提交 4fcbc99b 编写于 作者: T Tomas Winkler 提交者: Greg Kroah-Hartman

mei: implement power gating isolation hbm layer

Add send message functions and receive dispatch stubs
for power gating isolation hbm protocol.

The protocol consist of requests for entering and exiting
the power gating isolation state and their responses.
Signed-off-by: NTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: NAlexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 d1db0eea
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
* *
*/ */
#include <linux/export.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/wait.h> #include <linux/wait.h>
...@@ -289,6 +290,34 @@ static int mei_hbm_prop_req(struct mei_device *dev) ...@@ -289,6 +290,34 @@ static int mei_hbm_prop_req(struct mei_device *dev)
return 0; return 0;
} }
/*
* mei_hbm_pg - sends pg command
*
* @dev: the device structure
* @pg_cmd: the pg command code
*
* This function returns -EIO on write failure
*/
int mei_hbm_pg(struct mei_device *dev, u8 pg_cmd)
{
struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
struct hbm_power_gate *req;
const size_t len = sizeof(struct hbm_power_gate);
int ret;
mei_hbm_hdr(mei_hdr, len);
req = (struct hbm_power_gate *)dev->wr_msg.data;
memset(req, 0, len);
req->hbm_cmd = pg_cmd;
ret = mei_write_message(dev, mei_hdr, dev->wr_msg.data);
if (ret)
dev_err(&dev->pdev->dev, "power gate command write failed.\n");
return ret;
}
EXPORT_SYMBOL_GPL(mei_hbm_pg);
/** /**
* mei_hbm_stop_req - send stop request message * mei_hbm_stop_req - send stop request message
* *
...@@ -701,6 +730,18 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) ...@@ -701,6 +730,18 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
mei_hbm_cl_flow_control_res(dev, flow_control); mei_hbm_cl_flow_control_res(dev, flow_control);
break; break;
case MEI_PG_ISOLATION_ENTRY_RES_CMD:
dev_dbg(&dev->pdev->dev, "power gate isolation entry response received\n");
if (waitqueue_active(&dev->wait_pg))
wake_up(&dev->wait_pg);
break;
case MEI_PG_ISOLATION_EXIT_REQ_CMD:
dev_dbg(&dev->pdev->dev, "power gate isolation exit request received\n");
if (waitqueue_active(&dev->wait_pg))
wake_up(&dev->wait_pg);
break;
case HOST_CLIENT_PROPERTIES_RES_CMD: case HOST_CLIENT_PROPERTIES_RES_CMD:
dev_dbg(&dev->pdev->dev, "hbm: properties response: message received.\n"); dev_dbg(&dev->pdev->dev, "hbm: properties response: message received.\n");
......
...@@ -57,6 +57,7 @@ int mei_hbm_cl_disconnect_req(struct mei_device *dev, struct mei_cl *cl); ...@@ -57,6 +57,7 @@ int mei_hbm_cl_disconnect_req(struct mei_device *dev, struct mei_cl *cl);
int mei_hbm_cl_disconnect_rsp(struct mei_device *dev, struct mei_cl *cl); int mei_hbm_cl_disconnect_rsp(struct mei_device *dev, struct mei_cl *cl);
int mei_hbm_cl_connect_req(struct mei_device *dev, struct mei_cl *cl); int mei_hbm_cl_connect_req(struct mei_device *dev, struct mei_cl *cl);
bool mei_hbm_version_is_supported(struct mei_device *dev); bool mei_hbm_version_is_supported(struct mei_device *dev);
int mei_hbm_pg(struct mei_device *dev, u8 pg_cmd);
#endif /* _MEI_HBM_H_ */ #endif /* _MEI_HBM_H_ */
...@@ -69,6 +69,11 @@ ...@@ -69,6 +69,11 @@
#define MEI_FLOW_CONTROL_CMD 0x08 #define MEI_FLOW_CONTROL_CMD 0x08
#define MEI_PG_ISOLATION_ENTRY_REQ_CMD 0x0a
#define MEI_PG_ISOLATION_ENTRY_RES_CMD 0x8a
#define MEI_PG_ISOLATION_EXIT_REQ_CMD 0x0b
#define MEI_PG_ISOLATION_EXIT_RES_CMD 0x8b
/* /*
* MEI Stop Reason * MEI Stop Reason
* used by hbm_host_stop_request.reason * used by hbm_host_stop_request.reason
...@@ -207,6 +212,17 @@ struct hbm_props_response { ...@@ -207,6 +212,17 @@ struct hbm_props_response {
struct mei_client_properties client_properties; struct mei_client_properties client_properties;
} __packed; } __packed;
/**
* struct hbm_power_gate - power gate request/response
*
* @hbm_cmd - bus message command header
* @reserved[3]
*/
struct hbm_power_gate {
u8 hbm_cmd;
u8 reserved[3];
} __packed;
/** /**
* struct hbm_client_connect_request - connect/disconnect request * struct hbm_client_connect_request - connect/disconnect request
* *
......
...@@ -312,6 +312,7 @@ void mei_device_init(struct mei_device *dev) ...@@ -312,6 +312,7 @@ void mei_device_init(struct mei_device *dev)
INIT_LIST_HEAD(&dev->device_list); INIT_LIST_HEAD(&dev->device_list);
mutex_init(&dev->device_lock); mutex_init(&dev->device_lock);
init_waitqueue_head(&dev->wait_hw_ready); init_waitqueue_head(&dev->wait_hw_ready);
init_waitqueue_head(&dev->wait_pg);
init_waitqueue_head(&dev->wait_recvd_msg); init_waitqueue_head(&dev->wait_recvd_msg);
init_waitqueue_head(&dev->wait_stop_wd); init_waitqueue_head(&dev->wait_stop_wd);
dev->dev_state = MEI_DEV_INITIALIZING; dev->dev_state = MEI_DEV_INITIALIZING;
......
...@@ -371,6 +371,7 @@ struct mei_device { ...@@ -371,6 +371,7 @@ struct mei_device {
* waiting queue for receive message from FW * waiting queue for receive message from FW
*/ */
wait_queue_head_t wait_hw_ready; wait_queue_head_t wait_hw_ready;
wait_queue_head_t wait_pg;
wait_queue_head_t wait_recvd_msg; wait_queue_head_t wait_recvd_msg;
wait_queue_head_t wait_stop_wd; wait_queue_head_t wait_stop_wd;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册