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>
This commit is contained in:
parent
da9aa6ddd7
commit
0065b6974f
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue