summaryrefslogtreecommitdiff
path: root/libpeci/peci.c
diff options
context:
space:
mode:
authorJason M. Bills <jason.m.bills@linux.intel.com>2019-11-22 19:35:23 +0300
committerBills, Jason M <jason.m.bills@intel.com>2019-11-26 00:07:31 +0300
commita980a67c483738ca63aab52dcb0fb8c3044d9e52 (patch)
treefb32dc045f72fd3a282d102d9bd5d2d0c2ed24af /libpeci/peci.c
parentc83fd07531425531af219d919bfd01fd8bce8790 (diff)
downloadprovingground-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>
Diffstat (limited to 'libpeci/peci.c')
-rw-r--r--libpeci/peci.c21
1 files changed, 15 insertions, 6 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;
}