setup.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758
  1. /*
  2. * Powermac setup and early boot code plus other random bits.
  3. *
  4. * PowerPC version
  5. * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
  6. *
  7. * Adapted for Power Macintosh by Paul Mackerras
  8. * Copyright (C) 1996 Paul Mackerras (paulus@samba.org)
  9. *
  10. * Derived from "arch/alpha/kernel/setup.c"
  11. * Copyright (C) 1995 Linus Torvalds
  12. *
  13. * Maintained by Benjamin Herrenschmidt (benh@kernel.crashing.org)
  14. *
  15. * This program is free software; you can redistribute it and/or
  16. * modify it under the terms of the GNU General Public License
  17. * as published by the Free Software Foundation; either version
  18. * 2 of the License, or (at your option) any later version.
  19. *
  20. */
  21. /*
  22. * bootup setup stuff..
  23. */
  24. #include <linux/init.h>
  25. #include <linux/errno.h>
  26. #include <linux/sched.h>
  27. #include <linux/kernel.h>
  28. #include <linux/mm.h>
  29. #include <linux/stddef.h>
  30. #include <linux/unistd.h>
  31. #include <linux/ptrace.h>
  32. #include <linux/slab.h>
  33. #include <linux/user.h>
  34. #include <linux/a.out.h>
  35. #include <linux/tty.h>
  36. #include <linux/string.h>
  37. #include <linux/delay.h>
  38. #include <linux/ioport.h>
  39. #include <linux/major.h>
  40. #include <linux/initrd.h>
  41. #include <linux/vt_kern.h>
  42. #include <linux/console.h>
  43. #include <linux/pci.h>
  44. #include <linux/adb.h>
  45. #include <linux/cuda.h>
  46. #include <linux/pmu.h>
  47. #include <linux/irq.h>
  48. #include <linux/seq_file.h>
  49. #include <linux/root_dev.h>
  50. #include <linux/bitops.h>
  51. #include <linux/suspend.h>
  52. #include <linux/of_device.h>
  53. #include <linux/of_platform.h>
  54. #include <linux/lmb.h>
  55. #include <asm/reg.h>
  56. #include <asm/sections.h>
  57. #include <asm/prom.h>
  58. #include <asm/system.h>
  59. #include <asm/pgtable.h>
  60. #include <asm/io.h>
  61. #include <asm/kexec.h>
  62. #include <asm/pci-bridge.h>
  63. #include <asm/ohare.h>
  64. #include <asm/mediabay.h>
  65. #include <asm/machdep.h>
  66. #include <asm/dma.h>
  67. #include <asm/cputable.h>
  68. #include <asm/btext.h>
  69. #include <asm/pmac_feature.h>
  70. #include <asm/time.h>
  71. #include <asm/mmu_context.h>
  72. #include <asm/iommu.h>
  73. #include <asm/smu.h>
  74. #include <asm/pmc.h>
  75. #include <asm/udbg.h>
  76. #include "pmac.h"
  77. #undef SHOW_GATWICK_IRQS
  78. int ppc_override_l2cr = 0;
  79. int ppc_override_l2cr_value;
  80. int has_l2cache = 0;
  81. int pmac_newworld;
  82. static int current_root_goodness = -1;
  83. extern struct machdep_calls pmac_md;
  84. #define DEFAULT_ROOT_DEVICE Root_SDA1 /* sda1 - slightly silly choice */
  85. #ifdef CONFIG_PPC64
  86. int sccdbg;
  87. #endif
  88. sys_ctrler_t sys_ctrler = SYS_CTRLER_UNKNOWN;
  89. EXPORT_SYMBOL(sys_ctrler);
  90. #ifdef CONFIG_PMAC_SMU
  91. unsigned long smu_cmdbuf_abs;
  92. EXPORT_SYMBOL(smu_cmdbuf_abs);
  93. #endif
  94. #ifdef CONFIG_SMP
  95. extern struct smp_ops_t psurge_smp_ops;
  96. extern struct smp_ops_t core99_smp_ops;
  97. #endif /* CONFIG_SMP */
  98. static void pmac_show_cpuinfo(struct seq_file *m)
  99. {
  100. struct device_node *np;
  101. const char *pp;
  102. int plen;
  103. int mbmodel;
  104. unsigned int mbflags;
  105. char* mbname;
  106. mbmodel = pmac_call_feature(PMAC_FTR_GET_MB_INFO, NULL,
  107. PMAC_MB_INFO_MODEL, 0);
  108. mbflags = pmac_call_feature(PMAC_FTR_GET_MB_INFO, NULL,
  109. PMAC_MB_INFO_FLAGS, 0);
  110. if (pmac_call_feature(PMAC_FTR_GET_MB_INFO, NULL, PMAC_MB_INFO_NAME,
  111. (long) &mbname) != 0)
  112. mbname = "Unknown";
  113. /* find motherboard type */
  114. seq_printf(m, "machine\t\t: ");
  115. np = of_find_node_by_path("/");
  116. if (np != NULL) {
  117. pp = of_get_property(np, "model", NULL);
  118. if (pp != NULL)
  119. seq_printf(m, "%s\n", pp);
  120. else
  121. seq_printf(m, "PowerMac\n");
  122. pp = of_get_property(np, "compatible", &plen);
  123. if (pp != NULL) {
  124. seq_printf(m, "motherboard\t:");
  125. while (plen > 0) {
  126. int l = strlen(pp) + 1;
  127. seq_printf(m, " %s", pp);
  128. plen -= l;
  129. pp += l;
  130. }
  131. seq_printf(m, "\n");
  132. }
  133. of_node_put(np);
  134. } else
  135. seq_printf(m, "PowerMac\n");
  136. /* print parsed model */
  137. seq_printf(m, "detected as\t: %d (%s)\n", mbmodel, mbname);
  138. seq_printf(m, "pmac flags\t: %08x\n", mbflags);
  139. /* find l2 cache info */
  140. np = of_find_node_by_name(NULL, "l2-cache");
  141. if (np == NULL)
  142. np = of_find_node_by_type(NULL, "cache");
  143. if (np != NULL) {
  144. const unsigned int *ic =
  145. of_get_property(np, "i-cache-size", NULL);
  146. const unsigned int *dc =
  147. of_get_property(np, "d-cache-size", NULL);
  148. seq_printf(m, "L2 cache\t:");
  149. has_l2cache = 1;
  150. if (of_get_property(np, "cache-unified", NULL) != 0 && dc) {
  151. seq_printf(m, " %dK unified", *dc / 1024);
  152. } else {
  153. if (ic)
  154. seq_printf(m, " %dK instruction", *ic / 1024);
  155. if (dc)
  156. seq_printf(m, "%s %dK data",
  157. (ic? " +": ""), *dc / 1024);
  158. }
  159. pp = of_get_property(np, "ram-type", NULL);
  160. if (pp)
  161. seq_printf(m, " %s", pp);
  162. seq_printf(m, "\n");
  163. of_node_put(np);
  164. }
  165. /* Indicate newworld/oldworld */
  166. seq_printf(m, "pmac-generation\t: %s\n",
  167. pmac_newworld ? "NewWorld" : "OldWorld");
  168. }
  169. #ifndef CONFIG_ADB_CUDA
  170. int find_via_cuda(void)
  171. {
  172. struct device_node *dn = of_find_node_by_name(NULL, "via-cuda");
  173. if (!dn)
  174. return 0;
  175. of_node_put(dn);
  176. printk("WARNING ! Your machine is CUDA-based but your kernel\n");
  177. printk(" wasn't compiled with CONFIG_ADB_CUDA option !\n");
  178. return 0;
  179. }
  180. #endif
  181. #ifndef CONFIG_ADB_PMU
  182. int find_via_pmu(void)
  183. {
  184. struct device_node *dn = of_find_node_by_name(NULL, "via-pmu");
  185. if (!dn)
  186. return 0;
  187. of_node_put(dn);
  188. printk("WARNING ! Your machine is PMU-based but your kernel\n");
  189. printk(" wasn't compiled with CONFIG_ADB_PMU option !\n");
  190. return 0;
  191. }
  192. #endif
  193. #ifndef CONFIG_PMAC_SMU
  194. int smu_init(void)
  195. {
  196. /* should check and warn if SMU is present */
  197. return 0;
  198. }
  199. #endif
  200. #ifdef CONFIG_PPC32
  201. static volatile u32 *sysctrl_regs;
  202. static void __init ohare_init(void)
  203. {
  204. struct device_node *dn;
  205. /* this area has the CPU identification register
  206. and some registers used by smp boards */
  207. sysctrl_regs = (volatile u32 *) ioremap(0xf8000000, 0x1000);
  208. /*
  209. * Turn on the L2 cache.
  210. * We assume that we have a PSX memory controller iff
  211. * we have an ohare I/O controller.
  212. */
  213. dn = of_find_node_by_name(NULL, "ohare");
  214. if (dn) {
  215. of_node_put(dn);
  216. if (((sysctrl_regs[2] >> 24) & 0xf) >= 3) {
  217. if (sysctrl_regs[4] & 0x10)
  218. sysctrl_regs[4] |= 0x04000020;
  219. else
  220. sysctrl_regs[4] |= 0x04000000;
  221. if(has_l2cache)
  222. printk(KERN_INFO "Level 2 cache enabled\n");
  223. }
  224. }
  225. }
  226. static void __init l2cr_init(void)
  227. {
  228. /* Checks "l2cr-value" property in the registry */
  229. if (cpu_has_feature(CPU_FTR_L2CR)) {
  230. struct device_node *np = of_find_node_by_name(NULL, "cpus");
  231. if (np == 0)
  232. np = of_find_node_by_type(NULL, "cpu");
  233. if (np != 0) {
  234. const unsigned int *l2cr =
  235. of_get_property(np, "l2cr-value", NULL);
  236. if (l2cr != 0) {
  237. ppc_override_l2cr = 1;
  238. ppc_override_l2cr_value = *l2cr;
  239. _set_L2CR(0);
  240. _set_L2CR(ppc_override_l2cr_value);
  241. }
  242. of_node_put(np);
  243. }
  244. }
  245. if (ppc_override_l2cr)
  246. printk(KERN_INFO "L2CR overridden (0x%x), "
  247. "backside cache is %s\n",
  248. ppc_override_l2cr_value,
  249. (ppc_override_l2cr_value & 0x80000000)
  250. ? "enabled" : "disabled");
  251. }
  252. #endif
  253. static void __init pmac_setup_arch(void)
  254. {
  255. struct device_node *cpu, *ic;
  256. const int *fp;
  257. unsigned long pvr;
  258. pvr = PVR_VER(mfspr(SPRN_PVR));
  259. /* Set loops_per_jiffy to a half-way reasonable value,
  260. for use until calibrate_delay gets called. */
  261. loops_per_jiffy = 50000000 / HZ;
  262. cpu = of_find_node_by_type(NULL, "cpu");
  263. if (cpu != NULL) {
  264. fp = of_get_property(cpu, "clock-frequency", NULL);
  265. if (fp != NULL) {
  266. if (pvr >= 0x30 && pvr < 0x80)
  267. /* PPC970 etc. */
  268. loops_per_jiffy = *fp / (3 * HZ);
  269. else if (pvr == 4 || pvr >= 8)
  270. /* 604, G3, G4 etc. */
  271. loops_per_jiffy = *fp / HZ;
  272. else
  273. /* 601, 603, etc. */
  274. loops_per_jiffy = *fp / (2 * HZ);
  275. }
  276. of_node_put(cpu);
  277. }
  278. /* See if newworld or oldworld */
  279. for (ic = NULL; (ic = of_find_all_nodes(ic)) != NULL; )
  280. if (of_get_property(ic, "interrupt-controller", NULL))
  281. break;
  282. if (ic) {
  283. pmac_newworld = 1;
  284. of_node_put(ic);
  285. }
  286. /* Lookup PCI hosts */
  287. pmac_pci_init();
  288. #ifdef CONFIG_PPC32
  289. ohare_init();
  290. l2cr_init();
  291. #endif /* CONFIG_PPC32 */
  292. find_via_cuda();
  293. find_via_pmu();
  294. smu_init();
  295. #if defined(CONFIG_NVRAM) || defined(CONFIG_NVRAM_MODULE) || \
  296. defined(CONFIG_PPC64)
  297. pmac_nvram_init();
  298. #endif
  299. #ifdef CONFIG_PPC32
  300. #ifdef CONFIG_BLK_DEV_INITRD
  301. if (initrd_start)
  302. ROOT_DEV = Root_RAM0;
  303. else
  304. #endif
  305. ROOT_DEV = DEFAULT_ROOT_DEVICE;
  306. #endif
  307. #ifdef CONFIG_SMP
  308. /* Check for Core99 */
  309. ic = of_find_node_by_name(NULL, "uni-n");
  310. if (!ic)
  311. ic = of_find_node_by_name(NULL, "u3");
  312. if (!ic)
  313. ic = of_find_node_by_name(NULL, "u4");
  314. if (ic) {
  315. of_node_put(ic);
  316. smp_ops = &core99_smp_ops;
  317. }
  318. #ifdef CONFIG_PPC32
  319. else {
  320. /*
  321. * We have to set bits in cpu_possible_map here since the
  322. * secondary CPU(s) aren't in the device tree, and
  323. * setup_per_cpu_areas only allocates per-cpu data for
  324. * CPUs in the cpu_possible_map.
  325. */
  326. int cpu;
  327. for (cpu = 1; cpu < 4 && cpu < NR_CPUS; ++cpu)
  328. cpu_set(cpu, cpu_possible_map);
  329. smp_ops = &psurge_smp_ops;
  330. }
  331. #endif
  332. #endif /* CONFIG_SMP */
  333. #ifdef CONFIG_ADB
  334. if (strstr(cmd_line, "adb_sync")) {
  335. extern int __adb_probe_sync;
  336. __adb_probe_sync = 1;
  337. }
  338. #endif /* CONFIG_ADB */
  339. }
  340. #ifdef CONFIG_SCSI
  341. void note_scsi_host(struct device_node *node, void *host)
  342. {
  343. }
  344. EXPORT_SYMBOL(note_scsi_host);
  345. #endif
  346. static int initializing = 1;
  347. static int pmac_late_init(void)
  348. {
  349. initializing = 0;
  350. /* this is udbg (which is __init) and we can later use it during
  351. * cpu hotplug (in smp_core99_kick_cpu) */
  352. ppc_md.progress = NULL;
  353. return 0;
  354. }
  355. machine_late_initcall(powermac, pmac_late_init);
  356. /*
  357. * This is __init_refok because we check for "initializing" before
  358. * touching any of the __init sensitive things and "initializing"
  359. * will be false after __init time. This can't be __init because it
  360. * can be called whenever a disk is first accessed.
  361. */
  362. void __init_refok note_bootable_part(dev_t dev, int part, int goodness)
  363. {
  364. char *p;
  365. if (!initializing)
  366. return;
  367. if ((goodness <= current_root_goodness) &&
  368. ROOT_DEV != DEFAULT_ROOT_DEVICE)
  369. return;
  370. p = strstr(boot_command_line, "root=");
  371. if (p != NULL && (p == boot_command_line || p[-1] == ' '))
  372. return;
  373. ROOT_DEV = dev + part;
  374. current_root_goodness = goodness;
  375. }
  376. #ifdef CONFIG_ADB_CUDA
  377. static void cuda_restart(void)
  378. {
  379. struct adb_request req;
  380. cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_RESET_SYSTEM);
  381. for (;;)
  382. cuda_poll();
  383. }
  384. static void cuda_shutdown(void)
  385. {
  386. struct adb_request req;
  387. cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_POWERDOWN);
  388. for (;;)
  389. cuda_poll();
  390. }
  391. #else
  392. #define cuda_restart()
  393. #define cuda_shutdown()
  394. #endif
  395. #ifndef CONFIG_ADB_PMU
  396. #define pmu_restart()
  397. #define pmu_shutdown()
  398. #endif
  399. #ifndef CONFIG_PMAC_SMU
  400. #define smu_restart()
  401. #define smu_shutdown()
  402. #endif
  403. static void pmac_restart(char *cmd)
  404. {
  405. switch (sys_ctrler) {
  406. case SYS_CTRLER_CUDA:
  407. cuda_restart();
  408. break;
  409. case SYS_CTRLER_PMU:
  410. pmu_restart();
  411. break;
  412. case SYS_CTRLER_SMU:
  413. smu_restart();
  414. break;
  415. default: ;
  416. }
  417. }
  418. static void pmac_power_off(void)
  419. {
  420. switch (sys_ctrler) {
  421. case SYS_CTRLER_CUDA:
  422. cuda_shutdown();
  423. break;
  424. case SYS_CTRLER_PMU:
  425. pmu_shutdown();
  426. break;
  427. case SYS_CTRLER_SMU:
  428. smu_shutdown();
  429. break;
  430. default: ;
  431. }
  432. }
  433. static void
  434. pmac_halt(void)
  435. {
  436. pmac_power_off();
  437. }
  438. /*
  439. * Early initialization.
  440. */
  441. static void __init pmac_init_early(void)
  442. {
  443. /* Enable early btext debug if requested */
  444. if (strstr(cmd_line, "btextdbg")) {
  445. udbg_adb_init_early();
  446. register_early_udbg_console();
  447. }
  448. /* Probe motherboard chipset */
  449. pmac_feature_init();
  450. /* Initialize debug stuff */
  451. udbg_scc_init(!!strstr(cmd_line, "sccdbg"));
  452. udbg_adb_init(!!strstr(cmd_line, "btextdbg"));
  453. #ifdef CONFIG_PPC64
  454. iommu_init_early_dart();
  455. #endif
  456. }
  457. static int __init pmac_declare_of_platform_devices(void)
  458. {
  459. struct device_node *np;
  460. if (machine_is(chrp))
  461. return -1;
  462. np = of_find_node_by_name(NULL, "valkyrie");
  463. if (np)
  464. of_platform_device_create(np, "valkyrie", NULL);
  465. np = of_find_node_by_name(NULL, "platinum");
  466. if (np)
  467. of_platform_device_create(np, "platinum", NULL);
  468. np = of_find_node_by_type(NULL, "smu");
  469. if (np) {
  470. of_platform_device_create(np, "smu", NULL);
  471. of_node_put(np);
  472. }
  473. return 0;
  474. }
  475. machine_device_initcall(powermac, pmac_declare_of_platform_devices);
  476. #ifdef CONFIG_SERIAL_PMACZILOG_CONSOLE
  477. /*
  478. * This is called very early, as part of console_init() (typically just after
  479. * time_init()). This function is respondible for trying to find a good
  480. * default console on serial ports. It tries to match the open firmware
  481. * default output with one of the available serial console drivers.
  482. */
  483. static int __init check_pmac_serial_console(void)
  484. {
  485. struct device_node *prom_stdout = NULL;
  486. int offset = 0;
  487. const char *name;
  488. #ifdef CONFIG_SERIAL_PMACZILOG_TTYS
  489. char *devname = "ttyS";
  490. #else
  491. char *devname = "ttyPZ";
  492. #endif
  493. pr_debug(" -> check_pmac_serial_console()\n");
  494. /* The user has requested a console so this is already set up. */
  495. if (strstr(boot_command_line, "console=")) {
  496. pr_debug(" console was specified !\n");
  497. return -EBUSY;
  498. }
  499. if (!of_chosen) {
  500. pr_debug(" of_chosen is NULL !\n");
  501. return -ENODEV;
  502. }
  503. /* We are getting a weird phandle from OF ... */
  504. /* ... So use the full path instead */
  505. name = of_get_property(of_chosen, "linux,stdout-path", NULL);
  506. if (name == NULL) {
  507. pr_debug(" no linux,stdout-path !\n");
  508. return -ENODEV;
  509. }
  510. prom_stdout = of_find_node_by_path(name);
  511. if (!prom_stdout) {
  512. pr_debug(" can't find stdout package %s !\n", name);
  513. return -ENODEV;
  514. }
  515. pr_debug("stdout is %s\n", prom_stdout->full_name);
  516. name = of_get_property(prom_stdout, "name", NULL);
  517. if (!name) {
  518. pr_debug(" stdout package has no name !\n");
  519. goto not_found;
  520. }
  521. if (strcmp(name, "ch-a") == 0)
  522. offset = 0;
  523. else if (strcmp(name, "ch-b") == 0)
  524. offset = 1;
  525. else
  526. goto not_found;
  527. of_node_put(prom_stdout);
  528. pr_debug("Found serial console at %s%d\n", devname, offset);
  529. return add_preferred_console(devname, offset, NULL);
  530. not_found:
  531. pr_debug("No preferred console found !\n");
  532. of_node_put(prom_stdout);
  533. return -ENODEV;
  534. }
  535. console_initcall(check_pmac_serial_console);
  536. #endif /* CONFIG_SERIAL_PMACZILOG_CONSOLE */
  537. /*
  538. * Called very early, MMU is off, device-tree isn't unflattened
  539. */
  540. static int __init pmac_probe(void)
  541. {
  542. unsigned long root = of_get_flat_dt_root();
  543. if (!of_flat_dt_is_compatible(root, "Power Macintosh") &&
  544. !of_flat_dt_is_compatible(root, "MacRISC"))
  545. return 0;
  546. #ifdef CONFIG_PPC64
  547. /*
  548. * On U3, the DART (iommu) must be allocated now since it
  549. * has an impact on htab_initialize (due to the large page it
  550. * occupies having to be broken up so the DART itself is not
  551. * part of the cacheable linar mapping
  552. */
  553. alloc_dart_table();
  554. hpte_init_native();
  555. #endif
  556. #ifdef CONFIG_PPC32
  557. /* isa_io_base gets set in pmac_pci_init */
  558. ISA_DMA_THRESHOLD = ~0L;
  559. DMA_MODE_READ = 1;
  560. DMA_MODE_WRITE = 2;
  561. #endif /* CONFIG_PPC32 */
  562. #ifdef CONFIG_PMAC_SMU
  563. /*
  564. * SMU based G5s need some memory below 2Gb, at least the current
  565. * driver needs that. We have to allocate it now. We allocate 4k
  566. * (1 small page) for now.
  567. */
  568. smu_cmdbuf_abs = lmb_alloc_base(4096, 4096, 0x80000000UL);
  569. #endif /* CONFIG_PMAC_SMU */
  570. return 1;
  571. }
  572. #ifdef CONFIG_PPC64
  573. /* Move that to pci.c */
  574. static int pmac_pci_probe_mode(struct pci_bus *bus)
  575. {
  576. struct device_node *node = bus->sysdata;
  577. /* We need to use normal PCI probing for the AGP bus,
  578. * since the device for the AGP bridge isn't in the tree.
  579. * Same for the PCIe host on U4 and the HT host bridge.
  580. */
  581. if (bus->self == NULL && (of_device_is_compatible(node, "u3-agp") ||
  582. of_device_is_compatible(node, "u4-pcie") ||
  583. of_device_is_compatible(node, "u3-ht")))
  584. return PCI_PROBE_NORMAL;
  585. return PCI_PROBE_DEVTREE;
  586. }
  587. #ifdef CONFIG_HOTPLUG_CPU
  588. /* access per cpu vars from generic smp.c */
  589. DECLARE_PER_CPU(int, cpu_state);
  590. static void pmac_cpu_die(void)
  591. {
  592. /*
  593. * turn off as much as possible, we'll be
  594. * kicked out as this will only be invoked
  595. * on core99 platforms for now ...
  596. */
  597. printk(KERN_INFO "CPU#%d offline\n", smp_processor_id());
  598. __get_cpu_var(cpu_state) = CPU_DEAD;
  599. smp_wmb();
  600. /*
  601. * during the path that leads here preemption is disabled,
  602. * reenable it now so that when coming up preempt count is
  603. * zero correctly
  604. */
  605. preempt_enable();
  606. /*
  607. * hard-disable interrupts for the non-NAP case, the NAP code
  608. * needs to re-enable interrupts (but soft-disables them)
  609. */
  610. hard_irq_disable();
  611. while (1) {
  612. /* let's not take timer interrupts too often ... */
  613. set_dec(0x7fffffff);
  614. /* should always be true at this point */
  615. if (cpu_has_feature(CPU_FTR_CAN_NAP))
  616. power4_cpu_offline_powersave();
  617. else {
  618. HMT_low();
  619. HMT_very_low();
  620. }
  621. }
  622. }
  623. #endif /* CONFIG_HOTPLUG_CPU */
  624. #endif /* CONFIG_PPC64 */
  625. define_machine(powermac) {
  626. .name = "PowerMac",
  627. .probe = pmac_probe,
  628. .setup_arch = pmac_setup_arch,
  629. .init_early = pmac_init_early,
  630. .show_cpuinfo = pmac_show_cpuinfo,
  631. .init_IRQ = pmac_pic_init,
  632. .get_irq = NULL, /* changed later */
  633. .pci_irq_fixup = pmac_pci_irq_fixup,
  634. .restart = pmac_restart,
  635. .power_off = pmac_power_off,
  636. .halt = pmac_halt,
  637. .time_init = pmac_time_init,
  638. .get_boot_time = pmac_get_boot_time,
  639. .set_rtc_time = pmac_set_rtc_time,
  640. .get_rtc_time = pmac_get_rtc_time,
  641. .calibrate_decr = pmac_calibrate_decr,
  642. .feature_call = pmac_do_feature_call,
  643. .progress = udbg_progress,
  644. #ifdef CONFIG_PPC64
  645. .pci_probe_mode = pmac_pci_probe_mode,
  646. .power_save = power4_idle,
  647. .enable_pmcs = power4_enable_pmcs,
  648. #ifdef CONFIG_KEXEC
  649. .machine_kexec = default_machine_kexec,
  650. .machine_kexec_prepare = default_machine_kexec_prepare,
  651. .machine_crash_shutdown = default_machine_crash_shutdown,
  652. #endif
  653. #endif /* CONFIG_PPC64 */
  654. #ifdef CONFIG_PPC32
  655. .pcibios_enable_device_hook = pmac_pci_enable_device_hook,
  656. .pcibios_after_init = pmac_pcibios_after_init,
  657. .phys_mem_access_prot = pci_phys_mem_access_prot,
  658. #endif
  659. #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PPC64)
  660. .cpu_die = pmac_cpu_die,
  661. #endif
  662. };