Stefan Reinauer has uploaded this change for review. ( https://review.coreboot.org/c/em100/+/36938 )
Change subject: Firmware update support for EM100Pro-G2 ......................................................................
Firmware update support for EM100Pro-G2
Teach em100 tool about EM100Pro-G2 firmware and check that the firmware is for the correct device.
Change-Id: I04c60f8fbe9a93048740549aa57d6d85a5db8107 Signed-off-by: Stefan Reinauer stefan.reinauer@coreboot.org --- M firmware.c 1 file changed, 24 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/em100 refs/changes/38/36938/1
diff --git a/firmware.c b/firmware.c index 6e2ff36..94cd8b1 100644 --- a/firmware.c +++ b/firmware.c @@ -129,6 +129,9 @@ case HWVERSION_EM100PRO: hdrversion=1; break; + case HWVERSION_EM100PRO_G2: + hdrversion=2; + break; default: printf("Dumping DPFW firmware on hardware version %u is " "not yet supported.\n", em100->hwversion); @@ -166,8 +169,14 @@ em100->fpga >> 8 & 0x7f, em100->fpga & 0xff);
memset(header, 0, 0x100); - if (hdrversion == 1) + switch (hdrversion) { + case 1: memcpy(header, "em100pro", 8); + break; + case 2: + memcpy(header, "EM100Pro-G2", 11); + break; + } memcpy(header + 0x28, "WFPD", 4); memcpy(header + 0x14, mcu_version, 4); memcpy(header + 0x1e, fpga_version, 4); @@ -205,7 +214,10 @@
switch (em100->hwversion) { case HWVERSION_EM100PRO: - printf("Detected EM100Pro-G1.\n"); + printf("Detected EM100Pro (original).\n"); + break; + case HWVERSION_EM100PRO_G2: + printf("Detected EM100Pro-G2.\n"); break; default: printf("Updating EM100Pro firmware on hardware version %u is " @@ -251,6 +263,13 @@ return 0; }
+ if (em100->hwversion == HWVERSION_EM100PRO_G2 && (memcmp(fw, "EM100Pro-G2", 11) != 0 || + memcmp(fw + 0x28, "WFPD", 4) != 0)) { + printf("ERROR: Not an EM100Pro firmware file.\n"); + free(fw); + return 0; + } + /* Find firmwares in the update file */ fpga_offset = get_le32(fw+0x38); fpga_len = get_le32(fw+0x3c); @@ -263,7 +282,8 @@ strncpy(fpga_version, (char *)fw + 0x1e, MAX_VERSION_LENGTH); fpga_version[MAX_VERSION_LENGTH] = '\0';
- printf("EM100Pro Update File: %s\n", filename); + printf("EM100Pro%s Update File: %s\n", + em100->hwversion == HWVERSION_EM100PRO_G2 ? "-G2" : "", filename); printf(" Installed version: MCU %d.%d, FPGA %d.%d (%s)\n", em100->mcu >> 8, em100->mcu & 0xff, em100->fpga >> 8 & 0x7f, em100->fpga & 0xff, @@ -348,7 +368,7 @@
free(fw);
- /* Write magic update page */ + /* Write magic update tag '.UBOOTU.' */ memset(page, 0x00, 256); page[0] = 0xaa; page[1] = 0x55;
Martin Roth has posted comments on this change. ( https://review.coreboot.org/c/em100/+/36938 )
Change subject: Firmware update support for EM100Pro-G2 ......................................................................
Patch Set 1: Code-Review+1
(2 comments)
Nits
https://review.coreboot.org/c/em100/+/36938/1/firmware.c File firmware.c:
https://review.coreboot.org/c/em100/+/36938/1/firmware.c@261 PS1, Line 261: EM100Pro EM100Pro Gen 1? EM100Pro (Original)?
https://review.coreboot.org/c/em100/+/36938/1/firmware.c@268 PS1, Line 268: EM100Pro EM100Pro-G2
Hello Furquan Shaikh, build bot (Jenkins), Martin Roth, Patrick Georgi,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/em100/+/36938
to look at the new patch set (#2).
Change subject: Firmware update support for EM100Pro-G2 ......................................................................
Firmware update support for EM100Pro-G2
Teach em100 tool about EM100Pro-G2 firmware and check that the firmware is for the correct device.
Change-Id: I04c60f8fbe9a93048740549aa57d6d85a5db8107 Signed-off-by: Stefan Reinauer stefan.reinauer@coreboot.org --- M firmware.c 1 file changed, 25 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/em100 refs/changes/38/36938/2
Stefan Reinauer has posted comments on this change. ( https://review.coreboot.org/c/em100/+/36938 )
Change subject: Firmware update support for EM100Pro-G2 ......................................................................
Patch Set 2:
(2 comments)
https://review.coreboot.org/c/em100/+/36938/1/firmware.c File firmware.c:
https://review.coreboot.org/c/em100/+/36938/1/firmware.c@261 PS1, Line 261: EM100Pro
EM100Pro Gen 1? EM100Pro (Original)?
Done
https://review.coreboot.org/c/em100/+/36938/1/firmware.c@268 PS1, Line 268: EM100Pro
EM100Pro-G2
Done
Martin Roth has posted comments on this change. ( https://review.coreboot.org/c/em100/+/36938 )
Change subject: Firmware update support for EM100Pro-G2 ......................................................................
Patch Set 7: Code-Review+2
Stefan Reinauer has submitted this change. ( https://review.coreboot.org/c/em100/+/36938 )
Change subject: Firmware update support for EM100Pro-G2 ......................................................................
Firmware update support for EM100Pro-G2
Teach em100 tool about EM100Pro-G2 firmware and check that the firmware is for the correct device.
Change-Id: I04c60f8fbe9a93048740549aa57d6d85a5db8107 Signed-off-by: Stefan Reinauer stefan.reinauer@coreboot.org Reviewed-on: https://review.coreboot.org/c/em100/+/36938 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Martin Roth martinroth@google.com --- M firmware.c 1 file changed, 25 insertions(+), 5 deletions(-)
Approvals: build bot (Jenkins): Verified Martin Roth: Looks good to me, approved
diff --git a/firmware.c b/firmware.c index dd1a173..b2a1775 100644 --- a/firmware.c +++ b/firmware.c @@ -129,6 +129,9 @@ case HWVERSION_EM100PRO: hdrversion=1; break; + case HWVERSION_EM100PRO_G2: + hdrversion=2; + break; default: printf("Dumping DPFW firmware on hardware version %u is " "not yet supported.\n", em100->hwversion); @@ -166,8 +169,14 @@ em100->fpga >> 8 & 0x7f, em100->fpga & 0xff);
memset(header, 0, 0x100); - if (hdrversion == 1) + switch (hdrversion) { + case 1: memcpy(header, "em100pro", 8); + break; + case 2: + memcpy(header, "EM100Pro-G2", 11); + break; + } memcpy(header + 0x28, "WFPD", 4); memcpy(header + 0x14, mcu_version, 4); memcpy(header + 0x1e, fpga_version, 4); @@ -205,7 +214,10 @@
switch (em100->hwversion) { case HWVERSION_EM100PRO: - printf("Detected EM100Pro-G1.\n"); + printf("Detected EM100Pro (original).\n"); + break; + case HWVERSION_EM100PRO_G2: + printf("Detected EM100Pro-G2.\n"); break; default: printf("Updating EM100Pro firmware on hardware version %u is " @@ -246,7 +258,14 @@
if (em100->hwversion == HWVERSION_EM100PRO && (memcmp(fw, "em100pro", 8) != 0 || memcmp(fw + 0x28, "WFPD", 4) != 0)) { - printf("ERROR: Not an EM100Pro firmware file.\n"); + printf("ERROR: Not an EM100Pro (original) firmware file.\n"); + free(fw); + return 0; + } + + if (em100->hwversion == HWVERSION_EM100PRO_G2 && (memcmp(fw, "EM100Pro-G2", 11) != 0 || + memcmp(fw + 0x28, "WFPD", 4) != 0)) { + printf("ERROR: Not an EM100Pro-G2 firmware file.\n"); free(fw); return 0; } @@ -263,7 +282,8 @@ strncpy(fpga_version, (char *)fw + 0x1e, MAX_VERSION_LENGTH); fpga_version[MAX_VERSION_LENGTH] = '\0';
- printf("EM100Pro Update File: %s\n", filename); + printf("EM100Pro%s Update File: %s\n", + em100->hwversion == HWVERSION_EM100PRO_G2 ? "-G2" : "", filename); printf(" Installed version: MCU %d.%d, FPGA %d.%d (%s)\n", em100->mcu >> 8, em100->mcu & 0xff, em100->fpga >> 8 & 0x7f, em100->fpga & 0xff, @@ -348,7 +368,7 @@
free(fw);
- /* Write magic update page */ + /* Write magic update tag '.UBOOTU.' */ memset(page, 0x00, 256); page[0] = 0xaa; page[1] = 0x55;