Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/83997?usp=email )
Change subject: soc/intel/common/gpio: vm index changes as PTL vm entries are not continuous ......................................................................
soc/intel/common/gpio: vm index changes as PTL vm entries are not continuous
Add specific virtual wire mapping structure for: - First pad group does not starts with bit position 0. - vw_index and position are not continuous in between groups within a community.
BUG= TEST=boot to OS and use iotools to read the registers that use 16-bit port ID such as IOM AUX Bias Ctrl register to verify the 16-bit group ID field.
Signed-off-by: Cliff Huang cliff.huang@intel.com Change-Id: I986d4f4fe59b110e5075cab8742dfe8b336d034b Reviewed-on: https://review.coreboot.org/c/coreboot/+/83997 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Subrata Banik subratabanik@google.com --- M src/soc/intel/common/block/gpio/gpio.c M src/soc/intel/common/block/include/intelblocks/gpio.h 2 files changed, 17 insertions(+), 2 deletions(-)
Approvals: build bot (Jenkins): Verified Subrata Banik: Looks good to me, approved
diff --git a/src/soc/intel/common/block/gpio/gpio.c b/src/soc/intel/common/block/gpio/gpio.c index d49742d..625c3f4 100644 --- a/src/soc/intel/common/block/gpio/gpio.c +++ b/src/soc/intel/common/block/gpio/gpio.c @@ -1068,8 +1068,16 @@ if (i == comm->num_vw_entries) return false;
- offset += pad - comm->vw_entries[i].first_pad; - *vw_index = comm->vw_base + offset / 8; + /* Adjust offset and calculate vw_index based on the mapping type */ + if (comm->vw_map) { + offset = pad - comm->vw_entries[i].first_pad; + offset += comm->vw_map[i].start_pos; + *vw_index = comm->vw_map[i].base + offset / 8; + } else { + offset += pad - comm->vw_entries[i].first_pad; + offset += comm->vw_base; + *vw_index = offset / 8; + } *vw_bit = offset % 8;
return true; diff --git a/src/soc/intel/common/block/include/intelblocks/gpio.h b/src/soc/intel/common/block/include/intelblocks/gpio.h index 39d17a1..a501f7f 100644 --- a/src/soc/intel/common/block/include/intelblocks/gpio.h +++ b/src/soc/intel/common/block/include/intelblocks/gpio.h @@ -110,6 +110,12 @@ gpio_t last_pad; };
+/* virtual-wire mapping base and the starting bit position for a group */ +struct vw_map { + uint8_t base; + uint8_t start_pos; +}; + /* This structure will be used to describe a community or each group within a * community when multiple groups exist inside a community */ @@ -152,6 +158,7 @@ * which they map to VW indexes (beginning with VW base) */ const struct vw_entries *vw_entries; + const struct vw_map *vw_map; size_t num_vw_entries; };