summaryrefslogtreecommitdiff
path: root/src/soc
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2019-11-06 11:04:27 +0200
committerKyösti Mälkki <kyosti.malkki@gmail.com>2019-11-09 10:49:47 +0000
commit9dd1a12f9c3199fe9f678a4997bb163a1eb1bb96 (patch)
tree13440c2c992bf76005b3165671328d6ed154e5e9 /src/soc
parent7e4bfe4b91cc8dbc18a4b940c26f372e471d49db (diff)
downloadcoreboot-9dd1a12f9c3199fe9f678a4997bb163a1eb1bb96.tar.xz
ELOG: Introduce elog_gsmi variants
This avoids a lot of if (CONFIG(ELOG_GSMI)) boilerplate. Change-Id: I87d25c820daedeb33b3b474a6632a89ea80b0867 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/36647 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc')
-rw-r--r--src/soc/amd/picasso/smihandler.c3
-rw-r--r--src/soc/amd/stoneyridge/smihandler.c3
-rw-r--r--src/soc/intel/baytrail/smihandler.c15
-rw-r--r--src/soc/intel/braswell/smihandler.c16
-rw-r--r--src/soc/intel/broadwell/smihandler.c15
-rw-r--r--src/soc/intel/common/block/smm/smihandler.c7
-rw-r--r--src/soc/intel/fsp_baytrail/smihandler.c16
7 files changed, 23 insertions, 52 deletions
diff --git a/src/soc/amd/picasso/smihandler.c b/src/soc/amd/picasso/smihandler.c
index 4995acb484..39c2dfd09b 100644
--- a/src/soc/amd/picasso/smihandler.c
+++ b/src/soc/amd/picasso/smihandler.c
@@ -153,8 +153,7 @@ static void sb_slp_typ_handler(void)
if (slp_typ >= ACPI_S3) {
/* Sleep Type Elog S3, S4, and S5 entry */
- if (CONFIG(ELOG_GSMI))
- elog_add_event_byte(ELOG_TYPE_ACPI_ENTER, slp_typ);
+ elog_gsmi_add_event_byte(ELOG_TYPE_ACPI_ENTER, slp_typ);
wbinvd();
diff --git a/src/soc/amd/stoneyridge/smihandler.c b/src/soc/amd/stoneyridge/smihandler.c
index 9eddf853b6..2b883972c9 100644
--- a/src/soc/amd/stoneyridge/smihandler.c
+++ b/src/soc/amd/stoneyridge/smihandler.c
@@ -153,8 +153,7 @@ static void sb_slp_typ_handler(void)
if (slp_typ >= ACPI_S3) {
/* Sleep Type Elog S3, S4, and S5 entry */
- if (CONFIG(ELOG_GSMI))
- elog_add_event_byte(ELOG_TYPE_ACPI_ENTER, slp_typ);
+ elog_gsmi_add_event_byte(ELOG_TYPE_ACPI_ENTER, slp_typ);
wbinvd();
diff --git a/src/soc/intel/baytrail/smihandler.c b/src/soc/intel/baytrail/smihandler.c
index 7de9d960a0..16e2d950b5 100644
--- a/src/soc/intel/baytrail/smihandler.c
+++ b/src/soc/intel/baytrail/smihandler.c
@@ -114,11 +114,9 @@ static void southbridge_smi_sleep(void)
/* Do any mainboard sleep handling */
mainboard_smi_sleep(slp_typ);
-#if CONFIG(ELOG_GSMI)
/* Log S3, S4, and S5 entry */
if (slp_typ >= ACPI_S3)
- elog_add_event_byte(ELOG_TYPE_ACPI_ENTER, slp_typ);
-#endif
+ elog_gsmi_add_event_byte(ELOG_TYPE_ACPI_ENTER, slp_typ);
/* Next, do the deed.
*/
@@ -210,7 +208,6 @@ static em64t100_smm_state_save_area_t *smi_apmc_find_state_save(uint8_t cmd)
return NULL;
}
-#if CONFIG(ELOG_GSMI)
static void southbridge_smi_gsmi(void)
{
u32 *ret, *param;
@@ -231,7 +228,6 @@ static void southbridge_smi_gsmi(void)
/* drivers/elog/gsmi.c */
*ret = gsmi_exec(sub_command, param);
}
-#endif
static void finalize(void)
{
@@ -348,11 +344,10 @@ static void southbridge_smi_apmc(void)
printk(BIOS_DEBUG, "SMI#: Setting GNVS to %p\n", gnvs);
}
break;
-#if CONFIG(ELOG_GSMI)
case APM_CNT_ELOG_GSMI:
- southbridge_smi_gsmi();
+ if (CONFIG(ELOG_GSMI))
+ southbridge_smi_gsmi();
break;
-#endif
case APM_CNT_FINALIZE:
finalize();
break;
@@ -374,9 +369,7 @@ static void southbridge_smi_pm1(void)
*/
if (pm1_sts & PWRBTN_STS) {
// power button pressed
-#if CONFIG(ELOG_GSMI)
- elog_add_event(ELOG_TYPE_POWER_BUTTON);
-#endif
+ elog_gsmi_add_event(ELOG_TYPE_POWER_BUTTON);
disable_pm1_control(-1UL);
enable_pm1_control(SLP_EN | (SLP_TYP_S5 << SLP_TYP_SHIFT));
}
diff --git a/src/soc/intel/braswell/smihandler.c b/src/soc/intel/braswell/smihandler.c
index 174cd5d7ef..b94fe653ad 100644
--- a/src/soc/intel/braswell/smihandler.c
+++ b/src/soc/intel/braswell/smihandler.c
@@ -154,11 +154,10 @@ static void southbridge_smi_sleep(void)
/* Do any mainboard sleep handling */
mainboard_smi_sleep(slp_typ);
-#if CONFIG(ELOG_GSMI)
/* Log S3, S4, and S5 entry */
if (slp_typ >= ACPI_S3)
- elog_add_event_byte(ELOG_TYPE_ACPI_ENTER, slp_typ);
-#endif
+ elog_gsmi_add_event_byte(ELOG_TYPE_ACPI_ENTER, slp_typ);
+
/* Clear pending GPE events */
clear_gpe_status();
@@ -260,7 +259,6 @@ static em64t100_smm_state_save_area_t *smi_apmc_find_state_save(uint8_t cmd)
return NULL;
}
-#if CONFIG(ELOG_GSMI)
static void southbridge_smi_gsmi(void)
{
u32 *ret, *param;
@@ -281,7 +279,6 @@ static void southbridge_smi_gsmi(void)
/* drivers/elog/gsmi.c */
*ret = gsmi_exec(sub_command, param);
}
-#endif
static void finalize(void)
{
@@ -346,11 +343,10 @@ static void southbridge_smi_apmc(void)
printk(BIOS_DEBUG, "SMI#: Setting GNVS to %p\n", gnvs);
}
break;
-#if CONFIG(ELOG_GSMI)
case APM_CNT_ELOG_GSMI:
- southbridge_smi_gsmi();
+ if (CONFIG(ELOG_GSMI))
+ southbridge_smi_gsmi();
break;
-#endif
case APM_CNT_FINALIZE:
finalize();
break;
@@ -369,9 +365,7 @@ static void southbridge_smi_pm1(void)
*/
if (pm1_sts & PWRBTN_STS) {
/* power button pressed */
-#if CONFIG(ELOG_GSMI)
- elog_add_event(ELOG_TYPE_POWER_BUTTON);
-#endif
+ elog_gsmi_add_event(ELOG_TYPE_POWER_BUTTON);
disable_pm1_control(-1UL);
enable_pm1_control(SLP_EN | (SLP_TYP_S5 << SLP_TYP_SHIFT));
}
diff --git a/src/soc/intel/broadwell/smihandler.c b/src/soc/intel/broadwell/smihandler.c
index bad158748d..d37f65a16f 100644
--- a/src/soc/intel/broadwell/smihandler.c
+++ b/src/soc/intel/broadwell/smihandler.c
@@ -179,11 +179,9 @@ static void southbridge_smi_sleep(void)
/* USB sleep preparations */
usb_xhci_sleep_prepare(PCH_DEV_XHCI, slp_typ);
-#if CONFIG(ELOG_GSMI)
/* Log S3, S4, and S5 entry */
if (slp_typ >= ACPI_S3)
- elog_add_event_byte(ELOG_TYPE_ACPI_ENTER, slp_typ);
-#endif
+ elog_gsmi_add_event_byte(ELOG_TYPE_ACPI_ENTER, slp_typ);
/* Clear pending GPE events */
clear_gpe_status();
@@ -293,7 +291,6 @@ static em64t101_smm_state_save_area_t *smi_apmc_find_state_save(u8 cmd)
return NULL;
}
-#if CONFIG(ELOG_GSMI)
static void southbridge_smi_gsmi(void)
{
u32 *ret, *param;
@@ -314,7 +311,6 @@ static void southbridge_smi_gsmi(void)
/* drivers/elog/gsmi.c */
*ret = gsmi_exec(sub_command, param);
}
-#endif
static void finalize(void)
{
@@ -372,11 +368,10 @@ static void southbridge_smi_apmc(void)
printk(BIOS_DEBUG, "SMI#: Setting GNVS to %p\n", gnvs);
}
break;
-#if CONFIG(ELOG_GSMI)
case APM_CNT_ELOG_GSMI:
- southbridge_smi_gsmi();
+ if (CONFIG(ELOG_GSMI))
+ southbridge_smi_gsmi();
break;
-#endif
}
mainboard_smi_apmc(reg8);
@@ -391,9 +386,7 @@ static void southbridge_smi_pm1(void)
*/
if (pm1_sts & PWRBTN_STS) {
/* power button pressed */
-#if CONFIG(ELOG_GSMI)
- elog_add_event(ELOG_TYPE_POWER_BUTTON);
-#endif
+ elog_gsmi_add_event(ELOG_TYPE_POWER_BUTTON);
disable_pm1_control(-1UL);
enable_pm1_control(SLP_EN | (SLP_TYP_S5 << 10));
}
diff --git a/src/soc/intel/common/block/smm/smihandler.c b/src/soc/intel/common/block/smm/smihandler.c
index 9e98aae564..0581d23021 100644
--- a/src/soc/intel/common/block/smm/smihandler.c
+++ b/src/soc/intel/common/block/smm/smihandler.c
@@ -195,8 +195,8 @@ void smihandler_southbridge_sleep(
mainboard_smi_sleep(slp_typ);
/* Log S3, S4, and S5 entry */
- if (slp_typ >= ACPI_S3 && CONFIG(ELOG_GSMI))
- elog_add_event_byte(ELOG_TYPE_ACPI_ENTER, slp_typ);
+ if (slp_typ >= ACPI_S3)
+ elog_gsmi_add_event_byte(ELOG_TYPE_ACPI_ENTER, slp_typ);
/* Clear pending GPE events */
pmc_clear_all_gpe_status();
@@ -413,8 +413,7 @@ void smihandler_southbridge_pm1(
*/
if ((pm1_sts & PWRBTN_STS) && (pm1_en & PWRBTN_EN)) {
/* power button pressed */
- if (CONFIG(ELOG_GSMI))
- elog_add_event(ELOG_TYPE_POWER_BUTTON);
+ elog_gsmi_add_event(ELOG_TYPE_POWER_BUTTON);
pmc_disable_pm1_control(-1UL);
pmc_enable_pm1_control(SLP_EN | (SLP_TYP_S5 << SLP_TYP_SHIFT));
}
diff --git a/src/soc/intel/fsp_baytrail/smihandler.c b/src/soc/intel/fsp_baytrail/smihandler.c
index 2a7376ad7d..1a8fb4b6e6 100644
--- a/src/soc/intel/fsp_baytrail/smihandler.c
+++ b/src/soc/intel/fsp_baytrail/smihandler.c
@@ -112,11 +112,9 @@ static void southbridge_smi_sleep(void)
/* Do any mainboard sleep handling */
mainboard_smi_sleep(slp_typ);
-#if CONFIG(ELOG_GSMI)
/* Log S3, S4, and S5 entry */
if (slp_typ >= ACPI_S3)
- elog_add_event_byte(ELOG_TYPE_ACPI_ENTER, slp_typ);
-#endif
+ elog_gsmi_add_event_byte(ELOG_TYPE_ACPI_ENTER, slp_typ);
/* Next, do the deed.
*/
@@ -208,7 +206,6 @@ static em64t100_smm_state_save_area_t *smi_apmc_find_state_save(uint8_t cmd)
return NULL;
}
-#if CONFIG(ELOG_GSMI)
static void southbridge_smi_gsmi(void)
{
u32 *ret, *param;
@@ -229,7 +226,7 @@ static void southbridge_smi_gsmi(void)
/* drivers/elog/gsmi.c */
*ret = gsmi_exec(sub_command, param);
}
-#endif
+
static void southbridge_smi_apmc(void)
{
uint8_t reg8;
@@ -275,11 +272,10 @@ static void southbridge_smi_apmc(void)
printk(BIOS_DEBUG, "SMI#: Setting GNVS to %p\n", gnvs);
}
break;
-#if CONFIG(ELOG_GSMI)
case APM_CNT_ELOG_GSMI:
- southbridge_smi_gsmi();
+ if (CONFIG(ELOG_GSMI))
+ southbridge_smi_gsmi();
break;
-#endif
}
mainboard_smi_apmc(reg8);
@@ -294,9 +290,7 @@ static void southbridge_smi_pm1(void)
*/
if (pm1_sts & PWRBTN_STS) {
// power button pressed
-#if CONFIG(ELOG_GSMI)
- elog_add_event(ELOG_TYPE_POWER_BUTTON);
-#endif
+ elog_gsmi_add_event(ELOG_TYPE_POWER_BUTTON);
disable_pm1_control(-1UL);
enable_pm1_control(SLP_EN | (SLP_TYP_S5 << SLP_TYP_SHIFT));
}