aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/misc/mei/amthif.c7
-rw-r--r--drivers/misc/mei/hbm.c56
-rw-r--r--drivers/misc/mei/init.c4
-rw-r--r--drivers/misc/mei/interface.h11
-rw-r--r--drivers/misc/mei/interrupt.c10
-rw-r--r--drivers/misc/mei/iorw.c4
-rw-r--r--drivers/misc/mei/mei_dev.h9
-rw-r--r--drivers/misc/mei/wd.c2
8 files changed, 53 insertions, 50 deletions
diff --git a/drivers/misc/mei/amthif.c b/drivers/misc/mei/amthif.c
index f9d458cced21..6e3cd31eae3b 100644
--- a/drivers/misc/mei/amthif.c
+++ b/drivers/misc/mei/amthif.c
@@ -98,7 +98,7 @@ void mei_amthif_host_init(struct mei_device *dev)
98 98
99 dev->iamthif_msg_buf = msg_buf; 99 dev->iamthif_msg_buf = msg_buf;
100 100
101 if (mei_connect(dev, &dev->iamthif_cl)) { 101 if (mei_hbm_cl_connect_req(dev, &dev->iamthif_cl)) {
102 dev_dbg(&dev->pdev->dev, "Failed to connect to AMTHI client\n"); 102 dev_dbg(&dev->pdev->dev, "Failed to connect to AMTHI client\n");
103 dev->iamthif_cl.state = MEI_FILE_DISCONNECTED; 103 dev->iamthif_cl.state = MEI_FILE_DISCONNECTED;
104 dev->iamthif_cl.host_client_id = 0; 104 dev->iamthif_cl.host_client_id = 0;
@@ -558,7 +558,7 @@ int mei_amthif_irq_read(struct mei_device *dev, s32 *slots)
558 return -EMSGSIZE; 558 return -EMSGSIZE;
559 } 559 }
560 *slots -= mei_data2slots(sizeof(struct hbm_flow_control)); 560 *slots -= mei_data2slots(sizeof(struct hbm_flow_control));
561 if (mei_send_flow_control(dev, &dev->iamthif_cl)) { 561 if (mei_hbm_cl_flow_control_req(dev, &dev->iamthif_cl)) {
562 dev_dbg(&dev->pdev->dev, "iamthif flow control failed\n"); 562 dev_dbg(&dev->pdev->dev, "iamthif flow control failed\n");
563 return -EIO; 563 return -EIO;
564 } 564 }
@@ -630,7 +630,8 @@ static bool mei_clear_list(struct mei_device *dev,
630 if (dev->iamthif_current_cb == cb_pos) { 630 if (dev->iamthif_current_cb == cb_pos) {
631 dev->iamthif_current_cb = NULL; 631 dev->iamthif_current_cb = NULL;
632 /* send flow control to iamthif client */ 632 /* send flow control to iamthif client */
633 mei_send_flow_control(dev, &dev->iamthif_cl); 633 mei_hbm_cl_flow_control_req(dev,
634 &dev->iamthif_cl);
634 } 635 }
635 /* free all allocated buffers */ 636 /* free all allocated buffers */
636 mei_io_cb_free(cb_pos); 637 mei_io_cb_free(cb_pos);
diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c
index e9ba51d5a46c..3c9914038490 100644
--- a/drivers/misc/mei/hbm.c
+++ b/drivers/misc/mei/hbm.c
@@ -59,13 +59,11 @@ bool mei_hbm_cl_addr_equal(struct mei_cl *cl, void *buf)
59 59
60 60
61/** 61/**
62 * host_start_message - mei host sends start message. 62 * mei_hbm_start_req - sends start request message.
63 * 63 *
64 * @dev: the device structure 64 * @dev: the device structure
65 *
66 * returns none.
67 */ 65 */
68void mei_host_start_message(struct mei_device *dev) 66void mei_hbm_start_req(struct mei_device *dev)
69{ 67{
70 struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr; 68 struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
71 struct hbm_host_version_request *start_req; 69 struct hbm_host_version_request *start_req;
@@ -92,13 +90,13 @@ void mei_host_start_message(struct mei_device *dev)
92} 90}
93 91
94/** 92/**
95 * host_enum_clients_message - host sends enumeration client request message. 93 * mei_hbm_enum_clients_req - sends enumeration client request message.
96 * 94 *
97 * @dev: the device structure 95 * @dev: the device structure
98 * 96 *
99 * returns none. 97 * returns none.
100 */ 98 */
101void mei_host_enum_clients_message(struct mei_device *dev) 99static void mei_hbm_enum_clients_req(struct mei_device *dev)
102{ 100{
103 struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr; 101 struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
104 struct hbm_host_enum_request *enum_req; 102 struct hbm_host_enum_request *enum_req;
@@ -120,8 +118,15 @@ void mei_host_enum_clients_message(struct mei_device *dev)
120 return; 118 return;
121} 119}
122 120
121/**
122 * mei_hbm_prop_requsest - request property for a single client
123 *
124 * @dev: the device structure
125 *
126 * returns none.
127 */
123 128
124int mei_host_client_enumerate(struct mei_device *dev) 129static int mei_hbm_prop_req(struct mei_device *dev)
125{ 130{
126 131
127 struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr; 132 struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
@@ -191,14 +196,14 @@ static void mei_hbm_stop_req_prepare(struct mei_device *dev,
191} 196}
192 197
193/** 198/**
194 * mei_send_flow_control - sends flow control to fw. 199 * mei_hbm_cl_flow_control_req - sends flow control requst.
195 * 200 *
196 * @dev: the device structure 201 * @dev: the device structure
197 * @cl: private data of the file object 202 * @cl: client info
198 * 203 *
199 * This function returns -EIO on write failure 204 * This function returns -EIO on write failure
200 */ 205 */
201int mei_send_flow_control(struct mei_device *dev, struct mei_cl *cl) 206int mei_hbm_cl_flow_control_req(struct mei_device *dev, struct mei_cl *cl)
202{ 207{
203 struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr; 208 struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
204 const size_t len = sizeof(struct hbm_flow_control); 209 const size_t len = sizeof(struct hbm_flow_control);
@@ -213,14 +218,14 @@ int mei_send_flow_control(struct mei_device *dev, struct mei_cl *cl)
213} 218}
214 219
215/** 220/**
216 * mei_disconnect - sends disconnect message to fw. 221 * mei_hbm_cl_disconnect_req - sends disconnect message to fw.
217 * 222 *
218 * @dev: the device structure 223 * @dev: the device structure
219 * @cl: private data of the file object 224 * @cl: a client to disconnect from
220 * 225 *
221 * This function returns -EIO on write failure 226 * This function returns -EIO on write failure
222 */ 227 */
223int mei_disconnect(struct mei_device *dev, struct mei_cl *cl) 228int mei_hbm_cl_disconnect_req(struct mei_device *dev, struct mei_cl *cl)
224{ 229{
225 struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr; 230 struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
226 const size_t len = sizeof(struct hbm_client_connect_request); 231 const size_t len = sizeof(struct hbm_client_connect_request);
@@ -232,14 +237,14 @@ int mei_disconnect(struct mei_device *dev, struct mei_cl *cl)
232} 237}
233 238
234/** 239/**
235 * mei_connect - sends connect message to fw. 240 * mei_hbm_cl_connect_req - send connection request to specific me client
236 * 241 *
237 * @dev: the device structure 242 * @dev: the device structure
238 * @cl: private data of the file object 243 * @cl: a client to connect to
239 * 244 *
240 * This function returns -EIO on write failure 245 * returns -EIO on write failure
241 */ 246 */
242int mei_connect(struct mei_device *dev, struct mei_cl *cl) 247int mei_hbm_cl_connect_req(struct mei_device *dev, struct mei_cl *cl)
243{ 248{
244 struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr; 249 struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
245 const size_t len = sizeof(struct hbm_client_connect_request); 250 const size_t len = sizeof(struct hbm_client_connect_request);
@@ -251,12 +256,13 @@ int mei_connect(struct mei_device *dev, struct mei_cl *cl)
251} 256}
252 257
253/** 258/**
254 * mei_client_disconnect_request - disconnects from request irq routine 259 * mei_client_disconnect_request - disconnect request initiated by me
260 * host sends disoconnect response
255 * 261 *
256 * @dev: the device structure. 262 * @dev: the device structure.
257 * @disconnect_req: disconnect request bus message. 263 * @disconnect_req: disconnect request bus message from the me
258 */ 264 */
259static void mei_client_disconnect_request(struct mei_device *dev, 265static void mei_hbm_fw_disconnect_req(struct mei_device *dev,
260 struct hbm_client_connect_request *disconnect_req) 266 struct hbm_client_connect_request *disconnect_req)
261{ 267{
262 struct mei_cl *cl, *next; 268 struct mei_cl *cl, *next;
@@ -327,7 +333,7 @@ void mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
327 if (dev->dev_state == MEI_DEV_INIT_CLIENTS && 333 if (dev->dev_state == MEI_DEV_INIT_CLIENTS &&
328 dev->init_clients_state == MEI_START_MESSAGE) { 334 dev->init_clients_state == MEI_START_MESSAGE) {
329 dev->init_clients_timer = 0; 335 dev->init_clients_timer = 0;
330 mei_host_enum_clients_message(dev); 336 mei_hbm_enum_clients_req(dev);
331 } else { 337 } else {
332 dev->recvd_msg = false; 338 dev->recvd_msg = false;
333 dev_dbg(&dev->pdev->dev, "reset due to received hbm: host start\n"); 339 dev_dbg(&dev->pdev->dev, "reset due to received hbm: host start\n");
@@ -390,7 +396,8 @@ void mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
390 dev->me_client_index++; 396 dev->me_client_index++;
391 dev->me_client_presentation_num++; 397 dev->me_client_presentation_num++;
392 398
393 mei_host_client_enumerate(dev); 399 /* request property for the next client */
400 mei_hbm_prop_req(dev);
394 401
395 break; 402 break;
396 403
@@ -406,7 +413,8 @@ void mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
406 dev->init_clients_state = 413 dev->init_clients_state =
407 MEI_CLIENT_PROPERTIES_MESSAGE; 414 MEI_CLIENT_PROPERTIES_MESSAGE;
408 415
409 mei_host_client_enumerate(dev); 416 /* first property reqeust */
417 mei_hbm_prop_req(dev);
410 } else { 418 } else {
411 dev_dbg(&dev->pdev->dev, "reset due to received host enumeration clients response bus message.\n"); 419 dev_dbg(&dev->pdev->dev, "reset due to received host enumeration clients response bus message.\n");
412 mei_reset(dev, 1); 420 mei_reset(dev, 1);
@@ -423,7 +431,7 @@ void mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
423 case CLIENT_DISCONNECT_REQ_CMD: 431 case CLIENT_DISCONNECT_REQ_CMD:
424 /* search for client */ 432 /* search for client */
425 disconnect_req = (struct hbm_client_connect_request *)mei_msg; 433 disconnect_req = (struct hbm_client_connect_request *)mei_msg;
426 mei_client_disconnect_request(dev, disconnect_req); 434 mei_hbm_fw_disconnect_req(dev, disconnect_req);
427 break; 435 break;
428 436
429 case ME_STOP_REQ_CMD: 437 case ME_STOP_REQ_CMD:
diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c
index 0536170ff856..418a85f315f1 100644
--- a/drivers/misc/mei/init.c
+++ b/drivers/misc/mei/init.c
@@ -529,9 +529,9 @@ int mei_disconnect_host_client(struct mei_device *dev, struct mei_cl *cl)
529 cb->fop_type = MEI_FOP_CLOSE; 529 cb->fop_type = MEI_FOP_CLOSE;
530 if (dev->mei_host_buffer_is_empty) { 530 if (dev->mei_host_buffer_is_empty) {
531 dev->mei_host_buffer_is_empty = false; 531 dev->mei_host_buffer_is_empty = false;
532 if (mei_disconnect(dev, cl)) { 532 if (mei_hbm_cl_disconnect_req(dev, cl)) {
533 rets = -ENODEV; 533 rets = -ENODEV;
534 dev_dbg(&dev->pdev->dev, "failed to call mei_disconnect.\n"); 534 dev_err(&dev->pdev->dev, "failed to disconnect.\n");
535 goto free; 535 goto free;
536 } 536 }
537 mdelay(10); /* Wait for hardware disconnection ready */ 537 mdelay(10); /* Wait for hardware disconnection ready */
diff --git a/drivers/misc/mei/interface.h b/drivers/misc/mei/interface.h
index ca732990a7eb..90a3dfda9db5 100644
--- a/drivers/misc/mei/interface.h
+++ b/drivers/misc/mei/interface.h
@@ -69,12 +69,15 @@ void mei_watchdog_register(struct mei_device *dev);
69 */ 69 */
70void mei_watchdog_unregister(struct mei_device *dev); 70void mei_watchdog_unregister(struct mei_device *dev);
71 71
72int mei_other_client_is_connecting(struct mei_device *dev, struct mei_cl *cl);
72int mei_flow_ctrl_reduce(struct mei_device *dev, struct mei_cl *cl); 73int mei_flow_ctrl_reduce(struct mei_device *dev, struct mei_cl *cl);
73 74
74int mei_send_flow_control(struct mei_device *dev, struct mei_cl *cl); 75void mei_hbm_start_req(struct mei_device *dev);
75 76
76int mei_disconnect(struct mei_device *dev, struct mei_cl *cl); 77int mei_hbm_cl_flow_control_req(struct mei_device *dev, struct mei_cl *cl);
77int mei_other_client_is_connecting(struct mei_device *dev, struct mei_cl *cl); 78int mei_hbm_cl_disconnect_req(struct mei_device *dev, struct mei_cl *cl);
78int mei_connect(struct mei_device *dev, struct mei_cl *cl); 79int mei_hbm_cl_connect_req(struct mei_device *dev, struct mei_cl *cl);
80
81void mei_host_client_init(struct work_struct *work);
79 82
80#endif /* _MEI_INTERFACE_H_ */ 83#endif /* _MEI_INTERFACE_H_ */
diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c
index 9cbf148e02e0..eb744cc4f72a 100644
--- a/drivers/misc/mei/interrupt.c
+++ b/drivers/misc/mei/interrupt.c
@@ -157,7 +157,7 @@ static int _mei_irq_thread_close(struct mei_device *dev, s32 *slots,
157 157
158 *slots -= mei_data2slots(sizeof(struct hbm_client_connect_request)); 158 *slots -= mei_data2slots(sizeof(struct hbm_client_connect_request));
159 159
160 if (mei_disconnect(dev, cl)) { 160 if (mei_hbm_cl_disconnect_req(dev, cl)) {
161 cl->status = 0; 161 cl->status = 0;
162 cb_pos->buf_idx = 0; 162 cb_pos->buf_idx = 0;
163 list_move_tail(&cb_pos->list, &cmpl_list->list); 163 list_move_tail(&cb_pos->list, &cmpl_list->list);
@@ -407,7 +407,7 @@ static int _mei_irq_thread_read(struct mei_device *dev, s32 *slots,
407 407
408 *slots -= mei_data2slots(sizeof(struct hbm_flow_control)); 408 *slots -= mei_data2slots(sizeof(struct hbm_flow_control));
409 409
410 if (mei_send_flow_control(dev, cl)) { 410 if (mei_hbm_cl_flow_control_req(dev, cl)) {
411 cl->status = -ENODEV; 411 cl->status = -ENODEV;
412 cb_pos->buf_idx = 0; 412 cb_pos->buf_idx = 0;
413 list_move_tail(&cb_pos->list, &cmpl_list->list); 413 list_move_tail(&cb_pos->list, &cmpl_list->list);
@@ -443,8 +443,8 @@ static int _mei_irq_thread_ioctl(struct mei_device *dev, s32 *slots,
443 } 443 }
444 444
445 cl->state = MEI_FILE_CONNECTING; 445 cl->state = MEI_FILE_CONNECTING;
446 *slots -= mei_data2slots(sizeof(struct hbm_client_connect_request)); 446 *slots -= mei_data2slots(sizeof(struct hbm_client_connect_request));
447 if (mei_connect(dev, cl)) { 447 if (mei_hbm_cl_connect_req(dev, cl)) {
448 cl->status = -ENODEV; 448 cl->status = -ENODEV;
449 cb_pos->buf_idx = 0; 449 cb_pos->buf_idx = 0;
450 list_del(&cb_pos->list); 450 list_del(&cb_pos->list);
@@ -927,7 +927,7 @@ irqreturn_t mei_interrupt_thread_handler(int irq, void *dev_id)
927 /* link is established 927 /* link is established
928 * start sending messages. 928 * start sending messages.
929 */ 929 */
930 mei_host_start_message(dev); 930 mei_hbm_start_req(dev);
931 mutex_unlock(&dev->device_lock); 931 mutex_unlock(&dev->device_lock);
932 return IRQ_HANDLED; 932 return IRQ_HANDLED;
933 } else { 933 } else {
diff --git a/drivers/misc/mei/iorw.c b/drivers/misc/mei/iorw.c
index 7ccc3d8a079e..d8e08bcf3263 100644
--- a/drivers/misc/mei/iorw.c
+++ b/drivers/misc/mei/iorw.c
@@ -258,7 +258,7 @@ int mei_ioctl_connect_client(struct file *file,
258 && !mei_other_client_is_connecting(dev, cl)) { 258 && !mei_other_client_is_connecting(dev, cl)) {
259 dev_dbg(&dev->pdev->dev, "Sending Connect Message\n"); 259 dev_dbg(&dev->pdev->dev, "Sending Connect Message\n");
260 dev->mei_host_buffer_is_empty = false; 260 dev->mei_host_buffer_is_empty = false;
261 if (mei_connect(dev, cl)) { 261 if (mei_hbm_cl_connect_req(dev, cl)) {
262 dev_dbg(&dev->pdev->dev, "Sending connect message - failed\n"); 262 dev_dbg(&dev->pdev->dev, "Sending connect message - failed\n");
263 rets = -ENODEV; 263 rets = -ENODEV;
264 goto end; 264 goto end;
@@ -350,7 +350,7 @@ int mei_start_read(struct mei_device *dev, struct mei_cl *cl)
350 cl->read_cb = cb; 350 cl->read_cb = cb;
351 if (dev->mei_host_buffer_is_empty) { 351 if (dev->mei_host_buffer_is_empty) {
352 dev->mei_host_buffer_is_empty = false; 352 dev->mei_host_buffer_is_empty = false;
353 if (mei_send_flow_control(dev, cl)) { 353 if (mei_hbm_cl_flow_control_req(dev, cl)) {
354 rets = -ENODEV; 354 rets = -ENODEV;
355 goto err; 355 goto err;
356 } 356 }
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h
index 1ea331ac2463..0ad32cc49c06 100644
--- a/drivers/misc/mei/mei_dev.h
+++ b/drivers/misc/mei/mei_dev.h
@@ -383,15 +383,6 @@ static inline bool mei_cl_cmp_id(const struct mei_cl *cl1,
383} 383}
384 384
385 385
386
387/*
388 * MEI Host Client Functions
389 */
390void mei_host_start_message(struct mei_device *dev);
391void mei_host_enum_clients_message(struct mei_device *dev);
392int mei_host_client_enumerate(struct mei_device *dev);
393void mei_host_client_init(struct work_struct *work);
394
395/* 386/*
396 * MEI interrupt functions prototype 387 * MEI interrupt functions prototype
397 */ 388 */
diff --git a/drivers/misc/mei/wd.c b/drivers/misc/mei/wd.c
index 3997a630847f..4f2e9db86478 100644
--- a/drivers/misc/mei/wd.c
+++ b/drivers/misc/mei/wd.c
@@ -79,7 +79,7 @@ int mei_wd_host_init(struct mei_device *dev)
79 return -ENOENT; 79 return -ENOENT;
80 } 80 }
81 81
82 if (mei_connect(dev, &dev->wd_cl)) { 82 if (mei_hbm_cl_connect_req(dev, &dev->wd_cl)) {
83 dev_err(&dev->pdev->dev, "wd: failed to connect to the client\n"); 83 dev_err(&dev->pdev->dev, "wd: failed to connect to the client\n");
84 dev->wd_cl.state = MEI_FILE_DISCONNECTED; 84 dev->wd_cl.state = MEI_FILE_DISCONNECTED;
85 dev->wd_cl.host_client_id = 0; 85 dev->wd_cl.host_client_id = 0;