setup_64.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697
  1. /*
  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 <asm/smp.h>
  15. #include <linux/user.h>
  16. #include <linux/screen_info.h>
  17. #include <linux/delay.h>
  18. #include <linux/fs.h>
  19. #include <linux/seq_file.h>
  20. #include <linux/syscalls.h>
  21. #include <linux/kdev_t.h>
  22. #include <linux/major.h>
  23. #include <linux/string.h>
  24. #include <linux/init.h>
  25. #include <linux/inet.h>
  26. #include <linux/console.h>
  27. #include <linux/root_dev.h>
  28. #include <linux/interrupt.h>
  29. #include <linux/cpu.h>
  30. #include <linux/initrd.h>
  31. #include <linux/module.h>
  32. #include <linux/start_kernel.h>
  33. #include <linux/bootmem.h>
  34. #include <asm/io.h>
  35. #include <asm/processor.h>
  36. #include <asm/oplib.h>
  37. #include <asm/page.h>
  38. #include <asm/pgtable.h>
  39. #include <asm/idprom.h>
  40. #include <asm/head.h>
  41. #include <asm/starfire.h>
  42. #include <asm/mmu_context.h>
  43. #include <asm/timer.h>
  44. #include <asm/sections.h>
  45. #include <asm/setup.h>
  46. #include <asm/mmu.h>
  47. #include <asm/ns87303.h>
  48. #include <asm/btext.h>
  49. #include <asm/elf.h>
  50. #include <asm/mdesc.h>
  51. #include <asm/cacheflush.h>
  52. #include <asm/dma.h>
  53. #include <asm/irq.h>
  54. #ifdef CONFIG_IP_PNP
  55. #include <net/ipconfig.h>
  56. #endif
  57. #include "entry.h"
  58. #include "kernel.h"
  59. /* Used to synchronize accesses to NatSemi SUPER I/O chip configure
  60. * operations in asm/ns87303.h
  61. */
  62. DEFINE_SPINLOCK(ns87303_lock);
  63. EXPORT_SYMBOL(ns87303_lock);
  64. struct screen_info screen_info = {
  65. 0, 0, /* orig-x, orig-y */
  66. 0, /* unused */
  67. 0, /* orig-video-page */
  68. 0, /* orig-video-mode */
  69. 128, /* orig-video-cols */
  70. 0, 0, 0, /* unused, ega_bx, unused */
  71. 54, /* orig-video-lines */
  72. 0, /* orig-video-isVGA */
  73. 16 /* orig-video-points */
  74. };
  75. static void
  76. prom_console_write(struct console *con, const char *s, unsigned int n)
  77. {
  78. prom_write(s, n);
  79. }
  80. /* Exported for mm/init.c:paging_init. */
  81. unsigned long cmdline_memory_size = 0;
  82. static struct console prom_early_console = {
  83. .name = "earlyprom",
  84. .write = prom_console_write,
  85. .flags = CON_PRINTBUFFER | CON_BOOT | CON_ANYTIME,
  86. .index = -1,
  87. };
  88. /*
  89. * Process kernel command line switches that are specific to the
  90. * SPARC or that require special low-level processing.
  91. */
  92. static void __init process_switch(char c)
  93. {
  94. switch (c) {
  95. case 'd':
  96. case 's':
  97. break;
  98. case 'h':
  99. prom_printf("boot_flags_init: Halt!\n");
  100. prom_halt();
  101. break;
  102. case 'p':
  103. prom_early_console.flags &= ~CON_BOOT;
  104. break;
  105. case 'P':
  106. /* Force UltraSPARC-III P-Cache on. */
  107. if (tlb_type != cheetah) {
  108. printk("BOOT: Ignoring P-Cache force option.\n");
  109. break;
  110. }
  111. cheetah_pcache_forced_on = 1;
  112. add_taint(TAINT_MACHINE_CHECK, LOCKDEP_NOW_UNRELIABLE);
  113. cheetah_enable_pcache();
  114. break;
  115. default:
  116. printk("Unknown boot switch (-%c)\n", c);
  117. break;
  118. }
  119. }
  120. static void __init boot_flags_init(char *commands)
  121. {
  122. while (*commands) {
  123. /* Move to the start of the next "argument". */
  124. while (*commands && *commands == ' ')
  125. commands++;
  126. /* Process any command switches, otherwise skip it. */
  127. if (*commands == '\0')
  128. break;
  129. if (*commands == '-') {
  130. commands++;
  131. while (*commands && *commands != ' ')
  132. process_switch(*commands++);
  133. continue;
  134. }
  135. if (!strncmp(commands, "mem=", 4))
  136. cmdline_memory_size = memparse(commands + 4, &commands);
  137. while (*commands && *commands != ' ')
  138. commands++;
  139. }
  140. }
  141. extern unsigned short root_flags;
  142. extern unsigned short root_dev;
  143. extern unsigned short ram_flags;
  144. #define RAMDISK_IMAGE_START_MASK 0x07FF
  145. #define RAMDISK_PROMPT_FLAG 0x8000
  146. #define RAMDISK_LOAD_FLAG 0x4000
  147. extern int root_mountflags;
  148. char reboot_command[COMMAND_LINE_SIZE];
  149. static struct pt_regs fake_swapper_regs = { { 0, }, 0, 0, 0, 0 };
  150. static void __init per_cpu_patch(void)
  151. {
  152. struct cpuid_patch_entry *p;
  153. unsigned long ver;
  154. int is_jbus;
  155. if (tlb_type == spitfire && !this_is_starfire)
  156. return;
  157. is_jbus = 0;
  158. if (tlb_type != hypervisor) {
  159. __asm__ ("rdpr %%ver, %0" : "=r" (ver));
  160. is_jbus = ((ver >> 32UL) == __JALAPENO_ID ||
  161. (ver >> 32UL) == __SERRANO_ID);
  162. }
  163. p = &__cpuid_patch;
  164. while (p < &__cpuid_patch_end) {
  165. unsigned long addr = p->addr;
  166. unsigned int *insns;
  167. switch (tlb_type) {
  168. case spitfire:
  169. insns = &p->starfire[0];
  170. break;
  171. case cheetah:
  172. case cheetah_plus:
  173. if (is_jbus)
  174. insns = &p->cheetah_jbus[0];
  175. else
  176. insns = &p->cheetah_safari[0];
  177. break;
  178. case hypervisor:
  179. insns = &p->sun4v[0];
  180. break;
  181. default:
  182. prom_printf("Unknown cpu type, halting.\n");
  183. prom_halt();
  184. }
  185. *(unsigned int *) (addr + 0) = insns[0];
  186. wmb();
  187. __asm__ __volatile__("flush %0" : : "r" (addr + 0));
  188. *(unsigned int *) (addr + 4) = insns[1];
  189. wmb();
  190. __asm__ __volatile__("flush %0" : : "r" (addr + 4));
  191. *(unsigned int *) (addr + 8) = insns[2];
  192. wmb();
  193. __asm__ __volatile__("flush %0" : : "r" (addr + 8));
  194. *(unsigned int *) (addr + 12) = insns[3];
  195. wmb();
  196. __asm__ __volatile__("flush %0" : : "r" (addr + 12));
  197. p++;
  198. }
  199. }
  200. void sun4v_patch_1insn_range(struct sun4v_1insn_patch_entry *start,
  201. struct sun4v_1insn_patch_entry *end)
  202. {
  203. while (start < end) {
  204. unsigned long addr = start->addr;
  205. *(unsigned int *) (addr + 0) = start->insn;
  206. wmb();
  207. __asm__ __volatile__("flush %0" : : "r" (addr + 0));
  208. start++;
  209. }
  210. }
  211. void sun4v_patch_2insn_range(struct sun4v_2insn_patch_entry *start,
  212. struct sun4v_2insn_patch_entry *end)
  213. {
  214. while (start < end) {
  215. unsigned long addr = start->addr;
  216. *(unsigned int *) (addr + 0) = start->insns[0];
  217. wmb();
  218. __asm__ __volatile__("flush %0" : : "r" (addr + 0));
  219. *(unsigned int *) (addr + 4) = start->insns[1];
  220. wmb();
  221. __asm__ __volatile__("flush %0" : : "r" (addr + 4));
  222. start++;
  223. }
  224. }
  225. void sun_m7_patch_2insn_range(struct sun4v_2insn_patch_entry *start,
  226. struct sun4v_2insn_patch_entry *end)
  227. {
  228. while (start < end) {
  229. unsigned long addr = start->addr;
  230. *(unsigned int *) (addr + 0) = start->insns[0];
  231. wmb();
  232. __asm__ __volatile__("flush %0" : : "r" (addr + 0));
  233. *(unsigned int *) (addr + 4) = start->insns[1];
  234. wmb();
  235. __asm__ __volatile__("flush %0" : : "r" (addr + 4));
  236. start++;
  237. }
  238. }
  239. static void __init sun4v_patch(void)
  240. {
  241. extern void sun4v_hvapi_init(void);
  242. if (tlb_type != hypervisor)
  243. return;
  244. sun4v_patch_1insn_range(&__sun4v_1insn_patch,
  245. &__sun4v_1insn_patch_end);
  246. sun4v_patch_2insn_range(&__sun4v_2insn_patch,
  247. &__sun4v_2insn_patch_end);
  248. if (sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
  249. sun4v_chip_type == SUN4V_CHIP_SPARC_SN)
  250. sun_m7_patch_2insn_range(&__sun_m7_2insn_patch,
  251. &__sun_m7_2insn_patch_end);
  252. sun4v_hvapi_init();
  253. }
  254. static void __init popc_patch(void)
  255. {
  256. struct popc_3insn_patch_entry *p3;
  257. struct popc_6insn_patch_entry *p6;
  258. p3 = &__popc_3insn_patch;
  259. while (p3 < &__popc_3insn_patch_end) {
  260. unsigned long i, addr = p3->addr;
  261. for (i = 0; i < 3; i++) {
  262. *(unsigned int *) (addr + (i * 4)) = p3->insns[i];
  263. wmb();
  264. __asm__ __volatile__("flush %0"
  265. : : "r" (addr + (i * 4)));
  266. }
  267. p3++;
  268. }
  269. p6 = &__popc_6insn_patch;
  270. while (p6 < &__popc_6insn_patch_end) {
  271. unsigned long i, addr = p6->addr;
  272. for (i = 0; i < 6; i++) {
  273. *(unsigned int *) (addr + (i * 4)) = p6->insns[i];
  274. wmb();
  275. __asm__ __volatile__("flush %0"
  276. : : "r" (addr + (i * 4)));
  277. }
  278. p6++;
  279. }
  280. }
  281. static void __init pause_patch(void)
  282. {
  283. struct pause_patch_entry *p;
  284. p = &__pause_3insn_patch;
  285. while (p < &__pause_3insn_patch_end) {
  286. unsigned long i, addr = p->addr;
  287. for (i = 0; i < 3; i++) {
  288. *(unsigned int *) (addr + (i * 4)) = p->insns[i];
  289. wmb();
  290. __asm__ __volatile__("flush %0"
  291. : : "r" (addr + (i * 4)));
  292. }
  293. p++;
  294. }
  295. }
  296. void __init start_early_boot(void)
  297. {
  298. int cpu;
  299. check_if_starfire();
  300. per_cpu_patch();
  301. sun4v_patch();
  302. cpu = hard_smp_processor_id();
  303. if (cpu >= NR_CPUS) {
  304. prom_printf("Serious problem, boot cpu id (%d) >= NR_CPUS (%d)\n",
  305. cpu, NR_CPUS);
  306. prom_halt();
  307. }
  308. current_thread_info()->cpu = cpu;
  309. prom_init_report();
  310. start_kernel();
  311. }
  312. /* On Ultra, we support all of the v8 capabilities. */
  313. unsigned long sparc64_elf_hwcap = (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR |
  314. HWCAP_SPARC_SWAP | HWCAP_SPARC_MULDIV |
  315. HWCAP_SPARC_V9);
  316. EXPORT_SYMBOL(sparc64_elf_hwcap);
  317. static const char *hwcaps[] = {
  318. "flush", "stbar", "swap", "muldiv", "v9",
  319. "ultra3", "blkinit", "n2",
  320. /* These strings are as they appear in the machine description
  321. * 'hwcap-list' property for cpu nodes.
  322. */
  323. "mul32", "div32", "fsmuld", "v8plus", "popc", "vis", "vis2",
  324. "ASIBlkInit", "fmaf", "vis3", "hpc", "random", "trans", "fjfmau",
  325. "ima", "cspare", "pause", "cbcond", NULL /*reserved for crypto */,
  326. "adp",
  327. };
  328. static const char *crypto_hwcaps[] = {
  329. "aes", "des", "kasumi", "camellia", "md5", "sha1", "sha256",
  330. "sha512", "mpmul", "montmul", "montsqr", "crc32c",
  331. };
  332. void cpucap_info(struct seq_file *m)
  333. {
  334. unsigned long caps = sparc64_elf_hwcap;
  335. int i, printed = 0;
  336. seq_puts(m, "cpucaps\t\t: ");
  337. for (i = 0; i < ARRAY_SIZE(hwcaps); i++) {
  338. unsigned long bit = 1UL << i;
  339. if (hwcaps[i] && (caps & bit)) {
  340. seq_printf(m, "%s%s",
  341. printed ? "," : "", hwcaps[i]);
  342. printed++;
  343. }
  344. }
  345. if (caps & HWCAP_SPARC_CRYPTO) {
  346. unsigned long cfr;
  347. __asm__ __volatile__("rd %%asr26, %0" : "=r" (cfr));
  348. for (i = 0; i < ARRAY_SIZE(crypto_hwcaps); i++) {
  349. unsigned long bit = 1UL << i;
  350. if (cfr & bit) {
  351. seq_printf(m, "%s%s",
  352. printed ? "," : "", crypto_hwcaps[i]);
  353. printed++;
  354. }
  355. }
  356. }
  357. seq_putc(m, '\n');
  358. }
  359. static void __init report_one_hwcap(int *printed, const char *name)
  360. {
  361. if ((*printed) == 0)
  362. printk(KERN_INFO "CPU CAPS: [");
  363. printk(KERN_CONT "%s%s",
  364. (*printed) ? "," : "", name);
  365. if (++(*printed) == 8) {
  366. printk(KERN_CONT "]\n");
  367. *printed = 0;
  368. }
  369. }
  370. static void __init report_crypto_hwcaps(int *printed)
  371. {
  372. unsigned long cfr;
  373. int i;
  374. __asm__ __volatile__("rd %%asr26, %0" : "=r" (cfr));
  375. for (i = 0; i < ARRAY_SIZE(crypto_hwcaps); i++) {
  376. unsigned long bit = 1UL << i;
  377. if (cfr & bit)
  378. report_one_hwcap(printed, crypto_hwcaps[i]);
  379. }
  380. }
  381. static void __init report_hwcaps(unsigned long caps)
  382. {
  383. int i, printed = 0;
  384. for (i = 0; i < ARRAY_SIZE(hwcaps); i++) {
  385. unsigned long bit = 1UL << i;
  386. if (hwcaps[i] && (caps & bit))
  387. report_one_hwcap(&printed, hwcaps[i]);
  388. }
  389. if (caps & HWCAP_SPARC_CRYPTO)
  390. report_crypto_hwcaps(&printed);
  391. if (printed != 0)
  392. printk(KERN_CONT "]\n");
  393. }
  394. static unsigned long __init mdesc_cpu_hwcap_list(void)
  395. {
  396. struct mdesc_handle *hp;
  397. unsigned long caps = 0;
  398. const char *prop;
  399. int len;
  400. u64 pn;
  401. hp = mdesc_grab();
  402. if (!hp)
  403. return 0;
  404. pn = mdesc_node_by_name(hp, MDESC_NODE_NULL, "cpu");
  405. if (pn == MDESC_NODE_NULL)
  406. goto out;
  407. prop = mdesc_get_property(hp, pn, "hwcap-list", &len);
  408. if (!prop)
  409. goto out;
  410. while (len) {
  411. int i, plen;
  412. for (i = 0; i < ARRAY_SIZE(hwcaps); i++) {
  413. unsigned long bit = 1UL << i;
  414. if (hwcaps[i] && !strcmp(prop, hwcaps[i])) {
  415. caps |= bit;
  416. break;
  417. }
  418. }
  419. for (i = 0; i < ARRAY_SIZE(crypto_hwcaps); i++) {
  420. if (!strcmp(prop, crypto_hwcaps[i]))
  421. caps |= HWCAP_SPARC_CRYPTO;
  422. }
  423. plen = strlen(prop) + 1;
  424. prop += plen;
  425. len -= plen;
  426. }
  427. out:
  428. mdesc_release(hp);
  429. return caps;
  430. }
  431. /* This yields a mask that user programs can use to figure out what
  432. * instruction set this cpu supports.
  433. */
  434. static void __init init_sparc64_elf_hwcap(void)
  435. {
  436. unsigned long cap = sparc64_elf_hwcap;
  437. unsigned long mdesc_caps;
  438. if (tlb_type == cheetah || tlb_type == cheetah_plus)
  439. cap |= HWCAP_SPARC_ULTRA3;
  440. else if (tlb_type == hypervisor) {
  441. if (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 ||
  442. sun4v_chip_type == SUN4V_CHIP_NIAGARA2 ||
  443. sun4v_chip_type == SUN4V_CHIP_NIAGARA3 ||
  444. sun4v_chip_type == SUN4V_CHIP_NIAGARA4 ||
  445. sun4v_chip_type == SUN4V_CHIP_NIAGARA5 ||
  446. sun4v_chip_type == SUN4V_CHIP_SPARC_M6 ||
  447. sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
  448. sun4v_chip_type == SUN4V_CHIP_SPARC_SN ||
  449. sun4v_chip_type == SUN4V_CHIP_SPARC64X)
  450. cap |= HWCAP_SPARC_BLKINIT;
  451. if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2 ||
  452. sun4v_chip_type == SUN4V_CHIP_NIAGARA3 ||
  453. sun4v_chip_type == SUN4V_CHIP_NIAGARA4 ||
  454. sun4v_chip_type == SUN4V_CHIP_NIAGARA5 ||
  455. sun4v_chip_type == SUN4V_CHIP_SPARC_M6 ||
  456. sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
  457. sun4v_chip_type == SUN4V_CHIP_SPARC_SN ||
  458. sun4v_chip_type == SUN4V_CHIP_SPARC64X)
  459. cap |= HWCAP_SPARC_N2;
  460. }
  461. cap |= (AV_SPARC_MUL32 | AV_SPARC_DIV32 | AV_SPARC_V8PLUS);
  462. mdesc_caps = mdesc_cpu_hwcap_list();
  463. if (!mdesc_caps) {
  464. if (tlb_type == spitfire)
  465. cap |= AV_SPARC_VIS;
  466. if (tlb_type == cheetah || tlb_type == cheetah_plus)
  467. cap |= AV_SPARC_VIS | AV_SPARC_VIS2;
  468. if (tlb_type == cheetah_plus) {
  469. unsigned long impl, ver;
  470. __asm__ __volatile__("rdpr %%ver, %0" : "=r" (ver));
  471. impl = ((ver >> 32) & 0xffff);
  472. if (impl == PANTHER_IMPL)
  473. cap |= AV_SPARC_POPC;
  474. }
  475. if (tlb_type == hypervisor) {
  476. if (sun4v_chip_type == SUN4V_CHIP_NIAGARA1)
  477. cap |= AV_SPARC_ASI_BLK_INIT;
  478. if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2 ||
  479. sun4v_chip_type == SUN4V_CHIP_NIAGARA3 ||
  480. sun4v_chip_type == SUN4V_CHIP_NIAGARA4 ||
  481. sun4v_chip_type == SUN4V_CHIP_NIAGARA5 ||
  482. sun4v_chip_type == SUN4V_CHIP_SPARC_M6 ||
  483. sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
  484. sun4v_chip_type == SUN4V_CHIP_SPARC_SN ||
  485. sun4v_chip_type == SUN4V_CHIP_SPARC64X)
  486. cap |= (AV_SPARC_VIS | AV_SPARC_VIS2 |
  487. AV_SPARC_ASI_BLK_INIT |
  488. AV_SPARC_POPC);
  489. if (sun4v_chip_type == SUN4V_CHIP_NIAGARA3 ||
  490. sun4v_chip_type == SUN4V_CHIP_NIAGARA4 ||
  491. sun4v_chip_type == SUN4V_CHIP_NIAGARA5 ||
  492. sun4v_chip_type == SUN4V_CHIP_SPARC_M6 ||
  493. sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
  494. sun4v_chip_type == SUN4V_CHIP_SPARC_SN ||
  495. sun4v_chip_type == SUN4V_CHIP_SPARC64X)
  496. cap |= (AV_SPARC_VIS3 | AV_SPARC_HPC |
  497. AV_SPARC_FMAF);
  498. }
  499. }
  500. sparc64_elf_hwcap = cap | mdesc_caps;
  501. report_hwcaps(sparc64_elf_hwcap);
  502. if (sparc64_elf_hwcap & AV_SPARC_POPC)
  503. popc_patch();
  504. if (sparc64_elf_hwcap & AV_SPARC_PAUSE)
  505. pause_patch();
  506. }
  507. void __init alloc_irqstack_bootmem(void)
  508. {
  509. unsigned int i, node;
  510. for_each_possible_cpu(i) {
  511. node = cpu_to_node(i);
  512. softirq_stack[i] = __alloc_bootmem_node(NODE_DATA(node),
  513. THREAD_SIZE,
  514. THREAD_SIZE, 0);
  515. hardirq_stack[i] = __alloc_bootmem_node(NODE_DATA(node),
  516. THREAD_SIZE,
  517. THREAD_SIZE, 0);
  518. }
  519. }
  520. void __init setup_arch(char **cmdline_p)
  521. {
  522. /* Initialize PROM console and command line. */
  523. *cmdline_p = prom_getbootargs();
  524. strlcpy(boot_command_line, *cmdline_p, COMMAND_LINE_SIZE);
  525. parse_early_param();
  526. boot_flags_init(*cmdline_p);
  527. #ifdef CONFIG_EARLYFB
  528. if (btext_find_display())
  529. #endif
  530. register_console(&prom_early_console);
  531. if (tlb_type == hypervisor)
  532. printk("ARCH: SUN4V\n");
  533. else
  534. printk("ARCH: SUN4U\n");
  535. #ifdef CONFIG_DUMMY_CONSOLE
  536. conswitchp = &dummy_con;
  537. #endif
  538. idprom_init();
  539. if (!root_flags)
  540. root_mountflags &= ~MS_RDONLY;
  541. ROOT_DEV = old_decode_dev(root_dev);
  542. #ifdef CONFIG_BLK_DEV_RAM
  543. rd_image_start = ram_flags & RAMDISK_IMAGE_START_MASK;
  544. rd_prompt = ((ram_flags & RAMDISK_PROMPT_FLAG) != 0);
  545. rd_doload = ((ram_flags & RAMDISK_LOAD_FLAG) != 0);
  546. #endif
  547. task_thread_info(&init_task)->kregs = &fake_swapper_regs;
  548. #ifdef CONFIG_IP_PNP
  549. if (!ic_set_manually) {
  550. phandle chosen = prom_finddevice("/chosen");
  551. u32 cl, sv, gw;
  552. cl = prom_getintdefault (chosen, "client-ip", 0);
  553. sv = prom_getintdefault (chosen, "server-ip", 0);
  554. gw = prom_getintdefault (chosen, "gateway-ip", 0);
  555. if (cl && sv) {
  556. ic_myaddr = cl;
  557. ic_servaddr = sv;
  558. if (gw)
  559. ic_gateway = gw;
  560. #if defined(CONFIG_IP_PNP_BOOTP) || defined(CONFIG_IP_PNP_RARP)
  561. ic_proto_enabled = 0;
  562. #endif
  563. }
  564. }
  565. #endif
  566. /* Get boot processor trap_block[] setup. */
  567. init_cur_cpu_trap(current_thread_info());
  568. paging_init();
  569. init_sparc64_elf_hwcap();
  570. smp_fill_in_cpu_possible_map();
  571. /*
  572. * Once the OF device tree and MDESC have been setup and nr_cpus has
  573. * been parsed, we know the list of possible cpus. Therefore we can
  574. * allocate the IRQ stacks.
  575. */
  576. alloc_irqstack_bootmem();
  577. }
  578. extern int stop_a_enabled;
  579. void sun_do_break(void)
  580. {
  581. if (!stop_a_enabled)
  582. return;
  583. prom_printf("\n");
  584. flush_user_windows();
  585. prom_cmdline();
  586. }
  587. EXPORT_SYMBOL(sun_do_break);
  588. int stop_a_enabled = 1;
  589. EXPORT_SYMBOL(stop_a_enabled);