Lines Matching refs:dev
26 * @dev: mei device
29 void mei_irq_compl_handler(struct mei_device *dev, struct list_head *cmpl_list)
38 dev_dbg(dev->dev, "completing call back.\n");
62 * @dev: mei device
66 static void mei_irq_discard_msg(struct mei_device *dev, struct mei_msg_hdr *hdr,
70 mei_dma_ring_read(dev, NULL,
71 hdr->extension[dev->rd_msg_hdr_count - 2]);
78 mei_read_slots(dev, dev->rd_msg_buf, discard_len);
79 dev_dbg(dev->dev, "discarding message " MEI_HDR_FMT "\n",
98 struct mei_device *dev = cl->dev;
118 cl_err(dev, cl, "pending read cb not found\n");
145 cl_err(dev, cl, "unknown extended header\n");
154 cl_dbg(dev, cl, "no vtag or gsc found in extended header.\n");
161 cl_dbg(dev, cl, "vtag: %d\n", vtag_hdr->vtag);
163 cl_err(dev, cl, "mismatched tag: %d != %d\n",
174 if (!dev->hbm_f_gsc_supported) {
175 cl_err(dev, cl, "gsc extended header is not supported\n");
181 cl_err(dev, cl, "no data allowed in cb with gsc\n");
186 cl_err(dev, cl, "gsc extended header is too big %u\n", ext_hdr_len);
194 cl_dbg(dev, cl, "not connected\n");
205 cl_err(dev, cl, "message is too big len %d idx %zu\n",
212 cl_dbg(dev, cl, "message overflow. size %zu len %d idx %zu\n",
219 mei_dma_ring_read(dev, cb->buf.data + cb->buf_idx, length);
221 mei_read_slots(dev, cb->buf.data + cb->buf_idx, 0);
223 mei_read_slots(dev, cb->buf.data + cb->buf_idx, length);
229 cl_dbg(dev, cl, "completed read length = %zu\n", cb->buf_idx);
232 pm_runtime_mark_last_busy(dev->dev);
233 pm_request_autosuspend(dev->dev);
241 mei_irq_discard_msg(dev, mei_hdr, length);
257 struct mei_device *dev = cl->dev;
263 slots = mei_hbuf_empty_slots(dev);
270 ret = mei_hbm_cl_disconnect_rsp(dev, cl);
289 struct mei_device *dev = cl->dev;
298 slots = mei_hbuf_empty_slots(dev);
305 ret = mei_hbm_cl_flow_control_req(dev, cl);
313 pm_runtime_mark_last_busy(dev->dev);
314 pm_request_autosuspend(dev->dev);
354 * @dev: the device structure
360 int mei_irq_read_handler(struct mei_device *dev,
372 if (!dev->rd_msg_hdr[0]) {
373 dev->rd_msg_hdr[0] = mei_read_hdr(dev);
374 dev->rd_msg_hdr_count = 1;
376 dev_dbg(dev->dev, "slots =%08x.\n", *slots);
378 ret = hdr_is_valid(dev->rd_msg_hdr[0]);
380 dev_err(dev->dev, "corrupted message header 0x%08X\n",
381 dev->rd_msg_hdr[0]);
386 mei_hdr = (struct mei_msg_hdr *)dev->rd_msg_hdr;
387 dev_dbg(dev->dev, MEI_HDR_FMT, MEI_HDR_PRM(mei_hdr));
390 dev_err(dev->dev, "less data available than length=%08x.\n",
401 if (!dev->rd_msg_hdr[1]) {
402 dev->rd_msg_hdr[1] = mei_read_hdr(dev);
403 dev->rd_msg_hdr_count++;
405 dev_dbg(dev->dev, "extended header is %08x\n", dev->rd_msg_hdr[1]);
407 meta_hdr = ((struct mei_ext_meta_hdr *)&dev->rd_msg_hdr[1]);
411 dev_err(dev->dev, "extended message size too big %d\n",
416 dev_err(dev->dev, "corrupted message header len %d\n",
423 for (i = dev->rd_msg_hdr_count; i < ext_hdr_end; i++) {
424 dev->rd_msg_hdr[i] = mei_read_hdr(dev);
425 dev_dbg(dev->dev, "extended header %d is %08x\n", i,
426 dev->rd_msg_hdr[i]);
427 dev->rd_msg_hdr_count++;
433 if (hdr_size_left != sizeof(dev->rd_msg_hdr[ext_hdr_end])) {
434 dev_err(dev->dev, "corrupted message header len %d\n",
439 dev->rd_msg_hdr[ext_hdr_end] = mei_read_hdr(dev);
440 dev->rd_msg_hdr_count++;
442 mei_hdr->length -= sizeof(dev->rd_msg_hdr[ext_hdr_end]);
447 ret = mei_hbm_dispatch(dev, mei_hdr);
449 dev_dbg(dev->dev, "mei_hbm_dispatch failed ret = %d\n",
457 list_for_each_entry(cl, &dev->file_list, link) {
459 cl_dbg(dev, cl, "got a message\n");
472 dev->dev_state == MEI_DEV_POWER_DOWN) {
473 mei_irq_discard_msg(dev, mei_hdr, mei_hdr->length);
477 dev_err(dev->dev, "no destination client found 0x%08X\n", dev->rd_msg_hdr[0]);
483 memset(dev->rd_msg_hdr, 0, sizeof(dev->rd_msg_hdr));
484 dev->rd_msg_hdr_count = 0;
485 *slots = mei_count_full_read_slots(dev);
488 dev_err(dev->dev, "resetting due to slots overflow.\n");
503 * @dev: the device structure
508 int mei_irq_write_handler(struct mei_device *dev, struct list_head *cmpl_list)
517 if (!mei_hbuf_acquire(dev))
520 slots = mei_hbuf_empty_slots(dev);
528 dev_dbg(dev->dev, "complete all waiting for write cb.\n");
530 list_for_each_entry_safe(cb, next, &dev->write_waiting_list, list) {
534 cl_dbg(dev, cl, "MEI WRITE COMPLETE\n");
540 dev_dbg(dev->dev, "complete control write list cb.\n");
541 list_for_each_entry_safe(cb, next, &dev->ctrl_wr_list, list) {
594 dev_dbg(dev->dev, "complete write list cb.\n");
595 list_for_each_entry_safe(cb, next, &dev->write_list, list) {
613 struct mei_device *dev = cl->dev;
616 if (dev->hbm_f_dot_supported) {
622 mei_reset(dev);
631 * @dev: the device structure
633 void mei_schedule_stall_timer(struct mei_device *dev)
635 schedule_delayed_work(&dev->timer_work, MEI_STALL_TIMER_FREQ);
647 struct mei_device *dev = container_of(work,
651 mutex_lock(&dev->device_lock);
654 if (dev->dev_state == MEI_DEV_INIT_CLIENTS &&
655 dev->hbm_state != MEI_HBM_IDLE) {
657 if (dev->init_clients_timer) {
658 if (--dev->init_clients_timer == 0) {
659 dev_err(dev->dev, "timer: init clients timeout hbm_state = %d.\n",
660 dev->hbm_state);
661 mei_reset(dev);
668 if (dev->dev_state != MEI_DEV_ENABLED)
672 list_for_each_entry(cl, &dev->file_list, link) {
675 dev_err(dev->dev, "timer: connect/disconnect timeout.\n");
684 if (dev->dev_state != MEI_DEV_DISABLED && reschedule_timer)
685 mei_schedule_stall_timer(dev);
687 mutex_unlock(&dev->device_lock);