From 0065b6974fb311a1fa3448253f63e7d4cec0250e Mon Sep 17 00:00:00 2001 From: Thomas Heijligen Date: Thu, 10 Jan 2019 19:42:21 +0100 Subject: mb/emulation/qemu-i440fx: make fw_cfg_present usable in PRERAM Change-Id: I98f1c97e3ca33a12620cdd073c76fd4e271f1fcc Signed-off-by: Thomas Heijligen Reviewed-on: https://review.coreboot.org/c/30849 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Rudolph --- src/mainboard/emulation/qemu-i440fx/fw_cfg.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/mainboard') diff --git a/src/mainboard/emulation/qemu-i440fx/fw_cfg.c b/src/mainboard/emulation/qemu-i440fx/fw_cfg.c index c5d5a47008..6a9ef03867 100644 --- a/src/mainboard/emulation/qemu-i440fx/fw_cfg.c +++ b/src/mainboard/emulation/qemu-i440fx/fw_cfg.c @@ -25,20 +25,22 @@ #define FW_CFG_PORT_CTL 0x0510 #define FW_CFG_PORT_DATA 0x0511 -static unsigned char fw_cfg_detected = 0xff; +static int fw_cfg_detected; static int fw_cfg_present(void) { static const char qsig[] = "QEMU"; unsigned char sig[4]; + int detected = 0; - if (fw_cfg_detected == 0xff) { + if (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"); + fw_cfg_detected = detected + 1; } - return fw_cfg_detected; + return fw_cfg_detected - 1; } static void fw_cfg_select(uint16_t entry) -- cgit v1.2.3