aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/mei/interrupt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/mei/interrupt.c')
-rw-r--r--drivers/misc/mei/interrupt.c44
1 files changed, 17 insertions, 27 deletions
diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c
index d78c05e693f7..3533edde04a5 100644
--- a/drivers/misc/mei/interrupt.c
+++ b/drivers/misc/mei/interrupt.c
@@ -221,17 +221,10 @@ static int mei_irq_thread_read_client_message(struct mei_io_list *complete_list,
221 cl->status = 0; 221 cl->status = 0;
222 list_del(&cb_pos->cb_list); 222 list_del(&cb_pos->cb_list);
223 dev_dbg(&dev->pdev->dev, 223 dev_dbg(&dev->pdev->dev,
224 "completed read host client = %d," 224 "completed read H cl = %d, ME cl = %d, length = %lu\n",
225 "ME client = %d, "
226 "data length = %lu\n",
227 cl->host_client_id, 225 cl->host_client_id,
228 cl->me_client_id, 226 cl->me_client_id,
229 cb_pos->information); 227 cb_pos->information);
230
231 *(cb_pos->response_buffer.data +
232 cb_pos->information) = '\0';
233 dev_dbg(&dev->pdev->dev, "cb_pos->res_buffer - %s\n",
234 cb_pos->response_buffer.data);
235 list_add_tail(&cb_pos->cb_list, 228 list_add_tail(&cb_pos->cb_list,
236 &complete_list->mei_cb.cb_list); 229 &complete_list->mei_cb.cb_list);
237 } 230 }
@@ -633,7 +626,7 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev,
633 if (version_res->host_version_supported) { 626 if (version_res->host_version_supported) {
634 dev->version.major_version = HBM_MAJOR_VERSION; 627 dev->version.major_version = HBM_MAJOR_VERSION;
635 dev->version.minor_version = HBM_MINOR_VERSION; 628 dev->version.minor_version = HBM_MINOR_VERSION;
636 if (dev->mei_state == MEI_INIT_CLIENTS && 629 if (dev->dev_state == MEI_DEV_INIT_CLIENTS &&
637 dev->init_clients_state == MEI_START_MESSAGE) { 630 dev->init_clients_state == MEI_START_MESSAGE) {
638 dev->init_clients_timer = 0; 631 dev->init_clients_timer = 0;
639 mei_host_enum_clients_message(dev); 632 mei_host_enum_clients_message(dev);
@@ -707,7 +700,7 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev,
707 dev->me_clients[dev->me_client_presentation_num].props 700 dev->me_clients[dev->me_client_presentation_num].props
708 = props_res->client_properties; 701 = props_res->client_properties;
709 702
710 if (dev->mei_state == MEI_INIT_CLIENTS && 703 if (dev->dev_state == MEI_DEV_INIT_CLIENTS &&
711 dev->init_clients_state == 704 dev->init_clients_state ==
712 MEI_CLIENT_PROPERTIES_MESSAGE) { 705 MEI_CLIENT_PROPERTIES_MESSAGE) {
713 dev->me_client_index++; 706 dev->me_client_index++;
@@ -734,7 +727,7 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev,
734 * Client ID 2 - Reserved for AMTHI 727 * Client ID 2 - Reserved for AMTHI
735 */ 728 */
736 bitmap_set(dev->host_clients_map, 0, 3); 729 bitmap_set(dev->host_clients_map, 0, 3);
737 dev->mei_state = MEI_ENABLED; 730 dev->dev_state = MEI_DEV_ENABLED;
738 731
739 /* if wd initialization fails, initialization the AMTHI client, 732 /* if wd initialization fails, initialization the AMTHI client,
740 * otherwise the AMTHI client will be initialized after the WD client connect response 733 * otherwise the AMTHI client will be initialized after the WD client connect response
@@ -759,7 +752,7 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev,
759 case HOST_ENUM_RES_CMD: 752 case HOST_ENUM_RES_CMD:
760 enum_res = (struct hbm_host_enum_response *) mei_msg; 753 enum_res = (struct hbm_host_enum_response *) mei_msg;
761 memcpy(dev->me_clients_map, enum_res->valid_addresses, 32); 754 memcpy(dev->me_clients_map, enum_res->valid_addresses, 32);
762 if (dev->mei_state == MEI_INIT_CLIENTS && 755 if (dev->dev_state == MEI_DEV_INIT_CLIENTS &&
763 dev->init_clients_state == MEI_ENUM_CLIENTS_MESSAGE) { 756 dev->init_clients_state == MEI_ENUM_CLIENTS_MESSAGE) {
764 dev->init_clients_timer = 0; 757 dev->init_clients_timer = 0;
765 dev->me_client_presentation_num = 0; 758 dev->me_client_presentation_num = 0;
@@ -776,7 +769,7 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev,
776 break; 769 break;
777 770
778 case HOST_STOP_RES_CMD: 771 case HOST_STOP_RES_CMD:
779 dev->mei_state = MEI_DISABLED; 772 dev->dev_state = MEI_DEV_DISABLED;
780 dev_dbg(&dev->pdev->dev, "resetting because of FW stop response.\n"); 773 dev_dbg(&dev->pdev->dev, "resetting because of FW stop response.\n");
781 mei_reset(dev, 1); 774 mei_reset(dev, 1);
782 break; 775 break;
@@ -1224,10 +1217,9 @@ static int mei_irq_thread_write_handler(struct mei_io_list *cmpl_list,
1224 } 1217 }
1225 } 1218 }
1226 1219
1227 if (dev->stop && !dev->wd_pending) { 1220 if (dev->wd_state == MEI_WD_STOPPING) {
1228 dev->wd_stopped = true; 1221 dev->wd_state = MEI_WD_IDLE;
1229 wake_up_interruptible(&dev->wait_stop_wd); 1222 wake_up_interruptible(&dev->wait_stop_wd);
1230 return 0;
1231 } 1223 }
1232 1224
1233 if (dev->extra_write_index) { 1225 if (dev->extra_write_index) {
@@ -1240,7 +1232,7 @@ static int mei_irq_thread_write_handler(struct mei_io_list *cmpl_list,
1240 *slots -= dev->extra_write_index; 1232 *slots -= dev->extra_write_index;
1241 dev->extra_write_index = 0; 1233 dev->extra_write_index = 0;
1242 } 1234 }
1243 if (dev->mei_state == MEI_ENABLED) { 1235 if (dev->dev_state == MEI_DEV_ENABLED) {
1244 if (dev->wd_pending && 1236 if (dev->wd_pending &&
1245 mei_flow_ctrl_creds(dev, &dev->wd_cl) > 0) { 1237 mei_flow_ctrl_creds(dev, &dev->wd_cl) > 0) {
1246 if (mei_wd_send(dev)) 1238 if (mei_wd_send(dev))
@@ -1250,14 +1242,12 @@ static int mei_irq_thread_write_handler(struct mei_io_list *cmpl_list,
1250 1242
1251 dev->wd_pending = false; 1243 dev->wd_pending = false;
1252 1244
1253 if (dev->wd_timeout) 1245 if (dev->wd_state == MEI_WD_RUNNING)
1254 *slots -= mei_data2slots(MEI_START_WD_DATA_SIZE); 1246 *slots -= mei_data2slots(MEI_WD_START_MSG_SIZE);
1255 else 1247 else
1256 *slots -= mei_data2slots(MEI_WD_PARAMS_SIZE); 1248 *slots -= mei_data2slots(MEI_WD_STOP_MSG_SIZE);
1257 } 1249 }
1258 } 1250 }
1259 if (dev->stop)
1260 return -ENODEV;
1261 1251
1262 /* complete control write list CB */ 1252 /* complete control write list CB */
1263 dev_dbg(&dev->pdev->dev, "complete control write list cb.\n"); 1253 dev_dbg(&dev->pdev->dev, "complete control write list cb.\n");
@@ -1361,8 +1351,8 @@ void mei_timer(struct work_struct *work)
1361 1351
1362 1352
1363 mutex_lock(&dev->device_lock); 1353 mutex_lock(&dev->device_lock);
1364 if (dev->mei_state != MEI_ENABLED) { 1354 if (dev->dev_state != MEI_DEV_ENABLED) {
1365 if (dev->mei_state == MEI_INIT_CLIENTS) { 1355 if (dev->dev_state == MEI_DEV_INIT_CLIENTS) {
1366 if (dev->init_clients_timer) { 1356 if (dev->init_clients_timer) {
1367 if (--dev->init_clients_timer == 0) { 1357 if (--dev->init_clients_timer == 0) {
1368 dev_dbg(&dev->pdev->dev, "IMEI reset due to init clients timeout ,init clients state = %d.\n", 1358 dev_dbg(&dev->pdev->dev, "IMEI reset due to init clients timeout ,init clients state = %d.\n",
@@ -1484,8 +1474,8 @@ irqreturn_t mei_interrupt_thread_handler(int irq, void *dev_id)
1484 1474
1485 /* check if ME wants a reset */ 1475 /* check if ME wants a reset */
1486 if ((dev->me_hw_state & ME_RDY_HRA) == 0 && 1476 if ((dev->me_hw_state & ME_RDY_HRA) == 0 &&
1487 dev->mei_state != MEI_RESETING && 1477 dev->dev_state != MEI_DEV_RESETING &&
1488 dev->mei_state != MEI_INITIALIZING) { 1478 dev->dev_state != MEI_DEV_INITIALIZING) {
1489 dev_dbg(&dev->pdev->dev, "FW not ready.\n"); 1479 dev_dbg(&dev->pdev->dev, "FW not ready.\n");
1490 mei_reset(dev, 1); 1480 mei_reset(dev, 1);
1491 mutex_unlock(&dev->device_lock); 1481 mutex_unlock(&dev->device_lock);
@@ -1498,7 +1488,7 @@ irqreturn_t mei_interrupt_thread_handler(int irq, void *dev_id)
1498 dev_dbg(&dev->pdev->dev, "we need to start the dev.\n"); 1488 dev_dbg(&dev->pdev->dev, "we need to start the dev.\n");
1499 dev->host_hw_state |= (H_IE | H_IG | H_RDY); 1489 dev->host_hw_state |= (H_IE | H_IG | H_RDY);
1500 mei_hcsr_set(dev); 1490 mei_hcsr_set(dev);
1501 dev->mei_state = MEI_INIT_CLIENTS; 1491 dev->dev_state = MEI_DEV_INIT_CLIENTS;
1502 dev_dbg(&dev->pdev->dev, "link is established start sending messages.\n"); 1492 dev_dbg(&dev->pdev->dev, "link is established start sending messages.\n");
1503 /* link is established 1493 /* link is established
1504 * start sending messages. 1494 * start sending messages.