summaryrefslogtreecommitdiff
path: root/src/mainboard
diff options
context:
space:
mode:
authorThomas Heijligen <thomas.heijligen@secunet.com>2019-01-10 19:42:21 +0100
committerNico Huber <nico.h@gmx.de>2019-02-05 11:01:22 +0000
commit0065b6974fb311a1fa3448253f63e7d4cec0250e (patch)
tree4727f08f6498b60b2d631d400538928402ef34ae /src/mainboard
parentda9aa6ddd78dc61bfc34dd85996f45b2f07e22c6 (diff)
downloadcoreboot-0065b6974fb311a1fa3448253f63e7d4cec0250e.tar.xz
mb/emulation/qemu-i440fx: make fw_cfg_present usable in PRERAM
Change-Id: I98f1c97e3ca33a12620cdd073c76fd4e271f1fcc Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/30849 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Diffstat (limited to 'src/mainboard')
-rw-r--r--src/mainboard/emulation/qemu-i440fx/fw_cfg.c12
1 files changed, 7 insertions, 5 deletions
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)