]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/Include/IndustryStandard/VirtioBlk.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / OvmfPkg / Include / IndustryStandard / VirtioBlk.h
index 23da619d77a971d707f3551beb1a7b5a06f59c50..7a904975c314902848f57a4819623950b51f3adf 100644 (file)
 \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
-  UINT8  PhysicalBlockExp; // # of logical blocks per physical block (log2)\r
-  UINT8  AlignmentOffset;  // offset of first aligned logical block\r
-  UINT16 MinIoSize;        // suggested minimum I/O size in blocks\r
-  UINT32 OptIoSize;        // optimal (suggested maximum) I/O size in blocks\r
+  UINT8     PhysicalBlockExp; // # of logical blocks per physical block (log2)\r
+  UINT8     AlignmentOffset;  // offset of first aligned logical block\r
+  UINT16    MinIoSize;        // suggested minimum I/O size in blocks\r
+  UINT32    OptIoSize;        // optimal (suggested maximum) I/O size in blocks\r
 } VIRTIO_BLK_TOPOLOGY;\r
 \r
 typedef struct {\r
-  UINT64              Capacity;\r
-  UINT32              SizeMax;\r
-  UINT32              SegMax;\r
-  UINT16              Cylinders;\r
-  UINT8               Heads;\r
-  UINT8               Sectors;\r
-  UINT32              BlkSize;\r
-  VIRTIO_BLK_TOPOLOGY Topology;\r
+  UINT64                 Capacity;\r
+  UINT32                 SizeMax;\r
+  UINT32                 SegMax;\r
+  UINT16                 Cylinders;\r
+  UINT8                  Heads;\r
+  UINT8                  Sectors;\r
+  UINT32                 BlkSize;\r
+  VIRTIO_BLK_TOPOLOGY    Topology;\r
 } VIRTIO_BLK_CONFIG;\r
 #pragma pack()\r
 \r
-#define OFFSET_OF_VBLK(Field) OFFSET_OF (VIRTIO_BLK_CONFIG, Field)\r
-#define SIZE_OF_VBLK(Field)   (sizeof ((VIRTIO_BLK_CONFIG *) 0)->Field)\r
+#define OFFSET_OF_VBLK(Field)  OFFSET_OF (VIRTIO_BLK_CONFIG, Field)\r
+#define SIZE_OF_VBLK(Field)    (sizeof ((VIRTIO_BLK_CONFIG *) 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
+#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\r
                                     // implementation negotiates "optimal"\r
                                     // block size separately, via\r
                                     // VIRTIO_BLK_F_TOPOLOGY\r
-#define VIRTIO_BLK_F_SCSI     BIT7\r
-#define VIRTIO_BLK_F_FLUSH    BIT9  // identical to "write cache enabled"\r
-#define VIRTIO_BLK_F_TOPOLOGY BIT10 // information on optimal I/O alignment\r
+#define VIRTIO_BLK_F_SCSI      BIT7\r
+#define VIRTIO_BLK_F_FLUSH     BIT9  // identical to "write cache enabled"\r
+#define VIRTIO_BLK_F_TOPOLOGY  BIT10 // information on optimal I/O alignment\r
 \r
 //\r
 // We keep the status byte separate from the rest of the virtio-blk request\r
@@ -62,22 +61,22 @@ typedef struct {
 //\r
 #pragma pack(1)\r
 typedef struct {\r
-  UINT32 Type;\r
-  UINT32 IoPrio;\r
-  UINT64 Sector;\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
+#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
+#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