614
614
static unsigned reserve_low = CONFIG_X86_RESERVE_LOW << 10;
616
static bool __init snb_gfx_workaround_needed(void)
620
static const u16 snb_ids[] = {
630
/* Assume no if something weird is going on with PCI */
631
if (!early_pci_allowed())
634
vendor = read_pci_config_16(0, 2, 0, PCI_VENDOR_ID);
635
if (vendor != 0x8086)
638
devid = read_pci_config_16(0, 2, 0, PCI_DEVICE_ID);
639
for (i = 0; i < ARRAY_SIZE(snb_ids); i++)
640
if (devid == snb_ids[i])
647
* Sandy Bridge graphics has trouble with certain ranges, exclude
648
* them from allocation.
650
static void __init trim_snb_memory(void)
652
static const unsigned long bad_pages[] = {
661
if (!snb_gfx_workaround_needed())
664
printk(KERN_DEBUG "reserving inaccessible SNB gfx pages\n");
667
* Reserve all memory below the 1 MB mark that has not
668
* already been reserved.
670
memblock_reserve(0, 1<<20);
672
for (i = 0; i < ARRAY_SIZE(bad_pages); i++) {
673
if (memblock_reserve(bad_pages[i], PAGE_SIZE))
674
printk(KERN_WARNING "failed to reserve 0x%08lx\n",
680
* Here we put platform-specific memory range workarounds, i.e.
681
* memory known to be corrupt or otherwise in need to be reserved on
682
* specific platforms.
684
* If this gets used more widely it could use a real dispatch mechanism.
686
static void __init trim_platform_memory_ranges(void)
616
691
static void __init trim_bios_range(void)
635
710
e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1);
636
712
sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
732
808
#ifdef CONFIG_EFI
733
809
if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
811
set_bit(EFI_BOOT, &x86_efi_facility);
737
812
} else if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
814
set_bit(EFI_BOOT, &x86_efi_facility);
815
set_bit(EFI_64BIT, &x86_efi_facility);
742
if (efi_enabled && efi_memblock_x86_reserve_range())
818
if (efi_enabled(EFI_BOOT))
819
efi_memblock_x86_reserve_range();
746
822
x86_init.oem.arch_setup();
896
972
* The EFI specification says that boot service code won't be called
897
973
* after ExitBootServices(). This is, in fact, a lie.
975
if (efi_enabled(EFI_MEMMAP))
900
976
efi_reserve_boot_services();
902
978
/* preallocate 4k for mptable mpc */
1036
1114
#ifdef CONFIG_VT
1037
1115
#if defined(CONFIG_VGA_CONSOLE)
1038
if (!efi_enabled || (efi_mem_type(0xa0000) != EFI_CONVENTIONAL_MEMORY))
1116
if (!efi_enabled(EFI_BOOT) || (efi_mem_type(0xa0000) != EFI_CONVENTIONAL_MEMORY))
1039
1117
conswitchp = &vga_con;
1040
1118
#elif defined(CONFIG_DUMMY_CONSOLE)
1041
1119
conswitchp = &dummy_con;
1052
1130
arch_init_ideal_nops();
1054
1132
#ifdef CONFIG_EFI
1055
/* Once setup is done above, disable efi_enabled on mismatched
1056
* firmware/kernel archtectures since there is no support for
1133
/* Once setup is done above, unmap the EFI memory map on
1134
* mismatched firmware/kernel archtectures since there is no
1135
* support for runtime services.
1059
if (efi_enabled && IS_ENABLED(CONFIG_X86_64) != efi_64bit) {
1137
if (efi_enabled(EFI_BOOT) &&
1138
IS_ENABLED(CONFIG_X86_64) != efi_enabled(EFI_64BIT)) {
1060
1139
pr_info("efi: Setup done, disabling due to 32/64-bit mismatch\n");
1061
1140
efi_unmap_memmap();