[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [QEMU v7 PATCH 5/7] E820: Add interface for accessing e820
From: |
Gabriel L. Somlo |
Subject: |
[Qemu-devel] [QEMU v7 PATCH 5/7] E820: Add interface for accessing e820 table |
Date: |
Mon, 21 Apr 2014 15:27:12 -0400 |
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 <address@hidden>
---
hw/i386/pc.c | 15 +++++++++++++++
include/hw/i386/pc.h | 2 ++
2 files changed, 17 insertions(+)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index f95814b..7155269 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
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 9010246..9f26e14 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -239,6 +239,8 @@ uint16_t pvpanic_port(void);
#define E820_UNUSABLE 5
int e820_add_entry(uint64_t, uint64_t, uint32_t);
+int e820_get_num_entries(void);
+bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
#define PC_Q35_COMPAT_1_7 \
PC_COMPAT_1_7, \
--
1.9.0
- [Qemu-devel] [QEMU v7 PATCH 0/7] SMBIOS: build full tables in QEMU, Gabriel L. Somlo, 2014/04/21
- [Qemu-devel] [QEMU v7 PATCH 1/7] SMBIOS: Rename symbols to better reflect future use, Gabriel L. Somlo, 2014/04/21
- [Qemu-devel] [QEMU v7 PATCH 3/7] SMBIOS: Use macro to set smbios defaults, Gabriel L. Somlo, 2014/04/21
- [Qemu-devel] [QEMU v7 PATCH 7/7] SMBIOS: Build aggregate smbios tables and entry point, Gabriel L. Somlo, 2014/04/21
- [Qemu-devel] [QEMU v7 PATCH 4/7] SMBIOS: Use bitmaps to prevent incompatible comand line options, Gabriel L. Somlo, 2014/04/21
- [Qemu-devel] [QEMU v7 PATCH 6/7] PC: Add (empty) compat functions for machine version 2.0, Gabriel L. Somlo, 2014/04/21
- [Qemu-devel] [QEMU v7 PATCH 5/7] E820: Add interface for accessing e820 table,
Gabriel L. Somlo <=
- [Qemu-devel] [QEMU v7 PATCH 2/7] SMBIOS: Update header file definitions, Gabriel L. Somlo, 2014/04/21
- Re: [Qemu-devel] [QEMU v7 PATCH 0/7] SMBIOS: build full tables in QEMU, Gerd Hoffmann, 2014/04/23