Kyösti Mälkki has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/36648 )
Change subject: ELOG: Avoid some preprocessor use ......................................................................
ELOG: Avoid some preprocessor use
Change-Id: I8daf8868af2e8c2b07b0dda0eeaf863f2f550c59 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/ec/quanta/ene_kb3940q/ec.c M src/soc/intel/broadwell/me.c M src/southbridge/intel/bd82x6x/me.c M src/southbridge/intel/bd82x6x/me_8.x.c M src/southbridge/intel/ibexpeak/lpc.c M src/southbridge/intel/ibexpeak/me.c M src/southbridge/intel/lynxpoint/me_9.x.c M src/southbridge/intel/lynxpoint/smi.c 8 files changed, 13 insertions(+), 25 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/48/36648/1
diff --git a/src/ec/quanta/ene_kb3940q/ec.c b/src/ec/quanta/ene_kb3940q/ec.c index 4fc38da..5de6336 100644 --- a/src/ec/quanta/ene_kb3940q/ec.c +++ b/src/ec/quanta/ene_kb3940q/ec.c @@ -125,11 +125,11 @@
static void ene_kb3940q_log_events(void) { -#if CONFIG(ELOG) - u8 reason = ec_mem_read(EC_SHUTDOWN_REASON); - if (reason) - elog_add_event_byte(ELOG_TYPE_EC_SHUTDOWN, reason); -#endif + if (CONFIG(ELOG)) { + u8 reason = ec_mem_read(EC_SHUTDOWN_REASON); + if (reason) + elog_add_event_byte(ELOG_TYPE_EC_SHUTDOWN, reason); + } }
static void ene_kb3940q_init(struct device *dev) diff --git a/src/soc/intel/broadwell/me.c b/src/soc/intel/broadwell/me.c index 0461428..0021d2c 100644 --- a/src/soc/intel/broadwell/me.c +++ b/src/soc/intel/broadwell/me.c @@ -700,8 +700,7 @@ path = ME_ERROR_BIOS_PATH; }
-#if CONFIG(ELOG) - if (path != ME_NORMAL_BIOS_PATH) { + if (CONFIG(ELOG) && path != ME_NORMAL_BIOS_PATH) { struct elog_event_data_me_extended data = { .current_working_state = hfs.working_state, .operation_state = hfs.operation_state, @@ -715,7 +714,6 @@ elog_add_event_raw(ELOG_TYPE_MANAGEMENT_ENGINE_EXT, &data, sizeof(data)); } -#endif
return path; } diff --git a/src/southbridge/intel/bd82x6x/me.c b/src/southbridge/intel/bd82x6x/me.c index 62a2ed7..15f99cd 100644 --- a/src/southbridge/intel/bd82x6x/me.c +++ b/src/southbridge/intel/bd82x6x/me.c @@ -580,8 +580,7 @@ if (hfs.error_code || hfs.fpt_bad) path = ME_ERROR_BIOS_PATH;
-#if CONFIG(ELOG) - if (path != ME_NORMAL_BIOS_PATH) { + if (CONFIG(ELOG) && path != ME_NORMAL_BIOS_PATH) { struct elog_event_data_me_extended data = { .current_working_state = hfs.working_state, .operation_state = hfs.operation_state, @@ -595,7 +594,6 @@ elog_add_event_raw(ELOG_TYPE_MANAGEMENT_ENGINE_EXT, &data, sizeof(data)); } -#endif
return path; } diff --git a/src/southbridge/intel/bd82x6x/me_8.x.c b/src/southbridge/intel/bd82x6x/me_8.x.c index 3898787..f13ced9 100644 --- a/src/southbridge/intel/bd82x6x/me_8.x.c +++ b/src/southbridge/intel/bd82x6x/me_8.x.c @@ -568,8 +568,7 @@ path = ME_ERROR_BIOS_PATH; }
-#if CONFIG(ELOG) - if (path != ME_NORMAL_BIOS_PATH) { + if (CONFIG(ELOG) && path != ME_NORMAL_BIOS_PATH) { struct elog_event_data_me_extended data = { .current_working_state = hfs.working_state, .operation_state = hfs.operation_state, @@ -583,7 +582,6 @@ elog_add_event_raw(ELOG_TYPE_MANAGEMENT_ENGINE_EXT, &data, sizeof(data)); } -#endif
return path; } diff --git a/src/southbridge/intel/ibexpeak/lpc.c b/src/southbridge/intel/ibexpeak/lpc.c index 3657656..64be11e 100644 --- a/src/southbridge/intel/ibexpeak/lpc.c +++ b/src/southbridge/intel/ibexpeak/lpc.c @@ -286,9 +286,7 @@ if (rtc_failed) { reg8 &= ~RTC_BATTERY_DEAD; pci_write_config8(dev, GEN_PMCON_3, reg8); -#if CONFIG(ELOG) elog_add_event(ELOG_TYPE_RTC_RESET); -#endif } printk(BIOS_DEBUG, "rtc_failed = 0x%x\n", rtc_failed);
diff --git a/src/southbridge/intel/ibexpeak/me.c b/src/southbridge/intel/ibexpeak/me.c index 577bc91..63dff6a 100644 --- a/src/southbridge/intel/ibexpeak/me.c +++ b/src/southbridge/intel/ibexpeak/me.c @@ -465,8 +465,7 @@ if (hfs.error_code || hfs.fpt_bad) path = ME_ERROR_BIOS_PATH;
-#if CONFIG(ELOG) - if (path != ME_NORMAL_BIOS_PATH) { + if (CONFIG(ELOG) && path != ME_NORMAL_BIOS_PATH) { struct elog_event_data_me_extended data = { .current_working_state = hfs.working_state, .operation_state = hfs.operation_state, @@ -480,7 +479,6 @@ elog_add_event_raw(ELOG_TYPE_MANAGEMENT_ENGINE_EXT, &data, sizeof(data)); } -#endif
return path; } diff --git a/src/southbridge/intel/lynxpoint/me_9.x.c b/src/southbridge/intel/lynxpoint/me_9.x.c index 15b0932..2df03c9 100644 --- a/src/southbridge/intel/lynxpoint/me_9.x.c +++ b/src/southbridge/intel/lynxpoint/me_9.x.c @@ -716,8 +716,7 @@ path = ME_ERROR_BIOS_PATH; }
-#if CONFIG(ELOG) - if (path != ME_NORMAL_BIOS_PATH) { + if (CONFIG(ELOG) && path != ME_NORMAL_BIOS_PATH) { struct elog_event_data_me_extended data = { .current_working_state = hfs.working_state, .operation_state = hfs.operation_state, @@ -731,7 +730,6 @@ elog_add_event_raw(ELOG_TYPE_MANAGEMENT_ENGINE_EXT, &data, sizeof(data)); } -#endif
return path; } diff --git a/src/southbridge/intel/lynxpoint/smi.c b/src/southbridge/intel/lynxpoint/smi.c index 4fb00b5..e5c390e 100644 --- a/src/southbridge/intel/lynxpoint/smi.c +++ b/src/southbridge/intel/lynxpoint/smi.c @@ -29,10 +29,10 @@ { u32 smi_en;
-#if CONFIG(ELOG) /* Log events from chipset before clearing */ - pch_log_state(); -#endif + if (CONFIG(ELOG)) + pch_log_state(); + printk(BIOS_DEBUG, "Initializing Southbridge SMI..."); printk(BIOS_SPEW, " ... pmbase = 0x%04x\n", get_pmbase());
Aaron Durbin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36648 )
Change subject: ELOG: Avoid some preprocessor use ......................................................................
Patch Set 3: Code-Review+2
Kyösti Mälkki has submitted this change. ( https://review.coreboot.org/c/coreboot/+/36648 )
Change subject: ELOG: Avoid some preprocessor use ......................................................................
ELOG: Avoid some preprocessor use
Change-Id: I8daf8868af2e8c2b07b0dda0eeaf863f2f550c59 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/36648 Reviewed-by: Aaron Durbin adurbin@chromium.org Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/ec/quanta/ene_kb3940q/ec.c M src/soc/intel/broadwell/me.c M src/southbridge/intel/bd82x6x/me.c M src/southbridge/intel/bd82x6x/me_8.x.c M src/southbridge/intel/ibexpeak/lpc.c M src/southbridge/intel/ibexpeak/me.c M src/southbridge/intel/lynxpoint/me_9.x.c M src/southbridge/intel/lynxpoint/smi.c 8 files changed, 13 insertions(+), 25 deletions(-)
Approvals: build bot (Jenkins): Verified Aaron Durbin: Looks good to me, approved
diff --git a/src/ec/quanta/ene_kb3940q/ec.c b/src/ec/quanta/ene_kb3940q/ec.c index 4fc38da..5de6336 100644 --- a/src/ec/quanta/ene_kb3940q/ec.c +++ b/src/ec/quanta/ene_kb3940q/ec.c @@ -125,11 +125,11 @@
static void ene_kb3940q_log_events(void) { -#if CONFIG(ELOG) - u8 reason = ec_mem_read(EC_SHUTDOWN_REASON); - if (reason) - elog_add_event_byte(ELOG_TYPE_EC_SHUTDOWN, reason); -#endif + if (CONFIG(ELOG)) { + u8 reason = ec_mem_read(EC_SHUTDOWN_REASON); + if (reason) + elog_add_event_byte(ELOG_TYPE_EC_SHUTDOWN, reason); + } }
static void ene_kb3940q_init(struct device *dev) diff --git a/src/soc/intel/broadwell/me.c b/src/soc/intel/broadwell/me.c index 0461428..0021d2c 100644 --- a/src/soc/intel/broadwell/me.c +++ b/src/soc/intel/broadwell/me.c @@ -700,8 +700,7 @@ path = ME_ERROR_BIOS_PATH; }
-#if CONFIG(ELOG) - if (path != ME_NORMAL_BIOS_PATH) { + if (CONFIG(ELOG) && path != ME_NORMAL_BIOS_PATH) { struct elog_event_data_me_extended data = { .current_working_state = hfs.working_state, .operation_state = hfs.operation_state, @@ -715,7 +714,6 @@ elog_add_event_raw(ELOG_TYPE_MANAGEMENT_ENGINE_EXT, &data, sizeof(data)); } -#endif
return path; } diff --git a/src/southbridge/intel/bd82x6x/me.c b/src/southbridge/intel/bd82x6x/me.c index 5e355a1..8adb95b 100644 --- a/src/southbridge/intel/bd82x6x/me.c +++ b/src/southbridge/intel/bd82x6x/me.c @@ -585,8 +585,7 @@ if (hfs.error_code || hfs.fpt_bad) path = ME_ERROR_BIOS_PATH;
-#if CONFIG(ELOG) - if (path != ME_NORMAL_BIOS_PATH) { + if (CONFIG(ELOG) && path != ME_NORMAL_BIOS_PATH) { struct elog_event_data_me_extended data = { .current_working_state = hfs.working_state, .operation_state = hfs.operation_state, @@ -600,7 +599,6 @@ elog_add_event_raw(ELOG_TYPE_MANAGEMENT_ENGINE_EXT, &data, sizeof(data)); } -#endif
return path; } diff --git a/src/southbridge/intel/bd82x6x/me_8.x.c b/src/southbridge/intel/bd82x6x/me_8.x.c index c224cb4..7af9695 100644 --- a/src/southbridge/intel/bd82x6x/me_8.x.c +++ b/src/southbridge/intel/bd82x6x/me_8.x.c @@ -573,8 +573,7 @@ path = ME_ERROR_BIOS_PATH; }
-#if CONFIG(ELOG) - if (path != ME_NORMAL_BIOS_PATH) { + if (CONFIG(ELOG) && path != ME_NORMAL_BIOS_PATH) { struct elog_event_data_me_extended data = { .current_working_state = hfs.working_state, .operation_state = hfs.operation_state, @@ -588,7 +587,6 @@ elog_add_event_raw(ELOG_TYPE_MANAGEMENT_ENGINE_EXT, &data, sizeof(data)); } -#endif
return path; } diff --git a/src/southbridge/intel/ibexpeak/lpc.c b/src/southbridge/intel/ibexpeak/lpc.c index 3657656..64be11e 100644 --- a/src/southbridge/intel/ibexpeak/lpc.c +++ b/src/southbridge/intel/ibexpeak/lpc.c @@ -286,9 +286,7 @@ if (rtc_failed) { reg8 &= ~RTC_BATTERY_DEAD; pci_write_config8(dev, GEN_PMCON_3, reg8); -#if CONFIG(ELOG) elog_add_event(ELOG_TYPE_RTC_RESET); -#endif } printk(BIOS_DEBUG, "rtc_failed = 0x%x\n", rtc_failed);
diff --git a/src/southbridge/intel/ibexpeak/me.c b/src/southbridge/intel/ibexpeak/me.c index c944f63..6aa33ca 100644 --- a/src/southbridge/intel/ibexpeak/me.c +++ b/src/southbridge/intel/ibexpeak/me.c @@ -469,8 +469,7 @@ if (hfs.error_code || hfs.fpt_bad) path = ME_ERROR_BIOS_PATH;
-#if CONFIG(ELOG) - if (path != ME_NORMAL_BIOS_PATH) { + if (CONFIG(ELOG) && path != ME_NORMAL_BIOS_PATH) { struct elog_event_data_me_extended data = { .current_working_state = hfs.working_state, .operation_state = hfs.operation_state, @@ -484,7 +483,6 @@ elog_add_event_raw(ELOG_TYPE_MANAGEMENT_ENGINE_EXT, &data, sizeof(data)); } -#endif
return path; } diff --git a/src/southbridge/intel/lynxpoint/me_9.x.c b/src/southbridge/intel/lynxpoint/me_9.x.c index 1c45e2d..429fa42 100644 --- a/src/southbridge/intel/lynxpoint/me_9.x.c +++ b/src/southbridge/intel/lynxpoint/me_9.x.c @@ -718,8 +718,7 @@ path = ME_ERROR_BIOS_PATH; }
-#if CONFIG(ELOG) - if (path != ME_NORMAL_BIOS_PATH) { + if (CONFIG(ELOG) && path != ME_NORMAL_BIOS_PATH) { struct elog_event_data_me_extended data = { .current_working_state = hfs.working_state, .operation_state = hfs.operation_state, @@ -733,7 +732,6 @@ elog_add_event_raw(ELOG_TYPE_MANAGEMENT_ENGINE_EXT, &data, sizeof(data)); } -#endif
return path; } diff --git a/src/southbridge/intel/lynxpoint/smi.c b/src/southbridge/intel/lynxpoint/smi.c index 4fb00b5..e5c390e 100644 --- a/src/southbridge/intel/lynxpoint/smi.c +++ b/src/southbridge/intel/lynxpoint/smi.c @@ -29,10 +29,10 @@ { u32 smi_en;
-#if CONFIG(ELOG) /* Log events from chipset before clearing */ - pch_log_state(); -#endif + if (CONFIG(ELOG)) + pch_log_state(); + printk(BIOS_DEBUG, "Initializing Southbridge SMI..."); printk(BIOS_SPEW, " ... pmbase = 0x%04x\n", get_pmbase());