public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Pranav Madhu" <pranav.madhu@arm.com>
To: devel@edk2.groups.io
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Sami Mujawar <sami.mujawar@arm.com>
Subject: [edk2-platforms][PATCH V1 13/17] Platform/Sgi: Low Power Idle States for RD-V1 quad-chip platform
Date: Wed, 28 Apr 2021 18:05:56 +0530	[thread overview]
Message-ID: <20210428123600.2385-14-pranav.madhu@arm.com> (raw)
In-Reply-To: <20210428123600.2385-1-pranav.madhu@arm.com>

RD-V1 quad-chip platform supports two LPI states, LPI1 (Standby WFI) and
LPI3 (Power-down). Add idle support for RD-V1 quad-chip platform.

Signed-off-by: Pranav Madhu <pranav.madhu@arm.com>
---
 Platform/ARM/SgiPkg/AcpiTables/RdV1Mc/Dsdt.asl | 144 ++++++++++++++++++++
 1 file changed, 144 insertions(+)

diff --git a/Platform/ARM/SgiPkg/AcpiTables/RdV1Mc/Dsdt.asl b/Platform/ARM/SgiPkg/AcpiTables/RdV1Mc/Dsdt.asl
index 16919cc5aaa0..82eb91638426 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/RdV1Mc/Dsdt.asl
+++ b/Platform/ARM/SgiPkg/AcpiTables/RdV1Mc/Dsdt.asl
@@ -13,6 +13,86 @@
 DefinitionBlock ("DsdtTable.aml", "DSDT", 2, "ARMLTD", "ARMSGI",
                  EFI_ACPI_ARM_OEM_REVISION) {
   Scope (_SB) {
+    /* _OSC: Operating System Capabilities */
+    Method (_OSC, 4, Serialized) {
+      CreateDWordField (Arg3, 0x00, STS0)
+      CreateDWordField (Arg3, 0x04, CAP0)
+
+      /* Platform-wide Capabilities */
+      If (LEqual (Arg0, ToUUID("0811b06e-4a27-44f9-8d60-3cbbc22e7b48"))) {
+        /* OSC rev 1 supported, for other version, return failure */
+        If (LEqual (Arg1, One)) {
+          And (STS0, Not (OSC_STS_MASK), STS0)
+
+          If (And (CAP0, OSC_CAP_OS_INITIATED_LPI)) {
+            /* OS initiated LPI not supported */
+            And (CAP0, Not (OSC_CAP_OS_INITIATED_LPI), CAP0)
+            Or (STS0, OSC_STS_CAPABILITY_MASKED, STS0)
+          }
+        } Else {
+          And (STS0, Not (OSC_STS_MASK), STS0)
+          Or (STS0, Or (OSC_STS_FAILURE, OSC_STS_UNRECOGNIZED_REV), STS0)
+        }
+      } Else {
+        And (STS0, Not (OSC_STS_MASK), STS0)
+        Or (STS0, Or (OSC_STS_FAILURE, OSC_STS_UNRECOGNIZED_UUID), STS0)
+      }
+
+      Return (Arg3)
+    }
+
+    Name (PLPI, Package () {  /* LPI for Processor, support 2 LPI states */
+      0,                      // Version
+      1,                      // Level Index
+      2,                      // Count
+      Package () {            // WFI for CPU
+        1,                    // Min residency (uS)
+        1,                    // Wake latency (uS)
+        1,                    // Flags
+        0,                    // Arch Context lost Flags (no loss)
+        100,                  // Residency Counter Frequency
+        0,                    // No parent state
+        ResourceTemplate () { // Register Entry method
+          Register (FFixedHW,
+            32,               // Bit Width
+            0,                // Bit Offset
+            0xFFFFFFFF,       // Address
+            3,                // Access Size
+          )
+        },
+        ResourceTemplate () { // Null Residency Counter
+          Register (SystemMemory, 0, 0, 0, 0)
+        },
+        ResourceTemplate () { // Null Usage Counter
+          Register (SystemMemory, 0, 0, 0, 0)
+        },
+        "LPI1-Core"
+      },
+      Package () {            // Power Gating state for CPU
+        150,                  // Min residency (uS)
+        350,                  // Wake latency (uS)
+        1,                    // Flags
+        1,                    // Arch Context lost Flags (Core context lost)
+        100,                  // Residency Counter Frequency
+        1,                    // Parent node can be in any shallower state
+        ResourceTemplate () { // Register Entry method
+          Register (FFixedHW,
+            32,               // Bit Width
+            0,                // Bit Offset
+            0x40000002,       // Address (PwrLvl:core, StateTyp:PwrDn)
+            3,                // Access Size
+          )
+        },
+        ResourceTemplate () { // Null Residency Counter
+          Register (SystemMemory, 0, 0, 0, 0)
+        },
+        ResourceTemplate () { // Null Usage Counter
+          Register (SystemMemory, 0, 0, 0, 0)
+        },
+        "LPI3-Core"
+      },
+    })
+
     Device (CL00) {   // Cluster 0
       Name (_HID, "ACPI0010")
       Name (_UID, 0)
@@ -21,6 +101,10 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", 2, "ARMLTD", "ARMSGI",
         Name (_HID, "ACPI0007")
         Name (_UID, 0)
         Name (_STA, 0xF)
+
+        Method (_LPI, 0, NotSerialized) {
+          Return (\_SB.PLPI)
+        }
       }
     }
 
@@ -32,6 +116,10 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", 2, "ARMLTD", "ARMSGI",
         Name (_HID, "ACPI0007")
         Name (_UID, 1)
         Name (_STA, 0xF)
+
+        Method (_LPI, 0, NotSerialized) {
+          Return (\_SB.PLPI)
+        }
       }
     }
 
