Index: uspace/drv/nic/virtio-net/virtio-net.c
===================================================================
--- uspace/drv/nic/virtio-net/virtio-net.c	(revision cbcb34c71731e8f7f40ddb81bb612f2296305afc)
+++ uspace/drv/nic/virtio-net/virtio-net.c	(revision 341df5f859294503d81a416e3efa9d2f297a6410)
@@ -75,51 +75,11 @@
 	virtio_net_cfg_t *netcfg = virtio_net->virtio_dev.device_cfg;
 
-	/*
-	 * Perform device initialization as described in section 3.1.1 of the
-	 * specification.
-	 */
+	/* Reset the device and negotiate the feature bits */
+	rc = virtio_device_setup_start(vdev,
+	    VIRTIO_NET_F_MAC | VIRTIO_NET_F_CTRL_VQ);
+	if (rc != EOK)
+		goto fail;
 
-	/* 1. Reset the device */
-	uint8_t status = VIRTIO_DEV_STATUS_RESET;
-	pio_write_8(&cfg->device_status, status);
-
-	/* 2. Acknowledge we found the device */
-	status |= VIRTIO_DEV_STATUS_ACKNOWLEDGE;
-	pio_write_8(&cfg->device_status, status);
-
-	/* 3. We know how to drive the device */
-	status |= VIRTIO_DEV_STATUS_DRIVER;
-	pio_write_8(&cfg->device_status, status);
-
-	/* 4. Read the offered feature flags */
-	pio_write_32(&cfg->device_feature_select, VIRTIO_NET_F_SELECT_PAGE_0);
-	uint32_t features = pio_read_32(&cfg->device_feature);
-
-	ddf_msg(LVL_NOTE, "offered features %x", features);
-	features &= (1U << VIRTIO_NET_F_MAC) | (1U << VIRTIO_NET_F_CTRL_VQ);
-
-	if (!features) {
-		rc = ENOTSUP;
-		goto fail;
-	}
-
-	/* 4. Write the accepted feature flags */
-	pio_write_32(&cfg->driver_feature_select, VIRTIO_NET_F_SELECT_PAGE_0);
-	pio_write_32(&cfg->driver_feature, features);
-
-	ddf_msg(LVL_NOTE, "accepted features %x", features);
-
-	/* 5. Set FEATURES_OK */
-	status |= VIRTIO_DEV_STATUS_FEATURES_OK;
-	pio_write_8(&cfg->device_status, status);
-
-	/* 6. Test if the device supports our feature subset */ 
-	status = pio_read_8(&cfg->device_status);
-	if (!(status & VIRTIO_DEV_STATUS_FEATURES_OK)) {
-		rc = ENOTSUP;
-		goto fail;
-	}
-
-	/* 7. Perform device-specific setup */
+	/* Perform device-specific setup */
 
 	/*
@@ -164,14 +124,12 @@
 	    nic_addr.address[3], nic_addr.address[4], nic_addr.address[5]);
 
-	/* 8. Go live */
-	status |= VIRTIO_DEV_STATUS_DRIVER_OK;
-	pio_write_8(&cfg->device_status, status);
+	/* Go live */
+	virtio_device_setup_finalize(vdev);
 
 	return EOK;
 
 fail:
-	status |= VIRTIO_DEV_STATUS_FAILED;
-	pio_write_8(&cfg->device_status, status);
-	virtio_pci_dev_cleanup(&virtio_net->virtio_dev);
+	virtio_device_setup_fail(vdev);
+	virtio_pci_dev_cleanup(vdev);
 	return rc;
 }
Index: uspace/drv/nic/virtio-net/virtio-net.h
===================================================================
--- uspace/drv/nic/virtio-net/virtio-net.h	(revision cbcb34c71731e8f7f40ddb81bb612f2296305afc)
+++ uspace/drv/nic/virtio-net/virtio-net.h	(revision 341df5f859294503d81a416e3efa9d2f297a6410)
@@ -32,14 +32,12 @@
 #include <virtio-pci.h>
 
-#define VIRTIO_NET_F_SELECT_PAGE_0	0
-
 /** Device handles packets with partial checksum. */
-#define VIRTIO_NET_F_CSUM		0
+#define VIRTIO_NET_F_CSUM		(1U << 0)
 /** Driver handles packets with partial checksum. */
-#define VIRTIO_NET_F_GUEST_CSUM		2
+#define VIRTIO_NET_F_GUEST_CSUM		(1U << 2)
 /** Device has given MAC address. */
-#define VIRTIO_NET_F_MAC		5
+#define VIRTIO_NET_F_MAC		(1U << 5)
 /** Control channel is available */
