summaryrefslogtreecommitdiff
path: root/src/vendorcode
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2021-11-02 13:03:06 +0200
committerKyösti Mälkki <kyosti.malkki@gmail.com>2022-04-07 20:38:12 +0000
commit4ff218aa712a6875c6059343ba407f107a3312a1 (patch)
tree1b5b2a10053a0a7ff8e7f4f993405f8a2b643a17 /src/vendorcode
parentf0be9e34728070c8965a8a31832660a678881886 (diff)
ChromeOS: Add DECLARE_x_CROS_GPIOS()
Change-Id: I88406fa1b54312616e6717af3d924436dc4ff1a6 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/58899 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Diffstat (limited to 'src/vendorcode')
-rw-r--r--src/vendorcode/google/chromeos/acpi.c3
-rw-r--r--src/vendorcode/google/chromeos/chromeos.h19
2 files changed, 20 insertions, 2 deletions
diff --git a/src/vendorcode/google/chromeos/acpi.c b/src/vendorcode/google/chromeos/acpi.c
index 383cd313f3..801f33ddf4 100644
--- a/src/vendorcode/google/chromeos/acpi.c
+++ b/src/vendorcode/google/chromeos/acpi.c
@@ -12,7 +12,8 @@ void chromeos_acpi_gpio_generate(void)
size_t i, num;
int gpio_num;
- gpios = variant_cros_gpios(&num);
+ num = variant_cros_gpio.count;
+ gpios = variant_cros_gpio.gpios;
if (!gpios)
return;
diff --git a/src/vendorcode/google/chromeos/chromeos.h b/src/vendorcode/google/chromeos/chromeos.h
index 2ab51bebeb..cd3b603507 100644
--- a/src/vendorcode/google/chromeos/chromeos.h
+++ b/src/vendorcode/google/chromeos/chromeos.h
@@ -98,6 +98,23 @@ struct cros_gpio {
#define CROS_GPIO_PE_AH(num, dev) \
CROS_GPIO_PE_INITIALIZER(CROS_GPIO_ACTIVE_HIGH, num, dev)
-const struct cros_gpio *variant_cros_gpios(size_t *num);
+struct cros_gpio_pack {
+ int count;
+ const struct cros_gpio *gpios;
+};
+
+extern const struct cros_gpio_pack variant_cros_gpio;
+
+#define DECLARE_NO_CROS_GPIOS() \
+ const struct cros_gpio_pack variant_cros_gpio = \
+ { .count = 0, .gpios = NULL }
+
+#define DECLARE_CROS_GPIOS(x) \
+ const struct cros_gpio_pack variant_cros_gpio = \
+ { .count = ARRAY_SIZE(x), .gpios = x }
+
+#define DECLARE_WEAK_CROS_GPIOS(x) \
+ const struct cros_gpio_pack __weak variant_cros_gpio = \
+ { .count = ARRAY_SIZE(x), .gpios = x }
#endif /* __CHROMEOS_H__ */