qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Isaku Yamahata <yamahata@valinux.co.jp>
To: seabios <seabios@seabios.org>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] seabios: acpi: allow qemu to load dsdt as external acpi table.
Date: Tue, 15 Jun 2010 12:51:16 +0900	[thread overview]
Message-ID: <20100615035116.GW23473@valinux.co.jp> (raw)

allow qemu to load dsdt as external acpi table.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 src/acpi.c |   27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/acpi.c b/src/acpi.c
index 0559443..254e43b 100644
--- a/src/acpi.c
+++ b/src/acpi.c
@@ -126,6 +126,11 @@ struct fadt_descriptor_rev1
 } PACKED;
 
 /*
+ * Differentiated System Descrition Table (DSDT)
+ */
+#define DSDT_SIGNATURE 0x54445344 // DSDT
+
+/*
  * MADT values and structures
  */
 
@@ -280,6 +285,11 @@ static inline u32 cpu_to_le32(u32 x)
     return x;
 }
 
+static inline u32 le32_to_cpu(u32 x)
+{
+    return x;
+}
+
 static void
 build_header(struct acpi_table_header *h, u32 sig, int len, u8 rev)
 {
@@ -634,7 +644,8 @@ acpi_bios_init(void)
     } while(0)
 
     // Add tables
-    ACPI_INIT_TABLE(build_fadt(bdf));
+    struct fadt_descriptor_rev1 *fadt = build_fadt(bdf);
+    ACPI_INIT_TABLE(fadt);
     ACPI_INIT_TABLE(build_ssdt());
     ACPI_INIT_TABLE(build_madt());
     ACPI_INIT_TABLE(build_hpet());
@@ -649,7 +660,19 @@ acpi_bios_init(void)
             warn_noalloc();
             continue;
         }
-        ACPI_INIT_TABLE(qemu_cfg_next_acpi_table_load(addr, len));
+        struct acpi_table_header *header =
+            qemu_cfg_next_acpi_table_load(addr, len);
+        if (header->signature == DSDT_SIGNATURE) {
+            if (fadt) {
+                free((void*)le32_to_cpu(fadt->dsdt));
+                fadt->dsdt = cpu_to_le32((u32)addr);
+                fadt->checksum -= checksum(fadt, sizeof(*fadt));
+                header->checksum -= checksum(header, len);
+                dprintf(1, "ACPI DSDT=%p\n", addr);
+            }
+        } else {
+            ACPI_INIT_TABLE(header);
+        }
         if (tbl_idx == MAX_ACPI_TABLES) {
             warn_noalloc();
             break;
-- 
1.6.6.1

             reply	other threads:[~2010-06-15  3:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-15  3:51 Isaku Yamahata [this message]
2010-06-22  3:02 ` [Qemu-devel] Re: [SeaBIOS] [PATCH] seabios: acpi: allow qemu to load dsdt as external acpi table Kevin O'Connor

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=20100615035116.GW23473@valinux.co.jp \
    --to=yamahata@valinux.co.jp \
    --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).