From ac8e4db246861b917513133aaf02a668cdfd0915 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Wed, 19 Jul 2017 10:46:46 -0600 Subject: [PATCH] soc/intel/common/gpio: fix gpi_status_get() A pad number is passed into gpi_status_get() to determine if its associated bit is set from a generated event. However, the implementation wasn't taking into account the gpi_status_offset which dictates the starting offset for each community. Additionally, the max_pads_per_group field is per community as well -- not global. Fix the code to properly take into account the community's gpi_status_offset as well as the max_pads_per_group. Change-Id: Ia18ac6cbac31e3da3ae0ce3764ac33aa9286ac63 Signed-off-by: Aaron Durbin Reviewed-on: https://review.coreboot.org/20652 Reviewed-by: Furquan Shaikh Tested-by: build bot (Jenkins) Reviewed-by: Hannah Williams --- src/soc/intel/common/block/gpio/gpio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/soc/intel/common/block/gpio/gpio.c b/src/soc/intel/common/block/gpio/gpio.c index 6e9ae72c58..ce867ceadc 100644 --- a/src/soc/intel/common/block/gpio/gpio.c +++ b/src/soc/intel/common/block/gpio/gpio.c @@ -384,7 +384,8 @@ int gpi_status_get(const struct gpi_status *sts, gpio_t pad) const struct pad_community *comm = gpio_get_community(pad); pad = pad - comm->first_pad; - sts_index = pad / comm->max_pads_per_group; + sts_index = comm->gpi_status_offset; + sts_index += pad / comm->max_pads_per_group; return !!(sts->grp[sts_index] & (1 << pad % comm->max_pads_per_group));