[ipxe-devel] [PATCH v2 2/3] [virtio] Renumber virtio_pci_region flags

Ladi Prosek lprosek at redhat.com
Mon May 2 13:11:05 UTC 2016


Some of the regions may end up being unmapped, either because
they are optional or because the attempt to map them has failed.
Region types starting at 0 didn't make it easy to test for this
condition.

This commit adds VIRTIO_PCI_REGION_NONE with the value of 0
and bumps the valid region types up by 1.

Signed-off-by: Ladi Prosek <lprosek at redhat.com>
---
 src/include/ipxe/virtio-pci.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/include/ipxe/virtio-pci.h b/src/include/ipxe/virtio-pci.h
index c7452c8..ec8efaa 100644
--- a/src/include/ipxe/virtio-pci.h
+++ b/src/include/ipxe/virtio-pci.h
@@ -106,12 +106,14 @@ struct virtio_pci_region {
 
 /* How to interpret the base field */
 #define VIRTIO_PCI_REGION_TYPE_MASK  0x00000003
+/* The region is unused */
+#define VIRTIO_PCI_REGION_NONE       0x00000000
 /* The base field is a memory address */
-#define VIRTIO_PCI_REGION_MEMORY     0x00000000
+#define VIRTIO_PCI_REGION_MEMORY     0x00000001
 /* The base field is a port address */
-#define VIRTIO_PCI_REGION_PORT       0x00000001
+#define VIRTIO_PCI_REGION_PORT       0x00000002
 /* The base field is an offset within the PCI bar */
-#define VIRTIO_PCI_REGION_PCI_CONFIG 0x00000002
+#define VIRTIO_PCI_REGION_PCI_CONFIG 0x00000003
     unsigned flags;
 };
 
-- 
2.5.5




More information about the ipxe-devel mailing list