mei: add hbm and pg state in devstate debugfs print
authorAlexander Usyskin <alexander.usyskin@intel.com>
Mon, 29 Sep 2014 13:31:33 +0000 (16:31 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 29 Sep 2014 15:56:00 +0000 (11:56 -0400)
Add hbm state, pg enablement and state to devstate file in debugfs
(<debugfs>/mei/devstate)

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/mei/debugfs.c
drivers/misc/mei/hbm.c
drivers/misc/mei/hbm.h
drivers/misc/mei/init.c
drivers/misc/mei/mei_dev.h

index 3b032881622dd35d12564ab9fe4e35e790c4eec6..2399b3181e6c431409040bd2293cfde2bfc13438 100644 (file)
@@ -134,8 +134,13 @@ static ssize_t mei_dbgfs_read_devstate(struct file *fp, char __user *ubuf,
        if  (!buf)
                return -ENOMEM;
 
-       pos += scnprintf(buf + pos, bufsz - pos, "%s\n",
+       pos += scnprintf(buf + pos, bufsz - pos, "dev: %s\n",
                        mei_dev_state_str(dev->dev_state));
+       pos += scnprintf(buf + pos, bufsz - pos, "hbm: %s\n",
+                       mei_hbm_state_str(dev->hbm_state));
+       pos += scnprintf(buf + pos, bufsz - pos, "pg:  %s, %s\n",
+                       mei_pg_is_enabled(dev) ? "ENABLED" : "DISABLED",
+                       mei_pg_state_str(mei_pg_state(dev)));
        ret = simple_read_from_buffer(ubuf, cnt, ppos, buf, pos);
        kfree(buf);
        return ret;
index 9fc051b7f1a3d8afb1b71174543043103ec2c01a..3311b5c323af23b5575198727fa246c594a3e790 100644 (file)
@@ -56,6 +56,22 @@ static const char *mei_cl_conn_status_str(enum mei_cl_connect_status status)
 #undef MEI_CL_CCS
 }
 
+const char *mei_hbm_state_str(enum mei_hbm_state state)
+{
+#define MEI_HBM_STATE(state) case MEI_HBM_##state: return #state
+       switch (state) {
+       MEI_HBM_STATE(IDLE);
+       MEI_HBM_STATE(STARTING);
+       MEI_HBM_STATE(STARTED);
+       MEI_HBM_STATE(ENUM_CLIENTS);
+       MEI_HBM_STATE(CLIENT_PROPERTIES);
+       MEI_HBM_STATE(STOPPED);
+       default:
+               return "unknown";
+       }
+#undef MEI_HBM_STATE
+}
+
 /**
  * mei_cl_conn_status_to_errno - convert client connect response
  * status to error code
index 80920f096c04d1eef079d362b970648c03fd5411..efcb0d45bbe6636bb9219cd4456f84c2c052edb5 100644 (file)
@@ -40,6 +40,8 @@ enum mei_hbm_state {
        MEI_HBM_STOPPED,
 };
 
+const char *mei_hbm_state_str(enum mei_hbm_state state);
+
 int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr);
 
 static inline void mei_hbm_hdr(struct mei_msg_hdr *hdr, size_t length)
index 9f635be684ea2e9a76caf83cba68c15b7dff1feb..81695e4cf0a0e22a7d121053a9611b99ef8de17c 100644 (file)
@@ -43,6 +43,18 @@ const char *mei_dev_state_str(int state)
 #undef MEI_DEV_STATE
 }
 
+const char *mei_pg_state_str(enum mei_pg_state state)
+{
+#define MEI_PG_STATE(state) case MEI_PG_##state: return #state
+       switch (state) {
+       MEI_PG_STATE(OFF);
+       MEI_PG_STATE(ON);
+       default:
+               return "unknown";
+       }
+#undef MEI_PG_STATE
+}
+
 
 /**
  * mei_cancel_work. Cancel mei background jobs
index 719edeeb3ceb9905ea94a785fbdd9d6a0bc3bee6..be7b14766cfad98a4f1e39f23e4ee636f14c5066 100644 (file)
@@ -375,6 +375,8 @@ enum mei_pg_state {
        MEI_PG_ON =  1,
 };
 
+const char *mei_pg_state_str(enum mei_pg_state state);
+
 /*
  * mei_cfg
  *