summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/southbridge/amd/agesa/hudson/Makefile.inc73
-rw-r--r--src/southbridge/amd/agesa/hudson/hudson_fwm.py64
2 files changed, 69 insertions, 68 deletions
diff --git a/src/southbridge/amd/agesa/hudson/Makefile.inc b/src/southbridge/amd/agesa/hudson/Makefile.inc
index 19ffae18fd..ff0662d761 100644
--- a/src/southbridge/amd/agesa/hudson/Makefile.inc
+++ b/src/southbridge/amd/agesa/hudson/Makefile.inc
@@ -14,16 +14,81 @@ romstage-y += early_setup.c
ramstage-$(CONFIG_HAVE_ACPI_RESUME) += spi.c
-$(obj)/hudson.bin:
- python $(src)/southbridge/amd/agesa/hudson/hudson_fwm.py $(CONFIG_HUDSON_FWM_POSITION) $@ $(CONFIG_HUDSON_XHCI_FWM_FILE) $(CONFIG_HUDSON_IMC_FWM_FILE) ""
+# ROMSIG At ROMBASE + 0x20000:
+# +-----------+---------------+----------------+------------+
+# |0x55AA55AA |EC ROM Address |GEC ROM Address |USB3 ROM |
+# +-----------+---------------+----------------+------------+
+# EC ROM should be 64K aligned.
+HUDSON_FWM_POSITION=$(shell printf %d $(CONFIG_HUDSON_FWM_POSITION))
+
+#assume the cbfs header is less than 128 bytes.
+ROMSIG_SIZE=16
+ifeq ($(CONFIG_HUDSON_XHCI_FWM), y)
+HUDSON_XHCI_POSITION=$(shell expr $(HUDSON_FWM_POSITION) + $(ROMSIG_SIZE) + 128)
+XHCI_FWM_SIZE=$(word 5,$(shell ls -l $(CONFIG_HUDSON_XHCI_FWM_FILE)))
+else
+HUDSON_XHCI_POSITION=0
+XHCI_FWM_SIZE=0
+endif
+
+ifeq ($(CONFIG_HUDSON_GEC_FWM), y)
+HUDSON_GEC_POSITION=$(shell expr $(HUDSON_FWM_POSITION) + $(ROMSIG_SIZE) + 128 \
+ + $(XHCI_FWM_SIZE) + 128)
+GEC_FWM_SIZE=$(word 5,$(shell ls -l $(CONFIG_HUDSON_GEC_FWM_FILE)))
+else
+HUDSON_GEC_POSITION=0
+GEC_FWM_SIZE=0
+endif
+
+ifeq ($(CONFIG_HUDSON_IMC_FWM), y)
+HUDSON_IMC_POSITION_UNALIGN=$(shell expr $(HUDSON_FWM_POSITION) + $(ROMSIG_SIZE) + 128 \
+ + $(XHCI_FWM_SIZE) + 128 \
+ + $(GEC_FWM_SIZE) + 128 + 65535)
+HUDSON_IMC_POSITION=$(shell expr $(HUDSON_IMC_POSITION_UNALIGN) - $(HUDSON_IMC_POSITION_UNALIGN) % 65536)
+else
+HUDSON_IMC_POSITION=0
+endif
+
+$(obj)/hudson_romsig.bin: #$(call strip_quotes, $(CONFIG_HUDSON_XHCI_FWM_FILE)) \
+ $(call strip_quotes, $(CONFIG_HUDSON_IMC_FWM_FILE)) \
+ $(call strip_quotes, $(CONFIG_HUDSON_GEC_FWM_FILE)) \
+ $(obj)/config.h
+ echo " Hudson FW $@"
+ for fwm in 1437226410 \
+ $(HUDSON_IMC_POSITION) \
+ $(HUDSON_GEC_POSITION) \
+ $(HUDSON_XHCI_POSITION) ; do \
+ echo $$fwm | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 0x100, $$1/0x100 % 0x100, $$1/0x10000 % 0x100, $$1/0x1000000);}'; \
+ done > $@
ifeq ($(CONFIG_HUDSON_FWM), y)
cbfs-files-y += hudson/fwm
-hudson/fwm-file := $(obj)/hudson.bin
-hudson/fwm-position := $(CONFIG_HUDSON_FWM_POSITION)
+hudson/fwm-file := $(obj)/hudson_romsig.bin
+hudson/fwm-position := $(HUDSON_FWM_POSITION)
hudson/fwm-type := raw
endif
+ifeq ($(CONFIG_HUDSON_XHCI_FWM), y)
+cbfs-files-y += hudson/xhci
+hudson/xhci-file := $(call strip_quotes, $(CONFIG_HUDSON_XHCI_FWM_FILE))
+hudson/xhci-position := $(HUDSON_XHCI_POSITION)
+hudson/xhci-type := raw
+endif
+
+ifeq ($(CONFIG_HUDSON_IMC_FWM), y)
+cbfs-files-y += hudson/imc
+hudson/imc-file := $(call strip_quotes, $(CONFIG_HUDSON_IMC_FWM_FILE))
+hudson/imc-position := $(HUDSON_IMC_POSITION)
+hudson/imc-type := raw
+endif
+
+ifeq ($(CONFIG_HUDSON_GEC_FWM), y)
+cbfs-files-y += hudson/gec
+hudson/gec-file := $(call strip_quotes, $(CONFIG_HUDSON_GEC_FWM_FILE))
+hudson/gec-position := $(HUDSON_GEC_POSITION)
+hudson/gec-type := raw
+endif
+
#ifeq ($(CONFIG_HUDSON_SATA_AHCI), y)
ifdef CONFIG_HUDSON_AHCI_ROM
stripped_ahci_rom_id = $(call strip_quotes,$(CONFIG_AHCI_ROM_ID))
diff --git a/src/southbridge/amd/agesa/hudson/hudson_fwm.py b/src/southbridge/amd/agesa/hudson/hudson_fwm.py
deleted file mode 100644
index ad60b3b4e4..0000000000
--- a/src/southbridge/amd/agesa/hudson/hudson_fwm.py
+++ /dev/null
@@ -1,64 +0,0 @@
-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)