|
 |
6a2d3c |
From c2d55efd8a9a156fe14fd477924fadb765ac9438 Mon Sep 17 00:00:00 2001
|
|
 |
6a2d3c |
Message-Id: <c2d55efd8a9a156fe14fd477924fadb765ac9438.1387280747.git.minovotn@redhat.com>
|
|
 |
6a2d3c |
From: "Michael S. Tsirkin" <mst@redhat.com>
|
|
 |
6a2d3c |
Date: Wed, 11 Dec 2013 15:16:27 +0100
|
|
 |
6a2d3c |
Subject: [PATCH 1/3] biostables: support looking up RSDP
|
|
 |
6a2d3c |
|
|
 |
6a2d3c |
RH-Author: Michael S. Tsirkin <mst@redhat.com>
|
|
 |
6a2d3c |
Message-id: <1386774929-25693-2-git-send-email-mst@redhat.com>
|
|
 |
6a2d3c |
Patchwork-id: 56224
|
|
 |
6a2d3c |
O-Subject: [RHEL7.0 seabios PATCH 1/3] biostables: support looking up RSDP
|
|
 |
6a2d3c |
Bugzilla: 1034877
|
|
 |
6a2d3c |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
 |
6a2d3c |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
 |
6a2d3c |
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
 |
6a2d3c |
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
|
|
 |
6a2d3c |
|
|
 |
6a2d3c |
Will be used when it's loaded from QEMU.
|
|
 |
6a2d3c |
|
|
 |
6a2d3c |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
 |
6a2d3c |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
 |
6a2d3c |
(cherry-picked from commit ff5f7921d904dd2ddbaded3941643da8ba5fa9aa)
|
|
 |
6a2d3c |
|
|
 |
6a2d3c |
In rhel7 codebase we don't know the exact fseg
|
|
 |
6a2d3c |
range. Just scan all of the ROM range.
|
|
 |
6a2d3c |
|
|
 |
6a2d3c |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
 |
6a2d3c |
---
|
|
 |
6a2d3c |
src/util.h | 1 +
|
|
 |
6a2d3c |
src/biostables.c | 41 ++++++++++++++++++++++++++++++++++-------
|
|
 |
6a2d3c |
2 files changed, 35 insertions(+), 7 deletions(-)
|
|
 |
6a2d3c |
|
|
 |
6a2d3c |
Signed-off-by: Michal Novotny <minovotn@redhat.com>
|
|
 |
6a2d3c |
---
|
|
 |
6a2d3c |
src/biostables.c | 41 ++++++++++++++++++++++++++++++++++-------
|
|
 |
6a2d3c |
src/util.h | 1 +
|
|
 |
6a2d3c |
2 files changed, 35 insertions(+), 7 deletions(-)
|
|
 |
6a2d3c |
|
|
 |
6a2d3c |
diff --git a/src/biostables.c b/src/biostables.c
|
|
 |
6a2d3c |
index 81cc79b..2352ba4 100644
|
|
 |
6a2d3c |
--- a/src/biostables.c
|
|
 |
6a2d3c |
+++ b/src/biostables.c
|
|
 |
6a2d3c |
@@ -57,22 +57,35 @@ copy_mptable(void *pos)
|
|
 |
6a2d3c |
memcpy((void*)newpos + length, (void*)p->physaddr, mpclength);
|
|
 |
6a2d3c |
}
|
|
 |
6a2d3c |
|
|
 |
6a2d3c |
-static void
|
|
 |
6a2d3c |
-copy_acpi_rsdp(void *pos)
|
|
 |
6a2d3c |
+static int
|
|
 |
6a2d3c |
+get_acpi_rsdp_length(void *pos, unsigned size)
|
|
 |
