setup.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729
  1. /* $Id: setup.c,v 1.72 2002/02/09 19:49:30 davem Exp $
  2. * linux/arch/sparc64/kernel/setup.c
  3. *
  4. * Copyright (C) 1995,1996 David S. Miller (davem@caip.rutgers.edu)
  5. * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
  6. */
  7. #include <linux/errno.h>
  8. #include <linux/sched.h>
  9. #include <linux/kernel.h>
  10. #include <linux/mm.h>
  11. #include <linux/stddef.h>
  12. #include <linux/unistd.h>
  13. #include <linux/ptrace.h>
  14. #include <linux/slab.h>
  15. #include <asm/smp.h>
  16. #include <linux/user.h>
  17. #include <linux/a.out.h>
  18. #include <linux/tty.h>
  19. #include <linux/delay.h>
  20. #include <linux/config.h>
  21. #include <linux/fs.h>
  22. #include <linux/seq_file.h>
  23. #include <linux/syscalls.h>
  24. #include <linux/kdev_t.h>
  25. #include <linux/major.h>
  26. #include <linux/string.h>
  27. #include <linux/init.h>
  28. #include <linux/inet.h>
  29. #include <linux/console.h>
  30. #include <linux/root_dev.h>
  31. #include <linux/interrupt.h>
  32. #include <linux/cpu.h>
  33. #include <linux/initrd.h>
  34. #include <asm/system.h>
  35. #include <asm/io.h>
  36. #include <asm/processor.h>
  37. #include <asm/oplib.h>
  38. #include <asm/page.h>
  39. #include <asm/pgtable.h>
  40. #include <asm/idprom.h>
  41. #include <asm/head.h>
  42. #include <asm/starfire.h>
  43. #include <asm/mmu_context.h>
  44. #include <asm/timer.h>
  45. #include <asm/sections.h>
  46. #include <asm/setup.h>
  47. #include <asm/mmu.h>
  48. #ifdef CONFIG_IP_PNP
  49. #include <net/ipconfig.h>
  50. #endif
  51. struct screen_info screen_info = {
  52. 0, 0, /* orig-x, orig-y */
  53. 0, /* unused */
  54. 0, /* orig-video-page */
  55. 0, /* orig-video-mode */
  56. 128, /* orig-video-cols */
  57. 0, 0, 0, /* unused, ega_bx, unused */
  58. 54, /* orig-video-lines */
  59. 0, /* orig-video-isVGA */
  60. 16 /* orig-video-points */
  61. };
  62. /* Typing sync at the prom prompt calls the function pointed to by
  63. * the sync callback which I set to the following function.
  64. * This should sync all filesystems and return, for now it just
  65. * prints out pretty messages and returns.
  66. */
  67. void (*prom_palette)(int);
  68. void (*prom_keyboard)(void);
  69. static void
  70. prom_console_write(struct console *con, const char *s, unsigned n)
  71. {
  72. prom_write(s, n);
  73. }
  74. static struct console prom_console = {
  75. .name = "prom",
  76. .write = prom_console_write,
  77. .flags = CON_CONSDEV | CON_ENABLED,
  78. .index = -1,
  79. };
  80. #define PROM_TRUE -1
  81. #define PROM_FALSE 0
  82. /* Pretty sick eh? */
  83. int prom_callback(long *args)
  84. {
  85. struct console *cons, *saved_console = NULL;
  86. unsigned long flags;
  87. char *cmd;
  88. extern spinlock_t prom_entry_lock;
  89. if (!args)
  90. return -1;
  91. if (!(cmd = (char *)args[0]))
  92. return -1;
  93. /*
  94. * The callback can be invoked on the cpu that first dropped
  95. * into prom_cmdline after taking the serial interrupt, or on
  96. * a slave processor that was smp_captured() if the
  97. * administrator has done a switch-cpu inside obp. In either
  98. * case, the cpu is marked as in-interrupt. Drop IRQ locks.
  99. */
  100. irq_exit();
  101. /* XXX Revisit the locking here someday. This is a debugging
  102. * XXX feature so it isnt all that critical. -DaveM
  103. */
  104. local_irq_save(flags);
  105. spin_unlock(&prom_entry_lock);
  106. cons = console_drivers;
  107. while (cons) {
  108. unregister_console(cons);
  109. cons->flags &= ~(CON_PRINTBUFFER);
  110. cons->next = saved_console;
  111. saved_console = cons;
  112. cons = console_drivers;
  113. }
  114. register_console(&prom_console);
  115. if (!strcmp(cmd, "sync")) {
  116. prom_printf("PROM `%s' command...\n", cmd);
  117. show_free_areas();
  118. if (current->pid != 0) {
  119. local_irq_enable();
  120. sys_sync();
  121. local_irq_disable();
  122. }
  123. args[2] = 0;
  124. args[args[1] + 3] = -1;
  125. prom_printf("Returning to PROM\n");
  126. } else if (!strcmp(cmd, "va>tte-data")) {
  127. unsigned long ctx, va;
  128. unsigned long tte = 0;
  129. long res = PROM_FALSE;
  130. ctx = args[3];
  131. va = args[4];
  132. if (ctx) {
  133. /*
  134. * Find process owning ctx, lookup mapping.
  135. */
  136. struct task_struct *p;
  137. struct mm_struct *mm = NULL;
  138. pgd_t *pgdp;
  139. pud_t *pudp;
  140. pmd_t *pmdp;
  141. pte_t *ptep;
  142. for_each_process(p) {
  143. mm = p->mm;
  144. if (CTX_NRBITS(mm->context) == ctx)
  145. break;
  146. }
  147. if (!mm ||
  148. CTX_NRBITS(mm->context) != ctx)
  149. goto done;
  150. pgdp = pgd_offset(mm, va);
  151. if (pgd_none(*pgdp))
  152. goto done;
  153. pudp = pud_offset(pgdp, va);
  154. if (pud_none(*pudp))
  155. goto done;
  156. pmdp = pmd_offset(pudp, va);
  157. if (pmd_none(*pmdp))
  158. goto done;
  159. /* Preemption implicitly disabled by virtue of
  160. * being called from inside OBP.
  161. */
  162. ptep = pte_offset_map(pmdp, va);
  163. if (pte_present(*ptep)) {
  164. tte = pte_val(*ptep);
  165. res = PROM_TRUE;
  166. }
  167. pte_unmap(ptep);
  168. goto done;
  169. }
  170. if ((va >= KERNBASE) && (va < (KERNBASE + (4 * 1024 * 1024)))) {
  171. unsigned long kernel_pctx = 0;
  172. if (tlb_type == cheetah_plus)
  173. kernel_pctx |= (CTX_CHEETAH_PLUS_NUC |
  174. CTX_CHEETAH_PLUS_CTX0);
  175. /* Spitfire Errata #32 workaround */
  176. __asm__ __volatile__("stxa %0, [%1] %2\n\t"
  177. "flush %%g6"
  178. : /* No outputs */
  179. : "r" (kernel_pctx),
  180. "r" (PRIMARY_CONTEXT),
  181. "i" (ASI_DMMU));
  182. /*
  183. * Locked down tlb entry.
  184. */
  185. if (tlb_type == spitfire)
  186. tte = spitfire_get_dtlb_data(SPITFIRE_HIGHEST_LOCKED_TLBENT);
  187. else if (tlb_type == cheetah || tlb_type == cheetah_plus)
  188. tte = cheetah_get_ldtlb_data(CHEETAH_HIGHEST_LOCKED_TLBENT);
  189. res = PROM_TRUE;
  190. goto done;
  191. }
  192. if (va < PGDIR_SIZE) {
  193. /*
  194. * vmalloc or prom_inherited mapping.
  195. */
  196. pgd_t *pgdp;
  197. pud_t *pudp;
  198. pmd_t *pmdp;
  199. pte_t *ptep;
  200. int error;
  201. if ((va >= LOW_OBP_ADDRESS) && (va < HI_OBP_ADDRESS)) {
  202. tte = prom_virt_to_phys(va, &error);
  203. if (!error)
  204. res = PROM_TRUE;
  205. goto done;
  206. }
  207. pgdp = pgd_offset_k(va);
  208. if (pgd_none(*pgdp))
  209. goto done;
  210. pudp = pud_offset(pgdp, va);
  211. if (pud_none(*pudp))
  212. goto done;
  213. pmdp = pmd_offset(pudp, va);
  214. if (pmd_none(*pmdp))
  215. goto done;
  216. /* Preemption implicitly disabled by virtue of
  217. * being called from inside OBP.
  218. */
  219. ptep = pte_offset_kernel(pmdp, va);
  220. if (pte_present(*ptep)) {
  221. tte = pte_val(*ptep);
  222. res = PROM_TRUE;
  223. }
  224. goto done;
  225. }
  226. if (va < PAGE_OFFSET) {
  227. /*
  228. * No mappings here.
  229. */
  230. goto done;
  231. }
  232. if (va & (1UL << 40)) {
  233. /*
  234. * I/O page.
  235. */
  236. tte = (__pa(va) & _PAGE_PADDR) |
  237. _PAGE_VALID | _PAGE_SZ4MB |
  238. _PAGE_E | _PAGE_P | _PAGE_W;
  239. res = PROM_TRUE;
  240. goto done;
  241. }
  242. /*
  243. * Normal page.
  244. */
  245. tte = (__pa(va) & _PAGE_PADDR) |
  246. _PAGE_VALID | _PAGE_SZ4MB |
  247. _PAGE_CP | _PAGE_CV | _PAGE_P | _PAGE_W;
  248. res = PROM_TRUE;
  249. done:
  250. if (res == PROM_TRUE) {
  251. args[2] = 3;
  252. args[args[1] + 3] = 0;
  253. args[args[1] + 4] = res;
  254. args[args[1] + 5] = tte;
  255. } else {
  256. args[2] = 2;
  257. args[args[1] + 3] = 0;
  258. args[args[1] + 4] = res;
  259. }
  260. } else if (!strcmp(cmd, ".soft1")) {
  261. unsigned long tte;
  262. tte = args[3];
  263. prom_printf("%lx:\"%s%s%s%s%s\" ",
  264. (tte & _PAGE_SOFT) >> 7,
  265. tte & _PAGE_MODIFIED ? "M" : "-",
  266. tte & _PAGE_ACCESSED ? "A" : "-",
  267. tte & _PAGE_READ ? "W" : "-",
  268. tte & _PAGE_WRITE ? "R" : "-",
  269. tte & _PAGE_PRESENT ? "P" : "-");
  270. args[2] = 2;
  271. args[args[1] + 3] = 0;
  272. args[args[1] + 4] = PROM_TRUE;
  273. } else if (!strcmp(cmd, ".soft2")) {
  274. unsigned long tte;
  275. tte = args[3];
  276. prom_printf("%lx ", (tte & 0x07FC000000000000UL) >> 50);
  277. args[2] = 2;
  278. args[args[1] + 3] = 0;
  279. args[args[1] + 4] = PROM_TRUE;
  280. } else {
  281. prom_printf("unknown PROM `%s' command...\n", cmd);
  282. }
  283. unregister_console(&prom_console);
  284. while (saved_console) {
  285. cons = saved_console;
  286. saved_console = cons->next;
  287. register_console(cons);
  288. }
  289. spin_lock(&prom_entry_lock);
  290. local_irq_restore(flags);
  291. /*
  292. * Restore in-interrupt status for a resume from obp.
  293. */
  294. irq_enter();
  295. return 0;
  296. }
  297. unsigned int boot_flags = 0;
  298. #define BOOTME_DEBUG 0x1
  299. #define BOOTME_SINGLE 0x2
  300. /* Exported for mm/init.c:paging_init. */
  301. unsigned long cmdline_memory_size = 0;
  302. static struct console prom_debug_console = {
  303. .name = "debug",
  304. .write = prom_console_write,
  305. .flags = CON_PRINTBUFFER,
  306. .index = -1,
  307. };
  308. /* XXX Implement this at some point... */
  309. void kernel_enter_debugger(void)
  310. {
  311. }
  312. int obp_system_intr(void)
  313. {
  314. if (boot_flags & BOOTME_DEBUG) {
  315. printk("OBP: system interrupted\n");
  316. prom_halt();
  317. return 1;
  318. }
  319. return 0;
  320. }
  321. /*
  322. * Process kernel command line switches that are specific to the
  323. * SPARC or that require special low-level processing.
  324. */
  325. static void __init process_switch(char c)
  326. {
  327. switch (c) {
  328. case 'd':
  329. boot_flags |= BOOTME_DEBUG;
  330. break;
  331. case 's':
  332. boot_flags |= BOOTME_SINGLE;
  333. break;
  334. case 'h':
  335. prom_printf("boot_flags_init: Halt!\n");
  336. prom_halt();
  337. break;
  338. case 'p':
  339. /* Use PROM debug console. */
  340. register_console(&prom_debug_console);
  341. break;
  342. case 'P':
  343. /* Force UltraSPARC-III P-Cache on. */
  344. if (tlb_type != cheetah) {
  345. printk("BOOT: Ignoring P-Cache force option.\n");
  346. break;
  347. }
  348. cheetah_pcache_forced_on = 1;
  349. add_taint(TAINT_MACHINE_CHECK);
  350. cheetah_enable_pcache();
  351. break;
  352. default:
  353. printk("Unknown boot switch (-%c)\n", c);
  354. break;
  355. }
  356. }
  357. static void __init process_console(char *commands)
  358. {
  359. serial_console = 0;
  360. commands += 8;
  361. /* Linux-style serial */
  362. if (!strncmp(commands, "ttyS", 4))
  363. serial_console = simple_strtoul(commands + 4, NULL, 10) + 1;
  364. else if (!strncmp(commands, "tty", 3)) {
  365. char c = *(commands + 3);
  366. /* Solaris-style serial */
  367. if (c == 'a' || c == 'b') {
  368. serial_console = c - 'a' + 1;
  369. prom_printf ("Using /dev/tty%c as console.\n", c);
  370. }
  371. /* else Linux-style fbcon, not serial */
  372. }
  373. #if defined(CONFIG_PROM_CONSOLE)
  374. if (!strncmp(commands, "prom", 4)) {
  375. char *p;
  376. for (p = commands - 8; *p && *p != ' '; p++)
  377. *p = ' ';
  378. conswitchp = &prom_con;
  379. }
  380. #endif
  381. }
  382. static void __init boot_flags_init(char *commands)
  383. {
  384. while (*commands) {
  385. /* Move to the start of the next "argument". */
  386. while (*commands && *commands == ' ')
  387. commands++;
  388. /* Process any command switches, otherwise skip it. */
  389. if (*commands == '\0')
  390. break;
  391. if (*commands == '-') {
  392. commands++;
  393. while (*commands && *commands != ' ')
  394. process_switch(*commands++);
  395. continue;
  396. }
  397. if (!strncmp(commands, "console=", 8)) {
  398. process_console(commands);
  399. } else if (!strncmp(commands, "mem=", 4)) {
  400. /*
  401. * "mem=XXX[kKmM]" overrides the PROM-reported
  402. * memory size.
  403. */
  404. cmdline_memory_size = simple_strtoul(commands + 4,
  405. &commands, 0);
  406. if (*commands == 'K' || *commands == 'k') {
  407. cmdline_memory_size <<= 10;
  408. commands++;
  409. } else if (*commands=='M' || *commands=='m') {
  410. cmdline_memory_size <<= 20;
  411. commands++;
  412. }
  413. }
  414. while (*commands && *commands != ' ')
  415. commands++;
  416. }
  417. }
  418. extern int prom_probe_memory(void);
  419. extern unsigned long start, end;
  420. extern void panic_setup(char *, int *);
  421. extern unsigned short root_flags;
  422. extern unsigned short root_dev;
  423. extern unsigned short ram_flags;
  424. #define RAMDISK_IMAGE_START_MASK 0x07FF
  425. #define RAMDISK_PROMPT_FLAG 0x8000
  426. #define RAMDISK_LOAD_FLAG 0x4000
  427. extern int root_mountflags;
  428. char reboot_command[COMMAND_LINE_SIZE];
  429. static struct pt_regs fake_swapper_regs = { { 0, }, 0, 0, 0, 0 };
  430. void register_prom_callbacks(void)
  431. {
  432. prom_setcallback(prom_callback);
  433. prom_feval(": linux-va>tte-data 2 \" va>tte-data\" $callback drop ; "
  434. "' linux-va>tte-data to va>tte-data");
  435. prom_feval(": linux-.soft1 1 \" .soft1\" $callback 2drop ; "
  436. "' linux-.soft1 to .soft1");
  437. prom_feval(": linux-.soft2 1 \" .soft2\" $callback 2drop ; "
  438. "' linux-.soft2 to .soft2");
  439. }
  440. extern void paging_init(void);
  441. void __init setup_arch(char **cmdline_p)
  442. {
  443. unsigned long highest_paddr;
  444. int i;
  445. /* Initialize PROM console and command line. */
  446. *cmdline_p = prom_getbootargs();
  447. strcpy(saved_command_line, *cmdline_p);
  448. printk("ARCH: SUN4U\n");
  449. #ifdef CONFIG_DUMMY_CONSOLE
  450. conswitchp = &dummy_con;
  451. #elif defined(CONFIG_PROM_CONSOLE)
  452. conswitchp = &prom_con;
  453. #endif
  454. /* Work out if we are starfire early on */
  455. check_if_starfire();
  456. boot_flags_init(*cmdline_p);
  457. idprom_init();
  458. (void) prom_probe_memory();
  459. /* In paging_init() we tip off this value to see if we need
  460. * to change init_mm.pgd to point to the real alias mapping.
  461. */
  462. phys_base = 0xffffffffffffffffUL;
  463. highest_paddr = 0UL;
  464. for (i = 0; sp_banks[i].num_bytes != 0; i++) {
  465. unsigned long top;
  466. if (sp_banks[i].base_addr < phys_base)
  467. phys_base = sp_banks[i].base_addr;
  468. top = sp_banks[i].base_addr +
  469. sp_banks[i].num_bytes;
  470. if (highest_paddr < top)
  471. highest_paddr = top;
  472. }
  473. pfn_base = phys_base >> PAGE_SHIFT;
  474. switch (tlb_type) {
  475. default:
  476. case spitfire:
  477. kern_base = spitfire_get_itlb_data(sparc64_highest_locked_tlbent());
  478. kern_base &= _PAGE_PADDR_SF;
  479. break;
  480. case cheetah:
  481. case cheetah_plus:
  482. kern_base = cheetah_get_litlb_data(sparc64_highest_locked_tlbent());
  483. kern_base &= _PAGE_PADDR;
  484. break;
  485. };
  486. kern_size = (unsigned long)&_end - (unsigned long)KERNBASE;
  487. if (!root_flags)
  488. root_mountflags &= ~MS_RDONLY;
  489. ROOT_DEV = old_decode_dev(root_dev);
  490. #ifdef CONFIG_BLK_DEV_INITRD
  491. rd_image_start = ram_flags & RAMDISK_IMAGE_START_MASK;
  492. rd_prompt = ((ram_flags & RAMDISK_PROMPT_FLAG) != 0);
  493. rd_doload = ((ram_flags & RAMDISK_LOAD_FLAG) != 0);
  494. #endif
  495. init_task.thread_info->kregs = &fake_swapper_regs;
  496. #ifdef CONFIG_IP_PNP
  497. if (!ic_set_manually) {
  498. int chosen = prom_finddevice ("/chosen");
  499. u32 cl, sv, gw;
  500. cl = prom_getintdefault (chosen, "client-ip", 0);
  501. sv = prom_getintdefault (chosen, "server-ip", 0);
  502. gw = prom_getintdefault (chosen, "gateway-ip", 0);
  503. if (cl && sv) {
  504. ic_myaddr = cl;
  505. ic_servaddr = sv;
  506. if (gw)
  507. ic_gateway = gw;
  508. #if defined(CONFIG_IP_PNP_BOOTP) || defined(CONFIG_IP_PNP_RARP)
  509. ic_proto_enabled = 0;
  510. #endif
  511. }
  512. }
  513. #endif
  514. paging_init();
  515. }
  516. static int __init set_preferred_console(void)
  517. {
  518. int idev, odev;
  519. /* The user has requested a console so this is already set up. */
  520. if (serial_console >= 0)
  521. return -EBUSY;
  522. idev = prom_query_input_device();
  523. odev = prom_query_output_device();
  524. if (idev == PROMDEV_IKBD && odev == PROMDEV_OSCREEN) {
  525. serial_console = 0;
  526. } else if (idev == PROMDEV_ITTYA && odev == PROMDEV_OTTYA) {
  527. serial_console = 1;
  528. } else if (idev == PROMDEV_ITTYB && odev == PROMDEV_OTTYB) {
  529. serial_console = 2;
  530. } else {
  531. prom_printf("Inconsistent console: "
  532. "input %d, output %d\n",
  533. idev, odev);
  534. prom_halt();
  535. }
  536. if (serial_console)
  537. return add_preferred_console("ttyS", serial_console - 1, NULL);
  538. return -ENODEV;
  539. }
  540. console_initcall(set_preferred_console);
  541. /* BUFFER is PAGE_SIZE bytes long. */
  542. extern char *sparc_cpu_type;
  543. extern char *sparc_fpu_type;
  544. extern void smp_info(struct seq_file *);
  545. extern void smp_bogo(struct seq_file *);
  546. extern void mmu_info(struct seq_file *);
  547. static int show_cpuinfo(struct seq_file *m, void *__unused)
  548. {
  549. seq_printf(m,
  550. "cpu\t\t: %s\n"
  551. "fpu\t\t: %s\n"
  552. "promlib\t\t: Version 3 Revision %d\n"
  553. "prom\t\t: %d.%d.%d\n"
  554. "type\t\t: sun4u\n"
  555. "ncpus probed\t: %ld\n"
  556. "ncpus active\t: %ld\n"
  557. #ifndef CONFIG_SMP
  558. "Cpu0Bogo\t: %lu.%02lu\n"
  559. "Cpu0ClkTck\t: %016lx\n"
  560. #endif
  561. ,
  562. sparc_cpu_type,
  563. sparc_fpu_type,
  564. prom_rev,
  565. prom_prev >> 16,
  566. (prom_prev >> 8) & 0xff,
  567. prom_prev & 0xff,
  568. (long)num_possible_cpus(),
  569. (long)num_online_cpus()
  570. #ifndef CONFIG_SMP
  571. , cpu_data(0).udelay_val/(500000/HZ),
  572. (cpu_data(0).udelay_val/(5000/HZ)) % 100,
  573. cpu_data(0).clock_tick
  574. #endif
  575. );
  576. #ifdef CONFIG_SMP
  577. smp_bogo(m);
  578. #endif
  579. mmu_info(m);
  580. #ifdef CONFIG_SMP
  581. smp_info(m);
  582. #endif
  583. return 0;
  584. }
  585. static void *c_start(struct seq_file *m, loff_t *pos)
  586. {
  587. /* The pointer we are returning is arbitrary,
  588. * it just has to be non-NULL and not IS_ERR
  589. * in the success case.
  590. */
  591. return *pos == 0 ? &c_start : NULL;
  592. }
  593. static void *c_next(struct seq_file *m, void *v, loff_t *pos)
  594. {
  595. ++*pos;
  596. return c_start(m, pos);
  597. }
  598. static void c_stop(struct seq_file *m, void *v)
  599. {
  600. }
  601. struct seq_operations cpuinfo_op = {
  602. .start =c_start,
  603. .next = c_next,
  604. .stop = c_stop,
  605. .show = show_cpuinfo,
  606. };
  607. extern int stop_a_enabled;
  608. void sun_do_break(void)
  609. {
  610. if (!stop_a_enabled)
  611. return;
  612. prom_printf("\n");
  613. flush_user_windows();
  614. prom_cmdline();
  615. }
  616. int serial_console = -1;
  617. int stop_a_enabled = 1;
  618. static int __init topology_init(void)
  619. {
  620. int i, err;
  621. err = -ENOMEM;
  622. for (i = 0; i < NR_CPUS; i++) {
  623. if (cpu_possible(i)) {
  624. struct cpu *p = kmalloc(sizeof(*p), GFP_KERNEL);
  625. if (p) {
  626. memset(p, 0, sizeof(*p));
  627. register_cpu(p, i, NULL);
  628. err = 0;
  629. }
  630. }
  631. }
  632. return err;
  633. }
  634. subsys_initcall(topology_init);