Changeset 659bd24 in mainline
- Timestamp:
- 2018-05-22T19:06:50Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1c53d93
- Parents:
- 5f03107
- git-author:
- Jakub Jermar <jakub@…> (2018-04-25 21:19:18)
- git-committer:
- Jakub Jermar <jakub@…> (2018-05-22 19:06:50)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/nic/virtio-net/virtio-net.c
r5f03107 r659bd24 70 70 71 71 /* 1. Reset the device */ 72 pio_write_8(&cfg->device_status, VIRTIO_DEV_STATUS_RESET); 72 uint8_t status = VIRTIO_DEV_STATUS_RESET; 73 pio_write_8(&cfg->device_status, status); 73 74 74 75 /* 2. Acknowledge we found the device */ 75 pio_write_8(&cfg->device_status, VIRTIO_DEV_STATUS_ACKNOWLEDGE); 76 status |= VIRTIO_DEV_STATUS_ACKNOWLEDGE; 77 pio_write_8(&cfg->device_status, status); 76 78 77 79 /* 3. We know how to drive the device */ 78 pio_write_8(&cfg->device_status, VIRTIO_DEV_STATUS_DRIVER); 80 status |= VIRTIO_DEV_STATUS_DRIVER; 81 pio_write_8(&cfg->device_status, status); 79 82 80 83 /* 4. Read the offered feature flags */ … … 95 98 96 99 /* 5. Set FEATURES_OK */ 97 pio_write_8(&cfg->device_status, VIRTIO_DEV_STATUS_FEATURES_OK); 100 status |= VIRTIO_DEV_STATUS_FEATURES_OK; 101 pio_write_8(&cfg->device_status, status); 98 102 99 103 /* 6. Test if the device supports our feature subset */ 100 uint8_tstatus = pio_read_8(&cfg->device_status);104 status = pio_read_8(&cfg->device_status); 101 105 if (!(status & VIRTIO_DEV_STATUS_FEATURES_OK)) { 102 106 rc = ENOTSUP; … … 117 121 118 122 /* 8. Go live */ 119 pio_write_8(&cfg->device_status, VIRTIO_DEV_STATUS_DRIVER_OK); 123 status |= VIRTIO_DEV_STATUS_DRIVER_OK; 124 pio_write_8(&cfg->device_status, status); 120 125 121 126 return EOK; 122 127 123 128 fail: 124 pio_write_8(&cfg->device_status, VIRTIO_DEV_STATUS_FAILED); 129 status |= VIRTIO_DEV_STATUS_FAILED; 130 pio_write_8(&cfg->device_status, status); 125 131 virtio_pci_dev_cleanup(&virtio_net->virtio_dev); 126 132 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.