From 2f944f4da402ac79ec66529f3d771b6cb1e056df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Sun, 18 Aug 2019 22:10:51 +0300 Subject: mb/scaleway/tagada: Remove use of car_get_var() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Board has CAR_GLOBAL_MIGRATION=n and can use .bss for a variable that was previously declared with CAR_GLOBAL. Test for !defined(__PRE_RAM__) can be transformed into ENV_RAMSTAGE here as the warnings about invalid bmcinfo structure do not need to be repeated in SMM console, which is generally disabled anyways due to DEBUG_SMI=n. Change-Id: I6b63213484107fa0eeb0d952d8766916b44a3c4e Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/coreboot/+/35085 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons --- src/mainboard/scaleway/tagada/bmcinfo.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/mainboard/scaleway/tagada/bmcinfo.c b/src/mainboard/scaleway/tagada/bmcinfo.c index 237d551b59..93b45397ea 100644 --- a/src/mainboard/scaleway/tagada/bmcinfo.c +++ b/src/mainboard/scaleway/tagada/bmcinfo.c @@ -16,7 +16,6 @@ #include #include -#include #include #include @@ -52,15 +51,12 @@ enum biosBmcInfoValidFlag_e { BMCINFO_VALID_NEED_WARN, BMCINFO_VALID, }; - -static enum biosBmcInfoValidFlag_e CAR_GLOBAL biosBmcInfoValidFlag; - static bool bmcinfo_is_valid(size_t minsize) { + static enum biosBmcInfoValidFlag_e biosBmcInfoValidFlag; const biosBmcInfo_t *bmc_info = BMC_INFO; - int flag = car_get_var(biosBmcInfoValidFlag); - if (flag == BMCINFO_UNTESTED) { - flag = BMCINFO_INVALID; + if (biosBmcInfoValidFlag == BMCINFO_UNTESTED) { + biosBmcInfoValidFlag = BMCINFO_INVALID; if ((bmc_info->magic0 == BIOSBMCINFO_MAGIC0) && (bmc_info->magic1 == BIOSBMCINFO_MAGIC1) && (bmc_info->length >= offsetof(biosBmcInfo_t, hwRev)) @@ -73,20 +69,17 @@ static bool bmcinfo_is_valid(size_t minsize) if (bmc_info->chksum == chksum) { if (bmc_info->length >= offsetof(biosBmcInfo_t, endMarker)) - flag = BMCINFO_VALID; + biosBmcInfoValidFlag = BMCINFO_VALID; else - flag = BMCINFO_VALID_NEED_WARN; + biosBmcInfoValidFlag = BMCINFO_VALID_NEED_WARN; } } - car_set_var(biosBmcInfoValidFlag, flag); } -#if !defined(__PRE_RAM__) - if (flag == BMCINFO_INVALID) { + if (ENV_RAMSTAGE && biosBmcInfoValidFlag == BMCINFO_INVALID) { int length = offsetof(biosBmcInfo_t, endMarker); printk(BIOS_CRIT, "WARNING bmcInfo struct" "is not available please update your BMC.\n"); - flag = BMCINFO_INVALID_WARNED; - car_set_var(biosBmcInfoValidFlag, flag); + biosBmcInfoValidFlag = BMCINFO_INVALID_WARNED; printk(BIOS_CRIT, "bmcInfo magic = \"%x-%x\"\n", bmc_info->magic0, bmc_info->magic1); printk(BIOS_CRIT, "bmcInfo length = %d expected = %d\"\n", @@ -99,15 +92,13 @@ static bool bmcinfo_is_valid(size_t minsize) printk(BIOS_CRIT, "bmcInfo chksum = 0x%x expected = 0x%x\"\n", bmc_info->chksum, chksum); } - if (flag == BMCINFO_VALID_NEED_WARN) { + if (ENV_RAMSTAGE && biosBmcInfoValidFlag == BMCINFO_VALID_NEED_WARN) { printk(BIOS_CRIT, "WARNING bmcInfo struct" " is incomplete please update your BMC.\n"); - flag = BMCINFO_VALID; - car_set_var(biosBmcInfoValidFlag, flag); + biosBmcInfoValidFlag = BMCINFO_VALID; } -#endif - if (flag < BMCINFO_VALID_NEED_WARN) + if (biosBmcInfoValidFlag < BMCINFO_VALID_NEED_WARN) return false; return (bmc_info->length >= minsize); } -- cgit v1.2.3