aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/misc/mei/hw.h22
-rw-r--r--drivers/misc/mei/interface.c22
-rw-r--r--drivers/misc/mei/interrupt.c17
3 files changed, 34 insertions, 27 deletions
diff --git a/drivers/misc/mei/hw.h b/drivers/misc/mei/hw.h
index f21721aa4dc1..be8ca6b333ca 100644
--- a/drivers/misc/mei/hw.h
+++ b/drivers/misc/mei/hw.h
@@ -293,6 +293,14 @@ struct hbm_props_response {
293 struct mei_client_properties client_properties; 293 struct mei_client_properties client_properties;
294} __packed; 294} __packed;
295 295
296/**
297 * struct hbm_client_connect_request - connect/disconnect request
298 *
299 * @hbm_cmd - bus message command header
300 * @me_addr - address of the client in ME
301 * @host_addr - address of the client in the driver
302 * @reserved
303 */
296struct hbm_client_connect_request { 304struct hbm_client_connect_request {
297 u8 hbm_cmd; 305 u8 hbm_cmd;
298 u8 me_addr; 306 u8 me_addr;
@@ -300,6 +308,14 @@ struct hbm_client_connect_request {
300 u8 reserved; 308 u8 reserved;
301} __packed; 309} __packed;
302 310
311/**
312 * struct hbm_client_connect_response - connect/disconnect response
313 *
314 * @hbm_cmd - bus message command header
315 * @me_addr - address of the client in ME
316 * @host_addr - address of the client in the driver
317 * @status - status of the request
318 */
303struct hbm_client_connect_response { 319struct hbm_client_connect_response {
304 u8 hbm_cmd; 320 u8 hbm_cmd;
305 u8 me_addr; 321 u8 me_addr;
@@ -307,12 +323,6 @@ struct hbm_client_connect_response {
307 u8 status; 323 u8 status;
308} __packed; 324} __packed;
309 325
310struct hbm_client_disconnect_request {
311 u8 hbm_cmd;
312 u8 me_addr;
313 u8 host_addr;
314 u8 reserved[1];
315} __packed;
316 326
317#define MEI_FC_MESSAGE_RESERVED_LENGTH 5 327#define MEI_FC_MESSAGE_RESERVED_LENGTH 5
318 328
diff --git a/drivers/misc/mei/interface.c b/drivers/misc/mei/interface.c
index 509c3957ff45..6b50cf0253e5 100644
--- a/drivers/misc/mei/interface.c
+++ b/drivers/misc/mei/interface.c
@@ -352,26 +352,24 @@ int mei_other_client_is_connecting(struct mei_device *dev,
352int mei_disconnect(struct mei_device *dev, struct mei_cl *cl) 352int mei_disconnect(struct mei_device *dev, struct mei_cl *cl)
353{ 353{
354 struct mei_msg_hdr *mei_hdr; 354 struct mei_msg_hdr *mei_hdr;
355 struct hbm_client_disconnect_request *mei_cli_disconnect; 355 struct hbm_client_connect_request *req;
356 356
357 mei_hdr = (struct mei_msg_hdr *) &dev->wr_msg_buf[0]; 357 mei_hdr = (struct mei_msg_hdr *) &dev->wr_msg_buf[0];
358 mei_hdr->host_addr = 0; 358 mei_hdr->host_addr = 0;
359 mei_hdr->me_addr = 0; 359 mei_hdr->me_addr = 0;
360 mei_hdr->length = sizeof(struct hbm_client_disconnect_request); 360 mei_hdr->length = sizeof(struct hbm_client_connect_request);
361 mei_hdr->msg_complete = 1; 361 mei_hdr->msg_complete = 1;
362 mei_hdr->reserved = 0; 362 mei_hdr->reserved = 0;
363 363
364 mei_cli_disconnect = 364 req = (struct hbm_client_connect_request *)&dev->wr_msg_buf[1];
365 (struct hbm_client_disconnect_request *) &dev->wr_msg_buf[1]; 365 memset(req, 0, sizeof(*req));
366 memset(mei_cli_disconnect, 0, sizeof(*mei_cli_disconnect)); 366 req->host_addr = cl->host_client_id;
367 mei_cli_disconnect->host_addr = cl->host_client_id; 367 req->me_addr = cl->me_client_id;
368 mei_cli_disconnect->me_addr = cl->me_client_id; 368 req->hbm_cmd = CLIENT_DISCONNECT_REQ_CMD;
369 mei_cli_disconnect->hbm_cmd = CLIENT_DISCONNECT_REQ_CMD; 369 req->reserved = 0;
370 mei_cli_disconnect->reserved[0] = 0;
371 370
372 return mei_write_message(dev, mei_hdr, 371 return mei_write_message(dev, mei_hdr, (unsigned char *)req,
373 (unsigned char *) mei_cli_disconnect, 372 sizeof(struct hbm_client_connect_request));
374 sizeof(struct hbm_client_disconnect_request));
375} 373}
376 374
377/** 375/**
diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c
index 34e20cc54607..f8821015f3f6 100644
--- a/drivers/misc/mei/interrupt.c
+++ b/drivers/misc/mei/interrupt.c
@@ -174,10 +174,10 @@ static int _mei_irq_thread_close(struct mei_device *dev, s32 *slots,
174 struct mei_cl_cb *cmpl_list) 174 struct mei_cl_cb *cmpl_list)
175{ 175{
176 if ((*slots * sizeof(u32)) < (sizeof(struct mei_msg_hdr) + 176 if ((*slots * sizeof(u32)) < (sizeof(struct mei_msg_hdr) +
177 sizeof(struct hbm_client_disconnect_request))) 177 sizeof(struct hbm_client_connect_request)))
178 return -EBADMSG; 178 return -EBADMSG;
179 179
180 *slots -= mei_data2slots(sizeof(struct hbm_client_disconnect_request)); 180 *slots -= mei_data2slots(sizeof(struct hbm_client_connect_request));
181 181
182 if (mei_disconnect(dev, cl)) { 182 if (mei_disconnect(dev, cl)) {
183 cl->status = 0; 183 cl->status = 0;
@@ -414,10 +414,10 @@ static void mei_client_flow_control_response(struct mei_device *dev,
414 * returns !=0, same; 0,not. 414 * returns !=0, same; 0,not.
415 */ 415 */
416static int same_disconn_addr(struct mei_cl *cl, 416static int same_disconn_addr(struct mei_cl *cl,
417 struct hbm_client_disconnect_request *disconn) 417 struct hbm_client_connect_request *req)
418{ 418{
419 return (cl->host_client_id == disconn->host_addr && 419 return (cl->host_client_id == req->host_addr &&
420 cl->me_client_id == disconn->me_addr); 420 cl->me_client_id == req->me_addr);
421} 421}
422 422
423/** 423/**
@@ -427,7 +427,7 @@ static int same_disconn_addr(struct mei_cl *cl,
427 * @disconnect_req: disconnect request bus message. 427 * @disconnect_req: disconnect request bus message.
428 */ 428 */
429static void mei_client_disconnect_request(struct mei_device *dev, 429static void mei_client_disconnect_request(struct mei_device *dev,
430 struct hbm_client_disconnect_request *disconnect_req) 430 struct hbm_client_connect_request *disconnect_req)
431{ 431{
432 struct mei_msg_hdr *mei_hdr; 432 struct mei_msg_hdr *mei_hdr;
433 struct hbm_client_connect_response *disconnect_res; 433 struct hbm_client_connect_response *disconnect_res;
@@ -484,10 +484,10 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev,
484 struct hbm_host_version_response *version_res; 484 struct hbm_host_version_response *version_res;
485 struct hbm_client_connect_response *connect_res; 485 struct hbm_client_connect_response *connect_res;
486 struct hbm_client_connect_response *disconnect_res; 486 struct hbm_client_connect_response *disconnect_res;
487 struct hbm_client_connect_request *disconnect_req;
487 struct hbm_flow_control *flow_control; 488 struct hbm_flow_control *flow_control;
488 struct hbm_props_response *props_res; 489 struct hbm_props_response *props_res;
489 struct hbm_host_enum_response *enum_res; 490 struct hbm_host_enum_response *enum_res;
490 struct hbm_client_disconnect_request *disconnect_req;
491 struct hbm_host_stop_request *host_stop_req; 491 struct hbm_host_stop_request *host_stop_req;
492 int res; 492 int res;
493 493
@@ -653,8 +653,7 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev,
653 653
654 case CLIENT_DISCONNECT_REQ_CMD: 654 case CLIENT_DISCONNECT_REQ_CMD:
655 /* search for client */ 655 /* search for client */
656 disconnect_req = 656 disconnect_req = (struct hbm_client_connect_request *)mei_msg;
657 (struct hbm_client_disconnect_request *) mei_msg;
658 mei_client_disconnect_request(dev, disconnect_req); 657 mei_client_disconnect_request(dev, disconnect_req);
659 break; 658 break;
660 659