summaryrefslogtreecommitdiff
path: root/src/soc/amd/common/vboot
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/amd/common/vboot')
-rw-r--r--src/soc/amd/common/vboot/Makefile.inc10
-rw-r--r--src/soc/amd/common/vboot/early_ram_symbols.awk16
2 files changed, 26 insertions, 0 deletions
diff --git a/src/soc/amd/common/vboot/Makefile.inc b/src/soc/amd/common/vboot/Makefile.inc
index 6938d16e69..e3486abffc 100644
--- a/src/soc/amd/common/vboot/Makefile.inc
+++ b/src/soc/amd/common/vboot/Makefile.inc
@@ -7,3 +7,13 @@ endif
bootblock-$(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK) += vboot_bootblock.c
bootblock-$(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK) += transfer_buffer.c
+smm-$(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK) += transfer_buffer.c
+
+# We don't use the early RAM memlayout linker for SMM, so we don't have access
+# to the early RAM symbols. We manually generate a file that defines the symbols
+# for us.
+$(obj)/smm/early_ram_symbols.ld: $(objcbfs)/bootblock.map $(src)/soc/amd/common/vboot/early_ram_symbols.awk
+ awk -f $(src)/soc/amd/common/vboot/early_ram_symbols.awk -- "$<" > "$@"
+
+$(obj)/smm/smm.elf: $(obj)/smm/early_ram_symbols.ld
+$(obj)/smm/smm.elf-ldflags += -T $(obj)/smm/early_ram_symbols.ld
diff --git a/src/soc/amd/common/vboot/early_ram_symbols.awk b/src/soc/amd/common/vboot/early_ram_symbols.awk
new file mode 100644
index 0000000000..85a1627a25
--- /dev/null
+++ b/src/soc/amd/common/vboot/early_ram_symbols.awk
@@ -0,0 +1,16 @@
+#!/usr/bin/awk -F
+#
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Generates a linker script to provide early RAM symbols.
+#
+# e.g.,
+# _cbmemc_transfer = 0x02014040;
+# _ecbmemc_transfer = 0x02015640;
+# _cbmemc_transfer_size = 0x00001600;
+
+$3 ~ /^_e?transfer_buffer$/ { printf("%s = 0x%s;\n", $3, $1)}
+$3 ~ /^_transfer_buffer_size$/ { printf("%s = 0x%s;\n", $3, $1)}
+
+$3 ~ /^_e?cbmemc_transfer$/ { printf("%s = 0x%s;\n", $3, $1)}
+$3 ~ /^_cbmemc_transfer_size$/ { printf("%s = 0x%s;\n", $3, $1)}