6a2d3c |
{
|
|
 |
6a2d3c |
- if (RsdpAddr)
|
|
 |
6a2d3c |
- return;
|
|
 |
6a2d3c |
struct rsdp_descriptor *p = pos;
|
|
 |
6a2d3c |
if (p->signature != RSDP_SIGNATURE)
|
|
 |
6a2d3c |
- return;
|
|
 |
6a2d3c |
+ return -1;
|
|
 |
6a2d3c |
u32 length = 20;
|
|
 |
6a2d3c |
+ if (length > size)
|
|
 |
6a2d3c |
+ return -1;
|
|
 |
6a2d3c |
if (checksum(pos, length) != 0)
|
|
 |
6a2d3c |
- return;
|
|
 |
6a2d3c |
+ return -1;
|
|
 |
6a2d3c |
if (p->revision > 1) {
|
|
 |
6a2d3c |
length = p->length;
|
|
 |
6a2d3c |
+ if (length > size)
|
|
 |
6a2d3c |
+ return -1;
|
|
 |
6a2d3c |
if (checksum(pos, length) != 0)
|
|
 |
6a2d3c |
- return;
|
|
 |
6a2d3c |
+ return -1;
|
|
 |
6a2d3c |
}
|
|
 |
6a2d3c |
+ return length;
|
|
 |
6a2d3c |
+}
|
|
 |
6a2d3c |
+
|
|
 |
6a2d3c |
+static void
|
|
 |
6a2d3c |
+copy_acpi_rsdp(void *pos)
|
|
 |
6a2d3c |
+{
|
|
 |
6a2d3c |
+ if (RsdpAddr)
|
|
 |
6a2d3c |
+ return;
|
|
 |
6a2d3c |
+ int length = get_acpi_rsdp_length(pos, -1);
|
|
 |
6a2d3c |
+ if (length < 0)
|
|
 |
6a2d3c |
+ return;
|
|
 |
6a2d3c |
void *newpos = malloc_fseg(length);
|
|
 |
6a2d3c |
if (!newpos) {
|
|
 |
6a2d3c |
warn_noalloc();
|
|
 |
6a2d3c |
@@ -115,3 +128,17 @@ copy_table(void *pos)
|
|
 |
6a2d3c |
copy_acpi_rsdp(pos);
|
|
 |
6a2d3c |
copy_smbios(pos);
|
|
 |
6a2d3c |
}
|
|
 |
6a2d3c |
+
|
|
 |
6a2d3c |
+void *find_acpi_rsdp(void)
|
|
 |
6a2d3c |
+{
|
|
 |
6a2d3c |
+ /* The BIOS read-only memory space is between 0E0000h and 0FFFFFh. */
|
|
 |
6a2d3c |
+ unsigned long start = 0xE0000;
|
|
 |
6a2d3c |
+ unsigned long end = 0xFFFFF;
|
|
 |
6a2d3c |
+ unsigned long pos;
|
|
 |
6a2d3c |
+
|
|
 |
6a2d3c |
+ for (pos = ALIGN(start, 0x10); pos <= ALIGN_DOWN(end, 0x10); pos += 0x10)
|
|
 |
6a2d3c |
+ if (get_acpi_rsdp_length((void *)pos, end - pos) >= 0)
|
|
 |
6a2d3c |
+ return (void *)pos;
|
|
 |
6a2d3c |
+
|
|
 |
6a2d3c |
+ return NULL;
|
|
 |
6a2d3c |
+}
|
|
 |
6a2d3c |
diff --git a/src/util.h b/src/util.h
|
|
 |
6a2d3c |
index 7723bb1..e46d298 100644
|
|
 |
6a2d3c |
--- a/src/util.h
|
|
 |
6a2d3c |
+++ b/src/util.h
|
|
 |
6a2d3c |
@@ -339,6 +339,7 @@ void coreboot_cbfs_setup(void);
|
|
 |
6a2d3c |
|
|
 |
6a2d3c |
// biostable.c
|
|
 |
6a2d3c |
void copy_table(void *pos);
|
|
 |
6a2d3c |
+void *find_acpi_rsdp(void);
|
|
 |
6a2d3c |
|
|
 |
6a2d3c |
// vgahooks.c
|
|
 |
6a2d3c |
void handle_155f(struct bregs *regs);
|
|
 |
6a2d3c |
--
|
|
 |
6a2d3c |
1.7.11.7
|
|
 |
6a2d3c |
|