Debian Codegraph @

src/soc/amd/common/block/include/amdblocks/psp.h

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #ifndef AMD_BLOCK_PSP_H
4 #define AMD_BLOCK_PSP_H
5
6 #include <stdint.h>
7 #include <stdbool.h>
8
9 #define SMM_TRIGGER_IO 0
10 #define SMM_TRIGGER_MEM 1
11
12 #define SMM_TRIGGER_BYTE 0
13 #define SMM_TRIGGER_WORD 1
14 #define SMM_TRIGGER_DWORD 2
15
16 struct smm_trigger_info {
17 uint64_t address; /* Memory or IO address */
18 uint32_t address_type; /* 0=I/O, 1=memory */
19 uint32_t value_width; /* 0=byte, 1=word, 2=qword */
20 uint32_t value_and_mask;
21 uint32_t value_or_mask;
22 } __packed;
23
24 struct smm_register {
25 uint64_t address; /* Memory or IO address */
26 uint32_t address_type; /* 0=I/O, 1=memory */
27 uint32_t value_width; /* 0=byte, 1=word, 2=qword */
28 uint32_t reg_bit_mask;
29 uint32_t expect_value;
30 } __packed;
31
32 struct smm_register_info {
33 struct smm_register smi_enb;
34 struct smm_register eos;
35 struct smm_register psp_smi_en;
36 struct smm_register reserved[5];
37 } __packed;
38
39 void soc_fill_smm_trig_info(struct smm_trigger_info *trig);
40 void soc_fill_smm_reg_info(struct smm_register_info *reg); /* v2 only */
41
42 /* BIOS-to-PSP functions return 0 if successful, else negative value */
43 #define PSPSTS_SUCCESS 0
44 #define PSPSTS_NOBASE 1
45 #define PSPSTS_HALTED 2
46 #define PSPSTS_RECOVERY 3
47 #define PSPSTS_SEND_ERROR 4
48 #define PSPSTS_INIT_TIMEOUT 5
49 #define PSPSTS_CMD_TIMEOUT 6
50 /* other error codes */
51 #define PSPSTS_UNSUPPORTED 7
52 #define PSPSTS_INVALID_NAME 8
53 #define PSPSTS_INVALID_BLOB 9
54
55 /* PSP gen1-only. SoCs with PSP gen2 already have the DRAM initialized when
56 the x86 cores are released from reset. */
57 int psp_notify_dram(void);
58
59 int psp_notify_smm(void);
60
61 #if (CONFIG(SOC_AMD_COMMON_BLOCK_PSP_SMI))
62 void psp_smi_handler(void);
63 #else
64 static inline void psp_smi_handler(void) {}
65 #endif
66
67 /*
68 * type: identical to the corresponding PSP command, e.g. pass
69 * MBOX_BIOS_CMD_SMU_FW2 to load SMU FW2 blob.
70 * name: cbfs file name
71 */
72 enum psp_blob_type {
73 BLOB_SMU_FW,
74 BLOB_SMU_FW2,
75 };
76
77 /*
78 * Notify PSP that the system is entering a sleep state. sleep_state uses the
79 * same definition as Pm1Cnt[SlpTyp], typically 0, 1, 3, 4, 5.
80 */
81 void psp_notify_sx_info(uint8_t sleep_type);
82
83 int psp_load_named_blob(enum psp_blob_type type, const char *name);
84
85 /* Sets the GPIO used for the TPM IRQ */
86 void psp_set_tpm_irq_gpio(unsigned int gpio);
87
88 /* Returns the fTPM base address, 0 on error. */
89 uintptr_t psp_ftpm_base_address(void);
90
91 /* Returns true when the fTPM CRB interface is enabled */
92 bool psp_ftpm_is_active(void);
93
94 /* Returns required recovery actions to be taken */
95 void psp_ftpm_needs_recovery(bool *psp_rpmc_nvram,
96 bool *psp_nvram,
97 bool *psp_dir);
98
99 #endif /* AMD_BLOCK_PSP_H */