Changeset 9af56b6 in mainline
- Timestamp:
- 2018-05-23T21:12:28Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 31cf8c3c
- Parents:
- 85be731
- git-author:
- Jakub Jermar <jakub@…> (2018-05-23 21:12:24)
- git-committer:
- Jakub Jermar <jakub@…> (2018-05-23 21:12:28)
- Location:
- uspace
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/nic/virtio-net/virtio-net.c
r85be731 r9af56b6 123 123 * Discover and configure the virtqueues 124 124 */ 125 uint16_t num_queues = pio_read_ 16(&cfg->num_queues);125 uint16_t num_queues = pio_read_le16(&cfg->num_queues); 126 126 if (num_queues != VIRTIO_NET_NUM_QUEUES) { 127 127 ddf_msg(LVL_NOTE, "Unsupported number of virtqueues: %u", -
uspace/lib/virtio/virtio-pci.c
r85be731 r9af56b6 281 281 if (vdev->queues) { 282 282 for (unsigned i = 0; 283 i < pio_read_ 16(&vdev->common_cfg->num_queues); i++)283 i < pio_read_le16(&vdev->common_cfg->num_queues); i++) 284 284 virtio_virtq_teardown(vdev, i); 285 285 free(vdev->queues); -
uspace/lib/virtio/virtio.c
r85be731 r9af56b6 43 43 { 44 44 virtq_desc_t *d = &vdev->queues[num].desc[descno]; 45 pio_write_ 64(&d->addr, addr);46 pio_write_ 32(&d->len, len);47 pio_write_ 16(&d->flags, flags);48 pio_write_ 16(&d->next, next);45 pio_write_le64(&d->addr, addr); 46 pio_write_le32(&d->len, len); 47 pio_write_le16(&d->flags, flags); 48 pio_write_le16(&d->next, next); 49 49 } 50 50 … … 54 54 virtq_t *q = &vdev->queues[num]; 55 55 56 uint16_t idx = pio_read_ 16(&q->avail->idx);57 pio_write_ 16(&q->avail->ring[idx], descno);56 uint16_t idx = pio_read_le16(&q->avail->idx); 57 pio_write_le16(&q->avail->ring[idx], descno); 58 58 write_barrier(); 59 pio_write_ 16(&q->avail->idx, (idx + 1) % q->queue_size);59 pio_write_le16(&q->avail->idx, (idx + 1) % q->queue_size); 60 60 write_barrier(); 61 pio_write_ 16(q->notify, num);61 pio_write_le16(q->notify, num); 62 62 } 63 63 … … 68 68 69 69 /* Program the queue of our interest */ 70 pio_write_ 16(&cfg->queue_select, num);70 pio_write_le16(&cfg->queue_select, num); 71 71 72 72 /* Trim the size of the queue as needed */ … … 75 75 return ENOMEM; 76 76 } 77 pio_write_ 16(&cfg->queue_size, size);77 pio_write_le16(&cfg->queue_size, size); 78 78 ddf_msg(LVL_NOTE, "Virtq %u: %u descriptors", num, (unsigned) size); 79 79 … … 126 126 * Write the configured addresses to device's common config 127 127 */ 128 pio_write_ 64(&cfg->queue_desc, q->phys);129 pio_write_ 64(&cfg->queue_avail, q->phys + avail_offset);130 pio_write_ 64(&cfg->queue_used, q->phys + used_offset);128 pio_write_le64(&cfg->queue_desc, q->phys); 129 pio_write_le64(&cfg->queue_avail, q->phys + avail_offset); 130 pio_write_le64(&cfg->queue_used, q->phys + used_offset); 131 131 132 132 ddf_msg(LVL_NOTE, "DMA memory for virtq %d: virt=%p, phys=%p, size=%zu", … … 135 135 /* Determine virtq's notification address */ 136 136 q->notify = vdev->notify_base + 137 pio_read_ 16(&cfg->queue_notif_off) * vdev->notify_off_multiplier;137 pio_read_le16(&cfg->queue_notif_off) * vdev->notify_off_multiplier; 138 138 139 139 ddf_msg(LVL_NOTE, "notification register: %p", q->notify); … … 170 170 171 171 /* 4. Read the offered feature flags */ 172 pio_write_ 32(&cfg->device_feature_select, VIRTIO_FEATURES_0_31);173 uint32_t device_features = pio_read_ 32(&cfg->device_feature);172 pio_write_le32(&cfg->device_feature_select, VIRTIO_FEATURES_0_31); 173 uint32_t device_features = pio_read_le32(&cfg->device_feature); 174 174 175 175 ddf_msg(LVL_NOTE, "offered features %x", device_features); … … 180 180 181 181 /* 4. Write the accepted feature flags */ 182 pio_write_ 32(&cfg->driver_feature_select, VIRTIO_FEATURES_0_31);183 pio_write_ 32(&cfg->driver_feature, features);182 pio_write_le32(&cfg->driver_feature_select, VIRTIO_FEATURES_0_31); 183 pio_write_le32(&cfg->driver_feature, features); 184 184 185 185 ddf_msg(LVL_NOTE, "accepted features %x", features);
Note:
See TracChangeset
for help on using the changeset viewer.