1 /* SPDX-License-Identifier: GPL-2.0-only */
8 #define ME_RETRY 100000 /* 1 second */
9 #define ME_DELAY 10 /* 10 us */
12 * Management Engine PCI registers
15 #define PCI_CPU_DEVICE PCI_DEV(0,0,0)
16 #define PCI_CPU_MEBASE_L 0x70 /* Set by MRC */
17 #define PCI_CPU_MEBASE_H 0x74 /* Set by MRC */
19 #define PCI_ME_HFS 0x40
20 #define ME_HFS_CWS_RESET 0
21 #define ME_HFS_CWS_INIT 1
22 #define ME_HFS_CWS_REC 2
23 #define ME_HFS_CWS_NORMAL 5
24 #define ME_HFS_CWS_WAIT 6
25 #define ME_HFS_CWS_TRANS 7
26 #define ME_HFS_CWS_INVALID 8
27 #define ME_HFS_STATE_PREBOOT 0
28 #define ME_HFS_STATE_M0_UMA 1
29 #define ME_HFS_STATE_M3 4
30 #define ME_HFS_STATE_M0 5
31 #define ME_HFS_STATE_BRINGUP 6
32 #define ME_HFS_STATE_ERROR 7
33 #define ME_HFS_ERROR_NONE 0
34 #define ME_HFS_ERROR_UNCAT 1
35 #define ME_HFS_ERROR_IMAGE 3
36 #define ME_HFS_ERROR_DEBUG 4
37 #define ME_HFS_MODE_NORMAL 0
38 #define ME_HFS_MODE_DEBUG 2
39 #define ME_HFS_MODE_DIS 3
40 #define ME_HFS_MODE_OVER_JMPR 4
41 #define ME_HFS_MODE_OVER_MEI 5
42 #define ME_HFS_BIOS_DRAM_ACK 1
43 #define ME_HFS_ACK_NO_DID 0
44 #define ME_HFS_ACK_RESET 1
45 #define ME_HFS_ACK_PWR_CYCLE 2
46 #define ME_HFS_ACK_S3 3
47 #define ME_HFS_ACK_S4 4
48 #define ME_HFS_ACK_S5 5
49 #define ME_HFS_ACK_GBL_RESET 6
50 #define ME_HFS_ACK_CONTINUE 7
56 u32 operation_state
: 3;
57 u32 fw_init_complete
: 1;
59 u32 update_in_progress
: 1;
61 u32 operation_mode
: 4;
63 u32 boot_options_present
: 1;
68 #define PCI_ME_UMA 0x44
78 #define PCI_ME_H_GS 0x4c
79 #define ME_INIT_DONE 1
80 #define ME_INIT_STATUS_SUCCESS 0
81 #define ME_INIT_STATUS_NOMEM 1
82 #define ME_INIT_STATUS_ERROR 2
91 #define PCI_ME_GMES 0x48
92 #define ME_GMES_PHASE_ROM 0
93 #define ME_GMES_PHASE_BUP 1
94 #define ME_GMES_PHASE_UKERNEL 2
95 #define ME_GMES_PHASE_POLICY 3
96 #define ME_GMES_PHASE_MODULE 4
97 #define ME_GMES_PHASE_UNKNOWN 5
98 #define ME_GMES_PHASE_HOST 6
101 u32 bist_in_prog
: 1;
102 u32 icc_prog_sts
: 2;
104 u32 cpu_replaced_sts
: 1;
107 u32 warm_rst_req_for_df
: 1;
108 u32 cpu_replaced_valid
: 1;
112 u32 current_state
: 8;
113 u32 current_pmevent
: 4;
114 u32 progress_code
: 4;
117 #define PCI_ME_HERES 0xbc
118 #define PCI_ME_EXT_SHA1 0x00
119 #define PCI_ME_EXT_SHA256 0x02
120 #define PCI_ME_HER(x) (0xc0+(4*(x)))
123 u32 extend_reg_algorithm
: 4;
125 u32 extend_feature_present
: 1;
126 u32 extend_reg_valid
: 1;
130 * Management Engine MEI registers
133 #define MEI_H_CB_WW 0x00
134 #define MEI_H_CSR 0x04
135 #define MEI_ME_CB_RW 0x08
136 #define MEI_ME_CSR_HA 0x0c
139 u32 interrupt_enable
: 1;
140 u32 interrupt_status
: 1;
141 u32 interrupt_generate
: 1;
145 u32 buffer_read_ptr
: 8;
146 u32 buffer_write_ptr
: 8;
150 #define MEI_ADDRESS_CORE 0x01
151 #define MEI_ADDRESS_AMT 0x02
152 #define MEI_ADDRESS_RESERVED 0x03
153 #define MEI_ADDRESS_WDT 0x04
154 #define MEI_ADDRESS_MKHI 0x07
155 #define MEI_ADDRESS_ICC 0x08
156 #define MEI_ADDRESS_THERMAL 0x09
158 #define MEI_HOST_ADDRESS 0
161 u32 client_address
: 8;
168 #define MKHI_GROUP_ID_CBM 0x00
169 #define MKHI_GROUP_ID_FWCAPS 0x03
170 #define MKHI_GROUP_ID_MDES 0x08
171 #define MKHI_GROUP_ID_GEN 0xff
173 #define MKHI_GLOBAL_RESET 0x0b
175 #define MKHI_FWCAPS_GET_RULE 0x02
177 #define MKHI_MDES_ENABLE 0x09
179 #define MKHI_GET_FW_VERSION 0x02
180 #define MKHI_SET_UMA 0x08
181 #define MKHI_END_OF_POST 0x0c
182 #define MKHI_FEATURE_OVERRIDE 0x14
192 struct me_fw_version
{
195 u16 code_build_number
;
199 u16 recovery_build_number
;
200 u16 recovery_hot_fix
;
203 #define HECI_EOP_STATUS_SUCCESS 0x0
204 #define HECI_EOP_PERFORM_GLOBAL_RESET 0x1
206 #define CBM_RR_GLOBAL_RESET 0x01
208 #define GLOBAL_RESET_BIOS_MRC 0x01
209 #define GLOBAL_RESET_BIOS_POST 0x02
210 #define GLOBAL_RESET_MEBX 0x03
212 struct me_global_reset
{
221 ME_RECOVERY_BIOS_PATH
,
222 ME_DISABLE_BIOS_PATH
,
223 ME_FIRMWARE_UPDATE_BIOS_PATH
,
226 /* Defined in me_status.c for both romstage and ramstage */
227 void intel_me_status(struct me_hfs
*hfs
, struct me_gmes
*gmes
);
229 void intel_early_me_status(void);
230 int intel_early_me_init(void);
231 int intel_early_me_uma_size(void);
232 int intel_early_me_init_done(u8 status
);
234 void setup_heci_uma(u64 heci_uma_addr
, unsigned int heci_uma_size
);
237 u32 major_version
: 16;
238 u32 minor_version
: 16;
239 u32 hotfix_version
: 16;
240 u32 build_version
: 16;
241 } __packed mbp_fw_version_name
;
245 u8 icc_profile_soft_strap
;
246 u8 icc_profile_index
;
248 u32 register_lock_mask
[3];
249 } __packed mbp_icc_profile
;
254 u32 manageability
: 1;
255 u32 small_business
: 1;
256 u32 l3manageability
: 1;
261 u32 icc_over_clocking
: 1;
272 } __packed mefwcaps_sku
;
276 u16 authenticate_module
: 1;
277 u16 s3authentication
: 1;
278 u16 flash_wear_out
: 1;
279 u16 flash_variable_security
: 1;
280 u16 wwan3gpresent
: 1;
283 } __packed tdt_state_flag
;
287 u8 last_theft_trigger
;
288 tdt_state_flag flags
;
289 } __packed tdt_state_info
;
292 u32 platform_target_usage_type
: 4;
293 u32 platform_target_market_type
: 2;
296 u32 intel_me_fw_image_type
: 4;
297 u32 platform_brand
: 4;
299 } __packed platform_type_rule_data
;
302 mefwcaps_sku fw_capabilities
;
310 } __packed mbp_rom_bist_data
;
317 platform_type_rule_data rule_data
;
322 mbp_fw_version_name fw_version_name
;
323 mbp_fw_caps fw_caps_sku
;
324 mbp_rom_bist_data rom_bist_data
;
325 mbp_platform_key platform_key
;
326 mbp_plat_type fw_plat_type
;
327 mbp_icc_profile icc_profile
;
328 tdt_state_info at_state
;
336 } __packed mbp_header
;
343 } __packed mbp_item_header
;
348 mefwcaps_sku caps_sku
;
352 #endif /* _INTEL_ME_H */