interrupt.c 14.1 KB
Newer Older
O
Oren Weil 已提交
1 2 3
/*
 *
 * Intel Management Engine Interface (Intel MEI) Linux driver
4
 * Copyright (c) 2003-2012, Intel Corporation.
O
Oren Weil 已提交
5 6 7 8 9 10 11 12 13 14 15 16 17
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 */


18
#include <linux/export.h>
O
Oren Weil 已提交
19 20 21 22
#include <linux/kthread.h>
#include <linux/interrupt.h>
#include <linux/fs.h>
#include <linux/jiffies.h>
23
#include <linux/slab.h>
O
Oren Weil 已提交
24

25
#include <linux/mei.h>
26 27

#include "mei_dev.h"
28
#include "hbm.h"
T
Tomas Winkler 已提交
29
#include "client.h"
O
Oren Weil 已提交
30 31


32
/**
33
 * mei_irq_compl_handler - dispatch complete handlers
34 35
 *	for the completed callbacks
 *
36 37
 * @dev: mei device
 * @compl_list: list of completed cbs
38 39 40 41 42 43 44 45
 */
void mei_irq_compl_handler(struct mei_device *dev, struct mei_cl_cb *compl_list)
{
	struct mei_cl_cb *cb, *next;
	struct mei_cl *cl;

	list_for_each_entry_safe(cb, next, &compl_list->list, list) {
		cl = cb->cl;
46
		list_del_init(&cb->list);
47

48
		dev_dbg(dev->dev, "completing call back.\n");
49 50 51
		if (cl == &dev->iamthif_cl)
			mei_amthif_complete(dev, cb);
		else
52
			mei_cl_complete(cl, cb);
53 54
	}
}
55
EXPORT_SYMBOL_GPL(mei_irq_compl_handler);
56

O
Oren Weil 已提交
57
/**
58
 * mei_cl_hbm_equal - check if hbm is addressed to the client
O
Oren Weil 已提交
59
 *
60
 * @cl: host client
O
Oren Weil 已提交
61 62
 * @mei_hdr: header of mei client message
 *
63
 * Return: true if matches, false otherwise
O
Oren Weil 已提交
64
 */
65 66
static inline int mei_cl_hbm_equal(struct mei_cl *cl,
			struct mei_msg_hdr *mei_hdr)
O
Oren Weil 已提交
67
{
68 69 70 71
	return cl->host_client_id == mei_hdr->host_addr &&
		cl->me_client_id == mei_hdr->me_addr;
}
/**
72
 * mei_cl_is_reading - checks if the client is in reading state
73 74 75
 *
 * @cl: mei client
 *
76
 * Return: true if the client is reading
77
 */
78
static bool mei_cl_is_reading(struct mei_cl *cl)
79
{
80
	return cl->state == MEI_FILE_CONNECTED &&
81
		cl->reading_state != MEI_READ_COMPLETE;
O
Oren Weil 已提交
82 83
}

84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
/**
 * mei_irq_discard_msg  - discard received message
 *
 * @dev: mei device
 * @hdr: message header
 */
static inline
void mei_irq_discard_msg(struct mei_device *dev, struct mei_msg_hdr *hdr)
{
	/*
	 * no need to check for size as it is guarantied
	 * that length fits into rd_msg_buf
	 */
	mei_read_slots(dev, dev->rd_msg_buf, hdr->length);
	dev_dbg(dev->dev, "discarding message " MEI_HDR_FMT "\n",
		MEI_HDR_PRM(hdr));
}

O
Oren Weil 已提交
102
/**
A
Alexander Usyskin 已提交
103
 * mei_cl_irq_read_msg - process client message
O
Oren Weil 已提交
104
 *
105
 * @cl: reading client
O
Oren Weil 已提交
106
 * @mei_hdr: header of mei client message
107
 * @complete_list: completion list
O
Oren Weil 已提交
108
 *
109
 * Return: always 0
O
Oren Weil 已提交
110
 */
111 112 113
int mei_cl_irq_read_msg(struct mei_cl *cl,
		       struct mei_msg_hdr *mei_hdr,
		       struct mei_cl_cb *complete_list)
