{soc,sb}/intel: Drop named object from ASL GPLD method

Creation of named objects within a method is highly inefficient, as per
IASL's remarks during DSDT compilation. But it is possible to use local
variables instead of named objects to store a package.

Update the `GPLD` method to use a local variable, instead of creating a
named object. While at it, unify cosmetics of the several copies of the
method across the codebase.

TEST: Build coreboot for the ASRock Z97 Extreme6 (Lynx Point) and run:
  - acpiexec -b "Evaluate _SB.PCI0.XHCI.HUB7.GPLD 0" build/dsdt.aml
  - acpiexec -b "Evaluate _SB.PCI0.XHCI.HUB7.GPLD 1" build/dsdt.aml
Observe return value is the same before and after this change.

Change-Id: Id66322150c90309f42f574584728c6b1db353c0c
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/91390
Reviewed-by: Jérémy Compostella <jeremy.compostella@intel.com>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Angel Pons 2026-02-23 17:50:12 +01:00 committed by Matt DeVillier
commit 800db242bd
5 changed files with 41 additions and 53 deletions

View file

@ -12,18 +12,18 @@ Device (XHCI)
// GPLD: Generate Port Location Data (PLD)
Method (GPLD, 1, Serialized) {
Name (PCKG, Package (0x01) {
Local0 = Package () {
Buffer (0x10) {}
})
}
// REV: Revision 0x02 for ACPI 5.0
CreateField (DerefOf (PCKG[0]), 0, 0x07, REV)
REV = 0x02
// REV: Revision 2 for ACPI 5.0
CreateField (DerefOf (Local0[0]), 0, 7, REV)
REV = 2
// VISI: Port visibility to user per port
CreateField (DerefOf (PCKG[0]), 0x40, 1, VISI)
CreateField (DerefOf (Local0[0]), 0x40, 1, VISI)
VISI = Arg0
Return (PCKG)
Return (Local0)
}
Device (PRT1) { Name (_ADR, 1) }

View file

@ -330,18 +330,18 @@ Device (XHCI)
// GPLD: Generate Port Location Data (PLD)
Method (GPLD, 1, Serialized) {
Name (PCKG, Package () {
Local0 = Package () {
Buffer (0x10) {}
})
}
// REV: Revision 2 for ACPI 5.0
CreateField (DerefOf (PCKG [0]), 0, 7, REV)
CreateField (DerefOf (Local0[0]), 0, 7, REV)
REV = 2
// VISI: Port visibility to user per port
CreateField (DerefOf (PCKG [0]), 0x40, 1, VISI)
CreateField (DerefOf (Local0[0]), 0x40, 1, VISI)
VISI = Arg0
Return (PCKG)
Return (Local0)
}
Device (PRT1) { Name (_ADR, 1) } // USB Port 0

View file

@ -159,23 +159,19 @@ Device (XHCI)
Name (_ADR, 0)
// GPLD: Generate Port Location Data (PLD)
Method (GPLD, 1, Serialized)
{
Name (PCKG, Package (0x01)
{
Method (GPLD, 1, Serialized) {
Local0 = Package () {
Buffer (0x10) {}
})
}
// REV: Revision 0x02 for ACPI 5.0
CreateField (DerefOf (PCKG[0]), 0, 0x07, REV)
REV = 0x02
// REV: Revision 2 for ACPI 5.0
CreateField (DerefOf (Local0[0]), 0, 7, REV)
REV = 2
// VISI: Port visibility to user per port
CreateField (DerefOf (PCKG[0]), 0x40, 1, VISI)
CreateField (DerefOf (Local0[0]), 0x40, 1, VISI)
VISI = Arg0
Return (PCKG)
Return (Local0)
}
/* USB2 */

View file

@ -26,25 +26,20 @@ Device (EHC1)
{
Name (_ADR, 0x00000000)
// GPLD: Generate Port Location Data (PLD)
Method (GPLD, 1, Serialized)
{
Name (PCKG, Package (0x01)
{
Method (GPLD, 1, Serialized) {
Local0 = Package () {
Buffer (0x10) {}
})
}
// REV: Revision 0x02 for ACPI 5.0
CreateField (DerefOf (PCKG [0]), 0, 0x07, REV)
REV = 0x02
// REV: Revision 2 for ACPI 5.0
CreateField (DerefOf (Local0[0]), 0, 7, REV)
REV = 2
// VISI: Port visibility to user per port
CreateField (DerefOf (PCKG [0]), 0x40, 1, VISI)
CreateField (DerefOf (Local0[0]), 0x40, 1, VISI)
VISI = Arg0
Return (PCKG)
Return (Local0)
}
// How many are there?
@ -82,22 +77,19 @@ Device (EHC2)
Name (_ADR, 0x00000000)
// GPLD: Generate Port Location Data (PLD)
Method (GPLD, 1, Serialized)
{
Name (PCKG, Package (0x01)
{
Method (GPLD, 1, Serialized) {
Local0 = Package () {
Buffer (0x10) {}
})
}
// REV: Revision 0x02 for ACPI 5.0
CreateField (DerefOf (PCKG [0]), 0, 0x07, REV)
REV = 0x02
// REV: Revision 2 for ACPI 5.0
CreateField (DerefOf (Local0[0]), 0, 7, REV)
REV = 2
// VISI: Port visibility to user per port
CreateField (DerefOf (PCKG [0]), 0x40, 1, VISI)
CreateField (DerefOf (Local0[0]), 0x40, 1, VISI)
VISI = Arg0
Return (PCKG)
Return (Local0)
}
// How many are there?

View file

@ -364,18 +364,18 @@ Device (XHCI)
// GPLD: Generate Port Location Data (PLD)
Method (GPLD, 1, Serialized) {
Name (PCKG, Package () {
Local0 = Package () {
Buffer (0x10) {}
})
}
// REV: Revision 2 for ACPI 5.0
CreateField (DerefOf (PCKG [0]), 0, 7, REV)
CreateField (DerefOf (Local0[0]), 0, 7, REV)
REV = 2
// VISI: Port visibility to user per port
CreateField (DerefOf (PCKG [0]), 0x40, 1, VISI)
CreateField (DerefOf (Local0[0]), 0x40, 1, VISI)
VISI = Arg0
Return (PCKG)
Return (Local0)
}
Device (PRT1) { Name (_ADR, 1) } // USB Port 0