Name of user not set #1002476 has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/35365 )
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read
- configure DMA fw_cfg - add support to read using fw_cfg_dma - provide fw config version id info in logs
Change-Id: I0be5355b124af40aba62c0840790d46ed0fe80a2 Signed-off-by: Himanshu Sahdev himanshusah@hcl.com --- M src/mainboard/emulation/qemu-i440fx/fw_cfg.c M src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h 2 files changed, 69 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/65/35365/1
diff --git a/src/mainboard/emulation/qemu-i440fx/fw_cfg.c b/src/mainboard/emulation/qemu-i440fx/fw_cfg.c index 3acb11e..330c6c0 100644 --- a/src/mainboard/emulation/qemu-i440fx/fw_cfg.c +++ b/src/mainboard/emulation/qemu-i440fx/fw_cfg.c @@ -24,13 +24,18 @@
#define FW_CFG_PORT_CTL 0x0510 #define FW_CFG_PORT_DATA 0x0511 +#define FW_CFG_DMA_ADDR_HIGH 0x0514 +#define FW_CFG_DMA_ADDR_LOW 0x0518
static int fw_cfg_detected; +static uint8_t fw_ver; + +static void fw_cfg_dma(int control, void *buf, int len);
static int fw_cfg_present(void) { static const char qsig[] = "QEMU"; - unsigned char sig[4]; + unsigned char sig[FW_CFG_SIG_SIZE]; int detected = 0;
if (fw_cfg_detected == 0) { @@ -38,6 +43,10 @@ detected = memcmp(sig, qsig, 4) == 0; printk(BIOS_INFO, "QEMU: firmware config interface %s\n", detected ? "detected" : "not found"); + if (detected) { + fw_cfg_get(FW_CFG_ID, &fw_ver, sizeof(fw_ver)); + printk(BIOS_INFO, "Firmware config version id: %d\n", fw_ver); + } fw_cfg_detected = detected + 1; } return fw_cfg_detected - 1; @@ -50,7 +59,10 @@
static void fw_cfg_read(void *dst, int dstlen) { - insb(FW_CFG_PORT_DATA, dst, dstlen); + if (fw_ver & FW_CFG_VERSION_DMA) + fw_cfg_dma(FW_CFG_DMA_CTL_READ, dst, dstlen); + else + insb(FW_CFG_PORT_DATA, dst, dstlen); }
void fw_cfg_get(uint16_t entry, void *dst, int dstlen) @@ -500,3 +512,22 @@ fw_cfg_smbios_init(); memcpy(uuid, type1_uuid, 16); } + +/* + * Configure DMA setup + */ + +static void fw_cfg_dma(int control, void *buf, int len) +{ + volatile FwCfgDmaAccess dma; + uint32_t dma_desc_addr; + + dma.control = be32_to_cpu(control); + dma.length = be32_to_cpu(len); + dma.address = be64_to_cpu((uintptr_t)buf); + + dma_desc_addr = (uint32_t)&dma; + outl(be32_to_cpu(dma_desc_addr), FW_CFG_DMA_ADDR_LOW); + while (be32_to_cpu(dma.control) & ~FW_CFG_DMA_CTL_ERROR) + asm(""); +} diff --git a/src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h b/src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h index 46aee9b3d..3590943 100644 --- a/src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h +++ b/src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h @@ -64,11 +64,24 @@
#define FW_CFG_INVALID 0xffff
+/* width in bytes of fw_cfg control register */ +#define FW_CFG_CTL_SIZE 0x02 + +/* fw_cfg "file name" is up to 56 characters (including terminating nul) */ +#define FW_CFG_MAX_FILE_PATH 56 + +/* size in bytes of fw_cfg signature */ +#define FW_CFG_SIG_SIZE 4 + +/* FW_CFG_ID bits */ +#define FW_CFG_VERSION 0x01 +#define FW_CFG_VERSION_DMA 0x02 + typedef struct FWCfgFile { uint32_t size; /* file size */ uint16_t select; /* write this to 0x510 to read it */ uint16_t reserved; - char name[56]; + char name[FW_CFG_MAX_FILE_PATH]; } FWCfgFile;
typedef struct FWCfgFiles { @@ -93,4 +106,26 @@ uint16_t fieldoffset; } FwCfgSmbios;
+/* FW_CFG_ID bits */ +#define FW_CFG_VERSION 0x01 +#define FW_CFG_VERSION_DMA 0x02 + +/* FW_CFG_DMA_CONTROL bits */ +#define FW_CFG_DMA_CTL_ERROR 0x01 +#define FW_CFG_DMA_CTL_READ 0x02 +#define FW_CFG_DMA_CTL_SKIP 0x04 +#define FW_CFG_DMA_CTL_SELECT 0x08 +#define FW_CFG_DMA_CTL_WRITE 0x10 + +#define FW_CFG_DMA_SIGNATURE 0x51454d5520434647ULL /* "QEMU CFG" */ + +/* Control as first field allows for different structures selected by this + * field, which might be useful in the future + */ +typedef struct FwCfgDmaAccess { + uint32_t control; + uint32_t length; + uint64_t address; +} FwCfgDmaAccess; + #endif /* FW_CFG_IF_H */
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35365 )
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35365/1/src/mainboard/emulation/qem... File src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h:
https://review.coreboot.org/c/coreboot/+/35365/1/src/mainboard/emulation/qem... PS1, Line 84: char name[FW_CFG_MAX_FILE_PATH]; please, no spaces at the start of a line
Hello Patrick Rudolph, build bot (Jenkins), Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35365
to look at the new patch set (#2).
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read
- configure DMA fw_cfg - add support to read using fw_cfg_dma - provide fw config version id info in logs
BUG=N/A TEST=Build and boot using qemu-i440fx.
Change-Id: I0be5355b124af40aba62c0840790d46ed0fe80a2 Signed-off-by: Himanshu Sahdev himanshusah@hcl.com --- M src/mainboard/emulation/qemu-i440fx/fw_cfg.c M src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h 2 files changed, 69 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/65/35365/2
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35365 )
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
Patch Set 2:
(2 comments)
https://review.coreboot.org/c/coreboot/+/35365/2/src/mainboard/emulation/qem... File src/mainboard/emulation/qemu-i440fx/fw_cfg.c:
https://review.coreboot.org/c/coreboot/+/35365/2/src/mainboard/emulation/qem... PS2, Line 529: dma_desc_addr = (uint32_t)&dma; that doesn't work on x86_64. Please write FW_CFG_DMA_ADDR_HIGH as well.
https://review.coreboot.org/c/coreboot/+/35365/2/src/mainboard/emulation/qem... PS2, Line 532: asm(""); should work without asm("").
Hello Patrick Rudolph, build bot (Jenkins), Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35365
to look at the new patch set (#3).
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read
- configure DMA fw_cfg - add support to read using fw_cfg_dma - provide fw config version id info in logs
Change-Id: I0be5355b124af40aba62c0840790d46ed0fe80a2 Signed-off-by: Himanshu Sahdev himanshusah@hcl.com --- M src/mainboard/emulation/qemu-i440fx/fw_cfg.c M src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h 2 files changed, 76 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/65/35365/3
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35365 )
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
Patch Set 3:
(4 comments)
https://review.coreboot.org/c/coreboot/+/35365/3/src/mainboard/emulation/qem... File src/mainboard/emulation/qemu-i440fx/fw_cfg.c:
https://review.coreboot.org/c/coreboot/+/35365/3/src/mainboard/emulation/qem... PS3, Line 532: dma_desc_addr_hi = sizeof(uintptr_t) > sizeof(uint32_t) ? (uint32_t)(dma_desc_addr >> 32) : 0; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35365/3/src/mainboard/emulation/qem... PS3, Line 538: trailing whitespace
https://review.coreboot.org/c/coreboot/+/35365/3/src/mainboard/emulation/qem... PS3, Line 539: while (be32_to_cpu(dma.control) & ~FW_CFG_DMA_CTL_ERROR); trailing statements should be on next line
https://review.coreboot.org/c/coreboot/+/35365/3/src/mainboard/emulation/qem... File src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h:
https://review.coreboot.org/c/coreboot/+/35365/3/src/mainboard/emulation/qem... PS3, Line 84: char name[FW_CFG_MAX_FILE_PATH]; please, no spaces at the start of a line
Hello Patrick Rudolph, build bot (Jenkins), Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35365
to look at the new patch set (#4).
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read
- configure DMA fw_cfg - add support to read using fw_cfg_dma - provide fw config version id info in logs
Change-Id: I0be5355b124af40aba62c0840790d46ed0fe80a2 Signed-off-by: Himanshu Sahdev himanshusah@hcl.com --- M src/mainboard/emulation/qemu-i440fx/fw_cfg.c M src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h 2 files changed, 77 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/65/35365/4
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35365 )
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
Patch Set 4:
(5 comments)
https://review.coreboot.org/c/coreboot/+/35365/4/src/mainboard/emulation/qem... File src/mainboard/emulation/qemu-i440fx/fw_cfg.c:
https://review.coreboot.org/c/coreboot/+/35365/4/src/mainboard/emulation/qem... PS4, Line 533: ? (uint32_t)(dma_desc_addr >> 32) : 0; code indent should use tabs where possible
https://review.coreboot.org/c/coreboot/+/35365/4/src/mainboard/emulation/qem... PS4, Line 533: ? (uint32_t)(dma_desc_addr >> 32) : 0; please, no space before tabs
https://review.coreboot.org/c/coreboot/+/35365/4/src/mainboard/emulation/qem... PS4, Line 533: ? (uint32_t)(dma_desc_addr >> 32) : 0; please, no spaces at the start of a line
https://review.coreboot.org/c/coreboot/+/35365/4/src/mainboard/emulation/qem... PS4, Line 540: while (be32_to_cpu(dma.control) & ~FW_CFG_DMA_CTL_ERROR); trailing statements should be on next line
https://review.coreboot.org/c/coreboot/+/35365/4/src/mainboard/emulation/qem... File src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h:
https://review.coreboot.org/c/coreboot/+/35365/4/src/mainboard/emulation/qem... PS4, Line 84: char name[FW_CFG_MAX_FILE_PATH]; please, no spaces at the start of a line
Name of user not set #1002476 has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35365 )
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
Patch Set 4:
(6 comments)
https://review.coreboot.org/c/coreboot/+/35365/2/src/mainboard/emulation/qem... File src/mainboard/emulation/qemu-i440fx/fw_cfg.c:
https://review.coreboot.org/c/coreboot/+/35365/2/src/mainboard/emulation/qem... PS2, Line 529: dma_desc_addr = (uint32_t)&dma;
that doesn't work on x86_64. Please write FW_CFG_DMA_ADDR_HIGH as well.
Done
https://review.coreboot.org/c/coreboot/+/35365/2/src/mainboard/emulation/qem... PS2, Line 532: asm("");
should work without asm("").
Done
https://review.coreboot.org/c/coreboot/+/35365/3/src/mainboard/emulation/qem... File src/mainboard/emulation/qemu-i440fx/fw_cfg.c:
https://review.coreboot.org/c/coreboot/+/35365/3/src/mainboard/emulation/qem... PS3, Line 532: dma_desc_addr_hi = sizeof(uintptr_t) > sizeof(uint32_t) ? (uint32_t)(dma_desc_addr >> 32) : 0;
line over 96 characters
Done
https://review.coreboot.org/c/coreboot/+/35365/3/src/mainboard/emulation/qem... PS3, Line 538:
trailing whitespace
Done
https://review.coreboot.org/c/coreboot/+/35365/3/src/mainboard/emulation/qem... PS3, Line 539: while (be32_to_cpu(dma.control) & ~FW_CFG_DMA_CTL_ERROR);
trailing statements should be on next line
Ack
https://review.coreboot.org/c/coreboot/+/35365/3/src/mainboard/emulation/qem... File src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h:
https://review.coreboot.org/c/coreboot/+/35365/3/src/mainboard/emulation/qem... PS3, Line 84: char name[FW_CFG_MAX_FILE_PATH];
please, no spaces at the start of a line
Done
Hello Patrick Rudolph, build bot (Jenkins), Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35365
to look at the new patch set (#5).
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read
- configure DMA fw_cfg - add support to read using fw_cfg_dma - provide fw config version id info in logs
Change-Id: I0be5355b124af40aba62c0840790d46ed0fe80a2 Signed-off-by: Himanshu Sahdev himanshusah@hcl.com --- M src/mainboard/emulation/qemu-i440fx/fw_cfg.c M src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h 2 files changed, 78 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/65/35365/5
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35365 )
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
Patch Set 5:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35365/5/src/mainboard/emulation/qem... File src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h:
https://review.coreboot.org/c/coreboot/+/35365/5/src/mainboard/emulation/qem... PS5, Line 84: char name[FW_CFG_MAX_FILE_PATH]; please, no spaces at the start of a line
Name of user not set #1002476 has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35365 )
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
Patch Set 5:
Patch Set 2:
(2 comments)
It's done!
Idwer Vollering has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35365 )
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
Patch Set 5: Code-Review-1
(1 comment)
https://review.coreboot.org/c/coreboot/+/35365/5/src/mainboard/emulation/qem... File src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h:
https://review.coreboot.org/c/coreboot/+/35365/5/src/mainboard/emulation/qem... PS5, Line 111: #define FW_CFG_VERSION_DMA 0x02 These lines are already being added.
Name of user not set #1002476 has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35365 )
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
Patch Set 5:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35365/5/src/mainboard/emulation/qem... File src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h:
https://review.coreboot.org/c/coreboot/+/35365/5/src/mainboard/emulation/qem... PS5, Line 111: #define FW_CFG_VERSION_DMA 0x02
These lines are already being added.
My bad, typo. Thanks for pointing out! Ack
Hello Patrick Rudolph, Idwer Vollering, build bot (Jenkins), Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35365
to look at the new patch set (#6).
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read
- configure DMA fw_cfg - add support to read using fw_cfg_dma - provide fw config version id info in logs
Change-Id: I0be5355b124af40aba62c0840790d46ed0fe80a2 Signed-off-by: Himanshu Sahdev himanshusah@hcl.com --- M src/mainboard/emulation/qemu-i440fx/fw_cfg.c M src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h 2 files changed, 74 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/65/35365/6
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35365 )
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
Patch Set 6:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35365/6/src/mainboard/emulation/qem... File src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h:
https://review.coreboot.org/c/coreboot/+/35365/6/src/mainboard/emulation/qem... PS6, Line 80: char name[FW_CFG_MAX_FILE_PATH]; please, no spaces at the start of a line
Hello Patrick Rudolph, Idwer Vollering, build bot (Jenkins), Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35365
to look at the new patch set (#7).
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read
- configure DMA fw_cfg - add support to read using fw_cfg_dma - provide fw config version id info in logs
BUG=N/A TEST=Build and boot using qemu-i440fx.
Change-Id: I0be5355b124af40aba62c0840790d46ed0fe80a2 Signed-off-by: Himanshu Sahdev himanshusah@hcl.com --- M src/mainboard/emulation/qemu-i440fx/fw_cfg.c M src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h 2 files changed, 74 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/65/35365/7
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35365 )
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
Patch Set 8:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35365/8/src/mainboard/emulation/qem... File src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h:
https://review.coreboot.org/c/coreboot/+/35365/8/src/mainboard/emulation/qem... PS8, Line 80: char name[FW_CFG_MAX_FILE_PATH]; please, no spaces at the start of a line
Hello Patrick Rudolph, Idwer Vollering, build bot (Jenkins), Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35365
to look at the new patch set (#9).
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read
- configure DMA fw_cfg - add support to read using fw_cfg_dma - provide fw config version id info in logs
BUG=N/A TEST=Build and boot using qemu-i440fx.
Change-Id: I0be5355b124af40aba62c0840790d46ed0fe80a2 Signed-off-by: Himanshu Sahdev himanshusah@hcl.com --- M src/mainboard/emulation/qemu-i440fx/fw_cfg.c M src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h 2 files changed, 74 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/65/35365/9
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35365 )
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
Patch Set 9:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35365/9/src/mainboard/emulation/qem... File src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h:
https://review.coreboot.org/c/coreboot/+/35365/9/src/mainboard/emulation/qem... PS9, Line 80: char name[FW_CFG_MAX_FILE_PATH]; please, no spaces at the start of a line
Gerd Hoffmann has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35365 )
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
Patch Set 9: Code-Review+2
Thomas Heijligen has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35365 )
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
Patch Set 9:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35365/9/src/mainboard/emulation/qem... File src/mainboard/emulation/qemu-i440fx/fw_cfg.c:
https://review.coreboot.org/c/coreboot/+/35365/9/src/mainboard/emulation/qem... PS9, Line 43: 4 When introducing FW_CFG_SIG_SIZE, use it also here
Hello Patrick Rudolph, Gerd Hoffmann, Idwer Vollering, Thomas Heijligen, build bot (Jenkins), Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35365
to look at the new patch set (#10).
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read
- configure DMA fw_cfg - add support to read using fw_cfg_dma - provide fw config version id info in logs
BUG=N/A TEST=Build and boot using qemu-i440fx.
Change-Id: I0be5355b124af40aba62c0840790d46ed0fe80a2 Signed-off-by: Himanshu Sahdev himanshusah@hcl.com --- M src/mainboard/emulation/qemu-i440fx/fw_cfg.c M src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h 2 files changed, 75 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/65/35365/10
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35365 )
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
Patch Set 10:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35365/10/src/mainboard/emulation/qe... File src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h:
https://review.coreboot.org/c/coreboot/+/35365/10/src/mainboard/emulation/qe... PS10, Line 80: char name[FW_CFG_MAX_FILE_PATH]; please, no spaces at the start of a line
Name of user not set #1002476 has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35365 )
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
Patch Set 10:
(1 comment)
Patch Set 9:
(1 comment)
Thanks!
https://review.coreboot.org/c/coreboot/+/35365/9/src/mainboard/emulation/qem... File src/mainboard/emulation/qemu-i440fx/fw_cfg.c:
https://review.coreboot.org/c/coreboot/+/35365/9/src/mainboard/emulation/qem... PS9, Line 43: 4
When introducing FW_CFG_SIG_SIZE, use it also here
Done
Name of user not set #1002476 has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35365 )
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
Patch Set 10:
Patch Set 10: This patch set is created with Patch set 9 as exact base with a minor replacement in Line 43 (fw_cfg.c) with macro FW_CFG_SIG_SIZE
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35365 )
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
Patch Set 10:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35365/10/src/mainboard/emulation/qe... File src/mainboard/emulation/qemu-i440fx/fw_cfg.c:
https://review.coreboot.org/c/coreboot/+/35365/10/src/mainboard/emulation/qe... PS10, Line 529: Add a debug/spew message what values are set?
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35365 )
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
Patch Set 10:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35365/10//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/35365/10//COMMIT_MSG@14 PS10, Line 14: TEST=Build and boot using qemu-i440fx. What options did you use?
Name of user not set #1002476 has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35365 )
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
Patch Set 10:
(2 comments)
https://review.coreboot.org/c/coreboot/+/35365/10//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/35365/10//COMMIT_MSG@14 PS10, Line 14: TEST=Build and boot using qemu-i440fx.
What options did you use?
Normal build process for the target qemu-i440fx along with some debug messages are only required for the test success/failure detection. I have verified for its successful execution and calling the fw_cfg_dma (read using dma)
https://review.coreboot.org/c/coreboot/+/35365/10/src/mainboard/emulation/qe... File src/mainboard/emulation/qemu-i440fx/fw_cfg.c:
https://review.coreboot.org/c/coreboot/+/35365/10/src/mainboard/emulation/qe... PS10, Line 529:
Add a debug/spew message what values are set?
IMHO, the debug/spew messages are not required here as all parameters are parsed to this function as input. Can be referred to the insb function as well, I think provide printing of parameters to every read command is not good idea.
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35365 )
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
Patch Set 10: Code-Review+2
Tested on qemu.
Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/35365 )
Change subject: emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read ......................................................................
emulation/qemu-i440fx: use fw_cfg_dma for fw_cfg_read
- configure DMA fw_cfg - add support to read using fw_cfg_dma - provide fw config version id info in logs
BUG=N/A TEST=Build and boot using qemu-i440fx.
Change-Id: I0be5355b124af40aba62c0840790d46ed0fe80a2 Signed-off-by: Himanshu Sahdev himanshusah@hcl.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/35365 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 M src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h 2 files changed, 75 insertions(+), 4 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 3acb11e..580e09a 100644 --- a/src/mainboard/emulation/qemu-i440fx/fw_cfg.c +++ b/src/mainboard/emulation/qemu-i440fx/fw_cfg.c @@ -24,20 +24,29 @@
#define FW_CFG_PORT_CTL 0x0510 #define FW_CFG_PORT_DATA 0x0511 +#define FW_CFG_DMA_ADDR_HIGH 0x0514 +#define FW_CFG_DMA_ADDR_LOW 0x0518
static int fw_cfg_detected; +static uint8_t fw_ver; + +static void fw_cfg_dma(int control, void *buf, int len);
static int fw_cfg_present(void) { static const char qsig[] = "QEMU"; - unsigned char sig[4]; + unsigned char sig[FW_CFG_SIG_SIZE]; int detected = 0;
if (fw_cfg_detected == 0) { fw_cfg_get(FW_CFG_SIGNATURE, sig, sizeof(sig)); - detected = memcmp(sig, qsig, 4) == 0; + detected = memcmp(sig, qsig, FW_CFG_SIG_SIZE) == 0; printk(BIOS_INFO, "QEMU: firmware config interface %s\n", detected ? "detected" : "not found"); + if (detected) { + fw_cfg_get(FW_CFG_ID, &fw_ver, sizeof(fw_ver)); + printk(BIOS_INFO, "Firmware config version id: %d\n", fw_ver); + } fw_cfg_detected = detected + 1; } return fw_cfg_detected - 1; @@ -50,7 +59,10 @@
static void fw_cfg_read(void *dst, int dstlen) { - insb(FW_CFG_PORT_DATA, dst, dstlen); + if (fw_ver & FW_CFG_VERSION_DMA) + fw_cfg_dma(FW_CFG_DMA_CTL_READ, dst, dstlen); + else + insb(FW_CFG_PORT_DATA, dst, dstlen); }
void fw_cfg_get(uint16_t entry, void *dst, int dstlen) @@ -500,3 +512,31 @@ fw_cfg_smbios_init(); memcpy(uuid, type1_uuid, 16); } + +/* + * Configure DMA setup + */ + +static void fw_cfg_dma(int control, void *buf, int len) +{ + volatile FwCfgDmaAccess dma; + uintptr_t dma_desc_addr; + uint32_t dma_desc_addr_hi, dma_desc_addr_lo; + + dma.control = be32_to_cpu(control); + dma.length = be32_to_cpu(len); + dma.address = be64_to_cpu((uintptr_t)buf); + + dma_desc_addr = (uintptr_t)&dma; + dma_desc_addr_lo = (uint32_t)(dma_desc_addr & 0xFFFFFFFFU); + dma_desc_addr_hi = sizeof(uintptr_t) > sizeof(uint32_t) + ? (uint32_t)(dma_desc_addr >> 32) : 0; + + // Skip writing high half if unnecessary. + if (dma_desc_addr_hi) + outl(be32_to_cpu(dma_desc_addr_hi), FW_CFG_DMA_ADDR_HIGH); + outl(be32_to_cpu(dma_desc_addr_lo), FW_CFG_DMA_ADDR_LOW); + + while (be32_to_cpu(dma.control) & ~FW_CFG_DMA_CTL_ERROR) + ; +} diff --git a/src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h b/src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h index de67f02..dad6ca9 100644 --- a/src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h +++ b/src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h @@ -67,11 +67,20 @@
#define FW_CFG_INVALID 0xffff
+/* width in bytes of fw_cfg control register */ +#define FW_CFG_CTL_SIZE 0x02 + +/* fw_cfg "file name" is up to 56 characters (including terminating nul) */ +#define FW_CFG_MAX_FILE_PATH 56 + +/* size in bytes of fw_cfg signature */ +#define FW_CFG_SIG_SIZE 4 + typedef struct FWCfgFile { uint32_t size; /* file size */ uint16_t select; /* write this to 0x510 to read it */ uint16_t reserved; - char name[56]; + char name[FW_CFG_MAX_FILE_PATH]; } FWCfgFile;
typedef struct FWCfgFiles { @@ -96,4 +105,26 @@ uint16_t fieldoffset; } FwCfgSmbios;
+/* FW_CFG_ID bits */ +#define FW_CFG_VERSION 0x01 +#define FW_CFG_VERSION_DMA 0x02 + +/* FW_CFG_DMA_CONTROL bits */ +#define FW_CFG_DMA_CTL_ERROR 0x01 +#define FW_CFG_DMA_CTL_READ 0x02 +#define FW_CFG_DMA_CTL_SKIP 0x04 +#define FW_CFG_DMA_CTL_SELECT 0x08 +#define FW_CFG_DMA_CTL_WRITE 0x10 + +#define FW_CFG_DMA_SIGNATURE 0x51454d5520434647ULL /* "QEMU CFG" */ + +/* Control as first field allows for different structures selected by this + * field, which might be useful in the future + */ +typedef struct FwCfgDmaAccess { + uint32_t control; + uint32_t length; + uint64_t address; +} FwCfgDmaAccess; + #endif /* FW_CFG_IF_H */