mei: add hbm commands return status values
authorTomas Winkler <tomas.winkler@intel.com>
Thu, 21 Aug 2014 11:29:16 +0000 (14:29 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Sep 2014 05:57:48 +0000 (22:57 -0700)
HBM uses global list of status values
from which the values of particular commands
are derived

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.h

index 5fb177b3bfefca8b346099b73e6ad8d249f83516..d50c8d1fb36d1baa2f6d2e9e65ef3d923bd71b76 100644 (file)
 #include "hbm.h"
 #include "client.h"
 
+static const char *mei_hbm_status_str(enum mei_hbm_status status)
+{
+#define MEI_HBM_STATUS(status) case MEI_HBMS_##status: return #status
+       switch (status) {
+       MEI_HBM_STATUS(SUCCESS);
+       MEI_HBM_STATUS(CLIENT_NOT_FOUND);
+       MEI_HBM_STATUS(ALREADY_EXISTS);
+       MEI_HBM_STATUS(REJECTED);
+       MEI_HBM_STATUS(INVALID_PARAMETER);
+       MEI_HBM_STATUS(NOT_ALLOWED);
+       MEI_HBM_STATUS(ALREADY_STARTED);
+       MEI_HBM_STATUS(NOT_STARTED);
+       default: return "unknown";
+       }
+#undef MEI_HBM_STATUS
+};
+
 static const char *mei_cl_conn_status_str(enum mei_cl_connect_status status)
 {
 #define MEI_CL_CS(status) case MEI_CL_CONN_##status: return #status
@@ -770,8 +787,9 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
                props_res = (struct hbm_props_response *)mei_msg;
 
                if (props_res->status) {
-                       dev_err(&dev->pdev->dev, "hbm: properties response: wrong status = %d\n",
-                               props_res->status);
+                       dev_err(&dev->pdev->dev, "hbm: properties response: wrong status = %d %s\n",
+                               props_res->status,
+                               mei_hbm_status_str(props_res->status));
                        return -EPROTO;
                }
 
index 50526f92f09222454891be581ba3b6843a3f19ff..6e31113b63df43afc20728c25c2b21c0b32417e7 100644 (file)
@@ -97,23 +97,50 @@ enum mei_stop_reason_types {
        SYSTEM_S5_ENTRY = 0x08
 };
 
+
+/**
+ * mei_hbm_status  - mei host bus messages return values
+ *
+ * @MEI_HBMS_SUCCESS           - status success
+ * @MEI_HBMS_CLIENT_NOT_FOUND  - client not found
+ * @MEI_HBMS_ALREADY_EXISTS    - connection already established
+ * @MEI_HBMS_REJECTED          - connection is rejected
+ * @MEI_HBMS_INVALID_PARAMETER - invalid parameter
+ * @MEI_HBMS_NOT_ALLOWED       - operation not allowed
+ * @MEI_HBMS_ALREADY_STARTED   - system is already started
+ * @MEI_HBMS_NOT_STARTED       - system not started
+ */
+enum mei_hbm_status {
+       MEI_HBMS_SUCCESS           = 0,
+       MEI_HBMS_CLIENT_NOT_FOUND  = 1,
+       MEI_HBMS_ALREADY_EXISTS    = 2,
+       MEI_HBMS_REJECTED          = 3,
+       MEI_HBMS_INVALID_PARAMETER = 4,
+       MEI_HBMS_NOT_ALLOWED       = 5,
+       MEI_HBMS_ALREADY_STARTED   = 6,
+       MEI_HBMS_NOT_STARTED       = 7,
+
+       MEI_HBMS_MAX
+};
+
+
 /*
  * Client Connect Status
  * used by hbm_client_connect_response.status
  */
 enum mei_cl_connect_status {
-       MEI_CL_CONN_SUCCESS          = 0x00,
-       MEI_CL_CONN_NOT_FOUND        = 0x01,
-       MEI_CL_CONN_ALREADY_STARTED  = 0x02,
-       MEI_CL_CONN_OUT_OF_RESOURCES = 0x03,
-       MEI_CL_CONN_MESSAGE_SMALL    = 0x04
+       MEI_CL_CONN_SUCCESS          = MEI_HBMS_SUCCESS,
+       MEI_CL_CONN_NOT_FOUND        = MEI_HBMS_CLIENT_NOT_FOUND,
+       MEI_CL_CONN_ALREADY_STARTED  = MEI_HBMS_ALREADY_EXISTS,
+       MEI_CL_CONN_OUT_OF_RESOURCES = MEI_HBMS_REJECTED,
+       MEI_CL_CONN_MESSAGE_SMALL    = MEI_HBMS_INVALID_PARAMETER,
 };
 
 /*
  * Client Disconnect Status
  */
 enum  mei_cl_disconnect_status {
-       MEI_CL_DISCONN_SUCCESS = 0x00
+       MEI_CL_DISCONN_SUCCESS = MEI_HBMS_SUCCESS
 };
 
 /*