3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 Header file for SCSI Bus Driver.
23 // TODO: fix comment to end with --*/
28 #include <IndustryStandard/scsi.h>
32 #define ONE_SECOND_TIMER 10000000
34 #define SCSI_IO_DEV_SIGNATURE EFI_SIGNATURE_32 ('s', 'c', 'i', 'o')
36 typedef struct _SCSI_TARGET_ID
{
54 EFI_SCSI_IO_PROTOCOL ScsiIo
;
55 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
56 BOOLEAN ExtScsiSupport
;
57 EFI_SCSI_PASS_THRU_PROTOCOL
*ScsiPassThru
;
58 EFI_EXT_SCSI_PASS_THRU_PROTOCOL
*ExtScsiPassThru
;
63 BOOLEAN RemovableDevice
;
66 #define SCSI_IO_DEV_FROM_THIS(a) CR (a, SCSI_IO_DEV, ScsiIo, SCSI_IO_DEV_SIGNATURE)
69 // SCSI Bus Controller device strcuture
71 #define EFI_SCSI_BUS_PROTOCOL_GUID \
73 0x5261213D, 0x3A3D, 0x441E, 0xB3, 0xAF, 0x21, 0xD3, 0xF7, 0xA4, 0xCA, 0x17 \
76 typedef struct _EFI_SCSI_BUS_PROTOCOL
{
78 } EFI_SCSI_BUS_PROTOCOL
;
80 #define SCSI_BUS_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('s', 'c', 's', 'i')
83 typedef struct _SCSI_BUS_DEVICE
{
85 EFI_SCSI_BUS_PROTOCOL BusIdentify
;
86 BOOLEAN ExtScsiSupport
;
87 EFI_SCSI_PASS_THRU_PROTOCOL
*ScsiInterface
;
88 EFI_EXT_SCSI_PASS_THRU_PROTOCOL
*ExtScsiInterface
;
89 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
92 #define SCSI_BUS_CONTROLLER_DEVICE_FROM_THIS(a) CR (a, SCSI_BUS_DEVICE, BusIdentify, SCSI_BUS_DEVICE_SIGNATURE)
97 extern EFI_DRIVER_BINDING_PROTOCOL gScsiBusDriverBinding
;
98 extern EFI_COMPONENT_NAME_PROTOCOL gScsiBusComponentName
;
102 SCSIBusDriverBindingSupported (
103 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
104 IN EFI_HANDLE Controller
,
105 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
110 SCSIBusDriverBindingStart (
111 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
112 IN EFI_HANDLE Controller
,
113 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
118 SCSIBusDriverBindingStop (
119 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
120 IN EFI_HANDLE Controller
,
121 IN UINTN NumberOfChildren
,
122 IN EFI_HANDLE
*ChildHandleBuffer
126 // EFI Component Name Functions
130 ScsiBusComponentNameGetDriverName (
131 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
133 OUT CHAR16
**DriverName
138 ScsiBusComponentNameGetControllerName (
139 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
140 IN EFI_HANDLE ControllerHandle
,
141 IN EFI_HANDLE ChildHandle OPTIONAL
,
143 OUT CHAR16
**ControllerName
149 IN EFI_SCSI_IO_PROTOCOL
*This
,
150 OUT UINT8
*DeviceType
156 Retrieves the device type information of the SCSI Controller.
160 This - Protocol instance pointer.
161 DeviceType - A pointer to the device type information
162 retrieved from the SCSI Controller.
166 EFI_SUCCESS - Retrieves the device type information successfully.
167 EFI_INVALID_PARAMETER - The DeviceType is NULL.
175 IN EFI_SCSI_IO_PROTOCOL
*This
181 Resets the SCSI Bus that the SCSI Controller is attached to.
185 This - Protocol instance pointer.
189 EFI_SUCCESS - The SCSI bus is reset successfully.
190 EFI_DEVICE_ERROR - Errors encountered when resetting the SCSI bus.
191 EFI_UNSUPPORTED - The bus reset operation is not supported by the
192 SCSI Host Controller.
193 EFI_TIMEOUT - A timeout occurred while attempting to reset
202 IN EFI_SCSI_IO_PROTOCOL
*This
208 Resets the SCSI Controller that the device handle specifies.
212 This - Protocol instance pointer.
216 EFI_SUCCESS - Reset the SCSI controller successfully.
217 EFI_DEVICE_ERROR - Errors are encountered when resetting the
219 EFI_UNSUPPORTED - The SCSI bus does not support a device
221 EFI_TIMEOUT - A timeout occurred while attempting to
222 reset the SCSI Controller.
229 ScsiExecuteSCSICommand (
230 IN EFI_SCSI_IO_PROTOCOL
*This
,
231 IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET
*CommandPacket
,
238 Sends a SCSI Request Packet to the SCSI Controller for execution.
242 This - Protocol instance pointer.
243 Packet - The SCSI request packet to send to the SCSI
244 Controller specified by the device handle.
245 Event - If the SCSI bus where the SCSI device is attached
246 does not support non-blocking I/O, then Event is
247 ignored, and blocking I/O is performed.
248 If Event is NULL, then blocking I/O is performed.
249 If Event is not NULL and non-blocking I/O is
250 supported, then non-blocking I/O is performed,
251 and Event will be signaled when the SCSI Request
255 EFI_SUCCESS - The SCSI Request Packet was sent by the host
256 successfully, and TransferLength bytes were
257 transferred to/from DataBuffer.See
258 HostAdapterStatus, TargetStatus,
259 SenseDataLength, and SenseData in that order
260 for additional status information.
261 EFI_BAD_BUFFER_SIZE - The SCSI Request Packet was executed,
262 but the entire DataBuffer could not be transferred.
263 The actual number of bytes transferred is returned
264 in TransferLength. See HostAdapterStatus,
265 TargetStatus, SenseDataLength, and SenseData in
266 that order for additional status information.
267 EFI_NOT_READY - The SCSI Request Packet could not be sent because
268 there are too many SCSI Command Packets already
269 queued.The caller may retry again later.
270 EFI_DEVICE_ERROR - A device error occurred while attempting to send
271 the SCSI Request Packet. See HostAdapterStatus,
272 TargetStatus, SenseDataLength, and SenseData in
273 that order for additional status information.
274 EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid.
275 The SCSI Request Packet was not sent, so no
276 additional status information is available.
277 EFI_UNSUPPORTED - The command described by the SCSI Request Packet
278 is not supported by the SCSI initiator(i.e., SCSI
279 Host Controller). The SCSI Request Packet was not
280 sent, so no additional status information is
282 EFI_TIMEOUT - A timeout occurred while waiting for the SCSI
283 Request Packet to execute. See HostAdapterStatus,
284 TargetStatus, SenseDataLength, and SenseData in
285 that order for additional status information.
291 ScsiScanCreateDevice (
292 EFI_DRIVER_BINDING_PROTOCOL
*This
,
293 EFI_HANDLE Controller
,
294 SCSI_TARGET_ID
*TargetId
,
296 SCSI_BUS_DEVICE
*ScsiBusDev
302 Scan SCSI Bus to discover the device, and attach ScsiIoProtocol to it.
306 This - Protocol instance pointer
307 Controller - Controller handle
308 Pun - The Pun of the SCSI device on the SCSI channel.
309 Lun - The Lun of the SCSI device on the SCSI channel.
310 ScsiBusDev - The pointer of SCSI_BUS_DEVICE
314 EFI_SUCCESS - Successfully to discover the device and attach ScsiIoProtocol to it.
315 EFI_OUT_OF_RESOURCES - Fail to discover the device.
322 SCSI_IO_DEV
*ScsiIoDevice
328 TODO: Add function description
332 ScsiIoDevice - TODO: add argument description
336 TODO: add return values
343 EFI_SCSI_PASS_THRU_PROTOCOL
*ScsiPassThru
,
352 TODO: Add function description
356 ScsiPassThru - TODO: add argument description
357 Target - TODO: add argument description
358 LunArray - TODO: add argument description
359 NumberOfLuns - TODO: add argument description
363 TODO: add return values
369 ScsiBusSubmitReportLunCommand (
370 EFI_SCSI_PASS_THRU_PROTOCOL
*ScsiPassThru
,
372 UINTN AllocationLength
,
374 EFI_SCSI_SENSE_DATA
*SenseData
,
375 UINT8
*SenseDataLength
,
376 UINT8
*HostAdapterStatus
,
383 TODO: Add function description
387 ScsiPassThru - TODO: add argument description
388 Target - TODO: add argument description
389 AllocationLength - TODO: add argument description
390 Buffer - TODO: add argument description
391 SenseData - TODO: add argument description
392 SenseDataLength - TODO: add argument description
393 HostAdapterStatus - TODO: add argument description
394 TargetStatus - TODO: add argument description
398 TODO: add return values