diff options
-rw-r--r-- | drivers/misc/mei/init.c | 78 | ||||
-rw-r--r-- | drivers/misc/mei/interface.c | 75 | ||||
-rw-r--r-- | drivers/misc/mei/interrupt.c | 96 | ||||
-rw-r--r-- | drivers/misc/mei/mei_dev.h | 11 |
4 files changed, 112 insertions, 148 deletions
diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c index 4fcb0bb2c9f0..02784af1d1a1 100644 --- a/drivers/misc/mei/init.c +++ b/drivers/misc/mei/init.c | |||
@@ -43,6 +43,7 @@ const char *mei_dev_state_str(int state) | |||
43 | } | 43 | } |
44 | 44 | ||
45 | 45 | ||
46 | |||
46 | /** | 47 | /** |
47 | * mei_io_list_flush - removes list entry belonging to cl. | 48 | * mei_io_list_flush - removes list entry belonging to cl. |
48 | * | 49 | * |
@@ -331,25 +332,20 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled) | |||
331 | void mei_host_start_message(struct mei_device *dev) | 332 | void mei_host_start_message(struct mei_device *dev) |
332 | { | 333 | { |
333 | struct mei_msg_hdr *mei_hdr; | 334 | struct mei_msg_hdr *mei_hdr; |
334 | struct hbm_host_version_request *host_start_req; | 335 | struct hbm_host_version_request *start_req; |
336 | const size_t len = sizeof(struct hbm_host_version_request); | ||
337 | |||
338 | mei_hdr = mei_hbm_hdr(&dev->wr_msg_buf[0], len); | ||
335 | 339 | ||
336 | /* host start message */ | 340 | /* host start message */ |
337 | mei_hdr = (struct mei_msg_hdr *) &dev->wr_msg_buf[0]; | 341 | start_req = (struct hbm_host_version_request *)&dev->wr_msg_buf[1]; |
338 | mei_hdr->host_addr = 0; | 342 | memset(start_req, 0, len); |
339 | mei_hdr->me_addr = 0; | 343 | start_req->hbm_cmd = HOST_START_REQ_CMD; |
340 | mei_hdr->length = sizeof(struct hbm_host_version_request); | 344 | start_req->host_version.major_version = HBM_MAJOR_VERSION; |
341 | mei_hdr->msg_complete = 1; | 345 | start_req->host_version.minor_version = HBM_MINOR_VERSION; |
342 | mei_hdr->reserved = 0; | 346 | |
343 | |||
344 | host_start_req = | ||
345 | (struct hbm_host_version_request *) &dev->wr_msg_buf[1]; | ||
346 | memset(host_start_req, 0, sizeof(struct hbm_host_version_request)); | ||
347 | host_start_req->hbm_cmd = HOST_START_REQ_CMD; | ||
348 | host_start_req->host_version.major_version = HBM_MAJOR_VERSION; | ||
349 | host_start_req->host_version.minor_version = HBM_MINOR_VERSION; | ||
350 | dev->recvd_msg = false; | 347 | dev->recvd_msg = false; |
351 | if (mei_write_message(dev, mei_hdr, (unsigned char *)host_start_req, | 348 | if (mei_write_message(dev, mei_hdr, (unsigned char *)start_req, len)) { |
352 | mei_hdr->length)) { | ||
353 | dev_dbg(&dev->pdev->dev, "write send version message to FW fail.\n"); | 349 | dev_dbg(&dev->pdev->dev, "write send version message to FW fail.\n"); |
354 | dev->dev_state = MEI_DEV_RESETING; | 350 | dev->dev_state = MEI_DEV_RESETING; |
355 | mei_reset(dev, 1); | 351 | mei_reset(dev, 1); |
@@ -369,20 +365,16 @@ void mei_host_start_message(struct mei_device *dev) | |||
369 | void mei_host_enum_clients_message(struct mei_device *dev) | 365 | void mei_host_enum_clients_message(struct mei_device *dev) |
370 | { | 366 | { |
371 | struct mei_msg_hdr *mei_hdr; | 367 | struct mei_msg_hdr *mei_hdr; |
372 | struct hbm_host_enum_request *host_enum_req; | 368 | struct hbm_host_enum_request *enum_req; |
373 | mei_hdr = (struct mei_msg_hdr *) &dev->wr_msg_buf[0]; | 369 | const size_t len = sizeof(struct hbm_host_enum_request); |
374 | /* enumerate clients */ | 370 | /* enumerate clients */ |
375 | mei_hdr->host_addr = 0; | 371 | mei_hdr = mei_hbm_hdr(&dev->wr_msg_buf[0], len); |
376 | mei_hdr->me_addr = 0; | 372 | |
377 | mei_hdr->length = sizeof(struct hbm_host_enum_request); | 373 | enum_req = (struct hbm_host_enum_request *) &dev->wr_msg_buf[1]; |
378 | mei_hdr->msg_complete = 1; | 374 | memset(enum_req, 0, sizeof(struct hbm_host_enum_request)); |
379 | mei_hdr->reserved = 0; | 375 | enum_req->hbm_cmd = HOST_ENUM_REQ_CMD; |
380 | 376 | ||
381 | host_enum_req = (struct hbm_host_enum_request *) &dev->wr_msg_buf[1]; | 377 | if (mei_write_message(dev, mei_hdr, (unsigned char *)enum_req, len)) { |
382 | memset(host_enum_req, 0, sizeof(struct hbm_host_enum_request)); | ||
383 | host_enum_req->hbm_cmd = HOST_ENUM_REQ_CMD; | ||
384 | if (mei_write_message(dev, mei_hdr, (unsigned char *)host_enum_req, | ||
385 | mei_hdr->length)) { | ||
386 | dev->dev_state = MEI_DEV_RESETING; | 378 | dev->dev_state = MEI_DEV_RESETING; |
387 | dev_dbg(&dev->pdev->dev, "write send enumeration request message to FW fail.\n"); | 379 | dev_dbg(&dev->pdev->dev, "write send enumeration request message to FW fail.\n"); |
388 | mei_reset(dev, 1); | 380 | mei_reset(dev, 1); |
@@ -443,33 +435,31 @@ void mei_allocate_me_clients_storage(struct mei_device *dev) | |||
443 | */ | 435 | */ |
444 | int mei_host_client_properties(struct mei_device *dev) | 436 | int mei_host_client_properties(struct mei_device *dev) |
445 | { | 437 | { |
446 | struct mei_msg_hdr *mei_header; | 438 | |
447 | struct hbm_props_request *host_cli_req; | 439 | struct mei_msg_hdr *mei_hdr; |
440 | struct hbm_props_request *prop_req; | ||
441 | const size_t len = sizeof(struct hbm_props_request); | ||
442 | |||
448 | int b; | 443 | int b; |
449 | u8 client_num = dev->me_client_presentation_num; | 444 | u8 client_num = dev->me_client_presentation_num; |
450 | 445 | ||
446 | prop_req = (struct hbm_props_request *)&dev->wr_msg_buf[1]; | ||
447 | |||
451 | b = dev->me_client_index; | 448 | b = dev->me_client_index; |
452 | b = find_next_bit(dev->me_clients_map, MEI_CLIENTS_MAX, b); | 449 | b = find_next_bit(dev->me_clients_map, MEI_CLIENTS_MAX, b); |
453 | if (b < MEI_CLIENTS_MAX) { | 450 | if (b < MEI_CLIENTS_MAX) { |
454 | dev->me_clients[client_num].client_id = b; | 451 | dev->me_clients[client_num].client_id = b; |
455 | dev->me_clients[client_num].mei_flow_ctrl_creds = 0; | 452 | dev->me_clients[client_num].mei_flow_ctrl_creds = 0; |
456 | mei_header = (struct mei_msg_hdr *)&dev->wr_msg_buf[0]; | 453 | mei_hdr = mei_hbm_hdr(&dev->wr_msg_buf[0], len); |
457 | mei_header->host_addr = 0; | ||
458 | mei_header->me_addr = 0; | ||
459 | mei_header->length = sizeof(struct hbm_props_request); | ||
460 | mei_header->msg_complete = 1; | ||
461 | mei_header->reserved = 0; | ||
462 | 454 | ||
463 | host_cli_req = (struct hbm_props_request *)&dev->wr_msg_buf[1]; | ||
464 | 455 | ||
465 | memset(host_cli_req, 0, sizeof(struct hbm_props_request)); | 456 | memset(prop_req, 0, sizeof(struct hbm_props_request)); |
466 | 457 | ||
467 | host_cli_req->hbm_cmd = HOST_CLIENT_PROPERTIES_REQ_CMD; | 458 | prop_req->hbm_cmd = HOST_CLIENT_PROPERTIES_REQ_CMD; |
468 | host_cli_req->address = b; | 459 | prop_req->address = b; |
469 | 460 | ||
470 | if (mei_write_message(dev, mei_header, | 461 | if (mei_write_message(dev, mei_hdr, |
471 | (unsigned char *)host_cli_req, | 462 | (unsigned char *)prop_req, len)) { |
472 | mei_header->length)) { | ||
473 | dev->dev_state = MEI_DEV_RESETING; | 463 | dev->dev_state = MEI_DEV_RESETING; |
474 | dev_dbg(&dev->pdev->dev, "write send enumeration request message to FW fail.\n"); | 464 | dev_dbg(&dev->pdev->dev, "write send enumeration request message to FW fail.\n"); |
475 | mei_reset(dev, 1); | 465 | mei_reset(dev, 1); |
diff --git a/drivers/misc/mei/interface.c b/drivers/misc/mei/interface.c index 6b50cf0253e5..8de854785960 100644 --- a/drivers/misc/mei/interface.c +++ b/drivers/misc/mei/interface.c | |||
@@ -292,28 +292,23 @@ int mei_flow_ctrl_reduce(struct mei_device *dev, struct mei_cl *cl) | |||
292 | int mei_send_flow_control(struct mei_device *dev, struct mei_cl *cl) | 292 | int mei_send_flow_control(struct mei_device *dev, struct mei_cl *cl) |
293 | { | 293 | { |
294 | struct mei_msg_hdr *mei_hdr; | 294 | struct mei_msg_hdr *mei_hdr; |
295 | struct hbm_flow_control *mei_flow_control; | 295 | struct hbm_flow_control *flow_ctrl; |
296 | 296 | const size_t len = sizeof(struct hbm_flow_control); | |
297 | mei_hdr = (struct mei_msg_hdr *) &dev->wr_msg_buf[0]; | 297 | |
298 | mei_hdr->host_addr = 0; | 298 | mei_hdr = mei_hbm_hdr(&dev->wr_msg_buf[0], len); |
299 | mei_hdr->me_addr = 0; | 299 | |
300 | mei_hdr->length = sizeof(struct hbm_flow_control); | 300 | flow_ctrl = (struct hbm_flow_control *)&dev->wr_msg_buf[1]; |
301 | mei_hdr->msg_complete = 1; | 301 | memset(flow_ctrl, 0, len); |
302 | mei_hdr->reserved = 0; | 302 | flow_ctrl->hbm_cmd = MEI_FLOW_CONTROL_CMD; |
303 | 303 | flow_ctrl->host_addr = cl->host_client_id; | |
304 | mei_flow_control = (struct hbm_flow_control *) &dev->wr_msg_buf[1]; | 304 | flow_ctrl->me_addr = cl->me_client_id; |
305 | memset(mei_flow_control, 0, sizeof(*mei_flow_control)); | 305 | /* FIXME: reserved !? */ |
306 | mei_flow_control->host_addr = cl->host_client_id; | 306 | memset(flow_ctrl->reserved, 0, sizeof(flow_ctrl->reserved)); |
307 | mei_flow_control->me_addr = cl->me_client_id; | ||
308 | mei_flow_control->hbm_cmd = MEI_FLOW_CONTROL_CMD; | ||
309 | memset(mei_flow_control->reserved, 0, | ||
310 | sizeof(mei_flow_control->reserved)); | ||
311 | dev_dbg(&dev->pdev->dev, "sending flow control host client = %d, ME client = %d\n", | 307 | dev_dbg(&dev->pdev->dev, "sending flow control host client = %d, ME client = %d\n", |
312 | cl->host_client_id, cl->me_client_id); | 308 | cl->host_client_id, cl->me_client_id); |
313 | 309 | ||
314 | return mei_write_message(dev, mei_hdr, | 310 | return mei_write_message(dev, mei_hdr, |
315 | (unsigned char *) mei_flow_control, | 311 | (unsigned char *) flow_ctrl, len); |
316 | sizeof(struct hbm_flow_control)); | ||
317 | } | 312 | } |
318 | 313 | ||
319 | /** | 314 | /** |
@@ -353,23 +348,18 @@ int mei_disconnect(struct mei_device *dev, struct mei_cl *cl) | |||
353 | { | 348 | { |
354 | struct mei_msg_hdr *mei_hdr; | 349 | struct mei_msg_hdr *mei_hdr; |
355 | struct hbm_client_connect_request *req; | 350 | struct hbm_client_connect_request *req; |
351 | const size_t len = sizeof(struct hbm_client_connect_request); | ||
356 | 352 | ||
357 | mei_hdr = (struct mei_msg_hdr *) &dev->wr_msg_buf[0]; | 353 | mei_hdr = mei_hbm_hdr(&dev->wr_msg_buf[0], len); |
358 | mei_hdr->host_addr = 0; | ||
359 | mei_hdr->me_addr = 0; | ||
360 | mei_hdr->length = sizeof(struct hbm_client_connect_request); | ||
361 | mei_hdr->msg_complete = 1; | ||
362 | mei_hdr->reserved = 0; | ||
363 | 354 | ||
364 | req = (struct hbm_client_connect_request *)&dev->wr_msg_buf[1]; | 355 | req = (struct hbm_client_connect_request *)&dev->wr_msg_buf[1]; |
365 | memset(req, 0, sizeof(*req)); | 356 | memset(req, 0, len); |
357 | req->hbm_cmd = CLIENT_DISCONNECT_REQ_CMD; | ||
366 | req->host_addr = cl->host_client_id; | 358 | req->host_addr = cl->host_client_id; |
367 | req->me_addr = cl->me_client_id; | 359 | req->me_addr = cl->me_client_id; |
368 | req->hbm_cmd = CLIENT_DISCONNECT_REQ_CMD; | ||
369 | req->reserved = 0; | 360 | req->reserved = 0; |
370 | 361 | ||
371 | return mei_write_message(dev, mei_hdr, (unsigned char *)req, | 362 | return mei_write_message(dev, mei_hdr, (unsigned char *)req, len); |
372 | sizeof(struct hbm_client_connect_request)); | ||
373 | } | 363 | } |
374 | 364 | ||
375 | /** | 365 | /** |
@@ -383,23 +373,16 @@ int mei_disconnect(struct mei_device *dev, struct mei_cl *cl) | |||
383 | int mei_connect(struct mei_device *dev, struct mei_cl *cl) | 373 | int mei_connect(struct mei_device *dev, struct mei_cl *cl) |
384 | { | 374 | { |
385 | struct mei_msg_hdr *mei_hdr; | 375 | struct mei_msg_hdr *mei_hdr; |
386 | struct hbm_client_connect_request *mei_cli_connect; | 376 | struct hbm_client_connect_request *req; |
387 | 377 | const size_t len = sizeof(struct hbm_client_connect_request); | |
388 | mei_hdr = (struct mei_msg_hdr *) &dev->wr_msg_buf[0]; | ||
389 | mei_hdr->host_addr = 0; | ||
390 | mei_hdr->me_addr = 0; | ||
391 | mei_hdr->length = sizeof(struct hbm_client_connect_request); | ||
392 | mei_hdr->msg_complete = 1; | ||
393 | mei_hdr->reserved = 0; | ||
394 | |||
395 | mei_cli_connect = | ||
396 | (struct hbm_client_connect_request *) &dev->wr_msg_buf[1]; | ||
397 | mei_cli_connect->host_addr = cl->host_client_id; | ||
398 | mei_cli_connect->me_addr = cl->me_client_id; | ||
399 | mei_cli_connect->hbm_cmd = CLIENT_CONNECT_REQ_CMD; | ||
400 | mei_cli_connect->reserved = 0; | ||
401 | 378 | ||
402 | return mei_write_message(dev, mei_hdr, | 379 | mei_hdr = mei_hbm_hdr(&dev->wr_msg_buf[0], len); |
403 | (unsigned char *) mei_cli_connect, | 380 | |
404 | sizeof(struct hbm_client_connect_request)); | 381 | req = (struct hbm_client_connect_request *) &dev->wr_msg_buf[1]; |
382 | req->hbm_cmd = CLIENT_CONNECT_REQ_CMD; | ||
383 | req->host_addr = cl->host_client_id; | ||
384 | req->me_addr = cl->me_client_id; | ||
385 | req->reserved = 0; | ||
386 | |||
387 | return mei_write_message(dev, mei_hdr, (unsigned char *) req, len); | ||
405 | } | 388 | } |
diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c index f8821015f3f6..14becc0d5563 100644 --- a/drivers/misc/mei/interrupt.c +++ b/drivers/misc/mei/interrupt.c | |||
@@ -429,39 +429,30 @@ static int same_disconn_addr(struct mei_cl *cl, | |||
429 | static void mei_client_disconnect_request(struct mei_device *dev, | 429 | static void mei_client_disconnect_request(struct mei_device *dev, |
430 | struct hbm_client_connect_request *disconnect_req) | 430 | struct hbm_client_connect_request *disconnect_req) |
431 | { | 431 | { |
432 | struct mei_msg_hdr *mei_hdr; | ||
433 | struct hbm_client_connect_response *disconnect_res; | 432 | struct hbm_client_connect_response *disconnect_res; |
434 | struct mei_cl *cl_pos = NULL; | 433 | struct mei_cl *pos, *next; |
435 | struct mei_cl *cl_next = NULL; | 434 | const size_t len = sizeof(struct hbm_client_connect_response); |
436 | 435 | ||
437 | list_for_each_entry_safe(cl_pos, cl_next, &dev->file_list, link) { | 436 | list_for_each_entry_safe(pos, next, &dev->file_list, link) { |
438 | if (same_disconn_addr(cl_pos, disconnect_req)) { | 437 | if (same_disconn_addr(pos, disconnect_req)) { |
439 | dev_dbg(&dev->pdev->dev, "disconnect request host client %d ME client %d.\n", | 438 | dev_dbg(&dev->pdev->dev, "disconnect request host client %d ME client %d.\n", |
440 | disconnect_req->host_addr, | 439 | disconnect_req->host_addr, |
441 | disconnect_req->me_addr); | 440 | disconnect_req->me_addr); |
442 | cl_pos->state = MEI_FILE_DISCONNECTED; | 441 | pos->state = MEI_FILE_DISCONNECTED; |
443 | cl_pos->timer_count = 0; | 442 | pos->timer_count = 0; |
444 | if (cl_pos == &dev->wd_cl) | 443 | if (pos == &dev->wd_cl) |
445 | dev->wd_pending = false; | 444 | dev->wd_pending = false; |
446 | else if (cl_pos == &dev->iamthif_cl) | 445 | else if (pos == &dev->iamthif_cl) |
447 | dev->iamthif_timer = 0; | 446 | dev->iamthif_timer = 0; |
448 | 447 | ||
449 | /* prepare disconnect response */ | 448 | /* prepare disconnect response */ |
450 | mei_hdr = | 449 | (void)mei_hbm_hdr(&dev->ext_msg_buf[0], len); |
451 | (struct mei_msg_hdr *) &dev->ext_msg_buf[0]; | ||
452 | mei_hdr->host_addr = 0; | ||
453 | mei_hdr->me_addr = 0; | ||
454 | mei_hdr->length = | ||
455 | sizeof(struct hbm_client_connect_response); | ||
456 | mei_hdr->msg_complete = 1; | ||
457 | mei_hdr->reserved = 0; | ||
458 | |||
459 | disconnect_res = | 450 | disconnect_res = |
460 | (struct hbm_client_connect_response *) | 451 | (struct hbm_client_connect_response *) |
461 | &dev->ext_msg_buf[1]; | 452 | &dev->ext_msg_buf[1]; |
462 | disconnect_res->host_addr = cl_pos->host_client_id; | ||
463 | disconnect_res->me_addr = cl_pos->me_client_id; | ||
464 | 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; | ||
455 | disconnect_res->me_addr = pos->me_client_id; | ||
465 | disconnect_res->status = 0; | 456 | disconnect_res->status = 0; |
466 | dev->extra_write_index = 2; | 457 | dev->extra_write_index = 2; |
467 | break; | 458 | break; |
@@ -469,7 +460,6 @@ static void mei_client_disconnect_request(struct mei_device *dev, | |||
469 | } | 460 | } |
470 | } | 461 | } |
471 | 462 | ||
472 | |||
473 | /** | 463 | /** |
474 | * mei_irq_thread_read_bus_message - bottom half read routine after ISR to | 464 | * mei_irq_thread_read_bus_message - bottom half read routine after ISR to |
475 | * handle the read bus message cmd processing. | 465 | * handle the read bus message cmd processing. |
@@ -488,7 +478,7 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev, | |||
488 | struct hbm_flow_control *flow_control; | 478 | struct hbm_flow_control *flow_control; |
489 | struct hbm_props_response *props_res; | 479 | struct hbm_props_response *props_res; |
490 | struct hbm_host_enum_response *enum_res; | 480 | struct hbm_host_enum_response *enum_res; |
491 | struct hbm_host_stop_request *host_stop_req; | 481 | struct hbm_host_stop_request *stop_req; |
492 | int res; | 482 | int res; |
493 | 483 | ||
494 | 484 | ||
@@ -514,26 +504,20 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev, | |||
514 | return; | 504 | return; |
515 | } | 505 | } |
516 | } else { | 506 | } else { |
507 | u32 *buf = dev->wr_msg_buf; | ||
508 | const size_t len = sizeof(struct hbm_host_stop_request); | ||
509 | |||
517 | dev->version = version_res->me_max_version; | 510 | dev->version = version_res->me_max_version; |
511 | |||
518 | /* send stop message */ | 512 | /* send stop message */ |
519 | mei_hdr = (struct mei_msg_hdr *)&dev->wr_msg_buf[0]; | 513 | mei_hdr = mei_hbm_hdr(&buf[0], len); |
520 | mei_hdr->host_addr = 0; | 514 | stop_req = (struct hbm_host_stop_request *)&buf[1]; |
521 | mei_hdr->me_addr = 0; | 515 | memset(stop_req, 0, len); |
522 | mei_hdr->length = sizeof(struct hbm_host_stop_request); | 516 | stop_req->hbm_cmd = HOST_STOP_REQ_CMD; |
523 | mei_hdr->msg_complete = 1; | 517 | stop_req->reason = DRIVER_STOP_REQUEST; |
524 | mei_hdr->reserved = 0; | 518 | |
525 | |||
526 | host_stop_req = (struct hbm_host_stop_request *) | ||
527 | &dev->wr_msg_buf[1]; | ||
528 | |||
529 | memset(host_stop_req, | ||
530 | 0, | ||
531 | sizeof(struct hbm_host_stop_request)); | ||
532 | host_stop_req->hbm_cmd = HOST_STOP_REQ_CMD; | ||
533 | host_stop_req->reason = DRIVER_STOP_REQUEST; | ||
534 | mei_write_message(dev, mei_hdr, | 519 | mei_write_message(dev, mei_hdr, |
535 | (unsigned char *) (host_stop_req), | 520 | (unsigned char *)stop_req, len); |
536 | mei_hdr->length); | ||
537 | dev_dbg(&dev->pdev->dev, "version mismatch.\n"); | 521 | dev_dbg(&dev->pdev->dev, "version mismatch.\n"); |
538 | return; | 522 | return; |
539 | } | 523 | } |
@@ -543,16 +527,14 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev, | |||
543 | break; | 527 | break; |
544 | 528 | ||
545 | case CLIENT_CONNECT_RES_CMD: | 529 | case CLIENT_CONNECT_RES_CMD: |
546 | connect_res = | 530 | connect_res = (struct hbm_client_connect_response *) mei_msg; |
547 | (struct hbm_client_connect_response *) mei_msg; | ||
548 | mei_client_connect_response(dev, connect_res); | 531 | mei_client_connect_response(dev, connect_res); |
549 | dev_dbg(&dev->pdev->dev, "client connect response message received.\n"); | 532 | dev_dbg(&dev->pdev->dev, "client connect response message received.\n"); |
550 | wake_up(&dev->wait_recvd_msg); | 533 | wake_up(&dev->wait_recvd_msg); |
551 | break; | 534 | break; |
552 | 535 | ||
553 | case CLIENT_DISCONNECT_RES_CMD: | 536 | case CLIENT_DISCONNECT_RES_CMD: |
554 | disconnect_res = | 537 | disconnect_res = (struct hbm_client_connect_response *) mei_msg; |
555 | (struct hbm_client_connect_response *) mei_msg; | ||
556 | mei_client_disconnect_response(dev, disconnect_res); | 538 | mei_client_disconnect_response(dev, disconnect_res); |
557 | dev_dbg(&dev->pdev->dev, "client disconnect response message received.\n"); | 539 | dev_dbg(&dev->pdev->dev, "client disconnect response message received.\n"); |
558 | wake_up(&dev->wait_recvd_msg); | 540 | wake_up(&dev->wait_recvd_msg); |
@@ -658,23 +640,21 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev, | |||
658 | break; | 640 | break; |
659 | 641 | ||
660 | case ME_STOP_REQ_CMD: | 642 | case ME_STOP_REQ_CMD: |
661 | /* prepare stop request */ | 643 | { |
662 | mei_hdr = (struct mei_msg_hdr *) &dev->ext_msg_buf[0]; | 644 | /* prepare stop request: sent in next interrupt event */ |
663 | mei_hdr->host_addr = 0; | 645 | |
664 | mei_hdr->me_addr = 0; | 646 | u32 *buf = dev->ext_msg_buf; |
665 | mei_hdr->length = sizeof(struct hbm_host_stop_request); | 647 | const size_t len = sizeof(struct hbm_host_stop_request); |
666 | mei_hdr->msg_complete = 1; | 648 | |
667 | mei_hdr->reserved = 0; | 649 | mei_hdr = mei_hbm_hdr(&buf[0], len); |
668 | host_stop_req = | 650 | stop_req = (struct hbm_host_stop_request *)&buf[1]; |
669 | (struct hbm_host_stop_request *) &dev->ext_msg_buf[1]; | 651 | memset(stop_req, 0, len); |
670 | memset(host_stop_req, 0, sizeof(struct hbm_host_stop_request)); | 652 | stop_req->hbm_cmd = HOST_STOP_REQ_CMD; |
671 | host_stop_req->hbm_cmd = HOST_STOP_REQ_CMD; | 653 | stop_req->reason = DRIVER_STOP_REQUEST; |
672 | host_stop_req->reason = DRIVER_STOP_REQUEST; | 654 | |
673 | host_stop_req->reserved[0] = 0; | ||
674 | host_stop_req->reserved[1] = 0; | ||
675 | dev->extra_write_index = 2; | 655 | dev->extra_write_index = 2; |
676 | break; | 656 | break; |
677 | 657 | } | |
678 | default: | 658 | default: |
679 | BUG(); | 659 | BUG(); |
680 | break; | 660 | break; |
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h index aaee666577b4..e511b84ff4ce 100644 --- a/drivers/misc/mei/mei_dev.h +++ b/drivers/misc/mei/mei_dev.h | |||
@@ -491,4 +491,15 @@ void mei_csr_clear_his(struct mei_device *dev); | |||
491 | void mei_enable_interrupts(struct mei_device *dev); | 491 | void mei_enable_interrupts(struct mei_device *dev); |
492 | void mei_disable_interrupts(struct mei_device *dev); | 492 | void mei_disable_interrupts(struct mei_device *dev); |
493 | 493 | ||
494 | static inline struct mei_msg_hdr *mei_hbm_hdr(u32 *buf, size_t length) | ||
495 | { | ||
496 | struct mei_msg_hdr *hdr = (struct mei_msg_hdr *)buf; | ||
497 | hdr->host_addr = 0; | ||
498 | hdr->me_addr = 0; | ||
499 | hdr->length = length; | ||
500 | hdr->msg_complete = 1; | ||
501 | hdr->reserved = 0; | ||
502 | return hdr; | ||
503 | } | ||
504 | |||
494 | #endif | 505 | #endif |