@@ -43,6 +131,10 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", 2, "ARMLTD", "ARMSGI",
         Name (_HID, "ACPI0007")
         Name (_UID, 2)
         Name (_STA, 0xF)
+
+        Method (_LPI, 0, NotSerialized) {
+          Return (\_SB.PLPI)
+        }
       }
     }
 
@@ -54,6 +146,10 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", 2, "ARMLTD", "ARMSGI",
         Name (_HID, "ACPI0007")
         Name (_UID, 3)
         Name (_STA, 0xF)
+
+        Method (_LPI, 0, NotSerialized) {
+          Return (\_SB.PLPI)
+        }
       }
     }
 
@@ -65,6 +161,10 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", 2, "ARMLTD", "ARMSGI",
         Name (_HID, "ACPI0007")
         Name (_UID, 4)
         Name (_STA, 0xF)
+
+        Method (_LPI, 0, NotSerialized) {
+          Return (\_SB.PLPI)
+        }
       }
     }
 
@@ -76,6 +176,10 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", 2, "ARMLTD", "ARMSGI",
         Name (_HID, "ACPI0007")
         Name (_UID, 5)
         Name (_STA, 0xF)
+
+        Method (_LPI, 0, NotSerialized) {
+          Return (\_SB.PLPI)
+        }
       }
     }
 
@@ -87,6 +191,10 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", 2, "ARMLTD", "ARMSGI",
         Name (_HID, "ACPI0007")
         Name (_UID, 6)
         Name (_STA, 0xF)
+
+        Method (_LPI, 0, NotSerialized) {
+          Return (\_SB.PLPI)
+        }
       }
     }
 
@@ -98,6 +206,10 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", 2, "ARMLTD", "ARMSGI",
         Name (_HID, "ACPI0007")
         Name (_UID, 7)
         Name (_STA, 0xF)
+
+        Method (_LPI, 0, NotSerialized) {
+          Return (\_SB.PLPI)
+        }
       }
     }
 
@@ -109,6 +221,10 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", 2, "ARMLTD", "ARMSGI",
         Name (_HID, "ACPI0007")
         Name (_UID, 8)
         Name (_STA, 0xF)
+
+        Method (_LPI, 0, NotSerialized) {
+          Return (\_SB.PLPI)
+        }
       }
     }
 
@@ -120,6 +236,10 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", 2, "ARMLTD", "ARMSGI",
         Name (_HID, "ACPI0007")
         Name (_UID, 9)
         Name (_STA, 0xF)
+
+        Method (_LPI, 0, NotSerialized) {
+          Return (\_SB.PLPI)
+        }
       }
     }
 
@@ -131,6 +251,10 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", 2, "ARMLTD", "ARMSGI",
         Name (_HID, "ACPI0007")
         Name (_UID, 10)
         Name (_STA, 0xF)
+
+        Method (_LPI, 0, NotSerialized) {
+          Return (\_SB.PLPI)
+        }
       }
     }
 
@@ -142,6 +266,10 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", 2, "ARMLTD", "ARMSGI",
         Name (_HID, "ACPI0007")
         Name (_UID, 11)
         Name (_STA, 0xF)
+
+        Method (_LPI, 0, NotSerialized) {
+          Return (\_SB.PLPI)
+        }
       }
     }
 
