L4Re - L4 Runtime Environment
virtio_block.h
1 /*
2  * (c) 2014 Sarah Hoffmann <sarah.hoffmann@kernkonzept.com>
3  *
4  * This file is part of TUD:OS and distributed under the terms of the
5  * GNU General Public License 2.
6  * Please see the COPYING-GPL-2 file for details.
7  *
8  * As a special exception, you may use this file as part of a free software
9  * library without restriction. Specifically, if other files instantiate
10  * templates or use macros or inline functions from this file, or you compile
11  * this file and link it with other files to produce an executable, this
12  * file does not by itself cause the resulting executable to be covered by
13  * the GNU General Public License. This exception does not however
14  * invalidate any other reasons why the executable file might be covered by
15  * the GNU General Public License.
16  */
17 
18 #pragma once
19 
26 #include <l4/sys/types.h>
27 
32 {
39 };
40 
45 {
49 };
50 
55 {
60 
61 enum L4virtio_block_discard_flags_t
62 {
63  L4VIRTIO_BLOCK_DISCARD_F_UNMAP = 0x00000001UL,
64  L4VIRTIO_BLOCK_DISCARD_F_RESERVED = 0xFFFFFFFEUL,
65 };
66 
71 {
73  l4_uint32_t num_sectors;
74  l4_uint32_t flags;
76 
81 {
85  struct l4virtio_block_config_geometry_t
86  {
87  l4_uint16_t cylinders;
88  l4_uint8_t heads;
89  l4_uint8_t sectors;
90  } geometry;
92  struct l4virtio_block_config_topology_t
93  {
95  l4_uint8_t physical_block_exp;
97  l4_uint8_t alignment_offset;
99  l4_uint16_t min_io_size;
101  l4_uint32_t opt_io_size;
102  } topology;
103  l4_uint8_t writeback;
104  l4_uint8_t unused0[3];
105  l4_uint32_t max_discard_sectors;
106  l4_uint32_t max_discard_seg;
107  l4_uint32_t discard_sector_alignment;
108  l4_uint32_t max_write_zeroes_sectors;
109  l4_uint32_t max_write_zeroes_seg;
110  l4_uint8_t write_zeroes_may_unmap;
111  l4_uint8_t unused1[3];
113 
l4_uint64_t capacity
Capacity of device in 512-byte sectors.
Definition: virtio_block.h:82
l4_uint32_t blk_size
Block size of underlying disk.
Definition: virtio_block.h:91
l4_uint32_t ioprio
Priority (unused)
Definition: virtio_block.h:57
L4virtio_block_operations
Kinds of operation over a block device.
Definition: virtio_block.h:31
Request finished successfully.
Definition: virtio_block.h:46
unsigned short int l4_uint16_t
Unsigned 16bit value.
Definition: l4int.h:38
Common L4 ABI Data Types.
Header structure of a request for a block device.
Definition: virtio_block.h:54
Device configuration for block devices.
Definition: virtio_block.h:80
L4virtio_block_status
Status of a finished block request.
Definition: virtio_block.h:44
struct l4virtio_block_config_t l4virtio_block_config_t
Device configuration for block devices.
Read from device.
Definition: virtio_block.h:33
Structure used for the write zeroes and discard commands.
Definition: virtio_block.h:70
Discard a range of sectors.
Definition: virtio_block.h:37
Flush data to disk.
Definition: virtio_block.h:35
struct l4virtio_block_discard_t l4virtio_block_discard_t
Structure used for the write zeroes and discard commands.
Write to device.
Definition: virtio_block.h:34
l4_uint32_t type
Kind of request, see L4virtio_block_operations.
Definition: virtio_block.h:56
l4_uint32_t size_max
Maximum size of a single segment.
Definition: virtio_block.h:83
unsigned char l4_uint8_t
Unsigned 8bit value.
Definition: l4int.h:36
Operation is not supported.
Definition: virtio_block.h:48
unsigned long long l4_uint64_t
Unsigned 64bit value.
Definition: l4int.h:42
l4_uint64_t sector
First sector to read/write.
Definition: virtio_block.h:58
IO error on device.
Definition: virtio_block.h:47
Get device ID.
Definition: virtio_block.h:36
Write zeroes to a range of sectors.
Definition: virtio_block.h:38
struct l4virtio_block_header_t l4virtio_block_header_t
Header structure of a request for a block device.
unsigned int l4_uint32_t
Unsigned 32bit value.
Definition: l4int.h:40
l4_uint32_t seg_max
Maximum number of segments per request.
Definition: virtio_block.h:84