setup_32.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693
  1. /*
  2. * Copyright (C) 1995 Linus Torvalds
  3. *
  4. * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
  5. *
  6. * Memory region support
  7. * David Parsons <orc@pell.chi.il.us>, July-August 1999
  8. *
  9. * Added E820 sanitization routine (removes overlapping memory regions);
  10. * Brian Moyle <bmoyle@mvista.com>, February 2001
  11. *
  12. * Moved CPU detection code to cpu/${cpu}.c
  13. * Patrick Mochel <mochel@osdl.org>, March 2002
  14. *
  15. * Provisions for empty E820 memory regions (reported by certain BIOSes).
  16. * Alex Achenbach <xela@slit.de>, December 2002.
  17. *
  18. */
  19. /*
  20. * This file handles the architecture-dependent parts of initialization
  21. */
  22. #include <linux/sched.h>
  23. #include <linux/mm.h>
  24. #include <linux/mmzone.h>
  25. #include <linux/screen_info.h>
  26. #include <linux/ioport.h>
  27. #include <linux/acpi.h>
  28. #include <linux/apm_bios.h>
  29. #include <linux/initrd.h>
  30. #include <linux/bootmem.h>
  31. #include <linux/seq_file.h>
  32. #include <linux/console.h>
  33. #include <linux/mca.h>
  34. #include <linux/root_dev.h>
  35. #include <linux/highmem.h>
  36. #include <linux/module.h>
  37. #include <linux/efi.h>
  38. #include <linux/init.h>
  39. #include <linux/edd.h>
  40. #include <linux/nodemask.h>
  41. #include <linux/kexec.h>
  42. #include <linux/crash_dump.h>
  43. #include <linux/dmi.h>
  44. #include <linux/pfn.h>
  45. #include <video/edid.h>
  46. #include <asm/apic.h>
  47. #include <asm/e820.h>
  48. #include <asm/mpspec.h>
  49. #include <asm/mmzone.h>
  50. #include <asm/setup.h>
  51. #include <asm/arch_hooks.h>
  52. #include <asm/sections.h>
  53. #include <asm/io_apic.h>
  54. #include <asm/ist.h>
  55. #include <asm/io.h>
  56. #include <asm/vmi.h>
  57. #include <setup_arch.h>
  58. #include <bios_ebda.h>
  59. /* This value is set up by the early boot code to point to the value
  60. immediately after the boot time page tables. It contains a *physical*
  61. address, and must not be in the .bss segment! */
  62. unsigned long init_pg_tables_end __initdata = ~0UL;
  63. int disable_pse __devinitdata = 0;
  64. /*
  65. * Machine setup..
  66. */
  67. extern struct resource code_resource;
  68. extern struct resource data_resource;
  69. /* cpu data as detected by the assembly code in head.S */
  70. struct cpuinfo_x86 new_cpu_data __cpuinitdata = { 0, 0, 0, 0, -1, 1, 0, 0, -1 };
  71. /* common cpu data for all cpus */
  72. struct cpuinfo_x86 boot_cpu_data __read_mostly = { 0, 0, 0, 0, -1, 1, 0, 0, -1 };
  73. EXPORT_SYMBOL(boot_cpu_data);
  74. unsigned long mmu_cr4_features;
  75. /* for MCA, but anyone else can use it if they want */
  76. unsigned int machine_id;
  77. #ifdef CONFIG_MCA
  78. EXPORT_SYMBOL(machine_id);
  79. #endif
  80. unsigned int machine_submodel_id;
  81. unsigned int BIOS_revision;
  82. unsigned int mca_pentium_flag;
  83. /* Boot loader ID as an integer, for the benefit of proc_dointvec */
  84. int bootloader_type;
  85. /* user-defined highmem size */
  86. static unsigned int highmem_pages = -1;
  87. /*
  88. * Setup options
  89. */
  90. struct screen_info screen_info;
  91. EXPORT_SYMBOL(screen_info);
  92. struct apm_info apm_info;
  93. EXPORT_SYMBOL(apm_info);
  94. struct edid_info edid_info;
  95. EXPORT_SYMBOL_GPL(edid_info);
  96. struct ist_info ist_info;
  97. #if defined(CONFIG_X86_SPEEDSTEP_SMI) || \
  98. defined(CONFIG_X86_SPEEDSTEP_SMI_MODULE)
  99. EXPORT_SYMBOL(ist_info);
  100. #endif
  101. extern void early_cpu_init(void);
  102. extern int root_mountflags;
  103. unsigned long saved_videomode;
  104. #define RAMDISK_IMAGE_START_MASK 0x07FF
  105. #define RAMDISK_PROMPT_FLAG 0x8000
  106. #define RAMDISK_LOAD_FLAG 0x4000
  107. static char __initdata command_line[COMMAND_LINE_SIZE];
  108. struct boot_params __initdata boot_params;
  109. #if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
  110. struct edd edd;
  111. #ifdef CONFIG_EDD_MODULE
  112. EXPORT_SYMBOL(edd);
  113. #endif
  114. /**
  115. * copy_edd() - Copy the BIOS EDD information
  116. * from boot_params into a safe place.
  117. *
  118. */
  119. static inline void copy_edd(void)
  120. {
  121. memcpy(edd.mbr_signature, boot_params.edd_mbr_sig_buffer,
  122. sizeof(edd.mbr_signature));
  123. memcpy(edd.edd_info, boot_params.eddbuf, sizeof(edd.edd_info));
  124. edd.mbr_signature_nr = boot_params.edd_mbr_sig_buf_entries;
  125. edd.edd_info_nr = boot_params.eddbuf_entries;
  126. }
  127. #else
  128. static inline void copy_edd(void)
  129. {
  130. }
  131. #endif
  132. int __initdata user_defined_memmap = 0;
  133. /*
  134. * "mem=nopentium" disables the 4MB page tables.
  135. * "mem=XXX[kKmM]" defines a memory region from HIGH_MEM
  136. * to <mem>, overriding the bios size.
  137. * "memmap=XXX[KkmM]@XXX[KkmM]" defines a memory region from
  138. * <start> to <start>+<mem>, overriding the bios size.
  139. *
  140. * HPA tells me bootloaders need to parse mem=, so no new
  141. * option should be mem= [also see Documentation/i386/boot.txt]
  142. */
  143. static int __init parse_mem(char *arg)
  144. {
  145. if (!arg)
  146. return -EINVAL;
  147. if (strcmp(arg, "nopentium") == 0) {
  148. clear_bit(X86_FEATURE_PSE, boot_cpu_data.x86_capability);
  149. disable_pse = 1;
  150. } else {
  151. /* If the user specifies memory size, we
  152. * limit the BIOS-provided memory map to
  153. * that size. exactmap can be used to specify
  154. * the exact map. mem=number can be used to
  155. * trim the existing memory map.
  156. */
  157. unsigned long long mem_size;
  158. mem_size = memparse(arg, &arg);
  159. limit_regions(mem_size);
  160. user_defined_memmap = 1;
  161. }
  162. return 0;
  163. }
  164. early_param("mem", parse_mem);
  165. #ifdef CONFIG_PROC_VMCORE
  166. /* elfcorehdr= specifies the location of elf core header
  167. * stored by the crashed kernel.
  168. */
  169. static int __init parse_elfcorehdr(char *arg)
  170. {
  171. if (!arg)
  172. return -EINVAL;
  173. elfcorehdr_addr = memparse(arg, &arg);
  174. return 0;
  175. }
  176. early_param("elfcorehdr", parse_elfcorehdr);
  177. #endif /* CONFIG_PROC_VMCORE */
  178. /*
  179. * highmem=size forces highmem to be exactly 'size' bytes.
  180. * This works even on boxes that have no highmem otherwise.
  181. * This also works to reduce highmem size on bigger boxes.
  182. */
  183. static int __init parse_highmem(char *arg)
  184. {
  185. if (!arg)
  186. return -EINVAL;
  187. highmem_pages = memparse(arg, &arg) >> PAGE_SHIFT;
  188. return 0;
  189. }
  190. early_param("highmem", parse_highmem);
  191. /*
  192. * vmalloc=size forces the vmalloc area to be exactly 'size'
  193. * bytes. This can be used to increase (or decrease) the
  194. * vmalloc area - the default is 128m.
  195. */
  196. static int __init parse_vmalloc(char *arg)
  197. {
  198. if (!arg)
  199. return -EINVAL;
  200. __VMALLOC_RESERVE = memparse(arg, &arg);
  201. return 0;
  202. }
  203. early_param("vmalloc", parse_vmalloc);
  204. /*
  205. * reservetop=size reserves a hole at the top of the kernel address space which
  206. * a hypervisor can load into later. Needed for dynamically loaded hypervisors,
  207. * so relocating the fixmap can be done before paging initialization.
  208. */
  209. static int __init parse_reservetop(char *arg)
  210. {
  211. unsigned long address;
  212. if (!arg)
  213. return -EINVAL;
  214. address = memparse(arg, &arg);
  215. reserve_top_address(address);
  216. return 0;
  217. }
  218. early_param("reservetop", parse_reservetop);
  219. /*
  220. * Determine low and high memory ranges:
  221. */
  222. unsigned long __init find_max_low_pfn(void)
  223. {
  224. unsigned long max_low_pfn;
  225. max_low_pfn = max_pfn;
  226. if (max_low_pfn > MAXMEM_PFN) {
  227. if (highmem_pages == -1)
  228. highmem_pages = max_pfn - MAXMEM_PFN;
  229. if (highmem_pages + MAXMEM_PFN < max_pfn)
  230. max_pfn = MAXMEM_PFN + highmem_pages;
  231. if (highmem_pages + MAXMEM_PFN > max_pfn) {
  232. printk("only %luMB highmem pages available, ignoring highmem size of %uMB.\n", pages_to_mb(max_pfn - MAXMEM_PFN), pages_to_mb(highmem_pages));
  233. highmem_pages = 0;
  234. }
  235. max_low_pfn = MAXMEM_PFN;
  236. #ifndef CONFIG_HIGHMEM
  237. /* Maximum memory usable is what is directly addressable */
  238. printk(KERN_WARNING "Warning only %ldMB will be used.\n",
  239. MAXMEM>>20);
  240. if (max_pfn > MAX_NONPAE_PFN)
  241. printk(KERN_WARNING "Use a HIGHMEM64G enabled kernel.\n");
  242. else
  243. printk(KERN_WARNING "Use a HIGHMEM enabled kernel.\n");
  244. max_pfn = MAXMEM_PFN;
  245. #else /* !CONFIG_HIGHMEM */
  246. #ifndef CONFIG_HIGHMEM64G
  247. if (max_pfn > MAX_NONPAE_PFN) {
  248. max_pfn = MAX_NONPAE_PFN;
  249. printk(KERN_WARNING "Warning only 4GB will be used.\n");
  250. printk(KERN_WARNING "Use a HIGHMEM64G enabled kernel.\n");
  251. }
  252. #endif /* !CONFIG_HIGHMEM64G */
  253. #endif /* !CONFIG_HIGHMEM */
  254. } else {
  255. if (highmem_pages == -1)
  256. highmem_pages = 0;
  257. #ifdef CONFIG_HIGHMEM
  258. if (highmem_pages >= max_pfn) {
  259. printk(KERN_ERR "highmem size specified (%uMB) is bigger than pages available (%luMB)!.\n", pages_to_mb(highmem_pages), pages_to_mb(max_pfn));
  260. highmem_pages = 0;
  261. }
  262. if (highmem_pages) {
  263. if (max_low_pfn-highmem_pages < 64*1024*1024/PAGE_SIZE){
  264. printk(KERN_ERR "highmem size %uMB results in smaller than 64MB lowmem, ignoring it.\n", pages_to_mb(highmem_pages));
  265. highmem_pages = 0;
  266. }
  267. max_low_pfn -= highmem_pages;
  268. }
  269. #else
  270. if (highmem_pages)
  271. printk(KERN_ERR "ignoring highmem size on non-highmem kernel!\n");
  272. #endif
  273. }
  274. return max_low_pfn;
  275. }
  276. /*
  277. * workaround for Dell systems that neglect to reserve EBDA
  278. */
  279. static void __init reserve_ebda_region(void)
  280. {
  281. unsigned int addr;
  282. addr = get_bios_ebda();
  283. if (addr)
  284. reserve_bootmem(addr, PAGE_SIZE);
  285. }
  286. #ifndef CONFIG_NEED_MULTIPLE_NODES
  287. void __init setup_bootmem_allocator(void);
  288. static unsigned long __init setup_memory(void)
  289. {
  290. /*
  291. * partially used pages are not usable - thus
  292. * we are rounding upwards:
  293. */
  294. min_low_pfn = PFN_UP(init_pg_tables_end);
  295. find_max_pfn();
  296. max_low_pfn = find_max_low_pfn();
  297. #ifdef CONFIG_HIGHMEM
  298. highstart_pfn = highend_pfn = max_pfn;
  299. if (max_pfn > max_low_pfn) {
  300. highstart_pfn = max_low_pfn;
  301. }
  302. printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
  303. pages_to_mb(highend_pfn - highstart_pfn));
  304. num_physpages = highend_pfn;
  305. high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
  306. #else
  307. num_physpages = max_low_pfn;
  308. high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
  309. #endif
  310. #ifdef CONFIG_FLATMEM
  311. max_mapnr = num_physpages;
  312. #endif
  313. printk(KERN_NOTICE "%ldMB LOWMEM available.\n",
  314. pages_to_mb(max_low_pfn));
  315. setup_bootmem_allocator();
  316. return max_low_pfn;
  317. }
  318. void __init zone_sizes_init(void)
  319. {
  320. unsigned long max_zone_pfns[MAX_NR_ZONES];
  321. memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
  322. max_zone_pfns[ZONE_DMA] =
  323. virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
  324. max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
  325. #ifdef CONFIG_HIGHMEM
  326. max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;
  327. add_active_range(0, 0, highend_pfn);
  328. #else
  329. add_active_range(0, 0, max_low_pfn);
  330. #endif
  331. free_area_init_nodes(max_zone_pfns);
  332. }
  333. #else
  334. extern unsigned long __init setup_memory(void);
  335. extern void zone_sizes_init(void);
  336. #endif /* !CONFIG_NEED_MULTIPLE_NODES */
  337. static inline unsigned long long get_total_mem(void)
  338. {
  339. unsigned long long total;
  340. total = max_low_pfn - min_low_pfn;
  341. #ifdef CONFIG_HIGHMEM
  342. total += highend_pfn - highstart_pfn;
  343. #endif
  344. return total << PAGE_SHIFT;
  345. }
  346. #ifdef CONFIG_KEXEC
  347. static void __init reserve_crashkernel(void)
  348. {
  349. unsigned long long total_mem;
  350. unsigned long long crash_size, crash_base;
  351. int ret;
  352. total_mem = get_total_mem();
  353. ret = parse_crashkernel(boot_command_line, total_mem,
  354. &crash_size, &crash_base);
  355. if (ret == 0 && crash_size > 0) {
  356. if (crash_base > 0) {
  357. printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
  358. "for crashkernel (System RAM: %ldMB)\n",
  359. (unsigned long)(crash_size >> 20),
  360. (unsigned long)(crash_base >> 20),
  361. (unsigned long)(total_mem >> 20));
  362. crashk_res.start = crash_base;
  363. crashk_res.end = crash_base + crash_size - 1;
  364. reserve_bootmem(crash_base, crash_size);
  365. } else
  366. printk(KERN_INFO "crashkernel reservation failed - "
  367. "you have to specify a base address\n");
  368. }
  369. }
  370. #else
  371. static inline void __init reserve_crashkernel(void)
  372. {}
  373. #endif
  374. void __init setup_bootmem_allocator(void)
  375. {
  376. unsigned long bootmap_size;
  377. /*
  378. * Initialize the boot-time allocator (with low memory only):
  379. */
  380. bootmap_size = init_bootmem(min_low_pfn, max_low_pfn);
  381. register_bootmem_low_pages(max_low_pfn);
  382. /*
  383. * Reserve the bootmem bitmap itself as well. We do this in two
  384. * steps (first step was init_bootmem()) because this catches
  385. * the (very unlikely) case of us accidentally initializing the
  386. * bootmem allocator with an invalid RAM area.
  387. */
  388. reserve_bootmem(__pa_symbol(_text), (PFN_PHYS(min_low_pfn) +
  389. bootmap_size + PAGE_SIZE-1) - __pa_symbol(_text));
  390. /*
  391. * reserve physical page 0 - it's a special BIOS page on many boxes,
  392. * enabling clean reboots, SMP operation, laptop functions.
  393. */
  394. reserve_bootmem(0, PAGE_SIZE);
  395. /* reserve EBDA region, it's a 4K region */
  396. reserve_ebda_region();
  397. /* could be an AMD 768MPX chipset. Reserve a page before VGA to prevent
  398. PCI prefetch into it (errata #56). Usually the page is reserved anyways,
  399. unless you have no PS/2 mouse plugged in. */
  400. if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
  401. boot_cpu_data.x86 == 6)
  402. reserve_bootmem(0xa0000 - 4096, 4096);
  403. #ifdef CONFIG_SMP
  404. /*
  405. * But first pinch a few for the stack/trampoline stuff
  406. * FIXME: Don't need the extra page at 4K, but need to fix
  407. * trampoline before removing it. (see the GDT stuff)
  408. */
  409. reserve_bootmem(PAGE_SIZE, PAGE_SIZE);
  410. #endif
  411. #ifdef CONFIG_ACPI_SLEEP
  412. /*
  413. * Reserve low memory region for sleep support.
  414. */
  415. acpi_reserve_bootmem();
  416. #endif
  417. #ifdef CONFIG_X86_FIND_SMP_CONFIG
  418. /*
  419. * Find and reserve possible boot-time SMP configuration:
  420. */
  421. find_smp_config();
  422. #endif
  423. numa_kva_reserve();
  424. #ifdef CONFIG_BLK_DEV_INITRD
  425. if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) {
  426. unsigned long ramdisk_image = boot_params.hdr.ramdisk_image;
  427. unsigned long ramdisk_size = boot_params.hdr.ramdisk_size;
  428. unsigned long ramdisk_end = ramdisk_image + ramdisk_size;
  429. unsigned long end_of_lowmem = max_low_pfn << PAGE_SHIFT;
  430. if (ramdisk_end <= end_of_lowmem) {
  431. reserve_bootmem(ramdisk_image, ramdisk_size);
  432. initrd_start = ramdisk_image + PAGE_OFFSET;
  433. initrd_end = initrd_start+ramdisk_size;
  434. } else {
  435. printk(KERN_ERR "initrd extends beyond end of memory "
  436. "(0x%08lx > 0x%08lx)\ndisabling initrd\n",
  437. ramdisk_end, end_of_lowmem);
  438. initrd_start = 0;
  439. }
  440. }
  441. #endif
  442. reserve_crashkernel();
  443. }
  444. /*
  445. * The node 0 pgdat is initialized before all of these because
  446. * it's needed for bootmem. node>0 pgdats have their virtual
  447. * space allocated before the pagetables are in place to access
  448. * them, so they can't be cleared then.
  449. *
  450. * This should all compile down to nothing when NUMA is off.
  451. */
  452. static void __init remapped_pgdat_init(void)
  453. {
  454. int nid;
  455. for_each_online_node(nid) {
  456. if (nid != 0)
  457. memset(NODE_DATA(nid), 0, sizeof(struct pglist_data));
  458. }
  459. }
  460. #ifdef CONFIG_MCA
  461. static void set_mca_bus(int x)
  462. {
  463. MCA_bus = x;
  464. }
  465. #else
  466. static void set_mca_bus(int x) { }
  467. #endif
  468. /* Overridden in paravirt.c if CONFIG_PARAVIRT */
  469. char * __init __attribute__((weak)) memory_setup(void)
  470. {
  471. return machine_specific_memory_setup();
  472. }
  473. /*
  474. * Determine if we were loaded by an EFI loader. If so, then we have also been
  475. * passed the efi memmap, systab, etc., so we should use these data structures
  476. * for initialization. Note, the efi init code path is determined by the
  477. * global efi_enabled. This allows the same kernel image to be used on existing
  478. * systems (with a traditional BIOS) as well as on EFI systems.
  479. */
  480. void __init setup_arch(char **cmdline_p)
  481. {
  482. unsigned long max_low_pfn;
  483. memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data));
  484. pre_setup_arch_hook();
  485. early_cpu_init();
  486. /*
  487. * FIXME: This isn't an official loader_type right
  488. * now but does currently work with elilo.
  489. * If we were configured as an EFI kernel, check to make
  490. * sure that we were loaded correctly from elilo and that
  491. * the system table is valid. If not, then initialize normally.
  492. */
  493. #ifdef CONFIG_EFI
  494. if ((boot_params.hdr.type_of_loader == 0x50) &&
  495. boot_params.efi_info.efi_systab)
  496. efi_enabled = 1;
  497. #endif
  498. ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev);
  499. screen_info = boot_params.screen_info;
  500. edid_info = boot_params.edid_info;
  501. apm_info.bios = boot_params.apm_bios_info;
  502. ist_info = boot_params.ist_info;
  503. saved_videomode = boot_params.hdr.vid_mode;
  504. if( boot_params.sys_desc_table.length != 0 ) {
  505. set_mca_bus(boot_params.sys_desc_table.table[3] & 0x2);
  506. machine_id = boot_params.sys_desc_table.table[0];
  507. machine_submodel_id = boot_params.sys_desc_table.table[1];
  508. BIOS_revision = boot_params.sys_desc_table.table[2];
  509. }
  510. bootloader_type = boot_params.hdr.type_of_loader;
  511. #ifdef CONFIG_BLK_DEV_RAM
  512. rd_image_start = boot_params.hdr.ram_size & RAMDISK_IMAGE_START_MASK;
  513. rd_prompt = ((boot_params.hdr.ram_size & RAMDISK_PROMPT_FLAG) != 0);
  514. rd_doload = ((boot_params.hdr.ram_size & RAMDISK_LOAD_FLAG) != 0);
  515. #endif
  516. ARCH_SETUP
  517. if (efi_enabled)
  518. efi_init();
  519. else {
  520. printk(KERN_INFO "BIOS-provided physical RAM map:\n");
  521. print_memory_map(memory_setup());
  522. }
  523. copy_edd();
  524. if (!boot_params.hdr.root_flags)
  525. root_mountflags &= ~MS_RDONLY;
  526. init_mm.start_code = (unsigned long) _text;
  527. init_mm.end_code = (unsigned long) _etext;
  528. init_mm.end_data = (unsigned long) _edata;
  529. init_mm.brk = init_pg_tables_end + PAGE_OFFSET;
  530. code_resource.start = virt_to_phys(_text);
  531. code_resource.end = virt_to_phys(_etext)-1;
  532. data_resource.start = virt_to_phys(_etext);
  533. data_resource.end = virt_to_phys(_edata)-1;
  534. parse_early_param();
  535. if (user_defined_memmap) {
  536. printk(KERN_INFO "user-defined physical RAM map:\n");
  537. print_memory_map("user");
  538. }
  539. strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
  540. *cmdline_p = command_line;
  541. max_low_pfn = setup_memory();
  542. #ifdef CONFIG_VMI
  543. /*
  544. * Must be after max_low_pfn is determined, and before kernel
  545. * pagetables are setup.
  546. */
  547. vmi_init();
  548. #endif
  549. /*
  550. * NOTE: before this point _nobody_ is allowed to allocate
  551. * any memory using the bootmem allocator. Although the
  552. * allocator is now initialised only the first 8Mb of the kernel
  553. * virtual address space has been mapped. All allocations before
  554. * paging_init() has completed must use the alloc_bootmem_low_pages()
  555. * variant (which allocates DMA'able memory) and care must be taken
  556. * not to exceed the 8Mb limit.
  557. */
  558. #ifdef CONFIG_SMP
  559. smp_alloc_memory(); /* AP processor realmode stacks in low memory*/
  560. #endif
  561. paging_init();
  562. remapped_pgdat_init();
  563. sparse_init();
  564. zone_sizes_init();
  565. /*
  566. * NOTE: at this point the bootmem allocator is fully available.
  567. */
  568. paravirt_post_allocator_init();
  569. dmi_scan_machine();
  570. #ifdef CONFIG_X86_GENERICARCH
  571. generic_apic_probe();
  572. #endif
  573. if (efi_enabled)
  574. efi_map_memmap();
  575. #ifdef CONFIG_ACPI
  576. /*
  577. * Parse the ACPI tables for possible boot-time SMP configuration.
  578. */
  579. acpi_boot_table_init();
  580. #endif
  581. #ifdef CONFIG_PCI
  582. early_quirks();
  583. #endif
  584. #ifdef CONFIG_ACPI
  585. acpi_boot_init();
  586. #if defined(CONFIG_SMP) && defined(CONFIG_X86_PC)
  587. if (def_to_bigsmp)
  588. printk(KERN_WARNING "More than 8 CPUs detected and "
  589. "CONFIG_X86_PC cannot handle it.\nUse "
  590. "CONFIG_X86_GENERICARCH or CONFIG_X86_BIGSMP.\n");
  591. #endif
  592. #endif
  593. #ifdef CONFIG_X86_LOCAL_APIC
  594. if (smp_found_config)
  595. get_smp_config();
  596. #endif
  597. e820_register_memory();
  598. e820_mark_nosave_regions();
  599. #ifdef CONFIG_VT
  600. #if defined(CONFIG_VGA_CONSOLE)
  601. if (!efi_enabled || (efi_mem_type(0xa0000) != EFI_CONVENTIONAL_MEMORY))
  602. conswitchp = &vga_con;
  603. #elif defined(CONFIG_DUMMY_CONSOLE)
  604. conswitchp = &dummy_con;
  605. #endif
  606. #endif
  607. }