summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIwona Winiarska <iwona.winiarska@intel.com>2020-12-06 16:16:44 +0300
committerJae Hyun Yoo <jae.hyun.yoo@intel.com>2021-07-14 20:04:18 +0300
commit031d4a619b8a7832d3344365ac6d4dd9351ef58c (patch)
tree4751bdf472fc16f2ea31ea77a5a0e5f6faa82a95
parent15f3e740407062eb5c37092b18976345b2d73fd3 (diff)
downloadlinux-031d4a619b8a7832d3344365ac6d4dd9351ef58c.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. Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com>
-rw-r--r--drivers/peci/peci-core.c36
-rw-r--r--include/linux/peci.h1
2 files changed, 24 insertions, 13 deletions
diff --git a/drivers/peci/peci-core.c b/drivers/peci/peci-core.c
index 72f53c85b673..f4c89d9e94f2 100644
--- a/drivers/peci/peci-core.c
+++ b/drivers/peci/peci-core.c
@@ -301,23 +301,33 @@ 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) {
+ ret = -EAGAIN;
+ goto out;
+ }
+ if (msg->rx_buf[0] == PECI_DEV_CC_INVALID_REQ) {
+ /*
+ * if GetDIB() is not supported, use a revision property of
+ * hardware adapter
+ */
+ revision = adapter->peci_revision;
+ } 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)