setup.c 33 KB

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