@@ -153,6 +281,10 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", 2, "ARMLTD", "ARMSGI",
         Name (_HID, "ACPI0007")
         Name (_UID, 12)
         Name (_STA, 0xF)
+
+        Method (_LPI, 0, NotSerialized) {
+          Return (\_SB.PLPI)
+        }
       }
     }
 
@@ -164,6 +296,10 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", 2, "ARMLTD", "ARMSGI",
         Name (_HID, "ACPI0007")
         Name (_UID, 13)
         Name (_STA, 0xF)
+
+        Method (_LPI, 0, NotSerialized) {
+          Return (\_SB.PLPI)
+        }
       }
     }
 
@@ -175,6 +311,10 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", 2, "ARMLTD", "ARMSGI",
         Name (_HID, "ACPI0007")
         Name (_UID, 14)
         Name (_STA, 0xF)
+
+        Method (_LPI, 0, NotSerialized) {
+          Return (\_SB.PLPI)
+        }
       }
     }
 
@@ -186,6 +326,10 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", 2, "ARMLTD", "ARMSGI",
         Name (_HID, "ACPI0007")
         Name (_UID, 15)
         Name (_STA, 0xF)
+
+        Method (_LPI, 0, NotSerialized) {
+          Return (\_SB.PLPI)
+        }
       }
     }
   } // Scope(_SB)
-- 
2.17.1


  parent reply	other threads:[~2021-04-28 12:36 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-28 12:35 [edk2-platforms][PATCH V1 00/17] Enable idle state and CPPC support for RD platform Pranav Madhu
2021-04-28 12:35 ` [edk2-platforms][PATCH V1 01/17] Platform/Sgi: Macro definitions for ACPI _OSC Pranav Madhu
2021-04-28 12:35 ` [edk2-platforms][PATCH V1 02/17] Platform/Sgi: Add CPU container for SGI-575 Pranav Madhu
2021-05-10  9:12   ` Sami Mujawar
2021-04-28 12:35 ` [edk2-platforms][PATCH V1 03/17] Platform/Sgi: Low Power Idle states " Pranav Madhu
2021-04-28 12:35 ` [edk2-platforms][PATCH V1 04/17] Platform/Sgi: Add CPU container for RD-N1-Edge Pranav Madhu
2021-04-28 12:35 ` [edk2-platforms][PATCH V1 05/17] Platform/Sgi: Low Power Idle states " Pranav Madhu
2021-04-28 12:35 ` [edk2-platforms][PATCH V1 06/17] Platform/Sgi: Add DSDT ACPI table for RD-N1-Edge dual-chip platform Pranav Madhu
2021-04-28 12:35 ` [edk2-platforms][PATCH V1 07/17] Platform/Sgi: Low Power Idle States for RD-N1-Edge dual-chip Pranav Madhu
2021-04-28 12:35 ` [edk2-platforms][PATCH V1 08/17] Platform/Sgi: Add CPU container for RD-V1 platform Pranav Madhu
2021-04-28 12:35 ` [edk2-platforms][PATCH V1 09/17] Platform/Sgi: Low Power Idle states " Pranav Madhu
2021-04-28 12:35 ` [edk2-platforms][PATCH V1 10/17] Platform/Sgi: Macro definitions for ACPI CPPC Pranav Madhu
2021-05-10  9:12   ` Sami Mujawar
2021-04-28 12:35 ` [edk2-platforms][PATCH V1 11/17] Platform/Sgi: ACPI CPPC support for RD-V1 Pranav Madhu
2021-04-28 12:35 ` [edk2-platforms][PATCH V1 12/17] Platform/Sgi: Add CPU container for RD-V1 quad-chip platform Pranav Madhu
2021-04-28 12:35 ` Pranav Madhu [this message]
2021-04-28 12:35 ` [edk2-platforms][PATCH V1 14/17] Platform/Sgi: ACPI CPPC support " Pranav Madhu
2021-04-28 12:35 ` [edk2-platforms][PATCH V1 15/17] Platform/Sgi: Add CPU container for RD-N2 platform Pranav Madhu
2021-04-28 12:35 ` [edk2-platforms][PATCH V1 16/17] Platform/Sgi: Low Power Idle States for RD-N2 Pranav Madhu
2021-04-28 12:36 ` [edk2-platforms][PATCH V1 17/17] Platform/Sgi: ACPI CPPC support " Pranav Madhu
2021-05-03 14:29 ` [edk2-devel] [edk2-platforms][PATCH V1 00/17] Enable idle state and CPPC support for RD platform Thomas Abraham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210428123600.2385-14-pranav.madhu@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox