qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: kevin@koconnor.net
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 2/2] Add support for passing additional acpi tables from qemu.
Date: Wed,  7 Oct 2009 15:21:44 +0200	[thread overview]
Message-ID: <1254921704-18810-2-git-send-email-gleb@redhat.com> (raw)
In-Reply-To: <1254921704-18810-1-git-send-email-gleb@redhat.com>


Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
 src/acpi.c     |   18 +++++++++++++++++-
 src/config.h   |    2 +-
 src/paravirt.c |   27 +++++++++++++++++++++++++++
 src/paravirt.h |    3 +++
 4 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/src/acpi.c b/src/acpi.c
index b9d449f..dafd8c8 100644
--- a/src/acpi.c
+++ b/src/acpi.c
@@ -11,7 +11,7 @@
 #include "biosvar.h" // GET_EBDA
 #include "pci_ids.h" // PCI_VENDOR_ID_INTEL
 #include "pci_regs.h" // PCI_INTERRUPT_LINE
-
+#include "paravirt.h"
 
 /****************************************************/
 /* ACPI tables init */
@@ -444,6 +444,22 @@ acpi_bios_init(void)
     ACPI_INIT_TABLE(build_ssdt());
     ACPI_INIT_TABLE(build_madt());
 
+    u16 i, external_tables = qemu_cfg_acpi_additional_tables();
+
+    for(i = 0; i < external_tables; i++) {
+        u16 len = qemu_cfg_next_acpi_table_len();
+        void *addr = malloc_high(len);
+        if (!addr) {
+            dprintf(1, "Not enogh memory of ext acpi table of size %d!\n", len);
+            continue;
+        }
+        ACPI_INIT_TABLE(qemu_cfg_next_acpi_table_load(addr, len));
+        if (tbl_idx == MAX_ACPI_TABLES) {
+            dprintf(1, "To many external table!\n");
+            break;
+        }
+    }
+
     struct rsdt_descriptor_rev1 *rsdt;
     size_t rsdt_len = sizeof(*rsdt) + sizeof(u32) * tbl_idx;
     rsdt = malloc_high(rsdt_len);
diff --git a/src/config.h b/src/config.h
index e93b080..10b2232 100644
--- a/src/config.h
+++ b/src/config.h
@@ -13,7 +13,7 @@
 #define CONFIG_APPNAME4 "BXPC"
 
 // Configure for use with KVM.
-#define CONFIG_KVM 0
+#define CONFIG_KVM 1
 // Configure as a coreboot payload.
 #define CONFIG_COREBOOT 0
 
diff --git a/src/paravirt.c b/src/paravirt.c
index 56d8421..cd1f263 100644
--- a/src/paravirt.c
+++ b/src/paravirt.c
@@ -72,3 +72,30 @@ int qemu_cfg_show_boot_menu(void)
     return v;
 }
 
+u16 qemu_cfg_acpi_additional_tables(void)
+{
+    u16 cnt;
+
+    if (!qemu_cfg_present)
+        return 0;
+
+    qemu_cfg_read_entry(&cnt, QEMU_CFG_ACPI_TABLES, sizeof(cnt));
+
+    return cnt;
+}
+
+u16 qemu_cfg_next_acpi_table_len(void)
+{
+    u16 len;
+
+    qemu_cfg_read((u8*)&len, sizeof(len));
+
+    return len;
+}
+
+void* qemu_cfg_next_acpi_table_load(void *addr, u16 len)
+{
+    qemu_cfg_read(addr, len);
+    return addr;
+}
+
diff --git a/src/paravirt.h b/src/paravirt.h
index 6997cff..c2bab71 100644
--- a/src/paravirt.h
+++ b/src/paravirt.h
@@ -40,5 +40,8 @@ extern int qemu_cfg_present;
 void qemu_cfg_port_probe(void);
 int qemu_cfg_show_boot_menu(void);
 void qemu_cfg_get_uuid(u8 *uuid);
+u16 qemu_cfg_acpi_additional_tables(void);
+u16 qemu_cfg_next_acpi_table_len(void);
+void *qemu_cfg_next_acpi_table_load(void *addr, u16 len);
 
 #endif
-- 
1.6.3.3

  reply	other threads:[~2009-10-07 13:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-07 13:21 [Qemu-devel] [PATCH 1/2] Cleanup acpi table creation Gleb Natapov
2009-10-07 13:21 ` Gleb Natapov [this message]
2009-10-07 23:48   ` [Qemu-devel] Re: [PATCH 2/2] Add support for passing additional acpi tables from qemu Kevin O'Connor
2009-10-08  6:10     ` Gleb Natapov
2009-10-07 23:45 ` [Qemu-devel] Re: [PATCH 1/2] Cleanup acpi table creation 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=1254921704-18810-2-git-send-email-gleb@redhat.com \
    --to=gleb@redhat.com \
    --cc=kevin@koconnor.net \
    --cc=qemu-devel@nongnu.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).