Changeset 659bd24 in mainline


Ignore:
Timestamp:
2018-05-22T19:06:50Z (6 years ago)
Author:
Jakub Jermar <jakub@…>
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)
Message:

Do not zero device status bits

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/nic/virtio-net/virtio-net.c

    r5f03107 r659bd24  
    7070
    7171        /* 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);
    7374
    7475        /* 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);
    7678
    7779        /* 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);
    7982
    8083        /* 4. Read the offered feature flags */
     
    9598
    9699        /* 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);
    98102
    99103        /* 6. Test if the device supports our feature subset */
    100         uint8_t status = pio_read_8(&cfg->device_status);
     104        status = pio_read_8(&cfg->device_status);
    101105        if (!(status & VIRTIO_DEV_STATUS_FEATURES_OK)) {
    102106                rc = ENOTSUP;
     
    117121
    118122        /* 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);
    120125
    121126        return EOK;
    122127
    123128fail:
    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);
    125131        virtio_pci_dev_cleanup(&virtio_net->virtio_dev);
    126132        return rc;
Note: See TracChangeset for help on using the changeset viewer.