From 5e2053ea82c3efec3755e0bd62bb67a4aaf7242e Mon Sep 17 00:00:00 2001 From: Bruce Griffith Date: Fri, 5 Dec 2014 19:38:53 -0700 Subject: AMD 00730F01: Change Makefile to use BLOB sizes for packing The new AMD PSP and SMU BLOBs currently have fixed sizes in the southbridge Makefile. Future PSP and SMU updates may require more space and thereby cause the make to fail with cryptic error messages. Change the makefile to compute CBFS locations and the corresponding PSP pointer table entry values based on the actual file sizes. Additionally, the FWM directory has expanded to 4096 bytes. The Avalon makefile is modified to zero-pad the FWM directory using the "dd" system command. There is dead code in the makefile to allow hardware validated boot ROMs, but the option is hard-coded to be disabled. Remove the HVB dead code. Change-Id: I4705cede8ed001a71bb4f49598444255c9609d52 Signed-off-by: Bruce Griffith Reviewed-on: http://review.coreboot.org/7726 Reviewed-by: Marshall Dawson Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- src/southbridge/amd/pi/avalon/Makefile.inc | 227 +++++++++++++++-------------- 1 file changed, 118 insertions(+), 109 deletions(-) (limited to 'src') diff --git a/src/southbridge/amd/pi/avalon/Makefile.inc b/src/southbridge/amd/pi/avalon/Makefile.inc index 3a3a52716f..6c22f063a9 100644 --- a/src/southbridge/amd/pi/avalon/Makefile.inc +++ b/src/southbridge/amd/pi/avalon/Makefile.inc @@ -60,15 +60,13 @@ ramstage-$(CONFIG_HAVE_SMI_HANDLER) += smi.c smi_util.c # # EC ROM should be 64K aligned. -# HVB(Hardware Validated Boot) or Bypass -CONFIG_HVB=Bypass - HUDSON_FWM_POSITION=$(shell printf %u $(CONFIG_HUDSON_FWM_POSITION)) +CBFS_HEADER_SIZE=0x40 -#assume the cbfs header is less than 128 bytes. -ROMSIG_SIZE=16 +#assume the cbfs header is less than $(CBFS_HEADER_SIZE) bytes. +ROMSIG_SIZE=4096 ifeq ($(CONFIG_HUDSON_XHCI_FWM), y) -HUDSON_XHCI_POSITION=$(call int-add,$(HUDSON_FWM_POSITION) $(ROMSIG_SIZE) 128) +HUDSON_XHCI_POSITION=$(call int-add,$(HUDSON_FWM_POSITION) $(ROMSIG_SIZE) $(CBFS_HEADER_SIZE)) XHCI_FWM_SIZE=$(call file-size,$(CONFIG_HUDSON_XHCI_FWM_FILE)) else HUDSON_XHCI_POSITION=0 @@ -76,8 +74,8 @@ XHCI_FWM_SIZE=0 endif ifeq ($(CONFIG_HUDSON_GEC_FWM), y) -HUDSON_GEC_POSITION=$(call int-add,$(HUDSON_FWM_POSITION) $(ROMSIG_SIZE) 128 \ - $(XHCI_FWM_SIZE) 128) +HUDSON_GEC_POSITION=$(call int-add,$(HUDSON_FWM_POSITION) $(ROMSIG_SIZE) $(CBFS_HEADER_SIZE) \ + $(XHCI_FWM_SIZE) $(CBFS_HEADER_SIZE)) GEC_FWM_SIZE=$(call file-size,$(CONFIG_HUDSON_GEC_FWM_FILE)) else HUDSON_GEC_POSITION=0 @@ -87,16 +85,25 @@ endif ifeq ($(CONFIG_HUDSON_IMC_FWM), y) HUDSON_IMC_POSITION=$(call int-align,\ $(call int-add,\ - $(HUDSON_FWM_POSITION) $(ROMSIG_SIZE) 128 $(XHCI_FWM_SIZE)\ - 128 $(GEC_FWM_SIZE) 128),\ + $(HUDSON_FWM_POSITION) $(ROMSIG_SIZE) $(CBFS_HEADER_SIZE) $(XHCI_FWM_SIZE)\ + $(CBFS_HEADER_SIZE) $(GEC_FWM_SIZE) $(CBFS_HEADER_SIZE)),\ 65536) +IMC_FWM_SIZE=$(call file-size,$(CONFIG_HUDSON_IMC_FWM_FILE)) else HUDSON_IMC_POSITION=0 +IMC_FWM_SIZE=0 endif -HUDSON_PSP_DIRECTORY_POSITION=0 ifeq ($(CONFIG_CPU_AMD_PI_00730F01), y) -HUDSON_PSP_DIRECTORY_POSITION=$(call int-add,$(HUDSON_FWM_POSITION) 262144) +HUDSON_PSP_DIRECTORY_POSITION=$(call int-align,\ + $(call int-add,\ + $(HUDSON_FWM_POSITION) $(ROMSIG_SIZE) $(CBFS_HEADER_SIZE) $(XHCI_FWM_SIZE)\ + $(CBFS_HEADER_SIZE) $(GEC_FWM_SIZE) $(CBFS_HEADER_SIZE) $(IMC_FWM_SIZE) $(CBFS_HEADER_SIZE)),\ + 65536) +HUDSON_PSP_DIRECTORY_SIZE=256 +else +HUDSON_PSP_DIRECTORY_POSITION=0 +HUDSON_PSP_DIRECTORY_SIZE=0 endif $(obj)/coreboot_hudson_romsig.bin: $(call strip_quotes, $(CONFIG_HUDSON_XHCI_FWM_FILE)) \ @@ -104,43 +111,47 @@ $(obj)/coreboot_hudson_romsig.bin: $(call strip_quotes, $(CONFIG_HUDSON_XHCI_FWM $(call strip_quotes, $(CONFIG_HUDSON_GEC_FWM_FILE)) \ $(obj)/config.h echo " Hudson FW $@" + dd if=/dev/zero of=$@ count=$(ROMSIG_SIZE) ibs=1 status=noxfer 2>/dev/null; \ for fwm in 1437226410 \ $(HUDSON_IMC_POSITION) \ $(HUDSON_GEC_POSITION) \ $(HUDSON_XHCI_POSITION) \ $(HUDSON_PSP_DIRECTORY_POSITION); do \ echo $$fwm | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, int($$1/256) % 256, int($$1/65536) % 256, int($$1/16777216));}'; \ - done > $@ + done > $@.tmp; \ + dd if=$@.tmp of=$@ conv=notrunc status=noxfer 2>/dev/null; \ + rm $@.tmp ifeq ($(CONFIG_HUDSON_FWM), y) -cbfs-files-y += hudson/fwm -hudson/fwm-file := $(obj)/coreboot_hudson_romsig.bin -hudson/fwm-position := $(HUDSON_FWM_POSITION) -hudson/fwm-type := raw +cbfs-files-y += fch/fwm +fch/fwm-file := $(obj)/coreboot_hudson_romsig.bin +fch/fwm-position := $(HUDSON_FWM_POSITION) +fch/fwm-size := $(ROMSIZE_SIG) +fch/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 -hudson/xhci-required := Hudson XHCI firmware (available in coreboot/3rdparty if enabled) +cbfs-files-y += fch/xhci +fch/xhci-file := $(call strip_quotes, $(CONFIG_HUDSON_XHCI_FWM_FILE)) +fch/xhci-position := $(HUDSON_XHCI_POSITION) +fch/xhci-type := raw +fch/xhci-required := Hudson XHCI firmware (available in coreboot/3rdparty if enabled) 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 -hudson/imc-required := Hudson IMC Firmware (available in coreboot/3rdparty if enabled) +cbfs-files-y += fch/imc +fch/imc-file := $(call strip_quotes, $(CONFIG_HUDSON_IMC_FWM_FILE)) +fch/imc-position := $(HUDSON_IMC_POSITION) +fch/imc-type := raw +fch/imc-required := Hudson IMC Firmware (available in coreboot/3rdparty if enabled) 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 -hudson/gec-required := Hudson Gigabit Ethernet Controller Firmware (Contact your AMD representative) +cbfs-files-y += fch/gec +fch/gec-file := $(call strip_quotes, $(CONFIG_HUDSON_GEC_FWM_FILE)) +fch/gec-position := $(HUDSON_GEC_POSITION) +fch/gec-type := raw +fch/gec-required := Hudson Gigabit Ethernet Controller Firmware (Contact your AMD representative) endif ifdef CONFIG_HUDSON_AHCI_ROM @@ -155,90 +166,55 @@ ifeq ($(CONFIG_HUDSON_PSP), y) # 0 # catenate the pubkey and pspdir together to save some space. -AMDPUBKEY_POS=$(call int-add,$(HUDSON_PSP_DIRECTORY_POSITION) 0x100) #$(shell printf %u 0xFFb00100) +AMDPUBKEY_POS=$(call int-add,$(HUDSON_PSP_DIRECTORY_POSITION) $(HUDSON_PSP_DIRECTORY_SIZE)) AMDPUBKEY_SIZE=$(call file-size,$(CONFIG_AMD_PUBKEY_FILE)) ifeq ($(CONFIG_CPU_AMD_PI_00730F01), y) FIRMWARE_LOCATE=$(dir $(call strip_quotes, $(CONFIG_AMD_PUBKEY_FILE))) FIRMWARE_TYPE= endif -# 1 -CONFIG_PSPBTLDR_FILE=$(top)/$(FIRMWARE_LOCATE)/PspBootLoader$(FIRMWARE_TYPE).$(CONFIG_HVB).sbin -PSPBTLDR_POS=$(call int-add,$(HUDSON_PSP_DIRECTORY_POSITION) 0x1000) #$(shell printf %u 0xFFb10000) -PSPBTLDR_SIZE=$(call file-size,$(CONFIG_PSPBTLDR_FILE)) -cbfs-files-y += hudson/pspbtldr -hudson/pspbtldr-file := $(CONFIG_PSPBTLDR_FILE) -hudson/pspbtldr-position := $(PSPBTLDR_POS) -hudson/pspbtldr-type := raw -#8 -CONFIG_SMUFWM_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuFirmware$(FIRMWARE_TYPE).sbin -SMUFWM_POS=$(call int-add,$(HUDSON_PSP_DIRECTORY_POSITION) 0xb000) #$(shell printf %u 0xFFb20000) -SMUFWM_SIZE=$(call file-size,$(CONFIG_SMUFWM_FILE)) -cbfs-files-y += hudson/smufwm -hudson/smufwm-file := $(CONFIG_SMUFWM_FILE) -hudson/smufwm-position := $(SMUFWM_POS) -hudson/smufwm-type := raw +CONFIG_PUBSIGNEDKEY_FILE=$(top)/$(FIRMWARE_LOCATE)/RtmPubSigned$(FIRMWARE_TYPE).key +PUBSIGNEDKEY_POS=$(call int-align, \ + $(call int-add,$(AMDPUBKEY_POS) $(AMDPUBKEY_SIZE) $(CBFS_HEADER_SIZE)), \ + $(CBFS_HEADER_SIZE)) +PUBSIGNEDKEY_SIZE=$(call file-size,$(CONFIG_PUBSIGNEDKEY_FILE)) + +CONFIG_PSPBTLDR_FILE=$(top)/$(FIRMWARE_LOCATE)/PspBootLoader$(FIRMWARE_TYPE).Bypass.sbin +PSPBTLDR_POS=$(call int-align, \ + $(call int-add,$(PUBSIGNEDKEY_POS) $(PUBSIGNEDKEY_SIZE) $(CBFS_HEADER_SIZE)), \ + $(CBFS_HEADER_SIZE)) +PSPBTLDR_SIZE=$(call file-size,$(CONFIG_PSPBTLDR_FILE)) -#3 CONFIG_PSPRCVR_FILE=$(top)/$(FIRMWARE_LOCATE)/PspRecovery$(FIRMWARE_TYPE).sbin -PSPRCVR_POS=$(call int-add,$(HUDSON_PSP_DIRECTORY_POSITION) 0x30000) #$(shell printf %u 0xFFBb0000) +PSPRCVR_POS=$(call int-align, \ + $(call int-add,$(PSPBTLDR_POS) $(PSPBTLDR_SIZE) $(CBFS_HEADER_SIZE)), \ + $(CBFS_HEADER_SIZE)) PSPRCVR_SIZE=$(call file-size,$(CONFIG_PSPRCVR_FILE)) -cbfs-files-y += hudson/psprcvr -hudson/psprcvr-file := $(CONFIG_PSPRCVR_FILE) -hudson/psprcvr-position := $(PSPRCVR_POS) -hudson/psprcvr-type := raw -# 5 -CONFIG_PUBSIGNEDKEY_FILE=$(top)/$(FIRMWARE_LOCATE)/RtmPubSigned$(FIRMWARE_TYPE).key -PUBSIGNEDKEY_POS=$(call int-add,$(HUDSON_PSP_DIRECTORY_POSITION) 0x400) #$(shell printf %u 0xFFb00400) -PUBSIGNEDKEY_SIZE=$(call file-size,$(CONFIG_PUBSIGNEDKEY_FILE)) -cbfs-files-y += hudson/pubsignedkey -hudson/pubsignedkey-file := $(CONFIG_PUBSIGNEDKEY_FILE) -hudson/pubsignedkey-position := $(PUBSIGNEDKEY_POS) -hudson/pubsignedkey-type := raw - -# 2 CONFIG_PSPSCUREOS_FILE=$(top)/$(FIRMWARE_LOCATE)/PspSecureOs$(FIRMWARE_TYPE).sbin -PSPSECUREOS_POS=$(call int-add,$(HUDSON_PSP_DIRECTORY_POSITION) 0x3A000) #$(shell printf %u 0xFFbc0000) +PSPSECUREOS_POS=$(call int-align, \ + $(call int-add,$(PSPRCVR_POS) $(PSPRCVR_SIZE) $(CBFS_HEADER_SIZE)), \ + $(CBFS_HEADER_SIZE)) PSPSECUREOS_SIZE=$(call file-size,$(CONFIG_PSPSCUREOS_FILE)) -cbfs-files-y += hudson/pspsecureos -hudson/pspsecureos-file := $(CONFIG_PSPSCUREOS_FILE) -hudson/pspsecureos-position := $(PSPSECUREOS_POS) -hudson/pspsecureos-type := raw -# 4 CONFIG_PSPNVRAM_FILE=$(top)/$(FIRMWARE_LOCATE)/PspNvram$(FIRMWARE_TYPE).bin -PSPNVRAM_POS=$(call int-add,$(HUDSON_PSP_DIRECTORY_POSITION) 0x64000) #$(shell printf %u 0xFFbf0000) +PSPNVRAM_POS=$(call int-align, \ + $(call int-add,$(PSPSECUREOS_POS) $(PSPSECUREOS_SIZE) $(CBFS_HEADER_SIZE)), \ + $(CBFS_HEADER_SIZE)) PSPNVRAM_SIZE=$(call file-size,$(CONFIG_PSPNVRAM_FILE)) -cbfs-files-y += hudson/pspnvram -hudson/pspnvram-file := $(CONFIG_PSPNVRAM_FILE) -hudson/pspnvram-position := $(PSPNVRAM_POS) -hudson/pspnvram-type := raw - -ifeq ($(CONFIG_HVB), HVB) -# 6 -RTM_FILE=$(objcbfs)/bootblock.bin #The file size need to be 256 bytes aligned. -RTM_SIZE=$(call file-size,$(RTM_FILE)) -RTM_POS=$(call int-add,4294967296 -$(RTM_SIZE)) - -# 7 -RTMSIGN_FILE=$(obj)/bootblock_sig.bin -RTMSIGN_POS=$(call int-add,$(HUDSON_PSP_DIRECTORY_POSITION) 0x800) #$(shell printf %u 0xFFb00800) -RTMSIGN_SIZE=256 #it should be hardcoded to 256, otherwise circular dependency comes up.$(call file-size,$(RTMSIGN_FILE)) -cbfs-files-y += hudson/rtmsign -hudson/rtmsign-file := $(RTMSIGN_FILE) -hudson/rtmsign-position := $(RTMSIGN_POS) -hudson/rtmsign-type := raw -endif + +CONFIG_SMUFWM_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuFirmware$(FIRMWARE_TYPE).sbin +SMUFWM_POS=$(call int-align, \ + $(call int-add,$(PSPNVRAM_POS) $(PSPNVRAM_SIZE) $(CBFS_HEADER_SIZE)), \ + $(CBFS_HEADER_SIZE)) +SMUFWM_SIZE=$(call file-size,$(CONFIG_SMUFWM_FILE)) CONFIG_SMUSCS_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuScs$(FIRMWARE_TYPE).bin -SMUSCS_POS=$(call int-add,$(HUDSON_PSP_DIRECTORY_POSITION) 0x6d000) #$(shell printf %u 0xFFC00000) +SMUSCS_POS=$(call int-align, \ + $(call int-add,$(SMUFWM_POS) $(SMUFWM_SIZE) $(CBFS_HEADER_SIZE)), \ + $(CBFS_HEADER_SIZE)) SMUSCS_SIZE=$(call file-size,$(CONFIG_SMUSCS_FILE)) -cbfs-files-y += hudson/smuscs -hudson/smuscs-file := $(CONFIG_SMUSCS_FILE) -hudson/smuscs-position := $(SMUSCS_POS) -hudson/smuscs-type := raw define output_hex echo $(1) | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, int($$1/256) % 256, int($$1/65536) % 256, int($$1/16777216));}' @@ -261,14 +237,6 @@ $(obj)/coreboot_psp_directory.bin: $(obj)/config.h $(FLETCHER) $(RTM_FILE) for fwm in 5 $(PUBSIGNEDKEY_SIZE) $(PUBSIGNEDKEY_POS) 0; do \ echo $$fwm | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, int($$1/256) % 256, int($$1/65536) % 256, int($$1/16777216));}'; \ done >> $@_tail.tmp -ifeq ($(CONFIG_HVB), HVB) - for fwm in 6 $(RTM_SIZE) $(RTM_POS) 0; do \ - echo $$fwm | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, int($$1/256) % 256, int($$1/65536) % 256, int($$1/16777216));}'; \ - done >> $@_tail.tmp - for fwm in 7 $(RTMSIGN_SIZE) $(RTMSIGN_POS) 0; do \ - echo $$fwm | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, int($$1/256) % 256, int($$1/65536) % 256, int($$1/16777216));}'; \ - done >> $@_tail.tmp -endif for fwm in 2 $(PSPSECUREOS_SIZE) $(PSPSECUREOS_POS) 0; do \ echo $$fwm | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, int($$1/256) % 256, int($$1/65536) % 256, int($$1/16777216));}'; \ done >> $@_tail.tmp @@ -293,9 +261,50 @@ $(obj)/coreboot_psp_directory_combine_pubkey.bin: $(obj)/coreboot_psp_directory. ls -l $(obj)/coreboot_psp_directory.bin | LC_ALL=C awk '{for (i=0; i<256-$$5; i++) {printf "%c", 255}}' >> $@ cat $(top)/$(FIRMWARE_LOCATE)/AmdPubKey$(FIRMWARE_TYPE).bin >> $@ -cbfs-files-y += hudson/pspdir -hudson/pspdir-file := $(obj)/coreboot_psp_directory_combine_pubkey.bin -hudson/pspdir-position := $(HUDSON_PSP_DIRECTORY_POSITION) -hudson/pspdir-type := raw +cbfs-files-y += apu/pspdir +apu/pspdir-file := $(obj)/coreboot_psp_directory_combine_pubkey.bin +apu/pspdir-position := $(HUDSON_PSP_DIRECTORY_POSITION) +apu/pspdir-type := raw + +# 5 +cbfs-files-y += apu/pubsignedkey +apu/pubsignedkey-file := $(CONFIG_PUBSIGNEDKEY_FILE) +apu/pubsignedkey-position := $(PUBSIGNEDKEY_POS) +apu/pubsignedkey-type := raw + +# 1 +cbfs-files-y += apu/pspbtldr +apu/pspbtldr-file := $(CONFIG_PSPBTLDR_FILE) +apu/pspbtldr-position := $(PSPBTLDR_POS) +apu/pspbtldr-type := raw + +#3 +cbfs-files-y += apu/psprcvr +apu/psprcvr-file := $(CONFIG_PSPRCVR_FILE) +apu/psprcvr-position := $(PSPRCVR_POS) +apu/psprcvr-type := raw + +# 2 +cbfs-files-y += apu/pspsecureos +apu/pspsecureos-file := $(CONFIG_PSPSCUREOS_FILE) +apu/pspsecureos-position := $(PSPSECUREOS_POS) +apu/pspsecureos-type := raw + +# 4 +cbfs-files-y += apu/pspnvram +apu/pspnvram-file := $(CONFIG_PSPNVRAM_FILE) +apu/pspnvram-position := $(PSPNVRAM_POS) +apu/pspnvram-type := raw + +#8 +cbfs-files-y += apu/smufwm +apu/smufwm-file := $(CONFIG_SMUFWM_FILE) +apu/smufwm-position := $(SMUFWM_POS) +apu/smufwm-type := raw + +cbfs-files-y += apu/smuscs +apu/smuscs-file := $(CONFIG_SMUSCS_FILE) +apu/smuscs-position := $(SMUSCS_POS) +apu/smuscs-type := raw endif -- cgit v1.2.3