diff options
Diffstat (limited to 'src/soc/intel/xeon_sp/smihandler.c')
-rw-r--r-- | src/soc/intel/xeon_sp/smihandler.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/soc/intel/xeon_sp/smihandler.c b/src/soc/intel/xeon_sp/smihandler.c index cb8658f694..4362c6a906 100644 --- a/src/soc/intel/xeon_sp/smihandler.c +++ b/src/soc/intel/xeon_sp/smihandler.c @@ -5,6 +5,7 @@ #include <console/uart.h> #include <cpu/x86/smm.h> #include <device/pci.h> +#include <device/pci_ids.h> #include <drivers/uart/uart8250reg.h> #include <intelblocks/smihandler.h> #include <soc/pci_devs.h> @@ -55,18 +56,26 @@ void smm_soc_exit(void) */ void smihandler_soc_at_finalize(void) { + const volatile struct smm_pci_resource_info *res_store; + size_t res_count, found = 0; + u32 val; + /* SMM_FEATURE_CONTROL can only be written within SMM. */ - printk(BIOS_DEBUG, "Lock SMM_FEATURE_CONTROL\n"); - pci_devfn_t pcie_offset = soc_get_ubox_pmon_dev(); - if (!pcie_offset) { - printk(BIOS_ERR, "UBOX PMON is not found, cannot lock SMM_FEATURE_CONTROL!\n"); - return; - } + smm_pci_get_stored_resources(&res_store, &res_count); + for (size_t i_slot = 0; i_slot < res_count; i_slot++) { + if (res_store[i_slot].vendor_id != PCI_VID_INTEL || + res_store[i_slot].device_id != UBOX_DFX_DEVID) { + continue; + } - u32 val; - val = pci_s_read_config32(pcie_offset, SMM_FEATURE_CONTROL); - val |= (SMM_CODE_CHK_EN | SMM_FEATURE_CONTROL_LOCK); - pci_s_write_config32(pcie_offset, SMM_FEATURE_CONTROL, val); + val = pci_s_read_config32(res_store[i_slot].pci_addr, SMM_FEATURE_CONTROL); + val |= (SMM_CODE_CHK_EN | SMM_FEATURE_CONTROL_LOCK); + pci_s_write_config32(res_store[i_slot].pci_addr, SMM_FEATURE_CONTROL, val); + found ++; + } + printk(BIOS_DEBUG, "Locked SMM_FEATURE_CONTROL on %zd sockets\n", found); + if (!found) + printk(BIOS_ERR, "Failed to lock SMM_FEATURE_CONTROL\n"); } /* |