soc/intel/xeon_sp: Move read_msr_ppin() to common util.c
Move CPX and SKX read_msr_ppin() to common util.c file. Update drivers/ocp/smbios #include to match. Change-Id: I4c4281d2d5ce679f5444a502fa88df04de9f2cd8 Signed-off-by: Marc Jones <marcjones@sysproconsulting.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/46479 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jay Talbott <JayTalbott@sysproconsulting.com> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
parent
1f500845b4
commit
53b465d1c1
|
@ -9,7 +9,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <soc/soc_util.h>
|
#include <soc/soc_util.h>
|
||||||
#include <soc/cpu.h>
|
#include <soc/util.h>
|
||||||
#include <smbios.h>
|
#include <smbios.h>
|
||||||
|
|
||||||
#include "ocp_dmi.h"
|
#include "ocp_dmi.h"
|
||||||
|
|
|
@ -205,34 +205,3 @@ void cpx_init_cpus(struct device *dev)
|
||||||
/* update numa domain for all cpu devices */
|
/* update numa domain for all cpu devices */
|
||||||
xeonsp_init_cpu_config();
|
xeonsp_init_cpu_config();
|
||||||
}
|
}
|
||||||
|
|
||||||
msr_t read_msr_ppin(void)
|
|
||||||
{
|
|
||||||
msr_t ppin = {0};
|
|
||||||
msr_t msr;
|
|
||||||
|
|
||||||
/* If MSR_PLATFORM_INFO PPIN_CAP is 0, PPIN capability is not supported */
|
|
||||||
msr = rdmsr(MSR_PLATFORM_INFO);
|
|
||||||
if ((msr.lo & MSR_PPIN_CAP) == 0) {
|
|
||||||
printk(BIOS_ERR, "MSR_PPIN_CAP is 0, PPIN is not supported\n");
|
|
||||||
return ppin;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Access to MSR_PPIN is permitted only if MSR_PPIN_CTL LOCK is 0 and ENABLE is 1 */
|
|
||||||
msr = rdmsr(MSR_PPIN_CTL);
|
|
||||||
if (msr.lo & MSR_PPIN_CTL_LOCK) {
|
|
||||||
printk(BIOS_ERR, "MSR_PPIN_CTL_LOCK is 1, PPIN access is not allowed\n");
|
|
||||||
return ppin;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((msr.lo & MSR_PPIN_CTL_ENABLE) == 0) {
|
|
||||||
/* Set MSR_PPIN_CTL ENABLE to 1 */
|
|
||||||
msr.lo |= MSR_PPIN_CTL_ENABLE;
|
|
||||||
wrmsr(MSR_PPIN_CTL, msr);
|
|
||||||
}
|
|
||||||
ppin = rdmsr(MSR_PPIN);
|
|
||||||
/* Set enable to 0 after reading MSR_PPIN */
|
|
||||||
msr.lo &= ~MSR_PPIN_CTL_ENABLE;
|
|
||||||
wrmsr(MSR_PPIN_CTL, msr);
|
|
||||||
return ppin;
|
|
||||||
}
|
|
||||||
|
|
|
@ -10,6 +10,5 @@
|
||||||
#define CPUID_COOPERLAKE_SP_A1 0x05065b
|
#define CPUID_COOPERLAKE_SP_A1 0x05065b
|
||||||
|
|
||||||
void cpx_init_cpus(struct device *dev);
|
void cpx_init_cpus(struct device *dev);
|
||||||
msr_t read_msr_ppin(void);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3,10 +3,12 @@
|
||||||
#ifndef _XEON_SP_SOC_UTIL_H_
|
#ifndef _XEON_SP_SOC_UTIL_H_
|
||||||
#define _XEON_SP_SOC_UTIL_H_
|
#define _XEON_SP_SOC_UTIL_H_
|
||||||
|
|
||||||
|
#include <cpu/x86/msr.h>
|
||||||
#include <hob_iiouds.h>
|
#include <hob_iiouds.h>
|
||||||
|
|
||||||
void get_cpubusnos(uint32_t *bus0, uint32_t *bus1, uint32_t *bus2, uint32_t *bus3);
|
void get_cpubusnos(uint32_t *bus0, uint32_t *bus1, uint32_t *bus2, uint32_t *bus3);
|
||||||
void unlock_pam_regions(void);
|
void unlock_pam_regions(void);
|
||||||
void get_stack_busnos(uint32_t *bus);
|
void get_stack_busnos(uint32_t *bus);
|
||||||
|
msr_t read_msr_ppin(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -245,34 +245,3 @@ void xeon_sp_init_cpus(struct device *dev)
|
||||||
|
|
||||||
FUNC_EXIT();
|
FUNC_EXIT();
|
||||||
}
|
}
|
||||||
|
|
||||||
msr_t read_msr_ppin(void)
|
|
||||||
{
|
|
||||||
msr_t ppin = {0};
|
|
||||||
msr_t msr;
|
|
||||||
|
|
||||||
/* If MSR_PLATFORM_INFO PPIN_CAP is 0, PPIN capability is not supported */
|
|
||||||
msr = rdmsr(MSR_PLATFORM_INFO);
|
|
||||||
if ((msr.lo & MSR_PPIN_CAP) == 0) {
|
|
||||||
printk(BIOS_ERR, "MSR_PPIN_CAP is 0, PPIN is not supported\n");
|
|
||||||
return ppin;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Access to MSR_PPIN is permitted only if MSR_PPIN_CTL LOCK is 0 and ENABLE is 1 */
|
|
||||||
msr = rdmsr(MSR_PPIN_CTL);
|
|
||||||
if (msr.lo & MSR_PPIN_CTL_LOCK) {
|
|
||||||
printk(BIOS_ERR, "MSR_PPIN_CTL_LOCK is 1, PPIN access is not allowed\n");
|
|
||||||
return ppin;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((msr.lo & MSR_PPIN_CTL_ENABLE) == 0) {
|
|
||||||
/* Set MSR_PPIN_CTL ENABLE to 1 */
|
|
||||||
msr.lo |= MSR_PPIN_CTL_ENABLE;
|
|
||||||
wrmsr(MSR_PPIN_CTL, msr);
|
|
||||||
}
|
|
||||||
ppin = rdmsr(MSR_PPIN);
|
|
||||||
/* Set enable to 0 after reading MSR_PPIN */
|
|
||||||
msr.lo &= ~MSR_PPIN_CTL_ENABLE;
|
|
||||||
wrmsr(MSR_PPIN_CTL, msr);
|
|
||||||
return ppin;
|
|
||||||
}
|
|
||||||
|
|
|
@ -16,6 +16,5 @@
|
||||||
|
|
||||||
int get_cpu_count(void);
|
int get_cpu_count(void);
|
||||||
void xeon_sp_init_cpus(struct device *dev);
|
void xeon_sp_init_cpus(struct device *dev);
|
||||||
msr_t read_msr_ppin(void);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <device/pci.h>
|
#include <device/pci.h>
|
||||||
#include <soc/pci_devs.h>
|
#include <soc/pci_devs.h>
|
||||||
|
#include <soc/msr.h>
|
||||||
#include <soc/util.h>
|
#include <soc/util.h>
|
||||||
|
|
||||||
void get_stack_busnos(uint32_t *bus)
|
void get_stack_busnos(uint32_t *bus)
|
||||||
|
@ -53,3 +54,34 @@ void get_cpubusnos(uint32_t *bus0, uint32_t *bus1, uint32_t *bus2, uint32_t *bus
|
||||||
if (bus3)
|
if (bus3)
|
||||||
*bus3 = (bus >> 24) & 0xff;
|
*bus3 = (bus >> 24) & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
msr_t read_msr_ppin(void)
|
||||||
|
{
|
||||||
|
msr_t ppin = {0};
|
||||||
|
msr_t msr;
|
||||||
|
|
||||||
|
/* If MSR_PLATFORM_INFO PPIN_CAP is 0, PPIN capability is not supported */
|
||||||
|
msr = rdmsr(MSR_PLATFORM_INFO);
|
||||||
|
if ((msr.lo & MSR_PPIN_CAP) == 0) {
|
||||||
|
printk(BIOS_ERR, "MSR_PPIN_CAP is 0, PPIN is not supported\n");
|
||||||
|
return ppin;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Access to MSR_PPIN is permitted only if MSR_PPIN_CTL LOCK is 0 and ENABLE is 1 */
|
||||||
|
msr = rdmsr(MSR_PPIN_CTL);
|
||||||
|
if (msr.lo & MSR_PPIN_CTL_LOCK) {
|
||||||
|
printk(BIOS_ERR, "MSR_PPIN_CTL_LOCK is 1, PPIN access is not allowed\n");
|
||||||
|
return ppin;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((msr.lo & MSR_PPIN_CTL_ENABLE) == 0) {
|
||||||
|
/* Set MSR_PPIN_CTL ENABLE to 1 */
|
||||||
|
msr.lo |= MSR_PPIN_CTL_ENABLE;
|
||||||
|
wrmsr(MSR_PPIN_CTL, msr);
|
||||||
|
}
|
||||||
|
ppin = rdmsr(MSR_PPIN);
|
||||||
|
/* Set enable to 0 after reading MSR_PPIN */
|
||||||
|
msr.lo &= ~MSR_PPIN_CTL_ENABLE;
|
||||||
|
wrmsr(MSR_PPIN_CTL, msr);
|
||||||
|
return ppin;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue