XXX: test if the queue is ready ? */
| 516 | |
| 517 | /* XXX: test if the queue is ready ? */ |
| 518 | static void queue_notify(VIRTIODevice *s, int queue_idx) |
| 519 | { |
| 520 | QueueState *qs = &s->queue[queue_idx]; |
| 521 | uint16_t avail_idx; |
| 522 | int desc_idx, read_size, write_size; |
| 523 | |
| 524 | if (qs->manual_recv) |
| 525 | return; |
| 526 | |
| 527 | avail_idx = virtio_read16(s, qs->avail_addr + 2); |
| 528 | while (qs->last_avail_idx != avail_idx) { |
| 529 | desc_idx = virtio_read16(s, qs->avail_addr + 4 + |
| 530 | (qs->last_avail_idx & (qs->num - 1)) * 2); |
| 531 | if (!get_desc_rw_size(s, &read_size, &write_size, queue_idx, desc_idx)) { |
| 532 | #ifdef DEBUG_VIRTIO |
| 533 | if (s->debug & VIRTIO_DEBUG_IO) { |
| 534 | printf("queue_notify: idx=%d read_size=%d write_size=%d\n", |
| 535 | queue_idx, read_size, write_size); |
| 536 | } |
| 537 | #endif |
| 538 | if (s->device_recv(s, queue_idx, desc_idx, |
| 539 | read_size, write_size) < 0) |
| 540 | break; |
| 541 | } |
| 542 | qs->last_avail_idx++; |
| 543 | } |
| 544 | } |
| 545 | |
| 546 | static uint32_t virtio_config_read(VIRTIODevice *s, uint32_t offset, |
| 547 | int size_log2) |
no test coverage detected