soc/intel/pantherlake: Remove soc_info.[hc] interface
[coreboot2.git] / src / soc / intel / common / block / cse / cse_spec.c
blobaf64255514d56d845947caa76481429f1fd625ad
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <bootstate.h>
4 #include <intelblocks/cse.h>
5 #include <intelblocks/me.h>
6 #include <console/console.h>
7 #include <stdint.h>
9 /*
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));
22 #else
23 return !((hfsts1.fields.mfg_mode == 0) &&
24 (hfsts6.fields.fpf_soc_lock == 1) &&
25 (hfsts6.fields.manuf_lock == 1));
26 #endif
29 static void dump_me_status(void *unused)
31 if (CONFIG(SOC_INTEL_CSE_LITE_SYNC_BY_PAYLOAD))
32 return;
34 union me_hfsts1 hfsts1;
35 union me_hfsts2 hfsts2;
36 union me_hfsts3 hfsts3;
37 union me_hfsts4 hfsts4;
38 union me_hfsts5 hfsts5;
39 union me_hfsts6 hfsts6;
40 bool manufacturing_mode;
42 if (!is_cse_enabled())
43 return;
45 hfsts1.data = me_read_config32(PCI_ME_HFSTS1);
46 hfsts2.data = me_read_config32(PCI_ME_HFSTS2);
47 hfsts3.data = me_read_config32(PCI_ME_HFSTS3);
48 hfsts4.data = me_read_config32(PCI_ME_HFSTS4);
49 hfsts5.data = me_read_config32(PCI_ME_HFSTS5);
50 hfsts6.data = me_read_config32(PCI_ME_HFSTS6);
52 printk(BIOS_DEBUG, "ME: HFSTS1 : 0x%08X\n", hfsts1.data);
53 printk(BIOS_DEBUG, "ME: HFSTS2 : 0x%08X\n", hfsts2.data);
54 printk(BIOS_DEBUG, "ME: HFSTS3 : 0x%08X\n", hfsts3.data);
55 printk(BIOS_DEBUG, "ME: HFSTS4 : 0x%08X\n", hfsts4.data);
56 printk(BIOS_DEBUG, "ME: HFSTS5 : 0x%08X\n", hfsts5.data);
57 printk(BIOS_DEBUG, "ME: HFSTS6 : 0x%08X\n", hfsts6.data);
59 manufacturing_mode = is_manufacturing_mode(hfsts1, hfsts6);
60 printk(BIOS_DEBUG, "ME: Manufacturing Mode : %s\n",
61 manufacturing_mode ? "YES" : "NO");
63 * The SPI Protection Mode bit reflects SPI descriptor
64 * locked(0) or unlocked(1).
66 printk(BIOS_DEBUG, "ME: SPI Protection Mode Enabled : %s\n",
67 hfsts1.fields.mfg_mode ? "NO" : "YES");
68 printk(BIOS_DEBUG, "ME: FW Partition Table : %s\n",
69 hfsts1.fields.fpt_bad ? "BAD" : "OK");
70 printk(BIOS_DEBUG, "ME: Bringup Loader Failure : %s\n",
71 hfsts1.fields.ft_bup_ld_flr ? "YES" : "NO");
72 printk(BIOS_DEBUG, "ME: Firmware Init Complete : %s\n",
73 hfsts1.fields.fw_init_complete ? "YES" : "NO");
74 printk(BIOS_DEBUG, "ME: Boot Options Present : %s\n",
75 hfsts1.fields.boot_options_present ? "YES" : "NO");
76 printk(BIOS_DEBUG, "ME: Update In Progress : %s\n",
77 hfsts1.fields.update_in_progress ? "YES" : "NO");
78 printk(BIOS_DEBUG, "ME: D0i3 Support : %s\n",
79 hfsts1.fields.d0i3_support_valid ? "YES" : "NO");
80 printk(BIOS_DEBUG, "ME: Low Power State Enabled : %s\n",
81 hfsts2.fields.low_power_state ? "YES" : "NO");
82 printk(BIOS_DEBUG, "ME: CPU Replaced : %s\n",
83 hfsts2.fields.cpu_replaced ? "YES" : "NO");
84 printk(BIOS_DEBUG, "ME: CPU Replacement Valid : %s\n",
85 hfsts2.fields.cpu_replaced_valid ? "YES" : "NO");
86 printk(BIOS_DEBUG, "ME: Current Working State : %u\n",
87 hfsts1.fields.working_state);
88 printk(BIOS_DEBUG, "ME: Current Operation State : %u\n",
89 hfsts1.fields.operation_state);
90 printk(BIOS_DEBUG, "ME: Current Operation Mode : %u\n",
91 hfsts1.fields.operation_mode);
92 printk(BIOS_DEBUG, "ME: Error Code : %u\n",
93 hfsts1.fields.error_code);
94 #if CONFIG_ME_SPEC >= 15
95 printk(BIOS_DEBUG, "ME: FPFs Committed : %s\n",
96 hfsts6.fields.fpf_soc_lock ? "YES" : "NO");
97 printk(BIOS_DEBUG, "ME: Enhanced Debug Mode : %s\n",
98 hfsts1.fields.invoke_enhance_dbg_mode ? "YES" : "NO");
99 #endif
101 #if CONFIG_ME_SPEC <= 16
102 printk(BIOS_DEBUG, "ME: CPU Debug Disabled : %s\n",
103 hfsts6.fields.cpu_debug_disable ? "YES" : "NO");
104 printk(BIOS_DEBUG, "ME: TXT Support : %s\n",
105 hfsts6.fields.txt_support ? "YES" : "NO");
106 #else
107 printk(BIOS_DEBUG, "ME: CPU Debug Disabled : %s\n",
108 hfsts5.fields.cpu_debug_disabled ? "YES" : "NO");
109 printk(BIOS_DEBUG, "ME: TXT Support : %s\n",
110 hfsts5.fields.txt_support ? "YES" : "NO");
111 #endif
113 #if CONFIG_ME_SPEC >= 16
114 printk(BIOS_DEBUG, "ME: Manufacturing Vars Locked : %s\n",
115 hfsts6.fields.manuf_lock ? "YES" : "NO");
116 if (CONFIG(SOC_INTEL_CSE_LITE_SKU))
117 cse_log_ro_write_protection_info(manufacturing_mode);
118 #endif
121 BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_EXIT, print_me_fw_version, NULL);
122 BOOT_STATE_INIT_ENTRY(BS_OS_RESUME_CHECK, BS_ON_EXIT, dump_me_status, NULL);