Such packages should be more compatible with AML parsers in practice:

  /*
   * Intel ACPI Component Architecture
   * AML Disassembler version 20090123
   *
   * Disassembly of SSDT.aml, Thu Jan 24 13:23:26 2013
   *
   *
   * Original Table Header:
   *     Signature        "SSDT"
   *     Length           0x00000057 (87)
   *     Revision         0x01
   *     Checksum         0x9D
   *     OEM ID           "REDHAT"
   *     OEM Table ID     "OVMF    "
   *     OEM Revision     0x00000001 (1)
   *     Compiler ID      "INTL"
   *     Compiler Version 0x20090123 (537461027)
   */
  DefinitionBlock ("SSDT.aml", "SSDT", 1, "REDHAT", "OVMF    ", 0x00000001)
  {
      OperationRegion (FWDT, SystemMemory, 0xDFB66F98, 0x00000030)
      Name (\_S3, Package (0x04)
      {
          0x01,
          0x00,
          0x00,
          0x00
      })
      Name (\_S4, Package (0x04)
      {
          0x02,
          0x00,
          0x00,
          0x00
      })
  }

Testing:
- Checked dmesg in an F18 guest, then selected hibernate and verified the
  requested suspend type with a qemu debug patch. The above AML
  disassembly also originates from the F18 guest (acpidump + iasld -d).
- Hibernated a Windows 8 Consumer Preview (Build 8250) guest, confirmed
  requested suspend type with the same qemu debug patch.

Contributed-under: TianoCore Contribution Agreement 1.0

Signed-off-by: Laszlo Ersek <ler...@redhat.com>
---
 OvmfPkg/AcpiPlatformDxe/Qemu.c |   58 +++++++++++++++++++++++----------------
 1 files changed, 34 insertions(+), 24 deletions(-)

diff --git a/OvmfPkg/AcpiPlatformDxe/Qemu.c b/OvmfPkg/AcpiPlatformDxe/Qemu.c
index 35d667f..8a6ecf7 100644
--- a/OvmfPkg/AcpiPlatformDxe/Qemu.c
+++ b/OvmfPkg/AcpiPlatformDxe/Qemu.c
@@ -200,16 +200,20 @@ typedef struct {
 } FIRMWARE_DATA;
 
 typedef struct {
-  UINT8 NameOp;
-  UINT8 RootChar;
-  UINT8 NameChar[4];
-  UINT8 PackageOp;
-  UINT8 PkgLength;
-  UINT8 NumElements;
-  UINT8 DWordPrefix;
-  UINT8 Pm1aCntSlpTyp;
-  UINT8 Pm1bCntSlpTyp;
-  UINT8 Reserved[2];
+  UINT8 BytePrefix;
+  UINT8 ByteValue;
+} AML_BYTE;
+
+typedef struct {
+  UINT8    NameOp;
+  UINT8    RootChar;
+  UINT8    NameChar[4];
+  UINT8    PackageOp;
+  UINT8    PkgLength;
+  UINT8    NumElements;
+  AML_BYTE Pm1aCntSlpTyp;
+  AML_BYTE Pm1bCntSlpTyp;
+  AML_BYTE Reserved[2];
 } SYSTEM_STATE_PACKAGE;
 
 #pragma pack()
@@ -326,12 +330,14 @@ GetSuspendStates (
     '\\',                   // RootChar
     { '_', 'S', 'x', '_' }, // NameChar[4]
     0x12,                   // PackageOp
-    0x07,                   // PkgLength
-    0x01,                   // NumElements
-    0x0c,                   // DWordPrefix
-    0x00,                   // Pm1aCntSlpTyp
-    0x00,                   // Pm1bCntSlpTyp -- we don't support it
-    { 0x00, 0x00 }          // Reserved
+    0x0A,                   // PkgLength
+    0x04,                   // NumElements
+    { 0x0A, 0x00 },         // Pm1aCntSlpTyp
+    { 0x0A, 0x00 },         // Pm1bCntSlpTyp -- we don't support it
+    {                       // Reserved[2]
+      { 0x0A, 0x00 },
+      { 0x0A, 0x00 }
+    }
   };
   RETURN_STATUS                     Status;
   FIRMWARE_CONFIG_ITEM              FwCfgItem;
@@ -343,13 +349,13 @@ GetSuspendStates (
   //
   *SuspendToRamSize = sizeof Template;
   CopyMem (SuspendToRam, &Template, sizeof Template);
-  SuspendToRam->NameChar[2]   = '3'; // S3
-  SuspendToRam->Pm1aCntSlpTyp = 1;   // PIIX4: STR
+  SuspendToRam->NameChar[2]             = '3'; // S3
+  SuspendToRam->Pm1aCntSlpTyp.ByteValue = 1;   // PIIX4: STR
 
   *SuspendToDiskSize = sizeof Template;
   CopyMem (SuspendToDisk, &Template, sizeof Template);
-  SuspendToDisk->NameChar[2]   = '4'; // S4
-  SuspendToDisk->Pm1aCntSlpTyp = 2;   // PIIX4: POSCL
+  SuspendToDisk->NameChar[2]             = '4'; // S4
+  SuspendToDisk->Pm1aCntSlpTyp.ByteValue = 2;   // PIIX4: POSCL
 
   //
   // check for overrides
@@ -368,16 +374,20 @@ GetSuspendStates (
   // value to be written to the PM control register's SUS_TYP bits.
   //
   if (SystemStates[3] & BIT7) {
-    SuspendToRam->Pm1aCntSlpTyp = SystemStates[3] & (BIT2 | BIT1 | BIT0);
-    DEBUG ((DEBUG_INFO, "ACPI S3 value: %d\n", SuspendToRam->Pm1aCntSlpTyp));
+    SuspendToRam->Pm1aCntSlpTyp.ByteValue =
+        SystemStates[3] & (BIT2 | BIT1 | BIT0);
+    DEBUG ((DEBUG_INFO, "ACPI S3 value: %d\n",
+            SuspendToRam->Pm1aCntSlpTyp.ByteValue));
   } else {
     *SuspendToRamSize = 0;
     DEBUG ((DEBUG_INFO, "ACPI S3 disabled\n"));
   }
 
   if (SystemStates[4] & BIT7) {
-    SuspendToDisk->Pm1aCntSlpTyp = SystemStates[4] & (BIT2 | BIT1 | BIT0);
-    DEBUG ((DEBUG_INFO, "ACPI S4 value: %d\n", SuspendToDisk->Pm1aCntSlpTyp));
+    SuspendToDisk->Pm1aCntSlpTyp.ByteValue =
+        SystemStates[4] & (BIT2 | BIT1 | BIT0);
+    DEBUG ((DEBUG_INFO, "ACPI S4 value: %d\n",
+            SuspendToDisk->Pm1aCntSlpTyp.ByteValue));
   } else {
     *SuspendToDiskSize = 0;
     DEBUG ((DEBUG_INFO, "ACPI S4 disabled\n"));
-- 
1.7.1


------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to