blob: c8e7ef4b9341ba894f443de62c5eb53b9e4cb015 [file] [log] [blame]
Zheng Baoc5e28ab2020-10-28 11:38:09 +08001/* SPDX-License-Identifier: GPL-2.0-only */
2
3#ifndef _AMD_FW_TOOL_H_
4#define _AMD_FW_TOOL_H_
5
Zheng Baoc5e28ab2020-10-28 11:38:09 +08006typedef enum _amd_fw_type {
7 AMD_FW_PSP_PUBKEY = 0,
8 AMD_FW_PSP_BOOTLOADER = 1,
9 AMD_FW_PSP_SMU_FIRMWARE = 8,
10 AMD_FW_PSP_RECOVERY = 3,
11 AMD_FW_PSP_RTM_PUBKEY = 5,
12 AMD_FW_PSP_SECURED_OS = 2,
13 AMD_FW_PSP_NVRAM = 4,
14 AMD_FW_PSP_SECURED_DEBUG = 9,
15 AMD_FW_PSP_TRUSTLETS = 12,
16 AMD_FW_PSP_TRUSTLETKEY = 13,
17 AMD_FW_PSP_SMU_FIRMWARE2 = 18,
18 AMD_PSP_FUSE_CHAIN = 11,
19 AMD_FW_PSP_SMUSCS = 95,
20 AMD_DEBUG_UNLOCK = 0x13,
Zheng Baobf29a0d2020-12-03 23:00:48 +080021 AMD_HW_IPCFG = 0x20,
Zheng Baoc5e28ab2020-10-28 11:38:09 +080022 AMD_WRAPPED_IKEK = 0x21,
23 AMD_TOKEN_UNLOCK = 0x22,
24 AMD_SEC_GASKET = 0x24,
25 AMD_MP2_FW = 0x25,
26 AMD_DRIVER_ENTRIES = 0x28,
Zheng Baobf29a0d2020-12-03 23:00:48 +080027 AMD_FW_KVM_IMAGE = 0x29,
Zheng Baoc5e28ab2020-10-28 11:38:09 +080028 AMD_S0I3_DRIVER = 0x2d,
29 AMD_ABL0 = 0x30,
30 AMD_ABL1 = 0x31,
31 AMD_ABL2 = 0x32,
32 AMD_ABL3 = 0x33,
33 AMD_ABL4 = 0x34,
34 AMD_ABL5 = 0x35,
35 AMD_ABL6 = 0x36,
36 AMD_ABL7 = 0x37,
37 AMD_FW_PSP_WHITELIST = 0x3a,
Zheng Baobf29a0d2020-12-03 23:00:48 +080038 AMD_VBIOS_BTLOADER = 0x3c,
Zheng Baoc5e28ab2020-10-28 11:38:09 +080039 AMD_FW_L2_PTR = 0x40,
Zheng Baobf29a0d2020-12-03 23:00:48 +080040 AMD_FW_USB_PHY = 0x44,
41 AMD_FW_TOS_SEC_POLICY = 0x45,
42 AMD_FW_DRTM_TA = 0x47,
43 AMD_FW_KEYDB_BL = 0x50,
44 AMD_FW_KEYDB_TOS = 0x51,
Zheng Baoc5e28ab2020-10-28 11:38:09 +080045 AMD_FW_PSP_VERSTAGE = 0x52,
46 AMD_FW_VERSTAGE_SIG = 0x53,
Zheng Baobf29a0d2020-12-03 23:00:48 +080047 AMD_RPMC_NVRAM = 0x54,
48 AMD_FW_DMCU_ERAM = 0x58,
49 AMD_FW_DMCU_ISR = 0x59,
Zheng Baob993cb22021-02-02 18:48:23 +080050 AMD_FW_PSP_BOOTLOADER_AB = 0x73,
Zheng Baoc5e28ab2020-10-28 11:38:09 +080051 AMD_FW_IMC = 0x200, /* Large enough to be larger than the top BHD entry type. */
52 AMD_FW_GEC,
53 AMD_FW_XHCI,
54 AMD_FW_INVALID, /* Real last one to detect the last entry in table. */
55 AMD_FW_SKIP /* This is for non-applicable options. */
56} amd_fw_type;
57
58typedef enum _amd_bios_type {
Zheng Baobf29a0d2020-12-03 23:00:48 +080059 AMD_BIOS_RTM_PUBKEY = 5,
Zheng Baoc5e28ab2020-10-28 11:38:09 +080060 AMD_BIOS_APCB = 0x60,
61 AMD_BIOS_APOB = 0x61,
62 AMD_BIOS_BIN = 0x62,
63 AMD_BIOS_APOB_NV = 0x63,
64 AMD_BIOS_PMUI = 0x64,
65 AMD_BIOS_PMUD = 0x65,
66 AMD_BIOS_UCODE = 0x66,
67 AMD_BIOS_APCB_BK = 0x68,
68 AMD_BIOS_MP2_CFG = 0x6a,
69 AMD_BIOS_PSP_SHARED_MEM = 0x6b,
70 AMD_BIOS_L2_PTR = 0x70,
71 AMD_BIOS_INVALID,
72 AMD_BIOS_SKIP
73} amd_bios_type;
74
75
76#define BDT_LVL1 0x1
77#define BDT_LVL2 0x2
78#define BDT_BOTH (BDT_LVL1 | BDT_LVL2)
79typedef struct _amd_bios_entry {
80 amd_bios_type type;
81 char *filename;
82 int subpr;
83 int region_type;
84 int reset;
85 int copy;
86 int ro;
87 int zlib;
88 int inst;
89 uint64_t src;
90 uint64_t dest;
91 size_t size;
92 int level;
93} amd_bios_entry;
94
95
96#define PSP_LVL1 0x1
97#define PSP_LVL2 0x2
98#define PSP_BOTH (PSP_LVL1 | PSP_LVL2)
99typedef struct _amd_fw_entry {
100 amd_fw_type type;
101 char *filename;
102 uint8_t subprog;
103 int level;
104 uint64_t other;
105} amd_fw_entry;
106
107typedef struct _amd_cb_config {
108 uint8_t have_whitelist;
109 uint8_t unlock_secure;
110 uint8_t use_secureos;
111 uint8_t load_mp2_fw;
112 uint8_t s0i3;
113} amd_cb_config;
114
115void register_fw_fuse(char *str);
116uint8_t process_config(FILE *config, amd_cb_config *cb_config, uint8_t print_deps);
117
118#define OK 0
119
120#define LINE_EOF (1)
121#define LINE_TOO_LONG (2)
122
123
124#endif /* _AMD_FW_TOOL_H_ */