From 9beb888e7ce592fe424ba9fa871651d64d192001 Mon Sep 17 00:00:00 2001 From: jji4 Date: Wed, 12 Nov 2008 01:30:58 +0000 Subject: [PATCH] Code Scrub: MdeModulePkg\Bus\ScsiBusDxe\ MdeModulePkg\Bus\ScsiDisk\ git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6465 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Bus/Scsi/ScsiBusDxe/ComponentName.c | 35 +- MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c | 595 ++++------ MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.h | 361 +++--- .../Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf | 5 +- .../Bus/Scsi/ScsiDiskDxe/ComponentName.c | 31 +- MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c | 1043 +++++++---------- MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h | 926 +++++++-------- .../Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf | 5 +- 8 files changed, 1317 insertions(+), 1684 deletions(-) diff --git a/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ComponentName.c b/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ComponentName.c index 0e18db5800..59c8b5b671 100644 --- a/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ComponentName.c +++ b/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ComponentName.c @@ -13,25 +13,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include - - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - - #include "ScsiBus.h" // @@ -68,10 +49,10 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mScsiBusDriverNameTable[] by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. - @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or + @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or EFI_COMPONENT_NAME_PROTOCOL instance. - @param Language[in] A pointer to a Null-terminated ASCII string + @param Language A pointer to a Null-terminated ASCII string array indicating the language. This is the language of the driver name that the caller is requesting, and it must match one of the @@ -80,7 +61,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mScsiBusDriverNameTable[] to the driver writer. Language is specified in RFC 3066 or ISO 639-2 language code format. - @param DriverName[out] A pointer to the Unicode string to return. + @param DriverName A pointer to the Unicode string to return. This Unicode string is the name of the driver specified by This in the language specified by Language. @@ -127,15 +108,15 @@ ScsiBusComponentNameGetDriverName ( then EFI_UNSUPPORTED is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. - @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or + @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or EFI_COMPONENT_NAME_PROTOCOL instance. - @param ControllerHandle[in] The handle of a controller that the driver + @param ControllerHandle The handle of a controller that the driver specified by This is managing. This handle specifies the controller whose name is to be returned. - @param ChildHandle[in] The handle of the child controller to retrieve + @param ChildHandle The handle of the child controller to retrieve the name of. This is an optional parameter that may be NULL. It will be NULL for device drivers. It will also be NULL for a bus drivers @@ -144,7 +125,7 @@ ScsiBusComponentNameGetDriverName ( driver that wishes to retrieve the name of a child controller. - @param Language[in] A pointer to a Null-terminated ASCII string + @param Language A pointer to a Null-terminated ASCII string array indicating the language. This is the language of the driver name that the caller is requesting, and it must match one of the @@ -153,7 +134,7 @@ ScsiBusComponentNameGetDriverName ( to the driver writer. Language is specified in RFC 3066 or ISO 639-2 language code format. - @param ControllerName[out] A pointer to the Unicode string to return. + @param ControllerName A pointer to the Unicode string to return. This Unicode string is the name of the controller specified by ControllerHandle and ChildHandle in the language specified by diff --git a/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c b/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c index 4efee5b05b..73038c453a 100644 --- a/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c +++ b/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c @@ -14,27 +14,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include - - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - #include "ScsiBus.h" + EFI_DRIVER_BINDING_PROTOCOL gSCSIBusDriverBinding = { SCSIBusDriverBindingSupported, SCSIBusDriverBindingStart, @@ -52,37 +34,59 @@ EFI_DRIVER_BINDING_PROTOCOL gSCSIBusDriverBinding = { // EFI_GUID mScsiBusProtocolGuid = EFI_SCSI_BUS_PROTOCOL_GUID; -VOID *WorkingBuffer; +VOID *mWorkingBuffer; + +/** + Convert EFI_SCSI_IO_SCSI_REQUEST_PACKET packet to EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET packet. + @param Packet The pointer of EFI_SCSI_IO_SCSI_REQUEST_PACKET + @param CommandPacket The pointer of EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET + +**/ EFI_STATUS EFIAPI ScsiioToPassThruPacket ( IN EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet, - IN OUT EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *CommandPacket + OUT EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *CommandPacket ); +/** + Convert EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET packet to EFI_SCSI_IO_SCSI_REQUEST_PACKET packet. + + @param ScsiPacket The pointer of EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET + @param Packet The pointer of EFI_SCSI_IO_SCSI_REQUEST_PACKET +**/ EFI_STATUS EFIAPI PassThruToScsiioPacket ( IN EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *ScsiPacket, - IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet + OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet ); + +/** + Notify Function in which convert EFI1.0 PassThru Packet back to UEF2.0 + SCSI IO Packet. + + @param Event The instance of EFI_EVENT. + @param Context The parameter passed in. + +**/ VOID EFIAPI NotifyFunction ( - EFI_EVENT Event, - VOID *Context + IN EFI_EVENT Event, + IN VOID *Context ); /** The user Entry Point for module ScsiBus. The user code starts with this function. - @param[in] ImageHandle The firmware allocated handle for the EFI image. - @param[in] SystemTable A pointer to the EFI System Table. + @param ImageHandle The firmware allocated handle for the EFI image. + @param SystemTable A pointer to the EFI System Table. - @retval EFI_SUCCESS The entry point is executed successfully. - @retval other Some error occurs when executing this entry point. + @retval EFI_SUCCESS The entry point is executed successfully. + @retval other Some error occurs when executing this entry point. **/ EFI_STATUS @@ -110,6 +114,26 @@ InitializeScsiBus( return Status; } + +/** + Test to see if this driver supports ControllerHandle. + + This service is called by the EFI boot service ConnectController(). In order + to make drivers as small as possible, there are a few calling restrictions for + this service. ConnectController() must follow these calling restrictions. If + any other agent wishes to call Supported() it must also follow these calling + restrictions. + + @param This Protocol instance pointer. + @param ControllerHandle Handle of device to test + @param RemainingDevicePath Optional parameter use to pick a specific child + device to start. + + @retval EFI_SUCCESS This driver supports this device + @retval EFI_ALREADY_STARTED This driver is already running on this device + @retval other This driver does not support this device + +**/ EFI_STATUS EFIAPI SCSIBusDriverBindingSupported ( @@ -117,26 +141,6 @@ SCSIBusDriverBindingSupported ( IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ) -/*++ - -Routine Description: - - Test to see if this driver supports ControllerHandle. Any ControllerHandle - that has ExtScsiPassThruProtocol/ScsiPassThruProtocol installed will be supported. - -Arguments: - - This - Protocol instance pointer. - Controller - Handle of device to test - RemainingDevicePath - Not used - -Returns: - - EFI_SUCCESS - This driver supports this device. - EFI_UNSUPPORTED - This driver does not support this device. - ---*/ - { EFI_STATUS Status; EFI_SCSI_PASS_THRU_PROTOCOL *PassThru; @@ -194,6 +198,26 @@ Returns: return EFI_SUCCESS; } + +/** + Start this driver on ControllerHandle. + + This service is called by the EFI boot service ConnectController(). In order + to make drivers as small as possible, there are a few calling restrictions for + this service. ConnectController() must follow these calling restrictions. If + any other agent wishes to call Start() it must also follow these calling + restrictions. + + @param This Protocol instance pointer. + @param ControllerHandle Handle of device to bind driver to + @param RemainingDevicePath Optional parameter use to pick a specific child + device to start. + + @retval EFI_SUCCESS This driver is added to ControllerHandle + @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle + @retval other This driver does not support this device + +**/ EFI_STATUS EFIAPI SCSIBusDriverBindingStart ( @@ -201,22 +225,6 @@ SCSIBusDriverBindingStart ( IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ) -/*++ - -Routine Description: - Starting the SCSI Bus Driver - -Arguments: - This - Protocol instance pointer. - Controller - Handle of device to test - RemainingDevicePath - Not used - -Returns: - EFI_SUCCESS - This driver supports this device. - EFI_UNSUPPORTED - This driver does not support this device. - EFI_DEVICE_ERROR - This driver cannot be started due to device Error - ---*/ { UINT64 Lun; UINT8 *TargetId; @@ -239,7 +247,7 @@ Returns: FromFirstTarget = FALSE; ExtScsiSupport = FALSE; PassThruStatus = EFI_SUCCESS; - + ScsiTargetId = AllocateZeroPool(sizeof(SCSI_TARGET_ID)); if (ScsiTargetId == NULL) { return EFI_OUT_OF_RESOURCES; @@ -419,7 +427,7 @@ Returns: // Status = ScsiScanCreateDevice (This, Controller, ScsiTargetId, Lun, ScsiBusDev); } - gBS->FreePool (ScsiTargetId); + FreePool (ScsiTargetId); return EFI_SUCCESS; ErrorExit: @@ -454,6 +462,25 @@ ErrorExit: return Status; } +/** + Stop this driver on ControllerHandle. + + This service is called by the EFI boot service DisconnectController(). + In order to make drivers as small as possible, there are a few calling + restrictions for this service. DisconnectController() must follow these + calling restrictions. If any other agent wishes to call Stop() it must also + follow these calling restrictions. + + @param This Protocol instance pointer. + @param ControllerHandle Handle of device to stop driver on + @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of + children is zero stop the entire bus driver. + @param ChildHandleBuffer List of Child Handles to Stop. + + @retval EFI_SUCCESS This driver is removed ControllerHandle + @retval other This driver was not removed from this device + +**/ EFI_STATUS EFIAPI SCSIBusDriverBindingStop ( @@ -462,25 +489,6 @@ SCSIBusDriverBindingStop ( IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer ) -/*++ - -Routine Description: - - Stop this driver on ControllerHandle. Support stoping any child handles - created by this driver. - -Arguments: - - This - Protocol instance pointer. - Controller - Handle of device to stop driver on - NumberOfChildren - Number of Children in the ChildHandleBuffer - ChildHandleBuffer - List of handles for the children we need to stop. - -Returns: - - EFI_SUCCESS - Others ---*/ { EFI_STATUS Status; BOOLEAN AllChildrenStopped; @@ -627,30 +635,24 @@ Returns: return EFI_SUCCESS; } + +/** + Retrieves the device type information of the SCSI Controller. + + @param This Protocol instance pointer. + @param DeviceType A pointer to the device type information retrieved from + the SCSI Controller. + + @retval EFI_SUCCESS Retrieves the device type information successfully. + @retval EFI_INVALID_PARAMETER The DeviceType is NULL. + +**/ EFI_STATUS EFIAPI ScsiGetDeviceType ( IN EFI_SCSI_IO_PROTOCOL *This, OUT UINT8 *DeviceType ) -/*++ - -Routine Description: - - Retrieves the device type information of the SCSI Controller. - -Arguments: - - This - Protocol instance pointer. - DeviceType - A pointer to the device type information - retrieved from the SCSI Controller. - -Returns: - - EFI_SUCCESS - Retrieves the device type information successfully. - EFI_INVALID_PARAMETER - The DeviceType is NULL. - ---*/ { SCSI_IO_DEV *ScsiIoDevice; @@ -663,6 +665,20 @@ Returns: return EFI_SUCCESS; } + +/** + Retrieves the device location in the SCSI channel. + + @param This Protocol instance pointer. + @param Target A pointer to the Target ID of a SCSI device + on the SCSI channel. + @param Lun A pointer to the LUN of the SCSI device on + the SCSI channel. + + @retval EFI_SUCCESS Retrieves the device location successfully. + @retval EFI_INVALID_PARAMETER The Target or Lun is NULL. + +**/ EFI_STATUS EFIAPI ScsiGetDeviceLocation ( @@ -670,26 +686,6 @@ ScsiGetDeviceLocation ( IN OUT UINT8 **Target, OUT UINT64 *Lun ) -/*++ - -Routine Description: - - Retrieves the device location in the SCSI channel. - -Arguments: - - This - Protocol instance pointer. - Target - A pointer to the Target Array which represents ID of a SCSI device - on the SCSI channel. - Lun - A pointer to the LUN of the SCSI device on - the SCSI channel. - -Returns: - - EFI_SUCCESS - Retrieves the device location successfully. - EFI_INVALID_PARAMETER - The Target or Lun is NULL. - ---*/ { SCSI_IO_DEV *ScsiIoDevice; @@ -706,30 +702,23 @@ Returns: return EFI_SUCCESS; } +/** + Resets the SCSI Bus that the SCSI Controller is attached to. + + @param This Protocol instance pointer. + + @retval EFI_SUCCESS The SCSI bus is reset successfully. + @retval EFI_DEVICE_ERROR Errors encountered when resetting the SCSI bus. + @retval EFI_UNSUPPORTED The bus reset operation is not supported by the + SCSI Host Controller. + @retval EFI_TIMEOUT A timeout occurred while attempting to reset + the SCSI bus. +**/ EFI_STATUS EFIAPI ScsiResetBus ( IN EFI_SCSI_IO_PROTOCOL *This ) -/*++ - -Routine Description: - - Resets the SCSI Bus that the SCSI Controller is attached to. - -Arguments: - - This - Protocol instance pointer. - -Returns: - - EFI_SUCCESS - The SCSI bus is reset successfully. - EFI_DEVICE_ERROR - Errors encountered when resetting the SCSI bus. - EFI_UNSUPPORTED - The bus reset operation is not supported by the - SCSI Host Controller. - EFI_TIMEOUT - A timeout occurred while attempting to reset - the SCSI bus. ---*/ { SCSI_IO_DEV *ScsiIoDevice; @@ -742,31 +731,23 @@ Returns: } } + +/** + Resets the SCSI Controller that the device handle specifies. + + @param This Protocol instance pointer. + + @retval EFI_SUCCESS Reset the SCSI controller successfully. + @retval EFI_DEVICE_ERROR Errors are encountered when resetting the SCSI Controller. + @retval EFI_UNSUPPORTED The SCSI bus does not support a device reset operation. + @retval EFI_TIMEOUT A timeout occurred while attempting to reset the + SCSI Controller. +**/ EFI_STATUS EFIAPI ScsiResetDevice ( IN EFI_SCSI_IO_PROTOCOL *This ) -/*++ - -Routine Description: - - Resets the SCSI Controller that the device handle specifies. - -Arguments: - - This - Protocol instance pointer. - -Returns: - - EFI_SUCCESS - Reset the SCSI controller successfully. - EFI_DEVICE_ERROR - Errors are encountered when resetting the - SCSI Controller. - EFI_UNSUPPORTED - The SCSI bus does not support a device - reset operation. - EFI_TIMEOUT - A timeout occurred while attempting to - reset the SCSI Controller. ---*/ { SCSI_IO_DEV *ScsiIoDevice; UINT8 Target[TARGET_MAX_BYTES]; @@ -790,25 +771,14 @@ Returns: } } -EFI_STATUS -EFIAPI -ScsiExecuteSCSICommand ( - IN EFI_SCSI_IO_PROTOCOL *This, - IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet, - IN EFI_EVENT Event OPTIONAL - ) -/*++ - -Routine Description: +/** Sends a SCSI Request Packet to the SCSI Controller for execution. - -Arguments: - This - Protocol instance pointer. - Packet - The SCSI request packet to send to the SCSI + @param This Protocol instance pointer. + @param CommandPacket The SCSI request packet to send to the SCSI Controller specified by the device handle. - Event - If the SCSI bus where the SCSI device is attached + @param Event If the SCSI bus where the SCSI device is attached does not support non-blocking I/O, then Event is ignored, and blocking I/O is performed. If Event is NULL, then blocking I/O is performed. @@ -816,40 +786,46 @@ Arguments: supported, then non-blocking I/O is performed, and Event will be signaled when the SCSI Request Packet completes. -Returns: - - EFI_SUCCESS - The SCSI Request Packet was sent by the host - successfully, and TransferLength bytes were - transferred to/from DataBuffer.See - HostAdapterStatus, TargetStatus, - SenseDataLength, and SenseData in that order - for additional status information. - EFI_BAD_BUFFER_SIZE - The SCSI Request Packet was executed, - but the entire DataBuffer could not be transferred. - The actual number of bytes transferred is returned - in TransferLength. See HostAdapterStatus, - TargetStatus, SenseDataLength, and SenseData in - that order for additional status information. - EFI_NOT_READY - The SCSI Request Packet could not be sent because - there are too many SCSI Command Packets already - queued.The caller may retry again later. - EFI_DEVICE_ERROR - A device error occurred while attempting to send - the SCSI Request Packet. See HostAdapterStatus, - TargetStatus, SenseDataLength, and SenseData in - that order for additional status information. - EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid. - The SCSI Request Packet was not sent, so no - additional status information is available. - EFI_UNSUPPORTED - The command described by the SCSI Request Packet - is not supported by the SCSI initiator(i.e., SCSI - Host Controller). The SCSI Request Packet was not - sent, so no additional status information is - available. - EFI_TIMEOUT - A timeout occurred while waiting for the SCSI - Request Packet to execute. See HostAdapterStatus, - TargetStatus, SenseDataLength, and SenseData in - that order for additional status information. ---*/ + + @retval EFI_SUCCESS The SCSI Request Packet was sent by the host + successfully, and TransferLength bytes were + transferred to/from DataBuffer.See + HostAdapterStatus, TargetStatus, + SenseDataLength, and SenseData in that order + for additional status information. + @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed, + but the entire DataBuffer could not be transferred. + The actual number of bytes transferred is returned + in TransferLength. See HostAdapterStatus, + TargetStatus, SenseDataLength, and SenseData in + that order for additional status information. + @retval EFI_NOT_READY The SCSI Request Packet could not be sent because + there are too many SCSI Command Packets already + queued.The caller may retry again later. + @retval EFI_DEVICE_ERROR A device error occurred while attempting to send + the SCSI Request Packet. See HostAdapterStatus, + TargetStatus, SenseDataLength, and SenseData in + that order for additional status information. + @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid. + The SCSI Request Packet was not sent, so no + additional status information is available. + @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet + is not supported by the SCSI initiator(i.e., SCSI + Host Controller). The SCSI Request Packet was not + sent, so no additional status information is + available. + @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI + Request Packet to execute. See HostAdapterStatus, + TargetStatus, SenseDataLength, and SenseData in + that order for additional status information. +**/ +EFI_STATUS +EFIAPI +ScsiExecuteSCSICommand ( + IN EFI_SCSI_IO_PROTOCOL *This, + IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet, + IN EFI_EVENT Event OPTIONAL + ) { SCSI_IO_DEV *ScsiIoDevice; EFI_STATUS Status; @@ -881,7 +857,7 @@ Returns: Status = gBS->AllocatePool ( EfiBootServicesData, sizeof(EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET), - (VOID**)&WorkingBuffer + (VOID**)&mWorkingBuffer ); if (EFI_ERROR (Status)) { @@ -891,9 +867,9 @@ Returns: // // Convert package into EFI1.0, EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET. // - Status = ScsiioToPassThruPacket(Packet, (EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET*)WorkingBuffer); + Status = ScsiioToPassThruPacket(Packet, (EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET*)mWorkingBuffer); if (EFI_ERROR(Status)) { - gBS->FreePool(WorkingBuffer); + FreePool(mWorkingBuffer); return Status; } @@ -911,7 +887,7 @@ Returns: &PacketEvent ); if (EFI_ERROR(Status)) { - gBS->FreePool(WorkingBuffer); + FreePool(mWorkingBuffer); return Status; } @@ -919,12 +895,12 @@ Returns: ScsiIoDevice->ScsiPassThru, ScsiIoDevice->Pun.ScsiId.Scsi, ScsiIoDevice->Lun, - WorkingBuffer, + mWorkingBuffer, PacketEvent ); if (EFI_ERROR(Status)) { - gBS->FreePool(WorkingBuffer); + gBS->FreePool(mWorkingBuffer); gBS->CloseEvent(PacketEvent); return Status; } @@ -938,70 +914,59 @@ Returns: ScsiIoDevice->ScsiPassThru, ScsiIoDevice->Pun.ScsiId.Scsi, ScsiIoDevice->Lun, - WorkingBuffer, + mWorkingBuffer, Event ); if (EFI_ERROR(Status)) { - gBS->FreePool(WorkingBuffer); + FreePool(mWorkingBuffer); return Status; } - PassThruToScsiioPacket((EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET*)WorkingBuffer,Packet); + PassThruToScsiioPacket((EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET*)mWorkingBuffer,Packet); // // After converting EFI1.0 PassThru Packet back to UEFI2.0 SCSI IO Packet, - // free WorkingBuffer. + // free mWorkingBuffer. // - gBS->FreePool(WorkingBuffer); + FreePool(mWorkingBuffer); } } return Status; } -EFI_STATUS -EFIAPI -ScsiScanCreateDevice ( - EFI_DRIVER_BINDING_PROTOCOL *This, - EFI_HANDLE Controller, - SCSI_TARGET_ID *TargetId, - UINT64 Lun, - SCSI_BUS_DEVICE *ScsiBusDev - ) -/*++ - -Routine Description: +/** Scan SCSI Bus to discover the device, and attach ScsiIoProtocol to it. -Arguments: + @param This Protocol instance pointer + @param Controller Controller handle + @param TargetId Tartget to be scanned + @param Lun The Lun of the SCSI device on the SCSI channel. + @param ScsiBusDev The pointer of SCSI_BUS_DEVICE - This - Protocol instance pointer - Controller - Controller handle - Pun - The Pun of the SCSI device on the SCSI channel. - Lun - The Lun of the SCSI device on the SCSI channel. - ScsiBusDev - The pointer of SCSI_BUS_DEVICE + @retval EFI_SUCCESS Successfully to discover the device and attach + ScsiIoProtocol to it. + @retval EFI_OUT_OF_RESOURCES Fail to discover the device. -Returns: - - EFI_SUCCESS - Successfully to discover the device and attach ScsiIoProtocol to it. - EFI_OUT_OF_RESOURCES - Fail to discover the device. - ---*/ +**/ +EFI_STATUS +EFIAPI +ScsiScanCreateDevice ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN SCSI_TARGET_ID *TargetId, + IN UINT64 Lun, + IN OUT SCSI_BUS_DEVICE *ScsiBusDev + ) { EFI_STATUS Status; SCSI_IO_DEV *ScsiIoDevice; EFI_DEVICE_PATH_PROTOCOL *ScsiDevicePath; - Status = gBS->AllocatePool ( - EfiBootServicesData, - sizeof (SCSI_IO_DEV), - (VOID **) &ScsiIoDevice - ); - if (EFI_ERROR (Status)) { - return Status; + ScsiIoDevice = AllocateZeroPool (sizeof (SCSI_IO_DEV)); + if (ScsiIoDevice == NULL) { + return EFI_OUT_OF_RESOURCES; } - ZeroMem (ScsiIoDevice, sizeof (SCSI_IO_DEV)); - ScsiIoDevice->Signature = SCSI_IO_DEV_SIGNATURE; CopyMem(&ScsiIoDevice->Pun, TargetId, TARGET_MAX_BYTES); ScsiIoDevice->Lun = Lun; @@ -1025,7 +990,7 @@ Returns: if (!DiscoverScsiDevice (ScsiIoDevice)) { - gBS->FreePool (ScsiIoDevice); + FreePool (ScsiIoDevice); return EFI_OUT_OF_RESOURCES; } @@ -1040,7 +1005,7 @@ Returns: &ScsiDevicePath ); if (Status == EFI_OUT_OF_RESOURCES) { - gBS->FreePool (ScsiIoDevice); + FreePool (ScsiIoDevice); return Status; } } else { @@ -1051,7 +1016,7 @@ Returns: &ScsiDevicePath ); if (Status == EFI_OUT_OF_RESOURCES) { - gBS->FreePool (ScsiIoDevice); + FreePool (ScsiIoDevice); return Status; } } @@ -1107,27 +1072,20 @@ Returns: return EFI_SUCCESS; } -BOOLEAN -EFIAPI -DiscoverScsiDevice ( - SCSI_IO_DEV *ScsiIoDevice - ) -/*++ - -Routine Description: +/** Discovery SCSI Device -Arguments: - - ScsiIoDevice - The pointer of SCSI_IO_DEV - -Returns: + @param ScsiIoDevice The pointer of SCSI_IO_DEV - TRUE - Find SCSI Device and verify it. - FALSE - Unable to find SCSI Device. + @retval TRUE Find SCSI Device and verify it. + @retval FALSE Unable to find SCSI Device. ---*/ +**/ +BOOLEAN +DiscoverScsiDevice ( + IN OUT SCSI_IO_DEV *ScsiIoDevice + ) { EFI_STATUS Status; UINT32 InquiryDataLength; @@ -1157,9 +1115,6 @@ Returns: FALSE ); if (EFI_ERROR (Status)) { - // - // ParseSenseData (&SenseData,SenseDataLength); - // return FALSE; } // @@ -1198,29 +1153,19 @@ Returns: } +/** + Convert EFI_SCSI_IO_SCSI_REQUEST_PACKET packet to EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET packet. + + @param Packet The pointer of EFI_SCSI_IO_SCSI_REQUEST_PACKET + @param CommandPacket The pointer of EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET + +**/ EFI_STATUS EFIAPI ScsiioToPassThruPacket ( IN EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet, - IN OUT EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *CommandPacket + OUT EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *CommandPacket ) -/*++ - -Routine Description: - - Convert EFI_SCSI_IO_SCSI_REQUEST_PACKET packet to - EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET packet - -Arguments: - - Packet - The pointer of EFI_SCSI_IO_SCSI_REQUEST_PACKET - CommandPacket - The pointer of EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET - -Returns: - - NONE - ---*/ { // //EFI 1.10 doesn't support Bi-Direction Command. @@ -1251,29 +1196,19 @@ Returns: } +/** + Convert EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET packet to EFI_SCSI_IO_SCSI_REQUEST_PACKET packet. + + @param ScsiPacket The pointer of EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET + @param Packet The pointer of EFI_SCSI_IO_SCSI_REQUEST_PACKET + +**/ EFI_STATUS EFIAPI PassThruToScsiioPacket ( IN EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *ScsiPacket, - IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet + OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet ) -/*++ - -Routine Description: - - Convert EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET packet to - EFI_SCSI_IO_SCSI_REQUEST_PACKET packet - -Arguments: - - ScsiPacket - The pointer of EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET - Packet - The pointer of EFI_SCSI_IO_SCSI_REQUEST_PACKET - -Returns: - - NONE - ---*/ { Packet->Timeout = ScsiPacket->Timeout; Packet->Cdb = ScsiPacket->Cdb; @@ -1295,31 +1230,20 @@ Returns: return EFI_SUCCESS; } +/** + Notify Function in which convert EFI1.0 PassThru Packet back to UEF2.0 + SCSI IO Packet. + @param Event The instance of EFI_EVENT. + @param Context The parameter passed in. +**/ VOID EFIAPI NotifyFunction ( - EFI_EVENT Event, - VOID *Context + IN EFI_EVENT Event, + IN VOID *Context ) -/*++ - -Routine Description: - - Notify Function in which convert EFI1.0 PassThru Packet back to UEF2.0 - SCSI IO Packet. - -Arguments: - - Event - The instance of EFI_EVENT. - Context - The parameter passed in. - -Returns: - - NONE - ---*/ { EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet; EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *ScsiPacket; @@ -1328,7 +1252,7 @@ Returns: PassData = (SCSI_EVENT_DATA*)Context; Packet = (EFI_SCSI_IO_SCSI_REQUEST_PACKET *)PassData->Data1; - ScsiPacket = (EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET*)WorkingBuffer; + ScsiPacket = (EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET*)mWorkingBuffer; // // Convert EFI1.0 PassThru packet to UEFI2.0 SCSI IO Packet. @@ -1337,9 +1261,9 @@ Returns: // // After converting EFI1.0 PassThru Packet back to UEFI2.0 SCSI IO Packet, - // free WorkingBuffer. + // free mWorkingBuffer. // - gBS->FreePool(WorkingBuffer); + gBS->FreePool(mWorkingBuffer); // // Signal Event to tell caller to pick up UEFI2.0 SCSI IO Packet. @@ -1348,3 +1272,4 @@ Returns: gBS->CloseEvent(Event); gBS->SignalEvent(CallerEvent); } + diff --git a/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.h b/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.h index 62835cffc3..1d70b2cded 100644 --- a/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.h +++ b/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.h @@ -12,10 +12,28 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#ifndef _SCSI_BUS_H -#define _SCSI_BUS_H +#ifndef _SCSI_BUS_H_ +#define _SCSI_BUS_H_ +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + #include // // 1000 * 1000 * 10 @@ -89,6 +107,25 @@ extern EFI_DRIVER_BINDING_PROTOCOL gScsiBusDriverBinding; extern EFI_COMPONENT_NAME_PROTOCOL gScsiBusComponentName; extern EFI_COMPONENT_NAME2_PROTOCOL gScsiBusComponentName2; +/** + Test to see if this driver supports ControllerHandle. + + This service is called by the EFI boot service ConnectController(). In order + to make drivers as small as possible, there are a few calling restrictions for + this service. ConnectController() must follow these calling restrictions. If + any other agent wishes to call Supported() it must also follow these calling + restrictions. + + @param This Protocol instance pointer. + @param ControllerHandle Handle of device to test + @param RemainingDevicePath Optional parameter use to pick a specific child + device to start. + + @retval EFI_SUCCESS This driver supports this device + @retval EFI_ALREADY_STARTED This driver is already running on this device + @retval other This driver does not support this device + +**/ EFI_STATUS EFIAPI SCSIBusDriverBindingSupported ( @@ -97,6 +134,25 @@ SCSIBusDriverBindingSupported ( IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ); +/** + Start this driver on ControllerHandle. + + This service is called by the EFI boot service ConnectController(). In order + to make drivers as small as possible, there are a few calling restrictions for + this service. ConnectController() must follow these calling restrictions. If + any other agent wishes to call Start() it must also follow these calling + restrictions. + + @param This Protocol instance pointer. + @param ControllerHandle Handle of device to bind driver to + @param RemainingDevicePath Optional parameter use to pick a specific child + device to start. + + @retval EFI_SUCCESS This driver is added to ControllerHandle + @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle + @retval other This driver does not support this device + +**/ EFI_STATUS EFIAPI SCSIBusDriverBindingStart ( @@ -105,6 +161,25 @@ SCSIBusDriverBindingStart ( IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ); +/** + Stop this driver on ControllerHandle. + + This service is called by the EFI boot service DisconnectController(). + In order to make drivers as small as possible, there are a few calling + restrictions for this service. DisconnectController() must follow these + calling restrictions. If any other agent wishes to call Stop() it must also + follow these calling restrictions. + + @param This Protocol instance pointer. + @param ControllerHandle Handle of device to stop driver on + @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of + children is zero stop the entire bus driver. + @param ChildHandleBuffer List of Child Handles to Stop. + + @retval EFI_SUCCESS This driver is removed ControllerHandle + @retval other This driver was not removed from this device + +**/ EFI_STATUS EFIAPI SCSIBusDriverBindingStop ( @@ -127,10 +202,10 @@ SCSIBusDriverBindingStop ( by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. - @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or + @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or EFI_COMPONENT_NAME_PROTOCOL instance. - @param Language[in] A pointer to a Null-terminated ASCII string + @param Language A pointer to a Null-terminated ASCII string array indicating the language. This is the language of the driver name that the caller is requesting, and it must match one of the @@ -139,7 +214,7 @@ SCSIBusDriverBindingStop ( to the driver writer. Language is specified in RFC 3066 or ISO 639-2 language code format. - @param DriverName[out] A pointer to the Unicode string to return. + @param DriverName A pointer to the Unicode string to return. This Unicode string is the name of the driver specified by This in the language specified by Language. @@ -164,7 +239,6 @@ ScsiBusComponentNameGetDriverName ( OUT CHAR16 **DriverName ); - /** Retrieves a Unicode string that is the user readable name of the controller that is being managed by a driver. @@ -178,15 +252,15 @@ ScsiBusComponentNameGetDriverName ( then EFI_UNSUPPORTED is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. - @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or + @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or EFI_COMPONENT_NAME_PROTOCOL instance. - @param ControllerHandle[in] The handle of a controller that the driver + @param ControllerHandle The handle of a controller that the driver specified by This is managing. This handle specifies the controller whose name is to be returned. - @param ChildHandle[in] The handle of the child controller to retrieve + @param ChildHandle The handle of the child controller to retrieve the name of. This is an optional parameter that may be NULL. It will be NULL for device drivers. It will also be NULL for a bus drivers @@ -195,7 +269,7 @@ ScsiBusComponentNameGetDriverName ( driver that wishes to retrieve the name of a child controller. - @param Language[in] A pointer to a Null-terminated ASCII string + @param Language A pointer to a Null-terminated ASCII string array indicating the language. This is the language of the driver name that the caller is requesting, and it must match one of the @@ -204,7 +278,7 @@ ScsiBusComponentNameGetDriverName ( to the driver writer. Language is specified in RFC 3066 or ISO 639-2 language code format. - @param ControllerName[out] A pointer to the Unicode string to return. + @param ControllerName A pointer to the Unicode string to return. This Unicode string is the name of the controller specified by ControllerHandle and ChildHandle in the language specified by @@ -243,107 +317,87 @@ ScsiBusComponentNameGetControllerName ( OUT CHAR16 **ControllerName ); +/** + Retrieves the device type information of the SCSI Controller. + @param This Protocol instance pointer. + @param DeviceType A pointer to the device type information retrieved from + the SCSI Controller. + + @retval EFI_SUCCESS Retrieves the device type information successfully. + @retval EFI_INVALID_PARAMETER The DeviceType is NULL. + +**/ EFI_STATUS EFIAPI ScsiGetDeviceType ( IN EFI_SCSI_IO_PROTOCOL *This, OUT UINT8 *DeviceType - ) -/*++ - -Routine Description: - - Retrieves the device type information of the SCSI Controller. - -Arguments: - - This - Protocol instance pointer. - DeviceType - A pointer to the device type information - retrieved from the SCSI Controller. + ); -Returns: +/** + Retrieves the device location in the SCSI channel. - EFI_SUCCESS - Retrieves the device type information successfully. - EFI_INVALID_PARAMETER - The DeviceType is NULL. + @param This Protocol instance pointer. + @param Target A pointer to the Target ID of a SCSI device + on the SCSI channel. + @param Lun A pointer to the LUN of the SCSI device on + the SCSI channel. ---*/ -; + @retval EFI_SUCCESS Retrieves the device location successfully. + @retval EFI_INVALID_PARAMETER The Target or Lun is NULL. +**/ EFI_STATUS EFIAPI -ScsiResetBus ( - IN EFI_SCSI_IO_PROTOCOL *This - ) -/*++ - -Routine Description: +ScsiGetDeviceLocation ( + IN EFI_SCSI_IO_PROTOCOL *This, + IN OUT UINT8 **Target, + OUT UINT64 *Lun + ); +/** Resets the SCSI Bus that the SCSI Controller is attached to. - -Arguments: - - This - Protocol instance pointer. -Returns: - - EFI_SUCCESS - The SCSI bus is reset successfully. - EFI_DEVICE_ERROR - Errors encountered when resetting the SCSI bus. - EFI_UNSUPPORTED - The bus reset operation is not supported by the - SCSI Host Controller. - EFI_TIMEOUT - A timeout occurred while attempting to reset - the SCSI bus. - ---*/ -; + @param This Protocol instance pointer. + @retval EFI_SUCCESS The SCSI bus is reset successfully. + @retval EFI_DEVICE_ERROR Errors encountered when resetting the SCSI bus. + @retval EFI_UNSUPPORTED The bus reset operation is not supported by the + SCSI Host Controller. + @retval EFI_TIMEOUT A timeout occurred while attempting to reset + the SCSI bus. +**/ EFI_STATUS EFIAPI -ScsiResetDevice ( +ScsiResetBus ( IN EFI_SCSI_IO_PROTOCOL *This - ) -/*++ - -Routine Description: + ); +/** Resets the SCSI Controller that the device handle specifies. - -Arguments: - - This - Protocol instance pointer. - -Returns: - - EFI_SUCCESS - Reset the SCSI controller successfully. - EFI_DEVICE_ERROR - Errors are encountered when resetting the - SCSI Controller. - EFI_UNSUPPORTED - The SCSI bus does not support a device - reset operation. - EFI_TIMEOUT - A timeout occurred while attempting to - reset the SCSI Controller. ---*/ -; + @param This Protocol instance pointer. + @retval EFI_SUCCESS Reset the SCSI controller successfully. + @retval EFI_DEVICE_ERROR Errors are encountered when resetting the SCSI Controller. + @retval EFI_UNSUPPORTED The SCSI bus does not support a device reset operation. + @retval EFI_TIMEOUT A timeout occurred while attempting to reset the + SCSI Controller. +**/ EFI_STATUS EFIAPI -ScsiExecuteSCSICommand ( - IN EFI_SCSI_IO_PROTOCOL *This, - IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *CommandPacket, - IN EFI_EVENT Event - ) -/*++ - -Routine Description: +ScsiResetDevice ( + IN EFI_SCSI_IO_PROTOCOL *This + ); +/** Sends a SCSI Request Packet to the SCSI Controller for execution. - -Arguments: - This - Protocol instance pointer. - Packet - The SCSI request packet to send to the SCSI + @param This Protocol instance pointer. + @param CommandPacket The SCSI request packet to send to the SCSI Controller specified by the device handle. - Event - If the SCSI bus where the SCSI device is attached + @param Event If the SCSI bus where the SCSI device is attached does not support non-blocking I/O, then Event is ignored, and blocking I/O is performed. If Event is NULL, then blocking I/O is performed. @@ -351,92 +405,83 @@ Arguments: supported, then non-blocking I/O is performed, and Event will be signaled when the SCSI Request Packet completes. -Returns: - - EFI_SUCCESS - The SCSI Request Packet was sent by the host - successfully, and TransferLength bytes were - transferred to/from DataBuffer.See - HostAdapterStatus, TargetStatus, - SenseDataLength, and SenseData in that order - for additional status information. - EFI_BAD_BUFFER_SIZE - The SCSI Request Packet was executed, - but the entire DataBuffer could not be transferred. - The actual number of bytes transferred is returned - in TransferLength. See HostAdapterStatus, - TargetStatus, SenseDataLength, and SenseData in - that order for additional status information. - EFI_NOT_READY - The SCSI Request Packet could not be sent because - there are too many SCSI Command Packets already - queued.The caller may retry again later. - EFI_DEVICE_ERROR - A device error occurred while attempting to send - the SCSI Request Packet. See HostAdapterStatus, - TargetStatus, SenseDataLength, and SenseData in - that order for additional status information. - EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid. - The SCSI Request Packet was not sent, so no - additional status information is available. - EFI_UNSUPPORTED - The command described by the SCSI Request Packet - is not supported by the SCSI initiator(i.e., SCSI - Host Controller). The SCSI Request Packet was not - sent, so no additional status information is - available. - EFI_TIMEOUT - A timeout occurred while waiting for the SCSI - Request Packet to execute. See HostAdapterStatus, - TargetStatus, SenseDataLength, and SenseData in - that order for additional status information. - ---*/ -; + @retval EFI_SUCCESS The SCSI Request Packet was sent by the host + successfully, and TransferLength bytes were + transferred to/from DataBuffer.See + HostAdapterStatus, TargetStatus, + SenseDataLength, and SenseData in that order + for additional status information. + @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed, + but the entire DataBuffer could not be transferred. + The actual number of bytes transferred is returned + in TransferLength. See HostAdapterStatus, + TargetStatus, SenseDataLength, and SenseData in + that order for additional status information. + @retval EFI_NOT_READY The SCSI Request Packet could not be sent because + there are too many SCSI Command Packets already + queued.The caller may retry again later. + @retval EFI_DEVICE_ERROR A device error occurred while attempting to send + the SCSI Request Packet. See HostAdapterStatus, + TargetStatus, SenseDataLength, and SenseData in + that order for additional status information. + @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid. + The SCSI Request Packet was not sent, so no + additional status information is available. + @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet + is not supported by the SCSI initiator(i.e., SCSI + Host Controller). The SCSI Request Packet was not + sent, so no additional status information is + available. + @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI + Request Packet to execute. See HostAdapterStatus, + TargetStatus, SenseDataLength, and SenseData in + that order for additional status information. +**/ EFI_STATUS -ScsiScanCreateDevice ( - EFI_DRIVER_BINDING_PROTOCOL *This, - EFI_HANDLE Controller, - SCSI_TARGET_ID *TargetId, - UINT64 Lun, - SCSI_BUS_DEVICE *ScsiBusDev - ) -/*++ - -Routine Description: +EFIAPI +ScsiExecuteSCSICommand ( + IN EFI_SCSI_IO_PROTOCOL *This, + IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *CommandPacket, + IN EFI_EVENT Event OPTIONAL + ); +/** Scan SCSI Bus to discover the device, and attach ScsiIoProtocol to it. -Arguments: - - This - Protocol instance pointer - Controller - Controller handle - Pun - The Pun of the SCSI device on the SCSI channel. - Lun - The Lun of the SCSI device on the SCSI channel. - ScsiBusDev - The pointer of SCSI_BUS_DEVICE - -Returns: + @param This Protocol instance pointer + @param Controller Controller handle + @param TargetId Tartget to be scanned + @param Lun The Lun of the SCSI device on the SCSI channel. + @param ScsiBusDev The pointer of SCSI_BUS_DEVICE - EFI_SUCCESS - Successfully to discover the device and attach ScsiIoProtocol to it. - EFI_OUT_OF_RESOURCES - Fail to discover the device. + @retval EFI_SUCCESS Successfully to discover the device and attach + ScsiIoProtocol to it. + @retval EFI_OUT_OF_RESOURCES Fail to discover the device. ---*/ -; - -BOOLEAN -DiscoverScsiDevice ( - SCSI_IO_DEV *ScsiIoDevice - ) -/*++ - -Routine Description: +**/ +EFI_STATUS +EFIAPI +ScsiScanCreateDevice ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN SCSI_TARGET_ID *TargetId, + IN UINT64 Lun, + IN OUT SCSI_BUS_DEVICE *ScsiBusDev + ); +/** Discovery SCSI Device -Arguments: + @param ScsiIoDevice The pointer of SCSI_IO_DEV - ScsiIoDevice - The pointer of SCSI_IO_DEV + @retval TRUE Find SCSI Device and verify it. + @retval FALSE Unable to find SCSI Device. -Returns: - - TRUE - Find SCSI Device and verify it. - FALSE - Unable to find SCSI Device. +**/ +BOOLEAN +DiscoverScsiDevice ( + IN OUT SCSI_IO_DEV *ScsiIoDevice + ); ---*/ -; #endif diff --git a/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf b/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf index 12b9b01244..e0b0155353 100644 --- a/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf +++ b/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf @@ -32,7 +32,8 @@ # VALID_ARCHITECTURES = IA32 X64 IPF EBC # # DRIVER_BINDING = gSCSIBusDriverBinding -# COMPONENT_NAME = gScsiBusComponentName +# COMPONENT_NAME = gScsiBusComponentName +# COMPONENT_NAME2 = gScsiBusComponentName2 # [Sources.common] @@ -62,4 +63,4 @@ gEfiScsiIoProtocolGuid # PROTOCOL BY_START gEfiDevicePathProtocolGuid # PROTOCOL TO_START gEfiScsiPassThruProtocolGuid # PROTOCOL TO_START - gEfiExtScsiPassThruProtocolGuid + gEfiExtScsiPassThruProtocolGuid # PROTOCOL TO_START diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ComponentName.c b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ComponentName.c index eb9c1d487b..3ca2cbb764 100644 --- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ComponentName.c +++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ComponentName.c @@ -13,21 +13,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include - - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - #include "ScsiDisk.h" // @@ -64,10 +49,10 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mScsiDiskDriverNameTable[ by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. - @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or + @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or EFI_COMPONENT_NAME_PROTOCOL instance. - @param Language[in] A pointer to a Null-terminated ASCII string + @param Language A pointer to a Null-terminated ASCII string array indicating the language. This is the language of the driver name that the caller is requesting, and it must match one of the @@ -76,7 +61,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mScsiDiskDriverNameTable[ to the driver writer. Language is specified in RFC 3066 or ISO 639-2 language code format. - @param DriverName[out] A pointer to the Unicode string to return. + @param DriverName A pointer to the Unicode string to return. This Unicode string is the name of the driver specified by This in the language specified by Language. @@ -123,15 +108,15 @@ ScsiDiskComponentNameGetDriverName ( then EFI_UNSUPPORTED is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. - @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or + @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or EFI_COMPONENT_NAME_PROTOCOL instance. - @param ControllerHandle[in] The handle of a controller that the driver + @param ControllerHandle The handle of a controller that the driver specified by This is managing. This handle specifies the controller whose name is to be returned. - @param ChildHandle[in] The handle of the child controller to retrieve + @param ChildHandle The handle of the child controller to retrieve the name of. This is an optional parameter that may be NULL. It will be NULL for device drivers. It will also be NULL for a bus drivers @@ -140,7 +125,7 @@ ScsiDiskComponentNameGetDriverName ( driver that wishes to retrieve the name of a child controller. - @param Language[in] A pointer to a Null-terminated ASCII string + @param Language A pointer to a Null-terminated ASCII string array indicating the language. This is the language of the driver name that the caller is requesting, and it must match one of the @@ -149,7 +134,7 @@ ScsiDiskComponentNameGetDriverName ( to the driver writer. Language is specified in RFC 3066 or ISO 639-2 language code format. - @param ControllerName[out] A pointer to the Unicode string to return. + @param ControllerName A pointer to the Unicode string to return. This Unicode string is the name of the controller specified by ControllerHandle and ChildHandle in the language specified by diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c index 07e2f870c0..9451932cfc 100644 --- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c +++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c @@ -12,24 +12,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include - - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include #include "ScsiDisk.h" + EFI_DRIVER_BINDING_PROTOCOL gScsiDiskDriverBinding = { ScsiDiskDriverBindingSupported, ScsiDiskDriverBindingStart, @@ -40,10 +26,12 @@ EFI_DRIVER_BINDING_PROTOCOL gScsiDiskDriverBinding = { }; /** - The user Entry Point for module ScsiDisk. The user code starts with this function. + The user Entry Point for module ScsiDisk. + + The user code starts with this function. - @param[in] ImageHandle The firmware allocated handle for the EFI image. - @param[in] SystemTable A pointer to the EFI System Table. + @param ImageHandle The firmware allocated handle for the EFI image. + @param SystemTable A pointer to the EFI System Table. @retval EFI_SUCCESS The entry point is executed successfully. @retval other Some error occurs when executing this entry point. @@ -75,33 +63,32 @@ InitializeScsiDisk( return Status; } +/** + Test to see if this driver supports ControllerHandle. + + This service is called by the EFI boot service ConnectController(). In order + to make drivers as small as possible, there are a few calling restrictions for + this service. ConnectController() must follow these calling restrictions. + If any other agent wishes to call Supported() it must also follow these + calling restrictions. + + @param This Protocol instance pointer. + @param ControllerHandle Handle of device to test + @param RemainingDevicePath Optional parameter use to pick a specific child + device to start. + + @retval EFI_SUCCESS This driver supports this device + @retval EFI_ALREADY_STARTED This driver is already running on this device + @retval other This driver does not support this device + +**/ EFI_STATUS EFIAPI ScsiDiskDriverBindingSupported ( IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, - IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL ) -/*++ - -Routine Description: - - Test to see if this driver supports ControllerHandle. Any ControllerHandle - that has ScsiIoProtocol installed will be supported. - -Arguments: - - This - Protocol instance pointer. - Controller - Handle of device to test - RemainingDevicePath - Not used - -Returns: - - EFI_SUCCESS - This driver supports this device. - EFI_UNSUPPORTED - This driver does not support this device. - - ---*/ { EFI_STATUS Status; EFI_SCSI_IO_PROTOCOL *ScsiIo; @@ -137,32 +124,33 @@ Returns: return Status; } + +/** + Start this driver on ControllerHandle. + + This service is called by the EFI boot service ConnectController(). In order + to make drivers as small as possible, there are a few calling restrictions for + this service. ConnectController() must follow these calling restrictions. If + any other agent wishes to call Start() it must also follow these calling + restrictions. + + @param This Protocol instance pointer. + @param ControllerHandle Handle of device to bind driver to + @param RemainingDevicePath Optional parameter use to pick a specific child + device to start. + + @retval EFI_SUCCESS This driver is added to ControllerHandle + @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle + @retval other This driver does not support this device + +**/ EFI_STATUS EFIAPI ScsiDiskDriverBindingStart ( IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, - IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL ) -/*++ - -Routine Description: - - Start SCSI Disk Driver, and attach BlockIoProtocol to it. - -Arguments: - - This - Protocol instance pointer. - Controller - Handle of device to test - RemainingDevicePath - Not used - -Returns: - - EFI_SUCCESS - This driver supports this device. - EFI_UNSUPPORTED - This driver does not support this device. - - ---*/ { EFI_STATUS Status; EFI_SCSI_IO_PROTOCOL *ScsiIo; @@ -309,35 +297,34 @@ Returns: } + +/** + Stop this driver on ControllerHandle. + + This service is called by the EFI boot service DisconnectController(). + In order to make drivers as small as possible, there are a few calling + restrictions for this service. DisconnectController() must follow these + calling restrictions. If any other agent wishes to call Stop() it must + also follow these calling restrictions. + + @param This Protocol instance pointer. + @param ControllerHandle Handle of device to stop driver on + @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of + children is zero stop the entire bus driver. + @param ChildHandleBuffer List of Child Handles to Stop. + + @retval EFI_SUCCESS This driver is removed ControllerHandle + @retval other This driver was not removed from this device + +**/ EFI_STATUS EFIAPI ScsiDiskDriverBindingStop ( IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN UINTN NumberOfChildren, - IN EFI_HANDLE *ChildHandleBuffer + IN EFI_HANDLE *ChildHandleBuffer OPTIONAL ) -/*++ - -Routine Description: - - Stop this driver on ControllerHandle. Support stoping any child handles - created by this driver. - -Arguments: - - This - Protocol instance pointer. - Controller - Handle of device to stop driver on - NumberOfChildren - Number of Children in the ChildHandleBuffer - ChildHandleBuffer - List of handles for the children we need to stop. - -Returns: - - EFI_SUCCESS - EFI_DEVICE_ERROR - others - ---*/ { EFI_BLOCK_IO_PROTOCOL *BlkIo; SCSI_DISK_DEV *ScsiDiskDevice; @@ -379,29 +366,25 @@ Returns: return Status; } +/** + Reset SCSI Disk. + + @param This The pointer of EFI_BLOCK_IO_PROTOCOL + @param ExtendedVerification The flag about if extend verificate + + @retval EFI_SUCCESS The device was reset. + @retval EFI_DEVICE_ERROR The device is not functioning properly and could + not be reset. + @return EFI_STATUS is retured from EFI_SCSI_IO_PROTOCOL.ResetDevice(). + +**/ EFI_STATUS EFIAPI ScsiDiskReset ( IN EFI_BLOCK_IO_PROTOCOL *This, IN BOOLEAN ExtendedVerification ) -/*++ - -Routine Description: - - Reset SCSI Disk - -Arguments: - - This - The pointer of EFI_BLOCK_IO_PROTOCOL - ExtendedVerification - The flag about if extend verificate - -Returns: - - EFI_STATUS - ---*/ { EFI_TPL OldTpl; SCSI_DISK_DEV *ScsiDiskDevice; @@ -424,39 +407,32 @@ Done: return Status; } +/** + The function is to Read Block from SCSI Disk. + + @param This The pointer of EFI_BLOCK_IO_PROTOCOL. + @param MediaId The Id of Media detected + @param Lba The logic block address + @param BufferSize The size of Buffer + @param Buffer The buffer to fill the read out data + + @retval EFI_SUCCESS Successfully to read out block. + @retval EFI_DEVICE_ERROR Fail to detect media. + @retval EFI_NO_MEDIA Media is not present. + @retval EFI_MEDIA_CHANGED Media has changed. + @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device. + @retval EFI_INVALID_PARAMETER Invalid parameter passed in. + +**/ EFI_STATUS EFIAPI ScsiDiskReadBlocks ( IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, - IN EFI_LBA LBA, + IN EFI_LBA Lba, IN UINTN BufferSize, OUT VOID *Buffer ) -/*++ - -Routine Description: - - The function is to Read Block from SCSI Disk - -Arguments: - - This - The pointer of EFI_BLOCK_IO_PROTOCOL - MediaId - The Id of Media detected - LBA - The logic block address - BufferSize - The size of Buffer - Buffer - The buffer to fill the read out data - -Returns: - - EFI_INVALID_PARAMETER - Invalid parameter passed in. - EFI_SUCCESS - Successfully to read out block. - EFI_DEVICE_ERROR - Fail to detect media. - EFI_NO_MEDIA - Media is not present. - EFI_MEDIA_CHANGED - Media has changed. - EFI_BAD_BUFFER_SIZE - The buffer size is not multiple of BlockSize. - ---*/ { SCSI_DISK_DEV *ScsiDiskDevice; EFI_BLOCK_IO_MEDIA *Media; @@ -467,7 +443,7 @@ Returns: EFI_TPL OldTpl; MediaChange = FALSE; - if (!Buffer) { + if (Buffer == NULL) { return EFI_INVALID_PARAMETER; } @@ -479,7 +455,7 @@ Returns: ScsiDiskDevice = SCSI_DISK_DEV_FROM_THIS (This); - if (!IsDeviceFixed (ScsiDiskDevice)) { + if (!IS_DEVICE_FIXED(ScsiDiskDevice)) { Status = ScsiDiskDetectMedia (ScsiDiskDevice, FALSE, &MediaChange); if (EFI_ERROR (Status)) { @@ -519,12 +495,12 @@ Returns: goto Done; } - if (LBA > Media->LastBlock) { + if (Lba > Media->LastBlock) { Status = EFI_INVALID_PARAMETER; goto Done; } - if ((LBA + NumberOfBlocks - 1) > Media->LastBlock) { + if ((Lba + NumberOfBlocks - 1) > Media->LastBlock) { Status = EFI_INVALID_PARAMETER; goto Done; } @@ -538,46 +514,40 @@ Returns: // If all the parameters are valid, then perform read sectors command // to transfer data from device to host. // - Status = ScsiDiskReadSectors (ScsiDiskDevice, Buffer, LBA, NumberOfBlocks); + Status = ScsiDiskReadSectors (ScsiDiskDevice, Buffer, Lba, NumberOfBlocks); Done: gBS->RestoreTPL (OldTpl); return Status; } +/** + The function is to Write Block to SCSI Disk. + + @param This The pointer of EFI_BLOCK_IO_PROTOCOL + @param MediaId The Id of Media detected + @param Lba The logic block address + @param BufferSize The size of Buffer + @param Buffer The buffer to fill the read out data + + @retval EFI_SUCCESS Successfully to read out block. + @retval EFI_WRITE_PROTECTED The device can not be written to. + @retval EFI_DEVICE_ERROR Fail to detect media. + @retval EFI_NO_MEDIA Media is not present. + @retval EFI_MEDIA_CHNAGED Media has changed. + @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device. + @retval EFI_INVALID_PARAMETER Invalid parameter passed in. + +**/ EFI_STATUS EFIAPI ScsiDiskWriteBlocks ( IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, - IN EFI_LBA LBA, + IN EFI_LBA Lba, IN UINTN BufferSize, IN VOID *Buffer ) -/*++ - -Routine Description: - - The function is to Write Block to SCSI Disk - -Arguments: - - This - The pointer of EFI_BLOCK_IO_PROTOCOL - MediaId - The Id of Media detected - LBA - The logic block address - BufferSize - The size of Buffer - Buffer - The buffer to fill the read out data - -Returns: - - EFI_INVALID_PARAMETER - Invalid parameter passed in. - EFI_SUCCESS - Successfully to read out block. - EFI_DEVICE_ERROR - Fail to detect media. - EFI_NO_MEDIA - Media is not present. - EFI_MEDIA_CHANGED - Media has changed. - EFI_BAD_BUFFER_SIZE - The buffer size is not multiple of BlockSize. - ---*/ { SCSI_DISK_DEV *ScsiDiskDevice; EFI_BLOCK_IO_MEDIA *Media; @@ -588,7 +558,7 @@ Returns: EFI_TPL OldTpl; MediaChange = FALSE; - if (!Buffer) { + if (Buffer == NULL) { return EFI_INVALID_PARAMETER; } @@ -600,7 +570,7 @@ Returns: ScsiDiskDevice = SCSI_DISK_DEV_FROM_THIS (This); - if (!IsDeviceFixed (ScsiDiskDevice)) { + if (!IS_DEVICE_FIXED(ScsiDiskDevice)) { Status = ScsiDiskDetectMedia (ScsiDiskDevice, FALSE, &MediaChange); if (EFI_ERROR (Status)) { @@ -640,12 +610,12 @@ Returns: goto Done; } - if (LBA > Media->LastBlock) { + if (Lba > Media->LastBlock) { Status = EFI_INVALID_PARAMETER; goto Done; } - if ((LBA + NumberOfBlocks - 1) > Media->LastBlock) { + if ((Lba + NumberOfBlocks - 1) > Media->LastBlock) { Status = EFI_INVALID_PARAMETER; goto Done; } @@ -658,33 +628,28 @@ Returns: // if all the parameters are valid, then perform read sectors command // to transfer data from device to host. // - Status = ScsiDiskWriteSectors (ScsiDiskDevice, Buffer, LBA, NumberOfBlocks); + Status = ScsiDiskWriteSectors (ScsiDiskDevice, Buffer, Lba, NumberOfBlocks); Done: gBS->RestoreTPL (OldTpl); return Status; } +/** + Flush Block to Disk. + + EFI_SUCCESS is returned directly. + + @param This The pointer of EFI_BLOCK_IO_PROTOCOL + + @retval EFI_SUCCESS All outstanding data was written to the device + +**/ EFI_STATUS EFIAPI ScsiDiskFlushBlocks ( IN EFI_BLOCK_IO_PROTOCOL *This ) -/*++ - -Routine Description: - - Flush Block to Disk - -Arguments: - - This - The pointer of EFI_BLOCK_IO_PROTOCOL - -Returns: - - EFI_SUCCESS - ---*/ { // // return directly @@ -692,30 +657,24 @@ Returns: return EFI_SUCCESS; } -EFI_STATUS -ScsiDiskDetectMedia ( - SCSI_DISK_DEV *ScsiDiskDevice, - BOOLEAN MustReadCapacity, - BOOLEAN *MediaChange - ) -/*++ - -Routine Description: +/** Dectect Device and read out capacity ,if error occurs, parse the sense key. -Arguments: - - ScsiDiskDevice - The pointer of SCSI_DISK_DEV - MustReadCapacity - The flag about reading device capacity - MediaChange - The pointer of flag indicates if media has changed - -Returns: + @param ScsiDiskDevice The pointer of SCSI_DISK_DEV + @param MustReadCapacity The flag about reading device capacity + @param MediaChange The pointer of flag indicates if media has changed - EFI_DEVICE_ERROR - Indicates that error occurs - EFI_SUCCESS - Successfully to detect media + @retval EFI_DEVICE_ERROR Indicates that error occurs + @retval EFI_SUCCESS Successfully to detect media ---*/ +**/ +EFI_STATUS +ScsiDiskDetectMedia ( + IN SCSI_DISK_DEV *ScsiDiskDevice, + IN BOOLEAN MustReadCapacity, + OUT BOOLEAN *MediaChange + ) { EFI_STATUS Status; EFI_STATUS ReadCapacityStatus; @@ -885,28 +844,22 @@ Returns: return EFI_SUCCESS; } -EFI_STATUS -ScsiDiskInquiryDevice ( - SCSI_DISK_DEV *ScsiDiskDevice, - BOOLEAN *NeedRetry - ) -/*++ - -Routine Description: - Send out Inquiry command to Device - -Arguments: - - ScsiDiskDevice - The pointer of SCSI_DISK_DEV - NeedRetry - Indicates if needs try again when error happens +/** + Send out Inquiry command to Device. -Returns: + @param ScsiDiskDevice The pointer of SCSI_DISK_DEV + @param NeedRetry Indicates if needs try again when error happens - EFI_DEVICE_ERROR - Indicates that error occurs - EFI_SUCCESS - Successfully to detect media + @retval EFI_DEVICE_ERROR Indicates that error occurs + @retval EFI_SUCCESS Successfully to detect media ---*/ +**/ +EFI_STATUS +ScsiDiskInquiryDevice ( + IN OUT SCSI_DISK_DEV *ScsiDiskDevice, + OUT BOOLEAN *NeedRetry + ) { UINT32 InquiryDataLength; UINT8 SenseDataLength; @@ -1010,34 +963,29 @@ Returns: return EFI_DEVICE_ERROR; } -EFI_STATUS -ScsiDiskTestUnitReady ( - SCSI_DISK_DEV *ScsiDiskDevice, - BOOLEAN *NeedRetry, - EFI_SCSI_SENSE_DATA **SenseDataArray, - UINTN *NumberOfSenseKeys - ) - /*++ - -Routine Description: +/** + To test deivice. When Test Unit Ready command succeeds, retrieve Sense Keys via Request Sense; When Test Unit Ready command encounters any error caused by host adapter or target, return error without retrieving Sense Keys. - -Arguments: - ScsiDiskDevice - The pointer of SCSI_DISK_DEV - NeedRetry - The pointer of flag indicates try again - SenseDataArray - The pointer of an array of sense data - NumberOfSenseKeys - The pointer of the number of sense data array - -Returns: + @param ScsiDiskDevice The pointer of SCSI_DISK_DEV + @param NeedRetry The pointer of flag indicates try again + @param SenseDataArray The pointer of an array of sense data + @param NumberOfSenseKeys The pointer of the number of sense data array - EFI_DEVICE_ERROR - Indicates that error occurs - EFI_SUCCESS - Successfully to test unit + @retval EFI_DEVICE_ERROR Indicates that error occurs + @retval EFI_SUCCESS Successfully to test unit ---*/ +**/ +EFI_STATUS +ScsiDiskTestUnitReady ( + IN SCSI_DISK_DEV *ScsiDiskDevice, + OUT BOOLEAN *NeedRetry, + OUT EFI_SCSI_SENSE_DATA **SenseDataArray, + OUT UINTN *NumberOfSenseKeys + ) { EFI_STATUS Status; UINT8 SenseDataLength; @@ -1128,32 +1076,25 @@ Returns: return EFI_DEVICE_ERROR; } -EFI_STATUS -DetectMediaParsingSenseKeys ( - SCSI_DISK_DEV *ScsiDiskDevice, - EFI_SCSI_SENSE_DATA *SenseData, - UINTN NumberOfSenseKeys, - UINTN *Action - ) -/*++ - -Routine Description: - +/** Parsing Sense Keys which got from request sense command. - -Arguments: - ScsiDiskDevice - The pointer of SCSI_DISK_DEV - SenseData - The pointer of EFI_SCSI_SENSE_DATA - NumberOfSenseKeys - The number of sense key - Action - The pointer of action which indicates what is need to do next + @param ScsiDiskDevice The pointer of SCSI_DISK_DEV + @param SenseData The pointer of EFI_SCSI_SENSE_DATA + @param NumberOfSenseKeys The number of sense key + @param Action The pointer of action which indicates what is need to do next -Returns: + @retval EFI_DEVICE_ERROR Indicates that error occurs + @retval EFI_SUCCESS Successfully to complete the parsing - EFI_DEVICE_ERROR - Indicates that error occurs - EFI_SUCCESS - Successfully to complete the parsing - ---*/ +**/ +EFI_STATUS +DetectMediaParsingSenseKeys ( + OUT SCSI_DISK_DEV *ScsiDiskDevice, + IN EFI_SCSI_SENSE_DATA *SenseData, + IN UINTN NumberOfSenseKeys, + OUT UINTN *Action + ) { BOOLEAN RetryLater; @@ -1209,32 +1150,26 @@ Returns: return EFI_SUCCESS; } -EFI_STATUS -ScsiDiskReadCapacity ( - SCSI_DISK_DEV *ScsiDiskDevice, - BOOLEAN *NeedRetry, - EFI_SCSI_SENSE_DATA **SenseDataArray, - UINTN *NumberOfSenseKeys - ) -/*++ - -Routine Description: - - Send read capacity command to device and get the device parameter - -Arguments: - ScsiDiskDevice - The pointer of SCSI_DISK_DEV - NeedRetry - The pointer of flag indicates if need a retry - SenseDataArray - The pointer of an array of sense data - NumberOfSenseKeys - The number of sense key +/** + Send read capacity command to device and get the device parameter. -Returns: + @param ScsiDiskDevice The pointer of SCSI_DISK_DEV + @param NeedRetry The pointer of flag indicates if need a retry + @param SenseDataArray The pointer of an array of sense data + @param NumberOfSenseKeys The number of sense key - EFI_DEVICE_ERROR - Indicates that error occurs - EFI_SUCCESS - Successfully to read capacity + @retval EFI_DEVICE_ERROR Indicates that error occurs + @retval EFI_SUCCESS Successfully to read capacity ---*/ +**/ +EFI_STATUS +ScsiDiskReadCapacity ( + IN OUT SCSI_DISK_DEV *ScsiDiskDevice, + OUT BOOLEAN *NeedRetry, + OUT EFI_SCSI_SENSE_DATA **SenseDataArray, + OUT UINTN *NumberOfSenseKeys + ) { EFI_SCSI_DISK_CAPACITY_DATA CapacityData; UINT32 DataLength; @@ -1346,28 +1281,21 @@ Returns: return EFI_DEVICE_ERROR; } -EFI_STATUS -CheckHostAdapterStatus ( - UINT8 HostAdapterStatus - ) -/*++ - -Routine Description: - - Check the HostAdapter status - -Arguments: - - HostAdapterStatus - Host Adapter status +/** + Check the HostAdapter status and re-interpret it in EFI_STATUS. -Returns: + @param HostAdapterStatus Host Adapter status - EFI_SUCCESS - EFI_TIMEOUT - EFI_NOT_READY - EFI_DEVICE_ERROR + @retval EFI_SUCCESS Host adapter is OK. + @retval EFI_TIMEOUT Timeout. + @retval EFI_NOT_READY Adapter NOT ready. + @retval EFI_DEVICE_ERROR Adapter device error. ---*/ +**/ +EFI_STATUS +CheckHostAdapterStatus ( + IN UINT8 HostAdapterStatus + ) { switch (HostAdapterStatus) { case EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OK: @@ -1394,27 +1322,21 @@ Returns: } } -EFI_STATUS -CheckTargetStatus ( - UINT8 TargetStatus - ) -/*++ - -Routine Description: - - Check the target status - -Arguments: - TargetStatus - Target status +/** + Check the target status and re-interpret it in EFI_STATUS. -Returns: + @param TargetStatus Target status - EFI_NOT_READY - EFI_DEVICE_ERROR - EFI_SUCCESS + @retval EFI_NOT_READY Device is NOT ready. + @retval EFI_DEVICE_ERROR + @retval EFI_SUCCESS ---*/ +**/ +EFI_STATUS +CheckTargetStatus ( + IN UINT8 TargetStatus + ) { switch (TargetStatus) { case EFI_EXT_SCSI_STATUS_TARGET_GOOD: @@ -1437,39 +1359,32 @@ Returns: } } -EFI_STATUS -ScsiDiskRequestSenseKeys ( - SCSI_DISK_DEV *ScsiDiskDevice, - BOOLEAN *NeedRetry, - EFI_SCSI_SENSE_DATA **SenseDataArray, - UINTN *NumberOfSenseKeys, - BOOLEAN AskResetIfError - ) -/*++ - -Routine Description: +/** Retrieve all sense keys from the device. - When encountering error during the process, - if retrieve sense keys before error encounterred, - return the sense keys with return status set to EFI_SUCCESS, - and NeedRetry set to FALSE; otherwize, return the proper return - status. - -Arguments: - - ScsiDiskDevice - The pointer of SCSI_DISK_DEV - NeedRetry - The pointer of flag indicates if need a retry - SenseDataArray - The pointer of an array of sense data - NumberOfSenseKeys - The number of sense key - AskResetIfError - The flag indicates if need reset when error occurs - -Returns: - EFI_DEVICE_ERROR - Indicates that error occurs - EFI_SUCCESS - Successfully to request sense key + When encountering error during the process, if retrieve sense keys before + error encounterred, it returns the sense keys with return status set to EFI_SUCCESS, + and NeedRetry set to FALSE; otherwize, return the proper return status. + + @param ScsiDiskDevice The pointer of SCSI_DISK_DEV + @param NeedRetry The pointer of flag indicates if need a retry + @param SenseDataArray The pointer of an array of sense data + @param NumberOfSenseKeys The number of sense key + @param AskResetIfError The flag indicates if need reset when error occurs + + @retval EFI_DEVICE_ERROR Indicates that error occurs + @retval EFI_SUCCESS Successfully to request sense key ---*/ +**/ +EFI_STATUS +ScsiDiskRequestSenseKeys ( + IN OUT SCSI_DISK_DEV *ScsiDiskDevice, + OUT BOOLEAN *NeedRetry, + OUT EFI_SCSI_SENSE_DATA **SenseDataArray, + OUT UINTN *NumberOfSenseKeys, + IN BOOLEAN AskResetIfError + ) { EFI_SCSI_SENSE_DATA *PtrSenseData; UINT8 SenseDataLength; @@ -1543,27 +1458,19 @@ Returns: return EFI_SUCCESS; } -VOID -GetMediaInfo ( - SCSI_DISK_DEV *ScsiDiskDevice, - EFI_SCSI_DISK_CAPACITY_DATA *Capacity - ) -/*++ - -Routine Description: - - Get information from media read capacity command - -Arguments: - - ScsiDiskDevice - The pointer of SCSI_DISK_DEV - Capacity - The pointer of EFI_SCSI_DISK_CAPACITY_DATA -Returns: +/** + Get information from media read capacity command. - NONE + @param ScsiDiskDevice The pointer of SCSI_DISK_DEV + @param Capacity The pointer of EFI_SCSI_DISK_CAPACITY_DATA ---*/ +**/ +VOID +GetMediaInfo ( + IN OUT SCSI_DISK_DEV *ScsiDiskDevice, + IN EFI_SCSI_DISK_CAPACITY_DATA *Capacity + ) { ScsiDiskDevice->BlkIo.Media->LastBlock = (Capacity->LastLba3 << 24) | (Capacity->LastLba2 << 16) | @@ -1584,57 +1491,40 @@ Returns: } } +/** + Parse Inquiry data. + + @param ScsiDiskDevice The pointer of SCSI_DISK_DEV + +**/ VOID ParseInquiryData ( - SCSI_DISK_DEV *ScsiDiskDevice + IN OUT SCSI_DISK_DEV *ScsiDiskDevice ) -/*++ - -Routine Description: - - Parse Inquiry data - -Arguments: - - ScsiDiskDevice - The pointer of SCSI_DISK_DEV - -Returns: - - NONE - ---*/ { ScsiDiskDevice->FixedDevice = (BOOLEAN) (ScsiDiskDevice->InquiryData.RMB ? 0 : 1); ScsiDiskDevice->BlkIoMedia.RemovableMedia = (BOOLEAN) (!ScsiDiskDevice->FixedDevice); } -EFI_STATUS -EFIAPI -ScsiDiskReadSectors ( - SCSI_DISK_DEV *ScsiDiskDevice, - VOID *Buffer, - EFI_LBA Lba, - UINTN NumberOfBlocks - ) -/*++ - -Routine Description: - - Read sector from SCSI Disk - -Arguments: - - ScsiDiskDevice - The poiniter of SCSI_DISK_DEV - Buffer - The buffer to fill in the read out data - Lba - Logic block address - NumberOfBlocks - The number of blocks to read +/** + Read sector from SCSI Disk. -Returns: + @param ScsiDiskDevice The poiniter of SCSI_DISK_DEV + @param Buffer The buffer to fill in the read out data + @param Lba Logic block address + @param NumberOfBlocks The number of blocks to read - EFI_DEVICE_ERROR - EFI_SUCCESS + @retval EFI_DEVICE_ERROR Indicates a device error. + @retval EFI_SUCCESS Operation is successful. ---*/ +**/ +EFI_STATUS +ScsiDiskReadSectors ( + IN SCSI_DISK_DEV *ScsiDiskDevice, + OUT VOID *Buffer, + IN EFI_LBA Lba, + IN UINTN NumberOfBlocks + ) { UINTN BlocksRemaining; UINT32 Lba32; @@ -1720,32 +1610,25 @@ Returns: return EFI_SUCCESS; } -EFI_STATUS -ScsiDiskWriteSectors ( - SCSI_DISK_DEV *ScsiDiskDevice, - VOID *Buffer, - EFI_LBA Lba, - UINTN NumberOfBlocks - ) -/*++ - -Routine Description: - - Write SCSI Disk sectors - -Arguments: - - ScsiDiskDevice - The pointer of SCSI_DISK_DEV - Buffer - The data buffer to write sector - Lba - Logic block address - NumberOfBlocks - The number of blocks to write +/** + Write sector to SCSI Disk. -Returns: + @param ScsiDiskDevice The poiniter of SCSI_DISK_DEV + @param Buffer The buffer of data to be written into SCSI Disk + @param Lba Logic block address + @param NumberOfBlocks The number of blocks to read - EFI_DEVICE_ERROR - EFI_SUCCESS + @retval EFI_DEVICE_ERROR Indicates a device error. + @retval EFI_SUCCESS Operation is successful. ---*/ +**/ +EFI_STATUS +ScsiDiskWriteSectors ( + IN SCSI_DISK_DEV *ScsiDiskDevice, + IN VOID *Buffer, + IN EFI_LBA Lba, + IN UINTN NumberOfBlocks + ) { UINTN BlocksRemaining; UINT32 Lba32; @@ -1827,41 +1710,34 @@ Returns: return EFI_SUCCESS; } + +/** + Sumbmit Read command. + + @param ScsiDiskDevice The pointer of ScsiDiskDevice + @param NeedRetry The pointer of flag indicates if needs retry if error happens + @param SenseDataArray NOT used yet in this function + @param NumberOfSenseKeys The number of sense key + @param Timeout The time to complete the command + @param DataBuffer The buffer to fill with the read out data + @param DataLength The length of buffer + @param StartLba The start logic block address + @param SectorSize The size of sector + + @return EFI_STATUS is returned by calling ScsiRead10Command(). +**/ EFI_STATUS ScsiDiskRead10 ( - SCSI_DISK_DEV *ScsiDiskDevice, - BOOLEAN *NeedRetry, - EFI_SCSI_SENSE_DATA **SenseDataArray, - UINTN *NumberOfSenseKeys, - UINT64 Timeout, - UINT8 *DataBuffer, - UINT32 *DataLength, - UINT32 StartLba, - UINT32 SectorSize + IN SCSI_DISK_DEV *ScsiDiskDevice, + OUT BOOLEAN *NeedRetry, + OUT EFI_SCSI_SENSE_DATA **SenseDataArray, OPTIONAL + OUT UINTN *NumberOfSenseKeys, + IN UINT64 Timeout, + OUT UINT8 *DataBuffer, + IN OUT UINT32 *DataLength, + IN UINT32 StartLba, + IN UINT32 SectorSize ) -/*++ - -Routine Description: - - Sumbmit Read command - -Arguments: - - ScsiDiskDevice - The pointer of ScsiDiskDevice - NeedRetry - The pointer of flag indicates if needs retry if error happens - SenseDataArray - The pointer of an array of sense data - NumberOfSenseKeys - The number of sense key - Timeout - The time to complete the command - DataBuffer - The buffer to fill with the read out data - DataLength - The length of buffer - StartLba - The start logic block address - SectorSize - The size of sector - -Returns: - - EFI_STATUS - ---*/ { UINT8 SenseDataLength; EFI_STATUS Status; @@ -1886,41 +1762,35 @@ Returns: return Status; } -EFI_STATUS -ScsiDiskWrite10 ( - SCSI_DISK_DEV *ScsiDiskDevice, - BOOLEAN *NeedRetry, - EFI_SCSI_SENSE_DATA **SenseDataArray, - UINTN *NumberOfSenseKeys, - UINT64 Timeout, - UINT8 *DataBuffer, - UINT32 *DataLength, - UINT32 StartLba, - UINT32 SectorSize - ) -/*++ - -Routine Description: - Submit Write Command - -Arguments: - - ScsiDiskDevice - The pointer of ScsiDiskDevice - NeedRetry - The pointer of flag indicates if needs retry if error happens - SenseDataArray - The pointer of an array of sense data - NumberOfSenseKeys - The number of sense key - Timeout - The time to complete the command - DataBuffer - The buffer to fill with the read out data - DataLength - The length of buffer - StartLba - The start logic block address - SectorSize - The size of sector +/** + Submit Write Command. -Returns: + @param ScsiDiskDevice The pointer of ScsiDiskDevice + @param NeedRetry The pointer of flag indicates if needs retry if error happens + @param SenseDataArray NOT used yet in this function + @param NumberOfSenseKeys The number of sense key + @param Timeout The time to complete the command + @param DataBuffer The buffer to fill with the read out data + @param DataLength The length of buffer + @param StartLba The start logic block address + @param SectorSize The size of sector - EFI_STATUS + @return EFI_STATUS is returned by calling ScsiWrite10Command(). ---*/ +**/ +EFI_STATUS +ScsiDiskWrite10 ( + IN SCSI_DISK_DEV *ScsiDiskDevice, + OUT BOOLEAN *NeedRetry, + OUT EFI_SCSI_SENSE_DATA **SenseDataArray, OPTIONAL + OUT UINTN *NumberOfSenseKeys, + IN UINT64 Timeout, + IN UINT8 *DataBuffer, + IN OUT UINT32 *DataLength, + IN UINT32 StartLba, + IN UINT32 SectorSize + ) { EFI_STATUS Status; UINT8 SenseDataLength; @@ -1945,27 +1815,21 @@ Returns: return Status; } + +/** + Check sense key to find if media presents. + + @param SenseData The pointer of EFI_SCSI_SENSE_DATA + @param SenseCounts The number of sense key + + @retval TRUE NOT any media + @retval FALSE Media presents +**/ BOOLEAN ScsiDiskIsNoMedia ( IN EFI_SCSI_SENSE_DATA *SenseData, IN UINTN SenseCounts ) -/*++ - -Routine Description: - - Check sense key to find if media presents - -Arguments: - - SenseData - The pointer of EFI_SCSI_SENSE_DATA - SenseCounts - The number of sense key - -Returns: - - BOOLEAN - ---*/ { EFI_SCSI_SENSE_DATA *SensePtr; UINTN Index; @@ -1989,27 +1853,22 @@ Returns: return IsNoMedia; } + +/** + Parse sense key. + + @param SenseData The pointer of EFI_SCSI_SENSE_DATA + @param SenseCounts The number of sense key + + @retval TRUE Error + @retval FALSE NOT error + +**/ BOOLEAN ScsiDiskIsMediaError ( IN EFI_SCSI_SENSE_DATA *SenseData, IN UINTN SenseCounts ) -/*++ - -Routine Description: - - Parse sense key - -Arguments: - - SenseData - The pointer of EFI_SCSI_SENSE_DATA - SenseCounts - The number of sense key - -Returns: - - BOOLEAN - ---*/ { EFI_SCSI_SENSE_DATA *SensePtr; UINTN Index; @@ -2079,27 +1938,22 @@ Returns: return IsError; } + +/** + Check sense key to find if hardware error happens. + + @param SenseData The pointer of EFI_SCSI_SENSE_DATA + @param SenseCounts The number of sense key + + @retval TRUE Hardware error exits. + @retval FALSE NO error. + +**/ BOOLEAN ScsiDiskIsHardwareError ( IN EFI_SCSI_SENSE_DATA *SenseData, IN UINTN SenseCounts ) -/*++ - -Routine Description: - - Check sense key to find if hardware error happens - -Arguments: - - SenseData - The pointer of EFI_SCSI_SENSE_DATA - SenseCounts - The number of sense key - -Returns: - - BOOLEAN - ---*/ { EFI_SCSI_SENSE_DATA *SensePtr; UINTN Index; @@ -2123,27 +1977,21 @@ Returns: return IsError; } + +/** + Check sense key to find if media has changed. + + @param SenseData The pointer of EFI_SCSI_SENSE_DATA + @param SenseCounts The number of sense key + + @retval TRUE Media is changed. + @retval FALSE Medit is NOT changed. +**/ BOOLEAN ScsiDiskIsMediaChange ( IN EFI_SCSI_SENSE_DATA *SenseData, IN UINTN SenseCounts ) -/*++ - -Routine Description: - - Check sense key to find if media has changed - -Arguments: - - SenseData - The pointer of EFI_SCSI_SENSE_DATA - SenseCounts - The number of sense key - -Returns: - - BOOLEAN - ---*/ { EFI_SCSI_SENSE_DATA *SensePtr; UINTN Index; @@ -2168,27 +2016,21 @@ Returns: return IsMediaChanged; } +/** + Check sense key to find if reset happens. + + @param SenseData The pointer of EFI_SCSI_SENSE_DATA + @param SenseCounts The number of sense key + + @retval TRUE It is reset before. + @retval FALSE It is NOT reset before. + +**/ BOOLEAN ScsiDiskIsResetBefore ( IN EFI_SCSI_SENSE_DATA *SenseData, IN UINTN SenseCounts ) -/*++ - -Routine Description: - - Check sense key to find if reset happens - -Arguments: - - SenseData - The pointer of EFI_SCSI_SENSE_DATA - SenseCounts - The number of sense key - -Returns: - - BOOLEAN - ---*/ { EFI_SCSI_SENSE_DATA *SensePtr; UINTN Index; @@ -2214,29 +2056,23 @@ Returns: return IsResetBefore; } +/** + Check sense key to find if the drive is ready. + + @param SenseData The pointer of EFI_SCSI_SENSE_DATA + @param SenseCounts The number of sense key + @param RetryLater The flag means if need a retry + + @retval TRUE Drive is ready. + @retval FALSE Drive is NOT ready. + +**/ BOOLEAN ScsiDiskIsDriveReady ( IN EFI_SCSI_SENSE_DATA *SenseData, IN UINTN SenseCounts, OUT BOOLEAN *RetryLater ) -/*++ - -Routine Description: - - Check sense key to find if the drive is ready - -Arguments: - - SenseData - The pointer of EFI_SCSI_SENSE_DATA - SenseCounts - The number of sense key - RetryLater - The flag means if need a retry - -Returns: - - BOOLEAN - ---*/ { EFI_SCSI_SENSE_DATA *SensePtr; UINTN Index; @@ -2291,27 +2127,21 @@ Returns: return IsReady; } +/** + Check sense key to find if it has sense key. + + @param SenseData - The pointer of EFI_SCSI_SENSE_DATA + @param SenseCounts - The number of sense key + + @retval TRUE It has sense key. + @retval FALSE It has NOT any sense key. + +**/ BOOLEAN ScsiDiskHaveSenseKey ( IN EFI_SCSI_SENSE_DATA *SenseData, IN UINTN SenseCounts ) -/*++ - -Routine Description: - - Check sense key to find if it has sense key - -Arguments: - - SenseData - The pointer of EFI_SCSI_SENSE_DATA - SenseCounts - The number of sense key - -Returns: - - BOOLEAN - ---*/ { EFI_SCSI_SENSE_DATA *SensePtr; UINTN Index; @@ -2341,25 +2171,16 @@ Returns: return HaveSenseKey; } +/** + Release resource about disk device. + + @param ScsiDiskDevice The pointer of SCSI_DISK_DEV + +**/ VOID ReleaseScsiDiskDeviceResources ( IN SCSI_DISK_DEV *ScsiDiskDevice ) -/*++ - -Routine Description: - - Release resource about disk device - -Arguments: - - ScsiDiskDevice - The pointer of SCSI_DISK_DEV - -Returns: - - NONE - ---*/ { if (ScsiDiskDevice == NULL) { return ; diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h index 64ee905e36..273c0edc8b 100644 --- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h +++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h @@ -12,13 +12,29 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#ifndef _SCSI_DISK_H -#define _SCSI_DISK_H +#ifndef _SCSI_DISK_H_ +#define _SCSI_DISK_H_ +#include + + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + #include -#define IsDeviceFixed(a) (a)->FixedDevice ? 1 : 0 +#define IS_DEVICE_FIXED(a) (a)->FixedDevice ? 1 : 0 #define SCSI_DISK_DEV_SIGNATURE EFI_SIGNATURE_32 ('s', 'c', 'd', 'k') @@ -57,29 +73,86 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gScsiDiskComponentName2; #define ACTION_READ_CAPACITY 0x01 #define ACTION_RETRY_COMMAND_LATER 0x02 +/** + Test to see if this driver supports ControllerHandle. + + This service is called by the EFI boot service ConnectController(). In order + to make drivers as small as possible, there are a few calling restrictions for + this service. ConnectController() must follow these calling restrictions. + If any other agent wishes to call Supported() it must also follow these + calling restrictions. + + @param This Protocol instance pointer. + @param ControllerHandle Handle of device to test + @param RemainingDevicePath Optional parameter use to pick a specific child + device to start. + + @retval EFI_SUCCESS This driver supports this device + @retval EFI_ALREADY_STARTED This driver is already running on this device + @retval other This driver does not support this device + +**/ EFI_STATUS EFIAPI ScsiDiskDriverBindingSupported ( IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, - IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL ); +/** + Start this driver on ControllerHandle. + + This service is called by the EFI boot service ConnectController(). In order + to make drivers as small as possible, there are a few calling restrictions for + this service. ConnectController() must follow these calling restrictions. If + any other agent wishes to call Start() it must also follow these calling + restrictions. + + @param This Protocol instance pointer. + @param ControllerHandle Handle of device to bind driver to + @param RemainingDevicePath Optional parameter use to pick a specific child + device to start. + + @retval EFI_SUCCESS This driver is added to ControllerHandle + @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle + @retval other This driver does not support this device + +**/ EFI_STATUS EFIAPI ScsiDiskDriverBindingStart ( IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, - IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL ); +/** + Stop this driver on ControllerHandle. + + This service is called by the EFI boot service DisconnectController(). + In order to make drivers as small as possible, there are a few calling + restrictions for this service. DisconnectController() must follow these + calling restrictions. If any other agent wishes to call Stop() it must + also follow these calling restrictions. + + @param This Protocol instance pointer. + @param ControllerHandle Handle of device to stop driver on + @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of + children is zero stop the entire bus driver. + @param ChildHandleBuffer List of Child Handles to Stop. + + @retval EFI_SUCCESS This driver is removed ControllerHandle + @retval other This driver was not removed from this device + +**/ EFI_STATUS EFIAPI ScsiDiskDriverBindingStop ( IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN UINTN NumberOfChildren, - IN EFI_HANDLE *ChildHandleBuffer + IN EFI_HANDLE *ChildHandleBuffer OPTIONAL ); // @@ -95,10 +168,10 @@ ScsiDiskDriverBindingStop ( by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. - @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or + @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or EFI_COMPONENT_NAME_PROTOCOL instance. - @param Language[in] A pointer to a Null-terminated ASCII string + @param Language A pointer to a Null-terminated ASCII string array indicating the language. This is the language of the driver name that the caller is requesting, and it must match one of the @@ -107,7 +180,7 @@ ScsiDiskDriverBindingStop ( to the driver writer. Language is specified in RFC 3066 or ISO 639-2 language code format. - @param DriverName[out] A pointer to the Unicode string to return. + @param DriverName A pointer to the Unicode string to return. This Unicode string is the name of the driver specified by This in the language specified by Language. @@ -146,15 +219,15 @@ ScsiDiskComponentNameGetDriverName ( then EFI_UNSUPPORTED is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. - @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or + @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or EFI_COMPONENT_NAME_PROTOCOL instance. - @param ControllerHandle[in] The handle of a controller that the driver + @param ControllerHandle The handle of a controller that the driver specified by This is managing. This handle specifies the controller whose name is to be returned. - @param ChildHandle[in] The handle of the child controller to retrieve + @param ChildHandle The handle of the child controller to retrieve the name of. This is an optional parameter that may be NULL. It will be NULL for device drivers. It will also be NULL for a bus drivers @@ -163,7 +236,7 @@ ScsiDiskComponentNameGetDriverName ( driver that wishes to retrieve the name of a child controller. - @param Language[in] A pointer to a Null-terminated ASCII string + @param Language A pointer to a Null-terminated ASCII string array indicating the language. This is the language of the driver name that the caller is requesting, and it must match one of the @@ -172,7 +245,7 @@ ScsiDiskComponentNameGetDriverName ( to the driver writer. Language is specified in RFC 3066 or ISO 639-2 language code format. - @param ControllerName[out] A pointer to the Unicode string to return. + @param ControllerName A pointer to the Unicode string to return. This Unicode string is the name of the controller specified by ControllerHandle and ChildHandle in the language specified by @@ -211,699 +284,500 @@ ScsiDiskComponentNameGetControllerName ( OUT CHAR16 **ControllerName ); +/** + Reset SCSI Disk. + + + @param This The pointer of EFI_BLOCK_IO_PROTOCOL + @param ExtendedVerification The flag about if extend verificate + @retval EFI_SUCCESS The device was reset. + @retval EFI_DEVICE_ERROR The device is not functioning properly and could + not be reset. + @return EFI_STATUS is retured from EFI_SCSI_IO_PROTOCOL.ResetDevice(). + +**/ EFI_STATUS EFIAPI ScsiDiskReset ( IN EFI_BLOCK_IO_PROTOCOL *This, IN BOOLEAN ExtendedVerification - ) -/*++ - -Routine Description: - - Reset SCSI Disk - -Arguments: + ); - This - The pointer of EFI_BLOCK_IO_PROTOCOL - ExtendedVerification - The flag about if extend verificate -Returns: +/** + The function is to Read Block from SCSI Disk. - EFI_STATUS + @param This The pointer of EFI_BLOCK_IO_PROTOCOL. + @param MediaId The Id of Media detected + @param Lba The logic block address + @param BufferSize The size of Buffer + @param Buffer The buffer to fill the read out data ---*/ -; + @retval EFI_SUCCESS Successfully to read out block. + @retval EFI_DEVICE_ERROR Fail to detect media. + @retval EFI_NO_MEDIA Media is not present. + @retval EFI_MEDIA_CHANGED Media has changed. + @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device. + @retval EFI_INVALID_PARAMETER Invalid parameter passed in. +**/ EFI_STATUS EFIAPI ScsiDiskReadBlocks ( IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, - IN EFI_LBA LBA, + IN EFI_LBA Lba, IN UINTN BufferSize, OUT VOID *Buffer - ) -/*++ - -Routine Description: - - The function is to Read Block from SCSI Disk - -Arguments: - - This - The pointer of EFI_BLOCK_IO_PROTOCOL - MediaId - The Id of Media detected - LBA - The logic block address - BufferSize - The size of Buffer - Buffer - The buffer to fill the read out data - -Returns: + ); - EFI_INVALID_PARAMETER - Invalid parameter passed in. - EFI_SUCCESS - Successfully to read out block. - EFI_DEVICE_ERROR - Fail to detect media. - EFI_NO_MEDIA - Media is not present. - EFI_MEDIA_CHANGED - Media has changed. - EFI_BAD_BUFFER_SIZE - The buffer size is not multiple of BlockSize. ---*/ -; +/** + The function is to Write Block to SCSI Disk. + + @param This The pointer of EFI_BLOCK_IO_PROTOCOL + @param MediaId The Id of Media detected + @param Lba The logic block address + @param BufferSize The size of Buffer + @param Buffer The buffer to fill the read out data + + @retval EFI_SUCCESS Successfully to read out block. + @retval EFI_WRITE_PROTECTED The device can not be written to. + @retval EFI_DEVICE_ERROR Fail to detect media. + @retval EFI_NO_MEDIA Media is not present. + @retval EFI_MEDIA_CHNAGED Media has changed. + @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device. + @retval EFI_INVALID_PARAMETER Invalid parameter passed in. +**/ EFI_STATUS EFIAPI ScsiDiskWriteBlocks ( IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, - IN EFI_LBA LBA, + IN EFI_LBA Lba, IN UINTN BufferSize, IN VOID *Buffer - ) -/*++ - -Routine Description: - - The function is to Write Block to SCSI Disk + ); -Arguments: - This - The pointer of EFI_BLOCK_IO_PROTOCOL - MediaId - The Id of Media detected - LBA - The logic block address - BufferSize - The size of Buffer - Buffer - The buffer to fill the read out data +/** + Flush Block to Disk. -Returns: + EFI_SUCCESS is returned directly. - EFI_INVALID_PARAMETER - Invalid parameter passed in. - EFI_SUCCESS - Successfully to read out block. - EFI_DEVICE_ERROR - Fail to detect media. - EFI_NO_MEDIA - Media is not present. - EFI_MEDIA_CHANGED - Media has changed. - EFI_BAD_BUFFER_SIZE - The buffer size is not multiple of BlockSize. + @param This The pointer of EFI_BLOCK_IO_PROTOCOL ---*/ -; + @retval EFI_SUCCESS All outstanding data was written to the device +**/ EFI_STATUS EFIAPI ScsiDiskFlushBlocks ( IN EFI_BLOCK_IO_PROTOCOL *This - ) -/*++ - -Routine Description: - - Flush Block to Disk - -Arguments: - - This - The pointer of EFI_BLOCK_IO_PROTOCOL + ); -Returns: +/** + Dectect Device and read out capacity ,if error occurs, parse the sense key. - EFI_SUCCESS + @param ScsiDiskDevice The pointer of SCSI_DISK_DEV + @param MustReadCapacity The flag about reading device capacity + @param MediaChange The pointer of flag indicates if media has changed ---*/ -; + @retval EFI_DEVICE_ERROR Indicates that error occurs + @retval EFI_SUCCESS Successfully to detect media +**/ EFI_STATUS ScsiDiskDetectMedia ( - SCSI_DISK_DEV *ScsiDiskDevice, - BOOLEAN MustReadCap, - BOOLEAN *MediaChange - ) -/*++ - -Routine Description: - - Dectect Device and read out capacity ,if error occurs, parse the sense key. - -Arguments: + IN SCSI_DISK_DEV *ScsiDiskDevice, + IN BOOLEAN MustReadCapacity, + OUT BOOLEAN *MediaChange + ); - ScsiDiskDevice - The pointer of SCSI_DISK_DEV - MustReadCapacity - The flag about reading device capacity - MediaChange - The pointer of flag indicates if media has changed +/** + To test deivice. -Returns: + When Test Unit Ready command succeeds, retrieve Sense Keys via Request Sense; + When Test Unit Ready command encounters any error caused by host adapter or + target, return error without retrieving Sense Keys. - EFI_DEVICE_ERROR - Indicates that error occurs - EFI_SUCCESS - Successfully to detect media + @param ScsiDiskDevice The pointer of SCSI_DISK_DEV + @param NeedRetry The pointer of flag indicates try again + @param SenseDataArray The pointer of an array of sense data + @param NumberOfSenseKeys The pointer of the number of sense data array ---*/ -; + @retval EFI_DEVICE_ERROR Indicates that error occurs + @retval EFI_SUCCESS Successfully to test unit +**/ EFI_STATUS ScsiDiskTestUnitReady ( - SCSI_DISK_DEV *ScsiDiskDevice, - BOOLEAN *NeedRetry, - EFI_SCSI_SENSE_DATA **SenseDataArray, - UINTN *NumberOfSenseKeys - ) -/*++ - -Routine Description: + IN SCSI_DISK_DEV *ScsiDiskDevice, + OUT BOOLEAN *NeedRetry, + OUT EFI_SCSI_SENSE_DATA **SenseDataArray, + OUT UINTN *NumberOfSenseKeys + ); - When Test Unit Ready command succeeds, retrieve Sense Keys via Request Sense; - When Test Unit Ready command encounters any error caused by host adapter or - target, return error without retrieving Sense Keys. - -Arguments: - ScsiDiskDevice - The pointer of SCSI_DISK_DEV - NeedRetry - The pointer of flag indicates try again - SenseDataArray - The pointer of an array of sense data - NumberOfSenseKeys - The pointer of the number of sense data array - -Returns: +/** + Parsing Sense Keys which got from request sense command. - EFI_DEVICE_ERROR - Indicates that error occurs - EFI_SUCCESS - Successfully to test unit + @param ScsiDiskDevice The pointer of SCSI_DISK_DEV + @param SenseData The pointer of EFI_SCSI_SENSE_DATA + @param NumberOfSenseKeys The number of sense key + @param Action The pointer of action which indicates what is need to do next ---*/ -; + @retval EFI_DEVICE_ERROR Indicates that error occurs + @retval EFI_SUCCESS Successfully to complete the parsing +**/ EFI_STATUS DetectMediaParsingSenseKeys ( - SCSI_DISK_DEV *ScsiDiskDevice, - EFI_SCSI_SENSE_DATA *SenseData, - UINTN NumberOfSenseKeys, - UINTN *Action - ) -/*++ - -Routine Description: - - Parsing Sense Keys which got from request sense command. - -Arguments: + OUT SCSI_DISK_DEV *ScsiDiskDevice, + IN EFI_SCSI_SENSE_DATA *SenseData, + IN UINTN NumberOfSenseKeys, + OUT UINTN *Action + ); - ScsiDiskDevice - The pointer of SCSI_DISK_DEV - SenseData - The pointer of EFI_SCSI_SENSE_DATA - NumberOfSenseKeys - The number of sense key - Action - The pointer of action which indicates what is need to do next -Returns: +/** + Send read capacity command to device and get the device parameter. - EFI_DEVICE_ERROR - Indicates that error occurs - EFI_SUCCESS - Successfully to complete the parsing + @param ScsiDiskDevice The pointer of SCSI_DISK_DEV + @param NeedRetry The pointer of flag indicates if need a retry + @param SenseDataArray The pointer of an array of sense data + @param NumberOfSenseKeys The number of sense key ---*/ -; + @retval EFI_DEVICE_ERROR Indicates that error occurs + @retval EFI_SUCCESS Successfully to read capacity +**/ EFI_STATUS ScsiDiskReadCapacity ( - SCSI_DISK_DEV *ScsiDiskDevice, - BOOLEAN *NeedRetry, - EFI_SCSI_SENSE_DATA **SenseDataArray, - UINTN *NumberOfSenseKeys - ) -/*++ - -Routine Description: - - Send read capacity command to device and get the device parameter - -Arguments: - - ScsiDiskDevice - The pointer of SCSI_DISK_DEV - NeedRetry - The pointer of flag indicates if need a retry - SenseDataArray - The pointer of an array of sense data - NumberOfSenseKeys - The number of sense key + IN OUT SCSI_DISK_DEV *ScsiDiskDevice, + OUT BOOLEAN *NeedRetry, + OUT EFI_SCSI_SENSE_DATA **SenseDataArray, + OUT UINTN *NumberOfSenseKeys + ); -Returns: +/** + Check the HostAdapter status and re-interpret it in EFI_STATUS. - EFI_DEVICE_ERROR - Indicates that error occurs - EFI_SUCCESS - Successfully to read capacity + @param HostAdapterStatus Host Adapter status ---*/ -; + @retval EFI_SUCCESS Host adapter is OK. + @retval EFI_TIMEOUT Timeout. + @retval EFI_NOT_READY Adapter NOT ready. + @retval EFI_DEVICE_ERROR Adapter device error. +**/ EFI_STATUS CheckHostAdapterStatus ( - UINT8 HostAdapterStatus - ) -/*++ - -Routine Description: - - Check the HostAdapter status - -Arguments: + IN UINT8 HostAdapterStatus + ); - HostAdapterStatus - Host Adapter status -Returns: +/** + Check the target status and re-interpret it in EFI_STATUS. - EFI_SUCCESS - EFI_TIMEOUT - EFI_NOT_READY - EFI_DEVICE_ERROR + @param TargetStatus Target status ---*/ -; + @retval EFI_NOT_READY Device is NOT ready. + @retval EFI_DEVICE_ERROR + @retval EFI_SUCCESS +**/ EFI_STATUS CheckTargetStatus ( - UINT8 TargetStatus - ) -/*++ - -Routine Description: - - Check the target status - -Arguments: + IN UINT8 TargetStatus + ); - TargetStatus - Target status +/** + Retrieve all sense keys from the device. -Returns: + When encountering error during the process, if retrieve sense keys before + error encounterred, it returns the sense keys with return status set to EFI_SUCCESS, + and NeedRetry set to FALSE; otherwize, return the proper return status. - EFI_NOT_READY - EFI_DEVICE_ERROR - EFI_SUCCESS + @param ScsiDiskDevice The pointer of SCSI_DISK_DEV + @param NeedRetry The pointer of flag indicates if need a retry + @param SenseDataArray The pointer of an array of sense data + @param NumberOfSenseKeys The number of sense key + @param AskResetIfError The flag indicates if need reset when error occurs ---*/ -; + @retval EFI_DEVICE_ERROR Indicates that error occurs + @retval EFI_SUCCESS Successfully to request sense key +**/ EFI_STATUS ScsiDiskRequestSenseKeys ( - SCSI_DISK_DEV *ScsiDiskDevice, - BOOLEAN *NeedRetry, - EFI_SCSI_SENSE_DATA **SenseDataArray, - UINTN *NumberOfSenseKeys, - BOOLEAN AskResetIfError - ) -/*++ - -Routine Description: + IN OUT SCSI_DISK_DEV *ScsiDiskDevice, + OUT BOOLEAN *NeedRetry, + OUT EFI_SCSI_SENSE_DATA **SenseDataArray, + OUT UINTN *NumberOfSenseKeys, + IN BOOLEAN AskResetIfError + ); - Retrieve all sense keys from the device. - When encountering error during the process, - if retrieve sense keys before error encounterred, - return the sense keys with return status set to EFI_SUCCESS, - and NeedRetry set to FALSE; otherwize, return the proper return - status. - -Arguments: - - ScsiDiskDevice - The pointer of SCSI_DISK_DEV - NeedRetry - The pointer of flag indicates if need a retry - SenseDataArray - The pointer of an array of sense data - NumberOfSenseKeys - The number of sense key - AskResetIfError - The flag indicates if need reset when error occurs - -Returns: +/** + Send out Inquiry command to Device. - EFI_DEVICE_ERROR - Indicates that error occurs - EFI_SUCCESS - Successfully to request sense key + @param ScsiDiskDevice The pointer of SCSI_DISK_DEV + @param NeedRetry Indicates if needs try again when error happens ---*/ -; + @retval EFI_DEVICE_ERROR Indicates that error occurs + @retval EFI_SUCCESS Successfully to detect media +**/ EFI_STATUS ScsiDiskInquiryDevice ( - SCSI_DISK_DEV *ScsiDiskDevice, - BOOLEAN *NeedRetry - ) -/*++ - -Routine Description: - - Send out Inquiry command to Device - -Arguments: - - ScsiDiskDevice - The pointer of SCSI_DISK_DEV - NeedRetry - Indicates if needs try again when error happens - -Returns: + IN OUT SCSI_DISK_DEV *ScsiDiskDevice, + OUT BOOLEAN *NeedRetry + ); - EFI_DEVICE_ERROR - Indicates that error occurs - EFI_SUCCESS - Successfully to detect media +/** + Parse Inquiry data. ---*/ -; + @param ScsiDiskDevice The pointer of SCSI_DISK_DEV +**/ VOID ParseInquiryData ( - SCSI_DISK_DEV *ScsiDiskDevice - ) -/*++ - -Routine Description: - - Parse Inquiry data - -Arguments: - - ScsiDiskDevice - The pointer of SCSI_DISK_DEV + IN OUT SCSI_DISK_DEV *ScsiDiskDevice + ); -Returns: +/** + Read sector from SCSI Disk. - NONE + @param ScsiDiskDevice The poiniter of SCSI_DISK_DEV + @param Buffer The buffer to fill in the read out data + @param Lba Logic block address + @param NumberOfBlocks The number of blocks to read ---*/ -; + @retval EFI_DEVICE_ERROR Indicates a device error. + @retval EFI_SUCCESS Operation is successful. +**/ EFI_STATUS ScsiDiskReadSectors ( - SCSI_DISK_DEV *ScsiDiskDevice, - VOID *Buffer, - EFI_LBA Lba, - UINTN NumberOfBlocks - ) -/*++ - -Routine Description: - - Read sector from SCSI Disk - -Arguments: - - ScsiDiskDevice - The poiniter of SCSI_DISK_DEV - Buffer - The buffer to fill in the read out data - Lba - Logic block address - NumberOfBlocks - The number of blocks to read + IN SCSI_DISK_DEV *ScsiDiskDevice, + OUT VOID *Buffer, + IN EFI_LBA Lba, + IN UINTN NumberOfBlocks + ); -Returns: +/** + Write sector to SCSI Disk. - EFI_DEVICE_ERROR - EFI_SUCCESS + @param ScsiDiskDevice The poiniter of SCSI_DISK_DEV + @param Buffer The buffer of data to be written into SCSI Disk + @param Lba Logic block address + @param NumberOfBlocks The number of blocks to read ---*/ -; + @retval EFI_DEVICE_ERROR Indicates a device error. + @retval EFI_SUCCESS Operation is successful. +**/ EFI_STATUS ScsiDiskWriteSectors ( - SCSI_DISK_DEV *ScsiDiskDevice, - VOID *Buffer, - EFI_LBA Lba, - UINTN NumberOfBlocks - ) -/*++ - -Routine Description: - - Write SCSI Disk sectors - -Arguments: - - ScsiDiskDevice - The pointer of SCSI_DISK_DEV - Buffer - The data buffer to write sector - Lba - Logic block address - NumberOfBlocks - The number of blocks to write - -Returns: - - EFI_DEVICE_ERROR - EFI_SUCCESS - ---*/ -; + IN SCSI_DISK_DEV *ScsiDiskDevice, + IN VOID *Buffer, + IN EFI_LBA Lba, + IN UINTN NumberOfBlocks + ); +/** + Sumbmit Read command. + + @param ScsiDiskDevice The pointer of ScsiDiskDevice + @param NeedRetry The pointer of flag indicates if needs retry if error happens + @param SenseDataArray NOT used yet in this function + @param NumberOfSenseKeys The number of sense key + @param Timeout The time to complete the command + @param DataBuffer The buffer to fill with the read out data + @param DataLength The length of buffer + @param StartLba The start logic block address + @param SectorSize The size of sector + + @return EFI_STATUS is returned by calling ScsiRead10Command(). +**/ EFI_STATUS ScsiDiskRead10 ( - SCSI_DISK_DEV *ScsiDiskDevice, - BOOLEAN *NeedRetry, - EFI_SCSI_SENSE_DATA **SenseDataArray, - UINTN *NumberOfSenseKeys, - UINT64 Timeout, - UINT8 *DataBuffer, - UINT32 *DataLength, - UINT32 StartLba, - UINT32 SectorSize - ) -/*++ - -Routine Description: - - Sumbmit Read command - -Arguments: - - ScsiDiskDevice - The pointer of ScsiDiskDevice - NeedRetry - The pointer of flag indicates if needs retry if error happens - SenseDataArray - The pointer of an array of sense data - NumberOfSenseKeys - The number of sense key - Timeout - The time to complete the command - DataBuffer - The buffer to fill with the read out data - DataLength - The length of buffer - StartLba - The start logic block address - SectorSize - The size of sector + IN SCSI_DISK_DEV *ScsiDiskDevice, + OUT BOOLEAN *NeedRetry, + OUT EFI_SCSI_SENSE_DATA **SenseDataArray, OPTIONAL + OUT UINTN *NumberOfSenseKeys, + IN UINT64 Timeout, + OUT UINT8 *DataBuffer, + IN OUT UINT32 *DataLength, + IN UINT32 StartLba, + IN UINT32 SectorSize + ); -Returns: +/** + Submit Write Command. - EFI_STATUS + @param ScsiDiskDevice The pointer of ScsiDiskDevice + @param NeedRetry The pointer of flag indicates if needs retry if error happens + @param SenseDataArray NOT used yet in this function + @param NumberOfSenseKeys The number of sense key + @param Timeout The time to complete the command + @param DataBuffer The buffer to fill with the read out data + @param DataLength The length of buffer + @param StartLba The start logic block address + @param SectorSize The size of sector ---*/ -; + @return EFI_STATUS is returned by calling ScsiWrite10Command(). +**/ EFI_STATUS ScsiDiskWrite10 ( - SCSI_DISK_DEV *ScsiDiskDevice, - BOOLEAN *NeedRetry, - EFI_SCSI_SENSE_DATA **SenseDataArray, - UINTN *NumberOfSenseKeys, - UINT64 Timeout, - UINT8 *DataBuffer, - UINT32 *DataLength, - UINT32 StartLba, - UINT32 SectorSize - ) -/*++ - -Routine Description: - - Submit Write Command - -Arguments: - - ScsiDiskDevice - The pointer of ScsiDiskDevice - NeedRetry - The pointer of flag indicates if needs retry if error happens - SenseDataArray - The pointer of an array of sense data - NumberOfSenseKeys - The number of sense key - Timeout - The time to complete the command - DataBuffer - The buffer to fill with the read out data - DataLength - The length of buffer - StartLba - The start logic block address - SectorSize - The size of sector - -Returns: + IN SCSI_DISK_DEV *ScsiDiskDevice, + OUT BOOLEAN *NeedRetry, + OUT EFI_SCSI_SENSE_DATA **SenseDataArray, OPTIONAL + OUT UINTN *NumberOfSenseKeys, + IN UINT64 Timeout, + IN UINT8 *DataBuffer, + IN OUT UINT32 *DataLength, + IN UINT32 StartLba, + IN UINT32 SectorSize + ); - EFI_STATUS +/** + Get information from media read capacity command. ---*/ -; + @param ScsiDiskDevice The pointer of SCSI_DISK_DEV + @param Capacity The pointer of EFI_SCSI_DISK_CAPACITY_DATA +**/ VOID GetMediaInfo ( - SCSI_DISK_DEV *ScsiDiskDevice, - EFI_SCSI_DISK_CAPACITY_DATA *Capacity - ) -/*++ - -Routine Description: - - Get information from media read capacity command - -Arguments: - - ScsiDiskDevice - The pointer of SCSI_DISK_DEV - Capacity - The pointer of EFI_SCSI_DISK_CAPACITY_DATA - -Returns: + IN OUT SCSI_DISK_DEV *ScsiDiskDevice, + IN EFI_SCSI_DISK_CAPACITY_DATA *Capacity + ); - NONE +/** + Check sense key to find if media presents. ---*/ -; + @param SenseData The pointer of EFI_SCSI_SENSE_DATA + @param SenseCounts The number of sense key + @retval TRUE NOT any media + @retval FALSE Media presents +**/ BOOLEAN ScsiDiskIsNoMedia ( IN EFI_SCSI_SENSE_DATA *SenseData, IN UINTN SenseCounts - ) -/*++ - -Routine Description: - - Check sense key to find if media presents - -Arguments: - - SenseData - The pointer of EFI_SCSI_SENSE_DATA - SenseCounts - The number of sense key + ); -Returns: +/** + Parse sense key. - BOOLEAN + @param SenseData The pointer of EFI_SCSI_SENSE_DATA + @param SenseCounts The number of sense key ---*/ -; + @retval TRUE Error + @retval FALSE NOT error +**/ BOOLEAN ScsiDiskIsMediaError ( IN EFI_SCSI_SENSE_DATA *SenseData, IN UINTN SenseCounts - ) -/*++ - -Routine Description: - - Parse sense key - -Arguments: - - SenseData - The pointer of EFI_SCSI_SENSE_DATA - SenseCounts - The number of sense key + ); -Returns: +/** + Check sense key to find if hardware error happens. - BOOLEAN + @param SenseData The pointer of EFI_SCSI_SENSE_DATA + @param SenseCounts The number of sense key ---*/ -; + @retval TRUE Hardware error exits. + @retval FALSE NO error. +**/ BOOLEAN ScsiDiskIsHardwareError ( IN EFI_SCSI_SENSE_DATA *SenseData, IN UINTN SenseCounts - ) -/*++ - -Routine Description: - - Check sense key to find if hardware error happens - -Arguments: - - SenseData - The pointer of EFI_SCSI_SENSE_DATA - SenseCounts - The number of sense key - -Returns: + ); - BOOLEAN +/** + Check sense key to find if media has changed. ---*/ -; + @param SenseData The pointer of EFI_SCSI_SENSE_DATA + @param SenseCounts The number of sense key + @retval TRUE Media is changed. + @retval FALSE Medit is NOT changed. +**/ BOOLEAN ScsiDiskIsMediaChange ( IN EFI_SCSI_SENSE_DATA *SenseData, IN UINTN SenseCounts - ) -/*++ - -Routine Description: - -Routine Description: - - Check sense key to find if media has changed - -Arguments: - - SenseData - The pointer of EFI_SCSI_SENSE_DATA - SenseCounts - The number of sense key + ); -Returns: +/** + Check sense key to find if reset happens. - BOOLEAN + @param SenseData The pointer of EFI_SCSI_SENSE_DATA + @param SenseCounts The number of sense key ---*/ -; + @retval TRUE It is reset before. + @retval FALSE It is NOT reset before. +**/ BOOLEAN ScsiDiskIsResetBefore ( IN EFI_SCSI_SENSE_DATA *SenseData, IN UINTN SenseCounts - ) -/*++ - -Routine Description: - - Check sense key to find if reset happens - -Arguments: - - SenseData - The pointer of EFI_SCSI_SENSE_DATA - SenseCounts - The number of sense key + ); -Returns: +/** + Check sense key to find if the drive is ready. - BOOLEAN + @param SenseData The pointer of EFI_SCSI_SENSE_DATA + @param SenseCounts The number of sense key + @param RetryLater The flag means if need a retry ---*/ -; + @retval TRUE Drive is ready. + @retval FALSE Drive is NOT ready. +**/ BOOLEAN ScsiDiskIsDriveReady ( IN EFI_SCSI_SENSE_DATA *SenseData, IN UINTN SenseCounts, - OUT BOOLEAN *NeedRetry - ) -/*++ - -Routine Description: - - Check sense key to find if the drive is ready - -Arguments: - - SenseData - The pointer of EFI_SCSI_SENSE_DATA - SenseCounts - The number of sense key - RetryLater - The flag means if need a retry + OUT BOOLEAN *RetryLater + ); -Returns: +/** + Check sense key to find if it has sense key. - BOOLEAN + @param SenseData - The pointer of EFI_SCSI_SENSE_DATA + @param SenseCounts - The number of sense key ---*/ -; + @retval TRUE It has sense key. + @retval FALSE It has NOT any sense key. +**/ BOOLEAN ScsiDiskHaveSenseKey ( IN EFI_SCSI_SENSE_DATA *SenseData, IN UINTN SenseCounts - ) -/*++ - -Routine Description: - - Check sense key to find if it has sense key - -Arguments: - - SenseData - The pointer of EFI_SCSI_SENSE_DATA - SenseCounts - The number of sense key - -Returns: + ); - BOOLEAN +/** + Release resource about disk device. ---*/ -; + @param ScsiDiskDevice The pointer of SCSI_DISK_DEV +**/ VOID ReleaseScsiDiskDeviceResources ( IN SCSI_DISK_DEV *ScsiDiskDevice - ) -/*++ - -Routine Description: - - Release resource about disk device - -Arguments: - - ScsiDiskDevice - The pointer of SCSI_DISK_DEV - -Returns: - - NONE - ---*/ -; + ); #endif diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf index aea9646a98..3316862d0a 100644 --- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf +++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf @@ -1,6 +1,6 @@ #/** @file # -# Component description file for Scsi Disk module. +# Component description file for Scsi Disk module. # # Scsi Disk driver. This driver detected the Scsi disk media and export block io protocol # @@ -32,7 +32,8 @@ # VALID_ARCHITECTURES = IA32 X64 IPF EBC # # DRIVER_BINDING = gScsiDiskDriverBinding -# COMPONENT_NAME = gScsiDiskComponentName +# COMPONENT_NAME = gScsiDiskComponentName +# COMPONENT_NAME2 = gScsiDiskComponentName2 # [Sources.common] -- 2.39.2