summaryrefslogtreecommitdiff
path: root/src/soc/amd/common/vboot
diff options
context:
space:
mode:
authorMartin Roth <gaumless@gmail.com>2023-08-18 16:28:29 -0600
committerMartin L Roth <gaumless@gmail.com>2023-08-26 21:39:22 +0000
commit8fc68816a96c6fdfc7a35ec1c68b681b03decc06 (patch)
tree4316aa27580c58bafde7d17b5f2e60756ec2d37a /src/soc/amd/common/vboot
parent7687e7767f2d2321b57fa8eab68b7e954e57ad42 (diff)
soc/amd: Move psp_transfer.h out of each SOC into common
The psp_transfer.h file was the same under all SoCs, and is really tied to the file common/vboot/transfer.c, not the SOC. This patch makes an include directory under vboot to put the header into and sets it to be included for all SoCs using SOC_AMD_COMMON. This makes the header file available to all platforms, so that new chips that don't use the psp_verstage don't have to make a psp_transfer.h file just to satisfy the compiler. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: I5b9f2adee3a1d4d8d32813ec0a850344b7d717b2 Reviewed-on: https://review.coreboot.org/c/coreboot/+/77303 Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/amd/common/vboot')
-rw-r--r--src/soc/amd/common/vboot/include/psp_verstage/psp_transfer.h63
-rw-r--r--src/soc/amd/common/vboot/transfer_buffer.c2
-rw-r--r--src/soc/amd/common/vboot/vboot_bootblock.c2
3 files changed, 65 insertions, 2 deletions
diff --git a/src/soc/amd/common/vboot/include/psp_verstage/psp_transfer.h b/src/soc/amd/common/vboot/include/psp_verstage/psp_transfer.h
new file mode 100644
index 0000000000..e2365168ed
--- /dev/null
+++ b/src/soc/amd/common/vboot/include/psp_verstage/psp_transfer.h
@@ -0,0 +1,63 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef AMD_COMMON_PSP_TRANSFER_H
+#define AMD_COMMON_PSP_TRANSFER_H
+
+# if (CONFIG_CMOS_RECOVERY_BYTE != 0)
+# define CMOS_RECOVERY_BYTE CONFIG_CMOS_RECOVERY_BYTE
+# elif CONFIG(VBOOT_STARTS_BEFORE_BOOTBLOCK)
+# error "Must set CONFIG_CMOS_RECOVERY_BYTE"
+# endif
+
+#define CMOS_RECOVERY_MAGIC_VAL 0x96
+
+#define TRANSFER_INFO_SIZE 64
+#define TIMESTAMP_BUFFER_SIZE 0x200
+
+#define TRANSFER_MAGIC_VAL 0x50544953
+
+/* Bit definitions for the psp_info field in the PSP transfer_info_struct */
+#define PSP_INFO_PRODUCTION_MODE 0x00000001UL
+#define PSP_INFO_PRODUCTION_SILICON 0x00000002UL
+#define PSP_INFO_VALID 0x80000000UL
+
+/* Area for things that would cause errors in a linker script */
+#if !defined(__ASSEMBLER__)
+#include <stdint.h>
+
+struct transfer_info_struct {
+ uint32_t magic_val; /* Identifier */
+ uint32_t struct_bytes; /* Size of this structure */
+ uint32_t buffer_size; /* Size of the transfer buffer area */
+
+ /* Offsets from start of transfer buffer */
+ uint32_t workbuf_offset;
+ uint32_t console_offset;
+ uint32_t timestamp_offset;
+ uint32_t fmap_offset;
+
+ uint32_t unused1[5];
+
+ /* Fields reserved for the PSP */
+ uint64_t timestamp; /* Offset 0x30 */
+ uint32_t psp_unused; /* Offset 0x38 */
+ uint32_t psp_info; /* Offset 0x3C */
+};
+
+_Static_assert(sizeof(struct transfer_info_struct) == TRANSFER_INFO_SIZE,
+ "TRANSFER_INFO_SIZE is incorrect");
+
+/* Make sure the PSP transferred information over to x86 side. */
+int transfer_buffer_valid(const struct transfer_info_struct *ptr);
+/* Verify vboot work buffer is valid in transfer buffer */
+void verify_psp_transfer_buf(void);
+/* Display the transfer block's PSP_info data */
+void show_psp_transfer_info(void);
+/* Replays the pre-x86 cbmem console into the x86 cbmem console */
+void replay_transfer_buffer_cbmemc(void);
+/* Called by bootblock_c_entry in the VBOOT_STARTS_BEFORE_BOOTBLOCK case */
+void boot_with_psp_timestamp(uint64_t base_timestamp);
+
+#endif
+
+#endif /* AMD_COMMON_PSP_TRANSFER_H */
diff --git a/src/soc/amd/common/vboot/transfer_buffer.c b/src/soc/amd/common/vboot/transfer_buffer.c
index e08847e8ca..a9644d3a08 100644
--- a/src/soc/amd/common/vboot/transfer_buffer.c
+++ b/src/soc/amd/common/vboot/transfer_buffer.c
@@ -4,9 +4,9 @@
#include <console/cbmem_console.h>
#include <console/console.h>
#include <pc80/mc146818rtc.h>
+#include <psp_verstage/psp_transfer.h>
#include <security/vboot/vbnv.h>
#include <security/vboot/symbols.h>
-#include <soc/psp_transfer.h>
#include <timestamp.h>
#include <2struct.h>
diff --git a/src/soc/amd/common/vboot/vboot_bootblock.c b/src/soc/amd/common/vboot/vboot_bootblock.c
index 07039fd3b5..9b24232263 100644
--- a/src/soc/amd/common/vboot/vboot_bootblock.c
+++ b/src/soc/amd/common/vboot/vboot_bootblock.c
@@ -3,7 +3,7 @@
#include <bootblock_common.h>
#include <console/console.h>
#include <cpu/x86/tsc.h>
-#include <soc/psp_transfer.h>
+#include <psp_verstage/psp_transfer.h>
#include <symbols.h>
#include <timestamp.h>
#include <types.h>