diff mbox

[12/19] pc: acpi: memhp: move MHPD.MPXM method into MHPT table

Message ID 1445612242-79172-13-git-send-email-imammedo@redhat.com
State New
Headers show

Commit Message

Igor Mammedov Oct. 23, 2015, 2:57 p.m. UTC
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/memory_hotplug_acpi_table.c | 18 ++++++++++++++++--
 hw/i386/acpi-dsdt-mem-hotplug.dsl   |  9 ---------
 include/hw/acpi/pc-hotplug.h        |  2 --
 3 files changed, 16 insertions(+), 13 deletions(-)
diff mbox

Patch

diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c
index 7ca3c7d..3d35ac1 100644
--- a/hw/acpi/memory_hotplug_acpi_table.c
+++ b/hw/acpi/memory_hotplug_acpi_table.c
@@ -9,6 +9,8 @@ 
 #define MEMORY_SLOT_NOTIFY_METHOD    "MTFY"
 #define MEMORY_SLOT_STATUS_METHOD    "MRST"
 #define MEMORY_SLOT_ENABLED          "MES"
+#define MEMORY_SLOT_PROXIMITY_METHOD "MPXM"
+#define MEMORY_SLOT_PROXIMITY        "MPX"
 
 #define BASEPATH "\\_SB.PCI0." stringify(MEMORY_HOTPLUG_DEVICE) "."
 
@@ -52,7 +54,7 @@  void build_mhpt(GArray *table_data, GArray *linker, uint32_t nr_mem,
         aml_append(field, /* read only */
             aml_named_field(stringify(MEMORY_SLOT_SIZE_HIGH), 32));
         aml_append(field, /* read only */
-            aml_named_field(stringify(MEMORY_SLOT_PROXIMITY), 32));
+            aml_named_field(MEMORY_SLOT_PROXIMITY, 32));
         aml_append(ctrl_dev, field);
 
         field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_BYTE_ACC,
@@ -136,6 +138,18 @@  void build_mhpt(GArray *table_data, GArray *linker, uint32_t nr_mem,
             aml_append(method, aml_return(a_ret_val));
         }
         aml_append(ctrl_dev, method);
+
+        method = aml_method(MEMORY_SLOT_PROXIMITY_METHOD, 1);
+        {
+            Aml *a_proximity = aml_name(MEMORY_SLOT_PROXIMITY);
+
+            aml_append(method, aml_acquire(a_ctrl_lock, 0xFFFF));
+            aml_append(method, aml_store(a_slot_arg, a_slot_selector));
+            aml_append(method, aml_store(a_proximity, a_ret_val));
+            aml_append(method, aml_release(a_ctrl_lock));
+            aml_append(method, aml_return(a_ret_val));
+        }
+        aml_append(ctrl_dev, method);
     }
     aml_append(table, ctrl_dev);
 
@@ -158,7 +172,7 @@  void build_mhpt(GArray *table_data, GArray *linker, uint32_t nr_mem,
         aml_append(dev, method);
 
         method = aml_method("_PXM", 0);
-        s = BASEPATH stringify(MEMORY_SLOT_PROXIMITY_METHOD);
+        s = BASEPATH MEMORY_SLOT_PROXIMITY_METHOD;
         aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
         aml_append(dev, method);
 
diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl
index 13e93dc..02fecf2 100644
--- a/hw/i386/acpi-dsdt-mem-hotplug.dsl
+++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl
@@ -25,7 +25,6 @@ 
             External(MEMORY_SLOT_ADDR_HIGH, FieldUnitObj) // read only
             External(MEMORY_SLOT_SIZE_LOW, FieldUnitObj) // read only
             External(MEMORY_SLOT_SIZE_HIGH, FieldUnitObj) // read only
-            External(MEMORY_SLOT_PROXIMITY, FieldUnitObj) // read only
             External(MEMORY_SLOT_EJECT, FieldUnitObj) // initiates device eject, write only
             External(MEMORY_SLOT_SLECTOR, FieldUnitObj) // DIMM selector, write only
             External(MEMORY_SLOT_OST_EVENT, FieldUnitObj) // _OST event code, write only
@@ -96,14 +95,6 @@ 
                 Return(MR64)
             }
 
-            Method(MEMORY_SLOT_PROXIMITY_METHOD, 1) {
-                Acquire(MEMORY_SLOT_LOCK, 0xFFFF)
-                Store(ToInteger(Arg0), MEMORY_SLOT_SLECTOR) // select DIMM
-                Store(MEMORY_SLOT_PROXIMITY, Local0)
-                Release(MEMORY_SLOT_LOCK)
-                Return(Local0)
-            }
-
             Method(MEMORY_SLOT_OST_METHOD, 4) {
                 Acquire(MEMORY_SLOT_LOCK, 0xFFFF)
                 Store(ToInteger(Arg0), MEMORY_SLOT_SLECTOR) // select DIMM
diff --git a/include/hw/acpi/pc-hotplug.h b/include/hw/acpi/pc-hotplug.h
index 47efa99..d7d5ede 100644
--- a/include/hw/acpi/pc-hotplug.h
+++ b/include/hw/acpi/pc-hotplug.h
@@ -38,7 +38,6 @@ 
 #define MEMORY_SLOT_ADDR_HIGH        MRBH
 #define MEMORY_SLOT_SIZE_LOW         MRLL
 #define MEMORY_SLOT_SIZE_HIGH        MRLH
-#define MEMORY_SLOT_PROXIMITY        MPX
 #define MEMORY_SLOT_EJECT            MEJ
 #define MEMORY_SLOT_SLECTOR          MSEL
 #define MEMORY_SLOT_OST_EVENT        MOEV
@@ -46,7 +45,6 @@ 
 #define MEMORY_SLOT_LOCK             MLCK
 #define MEMORY_SLOT_CRS_METHOD       MCRS
 #define MEMORY_SLOT_OST_METHOD       MOST
-#define MEMORY_SLOT_PROXIMITY_METHOD MPXM
 #define MEMORY_SLOT_EJECT_METHOD     MEJ0
 #define MEMORY_SLOT_SCAN_METHOD      MSCN