O
Oren Weil 已提交
114
{
115 116
	struct mei_device *dev = cl->dev;
	struct mei_cl_cb *cb;
117
	unsigned char *buffer = NULL;
O
Oren Weil 已提交
118

119 120 121 122
	list_for_each_entry(cb, &dev->read_list.list, list) {
		if (cl == cb->cl)
			break;
	}
123

124 125 126 127
	if (&cb->list == &dev->read_list.list) {
		dev_err(dev->dev, "no reader found\n");
		goto out;
	}
128

129 130 131 132 133
	if (!mei_cl_is_reading(cl)) {
		cl_err(dev, cl, "cl is not reading state=%d reading state=%d\n",
			cl->state, cl->reading_state);
		goto out;
	}
134

135
	cl->reading_state = MEI_READING;
O
Oren Weil 已提交
136

137
	if (cb->buf.size == 0 || cb->buf.data == NULL) {
138 139 140 141 142
		cl_err(dev, cl, "response buffer is not allocated.\n");
		list_move_tail(&cb->list, &complete_list->list);
		cb->status = -ENOMEM;
		goto out;
	}
143

144
	if (cb->buf.size < mei_hdr->length + cb->buf_idx) {
145
		cl_dbg(dev, cl, "message overflow. size %d len %d idx %ld\n",
146 147
			cb->buf.size, mei_hdr->length, cb->buf_idx);
		buffer = krealloc(cb->buf.data, mei_hdr->length + cb->buf_idx,
148 149 150 151 152 153
				  GFP_KERNEL);

		if (!buffer) {
			cb->status = -ENOMEM;
			list_move_tail(&cb->list, &complete_list->list);
			goto out;
154
		}
155 156
		cb->buf.data = buffer;
		cb->buf.size = mei_hdr->length + cb->buf_idx;
O
Oren Weil 已提交
157 158
	}

159
	buffer = cb->buf.data + cb->buf_idx;
160 161 162
	mei_read_slots(dev, buffer, mei_hdr->length);

	cb->buf_idx += mei_hdr->length;
163

164
	if (mei_hdr->msg_complete) {
165
		cb->read_time = jiffies;
166 167 168 169 170 171
		cl_dbg(dev, cl, "completed read length = %lu\n",
			cb->buf_idx);
		list_move_tail(&cb->list, &complete_list->list);
	}

out:
172 173
	if (!buffer)
		mei_irq_discard_msg(dev, mei_hdr);
O
Oren Weil 已提交
174 175 176 177

	return 0;
}

T
Tomas Winkler 已提交
178 179 180 181 182 183 184
/**
 * mei_cl_irq_disconnect_rsp - send disconnection response message
 *
 * @cl: client
 * @cb: callback block.
 * @cmpl_list: complete list.
 *
185
 * Return: 0, OK; otherwise, error.
T
Tomas Winkler 已提交
186 187
 */
static int mei_cl_irq_disconnect_rsp(struct mei_cl *cl, struct mei_cl_cb *cb,
188
				     struct mei_cl_cb *cmpl_list)
T
Tomas Winkler 已提交
189 190
{
	struct mei_device *dev = cl->dev;
191 192
	u32 msg_slots;
	int slots;
T
Tomas Winkler 已提交
193 194
	int ret;

195 196
	slots = mei_hbuf_empty_slots(dev);
	msg_slots = mei_data2slots(sizeof(struct hbm_client_connect_response));
T
Tomas Winkler 已提交
197

198
	if (slots < msg_slots)
T
Tomas Winkler 已提交
199 200 201 202 203 204
		return -EMSGSIZE;

	ret = mei_hbm_cl_disconnect_rsp(dev, cl);

	cl->state = MEI_FILE_DISCONNECTED;
	cl->status = 0;
205
	list_del(&cb->list);
T
Tomas Winkler 已提交
206 207 208 209 210 211 212
	mei_io_cb_free(cb);

	return ret;
}



O
Oren Weil 已提交
213
/**
214
 * mei_cl_irq_disconnect - processes close related operation from
215
 *	interrupt thread context - send disconnect request
O
Oren Weil 已提交
216
 *
217 218
 * @cl: client
 * @cb: callback block.
O
Oren Weil 已提交
219 220
 * @cmpl_list: complete list.
 *
221
 * Return: 0, OK; otherwise, error.
O
Oren Weil 已提交
222
 */
223
static int mei_cl_irq_disconnect(struct mei_cl *cl, struct mei_cl_cb *cb,
224
			    struct mei_cl_cb *cmpl_list)