-#define VIRTIO_NET_F_CTRL_VQ		17
+#define VIRTIO_NET_F_CTRL_VQ		(1U << 17)
 
 typedef struct {
Index: uspace/lib/virtio/virtio-pci.c
===================================================================
--- uspace/lib/virtio/virtio-pci.c	(revision cbcb34c71731e8f7f40ddb81bb612f2296305afc)
+++ uspace/lib/virtio/virtio-pci.c	(revision 341df5f859294503d81a416e3efa9d2f297a6410)
@@ -272,4 +272,73 @@
 }
 
+/**
+ * Perform device initialization as described in section 3.1.1 of the
+ * specification, steps 1 - 6.
+ */
+errno_t virtio_device_setup_start(virtio_dev_t *vdev, uint32_t features)
+{
+	virtio_pci_common_cfg_t *cfg = vdev->common_cfg;
+
+	/* 1. Reset the device */
+	uint8_t status = VIRTIO_DEV_STATUS_RESET;
+	pio_write_8(&cfg->device_status, status);
+
+	/* 2. Acknowledge we found the device */
+	status |= VIRTIO_DEV_STATUS_ACKNOWLEDGE;
+	pio_write_8(&cfg->device_status, status);
+
+	/* 3. We know how to drive the device */
+	status |= VIRTIO_DEV_STATUS_DRIVER;
+	pio_write_8(&cfg->device_status, status);
+
+	/* 4. Read the offered feature flags */
+	pio_write_32(&cfg->device_feature_select, VIRTIO_FEATURES_0_31);
+	uint32_t device_features = pio_read_32(&cfg->device_feature);
+
+	ddf_msg(LVL_NOTE, "offered features %x", device_features);
+	features &= device_features;
+
+	if (!features)
+		return ENOTSUP;
+
+	/* 4. Write the accepted feature flags */
+	pio_write_32(&cfg->driver_feature_select, VIRTIO_FEATURES_0_31);
+	pio_write_32(&cfg->driver_feature, features);
+
+	ddf_msg(LVL_NOTE, "accepted features %x", features);
+
+	/* 5. Set FEATURES_OK */
+	status |= VIRTIO_DEV_STATUS_FEATURES_OK;
+	pio_write_8(&cfg->device_status, status);
+
+	/* 6. Test if the device supports our feature subset */ 
+	status = pio_read_8(&cfg->device_status);
+	if (!(status & VIRTIO_DEV_STATUS_FEATURES_OK))
+		return ENOTSUP;
+
+	return EOK;
+}
+
+/**
+ * Perform device initialization as described in section 3.1.1 of the
+ * specification, step 8 (go live).
+ */
+void virtio_device_setup_finalize(virtio_dev_t *vdev)
+{
+	virtio_pci_common_cfg_t *cfg = vdev->common_cfg;
+
+	/* 8. Go live */
+	uint8_t status = pio_read_8(&cfg->device_status);
+	pio_write_8(&cfg->device_status, status | VIRTIO_DEV_STATUS_DRIVER_OK);
+}
+
+void virtio_device_setup_fail(virtio_dev_t *vdev)
+{
+	virtio_pci_common_cfg_t *cfg = vdev->common_cfg;
+
+	uint8_t status = pio_read_8(&cfg->device_status);
+	pio_write_8(&cfg->device_status, status | VIRTIO_DEV_STATUS_FAILED);
+}
+
 errno_t virtio_pci_dev_initialize(ddf_dev_t *dev, virtio_dev_t *vdev)
 {
Index: uspace/lib/virtio/virtio-pci.h
===================================================================
--- uspace/lib/virtio/virtio-pci.h	(revision cbcb34c71731e8f7f40ddb81bb612f2296305afc)
+++ uspace/lib/virtio/virtio-pci.h	(revision 341df5f859294503d81a416e3efa9d2f297a6410)
@@ -57,4 +57,6 @@
 #define VIRTIO_DEV_STATUS_DEVICE_NEEDS_RESET	64
 #define VIRTIO_DEV_STATUS_FAILED		128
+
+#define VIRTIO_FEATURES_0_31	0
 
 /** Common configuration structure layout according to VIRTIO version 1.0 */
@@ -179,4 +181,8 @@
 extern void virtio_virtq_teardown(virtio_dev_t *, uint16_t);
 
+extern errno_t virtio_device_setup_start(virtio_dev_t *, uint32_t);
+extern void virtio_device_setup_fail(virtio_dev_t *);
+extern void virtio_device_setup_finalize(virtio_dev_t *);
+
 extern errno_t virtio_pci_dev_initialize(ddf_dev_t *, virtio_dev_t *);
 extern errno_t virtio_pci_dev_cleanup(virtio_dev_t *);
