TianoCore EDK2 master
Loading...
Searching...
No Matches
VirtioScsi.h
Go to the documentation of this file.
1
12#ifndef _VIRTIO_SCSI_H_
13#define _VIRTIO_SCSI_H_
14
16
17//
18// virtio-0.9.5, Appendix I: SCSI Host Device
19//
20#pragma pack(1)
21typedef struct {
22 UINT32 NumQueues;
23 UINT32 SegMax;
24 UINT32 MaxSectors;
25 UINT32 CmdPerLun;
26 UINT32 EventInfoSize;
27 UINT32 SenseSize;
28 UINT32 CdbSize;
29 UINT16 MaxChannel;
30 UINT16 MaxTarget;
31 UINT32 MaxLun;
33#pragma pack()
34
35#define OFFSET_OF_VSCSI(Field) OFFSET_OF (VIRTIO_SCSI_CONFIG, Field)
36#define SIZE_OF_VSCSI(Field) (sizeof ((VIRTIO_SCSI_CONFIG *) 0)->Field)
37
38#define VIRTIO_SCSI_F_INOUT BIT0
39#define VIRTIO_SCSI_F_HOTPLUG BIT1
40
41//
42// We expect these maximum sizes from the host. Also we force the CdbLength and
43// SenseDataLength parameters of EFI_EXT_SCSI_PASS_THRU_PROTOCOL.PassThru() not
44// to exceed these limits. See UEFI 2.3.1 errata C 14.7.
45//
46#define VIRTIO_SCSI_CDB_SIZE 32
47#define VIRTIO_SCSI_SENSE_SIZE 96
48
49//
50// We pass the dynamically sized buffers ("dataout", "datain") in separate ring
51// descriptors.
52//
53#pragma pack(1)
54typedef struct {
55 UINT8 Lun[8];
56 UINT64 Id;
57 UINT8 TaskAttr;
58 UINT8 Prio;
59 UINT8 Crn;
60 UINT8 Cdb[VIRTIO_SCSI_CDB_SIZE];
62
63typedef struct {
64 UINT32 SenseLen;
65 UINT32 Residual;
66 UINT16 StatusQualifier;
67 UINT8 Status;
68 UINT8 Response;
69 UINT8 Sense[VIRTIO_SCSI_SENSE_SIZE];
71#pragma pack()
72
73//
74// selector of first virtio queue usable for request transfer
75//
76#define VIRTIO_SCSI_REQUEST_QUEUE 2
77
78//
79// host response codes
80//
81#define VIRTIO_SCSI_S_OK 0
82#define VIRTIO_SCSI_S_OVERRUN 1
83#define VIRTIO_SCSI_S_ABORTED 2
84#define VIRTIO_SCSI_S_BAD_TARGET 3
85#define VIRTIO_SCSI_S_RESET 4
86#define VIRTIO_SCSI_S_BUSY 5
87#define VIRTIO_SCSI_S_TRANSPORT_FAILURE 6
88#define VIRTIO_SCSI_S_TARGET_FAILURE 7
89#define VIRTIO_SCSI_S_NEXUS_FAILURE 8
90#define VIRTIO_SCSI_S_FAILURE 9
91
92#endif // _VIRTIO_SCSI_H_