diff options
-rw-r--r-- | drivers/misc/mei/init.c | 2 | ||||
-rw-r--r-- | drivers/misc/mei/interrupt.c | 36 | ||||
-rw-r--r-- | drivers/misc/mei/mei_dev.h | 11 |
3 files changed, 22 insertions, 27 deletions
diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c index 02784af1d1a1..49600d6e3726 100644 --- a/drivers/misc/mei/init.c +++ b/drivers/misc/mei/init.c | |||
@@ -288,7 +288,7 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled) | |||
288 | mei_me_cl_unlink(dev, &dev->iamthif_cl); | 288 | mei_me_cl_unlink(dev, &dev->iamthif_cl); |
289 | 289 | ||
290 | mei_amthif_reset_params(dev); | 290 | mei_amthif_reset_params(dev); |
291 | dev->extra_write_index = 0; | 291 | memset(&dev->wr_ext_msg, 0, sizeof(dev->wr_ext_msg)); |
292 | } | 292 | } |
293 | 293 | ||
294 | dev->me_clients_num = 0; | 294 | dev->me_clients_num = 0; |
diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c index 14becc0d5563..92246465ea11 100644 --- a/drivers/misc/mei/interrupt.c +++ b/drivers/misc/mei/interrupt.c | |||
@@ -446,15 +446,14 @@ static void mei_client_disconnect_request(struct mei_device *dev, | |||
446 | dev->iamthif_timer = 0; | 446 | dev->iamthif_timer = 0; |
447 | 447 | ||
448 | /* prepare disconnect response */ | 448 | /* prepare disconnect response */ |
449 | (void)mei_hbm_hdr(&dev->ext_msg_buf[0], len); | 449 | (void)mei_hbm_hdr((u32 *)&dev->wr_ext_msg.hdr, len); |
450 | disconnect_res = | 450 | disconnect_res = |
451 | (struct hbm_client_connect_response *) | 451 | (struct hbm_client_connect_response *) |
452 | &dev->ext_msg_buf[1]; | 452 | &dev->wr_ext_msg.data; |
453 | disconnect_res->hbm_cmd = CLIENT_DISCONNECT_RES_CMD; | 453 | disconnect_res->hbm_cmd = CLIENT_DISCONNECT_RES_CMD; |
454 | disconnect_res->host_addr = pos->host_client_id; | 454 | disconnect_res->host_addr = pos->host_client_id; |
455 | disconnect_res->me_addr = pos->me_client_id; | 455 | disconnect_res->me_addr = pos->me_client_id; |
456 | disconnect_res->status = 0; | 456 | disconnect_res->status = 0; |
457 | dev->extra_write_index = 2; | ||
458 | break; | 457 | break; |
459 | } | 458 | } |
460 | } | 459 | } |
@@ -643,16 +642,13 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev, | |||
643 | { | 642 | { |
644 | /* prepare stop request: sent in next interrupt event */ | 643 | /* prepare stop request: sent in next interrupt event */ |
645 | 644 | ||
646 | u32 *buf = dev->ext_msg_buf; | ||
647 | const size_t len = sizeof(struct hbm_host_stop_request); | 645 | const size_t len = sizeof(struct hbm_host_stop_request); |
648 | 646 | ||
649 | mei_hdr = mei_hbm_hdr(&buf[0], len); | 647 | mei_hdr = mei_hbm_hdr((u32 *)&dev->wr_ext_msg.hdr, len); |
650 | stop_req = (struct hbm_host_stop_request *)&buf[1]; | 648 | stop_req = (struct hbm_host_stop_request *)&dev->wr_ext_msg.data; |
651 | memset(stop_req, 0, len); | 649 | memset(stop_req, 0, len); |
652 | stop_req->hbm_cmd = HOST_STOP_REQ_CMD; | 650 | stop_req->hbm_cmd = HOST_STOP_REQ_CMD; |
653 | stop_req->reason = DRIVER_STOP_REQUEST; | 651 | stop_req->reason = DRIVER_STOP_REQUEST; |
654 | |||
655 | dev->extra_write_index = 2; | ||
656 | break; | 652 | break; |
657 | } | 653 | } |
658 | default: | 654 | default: |
@@ -988,15 +984,11 @@ static int mei_irq_thread_write_handler(struct mei_cl_cb *cmpl_list, | |||
988 | wake_up_interruptible(&dev->wait_stop_wd); | 984 | wake_up_interruptible(&dev->wait_stop_wd); |
989 | } | 985 | } |
990 | 986 | ||
991 | if (dev->extra_write_index) { | 987 | if (dev->wr_ext_msg.hdr.length) { |
992 | dev_dbg(&dev->pdev->dev, "extra_write_index =%d.\n", | 988 | mei_write_message(dev, &dev->wr_ext_msg.hdr, |
993 | dev->extra_write_index); | 989 | dev->wr_ext_msg.data, dev->wr_ext_msg.hdr.length); |
994 | mei_write_message(dev, | 990 | *slots -= mei_data2slots(dev->wr_ext_msg.hdr.length); |
995 | (struct mei_msg_hdr *) &dev->ext_msg_buf[0], | 991 | dev->wr_ext_msg.hdr.length = 0; |
996 | (unsigned char *) &dev->ext_msg_buf[1], | ||
997 | (dev->extra_write_index - 1) * sizeof(u32)); | ||
998 | *slots -= dev->extra_write_index; | ||
999 | dev->extra_write_index = 0; | ||
1000 | } | 992 | } |
1001 | if (dev->dev_state == MEI_DEV_ENABLED) { | 993 | if (dev->dev_state == MEI_DEV_ENABLED) { |
1002 | if (dev->wd_pending && | 994 | if (dev->wd_pending && |
@@ -1263,11 +1255,11 @@ irqreturn_t mei_interrupt_thread_handler(int irq, void *dev_id) | |||
1263 | } | 1255 | } |
1264 | /* check slots available for reading */ | 1256 | /* check slots available for reading */ |
1265 | slots = mei_count_full_read_slots(dev); | 1257 | slots = mei_count_full_read_slots(dev); |
1266 | dev_dbg(&dev->pdev->dev, "slots =%08x extra_write_index =%08x.\n", | 1258 | while (slots > 0) { |
1267 | slots, dev->extra_write_index); | 1259 | /* we have urgent data to send so break the read */ |
1268 | while (slots > 0 && !dev->extra_write_index) { | 1260 | if (dev->wr_ext_msg.hdr.length) |
1269 | dev_dbg(&dev->pdev->dev, "slots =%08x extra_write_index =%08x.\n", | 1261 | break; |
1270 | slots, dev->extra_write_index); | 1262 | dev_dbg(&dev->pdev->dev, "slots =%08x\n", slots); |
1271 | dev_dbg(&dev->pdev->dev, "call mei_irq_thread_read_handler.\n"); | 1263 | dev_dbg(&dev->pdev->dev, "call mei_irq_thread_read_handler.\n"); |
1272 | rets = mei_irq_thread_read_handler(&complete_list, dev, &slots); | 1264 | rets = mei_irq_thread_read_handler(&complete_list, dev, &slots); |
1273 | if (rets) | 1265 | if (rets) |
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h index e511b84ff4ce..2a38e95e5de0 100644 --- a/drivers/misc/mei/mei_dev.h +++ b/drivers/misc/mei/mei_dev.h | |||
@@ -192,8 +192,9 @@ struct mei_cl { | |||
192 | }; | 192 | }; |
193 | 193 | ||
194 | /** | 194 | /** |
195 | * struct mei_deive - MEI private device struct | 195 | * struct mei_device - MEI private device struct |
196 | * @hbuf_depth - depth of host(write) buffer | 196 | * @hbuf_depth - depth of host(write) buffer |
197 | * @wr_ext_msg - buffer for hbm control responses (set in read cycle) | ||
197 | */ | 198 | */ |
198 | struct mei_device { | 199 | struct mei_device { |
199 | struct pci_dev *pdev; /* pointer to pci device struct */ | 200 | struct pci_dev *pdev; /* pointer to pci device struct */ |
@@ -244,11 +245,13 @@ struct mei_device { | |||
244 | u16 init_clients_timer; | 245 | u16 init_clients_timer; |
245 | bool need_reset; | 246 | bool need_reset; |
246 | 247 | ||
247 | u32 extra_write_index; | ||
248 | unsigned char rd_msg_buf[MEI_RD_MSG_BUF_SIZE]; /* control messages */ | 248 | unsigned char rd_msg_buf[MEI_RD_MSG_BUF_SIZE]; /* control messages */ |
249 | u32 wr_msg_buf[128]; /* used for control messages */ | ||
250 | u32 ext_msg_buf[8]; /* for control responses */ | ||
251 | u32 rd_msg_hdr; | 249 | u32 rd_msg_hdr; |
250 | u32 wr_msg_buf[128]; /* used for control messages */ | ||
251 | struct { | ||
252 | struct mei_msg_hdr hdr; | ||
253 | unsigned char data[4]; /* All HBM messages are 4 bytes */ | ||
254 | } wr_ext_msg; /* for control responses */ | ||
252 | 255 | ||
253 | struct hbm_version version; | 256 | struct hbm_version version; |
254 | 257 | ||