1 /* SPDX-License-Identifier: GPL-2.0-only */
4 #include <intelblocks/cse.h>
5 #include <intelblocks/me.h>
6 #include <console/console.h>
10 * This function returns state of manufacturing mode.
12 * ME manufacturing mode is disabled if the descriptor is locked and fuses
13 * are programmed. Additionally, if the SoC supports manufacturing variable, should be locked.
15 static bool is_manufacturing_mode(union me_hfsts1 hfsts1
, union me_hfsts6 hfsts6
)
17 #if CONFIG_ME_SPEC <= 13
18 return !(hfsts1
.fields
.mfg_mode
== 0);
19 #elif CONFIG_ME_SPEC <= 15
20 return !((hfsts1
.fields
.mfg_mode
== 0) &&
21 (hfsts6
.fields
.fpf_soc_lock
== 1));
23 return !((hfsts1
.fields
.mfg_mode
== 0) &&
24 (hfsts6
.fields
.fpf_soc_lock
== 1) &&
25 (hfsts6
.fields
.manuf_lock
== 1));
29 static void dump_me_status(void *unused
)
31 union me_hfsts1 hfsts1
;
32 union me_hfsts2 hfsts2
;
33 union me_hfsts3 hfsts3
;
34 union me_hfsts4 hfsts4
;
35 union me_hfsts5 hfsts5
;
36 union me_hfsts6 hfsts6
;
37 bool manufacturing_mode
;
39 if (!is_cse_enabled())
42 hfsts1
.data
= me_read_config32(PCI_ME_HFSTS1
);
43 hfsts2
.data
= me_read_config32(PCI_ME_HFSTS2
);
44 hfsts3
.data
= me_read_config32(PCI_ME_HFSTS3
);
45 hfsts4
.data
= me_read_config32(PCI_ME_HFSTS4
);
46 hfsts5
.data
= me_read_config32(PCI_ME_HFSTS5
);
47 hfsts6
.data
= me_read_config32(PCI_ME_HFSTS6
);
49 printk(BIOS_DEBUG
, "ME: HFSTS1 : 0x%08X\n", hfsts1
.data
);
50 printk(BIOS_DEBUG
, "ME: HFSTS2 : 0x%08X\n", hfsts2
.data
);
51 printk(BIOS_DEBUG
, "ME: HFSTS3 : 0x%08X\n", hfsts3
.data
);
52 printk(BIOS_DEBUG
, "ME: HFSTS4 : 0x%08X\n", hfsts4
.data
);
53 printk(BIOS_DEBUG
, "ME: HFSTS5 : 0x%08X\n", hfsts5
.data
);
54 printk(BIOS_DEBUG
, "ME: HFSTS6 : 0x%08X\n", hfsts6
.data
);
56 manufacturing_mode
= is_manufacturing_mode(hfsts1
, hfsts6
);
57 printk(BIOS_DEBUG
, "ME: Manufacturing Mode : %s\n",
58 manufacturing_mode
? "YES" : "NO");
60 * The SPI Protection Mode bit reflects SPI descriptor
61 * locked(0) or unlocked(1).
63 printk(BIOS_DEBUG
, "ME: SPI Protection Mode Enabled : %s\n",
64 hfsts1
.fields
.mfg_mode
? "NO" : "YES");
65 printk(BIOS_DEBUG
, "ME: FW Partition Table : %s\n",
66 hfsts1
.fields
.fpt_bad
? "BAD" : "OK");
67 printk(BIOS_DEBUG
, "ME: Bringup Loader Failure : %s\n",
68 hfsts1
.fields
.ft_bup_ld_flr
? "YES" : "NO");
69 printk(BIOS_DEBUG
, "ME: Firmware Init Complete : %s\n",
70 hfsts1
.fields
.fw_init_complete
? "YES" : "NO");
71 printk(BIOS_DEBUG
, "ME: Boot Options Present : %s\n",
72 hfsts1
.fields
.boot_options_present
? "YES" : "NO");
73 printk(BIOS_DEBUG
, "ME: Update In Progress : %s\n",
74 hfsts1
.fields
.update_in_progress
? "YES" : "NO");
75 printk(BIOS_DEBUG
, "ME: D0i3 Support : %s\n",
76 hfsts1
.fields
.d0i3_support_valid
? "YES" : "NO");
77 printk(BIOS_DEBUG
, "ME: Low Power State Enabled : %s\n",
78 hfsts2
.fields
.low_power_state
? "YES" : "NO");
79 printk(BIOS_DEBUG
, "ME: CPU Replaced : %s\n",
80 hfsts2
.fields
.cpu_replaced
? "YES" : "NO");
81 printk(BIOS_DEBUG
, "ME: CPU Replacement Valid : %s\n",
82 hfsts2
.fields
.cpu_replaced_valid
? "YES" : "NO");
83 printk(BIOS_DEBUG
, "ME: Current Working State : %u\n",
84 hfsts1
.fields
.working_state
);
85 printk(BIOS_DEBUG
, "ME: Current Operation State : %u\n",
86 hfsts1
.fields
.operation_state
);
87 printk(BIOS_DEBUG
, "ME: Current Operation Mode : %u\n",
88 hfsts1
.fields
.operation_mode
);
89 printk(BIOS_DEBUG
, "ME: Error Code : %u\n",
90 hfsts1
.fields
.error_code
);
91 #if CONFIG_ME_SPEC >= 15
92 printk(BIOS_DEBUG
, "ME: FPFs Committed : %s\n",
93 hfsts6
.fields
.fpf_soc_lock
? "YES" : "NO");
94 printk(BIOS_DEBUG
, "ME: Enhanced Debug Mode : %s\n",
95 hfsts1
.fields
.invoke_enhance_dbg_mode
? "YES" : "NO");
98 #if CONFIG_ME_SPEC <= 16
99 printk(BIOS_DEBUG
, "ME: CPU Debug Disabled : %s\n",
100 hfsts6
.fields
.cpu_debug_disable
? "YES" : "NO");
101 printk(BIOS_DEBUG
, "ME: TXT Support : %s\n",
102 hfsts6
.fields
.txt_support
? "YES" : "NO");
104 printk(BIOS_DEBUG
, "ME: CPU Debug Disabled : %s\n",
105 hfsts5
.fields
.cpu_debug_disabled
? "YES" : "NO");
106 printk(BIOS_DEBUG
, "ME: TXT Support : %s\n",
107 hfsts5
.fields
.txt_support
? "YES" : "NO");
110 #if CONFIG_ME_SPEC >= 16
111 printk(BIOS_DEBUG
, "ME: Manufacturing Vars Locked : %s\n",
112 hfsts6
.fields
.manuf_lock
? "YES" : "NO");
113 if (CONFIG(SOC_INTEL_CSE_LITE_SKU
))
114 cse_log_ro_write_protection_info(manufacturing_mode
);
118 BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE
, BS_ON_EXIT
, print_me_fw_version
, NULL
);
119 BOOT_STATE_INIT_ENTRY(BS_OS_RESUME_CHECK
, BS_ON_EXIT
, dump_me_status
, NULL
);