mei_hdr.reserved = 0;
dev->iamthif_msg_buf_index += mei_hdr.length;
if (mei_write_message(dev, &mei_hdr,
- (unsigned char *)(dev->iamthif_msg_buf),
- mei_hdr.length))
+ (unsigned char *)dev->iamthif_msg_buf))
return -ENODEV;
if (mei_hdr.msg_complete) {
*slots -= msg_slots;
if (mei_write_message(dev, mei_hdr,
- dev->iamthif_msg_buf + dev->iamthif_msg_buf_index,
- mei_hdr->length)) {
+ dev->iamthif_msg_buf + dev->iamthif_msg_buf_index)) {
dev->iamthif_state = MEI_IAMTHIF_IDLE;
cl->status = -ENODEV;
list_del(&cb->list);
start_req->host_version.minor_version = HBM_MINOR_VERSION;
dev->recvd_msg = false;
- if (mei_write_message(dev, mei_hdr, (unsigned char *)start_req, len)) {
+ if (mei_write_message(dev, mei_hdr, (unsigned char *)start_req)) {
dev_dbg(&dev->pdev->dev, "write send version message to FW fail.\n");
dev->dev_state = MEI_DEV_RESETING;
mei_reset(dev, 1);
memset(enum_req, 0, sizeof(struct hbm_host_enum_request));
enum_req->hbm_cmd = HOST_ENUM_REQ_CMD;
- if (mei_write_message(dev, mei_hdr, (unsigned char *)enum_req, len)) {
+ if (mei_write_message(dev, mei_hdr, (unsigned char *)enum_req)) {
dev->dev_state = MEI_DEV_RESETING;
dev_dbg(&dev->pdev->dev, "write send enumeration request message to FW fail.\n");
mei_reset(dev, 1);
prop_req->hbm_cmd = HOST_CLIENT_PROPERTIES_REQ_CMD;
prop_req->address = next_client_index;
- if (mei_write_message(dev, mei_hdr, (unsigned char *) prop_req,
- mei_hdr->length)) {
+ if (mei_write_message(dev, mei_hdr, (unsigned char *) prop_req)) {
dev->dev_state = MEI_DEV_RESETING;
dev_err(&dev->pdev->dev, "Properties request command failed\n");
mei_reset(dev, 1);
* mei_write_message - writes a message to mei device.
*
* @dev: the device structure
- * @header: header of message
- * @write_buffer: message buffer will be written
- * @write_length: message size will be written
+ * @hader: mei HECI header of message
+ * @buf: message payload will be written
*
* This function returns -EIO if write has failed
*/
int mei_write_message(struct mei_device *dev, struct mei_msg_hdr *header,
- unsigned char *buf, unsigned long length)
+ unsigned char *buf)
{
unsigned long rem, dw_cnt;
+ unsigned long length = header->length;
u32 *reg_buf = (u32 *)buf;
int i;
int empty_slots;
-
dev_dbg(&dev->pdev->dev,
"mei_write_message header=%08x.\n",
*((u32 *) header));
dev_dbg(&dev->pdev->dev, "sending flow control host client = %d, ME client = %d\n",
cl->host_client_id, cl->me_client_id);
- return mei_write_message(dev, mei_hdr,
- (unsigned char *) flow_ctrl, len);
+ return mei_write_message(dev, mei_hdr, (unsigned char *) flow_ctrl);
}
/**
*/
int mei_disconnect(struct mei_device *dev, struct mei_cl *cl)
{
- struct mei_msg_hdr *mei_hdr;
+ struct mei_msg_hdr *hdr;
struct hbm_client_connect_request *req;
const size_t len = sizeof(struct hbm_client_connect_request);
- mei_hdr = mei_hbm_hdr(&dev->wr_msg_buf[0], len);
+ hdr = mei_hbm_hdr(&dev->wr_msg_buf[0], len);
req = (struct hbm_client_connect_request *)&dev->wr_msg_buf[1];
memset(req, 0, len);
req->me_addr = cl->me_client_id;
req->reserved = 0;
- return mei_write_message(dev, mei_hdr, (unsigned char *)req, len);
+ return mei_write_message(dev, hdr, (unsigned char *)req);
}
/**
*/
int mei_connect(struct mei_device *dev, struct mei_cl *cl)
{
- struct mei_msg_hdr *mei_hdr;
+ struct mei_msg_hdr *hdr;
struct hbm_client_connect_request *req;
const size_t len = sizeof(struct hbm_client_connect_request);
- mei_hdr = mei_hbm_hdr(&dev->wr_msg_buf[0], len);
+ hdr = mei_hbm_hdr(&dev->wr_msg_buf[0], len);
req = (struct hbm_client_connect_request *) &dev->wr_msg_buf[1];
req->hbm_cmd = CLIENT_CONNECT_REQ_CMD;
req->me_addr = cl->me_client_id;
req->reserved = 0;
- return mei_write_message(dev, mei_hdr, (unsigned char *) req, len);
+ return mei_write_message(dev, hdr, (unsigned char *) req);
}
unsigned long buffer_length);
int mei_write_message(struct mei_device *dev,
- struct mei_msg_hdr *header,
- unsigned char *write_buffer,
- unsigned long write_length);
+ struct mei_msg_hdr *header,
+ unsigned char *buf);
bool mei_hbuf_is_empty(struct mei_device *dev);
* @mei_hdr: header of bus message
*/
static void mei_irq_thread_read_bus_message(struct mei_device *dev,
- struct mei_msg_hdr *mei_hdr)
+ struct mei_msg_hdr *hdr)
{
struct mei_bus_message *mei_msg;
struct mei_me_client *me_client;
struct hbm_host_stop_request *stop_req;
/* read the message to our buffer */
- BUG_ON(mei_hdr->length >= sizeof(dev->rd_msg_buf));
- mei_read_slots(dev, dev->rd_msg_buf, mei_hdr->length);
+ BUG_ON(hdr->length >= sizeof(dev->rd_msg_buf));
+ mei_read_slots(dev, dev->rd_msg_buf, hdr->length);
mei_msg = (struct mei_bus_message *)dev->rd_msg_buf;
switch (mei_msg->hbm_cmd) {
dev->version = version_res->me_max_version;
/* send stop message */
- mei_hdr = mei_hbm_hdr(&buf[0], len);
+ hdr = mei_hbm_hdr(&buf[0], len);
stop_req = (struct hbm_host_stop_request *)&buf[1];
memset(stop_req, 0, len);
stop_req->hbm_cmd = HOST_STOP_REQ_CMD;
stop_req->reason = DRIVER_STOP_REQUEST;
- mei_write_message(dev, mei_hdr,
- (unsigned char *)stop_req, len);
+ mei_write_message(dev, hdr, (unsigned char *)stop_req);
dev_dbg(&dev->pdev->dev, "version mismatch.\n");
return;
}
const size_t len = sizeof(struct hbm_host_stop_request);
- mei_hdr = mei_hbm_hdr((u32 *)&dev->wr_ext_msg.hdr, len);
+ hdr = mei_hbm_hdr((u32 *)&dev->wr_ext_msg.hdr, len);
stop_req = (struct hbm_host_stop_request *)&dev->wr_ext_msg.data;
memset(stop_req, 0, len);
stop_req->hbm_cmd = HOST_STOP_REQ_CMD;
*slots -= msg_slots;
if (mei_write_message(dev, mei_hdr,
- cb->request_buffer.data + cb->buf_idx, len)) {
+ cb->request_buffer.data + cb->buf_idx)) {
cl->status = -ENODEV;
list_move_tail(&cb->list, &cmpl_list->list);
return -ENODEV;
if (dev->wr_ext_msg.hdr.length) {
mei_write_message(dev, &dev->wr_ext_msg.hdr,
- dev->wr_ext_msg.data, dev->wr_ext_msg.hdr.length);
+ dev->wr_ext_msg.data);
slots -= mei_data2slots(dev->wr_ext_msg.hdr.length);
dev->wr_ext_msg.hdr.length = 0;
}
mei_hdr.reserved = 0;
dev_dbg(&dev->pdev->dev, "call mei_write_message header=%08x.\n",
*((u32 *) &mei_hdr));
- if (mei_write_message(dev, &mei_hdr,
- write_cb->request_buffer.data, mei_hdr.length)) {
+ if (mei_write_message(dev, &mei_hdr, write_cb->request_buffer.data)) {
rets = -ENODEV;
goto err;
}
*/
int mei_wd_send(struct mei_device *dev)
{
- struct mei_msg_hdr *mei_hdr;
+ struct mei_msg_hdr *hdr;
- mei_hdr = (struct mei_msg_hdr *) &dev->wr_msg_buf[0];
- mei_hdr->host_addr = dev->wd_cl.host_client_id;
- mei_hdr->me_addr = dev->wd_cl.me_client_id;
- mei_hdr->msg_complete = 1;
- mei_hdr->reserved = 0;
+ hdr = (struct mei_msg_hdr *) &dev->wr_msg_buf[0];
+ hdr->host_addr = dev->wd_cl.host_client_id;
+ hdr->me_addr = dev->wd_cl.me_client_id;
+ hdr->msg_complete = 1;
+ hdr->reserved = 0;
if (!memcmp(dev->wd_data, mei_start_wd_params, MEI_WD_HDR_SIZE))
- mei_hdr->length = MEI_WD_START_MSG_SIZE;
+ hdr->length = MEI_WD_START_MSG_SIZE;
else if (!memcmp(dev->wd_data, mei_stop_wd_params, MEI_WD_HDR_SIZE))
- mei_hdr->length = MEI_WD_STOP_MSG_SIZE;
+ hdr->length = MEI_WD_STOP_MSG_SIZE;
else
return -EINVAL;
- return mei_write_message(dev, mei_hdr, dev->wd_data, mei_hdr->length);
+ return mei_write_message(dev, hdr, dev->wd_data);
}
/**