From d17ace2c1b6d064e2c0ec563aa4db190caae036d Mon Sep 17 00:00:00 2001 From: Jeremy Compostella Date: Wed, 11 Jun 2025 17:14:10 -0700 Subject: [PATCH] soc/intel/cmn/blk/cnvi: Remove hardcoded offset in OperationRegion The commit leverages the \_SB.PCI0.BASE() ACPI method to remove the hardcoded offset in the definition of the ACPI OperationRegion for CNVI devices. Instead of using a fixed memory address addition, the code now dynamically calculates the RegionOffset using the device's base address (_ADR). This change enhances flexibility and adaptability for different configurations and devices. TEST=acpidbg -b 'evaluate \_SB.PCI0.CNVW.VDID' returns 0xE4408086 on a Fatcat device. Change-Id: Ia329aef0291c31862d002cb9bfa35930dab83fe5 Signed-off-by: Jeremy Compostella Reviewed-on: https://review.coreboot.org/c/coreboot/+/88085 Tested-by: build bot (Jenkins) Reviewed-by: Wonkyu Kim Reviewed-by: Sean Rhodes Reviewed-by: Subrata Banik Reviewed-by: Paul Menzel --- src/soc/intel/common/block/cnvi/cnvi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/soc/intel/common/block/cnvi/cnvi.c b/src/soc/intel/common/block/cnvi/cnvi.c index 7aada20079..f155cde5fd 100644 --- a/src/soc/intel/common/block/cnvi/cnvi.c +++ b/src/soc/intel/common/block/cnvi/cnvi.c @@ -21,7 +21,7 @@ static void cnvw_fill_ssdt(const struct device *dev) acpigen_write_scope(scope); /* - * OperationRegion(CWAR, SystemMemory, Add(\_SB.PCI0.GPCB(), 0xa3000), 0x100) + * OperationRegion(CWAR, SystemMemory, \_SB_.PCI0.BASE(_ADR), 0x100) * Field(CWAR, WordAcc, NoLock, Preserve) { * VDID, 32, // 0x00, VID DID * Offset(CNVI_DEV_CAP), @@ -36,10 +36,10 @@ static void cnvw_fill_ssdt(const struct device *dev) */ /* RegionOffset stored in Local0 */ - /* Local0 = \_SB_.PCI0.GPCB() + 0xa3000 */ - acpigen_emit_byte(ADD_OP); - acpigen_write_integer(0xa3000); - acpigen_emit_namestring("\\_SB_.PCI0.GPCB()"); + /* Local0 = \_SB_.PCI0.BASE(_ADR) */ + acpigen_write_store(); + acpigen_emit_namestring("\\_SB_.PCI0.BASE"); + acpigen_emit_namestring("_ADR"); acpigen_emit_byte(LOCAL0_OP); /* OperationRegion */