mb/scaleway/tagada: Remove use of car_get_var()

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 <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/35085
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Kyösti Mälkki 2019-08-18 22:10:51 +03:00
parent ec88c5c688
commit 2f944f4da4
1 changed files with 10 additions and 19 deletions

View File

@ -16,7 +16,6 @@
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <arch/early_variables.h>
#include <console/console.h> #include <console/console.h>
#include <console/uart.h> #include <console/uart.h>
@ -52,15 +51,12 @@ enum biosBmcInfoValidFlag_e {
BMCINFO_VALID_NEED_WARN, BMCINFO_VALID_NEED_WARN,
BMCINFO_VALID, BMCINFO_VALID,
}; };
static enum biosBmcInfoValidFlag_e CAR_GLOBAL biosBmcInfoValidFlag;
static bool bmcinfo_is_valid(size_t minsize) static bool bmcinfo_is_valid(size_t minsize)
{ {
static enum biosBmcInfoValidFlag_e biosBmcInfoValidFlag;
const biosBmcInfo_t *bmc_info = BMC_INFO; const biosBmcInfo_t *bmc_info = BMC_INFO;
int flag = car_get_var(biosBmcInfoValidFlag); if (biosBmcInfoValidFlag == BMCINFO_UNTESTED) {
if (flag == BMCINFO_UNTESTED) { biosBmcInfoValidFlag = BMCINFO_INVALID;
flag = BMCINFO_INVALID;
if ((bmc_info->magic0 == BIOSBMCINFO_MAGIC0) if ((bmc_info->magic0 == BIOSBMCINFO_MAGIC0)
&& (bmc_info->magic1 == BIOSBMCINFO_MAGIC1) && (bmc_info->magic1 == BIOSBMCINFO_MAGIC1)
&& (bmc_info->length >= offsetof(biosBmcInfo_t, hwRev)) && (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->chksum == chksum) {
if (bmc_info->length >= offsetof(biosBmcInfo_t, if (bmc_info->length >= offsetof(biosBmcInfo_t,
endMarker)) endMarker))
flag = BMCINFO_VALID; biosBmcInfoValidFlag = BMCINFO_VALID;
else else
flag = BMCINFO_VALID_NEED_WARN; biosBmcInfoValidFlag = BMCINFO_VALID_NEED_WARN;
} }
} }
car_set_var(biosBmcInfoValidFlag, flag);
} }
#if !defined(__PRE_RAM__) if (ENV_RAMSTAGE && biosBmcInfoValidFlag == BMCINFO_INVALID) {
if (flag == BMCINFO_INVALID) {
int length = offsetof(biosBmcInfo_t, endMarker); int length = offsetof(biosBmcInfo_t, endMarker);
printk(BIOS_CRIT, "WARNING bmcInfo struct" printk(BIOS_CRIT, "WARNING bmcInfo struct"
"is not available please update your BMC.\n"); "is not available please update your BMC.\n");
flag = BMCINFO_INVALID_WARNED; biosBmcInfoValidFlag = BMCINFO_INVALID_WARNED;
car_set_var(biosBmcInfoValidFlag, flag);
printk(BIOS_CRIT, "bmcInfo magic = \"%x-%x\"\n", printk(BIOS_CRIT, "bmcInfo magic = \"%x-%x\"\n",
bmc_info->magic0, bmc_info->magic1); bmc_info->magic0, bmc_info->magic1);
printk(BIOS_CRIT, "bmcInfo length = %d expected = %d\"\n", 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", printk(BIOS_CRIT, "bmcInfo chksum = 0x%x expected = 0x%x\"\n",
bmc_info->chksum, chksum); bmc_info->chksum, chksum);
} }
if (flag == BMCINFO_VALID_NEED_WARN) { if (ENV_RAMSTAGE && biosBmcInfoValidFlag == BMCINFO_VALID_NEED_WARN) {
printk(BIOS_CRIT, "WARNING bmcInfo struct" printk(BIOS_CRIT, "WARNING bmcInfo struct"
" is incomplete please update your BMC.\n"); " is incomplete please update your BMC.\n");
flag = BMCINFO_VALID; biosBmcInfoValidFlag = BMCINFO_VALID;
car_set_var(biosBmcInfoValidFlag, flag);
} }
#endif if (biosBmcInfoValidFlag < BMCINFO_VALID_NEED_WARN)
if (flag < BMCINFO_VALID_NEED_WARN)
return false; return false;
return (bmc_info->length >= minsize); return (bmc_info->length >= minsize);
} }