qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: seabios@seabios.org
Cc: Kevin O'Connor <kevin@koconnor.net>,
	qemu-devel@nongnu.org, lersek@redhat.com, lists@philjordan.eu,
	imammedo@redhat.com, mst@redhat.com, phil@philjordan.eu,
	programmingkidx@gmail.com, kraxel@redhat.com
Subject: [Qemu-devel] [seabios PATCH 2/2] seabios: create rev1 FADT in compatibility RSDT
Date: Wed, 26 Jul 2017 11:42:35 +0200	[thread overview]
Message-ID: <20170726094235.14267-3-pbonzini@redhat.com> (raw)
In-Reply-To: <20170726094235.14267-1-pbonzini@redhat.com>

This patch completes the job, presenting a rev1 FADT inside the
compatibility RSDT, so that ACPI 1.0 operating systems such as
Windows 2000 are not broken.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 src/fw/paravirt.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/fw/paravirt.c b/src/fw/paravirt.c
index 927fd75..97e2fe3 100644
--- a/src/fw/paravirt.c
+++ b/src/fw/paravirt.c
@@ -148,6 +148,20 @@ static void msr_feature_control_setup(void)
         wrmsr_smp(MSR_IA32_FEATURE_CONTROL, feature_control_bits);
 }
 
+static void*
+build_rev1_fadt(struct fadt_descriptor_rev1 *fadt_v3)
+{
+    struct fadt_descriptor_rev1 *fadt_v1 = malloc_high(sizeof *fadt_v1);
+
+    memcpy(fadt_v1, fadt_v3, sizeof *fadt_v1);
+    fadt_v1->length = sizeof *fadt_v1;
+    fadt_v1->revision = 1;
+    // the upper 23 bits are reserved in the rev1 FADT
+    fadt_v1->flags &= 0x1ff;
+    fadt_v1->checksum -= checksum(fadt_v1, fadt_v1->length);
+    return fadt_v1;
+}
+
 static void
 build_compatibility_rsdt(void)
 {
@@ -186,6 +200,11 @@ build_compatibility_rsdt(void)
         u64 tbl_addr = xsdt->table_offset_entry[i];
         if (!tbl_addr || (tbl_addr & ~0xffffffffULL))
             continue;
+        struct acpi_table_header *tbl = (void*)(u32)tbl_addr;
+        // for compatibility with Windows 2000, the RSDT should contain
+        // an ACPI 1.0 FADT (table revision 1)
+        if (tbl->signature == FACP_SIGNATURE && tbl->revision > 1)
+            tbl_addr = (u32)build_rev1_fadt((void *)tbl);
         rsdt->table_offset_entry[j++] = (u32)tbl_addr;
     }
 
-- 
2.13.3

  parent reply	other threads:[~2017-07-26  9:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-26  9:42 [Qemu-devel] [seabios PATCH for qemu 2.10 0/2] seabios: build ACPI 1.0-compatible ACPI tables Paolo Bonzini
2017-07-26  9:42 ` [Qemu-devel] [seabios PATCH 1/2] seabios: build RSDT from XSDT Paolo Bonzini
2017-07-26 20:05   ` Michael S. Tsirkin
2017-07-26 20:22     ` Paolo Bonzini
2017-07-26  9:42 ` Paolo Bonzini [this message]
2017-08-01 17:32 ` [Qemu-devel] [seabios PATCH for qemu 2.10 0/2] seabios: build ACPI 1.0-compatible ACPI 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=20170726094235.14267-3-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=kevin@koconnor.net \
    --cc=kraxel@redhat.com \
    --cc=lersek@redhat.com \
    --cc=lists@philjordan.eu \
    --cc=mst@redhat.com \
    --cc=phil@philjordan.eu \
    --cc=programmingkidx@gmail.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).