setup.c 16 KB

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