Browse Source

virtio: add pci definitions for qumra and virtio device names.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Ronald G. Minnich 7 years ago
parent
commit
5108b3fe6b
4 changed files with 36 additions and 22 deletions
  1. 7 7
      sys/include/virtio_blk.h
  2. 3 3
      sys/include/virtio_console.h
  3. 12 12
      sys/include/virtio_net.h
  4. 14 0
      sys/include/virtio_pci.h

+ 7 - 7
sys/include/virtio_blk.h

@@ -120,19 +120,19 @@ struct virtio_blk_config {
  */
 struct virtio_blk_outhdr {
 	/* VIRTIO_BLK_T* */
-	__virtio32 type;
+	uint32_t type;
 	/* io priority. */
-	__virtio32 ioprio;
+	uint32_t ioprio;
 	/* Sector (ie. 512 byte offset) */
-	__virtio64 sector;
+	uint64_t sector;
 };
 
 #ifndef VIRTIO_BLK_NO_LEGACY
 struct virtio_scsi_inhdr {
-	__virtio32 errors;
-	__virtio32 data_len;
-	__virtio32 sense_len;
-	__virtio32 residual;
+	uint32_t errors;
+	uint32_t data_len;
+	uint32_t sense_len;
+	uint32_t residual;
 };
 #endif /* !VIRTIO_BLK_NO_LEGACY */
 

+ 3 - 3
sys/include/virtio_console.h

@@ -53,9 +53,9 @@ struct virtio_console_config {
  * particular port.
  */
 struct virtio_console_control {
-	__virtio32 id;		/* Port number */
-	__virtio16 event;	/* The kind of control event (see below) */
-	__virtio16 value;	/* Extra information for the key */
+	uint32_t id;		/* Port number */
+	uint16_t event;	/* The kind of control event (see below) */
+	uint16_t value;	/* Extra information for the key */
 };
 
 /* Some events for control messages */

+ 12 - 12
sys/include/virtio_net.h

@@ -88,11 +88,11 @@ struct virtio_net_hdr_v1 {
 #define VIRTIO_NET_HDR_GSO_TCPV6	4	/* GSO frame, IPv6 TCP */
 #define VIRTIO_NET_HDR_GSO_ECN		0x80	/* TCP has ECN set */
 	uint8_t gso_type;
-	__virtio16 hdr_len;	/* Ethernet + IP + tcp/udp hdrs */
-	__virtio16 gso_size;	/* Bytes to append to hdr_len per frame */
-	__virtio16 csum_start;	/* Position to start checksumming from */
-	__virtio16 csum_offset;	/* Offset after that to place checksum */
-	__virtio16 num_buffers;	/* Number of merged rx buffers */
+	uint16_t hdr_len;	/* Ethernet + IP + tcp/udp hdrs */
+	uint16_t gso_size;	/* Bytes to append to hdr_len per frame */
+	uint16_t csum_start;	/* Position to start checksumming from */
+	uint16_t csum_offset;	/* Offset after that to place checksum */
+	uint16_t num_buffers;	/* Number of merged rx buffers */
 };
 
 #ifndef VIRTIO_NET_NO_LEGACY
@@ -105,17 +105,17 @@ struct virtio_net_hdr {
 	uint8_t flags;
 	/* See VIRTIO_NET_HDR_GSO_* */
 	uint8_t gso_type;
-	__virtio16 hdr_len;		/* Ethernet + IP + tcp/udp hdrs */
-	__virtio16 gso_size;		/* Bytes to append to hdr_len per frame */
-	__virtio16 csum_start;	/* Position to start checksumming from */
-	__virtio16 csum_offset;	/* Offset after that to place checksum */
+	uint16_t hdr_len;		/* Ethernet + IP + tcp/udp hdrs */
+	uint16_t gso_size;		/* Bytes to append to hdr_len per frame */
+	uint16_t csum_start;	/* Position to start checksumming from */
+	uint16_t csum_offset;	/* Offset after that to place checksum */
 };
 
 /* This is the version of the header to use when the MRG_RXBUF
  * feature has been negotiated. */
 struct virtio_net_hdr_mrg_rxbuf {
 	struct virtio_net_hdr hdr;
-	__virtio16 num_buffers;	/* Number of merged rx buffers */
+	uint16_t num_buffers;	/* Number of merged rx buffers */
 };
 #endif /* ...VIRTIO_NET_NO_LEGACY */
 
@@ -171,7 +171,7 @@ typedef uint8_t virtio_net_ctrl_ack;
  * VIRTIO_NET_F_CTRL_MAC_ADDR feature is available.
  */
 struct virtio_net_ctrl_mac {
-	__virtio32 entries;
+	uint32_t entries;
 	uint8_t macs[][ETH_ALEN];
 } __attribute__((packed));
 
@@ -215,7 +215,7 @@ struct virtio_net_ctrl_mac {
  * specified.
  */
 struct virtio_net_ctrl_mq {
-	__virtio16 virtqueue_pairs;
+	uint16_t virtqueue_pairs;
 };
 
 #define VIRTIO_NET_CTRL_MQ   4

+ 14 - 0
sys/include/virtio_pci.h

@@ -191,3 +191,17 @@ struct virtio_pci_cfg_cap {
 
 #endif /* VIRTIO_PCI_NO_MODERN */
 
+/* we're not sure where these should go; for now, they go here. */
+// Virtio-pci device type constants, from
+// http://git.qemu.org/?p=qemu.git;a=blob;f=include/hw/pci/pci.h
+#define PCI_VENDOR_ID_REDHAT_QUMRANET    0x1af4
+#define PCI_SUBVENDOR_ID_REDHAT_QUMRANET 0x1af4
+#define PCI_SUBDEVICE_ID_QEMU            0x1100
+
+#define PCI_DEVICE_ID_VIRTIO_NET         0x1000
+#define PCI_DEVICE_ID_VIRTIO_BLOCK       0x1001
+#define PCI_DEVICE_ID_VIRTIO_BALLOON     0x1002
+#define PCI_DEVICE_ID_VIRTIO_CONSOLE     0x1003
+#define PCI_DEVICE_ID_VIRTIO_SCSI        0x1004
+#define PCI_DEVICE_ID_VIRTIO_RNG         0x1005
+#define PCI_DEVICE_ID_VIRTIO_9P          0x1009