1. Set the Target array to zero before fill the target id.

2. Get the command/control register base address for each channel through IDE common registers.
3. Correctify some return status to sync with newest Uefi Spec 2.1



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3901 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qhuang8 2007-09-20 10:06:50 +00:00
parent c7a54f2560
commit f36d6e669c
7 changed files with 1241 additions and 915 deletions

View File

@ -12,13 +12,6 @@
#include "AtapiPassThru.h" #include "AtapiPassThru.h"
///
/// IDE registers' fixed address
///
static IDE_BASE_REGISTERS gAtapiIoPortRegisters[2] = {
{ 0x1f0, { 0x1f1 }, 0x1f2, 0x1f3, 0x1f4, 0x1f5, 0x1f6, { 0x1f7 }, { 0x3f6 }, 0x3f7, 0 },
{ 0x170, { 0x171 }, 0x172, 0x173, 0x174, 0x175, 0x176, { 0x177 }, { 0x376 }, 0x377, 0 }
};
static SCSI_COMMAND_SET gEndTable = { 0xff, (DATA_DIRECTION) 0xff }; static SCSI_COMMAND_SET gEndTable = { 0xff, (DATA_DIRECTION) 0xff };
@ -97,6 +90,7 @@ AtapiScsiPassThruDriverBindingSupported (
EFI_PCI_IO_PROTOCOL *PciIo; EFI_PCI_IO_PROTOCOL *PciIo;
PCI_TYPE00 Pci; PCI_TYPE00 Pci;
// //
// Open the IO Abstraction(s) needed to perform the supported test // Open the IO Abstraction(s) needed to perform the supported test
// //
@ -125,11 +119,11 @@ AtapiScsiPassThruDriverBindingSupported (
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
gBS->CloseProtocol ( gBS->CloseProtocol (
Controller, Controller,
&gEfiPciIoProtocolGuid, &gEfiPciIoProtocolGuid,
This->DriverBindingHandle, This->DriverBindingHandle,
Controller Controller
); );
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
@ -139,11 +133,11 @@ AtapiScsiPassThruDriverBindingSupported (
} }
gBS->CloseProtocol ( gBS->CloseProtocol (
Controller, Controller,
&gEfiPciIoProtocolGuid, &gEfiPciIoProtocolGuid,
This->DriverBindingHandle, This->DriverBindingHandle,
Controller Controller
); );
return Status; return Status;
} }
@ -169,7 +163,9 @@ AtapiScsiPassThruDriverBindingStart (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_STATUS DisableStatus;
EFI_PCI_IO_PROTOCOL *PciIo; EFI_PCI_IO_PROTOCOL *PciIo;
UINT64 Supports;
PciIo = NULL; PciIo = NULL;
Status = gBS->OpenProtocol ( Status = gBS->OpenProtocol (
@ -186,10 +182,21 @@ AtapiScsiPassThruDriverBindingStart (
Status = PciIo->Attributes ( Status = PciIo->Attributes (
PciIo, PciIo,
EfiPciIoAttributeOperationEnable, EfiPciIoAttributeOperationSupported,
EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO | EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO | EFI_PCI_DEVICE_ENABLE, 0,
NULL &Supports
); );
if (!EFI_ERROR (Status)) {
Supports &= (EFI_PCI_DEVICE_ENABLE |
EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO |
EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO);
Status = PciIo->Attributes (
PciIo,
EfiPciIoAttributeOperationEnable,
Supports,
NULL
);
}
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
goto Done; goto Done;
} }
@ -202,20 +209,31 @@ AtapiScsiPassThruDriverBindingStart (
Done: Done:
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
if (PciIo) { if (PciIo) {
PciIo->Attributes ( DisableStatus = PciIo->Attributes (
PciIo, PciIo,
EfiPciIoAttributeOperationDisable, EfiPciIoAttributeOperationSupported,
EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO | EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO | EFI_PCI_DEVICE_ENABLE, 0,
NULL &Supports
); );
if (!EFI_ERROR (DisableStatus)) {
Supports &= (EFI_PCI_DEVICE_ENABLE |
EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO |
EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO);
DisableStatus = PciIo->Attributes (
PciIo,
EfiPciIoAttributeOperationDisable,
Supports,
NULL
);
}
} }
gBS->CloseProtocol ( gBS->CloseProtocol (
Controller, Controller,
&gEfiPciIoProtocolGuid, &gEfiPciIoProtocolGuid,
This->DriverBindingHandle, This->DriverBindingHandle,
Controller Controller
); );
} }
return Status; return Status;
@ -246,6 +264,7 @@ AtapiScsiPassThruDriverBindingStop (
EFI_STATUS Status; EFI_STATUS Status;
EFI_SCSI_PASS_THRU_PROTOCOL *ScsiPassThru; EFI_SCSI_PASS_THRU_PROTOCOL *ScsiPassThru;
ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate; ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate;
UINT64 Supports;
Status = gBS->OpenProtocol ( Status = gBS->OpenProtocol (
Controller, Controller,
@ -272,19 +291,30 @@ AtapiScsiPassThruDriverBindingStop (
// //
// Release Pci Io protocol on the controller handle. // Release Pci Io protocol on the controller handle.
// //
AtapiScsiPrivate->PciIo->Attributes ( Status = AtapiScsiPrivate->PciIo->Attributes (
AtapiScsiPrivate->PciIo, AtapiScsiPrivate->PciIo,
EfiPciIoAttributeOperationDisable, EfiPciIoAttributeOperationSupported,
EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO | EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO | EFI_PCI_DEVICE_ENABLE, 0,
NULL &Supports
); );
if (!EFI_ERROR (Status)) {
Supports &= (EFI_PCI_DEVICE_ENABLE |
EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO |
EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO);
Status = AtapiScsiPrivate->PciIo->Attributes (
AtapiScsiPrivate->PciIo,
EfiPciIoAttributeOperationDisable,
Supports,
NULL
);
}
gBS->CloseProtocol ( gBS->CloseProtocol (
Controller, Controller,
&gEfiPciIoProtocolGuid, &gEfiPciIoProtocolGuid,
This->DriverBindingHandle, This->DriverBindingHandle,
Controller Controller
); );
gBS->FreePool (AtapiScsiPrivate); gBS->FreePool (AtapiScsiPrivate);
@ -313,20 +343,36 @@ RegisterAtapiScsiPassThru (
{ {
EFI_STATUS Status; EFI_STATUS Status;
ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate; ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate;
UINT64 Attributes; UINT64 Supports;
IDE_REGISTERS_BASE_ADDR IdeRegsBaseAddr[ATAPI_MAX_CHANNEL];
AtapiScsiPrivate = AllocateZeroPool (sizeof (ATAPI_SCSI_PASS_THRU_DEV)); AtapiScsiPrivate = AllocateZeroPool (sizeof (ATAPI_SCSI_PASS_THRU_DEV));
if (AtapiScsiPrivate == NULL) { if (AtapiScsiPrivate == NULL) {
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
} }
Attributes = EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO | EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO | EFI_PCI_DEVICE_ENABLE;
CopyMem (AtapiScsiPrivate->ChannelName, gAtapiChannelString, sizeof (gAtapiChannelString)); CopyMem (AtapiScsiPrivate->ChannelName, gAtapiChannelString, sizeof (gAtapiChannelString));
// //
// Enable channel // Enable channel
// //
PciIo->Attributes (PciIo, EfiPciIoAttributeOperationSet, Attributes, NULL); Status = PciIo->Attributes (
PciIo,
EfiPciIoAttributeOperationSupported,
0,
&Supports
);
if (!EFI_ERROR (Status)) {
Supports &= (EFI_PCI_DEVICE_ENABLE |
EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO |
EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO);
Status = PciIo->Attributes (
PciIo,
EfiPciIoAttributeOperationEnable,
Supports,
NULL
);
}
AtapiScsiPrivate->Signature = ATAPI_SCSI_PASS_THRU_DEV_SIGNATURE; AtapiScsiPrivate->Signature = ATAPI_SCSI_PASS_THRU_DEV_SIGNATURE;
AtapiScsiPrivate->Handle = Controller; AtapiScsiPrivate->Handle = Controller;
@ -334,10 +380,19 @@ RegisterAtapiScsiPassThru (
// //
// will reset the IoPort inside each API function. // will reset the IoPort inside each API function.
// //
AtapiScsiPrivate->IoPort = gAtapiIoPortRegisters; AtapiScsiPrivate->IoPort = NULL;
AtapiScsiPrivate->PciIo = PciIo; AtapiScsiPrivate->PciIo = PciIo;
// //
// Obtain IDE IO port registers' base addresses
//
Status = GetIdeRegistersBaseAddr (PciIo, IdeRegsBaseAddr);
if (EFI_ERROR (Status)) {
return Status;
}
InitAtapiIoPortRegisters(AtapiScsiPrivate, IdeRegsBaseAddr);
// initialize SCSI Pass Thru Protocol interface // initialize SCSI Pass Thru Protocol interface
// //
AtapiScsiPrivate->ScsiPassThru.Mode = &AtapiScsiPrivate->ScsiPassThruMode; AtapiScsiPrivate->ScsiPassThru.Mode = &AtapiScsiPrivate->ScsiPassThruMode;
@ -364,9 +419,9 @@ RegisterAtapiScsiPassThru (
AtapiScsiPrivate->ScsiPassThruMode.IoAlign = 0; AtapiScsiPrivate->ScsiPassThruMode.IoAlign = 0;
// //
// Initialize the LatestTargetId to 0xFFFFFFFF (for the GetNextDevice() call). // Initialize the LatestTargetId.
// //
AtapiScsiPrivate->LatestTargetId = 0xFFFFFFFF; AtapiScsiPrivate->LatestTargetId = 4;
AtapiScsiPrivate->LatestLun = 0; AtapiScsiPrivate->LatestLun = 0;
Status = gBS->InstallProtocolInterface ( Status = gBS->InstallProtocolInterface (
@ -411,15 +466,15 @@ AtapiScsiPassThruFunction (
IN EFI_EVENT Event OPTIONAL IN EFI_EVENT Event OPTIONAL
) )
{ {
ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate; ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate;
EFI_STATUS Status; EFI_STATUS Status;
AtapiScsiPrivate = ATAPI_SCSI_PASS_THRU_DEV_FROM_THIS (This); AtapiScsiPrivate = ATAPI_SCSI_PASS_THRU_DEV_FROM_THIS (This);
// //
// Target is not allowed beyond MAX_TARGET_ID // Target is not allowed beyond MAX_TARGET_ID
// //
if (Target > MAX_TARGET_ID) { if ((Target > MAX_TARGET_ID) || (Lun != 0)) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -442,13 +497,15 @@ AtapiScsiPassThruFunction (
// //
// According to Target ID, reset the Atapi I/O Register mapping // According to Target ID, reset the Atapi I/O Register mapping
// (Target Id in [0,1] area, using gAtapiIoPortRegisters[0], // (Target Id in [0,1] area, using AtapiIoPortRegisters[0],
// Target Id in [2,3] area, using gAtapiIoPortRegisters[1] // Target Id in [2,3] area, using AtapiIoPortRegisters[1]
// //
if ((Target / 2) == 0) { if ((Target / 2) == 0) {
AtapiScsiPrivate->IoPort = &gAtapiIoPortRegisters[0]; Target = Target % 2;
AtapiScsiPrivate->IoPort = &AtapiScsiPrivate->AtapiIoPortRegisters[0];
} else { } else {
AtapiScsiPrivate->IoPort = &gAtapiIoPortRegisters[1]; Target = Target % 2;
AtapiScsiPrivate->IoPort = &AtapiScsiPrivate->AtapiIoPortRegisters[1];
} }
// //
@ -572,6 +629,7 @@ AtapiScsiPassThruBuildDevicePath (
{ {
EFI_DEV_PATH *Node; EFI_DEV_PATH *Node;
// //
// Validate parameters passed in. // Validate parameters passed in.
// //
@ -691,8 +749,10 @@ AtapiScsiPassThruResetChannel (
UINT8 DeviceControlValue; UINT8 DeviceControlValue;
ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate; ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate;
UINT8 Index; UINT8 Index;
BOOLEAN ResetFlag;
AtapiScsiPrivate = ATAPI_SCSI_PASS_THRU_DEV_FROM_THIS (This); AtapiScsiPrivate = ATAPI_SCSI_PASS_THRU_DEV_FROM_THIS (This);
ResetFlag = FALSE;
// //
// Reset both Primary channel and Secondary channel. // Reset both Primary channel and Secondary channel.
@ -702,7 +762,7 @@ AtapiScsiPassThruResetChannel (
// //
// Reset // Reset
// //
AtapiScsiPrivate->IoPort = &gAtapiIoPortRegisters[Index]; AtapiScsiPrivate->IoPort = &AtapiScsiPrivate->AtapiIoPortRegisters[Index];
DeviceControlValue = 0; DeviceControlValue = 0;
// //
@ -735,12 +795,16 @@ AtapiScsiPassThruResetChannel (
// //
// slave device needs at most 31s to clear BSY // slave device needs at most 31s to clear BSY
// //
if (StatusWaitForBSYClear (AtapiScsiPrivate, 31000) == EFI_TIMEOUT) { if (StatusWaitForBSYClear (AtapiScsiPrivate, 31000000) != EFI_TIMEOUT) {
return EFI_DEVICE_ERROR; ResetFlag = TRUE;
} }
} }
return EFI_SUCCESS; if (ResetFlag) {
return EFI_SUCCESS;
}
return EFI_TIMEOUT;
} }
/** /**
@ -776,7 +840,7 @@ AtapiScsiPassThruResetTarget (
AtapiScsiPrivate = ATAPI_SCSI_PASS_THRU_DEV_FROM_THIS (This); AtapiScsiPrivate = ATAPI_SCSI_PASS_THRU_DEV_FROM_THIS (This);
if (Target > MAX_TARGET_ID) { if ((Target > MAX_TARGET_ID) || (Lun != 0)) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
// //
@ -788,13 +852,13 @@ AtapiScsiPassThruResetTarget (
// //
// According to Target ID, reset the Atapi I/O Register mapping // According to Target ID, reset the Atapi I/O Register mapping
// (Target Id in [0,1] area, using gAtapiIoPortRegisters[0], // (Target Id in [0,1] area, using AtapiIoPortRegisters[0],
// Target Id in [2,3] area, using gAtapiIoPortRegisters[1] // Target Id in [2,3] area, using AtapiIoPortRegisters[1]
// //
if ((Target / 2) == 0) { if ((Target / 2) == 0) {
AtapiScsiPrivate->IoPort = &gAtapiIoPortRegisters[0]; AtapiScsiPrivate->IoPort = &AtapiScsiPrivate->AtapiIoPortRegisters[0];
} else { } else {
AtapiScsiPrivate->IoPort = &gAtapiIoPortRegisters[1]; AtapiScsiPrivate->IoPort = &AtapiScsiPrivate->AtapiIoPortRegisters[1];
} }
// //
@ -813,8 +877,8 @@ AtapiScsiPassThruResetTarget (
// when reset is complete. // when reset is complete.
// slave device needs at most 31s to clear BSY // slave device needs at most 31s to clear BSY
// //
if (EFI_ERROR (StatusWaitForBSYClear (AtapiScsiPrivate, 31000))) { if (EFI_ERROR (StatusWaitForBSYClear (AtapiScsiPrivate, 31000000))) {
return EFI_DEVICE_ERROR; return EFI_TIMEOUT;
} }
// //
@ -825,25 +889,159 @@ AtapiScsiPassThruResetTarget (
return EFI_SUCCESS; return EFI_SUCCESS;
} }
EFI_STATUS
/** GetIdeRegistersBaseAddr (
Checks the parameters in the SCSI Request Packet to make sure IN EFI_PCI_IO_PROTOCOL *PciIo,
they are valid for a SCSI Pass Thru request. OUT IDE_REGISTERS_BASE_ADDR *IdeRegsBaseAddr
)
/*++
@todo function comment is missing 'Routine Description:' Routine Description:
@todo function comment is missing 'Arguments:' Get IDE IO port registers' base addresses by mode. In 'Compatibility' mode,
@todo function comment is missing 'Returns:' use fixed addresses. In Native-PCI mode, get base addresses from BARs in
@todo Packet - add argument and description to function comment the PCI IDE controller's Configuration Space.
@todo EFI_INVALID_PARAMETER - add return value to function comment
@todo EFI_INVALID_PARAMETER - add return value to function comment Arguments:
@todo EFI_INVALID_PARAMETER - add return value to function comment PciIo - Pointer to the EFI_PCI_IO_PROTOCOL instance
@todo EFI_UNSUPPORTED - add return value to function comment IdeRegsBaseAddr - Pointer to IDE_REGISTERS_BASE_ADDR to
@todo EFI_SUCCESS - add return value to function comment receive IDE IO port registers' base addresses
**/
Returns:
EFI_STATUS
--*/
{
EFI_STATUS Status;
PCI_TYPE00 PciData;
Status = PciIo->Pci.Read (
PciIo,
EfiPciIoWidthUint8,
0,
sizeof (PciData),
&PciData
);
if (EFI_ERROR (Status)) {
return Status;
}
if ((PciData.Hdr.ClassCode[0] & IDE_PRIMARY_OPERATING_MODE) == 0) {
IdeRegsBaseAddr[IdePrimary].CommandBlockBaseAddr = 0x1f0;
IdeRegsBaseAddr[IdePrimary].ControlBlockBaseAddr = 0x3f6;
} else {
//
// The BARs should be of IO type
//
if ((PciData.Device.Bar[0] & BIT0) == 0 ||
(PciData.Device.Bar[1] & BIT0) == 0) {
return EFI_UNSUPPORTED;
}
IdeRegsBaseAddr[IdePrimary].CommandBlockBaseAddr =
(UINT16) (PciData.Device.Bar[0] & 0x0000fff8);
IdeRegsBaseAddr[IdePrimary].ControlBlockBaseAddr =
(UINT16) ((PciData.Device.Bar[1] & 0x0000fffc) + 2);
}
if ((PciData.Hdr.ClassCode[0] & IDE_SECONDARY_OPERATING_MODE) == 0) {
IdeRegsBaseAddr[IdeSecondary].CommandBlockBaseAddr = 0x170;
IdeRegsBaseAddr[IdeSecondary].ControlBlockBaseAddr = 0x376;
} else {
//
// The BARs should be of IO type
//
if ((PciData.Device.Bar[2] & BIT0) == 0 ||
(PciData.Device.Bar[3] & BIT0) == 0) {
return EFI_UNSUPPORTED;
}
IdeRegsBaseAddr[IdeSecondary].CommandBlockBaseAddr =
(UINT16) (PciData.Device.Bar[2] & 0x0000fff8);
IdeRegsBaseAddr[IdeSecondary].ControlBlockBaseAddr =
(UINT16) ((PciData.Device.Bar[3] & 0x0000fffc) + 2);
}
return EFI_SUCCESS;
}
VOID
InitAtapiIoPortRegisters (
IN ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
IN IDE_REGISTERS_BASE_ADDR *IdeRegsBaseAddr
)
/*++
Routine Description:
Initialize each Channel's Base Address of CommandBlock and ControlBlock.
Arguments:
AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV
IdeRegsBaseAddr - The pointer of IDE_REGISTERS_BASE_ADDR
Returns:
None
--*/
{
UINT8 IdeChannel;
UINT16 CommandBlockBaseAddr;
UINT16 ControlBlockBaseAddr;
IDE_BASE_REGISTERS *RegisterPointer;
for (IdeChannel = 0; IdeChannel < ATAPI_MAX_CHANNEL; IdeChannel++) {
RegisterPointer = &AtapiScsiPrivate->AtapiIoPortRegisters[IdeChannel];
//
// Initialize IDE IO port addresses, including Command Block registers
// and Control Block registers
//
CommandBlockBaseAddr = IdeRegsBaseAddr[IdeChannel].CommandBlockBaseAddr;
ControlBlockBaseAddr = IdeRegsBaseAddr[IdeChannel].ControlBlockBaseAddr;
RegisterPointer->Data = CommandBlockBaseAddr;
(*(UINT16 *) &RegisterPointer->Reg1) = (UINT16) (CommandBlockBaseAddr + 0x01);
RegisterPointer->SectorCount = (UINT16) (CommandBlockBaseAddr + 0x02);
RegisterPointer->SectorNumber = (UINT16) (CommandBlockBaseAddr + 0x03);
RegisterPointer->CylinderLsb = (UINT16) (CommandBlockBaseAddr + 0x04);
RegisterPointer->CylinderMsb = (UINT16) (CommandBlockBaseAddr + 0x05);
RegisterPointer->Head = (UINT16) (CommandBlockBaseAddr + 0x06);
(*(UINT16 *) &RegisterPointer->Reg) = (UINT16) (CommandBlockBaseAddr + 0x07);
(*(UINT16 *) &RegisterPointer->Alt) = ControlBlockBaseAddr;
RegisterPointer->DriveAddress = (UINT16) (ControlBlockBaseAddr + 0x01);
}
}
EFI_STATUS EFI_STATUS
CheckSCSIRequestPacket ( CheckSCSIRequestPacket (
EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
) )
/*++
Routine Description:
Checks the parameters in the SCSI Request Packet to make sure
they are valid for a SCSI Pass Thru request.
Arguments:
Packet - The pointer of EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET
Returns:
EFI_STATUS
--*/
{ {
if (Packet == NULL) { if (Packet == NULL) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
@ -971,11 +1169,23 @@ SubmitBlockingIoCommand (
Packet->SenseDataLength = 0; Packet->SenseDataLength = 0;
return PacketCommandStatus; return PacketCommandStatus;
} }
//
// Check if SenseData meets the alignment requirement.
//
if ((AtapiScsiPrivate->ScsiPassThru.Mode->IoAlign != 0) \
&& (AtapiScsiPrivate->ScsiPassThru.Mode->IoAlign != 1)) {
if (((UINTN)Packet->SenseData % AtapiScsiPrivate->ScsiPassThru.Mode->IoAlign) != 0) {
return EFI_INVALID_PARAMETER;
}
}
// //
// Return SenseData if PacketCommandStatus matches // Return SenseData if PacketCommandStatus matches
// the following return codes. // the following return codes.
// //
if ((PacketCommandStatus == EFI_WARN_BUFFER_TOO_SMALL) || if ((PacketCommandStatus == EFI_BAD_BUFFER_SIZE) ||
(PacketCommandStatus == EFI_DEVICE_ERROR) || (PacketCommandStatus == EFI_DEVICE_ERROR) ||
(PacketCommandStatus == EFI_TIMEOUT)) { (PacketCommandStatus == EFI_TIMEOUT)) {
@ -1096,18 +1306,25 @@ AtapiPacketCommand (
EFI_STATUS Status; EFI_STATUS Status;
// //
// Set all the command parameters by fill related registers. // Check if the buffer meets the alignment requirement.
// Before write to all the following registers, BSY and DRQ must be 0.
// //
Status = StatusDRQClear (AtapiScsiPrivate, TimeoutInMicroSeconds); if ((AtapiScsiPrivate->ScsiPassThru.Mode->IoAlign != 0) \
if (EFI_ERROR (Status)) { && (AtapiScsiPrivate->ScsiPassThru.Mode->IoAlign != 1)) {
if (Status == EFI_ABORTED) { if (((UINTN)Buffer % AtapiScsiPrivate->ScsiPassThru.Mode->IoAlign) != 0) {
Status = EFI_DEVICE_ERROR; return EFI_INVALID_PARAMETER;
} }
*ByteCount = 0;
return Status;
} }
//
// Set all the command parameters by fill related registers.
// Before write to all the following registers, BSY must be 0.
//
Status = StatusWaitForBSYClear (AtapiScsiPrivate, TimeoutInMicroSeconds);
if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
}
// //
// Select device via Device/Head Register. // Select device via Device/Head Register.
// "Target = 0" indicates device 0; "Target = 1" indicates device 1 // "Target = 0" indicates device 0; "Target = 1" indicates device 1
@ -1118,6 +1335,20 @@ AtapiPacketCommand (
(UINT8) ((Target << 4) | DEFAULT_CMD) // DEFAULT_CMD: 0xa0 (1010,0000) (UINT8) ((Target << 4) | DEFAULT_CMD) // DEFAULT_CMD: 0xa0 (1010,0000)
); );
//
// Set all the command parameters by fill related registers.
// Before write to all the following registers, BSY DRQ must be 0.
//
Status = StatusDRQClear(AtapiScsiPrivate, TimeoutInMicroSeconds);
if (EFI_ERROR (Status)) {
if (Status == EFI_ABORTED) {
Status = EFI_DEVICE_ERROR;
}
*ByteCount = 0;
return Status;
}
// //
// No OVL; No DMA (by setting feature register) // No OVL; No DMA (by setting feature register)
// //
@ -1282,7 +1513,7 @@ AtapiPassThruPioReadWriteData (
// ActualWordCount > 0 // ActualWordCount > 0
// //
if (ActualWordCount < RequiredWordCount) { if (ActualWordCount < RequiredWordCount) {
return EFI_WARN_BUFFER_TOO_SMALL; return EFI_BAD_BUFFER_SIZE;
} }
} }
// //

View File

@ -56,6 +56,28 @@ typedef union {
UINT16 DeviceControl; /* when write */ UINT16 DeviceControl; /* when write */
} IDE_AltStatus_OR_DeviceControl; } IDE_AltStatus_OR_DeviceControl;
typedef enum {
IdePrimary = 0,
IdeSecondary = 1,
IdeMaxChannel = 2
} EFI_IDE_CHANNEL;
///
//
// Bit definitions in Programming Interface byte of the Class Code field
// in PCI IDE controller's Configuration Space
//
#define IDE_PRIMARY_OPERATING_MODE BIT0
#define IDE_PRIMARY_PROGRAMMABLE_INDICATOR BIT1
#define IDE_SECONDARY_OPERATING_MODE BIT2
#define IDE_SECONDARY_PROGRAMMABLE_INDICATOR BIT3
#define ATAPI_MAX_CHANNEL 2
/// ///
/// IDE registers set /// IDE registers set
/// ///
@ -68,36 +90,37 @@ typedef struct {
UINT16 CylinderMsb; UINT16 CylinderMsb;
UINT16 Head; UINT16 Head;
IDE_CMD_OR_STATUS Reg; IDE_CMD_OR_STATUS Reg;
IDE_AltStatus_OR_DeviceControl Alt; IDE_AltStatus_OR_DeviceControl Alt;
UINT16 DriveAddress; UINT16 DriveAddress;
UINT16 MasterSlave;
} IDE_BASE_REGISTERS; } IDE_BASE_REGISTERS;
#define ATAPI_SCSI_PASS_THRU_DEV_SIGNATURE EFI_SIGNATURE_32 ('a', 's', 'p', 't') #define ATAPI_SCSI_PASS_THRU_DEV_SIGNATURE EFI_SIGNATURE_32 ('a', 's', 'p', 't')
typedef struct { typedef struct {
UINTN Signature; UINTN Signature;
EFI_HANDLE Handle;
EFI_HANDLE Handle; EFI_SCSI_PASS_THRU_PROTOCOL ScsiPassThru;
EFI_SCSI_PASS_THRU_PROTOCOL ScsiPassThru; EFI_SCSI_PASS_THRU_MODE ScsiPassThruMode;
EFI_SCSI_PASS_THRU_MODE ScsiPassThruMode; EFI_PCI_IO_PROTOCOL *PciIo;
EFI_PCI_IO_PROTOCOL *PciIo;
// //
// Local Data goes here // Local Data goes here
// //
IDE_BASE_REGISTERS *IoPort; IDE_BASE_REGISTERS *IoPort;
IDE_BASE_REGISTERS AtapiIoPortRegisters[2];
CHAR16 ControllerName[100]; CHAR16 ControllerName[100];
CHAR16 ChannelName[100]; CHAR16 ChannelName[100];
UINT32 LatestTargetId;
UINT32 LatestTargetId; UINT64 LatestLun;
UINT64 LatestLun;
} ATAPI_SCSI_PASS_THRU_DEV; } ATAPI_SCSI_PASS_THRU_DEV;
//
// IDE registers' base addresses
//
typedef struct {
UINT16 CommandBlockBaseAddr;
UINT16 ControlBlockBaseAddr;
} IDE_REGISTERS_BASE_ADDR;
#define ATAPI_SCSI_PASS_THRU_DEV_FROM_THIS(a) \ #define ATAPI_SCSI_PASS_THRU_DEV_FROM_THIS(a) \
CR (a, \ CR (a, \
ATAPI_SCSI_PASS_THRU_DEV, \ ATAPI_SCSI_PASS_THRU_DEV, \
@ -824,4 +847,51 @@ AtapiPassThruCheckErrorStatus (
ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate
) )
; ;
EFI_STATUS
GetIdeRegistersBaseAddr (
IN EFI_PCI_IO_PROTOCOL *PciIo,
OUT IDE_REGISTERS_BASE_ADDR *IdeRegsBaseAddr
)
/*++
Routine Description:
Get IDE IO port registers' base addresses by mode. In 'Compatibility' mode,
use fixed addresses. In Native-PCI mode, get base addresses from BARs in
the PCI IDE controller's Configuration Space.
Arguments:
PciIo - Pointer to the EFI_PCI_IO_PROTOCOL instance
IdeRegsBaseAddr - Pointer to IDE_REGISTERS_BASE_ADDR to
receive IDE IO port registers' base addresses
Returns:
EFI_STATUS
--*/
;
VOID
InitAtapiIoPortRegisters (
IN ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
IN IDE_REGISTERS_BASE_ADDR *IdeRegsBaseAddr
)
/*++
Routine Description:
Initialize each Channel's Base Address of CommandBlock and ControlBlock.
Arguments:
AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV
IdeRegsBaseAddr - The pointer of IDE_REGISTERS_BASE_ADDR
Returns:
None
--*/
;
#endif #endif

View File

@ -120,7 +120,6 @@ InitializeScsiBus(
); );
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
return Status; return Status;
} }
@ -231,124 +230,156 @@ Returns:
EFI_DEVICE_ERROR - This driver cannot be started due to device Error EFI_DEVICE_ERROR - This driver cannot be started due to device Error
--*/ --*/
// TODO: This - add argument and description to function comment
// TODO: Controller - add argument and description to function comment
// TODO: RemainingDevicePath - add argument and description to function comment
{ {
EFI_STATUS Status; UINT64 Lun;
UINT64 Lun; UINT8 *TargetId;
BOOLEAN ScanOtherPuns; BOOLEAN ScanOtherPuns;
SCSI_BUS_DEVICE *ScsiBusDev; BOOLEAN FromFirstTarget;
BOOLEAN FromFirstTarget; BOOLEAN ExtScsiSupport;
SCSI_TARGET_ID *ScsiTargetId; EFI_STATUS Status;
UINT8 *TargetId; EFI_STATUS DevicePathStatus;
EFI_STATUS PassThruStatus;
SCSI_BUS_DEVICE *ScsiBusDev;
SCSI_TARGET_ID *ScsiTargetId;
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
EFI_SCSI_PASS_THRU_PROTOCOL *ScsiInterface;
EFI_EXT_SCSI_PASS_THRU_PROTOCOL *ExtScsiInterface;
EFI_SCSI_BUS_PROTOCOL *BusIdentify;
TargetId = NULL; TargetId = NULL;
ScanOtherPuns = TRUE; ScsiTargetId = NULL;
ScanOtherPuns = TRUE;
FromFirstTarget = FALSE; FromFirstTarget = FALSE;
// ExtScsiSupport = FALSE;
// Allocate SCSI_BUS_DEVICE structure PassThruStatus = EFI_SUCCESS;
//
ScsiBusDev = NULL; ScsiTargetId = AllocateZeroPool(sizeof(SCSI_TARGET_ID));
ScsiBusDev = AllocateZeroPool (sizeof (SCSI_BUS_DEVICE));
if (ScsiBusDev == NULL) {
return EFI_OUT_OF_RESOURCES;
}
ScsiTargetId = NULL;
ScsiTargetId = AllocateZeroPool (sizeof (SCSI_TARGET_ID));
if (ScsiTargetId == NULL) { if (ScsiTargetId == NULL) {
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
} }
TargetId = &ScsiTargetId->ScsiId.ExtScsi[0]; TargetId = &ScsiTargetId->ScsiId.ExtScsi[0];
Status = gBS->OpenProtocol ( DevicePathStatus = gBS->OpenProtocol (
Controller, Controller,
&gEfiDevicePathProtocolGuid, &gEfiDevicePathProtocolGuid,
(VOID **) &(ScsiBusDev->DevicePath), (VOID **) &ParentDevicePath,
This->DriverBindingHandle, This->DriverBindingHandle,
Controller, Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER EFI_OPEN_PROTOCOL_BY_DRIVER
); );
if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) { if (EFI_ERROR (DevicePathStatus) && (DevicePathStatus != EFI_ALREADY_STARTED)) {
gBS->FreePool (ScsiBusDev); return DevicePathStatus;
return Status;
} }
// //
// First consume Extended SCSI Pass Thru protocol, if fail, then consume // To keep backward compatibility, UEFI ExtPassThru Protocol is supported as well as
// SCSI Pass Thru protocol // EFI PassThru Protocol. From priority perspective, ExtPassThru Protocol is firstly
// tried to open on host controller handle. If fails, then PassThru Protocol is tried instead.
// //
Status = gBS->OpenProtocol ( Status = gBS->OpenProtocol (
Controller, Controller,
&gEfiExtScsiPassThruProtocolGuid, &gEfiExtScsiPassThruProtocolGuid,
(VOID **) &(ScsiBusDev->ExtScsiInterface), (VOID **) &ExtScsiInterface,
This->DriverBindingHandle, This->DriverBindingHandle,
Controller, Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER EFI_OPEN_PROTOCOL_BY_DRIVER
); );
if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) { //
// Fail to open UEFI ExtendPassThru Protocol, then try to open EFI PassThru Protocol instead.
//
if (EFI_ERROR(Status) && (Status != EFI_ALREADY_STARTED)) {
Status = gBS->OpenProtocol ( Status = gBS->OpenProtocol (
Controller, Controller,
&gEfiScsiPassThruProtocolGuid, &gEfiScsiPassThruProtocolGuid,
(VOID **) &(ScsiBusDev->ScsiInterface), (VOID **) &ScsiInterface,
This->DriverBindingHandle, This->DriverBindingHandle,
Controller, Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER EFI_OPEN_PROTOCOL_BY_DRIVER
); );
if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) { //
gBS->CloseProtocol ( // Fail to open EFI PassThru Protocol, Close the DevicePathProtocol if it is opened by this time.
Controller, //
&gEfiDevicePathProtocolGuid, if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) {
This->DriverBindingHandle, if (!EFI_ERROR(DevicePathStatus)) {
Controller gBS->CloseProtocol (
); Controller,
gBS->FreePool (ScsiBusDev); &gEfiDevicePathProtocolGuid,
This->DriverBindingHandle,
Controller
);
}
return Status;
}
} else {
//
// Succeed to open ExtPassThru Protocol, and meanwhile open PassThru Protocol
// with BY_DRIVER if it is also present on the handle. The intent is to prevent
// another SCSI Bus Driver to work on the same host handle.
//
ExtScsiSupport = TRUE;
PassThruStatus = gBS->OpenProtocol (
Controller,
&gEfiScsiPassThruProtocolGuid,
(VOID **) &ScsiInterface,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
}
if (Status != EFI_ALREADY_STARTED) {
//
// Go through here means either ExtPassThru or PassThru Protocol is successfully opened
// on this handle for this time. Then construct Host controller private data.
//
ScsiBusDev = NULL;
ScsiBusDev = AllocateZeroPool(sizeof(SCSI_BUS_DEVICE));
if (ScsiBusDev == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto ErrorExit;
}
ScsiBusDev->Signature = SCSI_BUS_DEVICE_SIGNATURE;
ScsiBusDev->ExtScsiSupport = ExtScsiSupport;
ScsiBusDev->DevicePath = ParentDevicePath;
if (ScsiBusDev->ExtScsiSupport) {
ScsiBusDev->ExtScsiInterface = ExtScsiInterface;
} else {
ScsiBusDev->ScsiInterface = ScsiInterface;
}
//
// Install EFI_SCSI_BUS_PROTOCOL to the controller handle, So ScsiBusDev could be
// retrieved on this controller handle. With ScsiBusDev, we can know which PassThru
// Protocol is present on the handle, UEFI ExtPassThru Protocol or EFI PassThru Protocol.
//
Status = gBS->InstallProtocolInterface (
&Controller,
&mScsiBusProtocolGuid,
EFI_NATIVE_INTERFACE,
&ScsiBusDev->BusIdentify
);
if (EFI_ERROR (Status)) {
goto ErrorExit;
}
} else {
//
// Go through here means Start() is re-invoked again, nothing special is required to do except
// picking up Host controller private information.
//
Status = gBS->OpenProtocol (
Controller,
&mScsiBusProtocolGuid,
(VOID **) &BusIdentify,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
return Status; return Status;
} }
DEBUG ((EFI_D_INFO, "Open Scsi Pass Thrugh Protocol\n")); ScsiBusDev = SCSI_BUS_CONTROLLER_DEVICE_FROM_THIS (BusIdentify);
ScsiBusDev->ExtScsiSupport = FALSE;
} else {
DEBUG ((EFI_D_INFO, "Open Extended Scsi Pass Thrugh Protocol\n"));
ScsiBusDev->ExtScsiSupport = TRUE;
}
ScsiBusDev->Signature = SCSI_BUS_DEVICE_SIGNATURE;
//
// Attach EFI_SCSI_BUS_PROTOCOL to controller handle
//
Status = gBS->InstallProtocolInterface (
&Controller,
&mScsiBusProtocolGuid,
EFI_NATIVE_INTERFACE,
&ScsiBusDev->BusIdentify
);
if (EFI_ERROR (Status)) {
gBS->CloseProtocol (
Controller,
&gEfiDevicePathProtocolGuid,
This->DriverBindingHandle,
Controller
);
if (ScsiBusDev->ExtScsiSupport) {
gBS->CloseProtocol (
Controller,
&gEfiExtScsiPassThruProtocolGuid,
This->DriverBindingHandle,
Controller
);
} else {
gBS->CloseProtocol (
Controller,
&gEfiScsiPassThruProtocolGuid,
This->DriverBindingHandle,
Controller
);
}
gBS->FreePool (ScsiBusDev);
return Status;
} }
if (RemainingDevicePath == NULL) { if (RemainingDevicePath == NULL) {
@ -357,7 +388,7 @@ Returns:
FromFirstTarget = TRUE; FromFirstTarget = TRUE;
} else { } else {
if (ScsiBusDev->ExtScsiSupport) { if (ScsiBusDev->ExtScsiSupport) {
ScsiBusDev->ExtScsiInterface->GetTargetLun (ScsiBusDev->ExtScsiInterface, RemainingDevicePath, &TargetId, &Lun); ScsiBusDev->ExtScsiInterface->GetTargetLun (ScsiBusDev->ExtScsiInterface, RemainingDevicePath, &TargetId, &Lun);
} else { } else {
ScsiBusDev->ScsiInterface->GetTargetLun (ScsiBusDev->ScsiInterface, RemainingDevicePath, &ScsiTargetId->ScsiId.Scsi, &Lun); ScsiBusDev->ScsiInterface->GetTargetLun (ScsiBusDev->ScsiInterface, RemainingDevicePath, &ScsiTargetId->ScsiId.Scsi, &Lun);
} }
@ -401,6 +432,38 @@ Returns:
// //
Status = ScsiScanCreateDevice (This, Controller, ScsiTargetId, Lun, ScsiBusDev); Status = ScsiScanCreateDevice (This, Controller, ScsiTargetId, Lun, ScsiBusDev);
} }
gBS->FreePool (ScsiTargetId);
return EFI_SUCCESS;
ErrorExit:
if (ScsiBusDev != NULL) {
gBS->FreePool (ScsiBusDev);
}
if (ExtScsiSupport) {
gBS->CloseProtocol (
Controller,
&gEfiExtScsiPassThruProtocolGuid,
This->DriverBindingHandle,
Controller
);
if (!EFI_ERROR (PassThruStatus)) {
gBS->CloseProtocol (
Controller,
&gEfiScsiPassThruProtocolGuid,
This->DriverBindingHandle,
Controller
);
}
} else {
gBS->CloseProtocol (
Controller,
&gEfiScsiPassThruProtocolGuid,
This->DriverBindingHandle,
Controller
);
}
return Status; return Status;
} }
@ -414,20 +477,23 @@ SCSIBusDriverBindingStop (
) )
/*++ /*++
Routine Description: Routine Description:
Arguments: Stop this driver on ControllerHandle. Support stoping any child handles
created by this driver.
Returns: 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
--*/ --*/
// TODO: This - add argument and description to function comment
// TODO: Controller - add argument and description to function comment
// TODO: NumberOfChildren - add argument and description to function comment
// TODO: ChildHandleBuffer - add argument and description to function comment
// TODO: EFI_SUCCESS - add return value to function comment
// TODO: EFI_DEVICE_ERROR - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{ {
EFI_STATUS Status; EFI_STATUS Status;
BOOLEAN AllChildrenStopped; BOOLEAN AllChildrenStopped;
@ -582,17 +648,21 @@ ScsiGetDeviceType (
) )
/*++ /*++
Routine Description: Routine Description:
Retrieves the device type information of the SCSI Controller.
Arguments: Retrieves the device type information of the SCSI Controller.
This - Protocol instance pointer.
DeviceType - A pointer to the device type information Arguments:
retrieved from the SCSI Controller.
Returns: This - Protocol instance pointer.
EFI_SUCCESS - Retrieves the device type information successfully. DeviceType - A pointer to the device type information
EFI_INVALID_PARAMETER - The DeviceType is NULL. 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; SCSI_IO_DEV *ScsiIoDevice;
@ -614,19 +684,24 @@ ScsiGetDeviceLocation (
OUT UINT64 *Lun OUT UINT64 *Lun
) )
/*++ /*++
Routine Description:
Retrieves the device location in the SCSI channel.
Arguments: Routine Description:
This - Protocol instance pointer.
Target - A pointer to the Target ID of a SCSI device Retrieves the device location in the SCSI channel.
on the SCSI channel.
Lun - A pointer to the LUN of the SCSI device on Arguments:
the SCSI channel.
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.
Returns:
EFI_SUCCESS - Retrieves the device location successfully.
EFI_INVALID_PARAMETER - The Target or Lun is NULL.
--*/ --*/
{ {
SCSI_IO_DEV *ScsiIoDevice; SCSI_IO_DEV *ScsiIoDevice;
@ -635,11 +710,11 @@ ScsiGetDeviceLocation (
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
ScsiIoDevice = SCSI_IO_DEV_FROM_THIS (This); ScsiIoDevice = SCSI_IO_DEV_FROM_THIS (This);
CopyMem (*Target,&ScsiIoDevice->Pun, TARGET_MAX_BYTES); CopyMem (*Target,&ScsiIoDevice->Pun, TARGET_MAX_BYTES);
*Lun = ScsiIoDevice->Lun; *Lun = ScsiIoDevice->Lun;
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -651,19 +726,22 @@ ScsiResetBus (
) )
/*++ /*++
Routine Description: Routine Description:
Resets the SCSI Bus that the SCSI Controller is attached to.
Arguments: Resets the SCSI Bus that the SCSI Controller is attached to.
This - Protocol instance pointer.
Arguments:
Returns: This - Protocol instance pointer.
EFI_SUCCESS - The SCSI bus is reset successfully.
EFI_DEVICE_ERROR - Errors encountered when resetting the SCSI bus. Returns:
EFI_UNSUPPORTED - The bus reset operation is not supported by the
SCSI Host Controller. EFI_SUCCESS - The SCSI bus is reset successfully.
EFI_TIMEOUT - A timeout occurred while attempting to reset EFI_DEVICE_ERROR - Errors encountered when resetting the SCSI bus.
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; SCSI_IO_DEV *ScsiIoDevice;
@ -684,24 +762,26 @@ ScsiResetDevice (
) )
/*++ /*++
Routine Description: Routine Description:
Resets the SCSI Controller that the device handle specifies.
Arguments: Resets the SCSI Controller that the device handle specifies.
This - Protocol instance pointer.
Arguments:
This - Protocol instance pointer.
Returns:
Returns: EFI_SUCCESS - Reset the SCSI controller successfully.
EFI_SUCCESS - Reset the SCSI controller successfully. EFI_DEVICE_ERROR - Errors are encountered when resetting the
EFI_DEVICE_ERROR - Errors are encountered when resetting the SCSI Controller.
SCSI Controller. EFI_UNSUPPORTED - The SCSI bus does not support a device
EFI_UNSUPPORTED - The SCSI bus does not support a device reset operation.
reset operation. EFI_TIMEOUT - A timeout occurred while attempting to
EFI_TIMEOUT - A timeout occurred while attempting to reset the SCSI Controller.
reset the SCSI Controller.
--*/ --*/
{ {
SCSI_IO_DEV *ScsiIoDevice; SCSI_IO_DEV *ScsiIoDevice;
UINT8 Target[TARGET_MAX_BYTES]; UINT8 Target[TARGET_MAX_BYTES];
ScsiIoDevice = SCSI_IO_DEV_FROM_THIS (This); ScsiIoDevice = SCSI_IO_DEV_FROM_THIS (This);
@ -732,64 +812,67 @@ ScsiExecuteSCSICommand (
) )
/*++ /*++
Routine Description: Routine Description:
Sends a SCSI Request Packet to the SCSI Controller for execution.
Arguments: Sends a SCSI Request Packet to the SCSI Controller for execution.
This - Protocol instance pointer.
Packet - The SCSI request packet to send to the SCSI Arguments:
Controller specified by the device handle.
Event - If the SCSI bus where the SCSI device is attached This - Protocol instance pointer.
does not support non-blocking I/O, then Event is Packet - The SCSI request packet to send to the SCSI
ignored, and blocking I/O is performed. Controller specified by the device handle.
If Event is NULL, then blocking I/O is performed. Event - If the SCSI bus where the SCSI device is attached
If Event is not NULL and non-blocking I/O is does not support non-blocking I/O, then Event is
supported, then non-blocking I/O is performed, ignored, and blocking I/O is performed.
and Event will be signaled when the SCSI Request If Event is NULL, then blocking I/O is performed.
Packet completes. If Event is not NULL and non-blocking I/O is
Returns: supported, then non-blocking I/O is performed,
EFI_SUCCESS - The SCSI Request Packet was sent by the host and Event will be signaled when the SCSI Request
successfully, and TransferLength bytes were Packet completes.
transferred to/from DataBuffer.See Returns:
HostAdapterStatus, TargetStatus,
SenseDataLength, and SenseData in that order EFI_SUCCESS - The SCSI Request Packet was sent by the host
for additional status information. successfully, and TransferLength bytes were
EFI_WARN_BUFFER_TOO_SMALL - The SCSI Request Packet was executed, transferred to/from DataBuffer.See
but the entire DataBuffer could not be transferred. HostAdapterStatus, TargetStatus,
The actual number of bytes transferred is returned SenseDataLength, and SenseData in that order
in TransferLength. See HostAdapterStatus, for additional status information.
TargetStatus, SenseDataLength, and SenseData in EFI_BAD_BUFFER_SIZE - The SCSI Request Packet was executed,
that order for additional status information. but the entire DataBuffer could not be transferred.
EFI_NOT_READY - The SCSI Request Packet could not be sent because The actual number of bytes transferred is returned
there are too many SCSI Command Packets already in TransferLength. See HostAdapterStatus,
queued.The caller may retry again later. TargetStatus, SenseDataLength, and SenseData in
EFI_DEVICE_ERROR - A device error occurred while attempting to send that order for additional status information.
the SCSI Request Packet. See HostAdapterStatus, EFI_NOT_READY - The SCSI Request Packet could not be sent because
TargetStatus, SenseDataLength, and SenseData in there are too many SCSI Command Packets already
that order for additional status information. queued.The caller may retry again later.
EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid. EFI_DEVICE_ERROR - A device error occurred while attempting to send
The SCSI Request Packet was not sent, so no the SCSI Request Packet. See HostAdapterStatus,
additional status information is available. TargetStatus, SenseDataLength, and SenseData in
EFI_UNSUPPORTED - The command described by the SCSI Request Packet that order for additional status information.
is not supported by the SCSI initiator(i.e., SCSI EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid.
Host Controller). The SCSI Request Packet was not The SCSI Request Packet was not sent, so no
sent, so no additional status information is additional status information is available.
available. EFI_UNSUPPORTED - The command described by the SCSI Request Packet
EFI_TIMEOUT - A timeout occurred while waiting for the SCSI is not supported by the SCSI initiator(i.e., SCSI
Request Packet to execute. See HostAdapterStatus, Host Controller). The SCSI Request Packet was not
TargetStatus, SenseDataLength, and SenseData in sent, so no additional status information is
that order for additional status information. 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.
--*/ --*/
{ {
SCSI_IO_DEV *ScsiIoDevice; SCSI_IO_DEV *ScsiIoDevice;
EFI_STATUS Status; EFI_STATUS Status;
UINT8 Target[TARGET_MAX_BYTES]; UINT8 Target[TARGET_MAX_BYTES];
EFI_EVENT PacketEvent; EFI_EVENT PacketEvent;
EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *ExtRequestPacket; EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *ExtRequestPacket;
SCSI_EVENT_DATA EventData; SCSI_EVENT_DATA EventData;
PacketEvent = NULL; PacketEvent = NULL;
if (Packet == NULL) { if (Packet == NULL) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }

View File

@ -18,9 +18,8 @@ Abstract:
Header file for SCSI Bus Driver. Header file for SCSI Bus Driver.
Revision History Revision History
++*/ --*/
// TODO: fix comment to end with --*/
#ifndef _SCSI_BUS_H #ifndef _SCSI_BUS_H
#define _SCSI_BUS_H #define _SCSI_BUS_H
@ -325,77 +324,16 @@ DiscoverScsiDevice (
Routine Description: Routine Description:
TODO: Add function description Discovery SCSI Device
Arguments: Arguments:
ScsiIoDevice - TODO: add argument description ScsiIoDevice - The pointer of SCSI_IO_DEV
Returns: Returns:
TODO: add return values TRUE - Find SCSI Device and verify it.
FALSE - Unable to find SCSI Device.
--*/
;
EFI_STATUS
GetLunList (
EFI_SCSI_PASS_THRU_PROTOCOL *ScsiPassThru,
UINT32 Target,
UINT64 **LunArray,
UINTN *NumberOfLuns
)
/*++
Routine Description:
TODO: Add function description
Arguments:
ScsiPassThru - TODO: add argument description
Target - TODO: add argument description
LunArray - TODO: add argument description
NumberOfLuns - TODO: add argument description
Returns:
TODO: add return values
--*/
;
EFI_STATUS
ScsiBusSubmitReportLunCommand (
EFI_SCSI_PASS_THRU_PROTOCOL *ScsiPassThru,
UINT32 Target,
UINTN AllocationLength,
VOID *Buffer,
EFI_SCSI_SENSE_DATA *SenseData,
UINT8 *SenseDataLength,
UINT8 *HostAdapterStatus,
UINT8 *TargetStatus
)
/*++
Routine Description:
TODO: Add function description
Arguments:
ScsiPassThru - TODO: add argument description
Target - TODO: add argument description
AllocationLength - TODO: add argument description
Buffer - TODO: add argument description
SenseData - TODO: add argument description
SenseDataLength - TODO: add argument description
HostAdapterStatus - TODO: add argument description
TargetStatus - TODO: add argument description
Returns:
TODO: add return values
--*/ --*/
; ;

View File

@ -1,6 +1,6 @@
/*++ /*++
Copyright (c) 2006, Intel Corporation Copyright (c) 2004 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
/*++ /*++
Copyright (c) 2006, Intel Corporation Copyright (c) 2004 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -119,16 +119,16 @@ ScsiDiskReset (
Routine Description: Routine Description:
TODO: Add function description Reset SCSI Disk
Arguments: Arguments:
This - TODO: add argument description This - The pointer of EFI_BLOCK_IO_PROTOCOL
ExtendedVerification - TODO: add argument description ExtendedVerification - The flag about if extend verificate
Returns: Returns:
TODO: add return values EFI_STATUS
--*/ --*/
; ;
@ -146,19 +146,24 @@ ScsiDiskReadBlocks (
Routine Description: Routine Description:
TODO: Add function description The function is to Read Block from SCSI Disk
Arguments: Arguments:
This - TODO: add argument description This - The pointer of EFI_BLOCK_IO_PROTOCOL
MediaId - TODO: add argument description MediaId - The Id of Media detected
LBA - TODO: add argument description LBA - The logic block address
BufferSize - TODO: add argument description BufferSize - The size of Buffer
Buffer - TODO: add argument description Buffer - The buffer to fill the read out data
Returns: Returns:
TODO: add return values 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.
--*/ --*/
; ;
@ -176,19 +181,24 @@ ScsiDiskWriteBlocks (
Routine Description: Routine Description:
TODO: Add function description The function is to Write Block to SCSI Disk
Arguments: Arguments:
This - TODO: add argument description This - The pointer of EFI_BLOCK_IO_PROTOCOL
MediaId - TODO: add argument description MediaId - The Id of Media detected
LBA - TODO: add argument description LBA - The logic block address
BufferSize - TODO: add argument description BufferSize - The size of Buffer
Buffer - TODO: add argument description Buffer - The buffer to fill the read out data
Returns: Returns:
TODO: add return values 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.
--*/ --*/
; ;
@ -202,15 +212,15 @@ ScsiDiskFlushBlocks (
Routine Description: Routine Description:
TODO: Add function description Flush Block to Disk
Arguments: Arguments:
This - TODO: add argument description This - The pointer of EFI_BLOCK_IO_PROTOCOL
Returns: Returns:
TODO: add return values EFI_SUCCESS
--*/ --*/
; ;
@ -225,44 +235,48 @@ ScsiDiskDetectMedia (
Routine Description: Routine Description:
TODO: Add function description Dectect Device and read out capacity ,if error occurs, parse the sense key.
Arguments: Arguments:
ScsiDiskDevice - TODO: add argument description ScsiDiskDevice - The pointer of SCSI_DISK_DEV
MustReadCap - TODO: add argument description MustReadCapacity - The flag about reading device capacity
MediaChange - TODO: add argument description MediaChange - The pointer of flag indicates if media has changed
Returns: Returns:
TODO: add return values EFI_DEVICE_ERROR - Indicates that error occurs
EFI_SUCCESS - Successfully to detect media
--*/ --*/
; ;
EFI_STATUS EFI_STATUS
ScsiDiskTestUnitReady ( ScsiDiskTestUnitReady (
SCSI_DISK_DEV *ScsiDiskDevice, SCSI_DISK_DEV *ScsiDiskDevice,
BOOLEAN *NeedRetry, BOOLEAN *NeedRetry,
EFI_SCSI_SENSE_DATA **SenseDataArray, EFI_SCSI_SENSE_DATA **SenseDataArray,
UINTN *NumberOfSenseKeys UINTN *NumberOfSenseKeys
) )
/*++ /*++
Routine Description: Routine Description:
TODO: Add function description 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: Arguments:
ScsiDiskDevice - TODO: add argument description ScsiDiskDevice - The pointer of SCSI_DISK_DEV
NeedRetry - TODO: add argument description NeedRetry - The pointer of flag indicates try again
SenseDataArray - TODO: add argument description SenseDataArray - The pointer of an array of sense data
NumberOfSenseKeys - TODO: add argument description NumberOfSenseKeys - The pointer of the number of sense data array
Returns: Returns:
TODO: add return values EFI_DEVICE_ERROR - Indicates that error occurs
EFI_SUCCESS - Successfully to test unit
--*/ --*/
; ;
@ -278,45 +292,47 @@ DetectMediaParsingSenseKeys (
Routine Description: Routine Description:
TODO: Add function description Parsing Sense Keys which got from request sense command.
Arguments: Arguments:
ScsiDiskDevice - TODO: add argument description ScsiDiskDevice - The pointer of SCSI_DISK_DEV
SenseData - TODO: add argument description SenseData - The pointer of EFI_SCSI_SENSE_DATA
NumberOfSenseKeys - TODO: add argument description NumberOfSenseKeys - The number of sense key
Action - TODO: add argument description Action - The pointer of action which indicates what is need to do next
Returns: Returns:
TODO: add return values EFI_DEVICE_ERROR - Indicates that error occurs
EFI_SUCCESS - Successfully to complete the parsing
--*/ --*/
; ;
EFI_STATUS EFI_STATUS
ScsiDiskReadCapacity ( ScsiDiskReadCapacity (
SCSI_DISK_DEV *ScsiDiskDevice, SCSI_DISK_DEV *ScsiDiskDevice,
BOOLEAN *NeedRetry, BOOLEAN *NeedRetry,
EFI_SCSI_SENSE_DATA **SenseDataArray, EFI_SCSI_SENSE_DATA **SenseDataArray,
UINTN *NumberOfSenseKeys UINTN *NumberOfSenseKeys
) )
/*++ /*++
Routine Description: Routine Description:
TODO: Add function description Send read capacity command to device and get the device parameter
Arguments: Arguments:
ScsiDiskDevice - TODO: add argument description ScsiDiskDevice - The pointer of SCSI_DISK_DEV
NeedRetry - TODO: add argument description NeedRetry - The pointer of flag indicates if need a retry
SenseDataArray - TODO: add argument description SenseDataArray - The pointer of an array of sense data
NumberOfSenseKeys - TODO: add argument description NumberOfSenseKeys - The number of sense key
Returns: Returns:
TODO: add return values EFI_DEVICE_ERROR - Indicates that error occurs
EFI_SUCCESS - Successfully to read capacity
--*/ --*/
; ;
@ -329,15 +345,18 @@ CheckHostAdapterStatus (
Routine Description: Routine Description:
TODO: Add function description Check the HostAdapter status
Arguments: Arguments:
HostAdapterStatus - TODO: add argument description HostAdapterStatus - Host Adapter status
Returns: Returns:
TODO: add return values EFI_SUCCESS
EFI_TIMEOUT
EFI_NOT_READY
EFI_DEVICE_ERROR
--*/ --*/
; ;
@ -350,15 +369,17 @@ CheckTargetStatus (
Routine Description: Routine Description:
TODO: Add function description Check the target status
Arguments: Arguments:
TargetStatus - TODO: add argument description TargetStatus - Target status
Returns: Returns:
TODO: add return values EFI_NOT_READY
EFI_DEVICE_ERROR
EFI_SUCCESS
--*/ --*/
; ;
@ -375,19 +396,25 @@ ScsiDiskRequestSenseKeys (
Routine Description: Routine Description:
TODO: Add function 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: Arguments:
ScsiDiskDevice - TODO: add argument description ScsiDiskDevice - The pointer of SCSI_DISK_DEV
NeedRetry - TODO: add argument description NeedRetry - The pointer of flag indicates if need a retry
SenseDataArray - TODO: add argument description SenseDataArray - The pointer of an array of sense data
NumberOfSenseKeys - TODO: add argument description NumberOfSenseKeys - The number of sense key
AskResetIfError - TODO: add argument description AskResetIfError - The flag indicates if need reset when error occurs
Returns: Returns:
TODO: add return values EFI_DEVICE_ERROR - Indicates that error occurs
EFI_SUCCESS - Successfully to request sense key
--*/ --*/
; ;
@ -401,16 +428,17 @@ ScsiDiskInquiryDevice (
Routine Description: Routine Description:
TODO: Add function description Send out Inquiry command to Device
Arguments: Arguments:
ScsiDiskDevice - TODO: add argument description ScsiDiskDevice - The pointer of SCSI_DISK_DEV
NeedRetry - TODO: add argument description NeedRetry - Indicates if needs try again when error happens
Returns: Returns:
TODO: add return values EFI_DEVICE_ERROR - Indicates that error occurs
EFI_SUCCESS - Successfully to detect media
--*/ --*/
; ;
@ -423,15 +451,15 @@ ParseInquiryData (
Routine Description: Routine Description:
TODO: Add function description Parse Inquiry data
Arguments: Arguments:
ScsiDiskDevice - TODO: add argument description ScsiDiskDevice - The pointer of SCSI_DISK_DEV
Returns: Returns:
TODO: add return values NONE
--*/ --*/
; ;
@ -447,18 +475,19 @@ ScsiDiskReadSectors (
Routine Description: Routine Description:
TODO: Add function description Read sector from SCSI Disk
Arguments: Arguments:
ScsiDiskDevice - TODO: add argument description ScsiDiskDevice - The poiniter of SCSI_DISK_DEV
Buffer - TODO: add argument description Buffer - The buffer to fill in the read out data
Lba - TODO: add argument description Lba - Logic block address
NumberOfBlocks - TODO: add argument description NumberOfBlocks - The number of blocks to read
Returns: Returns:
TODO: add return values EFI_DEVICE_ERROR
EFI_SUCCESS
--*/ --*/
; ;
@ -474,18 +503,19 @@ ScsiDiskWriteSectors (
Routine Description: Routine Description:
TODO: Add function description Write SCSI Disk sectors
Arguments: Arguments:
ScsiDiskDevice - TODO: add argument description ScsiDiskDevice - The pointer of SCSI_DISK_DEV
Buffer - TODO: add argument description Buffer - The data buffer to write sector
Lba - TODO: add argument description Lba - Logic block address
NumberOfBlocks - TODO: add argument description NumberOfBlocks - The number of blocks to write
Returns: Returns:
TODO: add return values EFI_DEVICE_ERROR
EFI_SUCCESS
--*/ --*/
; ;
@ -506,23 +536,23 @@ ScsiDiskRead10 (
Routine Description: Routine Description:
TODO: Add function description Sumbmit Read command
Arguments: Arguments:
ScsiDiskDevice - TODO: add argument description ScsiDiskDevice - The pointer of ScsiDiskDevice
NeedRetry - TODO: add argument description NeedRetry - The pointer of flag indicates if needs retry if error happens
SenseDataArray - TODO: add argument description SenseDataArray - The pointer of an array of sense data
NumberOfSenseKeys - TODO: add argument description NumberOfSenseKeys - The number of sense key
Timeout - TODO: add argument description Timeout - The time to complete the command
DataBuffer - TODO: add argument description DataBuffer - The buffer to fill with the read out data
DataLength - TODO: add argument description DataLength - The length of buffer
StartLba - TODO: add argument description StartLba - The start logic block address
SectorSize - TODO: add argument description SectorSize - The size of sector
Returns: Returns:
TODO: add return values EFI_STATUS
--*/ --*/
; ;
@ -543,23 +573,23 @@ ScsiDiskWrite10 (
Routine Description: Routine Description:
TODO: Add function description Submit Write Command
Arguments: Arguments:
ScsiDiskDevice - TODO: add argument description ScsiDiskDevice - The pointer of ScsiDiskDevice
NeedRetry - TODO: add argument description NeedRetry - The pointer of flag indicates if needs retry if error happens
SenseDataArray - TODO: add argument description SenseDataArray - The pointer of an array of sense data
NumberOfSenseKeys - TODO: add argument description NumberOfSenseKeys - The number of sense key
Timeout - TODO: add argument description Timeout - The time to complete the command
DataBuffer - TODO: add argument description DataBuffer - The buffer to fill with the read out data
DataLength - TODO: add argument description DataLength - The length of buffer
StartLba - TODO: add argument description StartLba - The start logic block address
SectorSize - TODO: add argument description SectorSize - The size of sector
Returns: Returns:
TODO: add return values EFI_STATUS
--*/ --*/
; ;
@ -573,16 +603,16 @@ GetMediaInfo (
Routine Description: Routine Description:
TODO: Add function description Get information from media read capacity command
Arguments: Arguments:
ScsiDiskDevice - TODO: add argument description ScsiDiskDevice - The pointer of SCSI_DISK_DEV
Capacity - TODO: add argument description Capacity - The pointer of EFI_SCSI_DISK_CAPACITY_DATA
Returns: Returns:
TODO: add return values NONE
--*/ --*/
; ;
@ -596,16 +626,16 @@ ScsiDiskIsNoMedia (
Routine Description: Routine Description:
TODO: Add function description Check sense key to find if media presents
Arguments: Arguments:
SenseData - TODO: add argument description SenseData - The pointer of EFI_SCSI_SENSE_DATA
SenseCounts - TODO: add argument description SenseCounts - The number of sense key
Returns: Returns:
TODO: add return values BOOLEAN
--*/ --*/
; ;
@ -619,16 +649,16 @@ ScsiDiskIsMediaError (
Routine Description: Routine Description:
TODO: Add function description Parse sense key
Arguments: Arguments:
SenseData - TODO: add argument description SenseData - The pointer of EFI_SCSI_SENSE_DATA
SenseCounts - TODO: add argument description SenseCounts - The number of sense key
Returns: Returns:
TODO: add return values BOOLEAN
--*/ --*/
; ;
@ -642,16 +672,16 @@ ScsiDiskIsHardwareError (
Routine Description: Routine Description:
TODO: Add function description Check sense key to find if hardware error happens
Arguments: Arguments:
SenseData - TODO: add argument description SenseData - The pointer of EFI_SCSI_SENSE_DATA
SenseCounts - TODO: add argument description SenseCounts - The number of sense key
Returns: Returns:
TODO: add return values BOOLEAN
--*/ --*/
; ;
@ -665,16 +695,18 @@ ScsiDiskIsMediaChange (
Routine Description: Routine Description:
TODO: Add function description Routine Description:
Check sense key to find if media has changed
Arguments: Arguments:
SenseData - TODO: add argument description SenseData - The pointer of EFI_SCSI_SENSE_DATA
SenseCounts - TODO: add argument description SenseCounts - The number of sense key
Returns: Returns:
TODO: add return values BOOLEAN
--*/ --*/
; ;
@ -688,16 +720,16 @@ ScsiDiskIsResetBefore (
Routine Description: Routine Description:
TODO: Add function description Check sense key to find if reset happens
Arguments: Arguments:
SenseData - TODO: add argument description SenseData - The pointer of EFI_SCSI_SENSE_DATA
SenseCounts - TODO: add argument description SenseCounts - The number of sense key
Returns: Returns:
TODO: add return values BOOLEAN
--*/ --*/
; ;
@ -712,17 +744,17 @@ ScsiDiskIsDriveReady (
Routine Description: Routine Description:
TODO: Add function description Check sense key to find if the drive is ready
Arguments: Arguments:
SenseData - TODO: add argument description SenseData - The pointer of EFI_SCSI_SENSE_DATA
SenseCounts - TODO: add argument description SenseCounts - The number of sense key
NeedRetry - TODO: add argument description RetryLater - The flag means if need a retry
Returns: Returns:
TODO: add return values BOOLEAN
--*/ --*/
; ;
@ -736,16 +768,16 @@ ScsiDiskHaveSenseKey (
Routine Description: Routine Description:
TODO: Add function description Check sense key to find if it has sense key
Arguments: Arguments:
SenseData - TODO: add argument description SenseData - The pointer of EFI_SCSI_SENSE_DATA
SenseCounts - TODO: add argument description SenseCounts - The number of sense key
Returns: Returns:
TODO: add return values BOOLEAN
--*/ --*/
; ;
@ -758,15 +790,15 @@ ReleaseScsiDiskDeviceResources (
Routine Description: Routine Description:
TODO: Add function description Release resource about disk device
Arguments: Arguments:
ScsiDiskDevice - TODO: add argument description ScsiDiskDevice - The pointer of SCSI_DISK_DEV
Returns: Returns:
TODO: add return values NONE
--*/ --*/
; ;