setup_64.c 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324
  1. /*
  2. *
  3. * Common boot and setup code.
  4. *
  5. * Copyright (C) 2001 PPC64 Team, IBM Corp
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version
  10. * 2 of the License, or (at your option) any later version.
  11. */
  12. #undef DEBUG
  13. #include <linux/config.h>
  14. #include <linux/module.h>
  15. #include <linux/string.h>
  16. #include <linux/sched.h>
  17. #include <linux/init.h>
  18. #include <linux/kernel.h>
  19. #include <linux/reboot.h>
  20. #include <linux/delay.h>
  21. #include <linux/initrd.h>
  22. #include <linux/ide.h>
  23. #include <linux/seq_file.h>
  24. #include <linux/ioport.h>
  25. #include <linux/console.h>
  26. #include <linux/utsname.h>
  27. #include <linux/tty.h>
  28. #include <linux/root_dev.h>
  29. #include <linux/notifier.h>
  30. #include <linux/cpu.h>
  31. #include <linux/unistd.h>
  32. #include <linux/serial.h>
  33. #include <linux/serial_8250.h>
  34. #include <asm/io.h>
  35. #include <asm/prom.h>
  36. #include <asm/processor.h>
  37. #include <asm/pgtable.h>
  38. #include <asm/bootinfo.h>
  39. #include <asm/smp.h>
  40. #include <asm/elf.h>
  41. #include <asm/machdep.h>
  42. #include <asm/paca.h>
  43. #include <asm/ppcdebug.h>
  44. #include <asm/time.h>
  45. #include <asm/cputable.h>
  46. #include <asm/sections.h>
  47. #include <asm/btext.h>
  48. #include <asm/nvram.h>
  49. #include <asm/setup.h>
  50. #include <asm/system.h>
  51. #include <asm/rtas.h>
  52. #include <asm/iommu.h>
  53. #include <asm/serial.h>
  54. #include <asm/cache.h>
  55. #include <asm/page.h>
  56. #include <asm/mmu.h>
  57. #include <asm/lmb.h>
  58. #include <asm/iSeries/ItLpNaca.h>
  59. #include <asm/firmware.h>
  60. #include <asm/systemcfg.h>
  61. #ifdef DEBUG
  62. #define DBG(fmt...) udbg_printf(fmt)
  63. #else
  64. #define DBG(fmt...)
  65. #endif
  66. /*
  67. * Here are some early debugging facilities. You can enable one
  68. * but your kernel will not boot on anything else if you do so
  69. */
  70. /* This one is for use on LPAR machines that support an HVC console
  71. * on vterm 0
  72. */
  73. extern void udbg_init_debug_lpar(void);
  74. /* This one is for use on Apple G5 machines
  75. */
  76. extern void udbg_init_pmac_realmode(void);
  77. /* That's RTAS panel debug */
  78. extern void call_rtas_display_status_delay(unsigned char c);
  79. /* Here's maple real mode debug */
  80. extern void udbg_init_maple_realmode(void);
  81. #define EARLY_DEBUG_INIT() do {} while(0)
  82. #if 0
  83. #define EARLY_DEBUG_INIT() udbg_init_debug_lpar()
  84. #define EARLY_DEBUG_INIT() udbg_init_maple_realmode()
  85. #define EARLY_DEBUG_INIT() udbg_init_pmac_realmode()
  86. #define EARLY_DEBUG_INIT() \
  87. do { udbg_putc = call_rtas_display_status_delay; } while(0)
  88. #endif
  89. /* extern void *stab; */
  90. extern unsigned long klimit;
  91. extern void mm_init_ppc64(void);
  92. extern void stab_initialize(unsigned long stab);
  93. extern void htab_initialize(void);
  94. extern void early_init_devtree(void *flat_dt);
  95. extern void unflatten_device_tree(void);
  96. extern void smp_release_cpus(void);
  97. int have_of = 1;
  98. int boot_cpuid = 0;
  99. int boot_cpuid_phys = 0;
  100. dev_t boot_dev;
  101. u64 ppc64_pft_size;
  102. struct ppc64_caches ppc64_caches;
  103. EXPORT_SYMBOL_GPL(ppc64_caches);
  104. /*
  105. * These are used in binfmt_elf.c to put aux entries on the stack
  106. * for each elf executable being started.
  107. */
  108. int dcache_bsize;
  109. int icache_bsize;
  110. int ucache_bsize;
  111. /* The main machine-dep calls structure
  112. */
  113. struct machdep_calls ppc_md;
  114. EXPORT_SYMBOL(ppc_md);
  115. #ifdef CONFIG_MAGIC_SYSRQ
  116. unsigned long SYSRQ_KEY;
  117. #endif /* CONFIG_MAGIC_SYSRQ */
  118. static int ppc64_panic_event(struct notifier_block *, unsigned long, void *);
  119. static struct notifier_block ppc64_panic_block = {
  120. .notifier_call = ppc64_panic_event,
  121. .priority = INT_MIN /* may not return; must be done last */
  122. };
  123. /*
  124. * Perhaps we can put the pmac screen_info[] here
  125. * on pmac as well so we don't need the ifdef's.
  126. * Until we get multiple-console support in here
  127. * that is. -- Cort
  128. * Maybe tie it to serial consoles, since this is really what
  129. * these processors use on existing boards. -- Dan
  130. */
  131. struct screen_info screen_info = {
  132. .orig_x = 0,
  133. .orig_y = 25,
  134. .orig_video_cols = 80,
  135. .orig_video_lines = 25,
  136. .orig_video_isVGA = 1,
  137. .orig_video_points = 16
  138. };
  139. #ifdef CONFIG_SMP
  140. static int smt_enabled_cmdline;
  141. /* Look for ibm,smt-enabled OF option */
  142. static void check_smt_enabled(void)
  143. {
  144. struct device_node *dn;
  145. char *smt_option;
  146. /* Allow the command line to overrule the OF option */
  147. if (smt_enabled_cmdline)
  148. return;
  149. dn = of_find_node_by_path("/options");
  150. if (dn) {
  151. smt_option = (char *)get_property(dn, "ibm,smt-enabled", NULL);
  152. if (smt_option) {
  153. if (!strcmp(smt_option, "on"))
  154. smt_enabled_at_boot = 1;
  155. else if (!strcmp(smt_option, "off"))
  156. smt_enabled_at_boot = 0;
  157. }
  158. }
  159. }
  160. /* Look for smt-enabled= cmdline option */
  161. static int __init early_smt_enabled(char *p)
  162. {
  163. smt_enabled_cmdline = 1;
  164. if (!p)
  165. return 0;
  166. if (!strcmp(p, "on") || !strcmp(p, "1"))
  167. smt_enabled_at_boot = 1;
  168. else if (!strcmp(p, "off") || !strcmp(p, "0"))
  169. smt_enabled_at_boot = 0;
  170. return 0;
  171. }
  172. early_param("smt-enabled", early_smt_enabled);
  173. /**
  174. * setup_cpu_maps - initialize the following cpu maps:
  175. * cpu_possible_map
  176. * cpu_present_map
  177. * cpu_sibling_map
  178. *
  179. * Having the possible map set up early allows us to restrict allocations
  180. * of things like irqstacks to num_possible_cpus() rather than NR_CPUS.
  181. *
  182. * We do not initialize the online map here; cpus set their own bits in
  183. * cpu_online_map as they come up.
  184. *
  185. * This function is valid only for Open Firmware systems. finish_device_tree
  186. * must be called before using this.
  187. *
  188. * While we're here, we may as well set the "physical" cpu ids in the paca.
  189. */
  190. static void __init setup_cpu_maps(void)
  191. {
  192. struct device_node *dn = NULL;
  193. int cpu = 0;
  194. int swap_cpuid = 0;
  195. check_smt_enabled();
  196. while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < NR_CPUS) {
  197. u32 *intserv;
  198. int j, len = sizeof(u32), nthreads;
  199. intserv = (u32 *)get_property(dn, "ibm,ppc-interrupt-server#s",
  200. &len);
  201. if (!intserv)
  202. intserv = (u32 *)get_property(dn, "reg", NULL);
  203. nthreads = len / sizeof(u32);
  204. for (j = 0; j < nthreads && cpu < NR_CPUS; j++) {
  205. cpu_set(cpu, cpu_present_map);
  206. set_hard_smp_processor_id(cpu, intserv[j]);
  207. if (intserv[j] == boot_cpuid_phys)
  208. swap_cpuid = cpu;
  209. cpu_set(cpu, cpu_possible_map);
  210. cpu++;
  211. }
  212. }
  213. /* Swap CPU id 0 with boot_cpuid_phys, so we can always assume that
  214. * boot cpu is logical 0.
  215. */
  216. if (boot_cpuid_phys != get_hard_smp_processor_id(0)) {
  217. u32 tmp;
  218. tmp = get_hard_smp_processor_id(0);
  219. set_hard_smp_processor_id(0, boot_cpuid_phys);
  220. set_hard_smp_processor_id(swap_cpuid, tmp);
  221. }
  222. /*
  223. * On pSeries LPAR, we need to know how many cpus
  224. * could possibly be added to this partition.
  225. */
  226. if (systemcfg->platform == PLATFORM_PSERIES_LPAR &&
  227. (dn = of_find_node_by_path("/rtas"))) {
  228. int num_addr_cell, num_size_cell, maxcpus;
  229. unsigned int *ireg;
  230. num_addr_cell = prom_n_addr_cells(dn);
  231. num_size_cell = prom_n_size_cells(dn);
  232. ireg = (unsigned int *)
  233. get_property(dn, "ibm,lrdr-capacity", NULL);
  234. if (!ireg)
  235. goto out;
  236. maxcpus = ireg[num_addr_cell + num_size_cell];
  237. /* Double maxcpus for processors which have SMT capability */
  238. if (cpu_has_feature(CPU_FTR_SMT))
  239. maxcpus *= 2;
  240. if (maxcpus > NR_CPUS) {
  241. printk(KERN_WARNING
  242. "Partition configured for %d cpus, "
  243. "operating system maximum is %d.\n",
  244. maxcpus, NR_CPUS);
  245. maxcpus = NR_CPUS;
  246. } else
  247. printk(KERN_INFO "Partition configured for %d cpus.\n",
  248. maxcpus);
  249. for (cpu = 0; cpu < maxcpus; cpu++)
  250. cpu_set(cpu, cpu_possible_map);
  251. out:
  252. of_node_put(dn);
  253. }
  254. /*
  255. * Do the sibling map; assume only two threads per processor.
  256. */
  257. for_each_cpu(cpu) {
  258. cpu_set(cpu, cpu_sibling_map[cpu]);
  259. if (cpu_has_feature(CPU_FTR_SMT))
  260. cpu_set(cpu ^ 0x1, cpu_sibling_map[cpu]);
  261. }
  262. systemcfg->processorCount = num_present_cpus();
  263. }
  264. #endif /* CONFIG_SMP */
  265. extern struct machdep_calls pSeries_md;
  266. extern struct machdep_calls pmac_md;
  267. extern struct machdep_calls maple_md;
  268. extern struct machdep_calls bpa_md;
  269. extern struct machdep_calls iseries_md;
  270. /* Ultimately, stuff them in an elf section like initcalls... */
  271. static struct machdep_calls __initdata *machines[] = {
  272. #ifdef CONFIG_PPC_PSERIES
  273. &pSeries_md,
  274. #endif /* CONFIG_PPC_PSERIES */
  275. #ifdef CONFIG_PPC_PMAC
  276. &pmac_md,
  277. #endif /* CONFIG_PPC_PMAC */
  278. #ifdef CONFIG_PPC_MAPLE
  279. &maple_md,
  280. #endif /* CONFIG_PPC_MAPLE */
  281. #ifdef CONFIG_PPC_BPA
  282. &bpa_md,
  283. #endif
  284. #ifdef CONFIG_PPC_ISERIES
  285. &iseries_md,
  286. #endif
  287. NULL
  288. };
  289. /*
  290. * Early initialization entry point. This is called by head.S
  291. * with MMU translation disabled. We rely on the "feature" of
  292. * the CPU that ignores the top 2 bits of the address in real
  293. * mode so we can access kernel globals normally provided we
  294. * only toy with things in the RMO region. From here, we do
  295. * some early parsing of the device-tree to setup out LMB
  296. * data structures, and allocate & initialize the hash table
  297. * and segment tables so we can start running with translation
  298. * enabled.
  299. *
  300. * It is this function which will call the probe() callback of
  301. * the various platform types and copy the matching one to the
  302. * global ppc_md structure. Your platform can eventually do
  303. * some very early initializations from the probe() routine, but
  304. * this is not recommended, be very careful as, for example, the
  305. * device-tree is not accessible via normal means at this point.
  306. */
  307. void __init early_setup(unsigned long dt_ptr)
  308. {
  309. struct paca_struct *lpaca = get_paca();
  310. static struct machdep_calls **mach;
  311. /*
  312. * Enable early debugging if any specified (see top of
  313. * this file)
  314. */
  315. EARLY_DEBUG_INIT();
  316. DBG(" -> early_setup()\n");
  317. /*
  318. * Fill the default DBG level (do we want to keep
  319. * that old mecanism around forever ?)
  320. */
  321. ppcdbg_initialize();
  322. /*
  323. * Do early initializations using the flattened device
  324. * tree, like retreiving the physical memory map or
  325. * calculating/retreiving the hash table size
  326. */
  327. early_init_devtree(__va(dt_ptr));
  328. /*
  329. * Iterate all ppc_md structures until we find the proper
  330. * one for the current machine type
  331. */
  332. DBG("Probing machine type for platform %x...\n",
  333. systemcfg->platform);
  334. for (mach = machines; *mach; mach++) {
  335. if ((*mach)->probe(systemcfg->platform))
  336. break;
  337. }
  338. /* What can we do if we didn't find ? */
  339. if (*mach == NULL) {
  340. DBG("No suitable machine found !\n");
  341. for (;;);
  342. }
  343. ppc_md = **mach;
  344. DBG("Found, Initializing memory management...\n");
  345. /*
  346. * Initialize stab / SLB management
  347. */
  348. if (!firmware_has_feature(FW_FEATURE_ISERIES))
  349. stab_initialize(lpaca->stab_real);
  350. /*
  351. * Initialize the MMU Hash table and create the linear mapping
  352. * of memory
  353. */
  354. htab_initialize();
  355. DBG(" <- early_setup()\n");
  356. }
  357. /*
  358. * Initialize some remaining members of the ppc64_caches and systemcfg structures
  359. * (at least until we get rid of them completely). This is mostly some
  360. * cache informations about the CPU that will be used by cache flush
  361. * routines and/or provided to userland
  362. */
  363. static void __init initialize_cache_info(void)
  364. {
  365. struct device_node *np;
  366. unsigned long num_cpus = 0;
  367. DBG(" -> initialize_cache_info()\n");
  368. for (np = NULL; (np = of_find_node_by_type(np, "cpu"));) {
  369. num_cpus += 1;
  370. /* We're assuming *all* of the CPUs have the same
  371. * d-cache and i-cache sizes... -Peter
  372. */
  373. if ( num_cpus == 1 ) {
  374. u32 *sizep, *lsizep;
  375. u32 size, lsize;
  376. const char *dc, *ic;
  377. /* Then read cache informations */
  378. if (systemcfg->platform == PLATFORM_POWERMAC) {
  379. dc = "d-cache-block-size";
  380. ic = "i-cache-block-size";
  381. } else {
  382. dc = "d-cache-line-size";
  383. ic = "i-cache-line-size";
  384. }
  385. size = 0;
  386. lsize = cur_cpu_spec->dcache_bsize;
  387. sizep = (u32 *)get_property(np, "d-cache-size", NULL);
  388. if (sizep != NULL)
  389. size = *sizep;
  390. lsizep = (u32 *) get_property(np, dc, NULL);
  391. if (lsizep != NULL)
  392. lsize = *lsizep;
  393. if (sizep == 0 || lsizep == 0)
  394. DBG("Argh, can't find dcache properties ! "
  395. "sizep: %p, lsizep: %p\n", sizep, lsizep);
  396. systemcfg->dcache_size = ppc64_caches.dsize = size;
  397. systemcfg->dcache_line_size =
  398. ppc64_caches.dline_size = lsize;
  399. ppc64_caches.log_dline_size = __ilog2(lsize);
  400. ppc64_caches.dlines_per_page = PAGE_SIZE / lsize;
  401. size = 0;
  402. lsize = cur_cpu_spec->icache_bsize;
  403. sizep = (u32 *)get_property(np, "i-cache-size", NULL);
  404. if (sizep != NULL)
  405. size = *sizep;
  406. lsizep = (u32 *)get_property(np, ic, NULL);
  407. if (lsizep != NULL)
  408. lsize = *lsizep;
  409. if (sizep == 0 || lsizep == 0)
  410. DBG("Argh, can't find icache properties ! "
  411. "sizep: %p, lsizep: %p\n", sizep, lsizep);
  412. systemcfg->icache_size = ppc64_caches.isize = size;
  413. systemcfg->icache_line_size =
  414. ppc64_caches.iline_size = lsize;
  415. ppc64_caches.log_iline_size = __ilog2(lsize);
  416. ppc64_caches.ilines_per_page = PAGE_SIZE / lsize;
  417. }
  418. }
  419. /* Add an eye catcher and the systemcfg layout version number */
  420. strcpy(systemcfg->eye_catcher, "SYSTEMCFG:PPC64");
  421. systemcfg->version.major = SYSTEMCFG_MAJOR;
  422. systemcfg->version.minor = SYSTEMCFG_MINOR;
  423. systemcfg->processor = mfspr(SPRN_PVR);
  424. DBG(" <- initialize_cache_info()\n");
  425. }
  426. static void __init check_for_initrd(void)
  427. {
  428. #ifdef CONFIG_BLK_DEV_INITRD
  429. u64 *prop;
  430. DBG(" -> check_for_initrd()\n");
  431. if (of_chosen) {
  432. prop = (u64 *)get_property(of_chosen,
  433. "linux,initrd-start", NULL);
  434. if (prop != NULL) {
  435. initrd_start = (unsigned long)__va(*prop);
  436. prop = (u64 *)get_property(of_chosen,
  437. "linux,initrd-end", NULL);
  438. if (prop != NULL) {
  439. initrd_end = (unsigned long)__va(*prop);
  440. initrd_below_start_ok = 1;
  441. } else
  442. initrd_start = 0;
  443. }
  444. }
  445. /* If we were passed an initrd, set the ROOT_DEV properly if the values
  446. * look sensible. If not, clear initrd reference.
  447. */
  448. if (initrd_start >= KERNELBASE && initrd_end >= KERNELBASE &&
  449. initrd_end > initrd_start)
  450. ROOT_DEV = Root_RAM0;
  451. else
  452. initrd_start = initrd_end = 0;
  453. if (initrd_start)
  454. printk("Found initrd at 0x%lx:0x%lx\n", initrd_start, initrd_end);
  455. DBG(" <- check_for_initrd()\n");
  456. #endif /* CONFIG_BLK_DEV_INITRD */
  457. }
  458. /*
  459. * Do some initial setup of the system. The parameters are those which
  460. * were passed in from the bootloader.
  461. */
  462. void __init setup_system(void)
  463. {
  464. DBG(" -> setup_system()\n");
  465. /*
  466. * Unflatten the device-tree passed by prom_init or kexec
  467. */
  468. unflatten_device_tree();
  469. /*
  470. * Fill the ppc64_caches & systemcfg structures with informations
  471. * retreived from the device-tree. Need to be called before
  472. * finish_device_tree() since the later requires some of the
  473. * informations filled up here to properly parse the interrupt
  474. * tree.
  475. * It also sets up the cache line sizes which allows to call
  476. * routines like flush_icache_range (used by the hash init
  477. * later on).
  478. */
  479. initialize_cache_info();
  480. #ifdef CONFIG_PPC_RTAS
  481. /*
  482. * Initialize RTAS if available
  483. */
  484. rtas_initialize();
  485. #endif /* CONFIG_PPC_RTAS */
  486. printk("%s:%d rtas.dev=%p (@ %p)\n", __FILE__, __LINE__, rtas.dev,
  487. &rtas.dev);
  488. /*
  489. * Check if we have an initrd provided via the device-tree
  490. */
  491. check_for_initrd();
  492. printk("%s:%d rtas.dev=%p\n", __FILE__, __LINE__, rtas.dev);
  493. /*
  494. * Do some platform specific early initializations, that includes
  495. * setting up the hash table pointers. It also sets up some interrupt-mapping
  496. * related options that will be used by finish_device_tree()
  497. */
  498. ppc_md.init_early();
  499. printk("%s:%d rtas.dev=%p\n", __FILE__, __LINE__, rtas.dev);
  500. /*
  501. * "Finish" the device-tree, that is do the actual parsing of
  502. * some of the properties like the interrupt map
  503. */
  504. finish_device_tree();
  505. printk("%s:%d rtas.dev=%p\n", __FILE__, __LINE__, rtas.dev);
  506. /*
  507. * Initialize xmon
  508. */
  509. #ifdef CONFIG_XMON_DEFAULT
  510. xmon_init(1);
  511. #endif
  512. printk("%s:%d rtas.dev=%p\n", __FILE__, __LINE__, rtas.dev);
  513. /*
  514. * Register early console
  515. */
  516. register_early_udbg_console();
  517. printk("%s:%d rtas.dev=%p\n", __FILE__, __LINE__, rtas.dev);
  518. /* Save unparsed command line copy for /proc/cmdline */
  519. strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE);
  520. parse_early_param();
  521. printk("%s:%d rtas.dev=%p\n", __FILE__, __LINE__, rtas.dev);
  522. #ifdef CONFIG_SMP
  523. /*
  524. * iSeries has already initialized the cpu maps at this point.
  525. */
  526. setup_cpu_maps();
  527. printk("%s:%d rtas.dev=%p\n", __FILE__, __LINE__, rtas.dev);
  528. /* Release secondary cpus out of their spinloops at 0x60 now that
  529. * we can map physical -> logical CPU ids
  530. */
  531. smp_release_cpus();
  532. printk("%s:%d rtas.dev=%p\n", __FILE__, __LINE__, rtas.dev);
  533. #endif
  534. printk("Starting Linux PPC64 %s\n", system_utsname.version);
  535. printk("-----------------------------------------------------\n");
  536. printk("ppc64_pft_size = 0x%lx\n", ppc64_pft_size);
  537. printk("ppc64_debug_switch = 0x%lx\n", ppc64_debug_switch);
  538. printk("ppc64_interrupt_controller = 0x%ld\n", ppc64_interrupt_controller);
  539. printk("systemcfg = 0x%p\n", systemcfg);
  540. printk("systemcfg->platform = 0x%x\n", systemcfg->platform);
  541. printk("systemcfg->processorCount = 0x%lx\n", systemcfg->processorCount);
  542. printk("systemcfg->physicalMemorySize = 0x%lx\n", systemcfg->physicalMemorySize);
  543. printk("ppc64_caches.dcache_line_size = 0x%x\n",
  544. ppc64_caches.dline_size);
  545. printk("ppc64_caches.icache_line_size = 0x%x\n",
  546. ppc64_caches.iline_size);
  547. printk("htab_address = 0x%p\n", htab_address);
  548. printk("htab_hash_mask = 0x%lx\n", htab_hash_mask);
  549. printk("-----------------------------------------------------\n");
  550. printk("%s:%d rtas.dev=%p\n", __FILE__, __LINE__, rtas.dev);
  551. mm_init_ppc64();
  552. printk("%s:%d rtas.dev=%p\n", __FILE__, __LINE__, rtas.dev);
  553. DBG(" <- setup_system()\n");
  554. }
  555. /* also used by kexec */
  556. void machine_shutdown(void)
  557. {
  558. if (ppc_md.nvram_sync)
  559. ppc_md.nvram_sync();
  560. }
  561. void machine_restart(char *cmd)
  562. {
  563. machine_shutdown();
  564. ppc_md.restart(cmd);
  565. #ifdef CONFIG_SMP
  566. smp_send_stop();
  567. #endif
  568. printk(KERN_EMERG "System Halted, OK to turn off power\n");
  569. local_irq_disable();
  570. while (1) ;
  571. }
  572. void machine_power_off(void)
  573. {
  574. machine_shutdown();
  575. ppc_md.power_off();
  576. #ifdef CONFIG_SMP
  577. smp_send_stop();
  578. #endif
  579. printk(KERN_EMERG "System Halted, OK to turn off power\n");
  580. local_irq_disable();
  581. while (1) ;
  582. }
  583. /* Used by the G5 thermal driver */
  584. EXPORT_SYMBOL_GPL(machine_power_off);
  585. void machine_halt(void)
  586. {
  587. machine_shutdown();
  588. ppc_md.halt();
  589. #ifdef CONFIG_SMP
  590. smp_send_stop();
  591. #endif
  592. printk(KERN_EMERG "System Halted, OK to turn off power\n");
  593. local_irq_disable();
  594. while (1) ;
  595. }
  596. static int ppc64_panic_event(struct notifier_block *this,
  597. unsigned long event, void *ptr)
  598. {
  599. ppc_md.panic((char *)ptr); /* May not return */
  600. return NOTIFY_DONE;
  601. }
  602. #ifdef CONFIG_SMP
  603. DEFINE_PER_CPU(unsigned int, pvr);
  604. #endif
  605. static int show_cpuinfo(struct seq_file *m, void *v)
  606. {
  607. unsigned long cpu_id = (unsigned long)v - 1;
  608. unsigned int pvr;
  609. unsigned short maj;
  610. unsigned short min;
  611. if (cpu_id == NR_CPUS) {
  612. seq_printf(m, "timebase\t: %lu\n", ppc_tb_freq);
  613. if (ppc_md.get_cpuinfo != NULL)
  614. ppc_md.get_cpuinfo(m);
  615. return 0;
  616. }
  617. /* We only show online cpus: disable preempt (overzealous, I
  618. * knew) to prevent cpu going down. */
  619. preempt_disable();
  620. if (!cpu_online(cpu_id)) {
  621. preempt_enable();
  622. return 0;
  623. }
  624. #ifdef CONFIG_SMP
  625. pvr = per_cpu(pvr, cpu_id);
  626. #else
  627. pvr = mfspr(SPRN_PVR);
  628. #endif
  629. maj = (pvr >> 8) & 0xFF;
  630. min = pvr & 0xFF;
  631. seq_printf(m, "processor\t: %lu\n", cpu_id);
  632. seq_printf(m, "cpu\t\t: ");
  633. if (cur_cpu_spec->pvr_mask)
  634. seq_printf(m, "%s", cur_cpu_spec->cpu_name);
  635. else
  636. seq_printf(m, "unknown (%08x)", pvr);
  637. #ifdef CONFIG_ALTIVEC
  638. if (cpu_has_feature(CPU_FTR_ALTIVEC))
  639. seq_printf(m, ", altivec supported");
  640. #endif /* CONFIG_ALTIVEC */
  641. seq_printf(m, "\n");
  642. /*
  643. * Assume here that all clock rates are the same in a
  644. * smp system. -- Cort
  645. */
  646. seq_printf(m, "clock\t\t: %lu.%06luMHz\n", ppc_proc_freq / 1000000,
  647. ppc_proc_freq % 1000000);
  648. seq_printf(m, "revision\t: %hd.%hd\n\n", maj, min);
  649. preempt_enable();
  650. return 0;
  651. }
  652. static void *c_start(struct seq_file *m, loff_t *pos)
  653. {
  654. return *pos <= NR_CPUS ? (void *)((*pos)+1) : NULL;
  655. }
  656. static void *c_next(struct seq_file *m, void *v, loff_t *pos)
  657. {
  658. ++*pos;
  659. return c_start(m, pos);
  660. }
  661. static void c_stop(struct seq_file *m, void *v)
  662. {
  663. }
  664. struct seq_operations cpuinfo_op = {
  665. .start =c_start,
  666. .next = c_next,
  667. .stop = c_stop,
  668. .show = show_cpuinfo,
  669. };
  670. /*
  671. * These three variables are used to save values passed to us by prom_init()
  672. * via the device tree. The TCE variables are needed because with a memory_limit
  673. * in force we may need to explicitly map the TCE are at the top of RAM.
  674. */
  675. unsigned long memory_limit;
  676. unsigned long tce_alloc_start;
  677. unsigned long tce_alloc_end;
  678. #ifdef CONFIG_PPC_ISERIES
  679. /*
  680. * On iSeries we just parse the mem=X option from the command line.
  681. * On pSeries it's a bit more complicated, see prom_init_mem()
  682. */
  683. static int __init early_parsemem(char *p)
  684. {
  685. if (!p)
  686. return 0;
  687. memory_limit = ALIGN(memparse(p, &p), PAGE_SIZE);
  688. return 0;
  689. }
  690. early_param("mem", early_parsemem);
  691. #endif /* CONFIG_PPC_ISERIES */
  692. #ifdef CONFIG_PPC_MULTIPLATFORM
  693. static int __init set_preferred_console(void)
  694. {
  695. struct device_node *prom_stdout = NULL;
  696. char *name;
  697. u32 *spd;
  698. int offset = 0;
  699. DBG(" -> set_preferred_console()\n");
  700. /* The user has requested a console so this is already set up. */
  701. if (strstr(saved_command_line, "console=")) {
  702. DBG(" console was specified !\n");
  703. return -EBUSY;
  704. }
  705. if (!of_chosen) {
  706. DBG(" of_chosen is NULL !\n");
  707. return -ENODEV;
  708. }
  709. /* We are getting a weird phandle from OF ... */
  710. /* ... So use the full path instead */
  711. name = (char *)get_property(of_chosen, "linux,stdout-path", NULL);
  712. if (name == NULL) {
  713. DBG(" no linux,stdout-path !\n");
  714. return -ENODEV;
  715. }
  716. prom_stdout = of_find_node_by_path(name);
  717. if (!prom_stdout) {
  718. DBG(" can't find stdout package %s !\n", name);
  719. return -ENODEV;
  720. }
  721. DBG("stdout is %s\n", prom_stdout->full_name);
  722. name = (char *)get_property(prom_stdout, "name", NULL);
  723. if (!name) {
  724. DBG(" stdout package has no name !\n");
  725. goto not_found;
  726. }
  727. spd = (u32 *)get_property(prom_stdout, "current-speed", NULL);
  728. if (0)
  729. ;
  730. #ifdef CONFIG_SERIAL_8250_CONSOLE
  731. else if (strcmp(name, "serial") == 0) {
  732. int i;
  733. u32 *reg = (u32 *)get_property(prom_stdout, "reg", &i);
  734. if (i > 8) {
  735. switch (reg[1]) {
  736. case 0x3f8:
  737. offset = 0;
  738. break;
  739. case 0x2f8:
  740. offset = 1;
  741. break;
  742. case 0x898:
  743. offset = 2;
  744. break;
  745. case 0x890:
  746. offset = 3;
  747. break;
  748. default:
  749. /* We dont recognise the serial port */
  750. goto not_found;
  751. }
  752. }
  753. }
  754. #endif /* CONFIG_SERIAL_8250_CONSOLE */
  755. #ifdef CONFIG_PPC_PSERIES
  756. else if (strcmp(name, "vty") == 0) {
  757. u32 *reg = (u32 *)get_property(prom_stdout, "reg", NULL);
  758. char *compat = (char *)get_property(prom_stdout, "compatible", NULL);
  759. if (reg && compat && (strcmp(compat, "hvterm-protocol") == 0)) {
  760. /* Host Virtual Serial Interface */
  761. int offset;
  762. switch (reg[0]) {
  763. case 0x30000000:
  764. offset = 0;
  765. break;
  766. case 0x30000001:
  767. offset = 1;
  768. break;
  769. default:
  770. goto not_found;
  771. }
  772. of_node_put(prom_stdout);
  773. DBG("Found hvsi console at offset %d\n", offset);
  774. return add_preferred_console("hvsi", offset, NULL);
  775. } else {
  776. /* pSeries LPAR virtual console */
  777. of_node_put(prom_stdout);
  778. DBG("Found hvc console\n");
  779. return add_preferred_console("hvc", 0, NULL);
  780. }
  781. }
  782. #endif /* CONFIG_PPC_PSERIES */
  783. #ifdef CONFIG_SERIAL_PMACZILOG_CONSOLE
  784. else if (strcmp(name, "ch-a") == 0)
  785. offset = 0;
  786. else if (strcmp(name, "ch-b") == 0)
  787. offset = 1;
  788. #endif /* CONFIG_SERIAL_PMACZILOG_CONSOLE */
  789. else
  790. goto not_found;
  791. of_node_put(prom_stdout);
  792. DBG("Found serial console at ttyS%d\n", offset);
  793. if (spd) {
  794. static char __initdata opt[16];
  795. sprintf(opt, "%d", *spd);
  796. return add_preferred_console("ttyS", offset, opt);
  797. } else
  798. return add_preferred_console("ttyS", offset, NULL);
  799. not_found:
  800. DBG("No preferred console found !\n");
  801. of_node_put(prom_stdout);
  802. return -ENODEV;
  803. }
  804. console_initcall(set_preferred_console);
  805. #endif /* CONFIG_PPC_MULTIPLATFORM */
  806. #ifdef CONFIG_IRQSTACKS
  807. static void __init irqstack_early_init(void)
  808. {
  809. unsigned int i;
  810. /*
  811. * interrupt stacks must be under 256MB, we cannot afford to take
  812. * SLB misses on them.
  813. */
  814. for_each_cpu(i) {
  815. softirq_ctx[i] = (struct thread_info *)__va(lmb_alloc_base(THREAD_SIZE,
  816. THREAD_SIZE, 0x10000000));
  817. hardirq_ctx[i] = (struct thread_info *)__va(lmb_alloc_base(THREAD_SIZE,
  818. THREAD_SIZE, 0x10000000));
  819. }
  820. }
  821. #else
  822. #define irqstack_early_init()
  823. #endif
  824. /*
  825. * Stack space used when we detect a bad kernel stack pointer, and
  826. * early in SMP boots before relocation is enabled.
  827. */
  828. static void __init emergency_stack_init(void)
  829. {
  830. unsigned long limit;
  831. unsigned int i;
  832. /*
  833. * Emergency stacks must be under 256MB, we cannot afford to take
  834. * SLB misses on them. The ABI also requires them to be 128-byte
  835. * aligned.
  836. *
  837. * Since we use these as temporary stacks during secondary CPU
  838. * bringup, we need to get at them in real mode. This means they
  839. * must also be within the RMO region.
  840. */
  841. limit = min(0x10000000UL, lmb.rmo_size);
  842. for_each_cpu(i)
  843. paca[i].emergency_sp = __va(lmb_alloc_base(PAGE_SIZE, 128,
  844. limit)) + PAGE_SIZE;
  845. }
  846. /*
  847. * Called from setup_arch to initialize the bitmap of available
  848. * syscalls in the systemcfg page
  849. */
  850. void __init setup_syscall_map(void)
  851. {
  852. unsigned int i, count64 = 0, count32 = 0;
  853. extern unsigned long *sys_call_table;
  854. extern unsigned long sys_ni_syscall;
  855. for (i = 0; i < __NR_syscalls; i++) {
  856. if (sys_call_table[i*2] != sys_ni_syscall) {
  857. count64++;
  858. systemcfg->syscall_map_64[i >> 5] |=
  859. 0x80000000UL >> (i & 0x1f);
  860. }
  861. if (sys_call_table[i*2+1] != sys_ni_syscall) {
  862. count32++;
  863. systemcfg->syscall_map_32[i >> 5] |=
  864. 0x80000000UL >> (i & 0x1f);
  865. }
  866. }
  867. printk(KERN_INFO "Syscall map setup, %d 32-bit and %d 64-bit syscalls\n",
  868. count32, count64);
  869. }
  870. /*
  871. * Called into from start_kernel, after lock_kernel has been called.
  872. * Initializes bootmem, which is unsed to manage page allocation until
  873. * mem_init is called.
  874. */
  875. void __init setup_arch(char **cmdline_p)
  876. {
  877. extern void do_init_bootmem(void);
  878. printk("%s:%d rtas.dev=%p\n", __FILE__, __LINE__, rtas.dev);
  879. ppc64_boot_msg(0x12, "Setup Arch");
  880. *cmdline_p = cmd_line;
  881. /*
  882. * Set cache line size based on type of cpu as a default.
  883. * Systems with OF can look in the properties on the cpu node(s)
  884. * for a possibly more accurate value.
  885. */
  886. dcache_bsize = ppc64_caches.dline_size;
  887. icache_bsize = ppc64_caches.iline_size;
  888. /* reboot on panic */
  889. panic_timeout = 180;
  890. printk("%s:%d rtas.dev=%p\n", __FILE__, __LINE__, rtas.dev);
  891. if (ppc_md.panic)
  892. notifier_chain_register(&panic_notifier_list, &ppc64_panic_block);
  893. init_mm.start_code = PAGE_OFFSET;
  894. init_mm.end_code = (unsigned long) _etext;
  895. init_mm.end_data = (unsigned long) _edata;
  896. init_mm.brk = klimit;
  897. irqstack_early_init();
  898. emergency_stack_init();
  899. printk("%s:%d rtas.dev=%p\n", __FILE__, __LINE__, rtas.dev);
  900. stabs_alloc();
  901. /* set up the bootmem stuff with available memory */
  902. do_init_bootmem();
  903. sparse_init();
  904. printk("%s:%d rtas.dev=%p\n", __FILE__, __LINE__, rtas.dev);
  905. /* initialize the syscall map in systemcfg */
  906. setup_syscall_map();
  907. ppc_md.setup_arch();
  908. /* Use the default idle loop if the platform hasn't provided one. */
  909. if (NULL == ppc_md.idle_loop) {
  910. ppc_md.idle_loop = default_idle;
  911. printk(KERN_INFO "Using default idle loop\n");
  912. }
  913. paging_init();
  914. ppc64_boot_msg(0x15, "Setup Done");
  915. }
  916. /* ToDo: do something useful if ppc_md is not yet setup. */
  917. #define PPC64_LINUX_FUNCTION 0x0f000000
  918. #define PPC64_IPL_MESSAGE 0xc0000000
  919. #define PPC64_TERM_MESSAGE 0xb0000000
  920. static void ppc64_do_msg(unsigned int src, const char *msg)
  921. {
  922. if (ppc_md.progress) {
  923. char buf[128];
  924. sprintf(buf, "%08X\n", src);
  925. ppc_md.progress(buf, 0);
  926. snprintf(buf, 128, "%s", msg);
  927. ppc_md.progress(buf, 0);
  928. }
  929. }
  930. /* Print a boot progress message. */
  931. void ppc64_boot_msg(unsigned int src, const char *msg)
  932. {
  933. ppc64_do_msg(PPC64_LINUX_FUNCTION|PPC64_IPL_MESSAGE|src, msg);
  934. printk("[boot]%04x %s\n", src, msg);
  935. }
  936. /* Print a termination message (print only -- does not stop the kernel) */
  937. void ppc64_terminate_msg(unsigned int src, const char *msg)
  938. {
  939. ppc64_do_msg(PPC64_LINUX_FUNCTION|PPC64_TERM_MESSAGE|src, msg);
  940. printk("[terminate]%04x %s\n", src, msg);
  941. }
  942. /* This should only be called on processor 0 during calibrate decr */
  943. void __init setup_default_decr(void)
  944. {
  945. struct paca_struct *lpaca = get_paca();
  946. lpaca->default_decr = tb_ticks_per_jiffy;
  947. lpaca->next_jiffy_update_tb = get_tb() + tb_ticks_per_jiffy;
  948. }
  949. #ifndef CONFIG_PPC_ISERIES
  950. /*
  951. * This function can be used by platforms to "find" legacy serial ports.
  952. * It works for "serial" nodes under an "isa" node, and will try to
  953. * respect the "ibm,aix-loc" property if any. It works with up to 8
  954. * ports.
  955. */
  956. #define MAX_LEGACY_SERIAL_PORTS 8
  957. static struct plat_serial8250_port serial_ports[MAX_LEGACY_SERIAL_PORTS+1];
  958. static unsigned int old_serial_count;
  959. void __init generic_find_legacy_serial_ports(u64 *physport,
  960. unsigned int *default_speed)
  961. {
  962. struct device_node *np;
  963. u32 *sizeprop;
  964. struct isa_reg_property {
  965. u32 space;
  966. u32 address;
  967. u32 size;
  968. };
  969. struct pci_reg_property {
  970. struct pci_address addr;
  971. u32 size_hi;
  972. u32 size_lo;
  973. };
  974. DBG(" -> generic_find_legacy_serial_port()\n");
  975. *physport = 0;
  976. if (default_speed)
  977. *default_speed = 0;
  978. np = of_find_node_by_path("/");
  979. if (!np)
  980. return;
  981. /* First fill our array */
  982. for (np = NULL; (np = of_find_node_by_type(np, "serial"));) {
  983. struct device_node *isa, *pci;
  984. struct isa_reg_property *reg;
  985. unsigned long phys_size, addr_size, io_base;
  986. u32 *rangesp;
  987. u32 *interrupts, *clk, *spd;
  988. char *typep;
  989. int index, rlen, rentsize;
  990. /* Ok, first check if it's under an "isa" parent */
  991. isa = of_get_parent(np);
  992. if (!isa || strcmp(isa->name, "isa")) {
  993. DBG("%s: no isa parent found\n", np->full_name);
  994. continue;
  995. }
  996. /* Now look for an "ibm,aix-loc" property that gives us ordering
  997. * if any...
  998. */
  999. typep = (char *)get_property(np, "ibm,aix-loc", NULL);
  1000. /* Get the ISA port number */
  1001. reg = (struct isa_reg_property *)get_property(np, "reg", NULL);
  1002. if (reg == NULL)
  1003. goto next_port;
  1004. /* We assume the interrupt number isn't translated ... */
  1005. interrupts = (u32 *)get_property(np, "interrupts", NULL);
  1006. /* get clock freq. if present */
  1007. clk = (u32 *)get_property(np, "clock-frequency", NULL);
  1008. /* get default speed if present */
  1009. spd = (u32 *)get_property(np, "current-speed", NULL);
  1010. /* Default to locate at end of array */
  1011. index = old_serial_count; /* end of the array by default */
  1012. /* If we have a location index, then use it */
  1013. if (typep && *typep == 'S') {
  1014. index = simple_strtol(typep+1, NULL, 0) - 1;
  1015. /* if index is out of range, use end of array instead */
  1016. if (index >= MAX_LEGACY_SERIAL_PORTS)
  1017. index = old_serial_count;
  1018. /* if our index is still out of range, that mean that
  1019. * array is full, we could scan for a free slot but that
  1020. * make little sense to bother, just skip the port
  1021. */
  1022. if (index >= MAX_LEGACY_SERIAL_PORTS)
  1023. goto next_port;
  1024. if (index >= old_serial_count)
  1025. old_serial_count = index + 1;
  1026. /* Check if there is a port who already claimed our slot */
  1027. if (serial_ports[index].iobase != 0) {
  1028. /* if we still have some room, move it, else override */
  1029. if (old_serial_count < MAX_LEGACY_SERIAL_PORTS) {
  1030. DBG("Moved legacy port %d -> %d\n", index,
  1031. old_serial_count);
  1032. serial_ports[old_serial_count++] =
  1033. serial_ports[index];
  1034. } else {
  1035. DBG("Replacing legacy port %d\n", index);
  1036. }
  1037. }
  1038. }
  1039. if (index >= MAX_LEGACY_SERIAL_PORTS)
  1040. goto next_port;
  1041. if (index >= old_serial_count)
  1042. old_serial_count = index + 1;
  1043. /* Now fill the entry */
  1044. memset(&serial_ports[index], 0, sizeof(struct plat_serial8250_port));
  1045. serial_ports[index].uartclk = clk ? *clk : BASE_BAUD * 16;
  1046. serial_ports[index].iobase = reg->address;
  1047. serial_ports[index].irq = interrupts ? interrupts[0] : 0;
  1048. serial_ports[index].flags = ASYNC_BOOT_AUTOCONF;
  1049. DBG("Added legacy port, index: %d, port: %x, irq: %d, clk: %d\n",
  1050. index,
  1051. serial_ports[index].iobase,
  1052. serial_ports[index].irq,
  1053. serial_ports[index].uartclk);
  1054. /* Get phys address of IO reg for port 1 */
  1055. if (index != 0)
  1056. goto next_port;
  1057. pci = of_get_parent(isa);
  1058. if (!pci) {
  1059. DBG("%s: no pci parent found\n", np->full_name);
  1060. goto next_port;
  1061. }
  1062. rangesp = (u32 *)get_property(pci, "ranges", &rlen);
  1063. if (rangesp == NULL) {
  1064. of_node_put(pci);
  1065. goto next_port;
  1066. }
  1067. rlen /= 4;
  1068. /* we need the #size-cells of the PCI bridge node itself */
  1069. phys_size = 1;
  1070. sizeprop = (u32 *)get_property(pci, "#size-cells", NULL);
  1071. if (sizeprop != NULL)
  1072. phys_size = *sizeprop;
  1073. /* we need the parent #addr-cells */
  1074. addr_size = prom_n_addr_cells(pci);
  1075. rentsize = 3 + addr_size + phys_size;
  1076. io_base = 0;
  1077. for (;rlen >= rentsize; rlen -= rentsize,rangesp += rentsize) {
  1078. if (((rangesp[0] >> 24) & 0x3) != 1)
  1079. continue; /* not IO space */
  1080. io_base = rangesp[3];
  1081. if (addr_size == 2)
  1082. io_base = (io_base << 32) | rangesp[4];
  1083. }
  1084. if (io_base != 0) {
  1085. *physport = io_base + reg->address;
  1086. if (default_speed && spd)
  1087. *default_speed = *spd;
  1088. }
  1089. of_node_put(pci);
  1090. next_port:
  1091. of_node_put(isa);
  1092. }
  1093. DBG(" <- generic_find_legacy_serial_port()\n");
  1094. }
  1095. static struct platform_device serial_device = {
  1096. .name = "serial8250",
  1097. .id = PLAT8250_DEV_PLATFORM,
  1098. .dev = {
  1099. .platform_data = serial_ports,
  1100. },
  1101. };
  1102. static int __init serial_dev_init(void)
  1103. {
  1104. return platform_device_register(&serial_device);
  1105. }
  1106. arch_initcall(serial_dev_init);
  1107. #endif /* CONFIG_PPC_ISERIES */
  1108. int check_legacy_ioport(unsigned long base_port)
  1109. {
  1110. if (ppc_md.check_legacy_ioport == NULL)
  1111. return 0;
  1112. return ppc_md.check_legacy_ioport(base_port);
  1113. }
  1114. EXPORT_SYMBOL(check_legacy_ioport);
  1115. #ifdef CONFIG_XMON
  1116. static int __init early_xmon(char *p)
  1117. {
  1118. /* ensure xmon is enabled */
  1119. if (p) {
  1120. if (strncmp(p, "on", 2) == 0)
  1121. xmon_init(1);
  1122. if (strncmp(p, "off", 3) == 0)
  1123. xmon_init(0);
  1124. if (strncmp(p, "early", 5) != 0)
  1125. return 0;
  1126. }
  1127. xmon_init(1);
  1128. debugger(NULL);
  1129. return 0;
  1130. }
  1131. early_param("xmon", early_xmon);
  1132. #endif
  1133. void cpu_die(void)
  1134. {
  1135. if (ppc_md.cpu_die)
  1136. ppc_md.cpu_die();
  1137. }