]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mei: extract supported features from the hbm version
authorTomas Winkler <tomas.winkler@intel.com>
Thu, 21 Aug 2014 11:29:21 +0000 (14:29 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Sep 2014 05:57:48 +0000 (22:57 -0700)
extract supported hbm features and commands from the hbm version

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/mei/hbm.c
drivers/misc/mei/hw-me.c
drivers/misc/mei/mei_dev.h

index 280befc46d11929196a0d0065565e7627cd4dbea..9fc051b7f1a3d8afb1b71174543043103ec2c01a 100644 (file)
@@ -372,7 +372,8 @@ static int mei_hbm_prop_req(struct mei_device *dev)
  * @dev: the device structure
  * @pg_cmd: the pg command code
  *
- * This function returns -EIO on write failure
+ * returns -EIO on write failure
+ *         -EOPNOTSUPP if the operation is not supported by the protocol
  */
 int mei_hbm_pg(struct mei_device *dev, u8 pg_cmd)
 {
@@ -381,6 +382,9 @@ int mei_hbm_pg(struct mei_device *dev, u8 pg_cmd)
        const size_t len = sizeof(struct hbm_power_gate);
        int ret;
 
+       if (!dev->hbm_f_pg_supported)
+               return -EOPNOTSUPP;
+
        mei_hbm_hdr(mei_hdr, len);
 
        req = (struct hbm_power_gate *)dev->wr_msg.data;
@@ -660,6 +664,23 @@ static int mei_hbm_fw_disconnect_req(struct mei_device *dev,
        return 0;
 }
 
+/**
+ * mei_hbm_config_features: check what hbm features and commands
+ *        are supported by the fw
+ *
+ * @dev: the device structure
+ */
+static void mei_hbm_config_features(struct mei_device *dev)
+{
+       /* Power Gating Isolation Support */
+       dev->hbm_f_pg_supported = 0;
+       if (dev->version.major_version > HBM_MAJOR_VERSION_PGI)
+               dev->hbm_f_pg_supported = 1;
+
+       if (dev->version.major_version == HBM_MAJOR_VERSION_PGI &&
+           dev->version.minor_version >= HBM_MINOR_VERSION_PGI)
+               dev->hbm_f_pg_supported = 1;
+}
 
 /**
  * mei_hbm_version_is_supported - checks whether the driver can
@@ -743,6 +764,8 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
                        break;
                }
 
+               mei_hbm_config_features(dev);
+
                if (dev->dev_state != MEI_DEV_INIT_CLIENTS ||
                    dev->hbm_state != MEI_HBM_STARTING) {
                        dev_err(&dev->pdev->dev, "hbm: start: state mismatch, [%d, %d]\n",
index caf0da33599448c46886909f9d3bb94db5fd9190..498bd42bca2587959102722f829403a0b2edbcef 100644 (file)
@@ -574,11 +574,7 @@ static bool mei_me_pg_is_enabled(struct mei_device *dev)
        if ((reg & ME_PGIC_HRA) == 0)
                goto notsupported;
 
-       if (dev->version.major_version < HBM_MAJOR_VERSION_PGI)
-               goto notsupported;
-
-       if (dev->version.major_version == HBM_MAJOR_VERSION_PGI &&
-           dev->version.minor_version < HBM_MINOR_VERSION_PGI)
+       if (!dev->hbm_f_pg_supported)
                goto notsupported;
 
        return true;
index 79124ae6a249dc53f8c7f15e562a3dabf5acf592..719edeeb3ceb9905ea94a785fbdd9d6a0bc3bee6 100644 (file)
@@ -402,6 +402,9 @@ struct mei_cfg {
  *
  * @reset_count - limits the number of consecutive resets
  * @hbm_state - state of host bus message protocol
+ *
+ * @hbm_f_pg_supported - hbm feature pgi protocol
+ *
  * @pg_event - power gating event
  * @mem_addr - mem mapped base register address
 
@@ -476,6 +479,7 @@ struct mei_device {
        } wr_msg;
 
        struct hbm_version version;
+       unsigned int hbm_f_pg_supported:1;
 
        struct list_head me_clients;
        DECLARE_BITMAP(me_clients_map, MEI_CLIENTS_MAX);