/** @file\r
\r
- Type and macro definitions corresponding to the virtio-0.9.5 specification.\r
+ Generic type and macro definitions corresponding to the virtio-0.9.5\r
+ specification.\r
\r
Copyright (C) 2012, Red Hat, Inc.\r
\r
UINT8 VhdrDeviceStatus;\r
UINT8 VhdrISR;\r
} VIRTIO_HDR;\r
-\r
-//\r
-// virtio-0.9.5, Appendix D: Block Device\r
-//\r
-typedef struct {\r
- VIRTIO_HDR Generic;\r
- UINT64 VhdrCapacity;\r
- UINT32 VhdrSizeMax;\r
- UINT32 VhdrSegMax;\r
- UINT16 VhdrCylinders;\r
- UINT8 VhdrHeads;\r
- UINT8 VhdrSectors;\r
- UINT32 VhdrBlkSize;\r
-} VBLK_HDR;\r
#pragma pack()\r
\r
-#define OFFSET_OF_VBLK(Field) OFFSET_OF (VBLK_HDR, Field)\r
-#define SIZE_OF_VBLK(Field) (sizeof ((VBLK_HDR *) 0)->Field)\r
-\r
\r
//\r
// virtio-0.9.5, 2.2.2.1 Device Status\r
#define VIRTIO_F_RING_INDIRECT_DESC BIT28\r
#define VIRTIO_F_RING_EVENT_IDX BIT29\r
\r
-//\r
-// virtio-0.9.5, Appendix D: Block Device\r
-//\r
-#define VIRTIO_BLK_F_BARRIER BIT0\r
-#define VIRTIO_BLK_F_SIZE_MAX BIT1\r
-#define VIRTIO_BLK_F_SEG_MAX BIT2\r
-#define VIRTIO_BLK_F_GEOMETRY BIT4\r
-#define VIRTIO_BLK_F_RO BIT5\r
-#define VIRTIO_BLK_F_BLK_SIZE BIT6 // treated as "logical block size" in\r
- // practice; actual host side implementation\r
- // negotiates "optimal" block size\r
- // separately\r
-#define VIRTIO_BLK_F_SCSI BIT7\r
-#define VIRTIO_BLK_F_FLUSH BIT9 // identical to "write cache enabled"\r
-\r
-\r
-//\r
-// We keep the status byte separate from the rest of the virtio-blk request\r
-// header. See description of historical scattering at the end of Appendix D:\r
-// we're going to put the status byte in a separate VRING_DESC.\r
-//\r
-#pragma pack(1)\r
-typedef struct {\r
- UINT32 Type;\r
- UINT32 IoPrio;\r
- UINT64 Sector;\r
-} VIRTIO_BLK_REQ;\r
-#pragma pack()\r
-\r
-#define VIRTIO_BLK_T_IN 0x00000000\r
-#define VIRTIO_BLK_T_OUT 0x00000001\r
-#define VIRTIO_BLK_T_SCSI_CMD 0x00000002\r
-#define VIRTIO_BLK_T_SCSI_CMD_OUT 0x00000003\r
-#define VIRTIO_BLK_T_FLUSH 0x00000004\r
-#define VIRTIO_BLK_T_FLUSH_OUT 0x00000005\r
-#define VIRTIO_BLK_T_BARRIER BIT31\r
-\r
-#define VIRTIO_BLK_S_OK 0x00\r
-#define VIRTIO_BLK_S_IOERR 0x01\r
-#define VIRTIO_BLK_S_UNSUPP 0x02\r
\r
#endif // _VIRTIO_H_\r
--- /dev/null
+/** @file\r
+\r
+ Virtio Block Device specific type and macro definitions corresponding to the\r
+ virtio-0.9.5 specification.\r
+\r
+ Copyright (C) 2012, Red Hat, Inc.\r
+\r
+ This program and the accompanying materials are licensed and made available\r
+ under the terms and conditions of the BSD License which accompanies this\r
+ distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT\r
+ WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef _VIRTIO_BLK_H_\r
+#define _VIRTIO_BLK_H_\r
+\r
+#include <IndustryStandard/Virtio.h>\r
+\r
+\r
+//\r
+// virtio-0.9.5, Appendix D: Block Device\r
+//\r
+#pragma pack(1)\r
+typedef struct {\r
+ VIRTIO_HDR Generic;\r
+ UINT64 VhdrCapacity;\r
+ UINT32 VhdrSizeMax;\r
+ UINT32 VhdrSegMax;\r
+ UINT16 VhdrCylinders;\r
+ UINT8 VhdrHeads;\r
+ UINT8 VhdrSectors;\r
+ UINT32 VhdrBlkSize;\r
+} VBLK_HDR;\r
+#pragma pack()\r
+\r
+#define OFFSET_OF_VBLK(Field) OFFSET_OF (VBLK_HDR, Field)\r
+#define SIZE_OF_VBLK(Field) (sizeof ((VBLK_HDR *) 0)->Field)\r
+\r
+#define VIRTIO_BLK_F_BARRIER BIT0\r
+#define VIRTIO_BLK_F_SIZE_MAX BIT1\r
+#define VIRTIO_BLK_F_SEG_MAX BIT2\r
+#define VIRTIO_BLK_F_GEOMETRY BIT4\r
+#define VIRTIO_BLK_F_RO BIT5\r
+#define VIRTIO_BLK_F_BLK_SIZE BIT6 // treated as "logical block size" in\r
+ // practice; actual host side implementation\r
+ // negotiates "optimal" block size\r
+ // separately\r
+#define VIRTIO_BLK_F_SCSI BIT7\r
+#define VIRTIO_BLK_F_FLUSH BIT9 // identical to "write cache enabled"\r
+\r
+//\r
+// We keep the status byte separate from the rest of the virtio-blk request\r
+// header. See description of historical scattering at the end of Appendix D:\r
+// we're going to put the status byte in a separate VRING_DESC.\r
+//\r
+#pragma pack(1)\r
+typedef struct {\r
+ UINT32 Type;\r
+ UINT32 IoPrio;\r
+ UINT64 Sector;\r
+} VIRTIO_BLK_REQ;\r
+#pragma pack()\r
+\r
+#define VIRTIO_BLK_T_IN 0x00000000\r
+#define VIRTIO_BLK_T_OUT 0x00000001\r
+#define VIRTIO_BLK_T_SCSI_CMD 0x00000002\r
+#define VIRTIO_BLK_T_SCSI_CMD_OUT 0x00000003\r
+#define VIRTIO_BLK_T_FLUSH 0x00000004\r
+#define VIRTIO_BLK_T_FLUSH_OUT 0x00000005\r
+#define VIRTIO_BLK_T_BARRIER BIT31\r
+\r
+#define VIRTIO_BLK_S_OK 0x00\r
+#define VIRTIO_BLK_S_IOERR 0x01\r
+#define VIRTIO_BLK_S_UNSUPP 0x02\r
+\r
+#endif // _VIRTIO_BLK_H_\r