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 <jeremy.compostella@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88085
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Wonkyu Kim <wonkyu.kim@intel.com>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Subrata Banik <subratabanik@google.com>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
This commit is contained in:
Jeremy Compostella 2025-06-11 17:14:10 -07:00 committed by Sean Rhodes
commit d17ace2c1b

View file

@ -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 */