blob: e2365168ed67c317f6ff88023fa6f408193ce446 [file] [log] [blame]
Martin Roth0c12abe2020-06-26 08:40:56 -06001/* SPDX-License-Identifier: GPL-2.0-only */
2
Martin Roth8fc68812023-08-18 16:28:29 -06003#ifndef AMD_COMMON_PSP_TRANSFER_H
4#define AMD_COMMON_PSP_TRANSFER_H
Martin Roth0c12abe2020-06-26 08:40:56 -06005
Martin Roth50cca762020-08-13 11:06:18 -06006# 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
Kangheui Won6b36c832021-04-21 14:48:14 +100012#define CMOS_RECOVERY_MAGIC_VAL 0x96
Martin Roth50cca762020-08-13 11:06:18 -060013
Martin Roth0c12abe2020-06-26 08:40:56 -060014#define TRANSFER_INFO_SIZE 64
15#define TIMESTAMP_BUFFER_SIZE 0x200
16
17#define TRANSFER_MAGIC_VAL 0x50544953
18
Kangheui Wonf2996322021-04-15 14:19:47 +100019/* 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
Martin Roth0c12abe2020-06-26 08:40:56 -060024/* Area for things that would cause errors in a linker script */
25#if !defined(__ASSEMBLER__)
26#include <stdint.h>
27
28struct 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;
Martin Roth60d89e22020-09-28 14:29:17 -060038
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 */
Martin Roth0c12abe2020-06-26 08:40:56 -060045};
46
Kangheui Won6b36c832021-04-21 14:48:14 +100047_Static_assert(sizeof(struct transfer_info_struct) == TRANSFER_INFO_SIZE,
Martin Roth0c12abe2020-06-26 08:40:56 -060048 "TRANSFER_INFO_SIZE is incorrect");
Martin Roth4b341932020-10-06 15:29:28 -060049
50/* Make sure the PSP transferred information over to x86 side. */
Raul E Rangelfe1418d2022-02-24 12:36:38 -070051int transfer_buffer_valid(const struct transfer_info_struct *ptr);
52/* Verify vboot work buffer is valid in transfer buffer */
Martin Roth4b341932020-10-06 15:29:28 -060053void verify_psp_transfer_buf(void);
Martin Roth0f3ef702020-10-06 18:11:12 -060054/* Display the transfer block's PSP_info data */
55void show_psp_transfer_info(void);
Raul E Rangelfe1418d2022-02-24 12:36:38 -070056/* Replays the pre-x86 cbmem console into the x86 cbmem console */
Raul E Rangel08de3e32022-02-25 17:10:09 -070057void replay_transfer_buffer_cbmemc(void);
Felix Heldcd507152020-11-24 20:37:15 +010058/* Called by bootblock_c_entry in the VBOOT_STARTS_BEFORE_BOOTBLOCK case */
59void boot_with_psp_timestamp(uint64_t base_timestamp);
Martin Roth4b341932020-10-06 15:29:28 -060060
Martin Roth0c12abe2020-06-26 08:40:56 -060061#endif
62
Martin Roth8fc68812023-08-18 16:28:29 -060063#endif /* AMD_COMMON_PSP_TRANSFER_H */