Kyösti Mälkki has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/48639 )
Change subject: soc/amd/common: Complete ACPIMMIO GPIO bank separation ......................................................................
soc/amd/common: Complete ACPIMMIO GPIO bank separation
Move GPIO bank accessors away from global scope.
Change-Id: Ie9db76129172311e848a374acb36b212c36bd1dc Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/soc/amd/common/block/gpio_banks/gpio.c M src/soc/amd/common/block/include/amdblocks/acpimmio.h 2 files changed, 15 insertions(+), 17 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/39/48639/1
diff --git a/src/soc/amd/common/block/gpio_banks/gpio.c b/src/soc/amd/common/block/gpio_banks/gpio.c index 8e340a3..1cd1ef4 100644 --- a/src/soc/amd/common/block/gpio_banks/gpio.c +++ b/src/soc/amd/common/block/gpio_banks/gpio.c @@ -89,11 +89,26 @@ smi_write32(SMI_SCI_LEVEL, value); }
+static void *gpio_ctrl_ptr(gpio_t gpio_num) +{ + return acpimmio_gpio0 + gpio_num * sizeof(uint32_t); +} + uintptr_t gpio_get_address(gpio_t gpio_num) { return (uintptr_t)gpio_ctrl_ptr(gpio_num); }
+static uint32_t gpio_read32(gpio_t gpio_num) +{ + return read32(gpio_ctrl_ptr(gpio_num)); +} + +static void gpio_write32(gpio_t gpio_num, uint32_t value) +{ + write32(gpio_ctrl_ptr(gpio_num), value); +} + static void gpio_update32(gpio_t gpio_num, uint32_t mask, uint32_t or) { uint32_t reg; diff --git a/src/soc/amd/common/block/include/amdblocks/acpimmio.h b/src/soc/amd/common/block/include/amdblocks/acpimmio.h index ca32f23..84a2d1d 100644 --- a/src/soc/amd/common/block/include/amdblocks/acpimmio.h +++ b/src/soc/amd/common/block/include/amdblocks/acpimmio.h @@ -330,23 +330,6 @@ write32(acpimmio_gpio_100 + reg, value); }
-/* New GPIO banks configuration registers */ - -static inline void *gpio_ctrl_ptr(uint8_t gpio_num) -{ - return acpimmio_gpio0 + gpio_num * sizeof(uint32_t); -} - -static inline uint32_t gpio_read32(uint8_t gpio_num) -{ - return read32(gpio_ctrl_ptr(gpio_num)); -} - -static inline void gpio_write32(uint8_t gpio_num, uint32_t value) -{ - write32(gpio_ctrl_ptr(gpio_num), value); -} - static inline uint8_t xhci_pm_read8(uint8_t reg) { return read8(acpimmio_xhci_pm + reg);