24 #include <linux/sched.h>
27 #include <linux/screen_info.h>
31 #include <linux/apm_bios.h>
39 #include <linux/module.h>
42 #include <linux/edd.h>
45 #include <linux/kexec.h>
48 #include <linux/pci.h>
51 #include <linux/kvm_para.h>
54 #include <linux/errno.h>
55 #include <linux/kernel.h>
56 #include <linux/stddef.h>
58 #include <linux/ptrace.h>
65 #include <linux/ctype.h>
73 #include <video/edid.h>
80 #include <asm/setup.h>
82 #include <asm/timer.h>
83 #include <asm/i8259.h>
84 #include <asm/sections.h>
90 #include <asm/cacheflush.h>
91 #include <asm/processor.h>
98 #include <asm/iommu.h>
100 #include <asm/mmu_context.h>
103 #include <asm/paravirt.h>
104 #include <asm/hypervisor.h>
107 #include <asm/percpu.h>
108 #include <asm/topology.h>
116 #include <asm/prom.h>
131 static __initdata unsigned long _brk_start = (
unsigned long)__brk_base;
135 int default_cpu_present_to_apicid(
int mps_cpu)
137 return __default_cpu_present_to_apicid(mps_cpu);
140 int default_check_phys_apicid_present(
int phys_apicid)
142 return __default_check_phys_apicid_present(phys_apicid);
146 #ifndef CONFIG_DEBUG_BOOT_PARAMS
155 static struct resource data_resource = {
156 .name =
"Kernel data",
162 static struct resource code_resource = {
163 .name =
"Kernel code",
169 static struct resource bss_resource = {
170 .name =
"Kernel bss",
184 unsigned int def_to_bigsmp;
194 #if defined(CONFIG_X86_SPEEDSTEP_SMI) || \
195 defined(CONFIG_X86_SPEEDSTEP_SMI_MODULE)
210 #if !defined(CONFIG_X86_PAE) || defined(CONFIG_X86_64)
231 #define RAMDISK_IMAGE_START_MASK 0x07FF
232 #define RAMDISK_PROMPT_FLAG 0x8000
233 #define RAMDISK_LOAD_FLAG 0x4000
236 #ifdef CONFIG_CMDLINE_BOOL
240 #if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
242 #ifdef CONFIG_EDD_MODULE
250 static inline void __init copy_edd(
void)
259 static inline void __init copy_edd(
void)
266 size_t mask = align - 1;
284 static void __init init_gbpages(
void)
292 static inline void init_gbpages(
void)
300 static void __init reserve_brk(
void)
311 #ifdef CONFIG_BLK_DEV_INITRD
313 #define MAX_MAP_CHUNK (NR_FIX_BTMAPS << PAGE_SHIFT)
314 static void __init relocate_initrd(
void)
322 unsigned long slop,
clen, mapaddr;
330 panic(
"Cannot find place for new RAMDISK of size %lld\n",
339 ramdisk_here, ramdisk_here + ramdisk_size - 1);
344 if (ramdisk_image < end_of_lowmem) {
346 p = (
char *)
__va(ramdisk_image);
349 ramdisk_image +=
clen;
350 ramdisk_size -=
clen;
354 while (ramdisk_size) {
357 if (clen > MAX_MAP_CHUNK-slop)
358 clen = MAX_MAP_CHUNK-slop;
364 ramdisk_image +=
clen;
365 ramdisk_size -=
clen;
371 " [mem %#010llx-%#010llx]\n",
372 ramdisk_image, ramdisk_image + ramdisk_size - 1,
373 ramdisk_here, ramdisk_here + ramdisk_size - 1);
376 static void __init reserve_initrd(
void)
385 !ramdisk_image || !ramdisk_size)
390 if (ramdisk_size >= (end_of_lowmem>>1)) {
391 panic(
"initrd too large to handle, "
392 "disabling initrd (%lld needed, %lld available)\n",
393 ramdisk_size, end_of_lowmem>>1);
400 if (ramdisk_end <= end_of_lowmem) {
416 static void __init reserve_initrd(
void)
421 static void __init parse_setup_data(
void)
436 if (data_len > map_len) {
442 switch (data->
type) {
452 pa_data = data->
next;
457 static void __init e820_reserve_setup_data(
void)
471 pa_data = data->
next;
483 static void __init memblock_x86_reserve_range_setup_data(
void)
494 pa_data = data->
next;
512 # define CRASH_KERNEL_ADDR_MAX (512 << 20)
514 # define CRASH_KERNEL_ADDR_MAX (896 << 20)
519 unsigned long long total_mem;
520 unsigned long long crash_size, crash_base;
526 &crash_size, &crash_base);
527 if (ret != 0 || crash_size <= 0)
531 if (crash_base <= 0) {
532 const unsigned long long alignment = 16<<20;
538 CRASH_KERNEL_ADDR_MAX, crash_size, alignment);
541 pr_info(
"crashkernel reservation failed - No suitable area found.\n");
545 unsigned long long start;
548 crash_base + crash_size, crash_size, 1<<20);
549 if (start != crash_base) {
550 pr_info(
"crashkernel reservation failed - memory is in use.\n");
557 "for crashkernel (System RAM: %ldMB)\n",
558 (
unsigned long)(crash_size >> 20),
559 (
unsigned long)(crash_base >> 20),
560 (
unsigned long)(total_mem >> 20));
573 { .name =
"dma1", .start = 0x00, .end = 0x1f,
575 { .name =
"pic1", .start = 0x20, .end = 0x21,
577 { .name =
"timer0", .start = 0x40, .end = 0x43,
579 { .name =
"timer1", .start = 0x50, .end = 0x53,
581 { .name =
"keyboard", .start = 0x60, .end = 0x60,
583 { .name =
"keyboard", .start = 0x64, .end = 0x64,
585 { .name =
"dma page reg", .start = 0x80, .end = 0x8f,
587 { .name =
"pic2", .start = 0xa0, .end = 0xa1,
589 { .name =
"dma2", .start = 0xc0, .end = 0xdf,
591 { .name =
"fpu", .start = 0xf0, .end = 0xff,
600 for (i = 0; i <
ARRAY_SIZE(standard_io_resources); i++)
605 static __init void reserve_ibft_region(
void)
615 static unsigned reserve_low = CONFIG_X86_RESERVE_LOW << 10;
617 static void __init trim_bios_range(
void)
640 static int __init parse_reservelow(
char *p)
642 unsigned long long size;
728 #ifdef CONFIG_BLK_DEV_RAM
753 e820_reserve_setup_data();
771 #ifdef CONFIG_CMDLINE_BOOL
772 #ifdef CONFIG_CMDLINE_OVERRIDE
775 if (builtin_cmdline[0]) {
801 memblock_x86_reserve_range_setup_data();
804 #ifdef CONFIG_X86_LOCAL_APIC
837 if (ppro_with_ram_bug()) {
882 reserve_ibft_region();
893 memblock.current_limit = get_max_mapped();
906 #ifdef CONFIG_X86_CHECK_BIOS_CORRUPTION
925 unsigned long start_pfn, end_pfn;
927 for_each_mem_pfn_range(i,
MAX_NUMNODES, &start_pfn, &end_pfn,
931 if (end <= (1
UL<<32))
936 max((1
UL<<32), start), end);
943 memblock.current_limit = get_max_mapped();
950 #ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
975 #ifdef CONFIG_KVM_GUEST
1031 x86_init.resources.reserve_resources();
1036 #if defined(CONFIG_VGA_CONSOLE)
1039 #elif defined(CONFIG_DUMMY_CONSOLE)
1059 pr_info(
"efi: Setup done, disabling due to 32/64-bit mismatch\n");
1066 #ifdef CONFIG_X86_32
1068 static struct resource video_ram_resource = {
1069 .
name =
"Video RAM area",
1075 void __init i386_reserve_resources(
void)