O
Oren Weil 已提交
225
{
226
	struct mei_device *dev = cl->dev;
227 228
	u32 msg_slots;
	int slots;
229

230 231
	msg_slots = mei_data2slots(sizeof(struct hbm_client_connect_request));
	slots = mei_hbuf_empty_slots(dev);
O
Oren Weil 已提交
232

233
	if (slots < msg_slots)
T
Tomas Winkler 已提交
234 235
		return -EMSGSIZE;

236
	if (mei_hbm_cl_disconnect_req(dev, cl)) {
237
		cl->status = 0;
238 239
		cb->buf_idx = 0;
		list_move_tail(&cb->list, &cmpl_list->list);
T
Tomas Winkler 已提交
240
		return -EIO;
O
Oren Weil 已提交
241 242
	}

T
Tomas Winkler 已提交
243 244
	cl->state = MEI_FILE_DISCONNECTING;
	cl->status = 0;
245 246
	cb->buf_idx = 0;
	list_move_tail(&cb->list, &dev->ctrl_rd_list.list);
T
Tomas Winkler 已提交
247 248
	cl->timer_count = MEI_CONNECT_TIMEOUT;

O
Oren Weil 已提交
249 250 251 252 253
	return 0;
}


/**
A
Alexander Usyskin 已提交
254
 * mei_cl_irq_read - processes client read related operation from the
255
 *	interrupt thread context - request for flow control credits
O
Oren Weil 已提交
256
 *
257 258
 * @cl: client
 * @cb: callback block.
O
Oren Weil 已提交
259 260
 * @cmpl_list: complete list.
 *
261
 * Return: 0, OK; otherwise, error.
O
Oren Weil 已提交
262
 */
263
static int mei_cl_irq_read(struct mei_cl *cl, struct mei_cl_cb *cb,
264
			   struct mei_cl_cb *cmpl_list)
O
Oren Weil 已提交
265
{
266
	struct mei_device *dev = cl->dev;
267 268
	u32 msg_slots;
	int slots;
269 270
	int ret;

271 272
	msg_slots = mei_data2slots(sizeof(struct hbm_flow_control));
	slots = mei_hbuf_empty_slots(dev);
273

274
	if (slots < msg_slots)
T
Tomas Winkler 已提交
275
		return -EMSGSIZE;
276

277 278 279
	ret = mei_hbm_cl_flow_control_req(dev, cl);
	if (ret) {
		cl->status = ret;
280 281
		cb->buf_idx = 0;
		list_move_tail(&cb->list, &cmpl_list->list);
282
		return ret;
283
	}
284

285
	list_move_tail(&cb->list, &dev->read_list.list);
286

O
Oren Weil 已提交
287 288 289 290 291
	return 0;
}


/**
292
 * mei_cl_irq_connect - send connect request in irq_thread context
O
Oren Weil 已提交
293
 *
294 295
 * @cl: client
 * @cb: callback block.
O
Oren Weil 已提交
296 297
 * @cmpl_list: complete list.
 *
298
 * Return: 0, OK; otherwise, error.
O
Oren Weil 已提交
299
 */
300
static int mei_cl_irq_connect(struct mei_cl *cl, struct mei_cl_cb *cb,
301
			      struct mei_cl_cb *cmpl_list)
O
Oren Weil 已提交
302
{
303
	struct mei_device *dev = cl->dev;
304 305
	u32 msg_slots;
	int slots;
306
	int ret;
307

308 309
	msg_slots = mei_data2slots(sizeof(struct hbm_client_connect_request));
	slots = mei_hbuf_empty_slots(dev);
T
Tomas Winkler 已提交
310

311 312 313
	if (mei_cl_is_other_connecting(cl))
		return 0;

314
	if (slots < msg_slots)
T
Tomas Winkler 已提交
315 316
		return -EMSGSIZE;

317
	cl->state = MEI_FILE_CONNECTING;
T
Tomas Winkler 已提交
318

319 320 321
	ret = mei_hbm_cl_connect_req(dev, cl);
	if (ret) {
		cl->status = ret;
322 323
		cb->buf_idx = 0;
		list_del(&cb->list);
324
		return ret;
325
	}
326 327 328

	list_move_tail(&cb->list, &dev->ctrl_rd_list.list);
	cl->timer_count = MEI_CONNECT_TIMEOUT;
O
Oren Weil 已提交
329 330 331 332 333
	return 0;
}


