setup.c 17 KB

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