setup.c 17 KB

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