Attention is currently required from: Martin Roth.

Mathew King has uploaded this change for review.

View Change

mb/google/guybrush: Add smihandler

BUG=b:180507707
TEST=builds

Signed-off-by: Mathew King <mathewk@chromium.org>
Change-Id: I25ce0ca869ca854ff33242d2c416319e9688cc6f
---
A src/mainboard/google/guybrush/smihandler.c
M src/mainboard/google/guybrush/variants/baseboard/Makefile.inc
M src/mainboard/google/guybrush/variants/baseboard/gpio.c
M src/mainboard/google/guybrush/variants/baseboard/include/baseboard/variants.h
4 files changed, 52 insertions(+), 0 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/51264/1
diff --git a/src/mainboard/google/guybrush/smihandler.c b/src/mainboard/google/guybrush/smihandler.c
new file mode 100644
index 0000000..f5dcd4e
--- /dev/null
+++ b/src/mainboard/google/guybrush/smihandler.c
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include <acpi/acpi.h>
+#include <baseboard/variants.h>
+#include <cpu/x86/smm.h>
+#include <ec/google/chromeec/smm.h>
+#include <gpio.h>
+#include <soc/smi.h>
+#include <variant/ec.h>
+
+void mainboard_smi_gpi(u32 gpi_sts)
+{
+ if (CONFIG(EC_GOOGLE_CHROMEEC))
+ chromeec_smi_process_events();
+}
+void mainboard_smi_sleep(u8 slp_typ)
+{
+ size_t num_gpios;
+ const struct soc_amd_gpio *gpios;
+
+ if (CONFIG(EC_GOOGLE_CHROMEEC))
+ chromeec_smi_sleep(slp_typ, MAINBOARD_EC_S3_WAKE_EVENTS,
+ MAINBOARD_EC_S5_WAKE_EVENTS);
+
+ gpios = variant_sleep_gpio_table(&num_gpios);
+ program_gpios(gpios, num_gpios);
+}
+
+int mainboard_smi_apmc(u8 apmc)
+{
+ if (CONFIG(EC_GOOGLE_CHROMEEC))
+ chromeec_smi_apmc(apmc, MAINBOARD_EC_SCI_EVENTS,
+ MAINBOARD_EC_SMI_EVENTS);
+
+ return 0;
+}
diff --git a/src/mainboard/google/guybrush/variants/baseboard/Makefile.inc b/src/mainboard/google/guybrush/variants/baseboard/Makefile.inc
index 9fb63f5..7c092e4 100644
--- a/src/mainboard/google/guybrush/variants/baseboard/Makefile.inc
+++ b/src/mainboard/google/guybrush/variants/baseboard/Makefile.inc
@@ -1,3 +1,5 @@
bootblock-y += gpio.c

ramstage-y += gpio.c
+
+smm-y += gpio.c
diff --git a/src/mainboard/google/guybrush/variants/baseboard/gpio.c b/src/mainboard/google/guybrush/variants/baseboard/gpio.c
index 6d5788d..68c7d29 100644
--- a/src/mainboard/google/guybrush/variants/baseboard/gpio.c
+++ b/src/mainboard/google/guybrush/variants/baseboard/gpio.c
@@ -168,6 +168,11 @@
/* TODO: Fill bootblock gpio configuration */
};

+/* GPIO configuration for sleep */
+static const struct soc_amd_gpio sleep_gpio_table[] = {
+ /* TODO: Fill sleep gpio configuration */
+};
+
const struct soc_amd_gpio *__weak variant_base_gpio_table(size_t *size)
{
*size = ARRAY_SIZE(base_gpio_table);
@@ -184,3 +189,9 @@
*size = ARRAY_SIZE(bootblock_gpio_table);
return bootblock_gpio_table;
}
+
+const __weak struct soc_amd_gpio *variant_sleep_gpio_table(size_t *size)
+{
+ *size = ARRAY_SIZE(sleep_gpio_table);
+ return sleep_gpio_table;
+}
diff --git a/src/mainboard/google/guybrush/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/guybrush/variants/baseboard/include/baseboard/variants.h
index 2946463..91a2f14 100644
--- a/src/mainboard/google/guybrush/variants/baseboard/include/baseboard/variants.h
+++ b/src/mainboard/google/guybrush/variants/baseboard/include/baseboard/variants.h
@@ -21,4 +21,7 @@
/* This function provides GPIO init in bootblock. */
const struct soc_amd_gpio *variant_bootblock_gpio_table(size_t *size);

+/* This function provides GPIO settings before entering sleep. */
+const struct soc_amd_gpio *variant_sleep_gpio_table(size_t *size);
+
#endif /* __BASEBOARD_VARIANTS_H__ */

To view, visit change 51264. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I25ce0ca869ca854ff33242d2c416319e9688cc6f
Gerrit-Change-Number: 51264
Gerrit-PatchSet: 1
Gerrit-Owner: Mathew King <mathewk@chromium.org>
Gerrit-Reviewer: Martin Roth <martinroth@google.com>
Gerrit-Reviewer: Patrick Georgi <pgeorgi@google.com>
Gerrit-Attention: Martin Roth <martinroth@google.com>
Gerrit-MessageType: newchange