License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[linux-2.6-block.git] / arch / x86 / include / asm / e820 / types.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_E820_TYPES_H
3 #define _ASM_E820_TYPES_H
4
5 #include <uapi/asm/bootparam.h>
6
7 /*
8  * These are the E820 types known to the kernel:
9  */
10 enum e820_type {
11         E820_TYPE_RAM           = 1,
12         E820_TYPE_RESERVED      = 2,
13         E820_TYPE_ACPI          = 3,
14         E820_TYPE_NVS           = 4,
15         E820_TYPE_UNUSABLE      = 5,
16         E820_TYPE_PMEM          = 7,
17
18         /*
19          * This is a non-standardized way to represent ADR or
20          * NVDIMM regions that persist over a reboot.
21          *
22          * The kernel will ignore their special capabilities
23          * unless the CONFIG_X86_PMEM_LEGACY=y option is set.
24          *
25          * ( Note that older platforms also used 6 for the same
26          *   type of memory, but newer versions switched to 12 as
27          *   6 was assigned differently. Some time they will learn... )
28          */
29         E820_TYPE_PRAM          = 12,
30
31         /*
32          * Reserved RAM used by the kernel itself if
33          * CONFIG_INTEL_TXT=y is enabled, memory of this type
34          * will be included in the S3 integrity calculation
35          * and so should not include any memory that the BIOS
36          * might alter over the S3 transition:
37          */
38         E820_TYPE_RESERVED_KERN = 128,
39 };
40
41 /*
42  * A single E820 map entry, describing a memory range of [addr...addr+size-1],
43  * of 'type' memory type:
44  *
45  * (We pack it because there can be thousands of them on large systems.)
46  */
47 struct e820_entry {
48         u64                     addr;
49         u64                     size;
50         enum e820_type          type;
51 } __attribute__((packed));
52
53 /*
54  * The legacy E820 BIOS limits us to 128 (E820_MAX_ENTRIES_ZEROPAGE) nodes
55  * due to the constrained space in the zeropage.
56  *
57  * On large systems we can easily have thousands of nodes with RAM,
58  * which cannot be fit into so few entries - so we have a mechanism
59  * to extend the e820 table size at build-time, via the E820_MAX_ENTRIES
60  * define below.
61  *
62  * ( Those extra entries are enumerated via the EFI memory map, not
63  *   via the legacy zeropage mechanism. )
64  *
65  * Size our internal memory map tables to have room for these additional
66  * entries, based on a heuristic calculation: up to three entries per
67  * NUMA node, plus E820_MAX_ENTRIES_ZEROPAGE for some extra space.
68  *
69  * This allows for bootstrap/firmware quirks such as possible duplicate
70  * E820 entries that might need room in the same arrays, prior to the
71  * call to e820__update_table() to remove duplicates.  The allowance
72  * of three memory map entries per node is "enough" entries for
73  * the initial hardware platform motivating this mechanism to make
74  * use of additional EFI map entries.  Future platforms may want
75  * to allow more than three entries per node or otherwise refine
76  * this size.
77  */
78
79 #include <linux/numa.h>
80
81 #define E820_MAX_ENTRIES        (E820_MAX_ENTRIES_ZEROPAGE + 3*MAX_NUMNODES)
82
83 /*
84  * The whole array of E820 entries:
85  */
86 struct e820_table {
87         __u32 nr_entries;
88         struct e820_entry entries[E820_MAX_ENTRIES];
89 };
90
91 /*
92  * Various well-known legacy memory ranges in physical memory:
93  */
94 #define ISA_START_ADDRESS       0x000a0000
95 #define ISA_END_ADDRESS         0x00100000
96
97 #define BIOS_BEGIN              0x000a0000
98 #define BIOS_END                0x00100000
99
100 #define HIGH_MEMORY             0x00100000
101
102 #define BIOS_ROM_BASE           0xffe00000
103 #define BIOS_ROM_END            0xffffffff
104
105 #endif /* _ASM_E820_TYPES_H */