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; }
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/30849 )
Change subject: mb/emulation/qemu-i440fx: use car for e820 ......................................................................
Patch Set 1:
(3 comments)
https://review.coreboot.org/#/c/30849/1/src/mainboard/emulation/qemu-i440fx/... File src/mainboard/emulation/qemu-i440fx/fw_cfg.c:
https://review.coreboot.org/#/c/30849/1/src/mainboard/emulation/qemu-i440fx/... PS1, Line 20: #include <arch/early_variables.h> not needed
https://review.coreboot.org/#/c/30849/1/src/mainboard/emulation/qemu-i440fx/... PS1, Line 29: static int fw_cfg_detected CAR_GLOBAL; no need for CAR_GLOBAL. To make it compile in romstage remove "= 0xff"
https://review.coreboot.org/#/c/30849/1/src/mainboard/emulation/qemu-i440fx/... PS1, Line 37: if (car_get_var(fw_cfg_detected) == 0) { no need for car_get_var or car_set_var
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/30849
to look at the new patch set (#3).
Change subject: mb/emulation/qemu-i440fx: make fw_cfg_present rom compatible ......................................................................
mb/emulation/qemu-i440fx: make fw_cfg_present rom compatible
Change-Id: I98f1c97e3ca33a12620cdd073c76fd4e271f1fcc Signed-off-by: Thomas Heijligen thomas.heijligen@secunet.com --- M src/mainboard/emulation/qemu-i440fx/fw_cfg.c 1 file changed, 7 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/49/30849/3
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/30849 )
Change subject: mb/emulation/qemu-i440fx: make fw_cfg_present rom compatible ......................................................................
Patch Set 3: Code-Review+1
(1 comment)
https://review.coreboot.org/#/c/30849/3//COMMIT_MSG Commit Message:
https://review.coreboot.org/#/c/30849/3//COMMIT_MSG@7 PS3, Line 7: mb/emulation/qemu-i440fx: make fw_cfg_present rom compatible "rom" refers to coreboot's romstage.
The change allows to use the code in every stage pre "ramstage", thus call it PRERAM (a common term in coreboot's Kconfig)
Hello Patrick Rudolph, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/30849
to look at the new patch set (#4).
Change subject: mb/emulation/qemu-i440fx: make fw_cfg_present rom compatible ......................................................................
mb/emulation/qemu-i440fx: make fw_cfg_present rom compatible
Change-Id: I98f1c97e3ca33a12620cdd073c76fd4e271f1fcc Signed-off-by: Thomas Heijligen thomas.heijligen@secunet.com --- M src/mainboard/emulation/qemu-i440fx/fw_cfg.c 1 file changed, 7 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/49/30849/4
Hello Patrick Rudolph, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/30849
to look at the new patch set (#5).
Change subject: mb/emulation/qemu-i440fx: make fw_cfg_present usable in PRERAM ......................................................................
mb/emulation/qemu-i440fx: make fw_cfg_present usable in PRERAM
Change-Id: I98f1c97e3ca33a12620cdd073c76fd4e271f1fcc Signed-off-by: Thomas Heijligen thomas.heijligen@secunet.com --- M src/mainboard/emulation/qemu-i440fx/fw_cfg.c 1 file changed, 7 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/49/30849/5
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/30849 )
Change subject: mb/emulation/qemu-i440fx: make fw_cfg_present usable in PRERAM ......................................................................
Patch Set 5: Code-Review+2
Nico Huber has submitted this change and it was merged. ( https://review.coreboot.org/c/coreboot/+/30849 )
Change subject: mb/emulation/qemu-i440fx: make fw_cfg_present usable in PRERAM ......................................................................
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 --- M src/mainboard/emulation/qemu-i440fx/fw_cfg.c 1 file changed, 7 insertions(+), 5 deletions(-)
Approvals: build bot (Jenkins): Verified Patrick Rudolph: Looks good to me, approved
diff --git a/src/mainboard/emulation/qemu-i440fx/fw_cfg.c b/src/mainboard/emulation/qemu-i440fx/fw_cfg.c index c5d5a47..6a9ef03 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)