1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 3 #ifndef AMD_COMMON_PSP_TRANSFER_H 4 #define AMD_COMMON_PSP_TRANSFER_H 5 6 # if (CONFIG_CMOS_RECOVERY_BYTE != 0) 7 # define CMOS_RECOVERY_BYTE CONFIG_CMOS_RECOVERY_BYTE 8 # elif CONFIG(VBOOT_STARTS_BEFORE_BOOTBLOCK) 9 # error "Must set CONFIG_CMOS_RECOVERY_BYTE" 10 # endif 11 12 #define CMOS_RECOVERY_MAGIC_VAL 0x96 13 14 #define TRANSFER_INFO_SIZE 64 15 #define TIMESTAMP_BUFFER_SIZE 0x200 16 17 #define TRANSFER_MAGIC_VAL 0x50544953 18 19 /* Bit definitions for the psp_info field in the PSP transfer_info_struct */ 20 #define PSP_INFO_PRODUCTION_MODE 0x00000001UL 21 #define PSP_INFO_PRODUCTION_SILICON 0x00000002UL 22 #define PSP_INFO_VALID 0x80000000UL 23 24 /* Area for things that would cause errors in a linker script */ 25 #if !defined(__ASSEMBLER__) 26 #include <stdint.h> 27 28 struct transfer_info_struct { 29 uint32_t magic_val; /* Identifier */ 30 uint32_t struct_bytes; /* Size of this structure */ 31 uint32_t buffer_size; /* Size of the transfer buffer area */ 32 33 /* Offsets from start of transfer buffer */ 34 uint32_t workbuf_offset; 35 uint32_t console_offset; 36 uint32_t timestamp_offset; 37 uint32_t fmap_offset; 38 39 uint32_t unused1[5]; 40 41 /* Fields reserved for the PSP */ 42 uint64_t timestamp; /* Offset 0x30 */ 43 uint32_t psp_unused; /* Offset 0x38 */ 44 uint32_t psp_info; /* Offset 0x3C */ 45 }; 46 47 _Static_assert(sizeof(struct transfer_info_struct) == TRANSFER_INFO_SIZE, 48 "TRANSFER_INFO_SIZE is incorrect"); 49 50 /* Make sure the PSP transferred information over to x86 side. */ 51 int transfer_buffer_valid(const struct transfer_info_struct *ptr); 52 /* Verify vboot work buffer is valid in transfer buffer */ 53 void verify_psp_transfer_buf(void); 54 /* Display the transfer block's PSP_info data */ 55 void show_psp_transfer_info(void); 56 /* Replays the pre-x86 cbmem console into the x86 cbmem console */ 57 void replay_transfer_buffer_cbmemc(void); 58 /* Called by bootblock_c_entry in the VBOOT_STARTS_BEFORE_BOOTBLOCK case */ 59 void boot_with_psp_timestamp(uint64_t base_timestamp); 60 61 #endif 62 63 #endif /* AMD_COMMON_PSP_TRANSFER_H */ 64