summaryrefslogtreecommitdiff
path: root/src/soc/amd/stoneyridge
diff options
context:
space:
mode:
authorZheng Bao <fishbaozi@gmail.com>2023-02-14 13:26:31 +0800
committerFelix Held <felix-coreboot@felixheld.de>2023-09-01 11:47:15 +0000
commit6bc06983ed1d6c545056b584eabc2f7864cb39cd (patch)
tree85e01a12ae0de1e768747bc3760ff9300faf517e /src/soc/amd/stoneyridge
parentd0de6c2183af5f6c435e53632fe92793be4d3783 (diff)
util/amdfwtool: Deal with psp position in flash offset directly
It is based on work by Arthur Heymans, 69852. Get rid of the confusing "position index" and use the relative flash offset as the Kconfig setting instead. TEST=binary identical on amd/birman amd/majolica amd/gardenia amd/mayan amd/bilby amd/mandolin amd/chausie amd/pademelon pcengines/apu2 google/skyrim google/guybrush google/zork google/kahlee google/myst (The test should be done with INCLUDE_CONFIG_FILE=n) Change-Id: I26bde0b7c70efe9f5762109f431329ea7f95b7f2 Signed-off-by: Zheng Bao <fishbaozi@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/72939 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'src/soc/amd/stoneyridge')
-rw-r--r--src/soc/amd/stoneyridge/Kconfig33
-rw-r--r--src/soc/amd/stoneyridge/Makefile.inc22
-rw-r--r--src/soc/amd/stoneyridge/fch.c2
3 files changed, 8 insertions, 49 deletions
diff --git a/src/soc/amd/stoneyridge/Kconfig b/src/soc/amd/stoneyridge/Kconfig
index 6091dce1e4..9af7455bae 100644
--- a/src/soc/amd/stoneyridge/Kconfig
+++ b/src/soc/amd/stoneyridge/Kconfig
@@ -322,39 +322,6 @@ config AMDFW_OUTSIDE_CBFS
option to manually attach the generated amdfw.rom outside of
cbfs. The location is selected by the FWM position.
-config AMD_FWM_POSITION_INDEX
- int "Firmware Directory Table location (0 to 5)"
- range 0 5
- default 0 if BOARD_ROMSIZE_KB_512
- default 1 if BOARD_ROMSIZE_KB_1024
- default 2 if BOARD_ROMSIZE_KB_2048
- default 3 if BOARD_ROMSIZE_KB_4096
- default 4 if BOARD_ROMSIZE_KB_8192
- default 5 if BOARD_ROMSIZE_KB_16384
- help
- Typically this is calculated by the ROM size, but there may
- be situations where you want to put the firmware directory
- table in a different location.
- 0: 512 KB - 0xFFFA0000
- 1: 1 MB - 0xFFF20000
- 2: 2 MB - 0xFFE20000
- 3: 4 MB - 0xFFC20000
- 4: 8 MB - 0xFF820000
- 5: 16 MB - 0xFF020000
-
-comment "AMD Firmware Directory Table set to location for 512KB ROM"
- depends on AMD_FWM_POSITION_INDEX = 0
-comment "AMD Firmware Directory Table set to location for 1MB ROM"
- depends on AMD_FWM_POSITION_INDEX = 1
-comment "AMD Firmware Directory Table set to location for 2MB ROM"
- depends on AMD_FWM_POSITION_INDEX = 2
-comment "AMD Firmware Directory Table set to location for 4MB ROM"
- depends on AMD_FWM_POSITION_INDEX = 3
-comment "AMD Firmware Directory Table set to location for 8MB ROM"
- depends on AMD_FWM_POSITION_INDEX = 4
-comment "AMD Firmware Directory Table set to location for 16MB ROM"
- depends on AMD_FWM_POSITION_INDEX = 5
-
config DIMM_SPD_SIZE
default 512 # DDR4
diff --git a/src/soc/amd/stoneyridge/Makefile.inc b/src/soc/amd/stoneyridge/Makefile.inc
index 5c0a31296b..47bdf0f587 100644
--- a/src/soc/amd/stoneyridge/Makefile.inc
+++ b/src/soc/amd/stoneyridge/Makefile.inc
@@ -64,7 +64,6 @@ CPPFLAGS_common += -I$(src)/soc/amd/stoneyridge/include
CPPFLAGS_common += -I$(src)/soc/amd/stoneyridge/acpi
# ROMSIG Normally At ROMBASE + 0x20000
-# Overridden by CONFIG_AMD_FWM_POSITION_INDEX
# +-----------+---------------+----------------+------------+
# |0x55AA55AA |EC ROM Address |GEC ROM Address |USB3 ROM |
# +-----------+---------------+----------------+------------+
@@ -72,11 +71,6 @@ CPPFLAGS_common += -I$(src)/soc/amd/stoneyridge/acpi
# +-----------+
#
# EC ROM should be 64K aligned.
-STONEYRIDGE_FWM_POSITION=$(call int-add, \
- $(call int-subtract, 0xffffffff \
- $(call int-shift-left, \
- 0x80000 $(CONFIG_AMD_FWM_POSITION_INDEX))) 0x20000 1)
-
### 0
FIRMWARE_LOCATION=$(shell grep -e FIRMWARE_LOCATION $(CONFIG_AMDFW_CONFIG_FILE) | awk '{print $$2}')
@@ -138,26 +132,24 @@ $(obj)/amdfw.rom: $(call strip_quotes, $(CONFIG_STONEYRIDGE_XHCI_FWM_FILE)) \
$(OPT_DEBUG_AMDFWTOOL) \
--config $(CONFIG_AMDFW_CONFIG_FILE) \
--flashsize $(CONFIG_ROM_SIZE) \
- --location $(call _tohex,$(STONEYRIDGE_FWM_POSITION)) \
+ --location $(CONFIG_AMD_FWM_POSITION) \
--output $@
ifeq ($(CONFIG_AMDFW_OUTSIDE_CBFS),y)
-# Calculate firmware position inside the ROM
-STONEYRIDGE_FWM_ROM_POSITION=$(call int-add, \
- $(call int-subtract, $(CONFIG_ROM_SIZE) \
- $(call int-shift-left, \
- 0x80000 $(CONFIG_AMD_FWM_POSITION_INDEX))) 0x20000)
-
$(call add_intermediate, add_amdfw, $(obj)/amdfw.rom)
printf " DD Adding AMD Firmware at ROM offset 0x%x\n" \
- "$(STONEYRIDGE_FWM_ROM_POSITION)"
+ "$(CONFIG_AMD_FWM_POSITION)"
dd if=$(obj)/amdfw.rom \
of=$< conv=notrunc bs=1 \
- seek=$(STONEYRIDGE_FWM_ROM_POSITION) >/dev/null 2>&1
+ seek=$(CONFIG_AMD_FWM_POSITION) >/dev/null 2>&1
else # ifeq ($(CONFIG_AMDFW_OUTSIDE_CBFS),y)
+STONEYRIDGE_FWM_POSITION=$(call int-add, \
+ $(call int-subtract, 0xffffffff $(CONFIG_ROM_SIZE)) \
+ 1 \
+ $(CONFIG_AMD_FWM_POSITION))
cbfs-files-y += apu/amdfw
apu/amdfw-file := $(obj)/amdfw.rom
apu/amdfw-position := $(STONEYRIDGE_FWM_POSITION)
diff --git a/src/soc/amd/stoneyridge/fch.c b/src/soc/amd/stoneyridge/fch.c
index 9680fb2c4a..176c263c17 100644
--- a/src/soc/amd/stoneyridge/fch.c
+++ b/src/soc/amd/stoneyridge/fch.c
@@ -151,7 +151,7 @@ static void set_sb_gnvs(struct global_nvs *gnvs)
uintptr_t fwaddr;
size_t fwsize;
- amdfw_rom = 0x20000 - (0x80000 << CONFIG_AMD_FWM_POSITION_INDEX);
+ amdfw_rom = 4ull * GiB - CONFIG_ROM_SIZE + CONFIG_AMD_FWM_POSITION;
xhci_fw = read32p(amdfw_rom + XHCI_FW_SIG_OFFSET);
fwaddr = 2 + read16p(xhci_fw + XHCI_FW_ADDR_OFFSET + XHCI_FW_BOOTRAM_SIZE);