You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branch 'x86-boot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 boot updates from Ingo Molnar:
"The biggest changes in this cycle were:
- reworking of the e820 code: separate in-kernel and boot-ABI data
structures and apply a whole range of cleanups to the kernel side.
No change in functionality.
- enable KASLR by default: it's used by all major distros and it's
out of the experimental stage as well.
- ... misc fixes and cleanups"
* 'x86-boot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (63 commits)
x86/KASLR: Fix kexec kernel boot crash when KASLR randomization fails
x86/reboot: Turn off KVM when halting a CPU
x86/boot: Fix BSS corruption/overwrite bug in early x86 kernel startup
x86: Enable KASLR by default
boot/param: Move next_arg() function to lib/cmdline.c for later reuse
x86/boot: Fix Sparse warning by including required header file
x86/boot/64: Rename start_cpu()
x86/xen: Update e820 table handling to the new core x86 E820 code
x86/boot: Fix pr_debug() API braindamage
xen, x86/headers: Add <linux/device.h> dependency to <asm/xen/page.h>
x86/boot/e820: Simplify e820__update_table()
x86/boot/e820: Separate the E820 ABI structures from the in-kernel structures
x86/boot/e820: Fix and clean up e820_type switch() statements
x86/boot/e820: Rename the remaining E820 APIs to the e820__*() prefix
x86/boot/e820: Remove unnecessary #include's
x86/boot/e820: Rename e820_mark_nosave_regions() to e820__register_nosave_regions()
x86/boot/e820: Rename e820_reserve_resources*() to e820__reserve_resources*()
x86/boot/e820: Use bool in query APIs
x86/boot/e820: Document e820__reserve_setup_data()
x86/boot/e820: Clean up __e820__update_table() et al
...
This commit is contained in:
@@ -27,7 +27,7 @@ Offset Proto Name Meaning
|
||||
1C0/020 ALL efi_info EFI 32 information (struct efi_info)
|
||||
1E0/004 ALL alk_mem_k Alternative mem check, in KB
|
||||
1E4/004 ALL scratch Scratch field for the kernel setup code
|
||||
1E8/001 ALL e820_entries Number of entries in e820_map (below)
|
||||
1E8/001 ALL e820_entries Number of entries in e820_table (below)
|
||||
1E9/001 ALL eddbuf_entries Number of entries in eddbuf (below)
|
||||
1EA/001 ALL edd_mbr_sig_buf_entries Number of entries in edd_mbr_sig_buffer
|
||||
(below)
|
||||
@@ -35,6 +35,6 @@ Offset Proto Name Meaning
|
||||
1EC/001 ALL secure_boot Secure boot is enabled in the firmware
|
||||
1EF/001 ALL sentinel Used to detect broken bootloaders
|
||||
290/040 ALL edd_mbr_sig_buffer EDD MBR signatures
|
||||
2D0/A00 ALL e820_map E820 memory map table
|
||||
(array of struct e820entry)
|
||||
2D0/A00 ALL e820_table E820 memory map table
|
||||
(array of struct e820_entry)
|
||||
D00/1EC ALL eddbuf EDD data (array of struct edd_info)
|
||||
|
||||
+3
-3
@@ -1973,7 +1973,7 @@ config RELOCATABLE
|
||||
config RANDOMIZE_BASE
|
||||
bool "Randomize the address of the kernel image (KASLR)"
|
||||
depends on RELOCATABLE
|
||||
default n
|
||||
default y
|
||||
---help---
|
||||
In support of Kernel Address Space Layout Randomization (KASLR),
|
||||
this randomizes the physical address at which the kernel image
|
||||
@@ -2003,7 +2003,7 @@ config RANDOMIZE_BASE
|
||||
theoretically possible, but the implementations are further
|
||||
limited due to memory layouts.
|
||||
|
||||
If unsure, say N.
|
||||
If unsure, say Y.
|
||||
|
||||
# Relocation on x86 needs some additional build support
|
||||
config X86_NEED_RELOCS
|
||||
@@ -2052,7 +2052,7 @@ config RANDOMIZE_MEMORY
|
||||
configuration have in average 30,000 different possible virtual
|
||||
addresses for each memory section.
|
||||
|
||||
If unsure, say N.
|
||||
If unsure, say Y.
|
||||
|
||||
config RANDOMIZE_MEMORY_PHYSICAL_PADDING
|
||||
hex "Physical memory mapping padding" if EXPERT
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#ifndef BOOT_BOOT_H
|
||||
#define BOOT_BOOT_H
|
||||
|
||||
#define STACK_SIZE 512 /* Minimum number of bytes for stack */
|
||||
#define STACK_SIZE 1024 /* Minimum number of bytes for stack */
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
|
||||
#include <linux/efi.h>
|
||||
#include <linux/pci.h>
|
||||
|
||||
#include <asm/efi.h>
|
||||
#include <asm/e820/types.h>
|
||||
#include <asm/setup.h>
|
||||
#include <asm/desc.h>
|
||||
|
||||
@@ -729,7 +731,7 @@ static void add_e820ext(struct boot_params *params,
|
||||
unsigned long size;
|
||||
|
||||
e820ext->type = SETUP_E820_EXT;
|
||||
e820ext->len = nr_entries * sizeof(struct e820entry);
|
||||
e820ext->len = nr_entries * sizeof(struct boot_e820_entry);
|
||||
e820ext->next = 0;
|
||||
|
||||
data = (struct setup_data *)(unsigned long)params->hdr.setup_data;
|
||||
@@ -746,9 +748,9 @@ static void add_e820ext(struct boot_params *params,
|
||||
static efi_status_t setup_e820(struct boot_params *params,
|
||||
struct setup_data *e820ext, u32 e820ext_size)
|
||||
{
|
||||
struct e820entry *e820_map = ¶ms->e820_map[0];
|
||||
struct boot_e820_entry *entry = params->e820_table;
|
||||
struct efi_info *efi = ¶ms->efi_info;
|
||||
struct e820entry *prev = NULL;
|
||||
struct boot_e820_entry *prev = NULL;
|
||||
u32 nr_entries;
|
||||
u32 nr_desc;
|
||||
int i;
|
||||
@@ -773,15 +775,15 @@ static efi_status_t setup_e820(struct boot_params *params,
|
||||
case EFI_MEMORY_MAPPED_IO:
|
||||
case EFI_MEMORY_MAPPED_IO_PORT_SPACE:
|
||||
case EFI_PAL_CODE:
|
||||
e820_type = E820_RESERVED;
|
||||
e820_type = E820_TYPE_RESERVED;
|
||||
break;
|
||||
|
||||
case EFI_UNUSABLE_MEMORY:
|
||||
e820_type = E820_UNUSABLE;
|
||||
e820_type = E820_TYPE_UNUSABLE;
|
||||
break;
|
||||
|
||||
case EFI_ACPI_RECLAIM_MEMORY:
|
||||
e820_type = E820_ACPI;
|
||||
e820_type = E820_TYPE_ACPI;
|
||||
break;
|
||||
|
||||
case EFI_LOADER_CODE:
|
||||
@@ -789,15 +791,15 @@ static efi_status_t setup_e820(struct boot_params *params,
|
||||
case EFI_BOOT_SERVICES_CODE:
|
||||
case EFI_BOOT_SERVICES_DATA:
|
||||
case EFI_CONVENTIONAL_MEMORY:
|
||||
e820_type = E820_RAM;
|
||||
e820_type = E820_TYPE_RAM;
|
||||
break;
|
||||
|
||||
case EFI_ACPI_MEMORY_NVS:
|
||||
e820_type = E820_NVS;
|
||||
e820_type = E820_TYPE_NVS;
|
||||
break;
|
||||
|
||||
case EFI_PERSISTENT_MEMORY:
|
||||
e820_type = E820_PMEM;
|
||||
e820_type = E820_TYPE_PMEM;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -811,26 +813,26 @@ static efi_status_t setup_e820(struct boot_params *params,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (nr_entries == ARRAY_SIZE(params->e820_map)) {
|
||||
u32 need = (nr_desc - i) * sizeof(struct e820entry) +
|
||||
if (nr_entries == ARRAY_SIZE(params->e820_table)) {
|
||||
u32 need = (nr_desc - i) * sizeof(struct e820_entry) +
|
||||
sizeof(struct setup_data);
|
||||
|
||||
if (!e820ext || e820ext_size < need)
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
|
||||
/* boot_params map full, switch to e820 extended */
|
||||
e820_map = (struct e820entry *)e820ext->data;
|
||||
entry = (struct boot_e820_entry *)e820ext->data;
|
||||
}
|
||||
|
||||
e820_map->addr = d->phys_addr;
|
||||
e820_map->size = d->num_pages << PAGE_SHIFT;
|
||||
e820_map->type = e820_type;
|
||||
prev = e820_map++;
|
||||
entry->addr = d->phys_addr;
|
||||
entry->size = d->num_pages << PAGE_SHIFT;
|
||||
entry->type = e820_type;
|
||||
prev = entry++;
|
||||
nr_entries++;
|
||||
}
|
||||
|
||||
if (nr_entries > ARRAY_SIZE(params->e820_map)) {
|
||||
u32 nr_e820ext = nr_entries - ARRAY_SIZE(params->e820_map);
|
||||
if (nr_entries > ARRAY_SIZE(params->e820_table)) {
|
||||
u32 nr_e820ext = nr_entries - ARRAY_SIZE(params->e820_table);
|
||||
|
||||
add_e820ext(params, e820ext, nr_e820ext);
|
||||
nr_entries -= nr_e820ext;
|
||||
@@ -848,7 +850,7 @@ static efi_status_t alloc_e820ext(u32 nr_desc, struct setup_data **e820ext,
|
||||
unsigned long size;
|
||||
|
||||
size = sizeof(struct setup_data) +
|
||||
sizeof(struct e820entry) * nr_desc;
|
||||
sizeof(struct e820_entry) * nr_desc;
|
||||
|
||||
if (*e820ext) {
|
||||
efi_call_early(free_pool, *e820ext);
|
||||
@@ -884,9 +886,9 @@ static efi_status_t exit_boot_func(efi_system_table_t *sys_table_arg,
|
||||
|
||||
if (first) {
|
||||
nr_desc = *map->buff_size / *map->desc_size;
|
||||
if (nr_desc > ARRAY_SIZE(p->boot_params->e820_map)) {
|
||||
if (nr_desc > ARRAY_SIZE(p->boot_params->e820_table)) {
|
||||
u32 nr_e820ext = nr_desc -
|
||||
ARRAY_SIZE(p->boot_params->e820_map);
|
||||
ARRAY_SIZE(p->boot_params->e820_table);
|
||||
|
||||
status = alloc_e820ext(nr_e820ext, &p->e820ext,
|
||||
&p->e820ext_size);
|
||||
|
||||
@@ -426,7 +426,7 @@ static unsigned long slots_fetch_random(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void process_e820_entry(struct e820entry *entry,
|
||||
static void process_e820_entry(struct boot_e820_entry *entry,
|
||||
unsigned long minimum,
|
||||
unsigned long image_size)
|
||||
{
|
||||
@@ -435,7 +435,7 @@ static void process_e820_entry(struct e820entry *entry,
|
||||
unsigned long start_orig;
|
||||
|
||||
/* Skip non-RAM entries. */
|
||||
if (entry->type != E820_RAM)
|
||||
if (entry->type != E820_TYPE_RAM)
|
||||
return;
|
||||
|
||||
/* On 32-bit, ignore entries entirely above our maximum. */
|
||||
@@ -518,7 +518,7 @@ static unsigned long find_random_phys_addr(unsigned long minimum,
|
||||
|
||||
/* Verify potential e820 positions, appending to slots list. */
|
||||
for (i = 0; i < boot_params->e820_entries; i++) {
|
||||
process_e820_entry(&boot_params->e820_map[i], minimum,
|
||||
process_e820_entry(&boot_params->e820_table[i], minimum,
|
||||
image_size);
|
||||
if (slot_area_index == MAX_SLOT_AREA) {
|
||||
debug_putstr("Aborted e820 scan (slot_areas full)!\n");
|
||||
@@ -597,10 +597,17 @@ void choose_random_location(unsigned long input,
|
||||
add_identity_map(random_addr, output_size);
|
||||
*output = random_addr;
|
||||
}
|
||||
|
||||
/*
|
||||
* This loads the identity mapping page table.
|
||||
* This should only be done if a new physical address
|
||||
* is found for the kernel, otherwise we should keep
|
||||
* the old page table to make it be like the "nokaslr"
|
||||
* case.
|
||||
*/
|
||||
finalize_identity_maps();
|
||||
}
|
||||
|
||||
/* This actually loads the identity pagetable on x86_64. */
|
||||
finalize_identity_maps();
|
||||
|
||||
/* Pick random virtual address starting from LOAD_PHYSICAL_ADDR. */
|
||||
if (IS_ENABLED(CONFIG_X86_64))
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <asm/segment.h>
|
||||
#include <generated/utsrelease.h>
|
||||
#include <asm/boot.h>
|
||||
#include <asm/e820.h>
|
||||
#include <asm/page_types.h>
|
||||
#include <asm/setup.h>
|
||||
#include <asm/bootparam.h>
|
||||
|
||||
@@ -21,8 +21,8 @@ static int detect_memory_e820(void)
|
||||
{
|
||||
int count = 0;
|
||||
struct biosregs ireg, oreg;
|
||||
struct e820entry *desc = boot_params.e820_map;
|
||||
static struct e820entry buf; /* static so it is zeroed */
|
||||
struct boot_e820_entry *desc = boot_params.e820_table;
|
||||
static struct boot_e820_entry buf; /* static so it is zeroed */
|
||||
|
||||
initregs(&ireg);
|
||||
ireg.ax = 0xe820;
|
||||
@@ -66,7 +66,7 @@ static int detect_memory_e820(void)
|
||||
|
||||
*desc++ = buf;
|
||||
count++;
|
||||
} while (ireg.ebx && count < ARRAY_SIZE(boot_params.e820_map));
|
||||
} while (ireg.ebx && count < ARRAY_SIZE(boot_params.e820_table));
|
||||
|
||||
return boot_params.e820_entries = count;
|
||||
}
|
||||
|
||||
@@ -57,6 +57,8 @@ CONFIG_EFI=y
|
||||
CONFIG_HZ_1000=y
|
||||
CONFIG_KEXEC=y
|
||||
CONFIG_CRASH_DUMP=y
|
||||
CONFIG_RANDOMIZE_BASE=y
|
||||
CONFIG_RANDOMIZE_MEMORY=y
|
||||
# CONFIG_COMPAT_VDSO is not set
|
||||
CONFIG_HIBERNATION=y
|
||||
CONFIG_PM_DEBUG=y
|
||||
|
||||
@@ -55,6 +55,8 @@ CONFIG_EFI=y
|
||||
CONFIG_HZ_1000=y
|
||||
CONFIG_KEXEC=y
|
||||
CONFIG_CRASH_DUMP=y
|
||||
CONFIG_RANDOMIZE_BASE=y
|
||||
CONFIG_RANDOMIZE_MEMORY=y
|
||||
# CONFIG_COMPAT_VDSO is not set
|
||||
CONFIG_HIBERNATION=y
|
||||
CONFIG_PM_DEBUG=y
|
||||
|
||||
@@ -52,6 +52,8 @@ extern u8 acpi_sci_flags;
|
||||
extern int acpi_sci_override_gsi;
|
||||
void acpi_pic_sci_set_trigger(unsigned int, u16);
|
||||
|
||||
struct device;
|
||||
|
||||
extern int (*__acpi_register_gsi)(struct device *dev, u32 gsi,
|
||||
int trigger, int polarity);
|
||||
extern void (*__acpi_unregister_gsi)(u32 gsi);
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
#ifndef _ASM_X86_E820_H
|
||||
#define _ASM_X86_E820_H
|
||||
|
||||
/*
|
||||
* E820_X_MAX is the maximum size of the extended E820 table. The extended
|
||||
* table may contain up to 3 extra E820 entries per possible NUMA node, so we
|
||||
* make room for 3 * MAX_NUMNODES possible entries, beyond the standard 128.
|
||||
* Also note that E820_X_MAX *must* be defined before we include uapi/asm/e820.h.
|
||||
*/
|
||||
#include <linux/numa.h>
|
||||
#define E820_X_MAX (E820MAX + 3 * MAX_NUMNODES)
|
||||
|
||||
#include <uapi/asm/e820.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
/* see comment in arch/x86/kernel/e820.c */
|
||||
extern struct e820map *e820;
|
||||
extern struct e820map *e820_saved;
|
||||
|
||||
extern unsigned long pci_mem_start;
|
||||
extern int e820_any_mapped(u64 start, u64 end, unsigned type);
|
||||
extern int e820_all_mapped(u64 start, u64 end, unsigned type);
|
||||
extern void e820_add_region(u64 start, u64 size, int type);
|
||||
extern void e820_print_map(char *who);
|
||||
extern int
|
||||
sanitize_e820_map(struct e820entry *biosmap, int max_nr_map, u32 *pnr_map);
|
||||
extern u64 e820_update_range(u64 start, u64 size, unsigned old_type,
|
||||
unsigned new_type);
|
||||
extern u64 e820_remove_range(u64 start, u64 size, unsigned old_type,
|
||||
int checktype);
|
||||
extern void update_e820(void);
|
||||
extern void e820_setup_gap(void);
|
||||
struct setup_data;
|
||||
extern void parse_e820_ext(u64 phys_addr, u32 data_len);
|
||||
|
||||
#if defined(CONFIG_X86_64) || \
|
||||
(defined(CONFIG_X86_32) && defined(CONFIG_HIBERNATION))
|
||||
extern void e820_mark_nosave_regions(unsigned long limit_pfn);
|
||||
#else
|
||||
static inline void e820_mark_nosave_regions(unsigned long limit_pfn)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
extern unsigned long e820_end_of_ram_pfn(void);
|
||||
extern unsigned long e820_end_of_low_ram_pfn(void);
|
||||
extern u64 early_reserve_e820(u64 sizet, u64 align);
|
||||
|
||||
void memblock_x86_fill(void);
|
||||
void memblock_find_dma_reserve(void);
|
||||
|
||||
extern void finish_e820_parsing(void);
|
||||
extern void e820_reserve_resources(void);
|
||||
extern void e820_reserve_resources_late(void);
|
||||
extern void setup_memory_map(void);
|
||||
extern char *default_machine_specific_memory_setup(void);
|
||||
|
||||
extern void e820_reallocate_tables(void);
|
||||
|
||||
/*
|
||||
* Returns true iff the specified range [s,e) is completely contained inside
|
||||
* the ISA region.
|
||||
*/
|
||||
static inline bool is_ISA_range(u64 s, u64 e)
|
||||
{
|
||||
return s >= ISA_START_ADDRESS && e <= ISA_END_ADDRESS;
|
||||
}
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#include <linux/ioport.h>
|
||||
|
||||
#define HIGH_MEMORY (1024*1024)
|
||||
#endif /* _ASM_X86_E820_H */
|
||||
@@ -0,0 +1,50 @@
|
||||
#ifndef _ASM_E820_API_H
|
||||
#define _ASM_E820_API_H
|
||||
|
||||
#include <asm/e820/types.h>
|
||||
|
||||
extern struct e820_table *e820_table;
|
||||
extern struct e820_table *e820_table_firmware;
|
||||
|
||||
extern unsigned long pci_mem_start;
|
||||
|
||||
extern bool e820__mapped_any(u64 start, u64 end, enum e820_type type);
|
||||
extern bool e820__mapped_all(u64 start, u64 end, enum e820_type type);
|
||||
|
||||
extern void e820__range_add (u64 start, u64 size, enum e820_type type);
|
||||
extern u64 e820__range_update(u64 start, u64 size, enum e820_type old_type, enum e820_type new_type);
|
||||
extern u64 e820__range_remove(u64 start, u64 size, enum e820_type old_type, bool check_type);
|
||||
|
||||
extern void e820__print_table(char *who);
|
||||
extern int e820__update_table(struct e820_table *table);
|
||||
extern void e820__update_table_print(void);
|
||||
|
||||
extern unsigned long e820__end_of_ram_pfn(void);
|
||||
extern unsigned long e820__end_of_low_ram_pfn(void);
|
||||
|
||||
extern u64 e820__memblock_alloc_reserved(u64 size, u64 align);
|
||||
extern void e820__memblock_setup(void);
|
||||
|
||||
extern void e820__reserve_setup_data(void);
|
||||
extern void e820__finish_early_params(void);
|
||||
extern void e820__reserve_resources(void);
|
||||
extern void e820__reserve_resources_late(void);
|
||||
|
||||
extern void e820__memory_setup(void);
|
||||
extern void e820__memory_setup_extended(u64 phys_addr, u32 data_len);
|
||||
extern char *e820__memory_setup_default(void);
|
||||
extern void e820__setup_pci_gap(void);
|
||||
|
||||
extern void e820__reallocate_tables(void);
|
||||
extern void e820__register_nosave_regions(unsigned long limit_pfn);
|
||||
|
||||
/*
|
||||
* Returns true iff the specified range [start,end) is completely contained inside
|
||||
* the ISA region.
|
||||
*/
|
||||
static inline bool is_ISA_range(u64 start, u64 end)
|
||||
{
|
||||
return start >= ISA_START_ADDRESS && end <= ISA_END_ADDRESS;
|
||||
}
|
||||
|
||||
#endif /* _ASM_E820_API_H */
|
||||
@@ -0,0 +1,104 @@
|
||||
#ifndef _ASM_E820_TYPES_H
|
||||
#define _ASM_E820_TYPES_H
|
||||
|
||||
#include <uapi/asm/bootparam.h>
|
||||
|
||||
/*
|
||||
* These are the E820 types known to the kernel:
|
||||
*/
|
||||
enum e820_type {
|
||||
E820_TYPE_RAM = 1,
|
||||
E820_TYPE_RESERVED = 2,
|
||||
E820_TYPE_ACPI = 3,
|
||||
E820_TYPE_NVS = 4,
|
||||
E820_TYPE_UNUSABLE = 5,
|
||||
E820_TYPE_PMEM = 7,
|
||||
|
||||
/*
|
||||
* This is a non-standardized way to represent ADR or
|
||||
* NVDIMM regions that persist over a reboot.
|
||||
*
|
||||
* The kernel will ignore their special capabilities
|
||||
* unless the CONFIG_X86_PMEM_LEGACY=y option is set.
|
||||
*
|
||||
* ( Note that older platforms also used 6 for the same
|
||||
* type of memory, but newer versions switched to 12 as
|
||||
* 6 was assigned differently. Some time they will learn... )
|
||||
*/
|
||||
E820_TYPE_PRAM = 12,
|
||||
|
||||
/*
|
||||
* Reserved RAM used by the kernel itself if
|
||||
* CONFIG_INTEL_TXT=y is enabled, memory of this type
|
||||
* will be included in the S3 integrity calculation
|
||||
* and so should not include any memory that the BIOS
|
||||
* might alter over the S3 transition:
|
||||
*/
|
||||
E820_TYPE_RESERVED_KERN = 128,
|
||||
};
|
||||
|
||||
/*
|
||||
* A single E820 map entry, describing a memory range of [addr...addr+size-1],
|
||||
* of 'type' memory type:
|
||||
*
|
||||
* (We pack it because there can be thousands of them on large systems.)
|
||||
*/
|
||||
struct e820_entry {
|
||||
u64 addr;
|
||||
u64 size;
|
||||
enum e820_type type;
|
||||
} __attribute__((packed));
|
||||
|
||||
/*
|
||||
* The legacy E820 BIOS limits us to 128 (E820_MAX_ENTRIES_ZEROPAGE) nodes
|
||||
* due to the constrained space in the zeropage.
|
||||
*
|
||||
* On large systems we can easily have thousands of nodes with RAM,
|
||||
* which cannot be fit into so few entries - so we have a mechanism
|
||||
* to extend the e820 table size at build-time, via the E820_MAX_ENTRIES
|
||||
* define below.
|
||||
*
|
||||
* ( Those extra entries are enumerated via the EFI memory map, not
|
||||
* via the legacy zeropage mechanism. )
|
||||
*
|
||||
* Size our internal memory map tables to have room for these additional
|
||||
* entries, based on a heuristic calculation: up to three entries per
|
||||
* NUMA node, plus E820_MAX_ENTRIES_ZEROPAGE for some extra space.
|
||||
*
|
||||
* This allows for bootstrap/firmware quirks such as possible duplicate
|
||||
* E820 entries that might need room in the same arrays, prior to the
|
||||
* call to e820__update_table() to remove duplicates. The allowance
|
||||
* of three memory map entries per node is "enough" entries for
|
||||
* the initial hardware platform motivating this mechanism to make
|
||||
* use of additional EFI map entries. Future platforms may want
|
||||
* to allow more than three entries per node or otherwise refine
|
||||
* this size.
|
||||
*/
|
||||
|
||||
#include <linux/numa.h>
|
||||
|
||||
#define E820_MAX_ENTRIES (E820_MAX_ENTRIES_ZEROPAGE + 3*MAX_NUMNODES)
|
||||
|
||||
/*
|
||||
* The whole array of E820 entries:
|
||||
*/
|
||||
struct e820_table {
|
||||
__u32 nr_entries;
|
||||
struct e820_entry entries[E820_MAX_ENTRIES];
|
||||
};
|
||||
|
||||
/*
|
||||
* Various well-known legacy memory ranges in physical memory:
|
||||
*/
|
||||
#define ISA_START_ADDRESS 0x000a0000
|
||||
#define ISA_END_ADDRESS 0x00100000
|
||||
|
||||
#define BIOS_BEGIN 0x000a0000
|
||||
#define BIOS_END 0x00100000
|
||||
|
||||
#define HIGH_MEMORY 0x00100000
|
||||
|
||||
#define BIOS_ROM_BASE 0xffe00000
|
||||
#define BIOS_ROM_END 0xffffffff
|
||||
|
||||
#endif /* _ASM_E820_TYPES_H */
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef _ASM_X86_GART_H
|
||||
#define _ASM_X86_GART_H
|
||||
|
||||
#include <asm/e820.h>
|
||||
#include <asm/e820/api.h>
|
||||
|
||||
extern void set_up_gart_resume(u32, u32);
|
||||
|
||||
@@ -97,7 +97,7 @@ static inline int aperture_valid(u64 aper_base, u32 aper_size, u32 min_size)
|
||||
printk(KERN_INFO "Aperture beyond 4GB. Ignoring.\n");
|
||||
return 0;
|
||||
}
|
||||
if (e820_any_mapped(aper_base, aper_base + aper_size, E820_RAM)) {
|
||||
if (e820__mapped_any(aper_base, aper_base + aper_size, E820_TYPE_RAM)) {
|
||||
printk(KERN_INFO "Aperture pointing to e820 RAM. Ignoring.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ static inline void find_smp_config(void)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_X86_MPPARSE
|
||||
extern void early_reserve_e820_mpc_new(void);
|
||||
extern void e820__memblock_alloc_reserved_mpc_new(void);
|
||||
extern int enable_update_mptable;
|
||||
extern int default_mpc_apic_id(struct mpc_cpu *m);
|
||||
extern void default_smp_read_mpc_oem(struct mpc_table *mpc);
|
||||
@@ -76,7 +76,7 @@ extern void default_mpc_oem_bus_info(struct mpc_bus *m, char *str);
|
||||
extern void default_find_smp_config(void);
|
||||
extern void default_get_smp_config(unsigned int early);
|
||||
#else
|
||||
static inline void early_reserve_e820_mpc_new(void) { }
|
||||
static inline void e820__memblock_alloc_reserved_mpc_new(void) { }
|
||||
#define enable_update_mptable 0
|
||||
#define default_mpc_apic_id NULL
|
||||
#define default_smp_read_mpc_oem NULL
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
* (c) 1999 Martin Mares <mj@ucw.cz>
|
||||
*/
|
||||
|
||||
#include <linux/ioport.h>
|
||||
|
||||
#undef DEBUG
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
#define _ASM_X86_PGTABLE_H
|
||||
|
||||
#include <asm/page.h>
|
||||
#include <asm/e820.h>
|
||||
|
||||
#include <asm/pgtable_types.h>
|
||||
|
||||
/*
|
||||
@@ -845,6 +843,7 @@ static inline int pgd_none(pgd_t pgd)
|
||||
extern int direct_gbpages;
|
||||
void init_mem_mapping(void);
|
||||
void early_alloc_pgt_buf(void);
|
||||
extern void memblock_find_dma_reserve(void);
|
||||
|
||||
#ifdef CONFIG_X86_64
|
||||
/* Realmode trampoline initialization. */
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/pfn.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/device.h>
|
||||
|
||||
#include <linux/uaccess.h>
|
||||
#include <asm/page.h>
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include <linux/screen_info.h>
|
||||
#include <linux/apm_bios.h>
|
||||
#include <linux/edd.h>
|
||||
#include <asm/e820.h>
|
||||
#include <asm/ist.h>
|
||||
#include <video/edid.h>
|
||||
|
||||
@@ -111,6 +110,21 @@ struct efi_info {
|
||||
__u32 efi_memmap_hi;
|
||||
};
|
||||
|
||||
/*
|
||||
* This is the maximum number of entries in struct boot_params::e820_table
|
||||
* (the zeropage), which is part of the x86 boot protocol ABI:
|
||||
*/
|
||||
#define E820_MAX_ENTRIES_ZEROPAGE 128
|
||||
|
||||
/*
|
||||
* The E820 memory region entry of the boot protocol ABI:
|
||||
*/
|
||||
struct boot_e820_entry {
|
||||
__u64 addr;
|
||||
__u64 size;
|
||||
__u32 type;
|
||||
} __attribute__((packed));
|
||||
|
||||
/* The so-called "zeropage" */
|
||||
struct boot_params {
|
||||
struct screen_info screen_info; /* 0x000 */
|
||||
@@ -153,7 +167,7 @@ struct boot_params {
|
||||
struct setup_header hdr; /* setup header */ /* 0x1f1 */
|
||||
__u8 _pad7[0x290-0x1f1-sizeof(struct setup_header)];
|
||||
__u32 edd_mbr_sig_buffer[EDD_MBR_SIG_MAX]; /* 0x290 */
|
||||
struct e820entry e820_map[E820MAX]; /* 0x2d0 */
|
||||
struct boot_e820_entry e820_table[E820_MAX_ENTRIES_ZEROPAGE]; /* 0x2d0 */
|
||||
__u8 _pad8[48]; /* 0xcd0 */
|
||||
struct edd_info eddbuf[EDDMAXNR]; /* 0xd00 */
|
||||
__u8 _pad9[276]; /* 0xeec */
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <linux/pci.h>
|
||||
#include <linux/efi-bgrt.h>
|
||||
|
||||
#include <asm/e820/api.h>
|
||||
#include <asm/irqdomain.h>
|
||||
#include <asm/pci_x86.h>
|
||||
#include <asm/pgtable.h>
|
||||
@@ -1723,6 +1724,6 @@ int __acpi_release_global_lock(unsigned int *lock)
|
||||
|
||||
void __init arch_reserve_mem_area(acpi_physical_address addr, size_t size)
|
||||
{
|
||||
e820_add_region(addr, size, E820_ACPI);
|
||||
update_e820();
|
||||
e820__range_add(addr, size, E820_TYPE_ACPI);
|
||||
e820__update_table_print();
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user