setup.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759
  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/ide.h>
  44. #include <linux/pci.h>
  45. #include <linux/adb.h>
  46. #include <linux/cuda.h>
  47. #include <linux/pmu.h>
  48. #include <linux/irq.h>
  49. #include <linux/seq_file.h>
  50. #include <linux/root_dev.h>
  51. #include <linux/bitops.h>
  52. #include <linux/suspend.h>
  53. #include <asm/reg.h>
  54. #include <asm/sections.h>
  55. #include <asm/prom.h>
  56. #include <asm/system.h>
  57. #include <asm/pgtable.h>
  58. #include <asm/io.h>
  59. #include <asm/kexec.h>
  60. #include <asm/pci-bridge.h>
  61. #include <asm/ohare.h>
  62. #include <asm/mediabay.h>
  63. #include <asm/machdep.h>
  64. #include <asm/dma.h>
  65. #include <asm/cputable.h>
  66. #include <asm/btext.h>
  67. #include <asm/pmac_feature.h>
  68. #include <asm/time.h>
  69. #include <asm/of_device.h>
  70. #include <asm/of_platform.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/lmb.h>
  76. #include <asm/udbg.h>
  77. #include "pmac.h"
  78. #undef SHOW_GATWICK_IRQS
  79. int ppc_override_l2cr = 0;
  80. int ppc_override_l2cr_value;
  81. int has_l2cache = 0;
  82. int pmac_newworld;
  83. static int current_root_goodness = -1;
  84. extern struct machdep_calls pmac_md;
  85. #define DEFAULT_ROOT_DEVICE Root_SDA1 /* sda1 - slightly silly choice */
  86. #ifdef CONFIG_PPC64
  87. #include <asm/udbg.h>
  88. int sccdbg;
  89. #endif
  90. extern void zs_kgdb_hook(int tty_num);
  91. sys_ctrler_t sys_ctrler = SYS_CTRLER_UNKNOWN;
  92. EXPORT_SYMBOL(sys_ctrler);
  93. #ifdef CONFIG_PMAC_SMU
  94. unsigned long smu_cmdbuf_abs;
  95. EXPORT_SYMBOL(smu_cmdbuf_abs);
  96. #endif
  97. #ifdef CONFIG_SMP
  98. extern struct smp_ops_t psurge_smp_ops;
  99. extern struct smp_ops_t core99_smp_ops;
  100. #endif /* CONFIG_SMP */
  101. static void pmac_show_cpuinfo(struct seq_file *m)
  102. {
  103. struct device_node *np;
  104. const char *pp;
  105. int plen;
  106. int mbmodel;
  107. unsigned int mbflags;
  108. char* mbname;
  109. mbmodel = pmac_call_feature(PMAC_FTR_GET_MB_INFO, NULL,
  110. PMAC_MB_INFO_MODEL, 0);
  111. mbflags = pmac_call_feature(PMAC_FTR_GET_MB_INFO, NULL,
  112. PMAC_MB_INFO_FLAGS, 0);
  113. if (pmac_call_feature(PMAC_FTR_GET_MB_INFO, NULL, PMAC_MB_INFO_NAME,
  114. (long) &mbname) != 0)
  115. mbname = "Unknown";
  116. /* find motherboard type */
  117. seq_printf(m, "machine\t\t: ");
  118. np = of_find_node_by_path("/");
  119. if (np != NULL) {
  120. pp = get_property(np, "model", NULL);
  121. if (pp != NULL)
  122. seq_printf(m, "%s\n", pp);
  123. else
  124. seq_printf(m, "PowerMac\n");
  125. pp = get_property(np, "compatible", &plen);
  126. if (pp != NULL) {
  127. seq_printf(m, "motherboard\t:");
  128. while (plen > 0) {
  129. int l = strlen(pp) + 1;
  130. seq_printf(m, " %s", pp);
  131. plen -= l;
  132. pp += l;
  133. }
  134. seq_printf(m, "\n");
  135. }
  136. of_node_put(np);
  137. } else
  138. seq_printf(m, "PowerMac\n");
  139. /* print parsed model */
  140. seq_printf(m, "detected as\t: %d (%s)\n", mbmodel, mbname);
  141. seq_printf(m, "pmac flags\t: %08x\n", mbflags);
  142. /* find l2 cache info */
  143. np = of_find_node_by_name(NULL, "l2-cache");
  144. if (np == NULL)
  145. np = of_find_node_by_type(NULL, "cache");
  146. if (np != NULL) {
  147. const unsigned int *ic = get_property(np, "i-cache-size", NULL);
  148. const unsigned int *dc = get_property(np, "d-cache-size", NULL);
  149. seq_printf(m, "L2 cache\t:");
  150. has_l2cache = 1;
  151. if (get_property(np, "cache-unified", NULL) != 0 && dc) {
  152. seq_printf(m, " %dK unified", *dc / 1024);
  153. } else {
  154. if (ic)
  155. seq_printf(m, " %dK instruction", *ic / 1024);
  156. if (dc)
  157. seq_printf(m, "%s %dK data",
  158. (ic? " +": ""), *dc / 1024);
  159. }
  160. pp = get_property(np, "ram-type", NULL);
  161. if (pp)
  162. seq_printf(m, " %s", pp);
  163. seq_printf(m, "\n");
  164. of_node_put(np);
  165. }
  166. /* Indicate newworld/oldworld */
  167. seq_printf(m, "pmac-generation\t: %s\n",
  168. pmac_newworld ? "NewWorld" : "OldWorld");
  169. }
  170. #ifndef CONFIG_ADB_CUDA
  171. int find_via_cuda(void)
  172. {
  173. if (!find_devices("via-cuda"))
  174. return 0;
  175. printk("WARNING ! Your machine is CUDA-based but your kernel\n");
  176. printk(" wasn't compiled with CONFIG_ADB_CUDA option !\n");
  177. return 0;
  178. }
  179. #endif
  180. #ifndef CONFIG_ADB_PMU
  181. int find_via_pmu(void)
  182. {
  183. if (!find_devices("via-pmu"))
  184. return 0;
  185. printk("WARNING ! Your machine is PMU-based but your kernel\n");
  186. printk(" wasn't compiled with CONFIG_ADB_PMU option !\n");
  187. return 0;
  188. }
  189. #endif
  190. #ifndef CONFIG_PMAC_SMU
  191. int smu_init(void)
  192. {
  193. /* should check and warn if SMU is present */
  194. return 0;
  195. }
  196. #endif
  197. #ifdef CONFIG_PPC32
  198. static volatile u32 *sysctrl_regs;
  199. static void __init ohare_init(void)
  200. {
  201. /* this area has the CPU identification register
  202. and some registers used by smp boards */
  203. sysctrl_regs = (volatile u32 *) ioremap(0xf8000000, 0x1000);
  204. /*
  205. * Turn on the L2 cache.
  206. * We assume that we have a PSX memory controller iff
  207. * we have an ohare I/O controller.
  208. */
  209. if (find_devices("ohare") != NULL) {
  210. if (((sysctrl_regs[2] >> 24) & 0xf) >= 3) {
  211. if (sysctrl_regs[4] & 0x10)
  212. sysctrl_regs[4] |= 0x04000020;
  213. else
  214. sysctrl_regs[4] |= 0x04000000;
  215. if(has_l2cache)
  216. printk(KERN_INFO "Level 2 cache enabled\n");
  217. }
  218. }
  219. }
  220. static void __init l2cr_init(void)
  221. {
  222. /* Checks "l2cr-value" property in the registry */
  223. if (cpu_has_feature(CPU_FTR_L2CR)) {
  224. struct device_node *np = find_devices("cpus");
  225. if (np == 0)
  226. np = find_type_devices("cpu");
  227. if (np != 0) {
  228. const unsigned int *l2cr =
  229. get_property(np, "l2cr-value", NULL);
  230. if (l2cr != 0) {
  231. ppc_override_l2cr = 1;
  232. ppc_override_l2cr_value = *l2cr;
  233. _set_L2CR(0);
  234. _set_L2CR(ppc_override_l2cr_value);
  235. }
  236. }
  237. }
  238. if (ppc_override_l2cr)
  239. printk(KERN_INFO "L2CR overridden (0x%x), "
  240. "backside cache is %s\n",
  241. ppc_override_l2cr_value,
  242. (ppc_override_l2cr_value & 0x80000000)
  243. ? "enabled" : "disabled");
  244. }
  245. #endif
  246. static void __init pmac_setup_arch(void)
  247. {
  248. struct device_node *cpu, *ic;
  249. const int *fp;
  250. unsigned long pvr;
  251. pvr = PVR_VER(mfspr(SPRN_PVR));
  252. /* Set loops_per_jiffy to a half-way reasonable value,
  253. for use until calibrate_delay gets called. */
  254. loops_per_jiffy = 50000000 / HZ;
  255. cpu = of_find_node_by_type(NULL, "cpu");
  256. if (cpu != NULL) {
  257. fp = get_property(cpu, "clock-frequency", NULL);
  258. if (fp != NULL) {
  259. if (pvr >= 0x30 && pvr < 0x80)
  260. /* PPC970 etc. */
  261. loops_per_jiffy = *fp / (3 * HZ);
  262. else if (pvr == 4 || pvr >= 8)
  263. /* 604, G3, G4 etc. */
  264. loops_per_jiffy = *fp / HZ;
  265. else
  266. /* 601, 603, etc. */
  267. loops_per_jiffy = *fp / (2 * HZ);
  268. }
  269. of_node_put(cpu);
  270. }
  271. /* See if newworld or oldworld */
  272. for (ic = NULL; (ic = of_find_all_nodes(ic)) != NULL; )
  273. if (get_property(ic, "interrupt-controller", NULL))
  274. break;
  275. if (ic) {
  276. pmac_newworld = 1;
  277. of_node_put(ic);
  278. }
  279. /* Lookup PCI hosts */
  280. pmac_pci_init();
  281. #ifdef CONFIG_PPC32
  282. ohare_init();
  283. l2cr_init();
  284. #endif /* CONFIG_PPC32 */
  285. #ifdef CONFIG_KGDB
  286. zs_kgdb_hook(0);
  287. #endif
  288. find_via_cuda();
  289. find_via_pmu();
  290. smu_init();
  291. #if defined(CONFIG_NVRAM) || defined(CONFIG_PPC64)
  292. pmac_nvram_init();
  293. #endif
  294. #ifdef CONFIG_PPC32
  295. #ifdef CONFIG_BLK_DEV_INITRD
  296. if (initrd_start)
  297. ROOT_DEV = Root_RAM0;
  298. else
  299. #endif
  300. ROOT_DEV = DEFAULT_ROOT_DEVICE;
  301. #endif
  302. #ifdef CONFIG_SMP
  303. /* Check for Core99 */
  304. if (find_devices("uni-n") || find_devices("u3") || find_devices("u4"))
  305. smp_ops = &core99_smp_ops;
  306. #ifdef CONFIG_PPC32
  307. else
  308. smp_ops = &psurge_smp_ops;
  309. #endif
  310. #endif /* CONFIG_SMP */
  311. #ifdef CONFIG_ADB
  312. if (strstr(cmd_line, "adb_sync")) {
  313. extern int __adb_probe_sync;
  314. __adb_probe_sync = 1;
  315. }
  316. #endif /* CONFIG_ADB */
  317. }
  318. char *bootpath;
  319. char *bootdevice;
  320. void *boot_host;
  321. int boot_target;
  322. int boot_part;
  323. static dev_t boot_dev;
  324. #ifdef CONFIG_SCSI
  325. void __init note_scsi_host(struct device_node *node, void *host)
  326. {
  327. int l;
  328. char *p;
  329. l = strlen(node->full_name);
  330. if (bootpath != NULL && bootdevice != NULL
  331. && strncmp(node->full_name, bootdevice, l) == 0
  332. && (bootdevice[l] == '/' || bootdevice[l] == 0)) {
  333. boot_host = host;
  334. /*
  335. * There's a bug in OF 1.0.5. (Why am I not surprised.)
  336. * If you pass a path like scsi/sd@1:0 to canon, it returns
  337. * something like /bandit@F2000000/gc@10/53c94@10000/sd@0,0
  338. * That is, the scsi target number doesn't get preserved.
  339. * So we pick the target number out of bootpath and use that.
  340. */
  341. p = strstr(bootpath, "/sd@");
  342. if (p != NULL) {
  343. p += 4;
  344. boot_target = simple_strtoul(p, NULL, 10);
  345. p = strchr(p, ':');
  346. if (p != NULL)
  347. boot_part = simple_strtoul(p + 1, NULL, 10);
  348. }
  349. }
  350. }
  351. EXPORT_SYMBOL(note_scsi_host);
  352. #endif
  353. #if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC)
  354. static dev_t __init find_ide_boot(void)
  355. {
  356. char *p;
  357. int n;
  358. dev_t __init pmac_find_ide_boot(char *bootdevice, int n);
  359. if (bootdevice == NULL)
  360. return 0;
  361. p = strrchr(bootdevice, '/');
  362. if (p == NULL)
  363. return 0;
  364. n = p - bootdevice;
  365. return pmac_find_ide_boot(bootdevice, n);
  366. }
  367. #endif /* CONFIG_BLK_DEV_IDE && CONFIG_BLK_DEV_IDE_PMAC */
  368. static void __init find_boot_device(void)
  369. {
  370. #if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC)
  371. boot_dev = find_ide_boot();
  372. #endif
  373. }
  374. /* TODO: Merge the suspend-to-ram with the common code !!!
  375. * currently, this is a stub implementation for suspend-to-disk
  376. * only
  377. */
  378. #ifdef CONFIG_SOFTWARE_SUSPEND
  379. static int pmac_pm_prepare(suspend_state_t state)
  380. {
  381. printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);
  382. return 0;
  383. }
  384. static int pmac_pm_enter(suspend_state_t state)
  385. {
  386. printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);
  387. /* Giveup the lazy FPU & vec so we don't have to back them
  388. * up from the low level code
  389. */
  390. enable_kernel_fp();
  391. #ifdef CONFIG_ALTIVEC
  392. if (cur_cpu_spec->cpu_features & CPU_FTR_ALTIVEC)
  393. enable_kernel_altivec();
  394. #endif /* CONFIG_ALTIVEC */
  395. return 0;
  396. }
  397. static int pmac_pm_finish(suspend_state_t state)
  398. {
  399. printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);
  400. /* Restore userland MMU context */
  401. set_context(current->active_mm->context.id, current->active_mm->pgd);
  402. return 0;
  403. }
  404. static int pmac_pm_valid(suspend_state_t state)
  405. {
  406. switch (state) {
  407. case PM_SUSPEND_DISK:
  408. return 1;
  409. /* can't do any other states via generic mechanism yet */
  410. default:
  411. return 0;
  412. }
  413. }
  414. static struct pm_ops pmac_pm_ops = {
  415. .pm_disk_mode = PM_DISK_SHUTDOWN,
  416. .prepare = pmac_pm_prepare,
  417. .enter = pmac_pm_enter,
  418. .finish = pmac_pm_finish,
  419. .valid = pmac_pm_valid,
  420. };
  421. #endif /* CONFIG_SOFTWARE_SUSPEND */
  422. static int initializing = 1;
  423. static int pmac_late_init(void)
  424. {
  425. initializing = 0;
  426. #ifdef CONFIG_SOFTWARE_SUSPEND
  427. pm_set_ops(&pmac_pm_ops);
  428. #endif /* CONFIG_SOFTWARE_SUSPEND */
  429. return 0;
  430. }
  431. late_initcall(pmac_late_init);
  432. /* can't be __init - can be called whenever a disk is first accessed */
  433. void note_bootable_part(dev_t dev, int part, int goodness)
  434. {
  435. static int found_boot = 0;
  436. char *p;
  437. if (!initializing)
  438. return;
  439. if ((goodness <= current_root_goodness) &&
  440. ROOT_DEV != DEFAULT_ROOT_DEVICE)
  441. return;
  442. p = strstr(saved_command_line, "root=");
  443. if (p != NULL && (p == saved_command_line || p[-1] == ' '))
  444. return;
  445. if (!found_boot) {
  446. find_boot_device();
  447. found_boot = 1;
  448. }
  449. if (!boot_dev || dev == boot_dev) {
  450. ROOT_DEV = dev + part;
  451. boot_dev = 0;
  452. current_root_goodness = goodness;
  453. }
  454. }
  455. #ifdef CONFIG_ADB_CUDA
  456. static void cuda_restart(void)
  457. {
  458. struct adb_request req;
  459. cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_RESET_SYSTEM);
  460. for (;;)
  461. cuda_poll();
  462. }
  463. static void cuda_shutdown(void)
  464. {
  465. struct adb_request req;
  466. cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_POWERDOWN);
  467. for (;;)
  468. cuda_poll();
  469. }
  470. #else
  471. #define cuda_restart()
  472. #define cuda_shutdown()
  473. #endif
  474. #ifndef CONFIG_ADB_PMU
  475. #define pmu_restart()
  476. #define pmu_shutdown()
  477. #endif
  478. #ifndef CONFIG_PMAC_SMU
  479. #define smu_restart()
  480. #define smu_shutdown()
  481. #endif
  482. static void pmac_restart(char *cmd)
  483. {
  484. switch (sys_ctrler) {
  485. case SYS_CTRLER_CUDA:
  486. cuda_restart();
  487. break;
  488. case SYS_CTRLER_PMU:
  489. pmu_restart();
  490. break;
  491. case SYS_CTRLER_SMU:
  492. smu_restart();
  493. break;
  494. default: ;
  495. }
  496. }
  497. static void pmac_power_off(void)
  498. {
  499. switch (sys_ctrler) {
  500. case SYS_CTRLER_CUDA:
  501. cuda_shutdown();
  502. break;
  503. case SYS_CTRLER_PMU:
  504. pmu_shutdown();
  505. break;
  506. case SYS_CTRLER_SMU:
  507. smu_shutdown();
  508. break;
  509. default: ;
  510. }
  511. }
  512. static void
  513. pmac_halt(void)
  514. {
  515. pmac_power_off();
  516. }
  517. /*
  518. * Early initialization.
  519. */
  520. static void __init pmac_init_early(void)
  521. {
  522. /* Enable early btext debug if requested */
  523. if (strstr(cmd_line, "btextdbg")) {
  524. udbg_adb_init_early();
  525. register_early_udbg_console();
  526. }
  527. /* Probe motherboard chipset */
  528. pmac_feature_init();
  529. /* Initialize debug stuff */
  530. udbg_scc_init(!!strstr(cmd_line, "sccdbg"));
  531. udbg_adb_init(!!strstr(cmd_line, "btextdbg"));
  532. #ifdef CONFIG_PPC64
  533. iommu_init_early_dart();
  534. #endif
  535. }
  536. /*
  537. * pmac has no legacy IO, anything calling this function has to
  538. * fail or bad things will happen
  539. */
  540. static int pmac_check_legacy_ioport(unsigned int baseport)
  541. {
  542. return -ENODEV;
  543. }
  544. static int __init pmac_declare_of_platform_devices(void)
  545. {
  546. struct device_node *np;
  547. if (machine_is(chrp))
  548. return -1;
  549. if (!machine_is(powermac))
  550. return 0;
  551. np = of_find_node_by_name(NULL, "valkyrie");
  552. if (np)
  553. of_platform_device_create(np, "valkyrie", NULL);
  554. np = of_find_node_by_name(NULL, "platinum");
  555. if (np)
  556. of_platform_device_create(np, "platinum", NULL);
  557. np = of_find_node_by_type(NULL, "smu");
  558. if (np) {
  559. of_platform_device_create(np, "smu", NULL);
  560. of_node_put(np);
  561. }
  562. return 0;
  563. }
  564. device_initcall(pmac_declare_of_platform_devices);
  565. /*
  566. * Called very early, MMU is off, device-tree isn't unflattened
  567. */
  568. static int __init pmac_probe(void)
  569. {
  570. unsigned long root = of_get_flat_dt_root();
  571. if (!of_flat_dt_is_compatible(root, "Power Macintosh") &&
  572. !of_flat_dt_is_compatible(root, "MacRISC"))
  573. return 0;
  574. #ifdef CONFIG_PPC64
  575. /*
  576. * On U3, the DART (iommu) must be allocated now since it
  577. * has an impact on htab_initialize (due to the large page it
  578. * occupies having to be broken up so the DART itself is not
  579. * part of the cacheable linar mapping
  580. */
  581. alloc_dart_table();
  582. hpte_init_native();
  583. #endif
  584. #ifdef CONFIG_PPC32
  585. /* isa_io_base gets set in pmac_pci_init */
  586. ISA_DMA_THRESHOLD = ~0L;
  587. DMA_MODE_READ = 1;
  588. DMA_MODE_WRITE = 2;
  589. #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
  590. #ifdef CONFIG_BLK_DEV_IDE_PMAC
  591. ppc_ide_md.ide_init_hwif = pmac_ide_init_hwif_ports;
  592. ppc_ide_md.default_io_base = pmac_ide_get_base;
  593. #endif /* CONFIG_BLK_DEV_IDE_PMAC */
  594. #endif /* defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) */
  595. #endif /* CONFIG_PPC32 */
  596. #ifdef CONFIG_PMAC_SMU
  597. /*
  598. * SMU based G5s need some memory below 2Gb, at least the current
  599. * driver needs that. We have to allocate it now. We allocate 4k
  600. * (1 small page) for now.
  601. */
  602. smu_cmdbuf_abs = lmb_alloc_base(4096, 4096, 0x80000000UL);
  603. #endif /* CONFIG_PMAC_SMU */
  604. return 1;
  605. }
  606. #ifdef CONFIG_PPC64
  607. /* Move that to pci.c */
  608. static int pmac_pci_probe_mode(struct pci_bus *bus)
  609. {
  610. struct device_node *node = bus->sysdata;
  611. /* We need to use normal PCI probing for the AGP bus,
  612. * since the device for the AGP bridge isn't in the tree.
  613. */
  614. if (bus->self == NULL && (device_is_compatible(node, "u3-agp") ||
  615. device_is_compatible(node, "u4-pcie")))
  616. return PCI_PROBE_NORMAL;
  617. return PCI_PROBE_DEVTREE;
  618. }
  619. #endif
  620. define_machine(powermac) {
  621. .name = "PowerMac",
  622. .probe = pmac_probe,
  623. .setup_arch = pmac_setup_arch,
  624. .init_early = pmac_init_early,
  625. .show_cpuinfo = pmac_show_cpuinfo,
  626. .init_IRQ = pmac_pic_init,
  627. .get_irq = NULL, /* changed later */
  628. .pci_irq_fixup = pmac_pci_irq_fixup,
  629. .restart = pmac_restart,
  630. .power_off = pmac_power_off,
  631. .halt = pmac_halt,
  632. .time_init = pmac_time_init,
  633. .get_boot_time = pmac_get_boot_time,
  634. .set_rtc_time = pmac_set_rtc_time,
  635. .get_rtc_time = pmac_get_rtc_time,
  636. .calibrate_decr = pmac_calibrate_decr,
  637. .feature_call = pmac_do_feature_call,
  638. .check_legacy_ioport = pmac_check_legacy_ioport,
  639. .progress = udbg_progress,
  640. #ifdef CONFIG_PPC64
  641. .pci_probe_mode = pmac_pci_probe_mode,
  642. .power_save = power4_idle,
  643. .enable_pmcs = power4_enable_pmcs,
  644. #ifdef CONFIG_KEXEC
  645. .machine_kexec = default_machine_kexec,
  646. .machine_kexec_prepare = default_machine_kexec_prepare,
  647. .machine_crash_shutdown = default_machine_crash_shutdown,
  648. #endif
  649. #endif /* CONFIG_PPC64 */
  650. #ifdef CONFIG_PPC32
  651. .pcibios_enable_device_hook = pmac_pci_enable_device_hook,
  652. .pcibios_after_init = pmac_pcibios_after_init,
  653. .phys_mem_access_prot = pci_phys_mem_access_prot,
  654. #endif
  655. #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PPC64)
  656. .cpu_die = generic_mach_cpu_die,
  657. #endif
  658. };