From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Gabriel L. Somlo" <gsomlo@gmail.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Gabriel Somlo <somlo@cmu.edu>,
Anthony Liguori <aliguori@amazon.com>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL v2 2/7] E820: Add interface for accessing e820 table
Date: Mon, 5 May 2014 13:23:11 +0200 [thread overview]
Message-ID: <1399288996-9721-3-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1399288996-9721-1-git-send-email-kraxel@redhat.com>
From: "Gabriel L. Somlo" <gsomlo@gmail.com>
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>
---
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 14f0d91..aefb315 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.8.3.1
next prev parent reply other threads:[~2014-05-05 11:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-05 11:23 [Qemu-devel] [PULL v2 0/7] smbios: make qemu generate smbios tables Gerd Hoffmann
2014-05-05 11:23 ` [Qemu-devel] [PULL v2 1/7] pc: add 2.1 machine type Gerd Hoffmann
2014-05-05 11:23 ` Gerd Hoffmann [this message]
2014-05-05 11:23 ` [Qemu-devel] [PULL v2 3/7] SMBIOS: Rename symbols to better reflect future use Gerd Hoffmann
2014-05-05 11:23 ` [Qemu-devel] [PULL v2 4/7] SMBIOS: Update header file definitions Gerd Hoffmann
2014-05-05 11:23 ` [Qemu-devel] [PULL v2 5/7] SMBIOS: Use macro to set smbios defaults Gerd Hoffmann
2014-05-05 11:23 ` [Qemu-devel] [PULL v2 6/7] SMBIOS: Use bitmaps to prevent incompatible comand line options Gerd Hoffmann
2014-05-05 11:23 ` [Qemu-devel] [PULL v2 7/7] SMBIOS: Build aggregate smbios tables and entry point Gerd Hoffmann
2014-05-06 12:08 ` [Qemu-devel] [PULL v2 0/7] smbios: make qemu generate smbios tables Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1399288996-9721-3-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=aliguori@amazon.com \
--cc=gsomlo@gmail.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=somlo@cmu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).