diff options
author | Gabriel L. Somlo <gsomlo@gmail.com> | 2014-04-23 09:42:36 -0400 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2014-05-05 12:29:39 +0200 |
commit | 7bf8ef196e80bedec3c48017e3105e46548e7a7b (patch) | |
tree | 9682f521872ccf46182ebc613c5bc0d44ff716a0 /hw/i386/pc.c | |
parent | 3458b2b075f92f163ccb9a1f24733eb5705947f0 (diff) |
E820: Add interface for accessing e820 table
Add the following two functions:
- e820_get_num_entries() - query the size of the e820 table
- e820_get_entry() - grab an entry matching a given set of criteria
This interface is currently necessary for creating type 19
(memory array mapped address) structures in smbios.
Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/i386/pc.c')
-rw-r--r-- | hw/i386/pc.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 14f0d91f76..aefb31593b 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -612,6 +612,21 @@ int e820_add_entry(uint64_t address, uint64_t length, uint32_t type) return e820_entries; } +int e820_get_num_entries(void) +{ + return e820_entries; +} + +bool e820_get_entry(int idx, uint32_t type, uint64_t *address, uint64_t *length) +{ + if (idx < e820_entries && e820_table[idx].type == cpu_to_le32(type)) { + *address = le64_to_cpu(e820_table[idx].address); + *length = le64_to_cpu(e820_table[idx].length); + return true; + } + return false; +} + /* Calculates the limit to CPU APIC ID values * * This function returns the limit for the APIC ID value, so that all |