Add a acpi driver for the qemu firmware config interface.

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

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)
+                   }
+                }
+           }
     }
 
 
-- 
1.7.1


Reply via email to