Patchwork [RFC,v4,22/30,SeaBIOS] acpi: add _EJ0 operation and eject port for memory devices

login
register
mail settings
Submitter Vasilis Liaskovitis
Date Dec. 18, 2012, 12:41 p.m.
Message ID <1355834518-17989-23-git-send-email-vasilis.liaskovitis@profitbricks.com>
Download mbox | patch
Permalink /patch/207139/
State New
Headers show

Comments

Vasilis Liaskovitis - Dec. 18, 2012, 12:41 p.m.
This will allow hot-remove signalling from/to qemu and acpi-enabled guest.
---
 src/acpi-dsdt-mem-hotplug.dsl |   15 +++++++++++++++
 src/ssdt-mem.dsl              |    3 +++
 2 files changed, 18 insertions(+), 0 deletions(-)

Patch

diff --git a/src/acpi-dsdt-mem-hotplug.dsl b/src/acpi-dsdt-mem-hotplug.dsl
index 0e7ced3..fd73ea7 100644
--- a/src/acpi-dsdt-mem-hotplug.dsl
+++ b/src/acpi-dsdt-mem-hotplug.dsl
@@ -21,6 +21,13 @@  Scope(\_SB) {
             MES, 256
         }
  
+        /* Memory eject byte */
+        OperationRegion(MEMJ, SystemIO, 0xafa0, 1)
+        Field (MEMJ, ByteAcc, NoLock, Preserve)
+        {
+            MPE, 8
+        }
+        
         Method(MESC, 0) {
             // Local5 = active memdevice bitmap
             Store (MES, Local5)
@@ -47,6 +54,8 @@  Scope(\_SB) {
                     // Do MEM notify
                     If (LEqual(Local3, 1)) {
                         MTFY(Local0, 1)
+                    } Else {
+                        MTFY(Local0, 3)
                     }
                 }
                 Increment(Local0)
@@ -54,4 +63,10 @@  Scope(\_SB) {
             Return(One)
         }
 
+        Method (MPEJ, 2, NotSerialized) {
+            // _EJ0 method - eject callback
+            Store(Arg0, MPE)
+            Sleep(200)
+        }
+
 }
diff --git a/src/ssdt-mem.dsl b/src/ssdt-mem.dsl
index dbac33f..eef84b6 100644
--- a/src/ssdt-mem.dsl
+++ b/src/ssdt-mem.dsl
@@ -57,6 +57,9 @@  DefinitionBlock ("ssdt-mem.aml", "SSDT", 0x02, "BXPC", "CSSDT", 0x1)
         Method (_STA, 0) {
             Return(CMST(ID))        
         }    
+        Method (_EJ0, 1, NotSerialized) {
+            MPEJ(ID, Arg0)
+        }
     }
 }