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>
This commit is contained in:
parent
ea864f4a2d
commit
ac8e4db246
|
@ -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);
|
const struct pad_community *comm = gpio_get_community(pad);
|
||||||
|
|
||||||
pad = pad - comm->first_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] &
|
return !!(sts->grp[sts_index] &
|
||||||
(1 << pad % comm->max_pads_per_group));
|
(1 << pad % comm->max_pads_per_group));
|
||||||
|
|
Loading…
Reference in New Issue