From 813edbbde879e4db365435f3fb025985a0cdfec8 Mon Sep 17 00:00:00 2001 From: Angel Pons Date: Mon, 23 Feb 2026 20:43:45 +0100 Subject: [PATCH] sb/intel/lynxpoint/acpi/xhci.asl: Use macros for constants Declaring named objects for constants is not ideal, especially when done inside of a method (it is highly inefficient). Instead, use preprocessor defines. Change-Id: I1143f2aa09a2ed04da92edcf6ae9d832c0b5e2fa Signed-off-by: Angel Pons Reviewed-on: https://review.coreboot.org/c/coreboot/+/91393 Reviewed-by: Paul Menzel Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/southbridge/intel/lynxpoint/acpi/xhci.asl | 42 +++++++++---------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/src/southbridge/intel/lynxpoint/acpi/xhci.asl b/src/southbridge/intel/lynxpoint/acpi/xhci.asl index d5b97d03e3..9c7bb2c1ac 100644 --- a/src/southbridge/intel/lynxpoint/acpi/xhci.asl +++ b/src/southbridge/intel/lynxpoint/acpi/xhci.asl @@ -6,9 +6,6 @@ Device (XHCI) { Name (_ADR, 0x00140000) - Name (PLSD, 5) // Port Link State - RxDetect - Name (PLSP, 7) // Port Link State - Polling - OperationRegion (XPRT, PCI_Config, 0, 0x100) Field (XPRT, AnyAcc, NoLock, Preserve) { @@ -57,27 +54,24 @@ Device (XHCI) PSC3, 32, } - // Port Enabled/Disabled (Bit 1) - Name (PEDB, 1 << 1) - - // Change Status (Bits 23:17) - Name (CHST, 0x7f << 17) +#define PSC_PORT_ENABLED (1 << 1) +#define PSC_PORT_CHANGE_BITS (0x7f << 17) // Port 0 - Local0 = PSC0 & ~PEDB - PSC0 = Local0 | CHST + Local0 = PSC0 & ~PSC_PORT_ENABLED + PSC0 = Local0 | PSC_PORT_CHANGE_BITS // Port 1 - Local0 = PSC1 & ~PEDB - PSC1 = Local0 | CHST + Local0 = PSC1 & ~PSC_PORT_ENABLED + PSC1 = Local0 | PSC_PORT_CHANGE_BITS // Port 2 - Local0 = PSC2 & ~PEDB - PSC2 = Local0 | CHST + Local0 = PSC2 & ~PSC_PORT_ENABLED + PSC2 = Local0 | PSC_PORT_CHANGE_BITS // Port 3 - Local0 = PSC3 & ~PEDB - PSC3 = Local0 | CHST + Local0 = PSC3 & ~PSC_PORT_ENABLED + PSC3 = Local0 | PSC_PORT_CHANGE_BITS } Method (LPS0, 0, Serialized) @@ -127,10 +121,12 @@ Device (XHCI) WPR4, 1, // [31] Warm Port Reset } +#define PLS_POLLING 7 + // Wait for all powered ports to finish polling Local0 = 10 - While ((PPR1 == 1 && PLS1 == PLSP || PPR2 == 1 && PLS2 == PLSP) || - (PPR3 == 1 && PLS3 == PLSP || PPR4 == 1 && PLS4 == PLSP)) + While ((PPR1 == 1 && PLS1 == PLS_POLLING || PPR2 == 1 && PLS2 == PLS_POLLING) || + (PPR3 == 1 && PLS3 == PLS_POLLING || PPR4 == 1 && PLS4 == PLS_POLLING)) { If (Local0 == 0) { Break @@ -151,19 +147,21 @@ Device (XHCI) Local3 = 0 Local4 = 0 - If (PLS1 == PLSD && (CSC1 == 0 && PPR1 == 1)) { +#define PLS_RX_DETECT 5 + + If (PLS1 == PLS_RX_DETECT && (CSC1 == 0 && PPR1 == 1)) { WPR1 = 1 // Issue warm reset Local1 = 1 } - If (PLS2 == PLSD && (CSC2 == 0 && PPR2 == 1)) { + If (PLS2 == PLS_RX_DETECT && (CSC2 == 0 && PPR2 == 1)) { WPR2 = 1 // Issue warm reset Local2 = 1 } - If (PLS3 == PLSD && (CSC3 == 0 && PPR3 == 1)) { + If (PLS3 == PLS_RX_DETECT && (CSC3 == 0 && PPR3 == 1)) { WPR3 = 1 // Issue warm reset Local3 = 1 } - If (PLS4 == PLSD && (CSC4 == 0 && PPR4 == 1)) { + If (PLS4 == PLS_RX_DETECT && (CSC4 == 0 && PPR4 == 1)) { WPR4 = 1 // Issue warm reset Local4 = 1 }