1*6f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2af170c50SDavid Howells #ifndef _UAPI_ASM_X86_E820_H 3af170c50SDavid Howells #define _UAPI_ASM_X86_E820_H 4af170c50SDavid Howells #define E820MAP 0x2d0 /* our map */ 5af170c50SDavid Howells #define E820MAX 128 /* number of entries in E820MAP */ 6af170c50SDavid Howells 7af170c50SDavid Howells /* 8af170c50SDavid Howells * Legacy E820 BIOS limits us to 128 (E820MAX) nodes due to the 9af170c50SDavid Howells * constrained space in the zeropage. If we have more nodes than 10af170c50SDavid Howells * that, and if we've booted off EFI firmware, then the EFI tables 11af170c50SDavid Howells * passed us from the EFI firmware can list more nodes. Size our 12af170c50SDavid Howells * internal memory map tables to have room for these additional 13af170c50SDavid Howells * nodes, based on up to three entries per node for which the 14af170c50SDavid Howells * kernel was built: MAX_NUMNODES == (1 << CONFIG_NODES_SHIFT), 15af170c50SDavid Howells * plus E820MAX, allowing space for the possible duplicate E820 16af170c50SDavid Howells * entries that might need room in the same arrays, prior to the 17af170c50SDavid Howells * call to sanitize_e820_map() to remove duplicates. The allowance 18af170c50SDavid Howells * of three memory map entries per node is "enough" entries for 19af170c50SDavid Howells * the initial hardware platform motivating this mechanism to make 20af170c50SDavid Howells * use of additional EFI map entries. Future platforms may want 21af170c50SDavid Howells * to allow more than three entries per node or otherwise refine 22af170c50SDavid Howells * this size. 23af170c50SDavid Howells */ 24af170c50SDavid Howells 25af170c50SDavid Howells #ifndef __KERNEL__ 26af170c50SDavid Howells #define E820_X_MAX E820MAX 27af170c50SDavid Howells #endif 28af170c50SDavid Howells 29af170c50SDavid Howells #define E820NR 0x1e8 /* # entries in E820MAP */ 30af170c50SDavid Howells 31af170c50SDavid Howells #define E820_RAM 1 32af170c50SDavid Howells #define E820_RESERVED 2 33af170c50SDavid Howells #define E820_ACPI 3 34af170c50SDavid Howells #define E820_NVS 4 35af170c50SDavid Howells #define E820_UNUSABLE 5 36ad5fb870SDan Williams #define E820_PMEM 7 37af170c50SDavid Howells 38ec776ef6SChristoph Hellwig /* 39ec776ef6SChristoph Hellwig * This is a non-standardized way to represent ADR or NVDIMM regions that 40ec776ef6SChristoph Hellwig * persist over a reboot. The kernel will ignore their special capabilities 417a67832cSDan Williams * unless the CONFIG_X86_PMEM_LEGACY option is set. 42ec776ef6SChristoph Hellwig * 43ec776ef6SChristoph Hellwig * ( Note that older platforms also used 6 for the same type of memory, 44ec776ef6SChristoph Hellwig * but newer versions switched to 12 as 6 was assigned differently. Some 45ec776ef6SChristoph Hellwig * time they will learn... ) 46ec776ef6SChristoph Hellwig */ 47ec776ef6SChristoph Hellwig #define E820_PRAM 12 48af170c50SDavid Howells 49af170c50SDavid Howells /* 50af170c50SDavid Howells * reserved RAM used by kernel itself 51af170c50SDavid Howells * if CONFIG_INTEL_TXT is enabled, memory of this type will be 52af170c50SDavid Howells * included in the S3 integrity calculation and so should not include 53af170c50SDavid Howells * any memory that BIOS might alter over the S3 transition 54af170c50SDavid Howells */ 55af170c50SDavid Howells #define E820_RESERVED_KERN 128 56af170c50SDavid Howells 57af170c50SDavid Howells #ifndef __ASSEMBLY__ 58af170c50SDavid Howells #include <linux/types.h> 59af170c50SDavid Howells struct e820entry { 60af170c50SDavid Howells __u64 addr; /* start of memory segment */ 61af170c50SDavid Howells __u64 size; /* size of memory segment */ 62af170c50SDavid Howells __u32 type; /* type of memory segment */ 63af170c50SDavid Howells } __attribute__((packed)); 64af170c50SDavid Howells 65af170c50SDavid Howells struct e820map { 66af170c50SDavid Howells __u32 nr_map; 67af170c50SDavid Howells struct e820entry map[E820_X_MAX]; 68af170c50SDavid Howells }; 69af170c50SDavid Howells 70af170c50SDavid Howells #define ISA_START_ADDRESS 0xa0000 71af170c50SDavid Howells #define ISA_END_ADDRESS 0x100000 72af170c50SDavid Howells 73af170c50SDavid Howells #define BIOS_BEGIN 0x000a0000 74af170c50SDavid Howells #define BIOS_END 0x00100000 75af170c50SDavid Howells 76af170c50SDavid Howells #define BIOS_ROM_BASE 0xffe00000 77af170c50SDavid Howells #define BIOS_ROM_END 0xffffffff 78af170c50SDavid Howells 79af170c50SDavid Howells #endif /* __ASSEMBLY__ */ 80af170c50SDavid Howells 81af170c50SDavid Howells 82af170c50SDavid Howells #endif /* _UAPI_ASM_X86_E820_H */ 83