From: "Michael S. Tsirkin" <mst@redhat.com>
To: seabios@seabios.org
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH v2 2/5] pmm: add a way to test whether memory is in FSEG
Date: Sun, 7 Jul 2013 18:42:38 +0300 [thread overview]
Message-ID: <1373211589-8097-3-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1373211589-8097-1-git-send-email-mst@redhat.com>
Will be handy for looking for RSDP.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
src/pmm.c | 24 ++++++++++++++++++------
src/util.h | 1 +
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/src/pmm.c b/src/pmm.c
index 8f993fd..8bd8983 100644
--- a/src/pmm.c
+++ b/src/pmm.c
@@ -120,15 +120,23 @@ addSpace(struct zone_s *zone, void *start, void *end)
// Search all zones for an allocation obtained from allocSpace()
static struct allocinfo_s *
+findAllocInZone(struct zone_s *zone, void *data)
+{
+ struct allocinfo_s *info;
+ hlist_for_each_entry(info, &zone->head, node)
+ if (info->data == data)
+ return info;
+ return NULL;
+}
+
+static struct allocinfo_s *
findAlloc(void *data)
{
int i;
- for (i=0; i<ARRAY_SIZE(Zones); i++) {
- struct allocinfo_s *info;
- hlist_for_each_entry(info, &Zones[i]->head, node) {
- if (info->data == data)
- return info;
- }
+ for (i = 0; i < ARRAY_SIZE(Zones); i++) {
+ struct allocinfo_s *info = findAllocInZone(Zones[i], data);
+ if (info)
+ return info;
}
return NULL;
}
@@ -241,6 +249,10 @@ pmm_find(u32 handle)
return NULL;
}
+int pmm_test_fseg(void *data)
+{
+ return !!findAllocInZone(&ZoneFSeg, data);
+}
/****************************************************************
* 0xc0000-0xf0000 management
diff --git a/src/util.h b/src/util.h
index 7b50c38..44e1c1a 100644
--- a/src/util.h
+++ b/src/util.h
@@ -378,6 +378,7 @@ void malloc_init(void);
void malloc_prepboot(void);
void *pmm_malloc(struct zone_s *zone, u32 handle, u32 size, u32 align);
int pmm_free(void *data);
+int pmm_test_fseg(void *data);
void pmm_init(void);
void pmm_prepboot(void);
#define PMM_DEFAULT_HANDLE 0xFFFFFFFF
--
MST
next prev parent reply other threads:[~2013-07-07 15:41 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-07 15:42 [Qemu-devel] [PATCH v2 0/5] seabios: load acpi tables from qemu Michael S. Tsirkin
2013-07-07 15:42 ` [Qemu-devel] [PATCH v2 1/5] linker: utility to patch in-memory ROM files Michael S. Tsirkin
2013-07-14 18:24 ` [Qemu-devel] [SeaBIOS] " Kevin O'Connor
2013-07-15 8:01 ` Michael S. Tsirkin
2013-07-25 12:55 ` Michael S. Tsirkin
2013-07-26 0:06 ` Kevin O'Connor
2013-09-22 10:49 ` Michael S. Tsirkin
2013-09-22 11:18 ` Michael S. Tsirkin
2013-09-22 13:44 ` Michael S. Tsirkin
2013-07-07 15:42 ` Michael S. Tsirkin [this message]
2013-07-07 15:42 ` [Qemu-devel] [PATCH v2 3/5] acpi: pack rsdp Michael S. Tsirkin
2013-07-07 15:42 ` [Qemu-devel] [PATCH v2 4/5] acpi: load and link tables from /etc/acpi/ Michael S. Tsirkin
2013-07-14 18:27 ` [Qemu-devel] [SeaBIOS] " Kevin O'Connor
2013-07-15 8:11 ` Michael S. Tsirkin
2013-07-15 9:58 ` Michael S. Tsirkin
2013-07-07 15:42 ` [Qemu-devel] [PATCH v2 5/5] acpi: add an option to disable builtin tables Michael S. Tsirkin
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=1373211589-8097-3-git-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=seabios@seabios.org \
/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).