diff options
author | Subrata Banik <subratabanik@google.com> | 2022-01-11 12:20:24 +0530 |
---|---|---|
committer | Subrata Banik <subratabanik@google.com> | 2022-01-12 18:40:24 +0000 |
commit | 778851366705579631f23b650edf3bc860f499e4 (patch) | |
tree | cc95f5f2ffd2e97f80d5005f6fd2f10db80a45e9 /src/soc/intel/common/block | |
parent | 878d3723fbbaced4d53ebbdfdf89ef7bef06a06a (diff) |
soc/intel/common/gpio: Fix cosmetic issue with `gpio_lock_pads`
This patch replaces hardcoded `4` (next offset Tx state) with
`sizeof(uint32_t)` for calculating 'Tx state offset'.
Also, add checks to detect the specific GPIO lock action between
`LOCK_CONFIG` or 'LOCK_TX'.
Signed-off-by: Subrata Banik <subratabanik@google.com>
Change-Id: Iff712b16808e0bc99c575bb2426a4f84b89fdb73
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60994
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Maulik V Vaghela <maulik.v.vaghela@intel.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: EricR Lai <ericr_lai@compal.corp-partner.google.com>
Diffstat (limited to 'src/soc/intel/common/block')
-rw-r--r-- | src/soc/intel/common/block/gpio/gpio.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/soc/intel/common/block/gpio/gpio.c b/src/soc/intel/common/block/gpio/gpio.c index 1bc34e7fc3..a833aaebb9 100644 --- a/src/soc/intel/common/block/gpio/gpio.c +++ b/src/soc/intel/common/block/gpio/gpio.c @@ -520,13 +520,14 @@ int gpio_lock_pads(const struct gpio_lock_config *pad_list, const size_t count) __func__, pad); continue; } + /* PADCFGLOCK and PADCFGLOCKTX registers for each community are contiguous */ offset += gpio_group_index_scaled(comm, rel_pad, 2 * sizeof(uint32_t)); data = gpio_bitmask_within_group(comm, rel_pad); msg.pid = comm->port; msg.offset = offset; - if (action & GPIO_LOCK_CONFIG) { + if ((action & GPIO_LOCK_CONFIG) == GPIO_LOCK_CONFIG) { if (CONFIG(DEBUG_GPIO)) printk(BIOS_INFO, "%s: Locking pad %d configuration\n", __func__, pad); @@ -537,11 +538,11 @@ int gpio_lock_pads(const struct gpio_lock_config *pad_list, const size_t count) } } - if (action & GPIO_LOCK_TX) { + if ((action & GPIO_LOCK_TX) == GPIO_LOCK_TX) { if (CONFIG(DEBUG_GPIO)) printk(BIOS_INFO, "%s: Locking pad %d TX state\n", __func__, pad); - msg.offset += 4; + msg.offset += sizeof(uint32_t); status = pcr_execute_sideband_msg(&msg, &data, &response); if ((err = sideband_msg_err(status, response)) != 0) { err_response = err; |