Patchwork [seabios,2/5] acpi: add qemu fwcfg driver

login
register
mail settings
Submitter Gerd Hoffmann
Date May 4, 2012, 8:21 a.m.
Message ID <1336119687-6295-3-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/156810/
State New
Headers show

Comments

Gerd Hoffmann - May 4, 2012, 8:21 a.m.
Add a acpi driver for the qemu firmware config interface.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 src/acpi-dsdt.dsl |   43 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 43 insertions(+), 0 deletions(-)

Patch

diff --git a/src/acpi-dsdt.dsl b/src/acpi-dsdt.dsl
index 4a18617..d71b783 100644
--- a/src/acpi-dsdt.dsl
+++ b/src/acpi-dsdt.dsl
@@ -445,6 +445,49 @@  DefinitionBlock (
 		    Return (BUF0)
 		}
 	    }
+
+	    /* qemu firmware config interface */
+	    Device (FWC)
+	    {
+		Name (_HID, EisaId ("FWC0510"))
+		OperationRegion (FWCD, SystemIO, 0x0510, 0x02)
+		Field (FWCD, WordAcc, NoLock, Preserve)
+		{
+		    FWCS, 16,  /* select */
+		}
+		Field (FWCD, ByteAcc, NoLock, Preserve)
+		{
+		    FWCW, 8,   /* write */
+		    FWCR, 8,   /* read */
+		}
+                Name (_CRS, ResourceTemplate ()
+		{
+		    IO (Decode16, 0x0510, 0x0510, 0x01, 0x02)
+		})
+
+		/* fetch fw_cfg entry, args: entry nr, length */
+		Method (FWCB, 2) {
+		    Name (RETB, Buffer(Arg1) { })
+		    Store (Arg0, FWCS)
+		    Store (Zero, Local0)
+		    While (LLess(Local0, Arg1)) {
+		        Store (FWCR, Index(RETB, Local0))
+			Increment(Local0)
+		    }
+		    Return (RETB)
+		}
+
+		/* fetch signature & verify */
+		Method (_STA, 0, NotSerialized)
+		{
+		    Store(ToString(FWCB(0, 4)), Local0)
+		    If (LEqual (Local0, "QEMU")) {
+		        Return (0x0f)
+		    } Else {
+			Return (0x00)
+		    }
+                }
+	    }
     }