diff options
Diffstat (limited to 'drivers/misc/mei/amthif.c')
-rw-r--r-- | drivers/misc/mei/amthif.c | 164 |
1 files changed, 87 insertions, 77 deletions
diff --git a/drivers/misc/mei/amthif.c b/drivers/misc/mei/amthif.c index e40ffd9502d1..c86d7e3839a4 100644 --- a/drivers/misc/mei/amthif.c +++ b/drivers/misc/mei/amthif.c | |||
@@ -31,15 +31,16 @@ | |||
31 | #include <linux/jiffies.h> | 31 | #include <linux/jiffies.h> |
32 | #include <linux/uaccess.h> | 32 | #include <linux/uaccess.h> |
33 | 33 | ||
34 | #include <linux/mei.h> | ||
34 | 35 | ||
35 | #include "mei_dev.h" | 36 | #include "mei_dev.h" |
36 | #include "hw.h" | 37 | #include "hbm.h" |
37 | #include <linux/mei.h> | 38 | #include "hw-me.h" |
38 | #include "interface.h" | 39 | #include "client.h" |
39 | 40 | ||
40 | const uuid_le mei_amthi_guid = UUID_LE(0x12f80028, 0xb4b7, 0x4b2d, 0xac, | 41 | const uuid_le mei_amthif_guid = UUID_LE(0x12f80028, 0xb4b7, 0x4b2d, |
41 | 0xa8, 0x46, 0xe0, 0xff, 0x65, | 42 | 0xac, 0xa8, 0x46, 0xe0, |
42 | 0x81, 0x4c); | 43 | 0xff, 0x65, 0x81, 0x4c); |
43 | 44 | ||
44 | /** | 45 | /** |
45 | * mei_amthif_reset_params - initializes mei device iamthif | 46 | * mei_amthif_reset_params - initializes mei device iamthif |
@@ -64,22 +65,24 @@ void mei_amthif_reset_params(struct mei_device *dev) | |||
64 | * @dev: the device structure | 65 | * @dev: the device structure |
65 | * | 66 | * |
66 | */ | 67 | */ |
67 | void mei_amthif_host_init(struct mei_device *dev) | 68 | int mei_amthif_host_init(struct mei_device *dev) |
68 | { | 69 | { |
69 | int i; | 70 | struct mei_cl *cl = &dev->iamthif_cl; |
70 | unsigned char *msg_buf; | 71 | unsigned char *msg_buf; |
72 | int ret, i; | ||
73 | |||
74 | dev->iamthif_state = MEI_IAMTHIF_IDLE; | ||
71 | 75 | ||
72 | mei_cl_init(&dev->iamthif_cl, dev); | 76 | mei_cl_init(cl, dev); |
73 | dev->iamthif_cl.state = MEI_FILE_DISCONNECTED; | ||
74 | 77 | ||
75 | /* find ME amthi client */ | 78 | i = mei_me_cl_by_uuid(dev, &mei_amthif_guid); |
76 | i = mei_me_cl_link(dev, &dev->iamthif_cl, | ||
77 | &mei_amthi_guid, MEI_IAMTHIF_HOST_CLIENT_ID); | ||
78 | if (i < 0) { | 79 | if (i < 0) { |
79 | dev_info(&dev->pdev->dev, "failed to find iamthif client.\n"); | 80 | dev_info(&dev->pdev->dev, "amthif: failed to find the client\n"); |
80 | return; | 81 | return -ENOENT; |
81 | } | 82 | } |
82 | 83 | ||
84 | cl->me_client_id = dev->me_clients[i].client_id; | ||
85 | |||
83 | /* Assign iamthif_mtu to the value received from ME */ | 86 | /* Assign iamthif_mtu to the value received from ME */ |
84 | 87 | ||
85 | dev->iamthif_mtu = dev->me_clients[i].props.max_msg_length; | 88 | dev->iamthif_mtu = dev->me_clients[i].props.max_msg_length; |
@@ -93,19 +96,29 @@ void mei_amthif_host_init(struct mei_device *dev) | |||
93 | msg_buf = kcalloc(dev->iamthif_mtu, | 96 | msg_buf = kcalloc(dev->iamthif_mtu, |
94 | sizeof(unsigned char), GFP_KERNEL); | 97 | sizeof(unsigned char), GFP_KERNEL); |
95 | if (!msg_buf) { | 98 | if (!msg_buf) { |
96 | dev_dbg(&dev->pdev->dev, "memory allocation for ME message buffer failed.\n"); | 99 | dev_err(&dev->pdev->dev, "amthif: memory allocation for ME message buffer failed.\n"); |
97 | return; | 100 | return -ENOMEM; |
98 | } | 101 | } |
99 | 102 | ||
100 | dev->iamthif_msg_buf = msg_buf; | 103 | dev->iamthif_msg_buf = msg_buf; |
101 | 104 | ||
102 | if (mei_connect(dev, &dev->iamthif_cl)) { | 105 | ret = mei_cl_link(cl, MEI_IAMTHIF_HOST_CLIENT_ID); |
103 | dev_dbg(&dev->pdev->dev, "Failed to connect to AMTHI client\n"); | 106 | |
104 | dev->iamthif_cl.state = MEI_FILE_DISCONNECTED; | 107 | if (ret < 0) { |
105 | dev->iamthif_cl.host_client_id = 0; | 108 | dev_err(&dev->pdev->dev, "amthif: failed link client\n"); |
109 | return -ENOENT; | ||
110 | } | ||
111 | |||
112 | cl->state = MEI_FILE_CONNECTING; | ||
113 | |||
114 | if (mei_hbm_cl_connect_req(dev, cl)) { | ||
115 | dev_dbg(&dev->pdev->dev, "amthif: Failed to connect to ME client\n"); | ||
116 | cl->state = MEI_FILE_DISCONNECTED; | ||
117 | cl->host_client_id = 0; | ||
106 | } else { | 118 | } else { |
107 | dev->iamthif_cl.timer_count = MEI_CONNECT_TIMEOUT; | 119 | cl->timer_count = MEI_CONNECT_TIMEOUT; |
108 | } | 120 | } |
121 | return 0; | ||
109 | } | 122 | } |
110 | 123 | ||
111 | /** | 124 | /** |
@@ -168,10 +181,10 @@ int mei_amthif_read(struct mei_device *dev, struct file *file, | |||
168 | i = mei_me_cl_by_id(dev, dev->iamthif_cl.me_client_id); | 181 | i = mei_me_cl_by_id(dev, dev->iamthif_cl.me_client_id); |
169 | 182 | ||
170 | if (i < 0) { | 183 | if (i < 0) { |
171 | dev_dbg(&dev->pdev->dev, "amthi client not found.\n"); | 184 | dev_dbg(&dev->pdev->dev, "amthif client not found.\n"); |
172 | return -ENODEV; | 185 | return -ENODEV; |
173 | } | 186 | } |
174 | dev_dbg(&dev->pdev->dev, "checking amthi data\n"); | 187 | dev_dbg(&dev->pdev->dev, "checking amthif data\n"); |
175 | cb = mei_amthif_find_read_list_entry(dev, file); | 188 | cb = mei_amthif_find_read_list_entry(dev, file); |
176 | 189 | ||
177 | /* Check for if we can block or not*/ | 190 | /* Check for if we can block or not*/ |
@@ -179,7 +192,7 @@ int mei_amthif_read(struct mei_device *dev, struct file *file, | |||
179 | return -EAGAIN; | 192 | return -EAGAIN; |
180 | 193 | ||
181 | 194 | ||
182 | dev_dbg(&dev->pdev->dev, "waiting for amthi data\n"); | 195 | dev_dbg(&dev->pdev->dev, "waiting for amthif data\n"); |
183 | while (cb == NULL) { | 196 | while (cb == NULL) { |
184 | /* unlock the Mutex */ | 197 | /* unlock the Mutex */ |
185 | mutex_unlock(&dev->device_lock); | 198 | mutex_unlock(&dev->device_lock); |
@@ -197,17 +210,17 @@ int mei_amthif_read(struct mei_device *dev, struct file *file, | |||
197 | } | 210 | } |
198 | 211 | ||
199 | 212 | ||
200 | dev_dbg(&dev->pdev->dev, "Got amthi data\n"); | 213 | dev_dbg(&dev->pdev->dev, "Got amthif data\n"); |
201 | dev->iamthif_timer = 0; | 214 | dev->iamthif_timer = 0; |
202 | 215 | ||
203 | if (cb) { | 216 | if (cb) { |
204 | timeout = cb->read_time + | 217 | timeout = cb->read_time + |
205 | mei_secs_to_jiffies(MEI_IAMTHIF_READ_TIMER); | 218 | mei_secs_to_jiffies(MEI_IAMTHIF_READ_TIMER); |
206 | dev_dbg(&dev->pdev->dev, "amthi timeout = %lud\n", | 219 | dev_dbg(&dev->pdev->dev, "amthif timeout = %lud\n", |
207 | timeout); | 220 | timeout); |
208 | 221 | ||
209 | if (time_after(jiffies, timeout)) { | 222 | if (time_after(jiffies, timeout)) { |
210 | dev_dbg(&dev->pdev->dev, "amthi Time out\n"); | 223 | dev_dbg(&dev->pdev->dev, "amthif Time out\n"); |
211 | /* 15 sec for the message has expired */ | 224 | /* 15 sec for the message has expired */ |
212 | list_del(&cb->list); | 225 | list_del(&cb->list); |
213 | rets = -ETIMEDOUT; | 226 | rets = -ETIMEDOUT; |
@@ -227,9 +240,9 @@ int mei_amthif_read(struct mei_device *dev, struct file *file, | |||
227 | * remove message from deletion list | 240 | * remove message from deletion list |
228 | */ | 241 | */ |
229 | 242 | ||
230 | dev_dbg(&dev->pdev->dev, "amthi cb->response_buffer size - %d\n", | 243 | dev_dbg(&dev->pdev->dev, "amthif cb->response_buffer size - %d\n", |
231 | cb->response_buffer.size); | 244 | cb->response_buffer.size); |
232 | dev_dbg(&dev->pdev->dev, "amthi cb->buf_idx - %lu\n", cb->buf_idx); | 245 | dev_dbg(&dev->pdev->dev, "amthif cb->buf_idx - %lu\n", cb->buf_idx); |
233 | 246 | ||
234 | /* length is being turncated to PAGE_SIZE, however, | 247 | /* length is being turncated to PAGE_SIZE, however, |
235 | * the buf_idx may point beyond */ | 248 | * the buf_idx may point beyond */ |
@@ -245,7 +258,7 @@ int mei_amthif_read(struct mei_device *dev, struct file *file, | |||
245 | } | 258 | } |
246 | } | 259 | } |
247 | free: | 260 | free: |
248 | dev_dbg(&dev->pdev->dev, "free amthi cb memory.\n"); | 261 | dev_dbg(&dev->pdev->dev, "free amthif cb memory.\n"); |
249 | *offset = 0; | 262 | *offset = 0; |
250 | mei_io_cb_free(cb); | 263 | mei_io_cb_free(cb); |
251 | out: | 264 | out: |
@@ -269,7 +282,7 @@ static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb) | |||
269 | if (!dev || !cb) | 282 | if (!dev || !cb) |
270 | return -ENODEV; | 283 | return -ENODEV; |
271 | 284 | ||
272 | dev_dbg(&dev->pdev->dev, "write data to amthi client.\n"); | 285 | dev_dbg(&dev->pdev->dev, "write data to amthif client.\n"); |
273 | 286 | ||
274 | dev->iamthif_state = MEI_IAMTHIF_WRITING; | 287 | dev->iamthif_state = MEI_IAMTHIF_WRITING; |
275 | dev->iamthif_current_cb = cb; | 288 | dev->iamthif_current_cb = cb; |
@@ -280,15 +293,15 @@ static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb) | |||
280 | memcpy(dev->iamthif_msg_buf, cb->request_buffer.data, | 293 | memcpy(dev->iamthif_msg_buf, cb->request_buffer.data, |
281 | cb->request_buffer.size); | 294 | cb->request_buffer.size); |
282 | 295 | ||
283 | ret = mei_flow_ctrl_creds(dev, &dev->iamthif_cl); | 296 | ret = mei_cl_flow_ctrl_creds(&dev->iamthif_cl); |
284 | if (ret < 0) | 297 | if (ret < 0) |
285 | return ret; | 298 | return ret; |
286 | 299 | ||
287 | if (ret && dev->mei_host_buffer_is_empty) { | 300 | if (ret && dev->hbuf_is_ready) { |
288 | ret = 0; | 301 | ret = 0; |
289 | dev->mei_host_buffer_is_empty = false; | 302 | dev->hbuf_is_ready = false; |
290 | if (cb->request_buffer.size > mei_hbuf_max_data(dev)) { | 303 | if (cb->request_buffer.size > mei_hbuf_max_len(dev)) { |
291 | mei_hdr.length = mei_hbuf_max_data(dev); | 304 | mei_hdr.length = mei_hbuf_max_len(dev); |
292 | mei_hdr.msg_complete = 0; | 305 | mei_hdr.msg_complete = 0; |
293 | } else { | 306 | } else { |
294 | mei_hdr.length = cb->request_buffer.size; | 307 | mei_hdr.length = cb->request_buffer.size; |
@@ -300,25 +313,24 @@ static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb) | |||
300 | mei_hdr.reserved = 0; | 313 | mei_hdr.reserved = 0; |
301 | dev->iamthif_msg_buf_index += mei_hdr.length; | 314 | dev->iamthif_msg_buf_index += mei_hdr.length; |
302 | if (mei_write_message(dev, &mei_hdr, | 315 | if (mei_write_message(dev, &mei_hdr, |
303 | (unsigned char *)(dev->iamthif_msg_buf), | 316 | (unsigned char *)dev->iamthif_msg_buf)) |
304 | mei_hdr.length)) | ||
305 | return -ENODEV; | 317 | return -ENODEV; |
306 | 318 | ||
307 | if (mei_hdr.msg_complete) { | 319 | if (mei_hdr.msg_complete) { |
308 | if (mei_flow_ctrl_reduce(dev, &dev->iamthif_cl)) | 320 | if (mei_cl_flow_ctrl_reduce(&dev->iamthif_cl)) |
309 | return -ENODEV; | 321 | return -ENODEV; |
310 | dev->iamthif_flow_control_pending = true; | 322 | dev->iamthif_flow_control_pending = true; |
311 | dev->iamthif_state = MEI_IAMTHIF_FLOW_CONTROL; | 323 | dev->iamthif_state = MEI_IAMTHIF_FLOW_CONTROL; |
312 | dev_dbg(&dev->pdev->dev, "add amthi cb to write waiting list\n"); | 324 | dev_dbg(&dev->pdev->dev, "add amthif cb to write waiting list\n"); |
313 | dev->iamthif_current_cb = cb; | 325 | dev->iamthif_current_cb = cb; |
314 | dev->iamthif_file_object = cb->file_object; | 326 | dev->iamthif_file_object = cb->file_object; |
315 | list_add_tail(&cb->list, &dev->write_waiting_list.list); | 327 | list_add_tail(&cb->list, &dev->write_waiting_list.list); |
316 | } else { | 328 | } else { |
317 | dev_dbg(&dev->pdev->dev, "message does not complete, so add amthi cb to write list.\n"); | 329 | dev_dbg(&dev->pdev->dev, "message does not complete, so add amthif cb to write list.\n"); |
318 | list_add_tail(&cb->list, &dev->write_list.list); | 330 | list_add_tail(&cb->list, &dev->write_list.list); |
319 | } | 331 | } |
320 | } else { | 332 | } else { |
321 | if (!(dev->mei_host_buffer_is_empty)) | 333 | if (!dev->hbuf_is_ready) |
322 | dev_dbg(&dev->pdev->dev, "host buffer is not empty"); | 334 | dev_dbg(&dev->pdev->dev, "host buffer is not empty"); |
323 | 335 | ||
324 | dev_dbg(&dev->pdev->dev, "No flow control credentials, so add iamthif cb to write list.\n"); | 336 | dev_dbg(&dev->pdev->dev, "No flow control credentials, so add iamthif cb to write list.\n"); |
@@ -383,7 +395,7 @@ void mei_amthif_run_next_cmd(struct mei_device *dev) | |||
383 | dev->iamthif_timer = 0; | 395 | dev->iamthif_timer = 0; |
384 | dev->iamthif_file_object = NULL; | 396 | dev->iamthif_file_object = NULL; |
385 | 397 | ||
386 | dev_dbg(&dev->pdev->dev, "complete amthi cmd_list cb.\n"); | 398 | dev_dbg(&dev->pdev->dev, "complete amthif cmd_list cb.\n"); |
387 | 399 | ||
388 | list_for_each_entry_safe(pos, next, &dev->amthif_cmd_list.list, list) { | 400 | list_for_each_entry_safe(pos, next, &dev->amthif_cmd_list.list, list) { |
389 | list_del(&pos->list); | 401 | list_del(&pos->list); |
@@ -392,7 +404,7 @@ void mei_amthif_run_next_cmd(struct mei_device *dev) | |||
392 | status = mei_amthif_send_cmd(dev, pos); | 404 | status = mei_amthif_send_cmd(dev, pos); |
393 | if (status) { | 405 | if (status) { |
394 | dev_dbg(&dev->pdev->dev, | 406 | dev_dbg(&dev->pdev->dev, |
395 | "amthi write failed status = %d\n", | 407 | "amthif write failed status = %d\n", |
396 | status); | 408 | status); |
397 | return; | 409 | return; |
398 | } | 410 | } |
@@ -412,7 +424,7 @@ unsigned int mei_amthif_poll(struct mei_device *dev, | |||
412 | if (dev->iamthif_state == MEI_IAMTHIF_READ_COMPLETE && | 424 | if (dev->iamthif_state == MEI_IAMTHIF_READ_COMPLETE && |
413 | dev->iamthif_file_object == file) { | 425 | dev->iamthif_file_object == file) { |
414 | mask |= (POLLIN | POLLRDNORM); | 426 | mask |= (POLLIN | POLLRDNORM); |
415 | dev_dbg(&dev->pdev->dev, "run next amthi cb\n"); | 427 | dev_dbg(&dev->pdev->dev, "run next amthif cb\n"); |
416 | mei_amthif_run_next_cmd(dev); | 428 | mei_amthif_run_next_cmd(dev); |
417 | } | 429 | } |
418 | return mask; | 430 | return mask; |
@@ -434,54 +446,51 @@ unsigned int mei_amthif_poll(struct mei_device *dev, | |||
434 | int mei_amthif_irq_write_complete(struct mei_device *dev, s32 *slots, | 446 | int mei_amthif_irq_write_complete(struct mei_device *dev, s32 *slots, |
435 | struct mei_cl_cb *cb, struct mei_cl_cb *cmpl_list) | 447 | struct mei_cl_cb *cb, struct mei_cl_cb *cmpl_list) |
436 | { | 448 | { |
437 | struct mei_msg_hdr *mei_hdr; | 449 | struct mei_msg_hdr mei_hdr; |
438 | struct mei_cl *cl = cb->cl; | 450 | struct mei_cl *cl = cb->cl; |
439 | size_t len = dev->iamthif_msg_buf_size - dev->iamthif_msg_buf_index; | 451 | size_t len = dev->iamthif_msg_buf_size - dev->iamthif_msg_buf_index; |
440 | size_t msg_slots = mei_data2slots(len); | 452 | size_t msg_slots = mei_data2slots(len); |
441 | 453 | ||
442 | mei_hdr = (struct mei_msg_hdr *)&dev->wr_msg_buf[0]; | 454 | mei_hdr.host_addr = cl->host_client_id; |
443 | mei_hdr->host_addr = cl->host_client_id; | 455 | mei_hdr.me_addr = cl->me_client_id; |
444 | mei_hdr->me_addr = cl->me_client_id; | 456 | mei_hdr.reserved = 0; |
445 | mei_hdr->reserved = 0; | ||
446 | 457 | ||
447 | if (*slots >= msg_slots) { | 458 | if (*slots >= msg_slots) { |
448 | mei_hdr->length = len; | 459 | mei_hdr.length = len; |
449 | mei_hdr->msg_complete = 1; | 460 | mei_hdr.msg_complete = 1; |
450 | /* Split the message only if we can write the whole host buffer */ | 461 | /* Split the message only if we can write the whole host buffer */ |
451 | } else if (*slots == dev->hbuf_depth) { | 462 | } else if (*slots == dev->hbuf_depth) { |
452 | msg_slots = *slots; | 463 | msg_slots = *slots; |
453 | len = (*slots * sizeof(u32)) - sizeof(struct mei_msg_hdr); | 464 | len = (*slots * sizeof(u32)) - sizeof(struct mei_msg_hdr); |
454 | mei_hdr->length = len; | 465 | mei_hdr.length = len; |
455 | mei_hdr->msg_complete = 0; | 466 | mei_hdr.msg_complete = 0; |
456 | } else { | 467 | } else { |
457 | /* wait for next time the host buffer is empty */ | 468 | /* wait for next time the host buffer is empty */ |
458 | return 0; | 469 | return 0; |
459 | } | 470 | } |
460 | 471 | ||
461 | dev_dbg(&dev->pdev->dev, "msg: len = %d complete = %d\n", | 472 | dev_dbg(&dev->pdev->dev, MEI_HDR_FMT, MEI_HDR_PRM(&mei_hdr)); |
462 | mei_hdr->length, mei_hdr->msg_complete); | ||
463 | 473 | ||
464 | *slots -= msg_slots; | 474 | *slots -= msg_slots; |
465 | if (mei_write_message(dev, mei_hdr, | 475 | if (mei_write_message(dev, &mei_hdr, |
466 | dev->iamthif_msg_buf + dev->iamthif_msg_buf_index, | 476 | dev->iamthif_msg_buf + dev->iamthif_msg_buf_index)) { |
467 | mei_hdr->length)) { | ||
468 | dev->iamthif_state = MEI_IAMTHIF_IDLE; | 477 | dev->iamthif_state = MEI_IAMTHIF_IDLE; |
469 | cl->status = -ENODEV; | 478 | cl->status = -ENODEV; |
470 | list_del(&cb->list); | 479 | list_del(&cb->list); |
471 | return -ENODEV; | 480 | return -ENODEV; |
472 | } | 481 | } |
473 | 482 | ||
474 | if (mei_flow_ctrl_reduce(dev, cl)) | 483 | if (mei_cl_flow_ctrl_reduce(cl)) |
475 | return -ENODEV; | 484 | return -ENODEV; |
476 | 485 | ||
477 | dev->iamthif_msg_buf_index += mei_hdr->length; | 486 | dev->iamthif_msg_buf_index += mei_hdr.length; |
478 | cl->status = 0; | 487 | cl->status = 0; |
479 | 488 | ||
480 | if (mei_hdr->msg_complete) { | 489 | if (mei_hdr.msg_complete) { |
481 | dev->iamthif_state = MEI_IAMTHIF_FLOW_CONTROL; | 490 | dev->iamthif_state = MEI_IAMTHIF_FLOW_CONTROL; |
482 | dev->iamthif_flow_control_pending = true; | 491 | dev->iamthif_flow_control_pending = true; |
483 | 492 | ||
484 | /* save iamthif cb sent to amthi client */ | 493 | /* save iamthif cb sent to amthif client */ |
485 | cb->buf_idx = dev->iamthif_msg_buf_index; | 494 | cb->buf_idx = dev->iamthif_msg_buf_index; |
486 | dev->iamthif_current_cb = cb; | 495 | dev->iamthif_current_cb = cb; |
487 | 496 | ||
@@ -494,11 +503,11 @@ int mei_amthif_irq_write_complete(struct mei_device *dev, s32 *slots, | |||
494 | 503 | ||
495 | /** | 504 | /** |
496 | * mei_amthif_irq_read_message - read routine after ISR to | 505 | * mei_amthif_irq_read_message - read routine after ISR to |
497 | * handle the read amthi message | 506 | * handle the read amthif message |
498 | * | 507 | * |
499 | * @complete_list: An instance of our list structure | 508 | * @complete_list: An instance of our list structure |
500 | * @dev: the device structure | 509 | * @dev: the device structure |
501 | * @mei_hdr: header of amthi message | 510 | * @mei_hdr: header of amthif message |
502 | * | 511 | * |
503 | * returns 0 on success, <0 on failure. | 512 | * returns 0 on success, <0 on failure. |
504 | */ | 513 | */ |
@@ -522,10 +531,10 @@ int mei_amthif_irq_read_message(struct mei_cl_cb *complete_list, | |||
522 | return 0; | 531 | return 0; |
523 | 532 | ||
524 | dev_dbg(&dev->pdev->dev, | 533 | dev_dbg(&dev->pdev->dev, |
525 | "amthi_message_buffer_index =%d\n", | 534 | "amthif_message_buffer_index =%d\n", |
526 | mei_hdr->length); | 535 | mei_hdr->length); |
527 | 536 | ||
528 | dev_dbg(&dev->pdev->dev, "completed amthi read.\n "); | 537 | dev_dbg(&dev->pdev->dev, "completed amthif read.\n "); |
529 | if (!dev->iamthif_current_cb) | 538 | if (!dev->iamthif_current_cb) |
530 | return -ENODEV; | 539 | return -ENODEV; |
531 | 540 | ||
@@ -540,8 +549,8 @@ int mei_amthif_irq_read_message(struct mei_cl_cb *complete_list, | |||
540 | cb->read_time = jiffies; | 549 | cb->read_time = jiffies; |
541 | if (dev->iamthif_ioctl && cb->cl == &dev->iamthif_cl) { | 550 | if (dev->iamthif_ioctl && cb->cl == &dev->iamthif_cl) { |
542 | /* found the iamthif cb */ | 551 | /* found the iamthif cb */ |
543 | dev_dbg(&dev->pdev->dev, "complete the amthi read cb.\n "); | 552 | dev_dbg(&dev->pdev->dev, "complete the amthif read cb.\n "); |
544 | dev_dbg(&dev->pdev->dev, "add the amthi read cb to complete.\n "); | 553 | dev_dbg(&dev->pdev->dev, "add the amthif read cb to complete.\n "); |
545 | list_add_tail(&cb->list, &complete_list->list); | 554 | list_add_tail(&cb->list, &complete_list->list); |
546 | } | 555 | } |
547 | return 0; | 556 | return 0; |
@@ -563,7 +572,7 @@ int mei_amthif_irq_read(struct mei_device *dev, s32 *slots) | |||
563 | return -EMSGSIZE; | 572 | return -EMSGSIZE; |
564 | } | 573 | } |
565 | *slots -= mei_data2slots(sizeof(struct hbm_flow_control)); | 574 | *slots -= mei_data2slots(sizeof(struct hbm_flow_control)); |
566 | if (mei_send_flow_control(dev, &dev->iamthif_cl)) { | 575 | if (mei_hbm_cl_flow_control_req(dev, &dev->iamthif_cl)) { |
567 | dev_dbg(&dev->pdev->dev, "iamthif flow control failed\n"); | 576 | dev_dbg(&dev->pdev->dev, "iamthif flow control failed\n"); |
568 | return -EIO; | 577 | return -EIO; |
569 | } | 578 | } |
@@ -574,7 +583,7 @@ int mei_amthif_irq_read(struct mei_device *dev, s32 *slots) | |||
574 | dev->iamthif_msg_buf_index = 0; | 583 | dev->iamthif_msg_buf_index = 0; |
575 | dev->iamthif_msg_buf_size = 0; | 584 | dev->iamthif_msg_buf_size = 0; |
576 | dev->iamthif_stall_timer = MEI_IAMTHIF_STALL_TIMER; | 585 | dev->iamthif_stall_timer = MEI_IAMTHIF_STALL_TIMER; |
577 | dev->mei_host_buffer_is_empty = mei_hbuf_is_empty(dev); | 586 | dev->hbuf_is_ready = mei_hbuf_is_ready(dev); |
578 | return 0; | 587 | return 0; |
579 | } | 588 | } |
580 | 589 | ||
@@ -593,7 +602,7 @@ void mei_amthif_complete(struct mei_device *dev, struct mei_cl_cb *cb) | |||
593 | dev->iamthif_msg_buf, | 602 | dev->iamthif_msg_buf, |
594 | dev->iamthif_msg_buf_index); | 603 | dev->iamthif_msg_buf_index); |
595 | list_add_tail(&cb->list, &dev->amthif_rd_complete_list.list); | 604 | list_add_tail(&cb->list, &dev->amthif_rd_complete_list.list); |
596 | dev_dbg(&dev->pdev->dev, "amthi read completed\n"); | 605 | dev_dbg(&dev->pdev->dev, "amthif read completed\n"); |
597 | dev->iamthif_timer = jiffies; | 606 | dev->iamthif_timer = jiffies; |
598 | dev_dbg(&dev->pdev->dev, "dev->iamthif_timer = %ld\n", | 607 | dev_dbg(&dev->pdev->dev, "dev->iamthif_timer = %ld\n", |
599 | dev->iamthif_timer); | 608 | dev->iamthif_timer); |
@@ -601,7 +610,7 @@ void mei_amthif_complete(struct mei_device *dev, struct mei_cl_cb *cb) | |||
601 | mei_amthif_run_next_cmd(dev); | 610 | mei_amthif_run_next_cmd(dev); |
602 | } | 611 | } |
603 | 612 | ||
604 | dev_dbg(&dev->pdev->dev, "completing amthi call back.\n"); | 613 | dev_dbg(&dev->pdev->dev, "completing amthif call back.\n"); |
605 | wake_up_interruptible(&dev->iamthif_cl.wait); | 614 | wake_up_interruptible(&dev->iamthif_cl.wait); |
606 | } | 615 | } |
607 | 616 | ||
@@ -635,7 +644,8 @@ static bool mei_clear_list(struct mei_device *dev, | |||
635 | if (dev->iamthif_current_cb == cb_pos) { | 644 | if (dev->iamthif_current_cb == cb_pos) { |
636 | dev->iamthif_current_cb = NULL; | 645 | dev->iamthif_current_cb = NULL; |
637 | /* send flow control to iamthif client */ | 646 | /* send flow control to iamthif client */ |
638 | mei_send_flow_control(dev, &dev->iamthif_cl); | 647 | mei_hbm_cl_flow_control_req(dev, |
648 | &dev->iamthif_cl); | ||
639 | } | 649 | } |
640 | /* free all allocated buffers */ | 650 | /* free all allocated buffers */ |
641 | mei_io_cb_free(cb_pos); | 651 | mei_io_cb_free(cb_pos); |
@@ -706,11 +716,11 @@ int mei_amthif_release(struct mei_device *dev, struct file *file) | |||
706 | if (dev->iamthif_file_object == file && | 716 | if (dev->iamthif_file_object == file && |
707 | dev->iamthif_state != MEI_IAMTHIF_IDLE) { | 717 | dev->iamthif_state != MEI_IAMTHIF_IDLE) { |
708 | 718 | ||
709 | dev_dbg(&dev->pdev->dev, "amthi canceled iamthif state %d\n", | 719 | dev_dbg(&dev->pdev->dev, "amthif canceled iamthif state %d\n", |
710 | dev->iamthif_state); | 720 | dev->iamthif_state); |
711 | dev->iamthif_canceled = true; | 721 | dev->iamthif_canceled = true; |
712 | if (dev->iamthif_state == MEI_IAMTHIF_READ_COMPLETE) { | 722 | if (dev->iamthif_state == MEI_IAMTHIF_READ_COMPLETE) { |
713 | dev_dbg(&dev->pdev->dev, "run next amthi iamthif cb\n"); | 723 | dev_dbg(&dev->pdev->dev, "run next amthif iamthif cb\n"); |
714 | mei_amthif_run_next_cmd(dev); | 724 | mei_amthif_run_next_cmd(dev); |
715 | } | 725 | } |
716 | } | 726 | } |