44 #define SMAP ( 0x534d4150 ) 58 #define E820_TYPE_RAM 1 59 #define E820_TYPE_RESERVED 2 60 #define E820_TYPE_ACPI 3 61 #define E820_TYPE_NVS 4 63 #define E820_ATTR_ENABLED 0x00000001UL 64 #define E820_ATTR_NONVOLATILE 0x00000002UL 65 #define E820_ATTR_UNKNOWN 0xfffffffcUL 67 #define E820_MIN_SIZE 20 71 #define e820buf __use_data16 ( e820buf ) 75 #define memmap_post __use_data16 ( memmap_post ) 83 uint16_t extmem_1m_to_16m_k, extmem_16m_plus_64k;
84 uint16_t confmem_1m_to_16m_k, confmem_16m_plus_64k;
90 DBG (
"INT 15,e801 not available during POST\n" );
99 "=a" ( extmem_1m_to_16m_k ),
100 "=b" ( extmem_16m_plus_64k ),
101 "=c" ( confmem_1m_to_16m_k ),
102 "=d" ( confmem_16m_plus_64k )
106 DBG (
"INT 15,e801 failed with CF set\n" );
110 if ( ! ( extmem_1m_to_16m_k | extmem_16m_plus_64k ) ) {
111 DBG (
"INT 15,e801 extmem=0, using confmem\n" );
112 extmem_1m_to_16m_k = confmem_1m_to_16m_k;
113 extmem_16m_plus_64k = confmem_16m_plus_64k;
116 extmem = ( extmem_1m_to_16m_k + ( extmem_16m_plus_64k * 64 ) );
117 DBG (
"INT 15,e801 extended memory size %d+64*%d=%d kB " 118 "[100000,%llx)\n", extmem_1m_to_16m_k, extmem_16m_plus_64k,
119 extmem, ( 0x100000 + ( ( (
uint64_t ) extmem ) * 1024 ) ) );
126 if ( extmem == ( 0x400000 - 0x400 ) ) {
127 DBG (
"INT 15,e801 reported whole 4GB; assuming insane\n" );
144 :
"=a" ( extmem ) :
"a" ( 0x8800 ) );
146 DBG (
"INT 15,88 extended memory size %d kB [100000, %x)\n",
147 extmem, ( 0x100000 + ( extmem * 1024 ) ) );
160 unsigned int extmem_e801;
161 unsigned int extmem_88;
166 return ( extmem_e801 ? extmem_e801 : extmem_88 );
176 unsigned int count = 0;
187 DBG (
"INT 15,e820 not available during POST\n" );
208 :
"=a" ( smap ),
"=b" (
next ),
211 :
"a" ( 0xe820 ),
"b" (
next ),
217 if ( smap !=
SMAP ) {
218 DBG (
"INT 15,e820 failed SMAP signature check\n" );
223 DBG (
"INT 15,e820 returned only %d bytes\n",
size );
228 DBG (
"INT 15,e820 terminated on CF set\n" );
232 DBG (
"INT 15,e820 region [%llx,%llx) type %d",
237 ?
"enabled" :
"disabled" ) );
239 DBG (
", non-volatile" );
270 DBG (
"INT 15,e820 region 0 starts at %llx (expected " 271 "0); assuming insane\n",
start );
278 if ( (
count == 1 ) && (
start != 0x100000 ) ) {
279 DBG (
"INT 15,e820 region 1 starts at %llx (expected " 280 "100000); assuming insane\n",
start );
288 }
while (
next != 0 );
297 DBG (
"INT 15,e820 returned only %d regions; assuming " 314 unsigned int basemem;
327 inaccessible = ( 1ULL << 32 );
337 if ( (
rc =
meme820 ( region ) ) == 0 ) {
338 DBG (
"Obtained system memory map via INT 15,e820\n" );
341 DBG (
"FBMS base memory size %d kB [0,%x)\n",
342 basemem, ( basemem * 1024 ) );
#define EINVAL
Invalid argument.
struct arbelprm_rc_send_wqe rc
uint32_t attrs
Extended attributes (optional)
void memmap_update(struct memmap_region *region, uint64_t start, uint64_t size, unsigned int flags, const char *name)
Update memory region descriptor.
void int15()
Assembly routine in e820mangler.S.
static unsigned int basememsize(void)
Get size of base memory from BIOS free base memory counter.
uint16_t size
Buffer size.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
unsigned int extmemsize(void)
Get size of extended memory.
static unsigned int extmemsize_e801(void)
Get size of extended memory via INT 15,e801.
unsigned long long uint64_t
#define E820_TYPE_RAM
Normal memory.
#define offsetof(type, field)
Get offset of a field within a structure.
static unsigned int extmemsize_88(void)
Get size of extended memory via INT 15,88.
#define ENOTSUP
Operation not supported.
uint32_t start
Starting offset.
uint64_t start
Start of region.
void memmap_describe(uint64_t min, int hide, struct memmap_region *region)
Describe memory region from system memory map.
An INT 15,e820 memory map entry.
static unsigned int count
Number of entries.
uint64_t len
Length of region.
static int meme820(struct memmap_region *region)
Get e820 memory map.
static void int15_describe(uint64_t min, int hide, struct memmap_region *region)
Describe memory region from system memory map.
__asm__ __volatile__("call *%9" :"=a"(result), "=c"(discard_ecx), "=d"(discard_edx) :"d"(0), "a"(code), "b"(0), "c"(in_phys), "D"(0), "S"(out_phys), "m"(hypercall))
static struct e820_entry __bss16(e820buf)
Buffer for INT 15,e820 calls.
void int15_intercept(int intercept)
Set INT 15 interception flag.
uint32_t next
Next descriptor address.
#define E820_ATTR_NONVOLATILE
#define E820_ATTR_ENABLED
uint32_t type
Type of region.
__asm__(".section \".rodata\", \"a\", " PROGBITS "\n\t" "\nprivate_key_data:\n\t" ".size private_key_data, ( . - private_key_data )\n\t" ".equ private_key_len, ( . - private_key_data )\n\t" ".previous\n\t")
#define ENOTTY
Inappropriate I/O control operation.
#define __from_data16(pointer)
#define MEMMAP_FL_MEMORY
Contains memory.
#define E820_ATTR_UNKNOWN
#define MEMMAP_FL_INACCESSIBLE
Outside of addressable range.
typeof(acpi_finder=acpi_find)
ACPI table finder.
A memory region descriptor.
#define SMAP
Magic value for INT 15,e820 calls.
static void memmap_init(uint64_t min, struct memmap_region *region)
Initialise memory region descriptor.
#define DBG(...)
Print a debugging message.
PROVIDE_MEMMAP(int15, memmap_describe, int15_describe)
#define REAL_CODE(asm_code_str)
#define NULL
NULL pointer (VOID *)
void * memset(void *dest, int character, size_t len) __nonnull