/**
334
 * mei_irq_read_handler - bottom half read routine after ISR to
O
Oren Weil 已提交
335 336 337
 * handle the read processing.
 *
 * @dev: the device structure
338
 * @cmpl_list: An instance of our list structure
O
Oren Weil 已提交
339 340
 * @slots: slots to read.
 *
341
 * Return: 0 on success, <0 on failure.
O
Oren Weil 已提交
342
 */
343 344
int mei_irq_read_handler(struct mei_device *dev,
		struct mei_cl_cb *cmpl_list, s32 *slots)
O
Oren Weil 已提交
345 346
{
	struct mei_msg_hdr *mei_hdr;
T
Tomas Winkler 已提交
347 348
	struct mei_cl *cl;
	int ret;
O
Oren Weil 已提交
349 350

	if (!dev->rd_msg_hdr) {
351
		dev->rd_msg_hdr = mei_read_hdr(dev);
O
Oren Weil 已提交
352
		(*slots)--;
353
		dev_dbg(dev->dev, "slots =%08x.\n", *slots);
O
Oren Weil 已提交
354 355
	}
	mei_hdr = (struct mei_msg_hdr *) &dev->rd_msg_hdr;
356
	dev_dbg(dev->dev, MEI_HDR_FMT, MEI_HDR_PRM(mei_hdr));
O
Oren Weil 已提交
357 358

	if (mei_hdr->reserved || !dev->rd_msg_hdr) {
359
		dev_err(dev->dev, "corrupted message header 0x%08X\n",
T
Tomas Winkler 已提交
360
				dev->rd_msg_hdr);
O
Oren Weil 已提交
361 362 363 364
		ret = -EBADMSG;
		goto end;
	}

T
Tomas Winkler 已提交
365
	if (mei_slots2data(*slots) < mei_hdr->length) {
366
		dev_err(dev->dev, "less data available than length=%08x.\n",
O
Oren Weil 已提交
367 368
				*slots);
		/* we can't read the message */
369
		ret = -ENODATA;
O
Oren Weil 已提交
370 371 372
		goto end;
	}

T
Tomas Winkler 已提交
373 374
	/*  HBM message */
	if (mei_hdr->host_addr == 0 && mei_hdr->me_addr == 0) {
375 376
		ret = mei_hbm_dispatch(dev, mei_hdr);
		if (ret) {
377
			dev_dbg(dev->dev, "mei_hbm_dispatch failed ret = %d\n",
378 379 380
					ret);
			goto end;
		}
T
Tomas Winkler 已提交
381 382
		goto reset_slots;
	}
383

384
	/* find recipient cl */
T
Tomas Winkler 已提交
385 386 387 388 389 390 391
	list_for_each_entry(cl, &dev->file_list, link) {
		if (mei_cl_hbm_equal(cl, mei_hdr)) {
			cl_dbg(dev, cl, "got a message\n");
			break;
		}
	}

392
	/* if no recipient cl was found we assume corrupted header */
T
Tomas Winkler 已提交
393
	if (&cl->link == &dev->file_list) {
394
		dev_err(dev->dev, "no destination client found 0x%08X\n",
T
Tomas Winkler 已提交
395 396 397 398 399
				dev->rd_msg_hdr);
		ret = -EBADMSG;
		goto end;
	}

400 401
	if (cl == &dev->iamthif_cl) {
		ret = mei_amthif_irq_read_msg(cl, mei_hdr, cmpl_list);
O
Oren Weil 已提交
402
	} else {
403
		ret = mei_cl_irq_read_msg(cl, mei_hdr, cmpl_list);
O
Oren Weil 已提交
404 405
	}

406

T
Tomas Winkler 已提交
407
reset_slots:
O
Oren Weil 已提交
408 409 410 411 412 413
	/* reset the number of slots and header */
	*slots = mei_count_full_read_slots(dev);
	dev->rd_msg_hdr = 0;

	if (*slots == -EOVERFLOW) {
		/* overflow - reset */
414
		dev_err(dev->dev, "resetting due to slots overflow.\n");
O
Oren Weil 已提交
415 416 417 418 419 420 421
		/* set the event since message has been read */
		ret = -ERANGE;
		goto end;
	}
end:
	return ret;
}
422
EXPORT_SYMBOL_GPL(mei_irq_read_handler);
O
Oren Weil 已提交
423 424 425


