On 12/06/12 21:56, Kevin O'Connor wrote:
> On Thu, Dec 06, 2012 at 06:10:46PM +0100, Alexander Graf wrote:
>> You should be able to poke fw_cfg in the _STA method. The machine
>> file could search its bus on init (or on machine create notify) and
>> populate a fw_cfg variable to indicate whether it found an applesmc.
> 
> I don't think we should access fw_cfg from the AML code.  AML code is
> already too fragile and I think accessing fw_cfg is just going to make
> it worse.

One can poke at the applesmc directly for detection ...

cheers,
  Gerd

>From baad5d90adae3d5de32bbf743996d4adb1e1ba18 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kra...@redhat.com>
Date: Fri, 7 Dec 2012 10:21:44 +0100
Subject: [PATCH] acpi: add apple smc device

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

diff --git a/src/acpi-dsdt-isa.dsl b/src/acpi-dsdt-isa.dsl
index 70e1e48..135c893 100644
--- a/src/acpi-dsdt-isa.dsl
+++ b/src/acpi-dsdt-isa.dsl
@@ -1,6 +1,28 @@
 /* Common legacy ISA style devices. */
 Scope(\_SB.PCI0.ISA) {
 
+    Device (SMC) {
+        Name(_HID, EisaId("APP0001"))
+        OperationRegion(SMC, SystemIO, 0x0300, 0x20)
+        Field(SMC, ByteAcc, NoLock, Preserve) {
+            Offset(0x04),
+            CMDP, 8,
+        }
+        Method(_STA, 0) {
+           Store(0x10, CMDP)    // APPLESMC_READ_CMD
+           Store(CMDP, Local0)
+            If (LEqual(Local0, 0x0c)) {
+                Return (0x0F)
+            } Else {
+                Return (0x00)
+            }
+        }
+        Name (_CRS, ResourceTemplate () {
+            IO (Decode16, 0x0300, 0x0300, 0x01, 0x20)
+            IRQNoFlags() { 6 }
+        })
+    }
+
     Device(RTC) {
         Name(_HID, EisaId("PNP0B00"))
         Name(RESI, ResourceTemplate() {
-- 
1.7.1

_______________________________________________
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios

Reply via email to