Thomas Heijligen has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/30849
Change subject: mb/emulation/qemu-i440fx: use car for e820 ......................................................................
mb/emulation/qemu-i440fx: use car for e820
Use cache as ram to store e820 table size and read index
Change-Id: I98f1c97e3ca33a12620cdd073c76fd4e271f1fcc Signed-off-by: Thomas Heijligen thomas.heijligen@secunet.com --- M src/mainboard/emulation/qemu-i440fx/fw_cfg.c 1 file changed, 13 insertions(+), 10 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/49/30849/1
diff --git a/src/mainboard/emulation/qemu-i440fx/fw_cfg.c b/src/mainboard/emulation/qemu-i440fx/fw_cfg.c index 1890e66..e261bba 100644 --- a/src/mainboard/emulation/qemu-i440fx/fw_cfg.c +++ b/src/mainboard/emulation/qemu-i440fx/fw_cfg.c @@ -17,6 +17,7 @@ #include <console/console.h> #include <arch/io.h> #include <arch/acpigen.h> +#include <arch/early_variables.h> #include <commonlib/endian.h>
#include "fw_cfg.h" @@ -25,21 +26,22 @@ #define FW_CFG_PORT_CTL 0x0510 #define FW_CFG_PORT_DATA 0x0511
-static unsigned char fw_cfg_detected = 0xff; -//static FWCfgFiles *fw_files; +static int fw_cfg_detected CAR_GLOBAL;
static int fw_cfg_present(void) { static const char qsig[] = "QEMU"; unsigned char sig[4]; + int detected = 0;
- if (fw_cfg_detected == 0xff) { + if (car_get_var(fw_cfg_detected) == 0) { fw_cfg_get(FW_CFG_SIGNATURE, sig, sizeof(sig)); - fw_cfg_detected = (memcmp(sig, qsig, 4) == 0) ? 1 : 0; + detected = memcmp(sig, qsig, 4) == 0; printk(BIOS_INFO, "QEMU: firmware config interface %s\n", - fw_cfg_detected ? "detected" : "not found"); + detected ? "detected" : "not found"); + car_set_var(fw_cfg_detected, detected + 1); } - return fw_cfg_detected; + return car_get_var(fw_cfg_detected) - 1; }
static void fw_cfg_select(int entry) @@ -83,8 +85,8 @@ return fw_cfg_find_file(file, name); }
-static uint32_t fw_cfg_e820_size; -static uint32_t fw_cfg_e820_pos; +static uint32_t fw_cfg_e820_size CAR_GLOBAL; +static uint32_t fw_cfg_e820_pos CAR_GLOBAL;
int fw_cfg_e820_select(void) { @@ -99,11 +101,12 @@
int fw_cfg_e820_read(FwCfgE820Entry *entry) { - if (fw_cfg_e820_pos + sizeof(*entry) > fw_cfg_e820_size) + if (car_get_var(fw_cfg_e820_pos) + sizeof(*entry) + > car_get_var(fw_cfg_e820_size)) return -1;
fw_cfg_read(entry, sizeof(*entry)); - fw_cfg_e820_pos += sizeof(*entry); + car_get_var(fw_cfg_e820_pos) += sizeof(*entry); return 0; }