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