Changes in uspace/lib/virtio/virtio.c [8591b31:13eecc4] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/virtio/virtio.c
r8591b31 r13eecc4 50 50 * buffers. 51 51 * 52 * The buffers can be deallocated by virtio_ net_teardown_bufs().52 * The buffers can be deallocated by virtio_teardown_dma_bufs(). 53 53 * 54 54 * @return EOK on success or error code. … … 63 63 uintptr_t phys; 64 64 errno_t rc = dmamem_map_anonymous(buffers * size, 0, 65 write ? AS_AREA_WRITE : AS_AREA_READ, 0, &phys, &virt); 65 write ? AS_AREA_WRITE | AS_AREA_READ : AS_AREA_READ, 0, &phys, 66 &virt); 66 67 if (rc != EOK) 67 68 return rc; … … 83 84 * 84 85 * @param buf[in] Array holding the virtual addresses of the DMA buffers 85 * previously allocated by virtio_ net_setup_bufs().86 */ 87 externvoid virtio_teardown_dma_bufs(void *buf[])86 * previously allocated by virtio_setup_dma_bufs(). 87 */ 88 void virtio_teardown_dma_bufs(void *buf[]) 88 89 { 89 90 if (buf[0]) { … … 319 320 uint32_t device_features = pio_read_le32(&cfg->device_feature); 320 321 321 ddf_msg(LVL_NOTE, "offered features %x", device_features); 322 uint32_t reserved_features = VIRTIO_F_VERSION_1; 323 pio_write_le32(&cfg->device_feature_select, VIRTIO_FEATURES_32_63); 324 uint32_t device_reserved_features = pio_read_le32(&cfg->device_feature); 325 326 ddf_msg(LVL_NOTE, "offered features %x, reserved features %x", 327 device_features, device_reserved_features); 322 328 323 329 if (features != (features & device_features)) … … 325 331 features &= device_features; 326 332 333 if (reserved_features != (reserved_features & device_reserved_features)) 334 return ENOTSUP; 335 reserved_features &= device_reserved_features; 336 327 337 /* 4. Write the accepted feature flags */ 328 338 pio_write_le32(&cfg->driver_feature_select, VIRTIO_FEATURES_0_31); 329 339 pio_write_le32(&cfg->driver_feature, features); 330 331 ddf_msg(LVL_NOTE, "accepted features %x", features); 340 pio_write_le32(&cfg->driver_feature_select, VIRTIO_FEATURES_32_63); 341 pio_write_le32(&cfg->driver_feature, reserved_features); 342 343 ddf_msg(LVL_NOTE, "accepted features %x, reserved features %x", 344 features, reserved_features); 332 345 333 346 /* 5. Set FEATURES_OK */
Note:
See TracChangeset
for help on using the changeset viewer.