summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIwona Winiarska <iwona.winiarska@intel.com>2020-12-06 16:16:44 +0300
committerIwona Winiarska <iwona.winiarska@intel.com>2020-12-17 12:19:12 +0300
commit9a05ca0a3d97473bf39d28818bd9a1ca2b3e78fe (patch)
treed75730e4399a7ebd07e31ec67f66d18652ef68d6
parente25f94a28a950297018b3f4caebba41a60a46d61 (diff)
downloadlinux-9a05ca0a3d97473bf39d28818bd9a1ca2b3e78fe.tar.xz
peci: Add peci_revision property
Right now, PECI revision is determined using a result of GetDIB() PECI command. Because GetDIB() may not be supported by all type of physical media that provides PECI, we need an alternative. Until we figure how to determine PECI revision there (if we can't do that, we'll fallback to device tree), let's allow to hardcode PECI revision as a property of hardware adapter. Change-Id: Iea75ccae9b9f793c67e996064fff3c31c730ad4f Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com>
-rw-r--r--drivers/peci/peci-core.c35
-rw-r--r--include/linux/peci.h1
2 files changed, 23 insertions, 13 deletions
diff --git a/drivers/peci/peci-core.c b/drivers/peci/peci-core.c
index ba561bf810f9..0fc2f246ada8 100644
--- a/drivers/peci/peci-core.c
+++ b/drivers/peci/peci-core.c
@@ -304,23 +304,32 @@ static int peci_scan_cmd_mask(struct peci_adapter *adapter)
msg->tx_buf[0] = PECI_GET_DIB_CMD;
ret = peci_xfer(adapter, msg);
- if (ret)
- return ret;
+ if (ret || msg->rx_buf[0] == PECI_DEV_CC_INVALID_REQ) {
+ /*
+ * if GetDIB() is not supported, use a revision property of
+ * hardware adapter
+ */
+ if (adapter->peci_revision != 0)
+ revision = adapter->peci_revision;
+ else
+ revision = 0;
+ } else {
+ dib = le64_to_cpup((__le64 *)msg->rx_buf);
- dib = le64_to_cpup((__le64 *)msg->rx_buf);
+ /* Check special case for Get DIB command */
+ if (dib == 0) {
+ dev_dbg(&adapter->dev, "DIB read as 0\n");
+ ret = -EIO;
+ goto out;
+ }
- /* Check special case for Get DIB command */
- if (dib == 0) {
- dev_dbg(&adapter->dev, "DIB read as 0\n");
- ret = -EIO;
- goto out;
+ /*
+ * Setting up the supporting commands based on revision number.
+ * See PECI Spec Table 3-1.
+ */
+ revision = FIELD_GET(REVISION_NUM_MASK, dib);
}
- /*
- * Setting up the supporting commands based on revision number.
- * See PECI Spec Table 3-1.
- */
- revision = FIELD_GET(REVISION_NUM_MASK, dib);
if (revision >= 0x40) { /* Rev. 4.0 */
adapter->cmd_mask |= BIT(PECI_CMD_RD_IA_MSREX);
adapter->cmd_mask |= BIT(PECI_CMD_RD_END_PT_CFG);
diff --git a/include/linux/peci.h b/include/linux/peci.h
index 4bc4595c797d..45cb77d1913c 100644
--- a/include/linux/peci.h
+++ b/include/linux/peci.h
@@ -44,6 +44,7 @@ struct peci_adapter {
struct peci_xfer_msg *msg);
u32 cmd_mask;
bool use_dma;
+ u8 peci_revision;
};
static inline struct peci_adapter *to_peci_adapter(void *d)