]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/ScsiIo.h
Initial import.
[mirror_edk2.git] / MdePkg / Include / Protocol / ScsiIo.h
CommitLineData
878ddf1f 1/** @file\r
2 EFI_SCSI_IO_PROTOCOL as defined in UEFI 2.0.\r
3\r
4 Copyright (c) 2006, Intel Corporation \r
5 All rights reserved. This program and the accompanying materials \r
6 are licensed and made available under the terms and conditions of the BSD License \r
7 which accompanies this distribution. The full text of the license may be found at \r
8 http://opensource.org/licenses/bsd-license.php \r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
12\r
13 Module Name: ScsiIo.h\r
14\r
15**/\r
16\r
17#ifndef __EFI_SCSI_IO_PROTOCOL_H__\r
18#define __EFI_SCSI_IO_PROTOCOL_H__\r
19\r
20#define EFI_SCSI_IO_PROTOCOL_GUID \\r
21 { \\r
22 0x932f4736, 0x2362, 0x4002, {0x80, 0x3e, 0x3c, 0xd5, 0x4b, 0x13, 0x8f, 0x85 } \\r
23 }\r
24\r
25//\r
26// Forward reference for pure ANSI compatability\r
27//\r
28typedef struct _EFI_SCSI_IO_PROTOCOL EFI_SCSI_IO_PROTOCOL;\r
29\r
30//\r
31// SCSI Data Direction definition\r
32//\r
33#define EFI_SCSI_IO_DATA_DIRECTION_READ 0\r
34#define EFI_SCSI_IO_DATA_DIRECTION_WRITE 1\r
35#define EFI_SCSI_IO_DATA_DIRECTION_BIDIRECTIONAL 2\r
36\r
37//\r
38// SCSI Host Adapter Status definition\r
39//\r
40#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_OK 0x00\r
41#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND 0x09 // timeout when processing the command\r
42#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_TIMEOUT 0x0b // timeout when waiting for the command processing\r
43#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_MESSAGE_REJECT 0x0d // a message reject was received when processing command\r
44#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_BUS_RESET 0x0e // a bus reset was detected\r
45#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_PARITY_ERROR 0x0f\r
46#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_REQUEST_SENSE_FAILED 0x10 // the adapter failed in issuing request sense command\r
47#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_SELECTION_TIMEOUT 0x11 // selection timeout\r
48#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN 0x12 // data overrun or data underrun\r
49#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_BUS_FREE 0x13 // Unexepected bus free\r
50#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_PHASE_ERROR 0x14 // Target bus phase sequence failure\r
51#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_OTHER 0x7f\r
52\r
53\r
54//\r
55// SCSI Target Status definition\r
56//\r
57#define EFI_SCSI_IO_STATUS_TARGET_GOOD 0x00\r
58#define EFI_SCSI_IO_STATUS_TARGET_CHECK_CONDITION 0x02 // check condition\r
59#define EFI_SCSI_IO_STATUS_TARGET_CONDITION_MET 0x04 // condition met\r
60#define EFI_SCSI_IO_STATUS_TARGET_BUSY 0x08 // busy\r
61#define EFI_SCSI_IO_STATUS_TARGET_INTERMEDIATE 0x10 // intermediate\r
62#define EFI_SCSI_IO_STATUS_TARGET_INTERMEDIATE_CONDITION_MET 0x14 // intermediate-condition met\r
63#define EFI_SCSI_IO_STATUS_TARGET_RESERVATION_CONFLICT 0x18 // reservation conflict\r
64#define EFI_SCSI_IO_STATUS_TARGET_COMMOND_TERMINATED 0x22 // command terminated\r
65#define EFI_SCSI_IO_STATUS_TARGET_QUEUE_FULL 0x28 // queue full\r
66\r
67typedef struct {\r
68 UINT64 Timeout;\r
69 VOID *InDataBuffer;\r
70 VOID *OutDataBuffer;\r
71 VOID *SenseData;\r
72 VOID *Cdb;\r
73 UINT32 InTransferLength;\r
74 UINT32 OutTransferLength;\r
75 UINT8 CdbLength;\r
76 UINT8 DataDirection;\r
77 UINT8 HostAdapterStatus;\r
78 UINT8 TargetStatus;\r
79 UINT8 SenseDataLength;\r
80} EFI_SCSI_IO_SCSI_REQUEST_PACKET;\r
81\r
82/**\r
83 Retrieves the device type information of the SCSI Controller.\r
84\r
85 @param This Protocol instance pointer.\r
86 @param DeviceType A pointer to the device type information\r
87 retrieved from the SCSI Controller.\r
88\r
89 @retval EFI_SUCCESS Retrieves the device type information successfully.\r
90 @retval EFI_INVALID_PARAMETER The DeviceType is NULL.\r
91\r
92**/\r
93typedef\r
94EFI_STATUS\r
95(EFIAPI *EFI_SCSI_IO_PROTOCOL_GET_DEVICE_TYPE) (\r
96 IN EFI_SCSI_IO_PROTOCOL *This,\r
97 OUT UINT8 *DeviceType\r
98 )\r
99;\r
100\r
101/**\r
102 Retrieves the device location in the SCSI channel.\r
103\r
104 @param This Protocol instance pointer.\r
105 @param Target A pointer to the Target ID of a SCSI device\r
106 on the SCSI channel.\r
107 @param Lun A pointer to the LUN of the SCSI device on\r
108 the SCSI channel.\r
109\r
110 @retval EFI_SUCCESS Retrieves the device location successfully.\r
111 @retval EFI_INVALID_PARAMETER The Target or Lun is NULL.\r
112\r
113**/\r
114typedef\r
115EFI_STATUS\r
116(EFIAPI *EFI_SCSI_IO_PROTOCOL_GET_DEVICE_LOCATION) (\r
117 IN EFI_SCSI_IO_PROTOCOL *This,\r
118 IN OUT UINT8 **Target,\r
119 OUT UINT64 *Lun\r
120 )\r
121;\r
122\r
123/**\r
124 Resets the SCSI Bus that the SCSI Controller is attached to.\r
125\r
126 @param This Protocol instance pointer.\r
127\r
128 @retval EFI_SUCCESS The SCSI bus is reset successfully.\r
129 @retval EFI_DEVICE_ERROR Errors encountered when resetting the SCSI bus.\r
130 @retval EFI_UNSUPPORTED The bus reset operation is not supported by the\r
131 SCSI Host Controller.\r
132 @retval EFI_TIMEOUT A timeout occurred while attempting to reset\r
133 the SCSI bus.\r
134\r
135**/\r
136typedef\r
137EFI_STATUS\r
138(EFIAPI *EFI_SCSI_IO_PROTOCOL_RESET_BUS) (\r
139 IN EFI_SCSI_IO_PROTOCOL *This\r
140 )\r
141;\r
142\r
143/**\r
144 Resets the SCSI Controller that the device handle specifies.\r
145\r
146 @param This Protocol instance pointer.\r
147\r
148 @retval EFI_SUCCESS Reset the SCSI controller successfully.\r
149 @retval EFI_DEVICE_ERROR Errors are encountered when resetting the\r
150 SCSI Controller.\r
151 @retval EFI_UNSUPPORTED The SCSI bus does not support a device\r
152 reset operation.\r
153 @retval EFI_TIMEOUT A timeout occurred while attempting to\r
154 reset the SCSI Controller.\r
155\r
156**/\r
157typedef\r
158EFI_STATUS\r
159(EFIAPI *EFI_SCSI_IO_PROTOCOL_RESET_DEVICE) (\r
160 IN EFI_SCSI_IO_PROTOCOL *This\r
161 )\r
162;\r
163\r
164\r
165/**\r
166 Sends a SCSI Request Packet to the SCSI Controller for execution.\r
167\r
168 @param This Protocol instance pointer.\r
169 @param Packet The SCSI request packet to send to the SCSI\r
170 Controller specified by the device handle.\r
171 @param Event If the SCSI bus where the SCSI device is attached\r
172 does not support non-blocking I/O, then Event is\r
173 ignored, and blocking I/O is performed.\r
174 If Event is NULL, then blocking I/O is performed.\r
175 If Event is not NULL and non-blocking I/O is\r
176 supported, then non-blocking I/O is performed,\r
177 and Event will be signaled when the SCSI Request\r
178 Packet completes.\r
179\r
180 @retval EFI_SUCCESS The SCSI Request Packet was sent by the host\r
181 successfully, and TransferLength bytes were\r
182 transferred to/from DataBuffer.See\r
183 HostAdapterStatus, TargetStatus,\r
184 SenseDataLength, and SenseData in that order\r
185 for additional status information.\r
186 @retval EFI_WARN_BUFFER_TOO_SMALL The SCSI Request Packet was executed,\r
187 but the entire DataBuffer could not be transferred.\r
188 The actual number of bytes transferred is returned\r
189 in TransferLength. See HostAdapterStatus,\r
190 TargetStatus, SenseDataLength, and SenseData in\r
191 that order for additional status information.\r
192 @retval EFI_NOT_READY The SCSI Request Packet could not be sent because\r
193 there are too many SCSI Command Packets already\r
194 queued.The caller may retry again later.\r
195 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send\r
196 the SCSI Request Packet. See HostAdapterStatus,\r
197 TargetStatus, SenseDataLength, and SenseData in\r
198 that order for additional status information.\r
199 @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid.\r
200 The SCSI Request Packet was not sent, so no\r
201 additional status information is available.\r
202 @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet\r
203 is not supported by the SCSI initiator(i.e., SCSI\r
204 Host Controller). The SCSI Request Packet was not\r
205 sent, so no additional status information is\r
206 available.\r
207 @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI\r
208 Request Packet to execute. See HostAdapterStatus,\r
209 TargetStatus, SenseDataLength, and SenseData in\r
210 that order for additional status information.\r
211\r
212**/\r
213typedef\r
214EFI_STATUS\r
215(EFIAPI *EFI_SCSI_IO_PROTOCOL_EXEC_SCSI_COMMAND) (\r
216 IN EFI_SCSI_IO_PROTOCOL *This,\r
217 IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet,\r
218 IN EFI_EVENT Event OPTIONAL\r
219 )\r
220;\r
221\r
222struct _EFI_SCSI_IO_PROTOCOL {\r
223 EFI_SCSI_IO_PROTOCOL_GET_DEVICE_TYPE GetDeviceType;\r
224 EFI_SCSI_IO_PROTOCOL_GET_DEVICE_LOCATION GetDeviceLocation;\r
225 EFI_SCSI_IO_PROTOCOL_RESET_BUS ResetBus;\r
226 EFI_SCSI_IO_PROTOCOL_RESET_DEVICE ResetDevice;\r
227 EFI_SCSI_IO_PROTOCOL_EXEC_SCSI_COMMAND ExecuteSCSICommand; \r
228 UINT32 IoAlign;\r
229};\r
230\r
231extern EFI_GUID gEfiScsiIoProtocolGuid;\r
232\r
233#endif\r