diff options
author | Jason M. Bills <jason.m.bills@linux.intel.com> | 2019-11-22 19:35:23 +0300 |
---|---|---|
committer | Bills, Jason M <jason.m.bills@intel.com> | 2019-11-26 00:07:31 +0300 |
commit | a980a67c483738ca63aab52dcb0fb8c3044d9e52 (patch) | |
tree | fb32dc045f72fd3a282d102d9bd5d2d0c2ed24af | |
parent | c83fd07531425531af219d919bfd01fd8bce8790 (diff) | |
download | provingground-a980a67c483738ca63aab52dcb0fb8c3044d9e52.tar.xz |
Separate stepping from model in peci_GetCPUID()
Including the stepping in the CPUID was too granular and was
causing a lot of unnecessary updates to code that uses it.
This change returns the CPU model as the main parameter for
identifying the processor and gives the stepping as a separate
parameter in case it is needed.
Tested:
Combined with the changes in the consumers of this library,
verified that the CPU model can correctly be retreived and
used to determine the correct PECI calls to use.
Change-Id: Ifef3ed4c952bf303bcb43aebb6a013e91719756e
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
-rw-r--r-- | libpeci/peci.c | 21 | ||||
-rw-r--r-- | libpeci/peci.h | 8 |
2 files changed, 17 insertions, 12 deletions
diff --git a/libpeci/peci.c b/libpeci/peci.c index 7e3f5e3..90d68b0 100644 --- a/libpeci/peci.c +++ b/libpeci/peci.c @@ -1134,12 +1134,16 @@ EPECIStatus peci_raw(uint8_t target, uint8_t u8ReadLen, const uint8_t* pRawCmd, } /*------------------------------------------------------------------------- - * This function returns the CPUID for the given PECI client address + * This function returns the CPUID (Model and stepping) for the given PECI + * client address *------------------------------------------------------------------------*/ EPECIStatus peci_GetCPUID(const uint8_t clientAddr, CPUModel* cpuModel, - uint8_t* cc) + uint8_t* stepping, uint8_t* cc) { - if (cpuModel == NULL || cc == NULL) + EPECIStatus ret = PECI_CC_SUCCESS; + uint32_t cpuid = 0; + + if (cpuModel == NULL || stepping == NULL || cc == NULL) { return PECI_CC_INVALID_REQ; } @@ -1149,7 +1153,12 @@ EPECIStatus peci_GetCPUID(const uint8_t clientAddr, CPUModel* cpuModel, return PECI_CC_CPU_NOT_PRESENT; } - return peci_RdPkgConfig(clientAddr, PECI_MBX_INDEX_CPU_ID, - PECI_PKG_ID_CPU_ID, sizeof(uint32_t), - (uint8_t*)cpuModel, cc); + ret = + peci_RdPkgConfig(clientAddr, PECI_MBX_INDEX_CPU_ID, PECI_PKG_ID_CPU_ID, + sizeof(uint32_t), (uint8_t*)&cpuid, cc); + + // Separate out the model and stepping (bits 3:0) from the CPUID + *cpuModel = cpuid & 0xFFFFFFF0; + *stepping = (uint8_t)(cpuid & 0x0000000F); + return ret; } diff --git a/libpeci/peci.h b/libpeci/peci.h index b68ea6c..81fba95 100644 --- a/libpeci/peci.h +++ b/libpeci/peci.h @@ -32,12 +32,8 @@ extern "C" { typedef enum { - skx = 0x00050654, - clx = 0x00050656, - clx2 = 0x00050657, - cpx = 0x0005065A, + skx = 0x00050650, icx = 0x000606A0, - icx2 = 0x000606A4, } CPUModel; // PECI Status Codes @@ -235,7 +231,7 @@ void peci_Unlock(int peci_fd); EPECIStatus peci_Ping(uint8_t target); EPECIStatus peci_Ping_seq(uint8_t target, int peci_fd); EPECIStatus peci_GetCPUID(const uint8_t clientAddr, CPUModel* cpuModel, - uint8_t* cc); + uint8_t* stepping, uint8_t* cc); #ifdef __cplusplus } |