/**
426 427
 * mei_irq_write_handler -  dispatch write requests
 *  after irq received
O
Oren Weil 已提交
428 429
 *
 * @dev: the device structure
430
 * @cmpl_list: An instance of our list structure
O
Oren Weil 已提交
431
 *
432
 * Return: 0 on success, <0 on failure.
O
Oren Weil 已提交
433
 */
T
Tomas Winkler 已提交
434
int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list)
O
Oren Weil 已提交
435 436 437
{

	struct mei_cl *cl;
438
	struct mei_cl_cb *cb, *next;
439
	struct mei_cl_cb *list;
440
	s32 slots;
O
Oren Weil 已提交
441 442
	int ret;

443 444

	if (!mei_hbuf_acquire(dev))
O
Oren Weil 已提交
445
		return 0;
446

447 448
	slots = mei_hbuf_empty_slots(dev);
	if (slots <= 0)
449 450
		return -EMSGSIZE;

O
Oren Weil 已提交
451
	/* complete all waiting for write CB */
452
	dev_dbg(dev->dev, "complete all waiting for write cb.\n");
O
Oren Weil 已提交
453 454

	list = &dev->write_waiting_list;
455 456
	list_for_each_entry_safe(cb, next, &list->list, list) {
		cl = cb->cl;
457 458

		cl->status = 0;
459 460 461
		cl_dbg(dev, cl, "MEI WRITE COMPLETE\n");
		cl->writing_state = MEI_WRITE_COMPLETE;
		list_move_tail(&cb->list, &cmpl_list->list);
O
Oren Weil 已提交
462 463
	}

464 465
	if (dev->wd_state == MEI_WD_STOPPING) {
		dev->wd_state = MEI_WD_IDLE;
466
		wake_up(&dev->wait_stop_wd);
O
Oren Weil 已提交
467 468
	}

469
	if (mei_cl_is_connected(&dev->wd_cl)) {
O
Oren Weil 已提交
470
		if (dev->wd_pending &&
T
Tomas Winkler 已提交
471
		    mei_cl_flow_ctrl_creds(&dev->wd_cl) > 0) {
472 473 474
			ret = mei_wd_send(dev);
			if (ret)
				return ret;
475
			dev->wd_pending = false;
O
Oren Weil 已提交
476 477 478 479
		}
	}

	/* complete control write list CB */
480
	dev_dbg(dev->dev, "complete control write list cb.\n");
481 482 483
	list_for_each_entry_safe(cb, next, &dev->ctrl_wr_list.list, list) {
		cl = cb->cl;
		switch (cb->fop_type) {
484
		case MEI_FOP_DISCONNECT:
485
			/* send disconnect message */
486
			ret = mei_cl_irq_disconnect(cl, cb, cmpl_list);
487 488
			if (ret)
				return ret;
O
Oren Weil 已提交
489

490
			break;
491
		case MEI_FOP_READ:
492
			/* send flow control message */
493
			ret = mei_cl_irq_read(cl, cb, cmpl_list);
494 495
			if (ret)
				return ret;
O
Oren Weil 已提交
496

497
			break;
498
		case MEI_FOP_CONNECT:
499
			/* connect message */
500
			ret = mei_cl_irq_connect(cl, cb, cmpl_list);
501 502
			if (ret)
				return ret;
O
Oren Weil 已提交
503

504
			break;
T
Tomas Winkler 已提交
505 506
		case MEI_FOP_DISCONNECT_RSP:
			/* send disconnect resp */
507
			ret = mei_cl_irq_disconnect_rsp(cl, cb, cmpl_list);
T
Tomas Winkler 已提交
508 509
			if (ret)
				return ret;
510
			break;
511 512
		default:
			BUG();
O
Oren Weil 已提交
513
		}
514

O
Oren Weil 已提交
515 516
	}
	/* complete  write list CB */
517
	dev_dbg(dev->dev, "complete write list cb.\n");
518 519
	list_for_each_entry_safe(cb, next, &dev->write_list.list, list) {
		cl = cb->cl;
520
		if (cl == &dev->iamthif_cl)
521
			ret = mei_amthif_irq_write(cl, cb, cmpl_list);
522
		else
523
			ret = mei_cl_irq_write(cl, cb, cmpl_list);
524 525
		if (ret)
			return ret;
O
Oren Weil 已提交
526 527 528
	}
	return 0;
}
529
EXPORT_SYMBOL_GPL(mei_irq_write_handler);
O
Oren Weil 已提交
530 531 532 533 534 535 536 537 538



