diff options
author | zbao <fishbaozi@gmail.com> | 2012-07-13 18:47:03 +0800 |
---|---|---|
committer | Patrick Georgi <patrick@georgi-clan.de> | 2012-07-14 16:29:52 +0200 |
commit | 246e84bc0d04e3e670ca815eca32bcfa3be7e2c2 (patch) | |
tree | 10aadb7c1812235e2572d528a91f339d758f217d /src/southbridge/amd/agesa/hudson/hudson_fwm.py | |
parent | 22b7a55a4db9d9bfa69113a8e25e86f21ce8ab6e (diff) |
AGESA F15 wrapper for Hudson.
Hudson code has been integrated from CIMx to AGESA. This patch is about the wrapper.
Change-Id: I63d951982140b82a3a77a97eb3d55fc75fc0caa3
Signed-off-by: Zheng Bao <zheng.bao@amd.com>
Signed-off-by: zbao <fishbaozi@gmail.com>
Reviewed-on: http://review.coreboot.org/1157
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
Diffstat (limited to 'src/southbridge/amd/agesa/hudson/hudson_fwm.py')
-rw-r--r-- | src/southbridge/amd/agesa/hudson/hudson_fwm.py | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/southbridge/amd/agesa/hudson/hudson_fwm.py b/src/southbridge/amd/agesa/hudson/hudson_fwm.py new file mode 100644 index 0000000000..ad60b3b4e4 --- /dev/null +++ b/src/southbridge/amd/agesa/hudson/hudson_fwm.py @@ -0,0 +1,64 @@ +import sys, os, re +import struct +from Queue import Queue + +def main(start_addr, file_name, xhci_name, imc_name, gec_name): + fwm_sig = 0x55AA55AA # Hudson-2/3/4 firmware signature + fwm_header_len = 0x10 # 55AA55AA, imc_off, gec_off, xhci_off + + if not os.path.exists(xhci_name): + print "XHCI firmware %s does not exist\n" % xhci_name + sys.exit(1) + if not os.path.exists(imc_name): + print "IMC firmware %s does not exist\n" % imc_name + sys.exit(1) + + f = open(file_name, "w") + print "write to file " + file_name + + imc_offset = 0x10000 # 64K Bytes offset, hardcoded + imc_addr = start_addr + imc_offset; #startaddr + 0x10000 + gec_offset = 0 #TODO + gec_addr = 0 #TODO + xhci_addr = start_addr + fwm_header_len #ROMSIG take 0x10 bytes + + format="I" # one unsigned integer + data=struct.pack(format, fwm_sig) + f.write(data) + data=struct.pack(format, imc_addr) + f.write(data) + data=struct.pack(format, gec_addr) + f.write(data) + data=struct.pack(format, xhci_addr) + f.write(data) + + fwm_content = open(xhci_name).read() + f.write(fwm_content) + + imc_content = open(imc_name).read() + f.seek(0) + f.seek(imc_offset) + f.write(imc_content) +# if os.path.exists(gec_name): +# gec_conent = open(gec_name).read() +# f.seek(0) +# f.seek(gec_offset) +# f.write(gec_content) + + f.close() + print "done\n" + + +if __name__ == '__main__': + if (len(sys.argv) < 6): + print "\nUsage: %s <rom_addr> <rom_file> <xhci_rom> <imc_rom> <gec_rom>\n" % sys.argv[0] + print "Example: %s 0xFFF20000 hudson.bin xhci.bin imc.bin gec.bin\n" % sys.argv[0] + sys.exit(1) + rom_addr = int(sys.argv[1], 16) + rom_file = sys.argv[2] + xhci_file = sys.argv[3] + imc_file = sys.argv[4] + gec_file = sys.argv[5] + print "%x %s %s %s %s" % (rom_addr, rom_file, xhci_file, imc_file, gec_file) + + main(rom_addr, rom_file, xhci_file, imc_file, gec_file) |