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