mei: rename to mei_host_buffer_is_empty to hbuf_is_ready
we rename the mei_host_buffer_is_empty to keep naming convention of hbuf and also make the query more generic to be correct also for other under laying hardware Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
06ecd64598
commit
330dd7da5e
|
@ -297,9 +297,9 @@ static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb)
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (ret && dev->mei_host_buffer_is_empty) {
|
if (ret && dev->hbuf_is_ready) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
dev->mei_host_buffer_is_empty = false;
|
dev->hbuf_is_ready = false;
|
||||||
if (cb->request_buffer.size > mei_hbuf_max_len(dev)) {
|
if (cb->request_buffer.size > mei_hbuf_max_len(dev)) {
|
||||||
mei_hdr.length = mei_hbuf_max_len(dev);
|
mei_hdr.length = mei_hbuf_max_len(dev);
|
||||||
mei_hdr.msg_complete = 0;
|
mei_hdr.msg_complete = 0;
|
||||||
|
@ -330,7 +330,7 @@ static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb)
|
||||||
list_add_tail(&cb->list, &dev->write_list.list);
|
list_add_tail(&cb->list, &dev->write_list.list);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!(dev->mei_host_buffer_is_empty))
|
if (!dev->hbuf_is_ready)
|
||||||
dev_dbg(&dev->pdev->dev, "host buffer is not empty");
|
dev_dbg(&dev->pdev->dev, "host buffer is not empty");
|
||||||
|
|
||||||
dev_dbg(&dev->pdev->dev, "No flow control credentials, so add iamthif cb to write list.\n");
|
dev_dbg(&dev->pdev->dev, "No flow control credentials, so add iamthif cb to write list.\n");
|
||||||
|
@ -583,7 +583,7 @@ int mei_amthif_irq_read(struct mei_device *dev, s32 *slots)
|
||||||
dev->iamthif_msg_buf_index = 0;
|
dev->iamthif_msg_buf_index = 0;
|
||||||
dev->iamthif_msg_buf_size = 0;
|
dev->iamthif_msg_buf_size = 0;
|
||||||
dev->iamthif_stall_timer = MEI_IAMTHIF_STALL_TIMER;
|
dev->iamthif_stall_timer = MEI_IAMTHIF_STALL_TIMER;
|
||||||
dev->mei_host_buffer_is_empty = mei_hbuf_is_ready(dev);
|
dev->hbuf_is_ready = mei_hbuf_is_ready(dev);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -393,8 +393,8 @@ int mei_cl_disconnect(struct mei_cl *cl)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
cb->fop_type = MEI_FOP_CLOSE;
|
cb->fop_type = MEI_FOP_CLOSE;
|
||||||
if (dev->mei_host_buffer_is_empty) {
|
if (dev->hbuf_is_ready) {
|
||||||
dev->mei_host_buffer_is_empty = false;
|
dev->hbuf_is_ready = false;
|
||||||
if (mei_hbm_cl_disconnect_req(dev, cl)) {
|
if (mei_hbm_cl_disconnect_req(dev, cl)) {
|
||||||
rets = -ENODEV;
|
rets = -ENODEV;
|
||||||
dev_err(&dev->pdev->dev, "failed to disconnect.\n");
|
dev_err(&dev->pdev->dev, "failed to disconnect.\n");
|
||||||
|
@ -496,9 +496,8 @@ int mei_cl_connect(struct mei_cl *cl, struct file *file)
|
||||||
|
|
||||||
cb->fop_type = MEI_FOP_IOCTL;
|
cb->fop_type = MEI_FOP_IOCTL;
|
||||||
|
|
||||||
if (dev->mei_host_buffer_is_empty &&
|
if (dev->hbuf_is_ready && !mei_cl_is_other_connecting(cl)) {
|
||||||
!mei_cl_is_other_connecting(cl)) {
|
dev->hbuf_is_ready = false;
|
||||||
dev->mei_host_buffer_is_empty = false;
|
|
||||||
|
|
||||||
if (mei_hbm_cl_connect_req(dev, cl)) {
|
if (mei_hbm_cl_connect_req(dev, cl)) {
|
||||||
rets = -ENODEV;
|
rets = -ENODEV;
|
||||||
|
@ -661,8 +660,8 @@ int mei_cl_read_start(struct mei_cl *cl)
|
||||||
|
|
||||||
cb->fop_type = MEI_FOP_READ;
|
cb->fop_type = MEI_FOP_READ;
|
||||||
cl->read_cb = cb;
|
cl->read_cb = cb;
|
||||||
if (dev->mei_host_buffer_is_empty) {
|
if (dev->hbuf_is_ready) {
|
||||||
dev->mei_host_buffer_is_empty = false;
|
dev->hbuf_is_ready = false;
|
||||||
if (mei_hbm_cl_flow_control_req(dev, cl)) {
|
if (mei_hbm_cl_flow_control_req(dev, cl)) {
|
||||||
rets = -ENODEV;
|
rets = -ENODEV;
|
||||||
goto err;
|
goto err;
|
||||||
|
|
|
@ -486,7 +486,7 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)
|
||||||
rets = mei_irq_write_handler(dev, &complete_list);
|
rets = mei_irq_write_handler(dev, &complete_list);
|
||||||
end:
|
end:
|
||||||
dev_dbg(&dev->pdev->dev, "end of bottom half function.\n");
|
dev_dbg(&dev->pdev->dev, "end of bottom half function.\n");
|
||||||
dev->mei_host_buffer_is_empty = mei_hbuf_is_ready(dev);
|
dev->hbuf_is_ready = mei_hbuf_is_ready(dev);
|
||||||
|
|
||||||
bus_message_received = false;
|
bus_message_received = false;
|
||||||
if (dev->recvd_msg && waitqueue_active(&dev->wait_recvd_msg)) {
|
if (dev->recvd_msg && waitqueue_active(&dev->wait_recvd_msg)) {
|
||||||
|
|
|
@ -454,14 +454,14 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,
|
||||||
if (rets < 0)
|
if (rets < 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
if (rets == 0 || dev->mei_host_buffer_is_empty == false) {
|
if (rets == 0 || !dev->hbuf_is_ready) {
|
||||||
write_cb->buf_idx = 0;
|
write_cb->buf_idx = 0;
|
||||||
mei_hdr.msg_complete = 0;
|
mei_hdr.msg_complete = 0;
|
||||||
cl->writing_state = MEI_WRITING;
|
cl->writing_state = MEI_WRITING;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev->mei_host_buffer_is_empty = false;
|
dev->hbuf_is_ready = false;
|
||||||
if (length > mei_hbuf_max_len(dev)) {
|
if (length > mei_hbuf_max_len(dev)) {
|
||||||
mei_hdr.length = mei_hbuf_max_len(dev);
|
mei_hdr.length = mei_hbuf_max_len(dev);
|
||||||
mei_hdr.msg_complete = 0;
|
mei_hdr.msg_complete = 0;
|
||||||
|
|
|
@ -265,9 +265,13 @@ struct mei_hw_ops {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct mei_device - MEI private device struct
|
* struct mei_device - MEI private device struct
|
||||||
|
|
||||||
* @mem_addr - mem mapped base register address
|
* @mem_addr - mem mapped base register address
|
||||||
* @hbuf_depth - depth of host(write) buffer
|
|
||||||
* @wr_ext_msg - buffer for hbm control responses (set in read cycle)
|
* @hbuf_depth - depth of hardware host/write buffer is slots
|
||||||
|
* @hbuf_is_ready - query if the host host/write buffer is ready
|
||||||
|
* @wr_msg - the buffer for hbm control messages
|
||||||
|
* @wr_ext_msg - the buffer for hbm control responses (set in read cycle)
|
||||||
*/
|
*/
|
||||||
struct mei_device {
|
struct mei_device {
|
||||||
struct pci_dev *pdev; /* pointer to pci device struct */
|
struct pci_dev *pdev; /* pointer to pci device struct */
|
||||||
|
@ -294,7 +298,6 @@ struct mei_device {
|
||||||
struct delayed_work timer_work; /* MEI timer delayed work (timeouts) */
|
struct delayed_work timer_work; /* MEI timer delayed work (timeouts) */
|
||||||
bool recvd_msg;
|
bool recvd_msg;
|
||||||
|
|
||||||
u8 hbuf_depth;
|
|
||||||
/*
|
/*
|
||||||
* waiting queue for receive message from FW
|
* waiting queue for receive message from FW
|
||||||
*/
|
*/
|
||||||
|
@ -311,6 +314,10 @@ struct mei_device {
|
||||||
unsigned char rd_msg_buf[MEI_RD_MSG_BUF_SIZE]; /* control messages */
|
unsigned char rd_msg_buf[MEI_RD_MSG_BUF_SIZE]; /* control messages */
|
||||||
u32 rd_msg_hdr;
|
u32 rd_msg_hdr;
|
||||||
|
|
||||||
|
/* write buffer */
|
||||||
|
u8 hbuf_depth;
|
||||||
|
bool hbuf_is_ready;
|
||||||
|
|
||||||
/* used for control messages */
|
/* used for control messages */
|
||||||
struct {
|
struct {
|
||||||
struct mei_msg_hdr hdr;
|
struct mei_msg_hdr hdr;
|
||||||
|
@ -330,7 +337,6 @@ struct mei_device {
|
||||||
u8 me_clients_num;
|
u8 me_clients_num;
|
||||||
u8 me_client_presentation_num;
|
u8 me_client_presentation_num;
|
||||||
u8 me_client_index;
|
u8 me_client_index;
|
||||||
bool mei_host_buffer_is_empty;
|
|
||||||
|
|
||||||
struct mei_cl wd_cl;
|
struct mei_cl wd_cl;
|
||||||
enum mei_wd_states wd_state;
|
enum mei_wd_states wd_state;
|
||||||
|
|
|
@ -157,9 +157,9 @@ int mei_wd_stop(struct mei_device *dev)
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (ret && dev->mei_host_buffer_is_empty) {
|
if (ret && dev->hbuf_is_ready) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
dev->mei_host_buffer_is_empty = false;
|
dev->hbuf_is_ready = false;
|
||||||
|
|
||||||
if (!mei_wd_send(dev)) {
|
if (!mei_wd_send(dev)) {
|
||||||
ret = mei_cl_flow_ctrl_reduce(&dev->wd_cl);
|
ret = mei_cl_flow_ctrl_reduce(&dev->wd_cl);
|
||||||
|
@ -282,10 +282,9 @@ static int mei_wd_ops_ping(struct watchdog_device *wd_dev)
|
||||||
dev->wd_state = MEI_WD_RUNNING;
|
dev->wd_state = MEI_WD_RUNNING;
|
||||||
|
|
||||||
/* Check if we can send the ping to HW*/
|
/* Check if we can send the ping to HW*/
|
||||||
if (dev->mei_host_buffer_is_empty &&
|
if (dev->hbuf_is_ready && mei_cl_flow_ctrl_creds(&dev->wd_cl) > 0) {
|
||||||
mei_cl_flow_ctrl_creds(&dev->wd_cl) > 0) {
|
|
||||||
|
|
||||||
dev->mei_host_buffer_is_empty = false;
|
dev->hbuf_is_ready = false;
|
||||||
dev_dbg(&dev->pdev->dev, "wd: sending ping\n");
|
dev_dbg(&dev->pdev->dev, "wd: sending ping\n");
|
||||||
|
|
||||||
if (mei_wd_send(dev)) {
|
if (mei_wd_send(dev)) {
|
||||||
|
|
Loading…
Reference in a new issue