Home | History | Annotate | Download | only in linux
      1 /****************************************************************************
      2  ****************************************************************************
      3  ***
      4  ***   This header was automatically generated from a Linux kernel header
      5  ***   of the same name, to make information necessary for userspace to
      6  ***   call into the kernel available to libc.  It contains only constants,
      7  ***   structures, and macros generated from the original header, and thus,
      8  ***   contains no copyrightable information.
      9  ***
     10  ***   To edit the content of this header, modify the corresponding
     11  ***   source file (e.g. under external/kernel-headers/original/) then
     12  ***   run bionic/libc/kernel/tools/update_all.py
     13  ***
     14  ***   Any manual change here will be lost the next time this script will
     15  ***   be run. You've been warned!
     16  ***
     17  ****************************************************************************
     18  ****************************************************************************/
     19 #ifndef _LINUX_VIRTIO_BLK_H
     20 #define _LINUX_VIRTIO_BLK_H
     21 #include <linux/types.h>
     22 #include <linux/virtio_ids.h>
     23 #include <linux/virtio_config.h>
     24 #include <linux/virtio_types.h>
     25 #define VIRTIO_BLK_F_SIZE_MAX 1
     26 #define VIRTIO_BLK_F_SEG_MAX 2
     27 #define VIRTIO_BLK_F_GEOMETRY 4
     28 #define VIRTIO_BLK_F_RO 5
     29 #define VIRTIO_BLK_F_BLK_SIZE 6
     30 #define VIRTIO_BLK_F_TOPOLOGY 10
     31 #define VIRTIO_BLK_F_MQ 12
     32 #ifndef VIRTIO_BLK_NO_LEGACY
     33 #define VIRTIO_BLK_F_BARRIER 0
     34 #define VIRTIO_BLK_F_SCSI 7
     35 #define VIRTIO_BLK_F_FLUSH 9
     36 #define VIRTIO_BLK_F_CONFIG_WCE 11
     37 #define VIRTIO_BLK_F_WCE VIRTIO_BLK_F_FLUSH
     38 #endif
     39 #define VIRTIO_BLK_ID_BYTES 20
     40 struct virtio_blk_config {
     41   __u64 capacity;
     42   __u32 size_max;
     43   __u32 seg_max;
     44   struct virtio_blk_geometry {
     45     __u16 cylinders;
     46     __u8 heads;
     47     __u8 sectors;
     48   } geometry;
     49   __u32 blk_size;
     50   __u8 physical_block_exp;
     51   __u8 alignment_offset;
     52   __u16 min_io_size;
     53   __u32 opt_io_size;
     54   __u8 wce;
     55   __u8 unused;
     56   __u16 num_queues;
     57 } __attribute__((packed));
     58 #define VIRTIO_BLK_T_IN 0
     59 #define VIRTIO_BLK_T_OUT 1
     60 #ifndef VIRTIO_BLK_NO_LEGACY
     61 #define VIRTIO_BLK_T_SCSI_CMD 2
     62 #endif
     63 #define VIRTIO_BLK_T_FLUSH 4
     64 #define VIRTIO_BLK_T_GET_ID 8
     65 #ifndef VIRTIO_BLK_NO_LEGACY
     66 #define VIRTIO_BLK_T_BARRIER 0x80000000
     67 #endif
     68 struct virtio_blk_outhdr {
     69   __virtio32 type;
     70   __virtio32 ioprio;
     71   __virtio64 sector;
     72 };
     73 #ifndef VIRTIO_BLK_NO_LEGACY
     74 struct virtio_scsi_inhdr {
     75   __virtio32 errors;
     76   __virtio32 data_len;
     77   __virtio32 sense_len;
     78   __virtio32 residual;
     79 };
     80 #endif
     81 #define VIRTIO_BLK_S_OK 0
     82 #define VIRTIO_BLK_S_IOERR 1
     83 #define VIRTIO_BLK_S_UNSUPP 2
     84 #endif
     85