/**
 * mei_timer - timer function.
 *
 * @work: pointer to the work_struct structure
 *
 */
539
void mei_timer(struct work_struct *work)
O
Oren Weil 已提交
540 541
{
	unsigned long timeout;
542
	struct mei_cl *cl;
O
Oren Weil 已提交
543 544

	struct mei_device *dev = container_of(work,
545
					struct mei_device, timer_work.work);
O
Oren Weil 已提交
546 547 548


	mutex_lock(&dev->device_lock);
549 550 551 552 553 554 555

	/* Catch interrupt stalls during HBM init handshake */
	if (dev->dev_state == MEI_DEV_INIT_CLIENTS &&
	    dev->hbm_state != MEI_HBM_IDLE) {

		if (dev->init_clients_timer) {
			if (--dev->init_clients_timer == 0) {
556
				dev_err(dev->dev, "timer: init clients timeout hbm_state = %d.\n",
557
					dev->hbm_state);
558
				mei_reset(dev);
559
				goto out;
O
Oren Weil 已提交
560 561 562
			}
		}
	}
563 564 565 566

	if (dev->dev_state != MEI_DEV_ENABLED)
		goto out;

O
Oren Weil 已提交
567
	/*** connect/disconnect timeouts ***/
568 569 570
	list_for_each_entry(cl, &dev->file_list, link) {
		if (cl->timer_count) {
			if (--cl->timer_count == 0) {
571
				dev_err(dev->dev, "timer: connect/disconnect timeout.\n");
572
				mei_reset(dev);
O
Oren Weil 已提交
573 574 575 576 577
				goto out;
			}
		}
	}

578 579 580
	if (!mei_cl_is_connected(&dev->iamthif_cl))
		goto out;

O
Oren Weil 已提交
581 582
	if (dev->iamthif_stall_timer) {
		if (--dev->iamthif_stall_timer == 0) {
583
			dev_err(dev->dev, "timer: amthif  hanged.\n");
584
			mei_reset(dev);
585
			dev->iamthif_canceled = false;
O
Oren Weil 已提交
586 587 588
			dev->iamthif_state = MEI_IAMTHIF_IDLE;
			dev->iamthif_timer = 0;

589 590
			mei_io_cb_free(dev->iamthif_current_cb);
			dev->iamthif_current_cb = NULL;
O
Oren Weil 已提交
591 592

			dev->iamthif_file_object = NULL;
593
			mei_amthif_run_next_cmd(dev);
O
Oren Weil 已提交
594 595 596 597 598 599
		}
	}

	if (dev->iamthif_timer) {

		timeout = dev->iamthif_timer +
600
			mei_secs_to_jiffies(MEI_IAMTHIF_READ_TIMER);
O
Oren Weil 已提交
601

602
		dev_dbg(dev->dev, "dev->iamthif_timer = %ld\n",
O
Oren Weil 已提交
603
				dev->iamthif_timer);
604 605
		dev_dbg(dev->dev, "timeout = %ld\n", timeout);
		dev_dbg(dev->dev, "jiffies = %ld\n", jiffies);
O
Oren Weil 已提交
606 607 608 609 610 611
		if (time_after(jiffies, timeout)) {
			/*
			 * User didn't read the AMTHI data on time (15sec)
			 * freeing AMTHI for other requests
			 */

612
			dev_dbg(dev->dev, "freeing AMTHI for other requests\n");
O
Oren Weil 已提交
613

614 615
			mei_io_list_flush(&dev->amthif_rd_complete_list,
				&dev->iamthif_cl);
616 617
			mei_io_cb_free(dev->iamthif_current_cb);
			dev->iamthif_current_cb = NULL;
O
Oren Weil 已提交
618 619 620 621

			dev->iamthif_file_object->private_data = NULL;
			dev->iamthif_file_object = NULL;
			dev->iamthif_timer = 0;
622
			mei_amthif_run_next_cmd(dev);
O
Oren Weil 已提交
623 624 625 626

		}
	}
out:
627 628
	if (dev->dev_state != MEI_DEV_DISABLED)
		schedule_delayed_work(&dev->timer_work, 2 * HZ);
629
	mutex_unlock(&dev->device_lock);
O
Oren Weil 已提交
630
}