setup.c 17 KB

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