diff options
author | Iwona Winiarska <iwona.winiarska@intel.com> | 2020-12-06 16:16:44 +0300 |
---|---|---|
committer | Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com> | 2021-11-05 10:22:12 +0300 |
commit | b9c5e4a55eb6bdfd4191e7223638bf7990088956 (patch) | |
tree | 6a029d00243f25d8ab34f8b77ec87ec26ca449fb /drivers/peci | |
parent | 38d14652685c2f3171ef8d2294782c397ce4e7d0 (diff) | |
download | linux-b9c5e4a55eb6bdfd4191e7223638bf7990088956.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>
Diffstat (limited to 'drivers/peci')
-rw-r--r-- | drivers/peci/peci-core.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/drivers/peci/peci-core.c b/drivers/peci/peci-core.c index 54e84423b59c..261a1deb5059 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); |