summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2017-07-19 10:46:46 -0600
committerAaron Durbin <adurbin@chromium.org>2017-07-20 17:06:48 +0000
commitac8e4db246861b917513133aaf02a668cdfd0915 (patch)
tree71b04c5eabf3b422c835fc11bf7e67f74fd18ab3
parentea864f4a2d6ad85c97e78e36b8a30e605d3a5881 (diff)
downloadcoreboot-ac8e4db246861b917513133aaf02a668cdfd0915.tar.xz
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 <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/20652 Reviewed-by: Furquan Shaikh <furquan@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Hannah Williams <hannah.williams@intel.com>
-rw-r--r--src/soc/intel/common/block/gpio/gpio.c3
1 files changed, 2 insertions, 1 deletions
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));