soc/amd: Only warn about missing gevents when they're used
Before this change, there was no way to tell if this warning was a real
problem. Now it only warns if it's a problem and tells you that it's
not initializing the requested flag.
BUG=None
TEST=Warning about GPIO 62 now says that it's not initializing
the SCI flag.
Change-Id: I17bc9bb63fa76a1266e7874de289824ddf817f50
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/coreboot/+/2004556
Reviewed-by: Eric Peers <epeers@google.com>
Reviewed-by: Raul E Rangel <rrangel@chromium.org>
Reviewed-by: Marshall Dawson <marshall.dawson@amd.corp-partner.google.com>
Commit-Queue: Martin Roth <martinroth@google.com>
Tested-by: Martin Roth <martinroth@google.com>
Auto-Submit: Martin Roth <martinroth@google.com>
diff --git a/src/soc/amd/common/block/gpio_banks/gpio.c b/src/soc/amd/common/block/gpio_banks/gpio.c
index 17e3de0..219a131 100644
--- a/src/soc/amd/common/block/gpio_banks/gpio.c
+++ b/src/soc/amd/common/block/gpio_banks/gpio.c
@@ -183,6 +183,17 @@
return gpio;
}
+static int gevent_missing(uint8_t gpio, int gevent_num, const char *string)
+{
+ if (gevent_num < 0) {
+ printk(BIOS_WARNING, "Warning: GPIO pin %d has"
+ " no associated gevent!\n", gpio);
+ printk (BIOS_WARNING, "Not programming %s\n", string);
+ return 1;
+ }
+ return 0;
+}
+
__weak void soc_gpio_hook(uint8_t gpio, uint8_t mux) {}
void program_gpios(const struct soc_amd_gpio *gpio_list_ptr, size_t size)
@@ -230,11 +241,6 @@
if (control_flags & GPIO_SPECIAL_FLAG) {
gevent_num = get_gpio_gevent(gpio, gev_tbl, gev_items);
- if (gevent_num < 0) {
- printk(BIOS_WARNING, "Warning: GPIO pin %d has"
- " no associated gevent!\n", gpio);
- continue;
- }
switch (control_flags & GPIO_SPECIAL_MASK) {
case GPIO_DEBOUNCE_FLAG:
mem_read_write32(gpio_ptr, control,
@@ -249,11 +255,15 @@
AMD_GPIO_CONTROL_MASK);
break;
case GPIO_SMI_FLAG:
+ if (gevent_missing(gpio, gevent_num, "SMI Flag"))
+ break;
mem_read_write32(gpio_ptr, control,
INT_SCI_SMI_MASK);
program_smi(control_flags, gevent_num);
break;
case GPIO_SCI_FLAG:
+ if (gevent_missing(gpio, gevent_num, "SCI Flag"))
+ break;
mem_read_write32(gpio_ptr, control,
INT_SCI_SMI_MASK);
get_sci_config_bits(control_flags, &bit_edge,