Angel Pons | f5627e8 | 2020-04-05 15:46:52 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Tim Wawrzynczak | d93531b | 2019-04-30 12:52:29 -0600 | [diff] [blame] | 2 | |
| 3 | #include <device/pci_ops.h> |
| 4 | #include <bootstate.h> |
| 5 | #include <commonlib/helpers.h> |
| 6 | #include <console/console.h> |
| 7 | #include <device/pci.h> |
| 8 | #include <intelblocks/cse.h> |
| 9 | #include <soc/me.h> |
| 10 | #include <soc/pci_devs.h> |
| 11 | #include <stdint.h> |
Tim Wawrzynczak | d93531b | 2019-04-30 12:52:29 -0600 | [diff] [blame] | 12 | |
Tim Wawrzynczak | d93531b | 2019-04-30 12:52:29 -0600 | [diff] [blame] | 13 | /* Host Firmware Status Register 2 */ |
Sridhar Siricilla | 182a0ae | 2020-02-19 14:57:04 +0530 | [diff] [blame] | 14 | union me_hfsts2 { |
Angel Pons | bda02b0 | 2020-09-28 01:10:40 +0200 | [diff] [blame] | 15 | uint32_t data; |
Tim Wawrzynczak | d93531b | 2019-04-30 12:52:29 -0600 | [diff] [blame] | 16 | struct { |
| 17 | uint32_t nftp_load_failure : 1; |
| 18 | uint32_t icc_prog_status : 2; |
| 19 | uint32_t invoke_mebx : 1; |
| 20 | uint32_t cpu_replaced : 1; |
| 21 | uint32_t rsvd0 : 1; |
| 22 | uint32_t mfs_failure : 1; |
| 23 | uint32_t warm_reset_rqst : 1; |
| 24 | uint32_t cpu_replaced_valid : 1; |
| 25 | uint32_t low_power_state : 1; |
| 26 | uint32_t me_power_gate : 1; |
| 27 | uint32_t ipu_needed : 1; |
| 28 | uint32_t forced_safe_boot : 1; |
| 29 | uint32_t rsvd1 : 2; |
| 30 | uint32_t listener_change : 1; |
| 31 | uint32_t status_data : 8; |
| 32 | uint32_t current_pmevent : 4; |
| 33 | uint32_t phase : 4; |
| 34 | } __packed fields; |
| 35 | }; |
| 36 | |
Tim Wawrzynczak | d93531b | 2019-04-30 12:52:29 -0600 | [diff] [blame] | 37 | /* Host Firmware Status Register 4 */ |
Sridhar Siricilla | 182a0ae | 2020-02-19 14:57:04 +0530 | [diff] [blame] | 38 | union me_hfsts4 { |
Angel Pons | bda02b0 | 2020-09-28 01:10:40 +0200 | [diff] [blame] | 39 | uint32_t data; |
Tim Wawrzynczak | d93531b | 2019-04-30 12:52:29 -0600 | [diff] [blame] | 40 | struct { |
| 41 | uint32_t rsvd0 : 9; |
| 42 | uint32_t enforcement_flow : 1; |
| 43 | uint32_t sx_resume_type : 1; |
| 44 | uint32_t rsvd1 : 1; |
| 45 | uint32_t tpms_disconnected : 1; |
| 46 | uint32_t rvsd2 : 1; |
| 47 | uint32_t fwsts_valid : 1; |
| 48 | uint32_t boot_guard_self_test : 1; |
| 49 | uint32_t rsvd3 : 16; |
| 50 | } __packed fields; |
| 51 | }; |
| 52 | |
| 53 | /* Host Firmware Status Register 5 */ |
Sridhar Siricilla | 182a0ae | 2020-02-19 14:57:04 +0530 | [diff] [blame] | 54 | union me_hfsts5 { |
Angel Pons | bda02b0 | 2020-09-28 01:10:40 +0200 | [diff] [blame] | 55 | uint32_t data; |
Tim Wawrzynczak | d93531b | 2019-04-30 12:52:29 -0600 | [diff] [blame] | 56 | struct { |
| 57 | uint32_t acm_active : 1; |
| 58 | uint32_t valid : 1; |
| 59 | uint32_t result_code_source : 1; |
| 60 | uint32_t error_status_code : 5; |
| 61 | uint32_t acm_done_sts : 1; |
| 62 | uint32_t timeout_count : 7; |
| 63 | uint32_t scrtm_indicator : 1; |
| 64 | uint32_t inc_boot_guard_acm : 4; |
| 65 | uint32_t inc_key_manifest : 4; |
| 66 | uint32_t inc_boot_policy : 4; |
| 67 | uint32_t rsvd0 : 2; |
| 68 | uint32_t start_enforcement : 1; |
| 69 | } __packed fields; |
| 70 | }; |
| 71 | |
| 72 | /* Host Firmware Status Register 6 */ |
Sridhar Siricilla | 182a0ae | 2020-02-19 14:57:04 +0530 | [diff] [blame] | 73 | union me_hfsts6 { |
Angel Pons | bda02b0 | 2020-09-28 01:10:40 +0200 | [diff] [blame] | 74 | uint32_t data; |
Tim Wawrzynczak | d93531b | 2019-04-30 12:52:29 -0600 | [diff] [blame] | 75 | struct { |
| 76 | uint32_t force_boot_guard_acm : 1; |
| 77 | uint32_t cpu_debug_disable : 1; |
| 78 | uint32_t bsp_init_disable : 1; |
| 79 | uint32_t protect_bios_env : 1; |
| 80 | uint32_t rsvd0 : 2; |
| 81 | uint32_t error_enforce_policy : 2; |
| 82 | uint32_t measured_boot : 1; |
| 83 | uint32_t verified_boot : 1; |
| 84 | uint32_t boot_guard_acmsvn : 4; |
| 85 | uint32_t kmsvn : 4; |
| 86 | uint32_t bpmsvn : 4; |
| 87 | uint32_t key_manifest_id : 4; |
| 88 | uint32_t boot_policy_status : 1; |
| 89 | uint32_t error : 1; |
| 90 | uint32_t boot_guard_disable : 1; |
| 91 | uint32_t fpf_disable : 1; |
| 92 | uint32_t fpf_soc_lock : 1; |
| 93 | uint32_t txt_support : 1; |
| 94 | } __packed fields; |
| 95 | }; |
| 96 | |
Bora Guvendik | 9637856 | 2019-05-24 14:41:31 -0700 | [diff] [blame] | 97 | void dump_me_status(void *unused) |
Tim Wawrzynczak | d93531b | 2019-04-30 12:52:29 -0600 | [diff] [blame] | 98 | { |
Sridhar Siricilla | b9d075b | 2019-08-31 11:38:33 +0530 | [diff] [blame] | 99 | union me_hfsts1 hfsts1; |
Sridhar Siricilla | 182a0ae | 2020-02-19 14:57:04 +0530 | [diff] [blame] | 100 | union me_hfsts2 hfsts2; |
| 101 | union me_hfsts3 hfsts3; |
| 102 | union me_hfsts4 hfsts4; |
| 103 | union me_hfsts5 hfsts5; |
| 104 | union me_hfsts6 hfsts6; |
Tim Wawrzynczak | d93531b | 2019-04-30 12:52:29 -0600 | [diff] [blame] | 105 | |
Sridhar Siricilla | 2cc6691 | 2019-08-31 11:20:34 +0530 | [diff] [blame] | 106 | if (!is_cse_enabled()) |
| 107 | return; |
| 108 | |
Sridhar Siricilla | b9d075b | 2019-08-31 11:38:33 +0530 | [diff] [blame] | 109 | hfsts1.data = me_read_config32(PCI_ME_HFSTS1); |
Angel Pons | bda02b0 | 2020-09-28 01:10:40 +0200 | [diff] [blame] | 110 | hfsts2.data = me_read_config32(PCI_ME_HFSTS2); |
Sridhar Siricilla | 182a0ae | 2020-02-19 14:57:04 +0530 | [diff] [blame] | 111 | hfsts3.data = me_read_config32(PCI_ME_HFSTS3); |
Angel Pons | bda02b0 | 2020-09-28 01:10:40 +0200 | [diff] [blame] | 112 | hfsts4.data = me_read_config32(PCI_ME_HFSTS4); |
| 113 | hfsts5.data = me_read_config32(PCI_ME_HFSTS5); |
| 114 | hfsts6.data = me_read_config32(PCI_ME_HFSTS6); |
Tim Wawrzynczak | d93531b | 2019-04-30 12:52:29 -0600 | [diff] [blame] | 115 | |
Angel Pons | bda02b0 | 2020-09-28 01:10:40 +0200 | [diff] [blame] | 116 | printk(BIOS_DEBUG, "ME: HFSTS1 : 0x%08X\n", hfsts1.data); |
| 117 | printk(BIOS_DEBUG, "ME: HFSTS2 : 0x%08X\n", hfsts2.data); |
| 118 | printk(BIOS_DEBUG, "ME: HFSTS3 : 0x%08X\n", hfsts3.data); |
| 119 | printk(BIOS_DEBUG, "ME: HFSTS4 : 0x%08X\n", hfsts4.data); |
| 120 | printk(BIOS_DEBUG, "ME: HFSTS5 : 0x%08X\n", hfsts5.data); |
| 121 | printk(BIOS_DEBUG, "ME: HFSTS6 : 0x%08X\n", hfsts6.data); |
Tim Wawrzynczak | d93531b | 2019-04-30 12:52:29 -0600 | [diff] [blame] | 122 | |
| 123 | printk(BIOS_DEBUG, "ME: Manufacturing Mode : %s\n", |
| 124 | hfsts1.fields.mfg_mode ? "YES" : "NO"); |
| 125 | printk(BIOS_DEBUG, "ME: FW Partition Table : %s\n", |
| 126 | hfsts1.fields.fpt_bad ? "BAD" : "OK"); |
| 127 | printk(BIOS_DEBUG, "ME: Bringup Loader Failure : %s\n", |
| 128 | hfsts1.fields.ft_bup_ld_flr ? "YES" : "NO"); |
| 129 | printk(BIOS_DEBUG, "ME: Firmware Init Complete : %s\n", |
| 130 | hfsts1.fields.fw_init_complete ? "YES" : "NO"); |
| 131 | printk(BIOS_DEBUG, "ME: Boot Options Present : %s\n", |
Sridhar Siricilla | b9d075b | 2019-08-31 11:38:33 +0530 | [diff] [blame] | 132 | hfsts1.fields.boot_options_present ? "YES" : "NO"); |
Tim Wawrzynczak | d93531b | 2019-04-30 12:52:29 -0600 | [diff] [blame] | 133 | printk(BIOS_DEBUG, "ME: Update In Progress : %s\n", |
Sridhar Siricilla | b9d075b | 2019-08-31 11:38:33 +0530 | [diff] [blame] | 134 | hfsts1.fields.update_in_progress ? "YES" : "NO"); |
Tim Wawrzynczak | d93531b | 2019-04-30 12:52:29 -0600 | [diff] [blame] | 135 | printk(BIOS_DEBUG, "ME: D0i3 Support : %s\n", |
| 136 | hfsts1.fields.d0i3_support_valid ? "YES" : "NO"); |
| 137 | printk(BIOS_DEBUG, "ME: Low Power State Enabled : %s\n", |
| 138 | hfsts2.fields.low_power_state ? "YES" : "NO"); |
| 139 | printk(BIOS_DEBUG, "ME: CPU Replaced : %s\n", |
| 140 | hfsts2.fields.cpu_replaced ? "YES" : "NO"); |
| 141 | printk(BIOS_DEBUG, "ME: CPU Replacement Valid : %s\n", |
| 142 | hfsts2.fields.cpu_replaced_valid ? "YES" : "NO"); |
| 143 | printk(BIOS_DEBUG, "ME: Current Working State : %u\n", |
| 144 | hfsts1.fields.working_state); |
| 145 | printk(BIOS_DEBUG, "ME: Current Operation State : %u\n", |
| 146 | hfsts1.fields.operation_state); |
| 147 | printk(BIOS_DEBUG, "ME: Current Operation Mode : %u\n", |
| 148 | hfsts1.fields.operation_mode); |
| 149 | printk(BIOS_DEBUG, "ME: Error Code : %u\n", |
| 150 | hfsts1.fields.error_code); |
| 151 | printk(BIOS_DEBUG, "ME: CPU Debug Disabled : %s\n", |
| 152 | hfsts6.fields.cpu_debug_disable ? "YES" : "NO"); |
| 153 | printk(BIOS_DEBUG, "ME: TXT Support : %s\n", |
| 154 | hfsts6.fields.txt_support ? "YES" : "NO"); |
| 155 | } |
Angel Pons | bda02b0 | 2020-09-28 01:10:40 +0200 | [diff] [blame] | 156 | |
Sridhar Siricilla | 24a974a | 2020-02-19 14:41:36 +0530 | [diff] [blame] | 157 | BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_EXIT, print_me_fw_version, NULL); |
Bora Guvendik | 9637856 | 2019-05-24 14:41:31 -0700 | [diff] [blame] | 158 | BOOT_STATE_INIT_ENTRY(BS_OS_RESUME_CHECK, BS_ON_EXIT, dump_me_status, NULL); |