mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-26 15:14:02 +02:00
Introduce tow non-blocking task lists to AtaBus. One maintains the sub-task which is related to running Ata Task and the other is for waiting Ata Task. And it will not pass any task to AtaAtapiPassThru until the previous Ata task has been finished or met error.
Signed-off-by: qianouyang Reviewed-by: czhang46 erictian git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13105 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
be30ddf795
commit
58727f29ea
@ -1,8 +1,8 @@
|
|||||||
/** @file
|
/** @file
|
||||||
This file implements ATA_PASSTHRU_PROCTOCOL and EXT_SCSI_PASSTHRU_PROTOCOL interfaces
|
This file implements ATA_PASSTHRU_PROCTOCOL and EXT_SCSI_PASSTHRU_PROTOCOL interfaces
|
||||||
for managed ATA controllers.
|
for managed ATA controllers.
|
||||||
|
|
||||||
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
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
|
||||||
@ -46,14 +46,14 @@ ATA_ATAPI_PASS_THRU_INSTANCE gAtaAtapiPassThruInstanceTemplate = {
|
|||||||
sizeof (UINTN)
|
sizeof (UINTN)
|
||||||
},
|
},
|
||||||
{ // AtaPassThru
|
{ // AtaPassThru
|
||||||
NULL,
|
NULL,
|
||||||
AtaPassThruPassThru,
|
AtaPassThruPassThru,
|
||||||
AtaPassThruGetNextPort,
|
AtaPassThruGetNextPort,
|
||||||
AtaPassThruGetNextDevice,
|
AtaPassThruGetNextDevice,
|
||||||
AtaPassThruBuildDevicePath,
|
AtaPassThruBuildDevicePath,
|
||||||
AtaPassThruGetDevice,
|
AtaPassThruGetDevice,
|
||||||
AtaPassThruResetPort,
|
AtaPassThruResetPort,
|
||||||
AtaPassThruResetDevice
|
AtaPassThruResetDevice
|
||||||
},
|
},
|
||||||
{ // ExtScsiPassThruMode
|
{ // ExtScsiPassThruMode
|
||||||
//
|
//
|
||||||
@ -65,7 +65,7 @@ ATA_ATAPI_PASS_THRU_INSTANCE gAtaAtapiPassThruInstanceTemplate = {
|
|||||||
// both EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL and EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL
|
// both EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL and EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL
|
||||||
// bits.
|
// bits.
|
||||||
// Note that the driver doesn't support ExtScsiPassThru non blocking I/O.
|
// Note that the driver doesn't support ExtScsiPassThru non blocking I/O.
|
||||||
//
|
//
|
||||||
EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL | EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL,
|
EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL | EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL,
|
||||||
//
|
//
|
||||||
// IoAlign
|
// IoAlign
|
||||||
@ -101,7 +101,7 @@ ATA_ATAPI_PASS_THRU_INSTANCE gAtaAtapiPassThruInstanceTemplate = {
|
|||||||
0, // PreviousLun
|
0, // PreviousLun
|
||||||
NULL, // Timer event
|
NULL, // Timer event
|
||||||
{ // NonBlocking TaskList
|
{ // NonBlocking TaskList
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
NULL
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -142,7 +142,7 @@ UINT8 mScsiId[TARGET_MAX_BYTES] = {
|
|||||||
supports both blocking I/O and non-blocking I/O. The blocking I/O functionality is required,
|
supports both blocking I/O and non-blocking I/O. The blocking I/O functionality is required,
|
||||||
and the non-blocking I/O functionality is optional.
|
and the non-blocking I/O functionality is optional.
|
||||||
|
|
||||||
@param[in] Port The port number of the ATA device to send the command.
|
@param[in] Port The port number of the ATA device to send the command.
|
||||||
@param[in] PortMultiplierPort The port multiplier port number of the ATA device to send the command.
|
@param[in] PortMultiplierPort The port multiplier port number of the ATA device to send the command.
|
||||||
If there is no port multiplier, then specify 0.
|
If there is no port multiplier, then specify 0.
|
||||||
@param[in, out] Packet A pointer to the ATA command to send to the ATA device specified by Port
|
@param[in, out] Packet A pointer to the ATA command to send to the ATA device specified by Port
|
||||||
@ -178,14 +178,14 @@ AtaPassThruPassThruExecute (
|
|||||||
IN UINT16 Port,
|
IN UINT16 Port,
|
||||||
IN UINT16 PortMultiplierPort,
|
IN UINT16 PortMultiplierPort,
|
||||||
IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet,
|
IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet,
|
||||||
IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance,
|
IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance,
|
||||||
IN ATA_NONBLOCK_TASK *Task OPTIONAL
|
IN ATA_NONBLOCK_TASK *Task OPTIONAL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_ATA_PASS_THRU_CMD_PROTOCOL Protocol;
|
EFI_ATA_PASS_THRU_CMD_PROTOCOL Protocol;
|
||||||
EFI_ATA_HC_WORK_MODE Mode;
|
EFI_ATA_HC_WORK_MODE Mode;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
Protocol = Packet->Protocol;
|
Protocol = Packet->Protocol;
|
||||||
|
|
||||||
Mode = Instance->Mode;
|
Mode = Instance->Mode;
|
||||||
@ -195,11 +195,11 @@ AtaPassThruPassThruExecute (
|
|||||||
// Reassign IDE mode io port registers' base addresses
|
// Reassign IDE mode io port registers' base addresses
|
||||||
//
|
//
|
||||||
Status = GetIdeRegisterIoAddr (Instance->PciIo, Instance->IdeRegisters);
|
Status = GetIdeRegisterIoAddr (Instance->PciIo, Instance->IdeRegisters);
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (Protocol) {
|
switch (Protocol) {
|
||||||
case EFI_ATA_PASS_THRU_PROTOCOL_ATA_NON_DATA:
|
case EFI_ATA_PASS_THRU_PROTOCOL_ATA_NON_DATA:
|
||||||
Status = AtaNonDataCommandIn (
|
Status = AtaNonDataCommandIn (
|
||||||
@ -207,7 +207,7 @@ AtaPassThruPassThruExecute (
|
|||||||
&Instance->IdeRegisters[Port],
|
&Instance->IdeRegisters[Port],
|
||||||
Packet->Acb,
|
Packet->Acb,
|
||||||
Packet->Asb,
|
Packet->Asb,
|
||||||
Packet->Timeout,
|
Packet->Timeout,
|
||||||
Task
|
Task
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@ -313,7 +313,7 @@ AtaPassThruPassThruExecute (
|
|||||||
Packet->Asb,
|
Packet->Asb,
|
||||||
Packet->OutDataBuffer,
|
Packet->OutDataBuffer,
|
||||||
Packet->OutTransferLength,
|
Packet->OutTransferLength,
|
||||||
Packet->Timeout,
|
Packet->Timeout,
|
||||||
Task
|
Task
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@ -360,7 +360,7 @@ AtaPassThruPassThruExecute (
|
|||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,11 +369,11 @@ AtaPassThruPassThruExecute (
|
|||||||
|
|
||||||
@param[in] Event The Event this notify function registered to.
|
@param[in] Event The Event this notify function registered to.
|
||||||
@param[in] Context Pointer to the context data registered to the
|
@param[in] Context Pointer to the context data registered to the
|
||||||
Event.
|
Event.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
AsyncNonBlockingTransferRoutine (
|
AsyncNonBlockingTransferRoutine (
|
||||||
EFI_EVENT Event,
|
EFI_EVENT Event,
|
||||||
VOID* Context
|
VOID* Context
|
||||||
@ -388,7 +388,7 @@ AsyncNonBlockingTransferRoutine (
|
|||||||
Instance = (ATA_ATAPI_PASS_THRU_INSTANCE *) Context;
|
Instance = (ATA_ATAPI_PASS_THRU_INSTANCE *) Context;
|
||||||
EntryHeader = &Instance->NonBlockingTaskList;
|
EntryHeader = &Instance->NonBlockingTaskList;
|
||||||
//
|
//
|
||||||
// Get the Taks from the Taks List and execute it, until there is
|
// Get the Taks from the Taks List and execute it, until there is
|
||||||
// no task in the list or the device is busy with task (EFI_NOT_READY).
|
// no task in the list or the device is busy with task (EFI_NOT_READY).
|
||||||
//
|
//
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
@ -408,23 +408,24 @@ AsyncNonBlockingTransferRoutine (
|
|||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// If the data transfer meet a error which is not dumped into the status block
|
// If the data transfer meet a error, remove all tasks in the list since these tasks are
|
||||||
// set the Status block related bit.
|
// associated with one task from Ata Bus and signal the event with error status.
|
||||||
//
|
//
|
||||||
if ((Status != EFI_NOT_READY) && (Status != EFI_SUCCESS)) {
|
if ((Status != EFI_NOT_READY) && (Status != EFI_SUCCESS)) {
|
||||||
Task->Packet->Asb->AtaStatus = 0x01;
|
DestroyAsynTaskList (Instance, TRUE);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// For Non blocking mode, the Status of EFI_NOT_READY means the operation
|
// For Non blocking mode, the Status of EFI_NOT_READY means the operation
|
||||||
// is not finished yet. Other Status indicate the operation is either
|
// is not finished yet. Otherwise the operation is successful.
|
||||||
// successful or failed.
|
|
||||||
//
|
//
|
||||||
if (Status != EFI_NOT_READY) {
|
if (Status == EFI_NOT_READY) {
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
RemoveEntryList (&Task->Link);
|
RemoveEntryList (&Task->Link);
|
||||||
gBS->SignalEvent (Task->Event);
|
gBS->SignalEvent (Task->Event);
|
||||||
FreePool (Task);
|
FreePool (Task);
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -465,33 +466,33 @@ InitializeAtaAtapiPassThru (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Tests to see if this driver supports a given controller. If a child device is provided,
|
Tests to see if this driver supports a given controller. If a child device is provided,
|
||||||
it further tests to see if this driver supports creating a handle for the specified child device.
|
it further tests to see if this driver supports creating a handle for the specified child device.
|
||||||
|
|
||||||
This function checks to see if the driver specified by This supports the device specified by
|
This function checks to see if the driver specified by This supports the device specified by
|
||||||
ControllerHandle. Drivers will typically use the device path attached to
|
ControllerHandle. Drivers will typically use the device path attached to
|
||||||
ControllerHandle and/or the services from the bus I/O abstraction attached to
|
ControllerHandle and/or the services from the bus I/O abstraction attached to
|
||||||
ControllerHandle to determine if the driver supports ControllerHandle. This function
|
ControllerHandle to determine if the driver supports ControllerHandle. This function
|
||||||
may be called many times during platform initialization. In order to reduce boot times, the tests
|
may be called many times during platform initialization. In order to reduce boot times, the tests
|
||||||
performed by this function must be very small, and take as little time as possible to execute. This
|
performed by this function must be very small, and take as little time as possible to execute. This
|
||||||
function must not change the state of any hardware devices, and this function must be aware that the
|
function must not change the state of any hardware devices, and this function must be aware that the
|
||||||
device specified by ControllerHandle may already be managed by the same driver or a
|
device specified by ControllerHandle may already be managed by the same driver or a
|
||||||
different driver. This function must match its calls to AllocatePages() with FreePages(),
|
different driver. This function must match its calls to AllocatePages() with FreePages(),
|
||||||
AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
|
AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
|
||||||
Because ControllerHandle may have been previously started by the same driver, if a protocol is
|
Because ControllerHandle may have been previously started by the same driver, if a protocol is
|
||||||
already in the opened state, then it must not be closed with CloseProtocol(). This is required
|
already in the opened state, then it must not be closed with CloseProtocol(). This is required
|
||||||
to guarantee the state of ControllerHandle is not modified by this function.
|
to guarantee the state of ControllerHandle is not modified by this function.
|
||||||
|
|
||||||
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
||||||
@param[in] ControllerHandle The handle of the controller to test. This handle
|
@param[in] ControllerHandle The handle of the controller to test. This handle
|
||||||
must support a protocol interface that supplies
|
must support a protocol interface that supplies
|
||||||
an I/O abstraction to the driver.
|
an I/O abstraction to the driver.
|
||||||
@param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
|
@param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
|
||||||
parameter is ignored by device drivers, and is optional for bus
|
parameter is ignored by device drivers, and is optional for bus
|
||||||
drivers. For bus drivers, if this parameter is not NULL, then
|
drivers. For bus drivers, if this parameter is not NULL, then
|
||||||
the bus driver must determine if the bus controller specified
|
the bus driver must determine if the bus controller specified
|
||||||
by ControllerHandle and the child controller specified
|
by ControllerHandle and the child controller specified
|
||||||
by RemainingDevicePath are both supported by this
|
by RemainingDevicePath are both supported by this
|
||||||
bus driver.
|
bus driver.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The device specified by ControllerHandle and
|
@retval EFI_SUCCESS The device specified by ControllerHandle and
|
||||||
@ -614,8 +615,8 @@ AtaAtapiPassThruSupported (
|
|||||||
Starts a device controller or a bus controller.
|
Starts a device controller or a bus controller.
|
||||||
|
|
||||||
The Start() function is designed to be invoked from the EFI boot service ConnectController().
|
The Start() function is designed to be invoked from the EFI boot service ConnectController().
|
||||||
As a result, much of the error checking on the parameters to Start() has been moved into this
|
As a result, much of the error checking on the parameters to Start() has been moved into this
|
||||||
common boot service. It is legal to call Start() from other locations,
|
common boot service. It is legal to call Start() from other locations,
|
||||||
but the following calling restrictions must be followed, or the system behavior will not be deterministic.
|
but the following calling restrictions must be followed, or the system behavior will not be deterministic.
|
||||||
1. ControllerHandle must be a valid EFI_HANDLE.
|
1. ControllerHandle must be a valid EFI_HANDLE.
|
||||||
2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
|
2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
|
||||||
@ -624,18 +625,18 @@ AtaAtapiPassThruSupported (
|
|||||||
have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
|
have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
|
||||||
|
|
||||||
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
||||||
@param[in] ControllerHandle The handle of the controller to start. This handle
|
@param[in] ControllerHandle The handle of the controller to start. This handle
|
||||||
must support a protocol interface that supplies
|
must support a protocol interface that supplies
|
||||||
an I/O abstraction to the driver.
|
an I/O abstraction to the driver.
|
||||||
@param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
|
@param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
|
||||||
parameter is ignored by device drivers, and is optional for bus
|
parameter is ignored by device drivers, and is optional for bus
|
||||||
drivers. For a bus driver, if this parameter is NULL, then handles
|
drivers. For a bus driver, if this parameter is NULL, then handles
|
||||||
for all the children of Controller are created by this driver.
|
for all the children of Controller are created by this driver.
|
||||||
If this parameter is not NULL and the first Device Path Node is
|
If this parameter is not NULL and the first Device Path Node is
|
||||||
not the End of Device Path Node, then only the handle for the
|
not the End of Device Path Node, then only the handle for the
|
||||||
child device specified by the first Device Path Node of
|
child device specified by the first Device Path Node of
|
||||||
RemainingDevicePath is created by this driver.
|
RemainingDevicePath is created by this driver.
|
||||||
If the first Device Path Node of RemainingDevicePath is
|
If the first Device Path Node of RemainingDevicePath is
|
||||||
the End of Device Path Node, no child handle is created by this
|
the End of Device Path Node, no child handle is created by this
|
||||||
driver.
|
driver.
|
||||||
|
|
||||||
@ -754,7 +755,7 @@ AtaAtapiPassThruStart (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto ErrorExit;
|
goto ErrorExit;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set 1ms timer.
|
// Set 1ms timer.
|
||||||
//
|
//
|
||||||
@ -808,10 +809,10 @@ ErrorExit:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Stops a device controller or a bus controller.
|
Stops a device controller or a bus controller.
|
||||||
|
|
||||||
The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
|
The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
|
||||||
As a result, much of the error checking on the parameters to Stop() has been moved
|
As a result, much of the error checking on the parameters to Stop() has been moved
|
||||||
into this common boot service. It is legal to call Stop() from other locations,
|
into this common boot service. It is legal to call Stop() from other locations,
|
||||||
but the following calling restrictions must be followed, or the system behavior will not be deterministic.
|
but the following calling restrictions must be followed, or the system behavior will not be deterministic.
|
||||||
1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
|
1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
|
||||||
same driver's Start() function.
|
same driver's Start() function.
|
||||||
@ -819,13 +820,13 @@ ErrorExit:
|
|||||||
EFI_HANDLE. In addition, all of these handles must have been created in this driver's
|
EFI_HANDLE. In addition, all of these handles must have been created in this driver's
|
||||||
Start() function, and the Start() function must have called OpenProtocol() on
|
Start() function, and the Start() function must have called OpenProtocol() on
|
||||||
ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
|
ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
|
||||||
|
|
||||||
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
||||||
@param[in] ControllerHandle A handle to the device being stopped. The handle must
|
@param[in] ControllerHandle A handle to the device being stopped. The handle must
|
||||||
support a bus specific I/O protocol for the driver
|
support a bus specific I/O protocol for the driver
|
||||||
to use to stop the device.
|
to use to stop the device.
|
||||||
@param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
|
@param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
|
||||||
@param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
|
@param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
|
||||||
if NumberOfChildren is 0.
|
if NumberOfChildren is 0.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The device was stopped.
|
@retval EFI_SUCCESS The device was stopped.
|
||||||
@ -872,7 +873,7 @@ AtaAtapiPassThruStop (
|
|||||||
gBS->CloseEvent (Instance->TimerEvent);
|
gBS->CloseEvent (Instance->TimerEvent);
|
||||||
Instance->TimerEvent = NULL;
|
Instance->TimerEvent = NULL;
|
||||||
}
|
}
|
||||||
DestroyAsynTaskList (Instance);
|
DestroyAsynTaskList (Instance, FALSE);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Disable this ATA host controller.
|
// Disable this ATA host controller.
|
||||||
@ -968,13 +969,13 @@ AtaAtapiPassThruStop (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Traverse the attached ATA devices list to find out the device to access.
|
Traverse the attached ATA devices list to find out the device to access.
|
||||||
|
|
||||||
@param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
|
@param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
|
||||||
@param[in] Port The port number of the ATA device to send the command.
|
@param[in] Port The port number of the ATA device to send the command.
|
||||||
@param[in] PortMultiplierPort The port multiplier port number of the ATA device to send the command.
|
@param[in] PortMultiplierPort The port multiplier port number of the ATA device to send the command.
|
||||||
If there is no port multiplier, then specify 0.
|
If there is no port multiplier, then specify 0.
|
||||||
@param[in] DeviceType The device type of the ATA device.
|
@param[in] DeviceType The device type of the ATA device.
|
||||||
|
|
||||||
@retval The pointer to the data structure of the device info to access.
|
@retval The pointer to the data structure of the device info to access.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@ -995,7 +996,7 @@ SearchDeviceInfoList (
|
|||||||
DeviceInfo = ATA_ATAPI_DEVICE_INFO_FROM_THIS (Node);
|
DeviceInfo = ATA_ATAPI_DEVICE_INFO_FROM_THIS (Node);
|
||||||
|
|
||||||
if ((DeviceInfo->Type == DeviceType) &&
|
if ((DeviceInfo->Type == DeviceType) &&
|
||||||
(Port == DeviceInfo->Port) &&
|
(Port == DeviceInfo->Port) &&
|
||||||
(PortMultiplier == DeviceInfo->PortMultiplier)) {
|
(PortMultiplier == DeviceInfo->PortMultiplier)) {
|
||||||
return Node;
|
return Node;
|
||||||
}
|
}
|
||||||
@ -1009,9 +1010,9 @@ SearchDeviceInfoList (
|
|||||||
/**
|
/**
|
||||||
Allocate device info data structure to contain device info.
|
Allocate device info data structure to contain device info.
|
||||||
And insert the data structure to the tail of device list for tracing.
|
And insert the data structure to the tail of device list for tracing.
|
||||||
|
|
||||||
@param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
|
@param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
|
||||||
@param[in] Port The port number of the ATA device to send the command.
|
@param[in] Port The port number of the ATA device to send the command.
|
||||||
@param[in] PortMultiplierPort The port multiplier port number of the ATA device to send the command.
|
@param[in] PortMultiplierPort The port multiplier port number of the ATA device to send the command.
|
||||||
If there is no port multiplier, then specify 0.
|
If there is no port multiplier, then specify 0.
|
||||||
@param[in] DeviceType The device type of the ATA device.
|
@param[in] DeviceType The device type of the ATA device.
|
||||||
@ -1059,7 +1060,7 @@ CreateNewDeviceInfo (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Destroy all attached ATA devices info.
|
Destroy all attached ATA devices info.
|
||||||
|
|
||||||
@param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
|
@param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@ -1088,14 +1089,17 @@ DestroyDeviceInfoList (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Destroy all pending non blocking tasks.
|
Destroy all pending non blocking tasks.
|
||||||
|
|
||||||
@param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
|
@param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
|
||||||
|
@param[in] IsSigEvent Indicate whether signal the task event when remove the
|
||||||
|
task.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
DestroyAsynTaskList (
|
DestroyAsynTaskList (
|
||||||
IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance
|
IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance,
|
||||||
|
IN BOOLEAN IsSigEvent
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
LIST_ENTRY *Entry;
|
LIST_ENTRY *Entry;
|
||||||
@ -1108,7 +1112,7 @@ DestroyAsynTaskList (
|
|||||||
//
|
//
|
||||||
// Free the Subtask list.
|
// Free the Subtask list.
|
||||||
//
|
//
|
||||||
for (Entry = (&Instance->NonBlockingTaskList)->ForwardLink;
|
for (Entry = (&Instance->NonBlockingTaskList)->ForwardLink;
|
||||||
Entry != (&Instance->NonBlockingTaskList);
|
Entry != (&Instance->NonBlockingTaskList);
|
||||||
) {
|
) {
|
||||||
DelEntry = Entry;
|
DelEntry = Entry;
|
||||||
@ -1116,6 +1120,10 @@ DestroyAsynTaskList (
|
|||||||
Task = ATA_NON_BLOCK_TASK_FROM_ENTRY (DelEntry);
|
Task = ATA_NON_BLOCK_TASK_FROM_ENTRY (DelEntry);
|
||||||
|
|
||||||
RemoveEntryList (DelEntry);
|
RemoveEntryList (DelEntry);
|
||||||
|
if (IsSigEvent) {
|
||||||
|
Task->Packet->Asb->AtaStatus = 0x01;
|
||||||
|
gBS->SignalEvent (Task->Event);
|
||||||
|
}
|
||||||
FreePool (Task);
|
FreePool (Task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1124,9 +1132,9 @@ DestroyAsynTaskList (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Enumerate all attached ATA devices at IDE mode or AHCI mode separately.
|
Enumerate all attached ATA devices at IDE mode or AHCI mode separately.
|
||||||
|
|
||||||
The function is designed to enumerate all attached ATA devices.
|
The function is designed to enumerate all attached ATA devices.
|
||||||
|
|
||||||
@param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
|
@param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Successfully enumerate attached ATA devices.
|
@retval EFI_SUCCESS Successfully enumerate attached ATA devices.
|
||||||
@ -1196,8 +1204,8 @@ Done:
|
|||||||
supports both blocking I/O and non-blocking I/O. The blocking I/O functionality is required,
|
supports both blocking I/O and non-blocking I/O. The blocking I/O functionality is required,
|
||||||
and the non-blocking I/O functionality is optional.
|
and the non-blocking I/O functionality is optional.
|
||||||
|
|
||||||
@param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.
|
@param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.
|
||||||
@param[in] Port The port number of the ATA device to send the command.
|
@param[in] Port The port number of the ATA device to send the command.
|
||||||
@param[in] PortMultiplierPort The port multiplier port number of the ATA device to send the command.
|
@param[in] PortMultiplierPort The port multiplier port number of the ATA device to send the command.
|
||||||
If there is no port multiplier, then specify 0.
|
If there is no port multiplier, then specify 0.
|
||||||
@param[in, out] Packet A pointer to the ATA command to send to the ATA device specified by Port
|
@param[in, out] Packet A pointer to the ATA command to send to the ATA device specified by Port
|
||||||
@ -1207,11 +1215,11 @@ Done:
|
|||||||
Event is not NULL and non blocking I/O is supported, then non-blocking
|
Event is not NULL and non blocking I/O is supported, then non-blocking
|
||||||
I/O is performed, and Event will be signaled when the ATA command completes.
|
I/O is performed, and Event will be signaled when the ATA command completes.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The ATA command was sent by the host. For bi-directional commands,
|
@retval EFI_SUCCESS The ATA command was sent by the host. For bi-directional commands,
|
||||||
InTransferLength bytes were transferred from InDataBuffer. For write and
|
InTransferLength bytes were transferred from InDataBuffer. For write and
|
||||||
bi-directional commands, OutTransferLength bytes were transferred by OutDataBuffer.
|
bi-directional commands, OutTransferLength bytes were transferred by OutDataBuffer.
|
||||||
@retval EFI_BAD_BUFFER_SIZE The ATA command was not executed. The number of bytes that could be transferred
|
@retval EFI_BAD_BUFFER_SIZE The ATA command was not executed. The number of bytes that could be transferred
|
||||||
is returned in InTransferLength. For write and bi-directional commands,
|
is returned in InTransferLength. For write and bi-directional commands,
|
||||||
OutTransferLength bytes were transferred by OutDataBuffer.
|
OutTransferLength bytes were transferred by OutDataBuffer.
|
||||||
@retval EFI_NOT_READY The ATA command could not be sent because there are too many ATA commands
|
@retval EFI_NOT_READY The ATA command could not be sent because there are too many ATA commands
|
||||||
already queued. The caller may retry again later.
|
already queued. The caller may retry again later.
|
||||||
@ -1256,7 +1264,7 @@ AtaPassThruPassThru (
|
|||||||
//
|
//
|
||||||
// convert the transfer length from sector count to byte.
|
// convert the transfer length from sector count to byte.
|
||||||
//
|
//
|
||||||
if (((Packet->Length & EFI_ATA_PASS_THRU_LENGTH_BYTES) == 0) &&
|
if (((Packet->Length & EFI_ATA_PASS_THRU_LENGTH_BYTES) == 0) &&
|
||||||
(Packet->InTransferLength != 0)) {
|
(Packet->InTransferLength != 0)) {
|
||||||
Packet->InTransferLength = Packet->InTransferLength * 0x200;
|
Packet->InTransferLength = Packet->InTransferLength * 0x200;
|
||||||
}
|
}
|
||||||
@ -1278,7 +1286,7 @@ AtaPassThruPassThru (
|
|||||||
//
|
//
|
||||||
// Check whether this device needs 48-bit addressing (ATAPI-6 ata device).
|
// Check whether this device needs 48-bit addressing (ATAPI-6 ata device).
|
||||||
// Per ATA-6 spec, word83: bit15 is zero and bit14 is one.
|
// Per ATA-6 spec, word83: bit15 is zero and bit14 is one.
|
||||||
// If bit10 is one, it means the ata device support 48-bit addressing.
|
// If bit10 is one, it means the ata device support 48-bit addressing.
|
||||||
//
|
//
|
||||||
DeviceInfo = ATA_ATAPI_DEVICE_INFO_FROM_THIS (Node);
|
DeviceInfo = ATA_ATAPI_DEVICE_INFO_FROM_THIS (Node);
|
||||||
IdentifyData = DeviceInfo->IdentifyData;
|
IdentifyData = DeviceInfo->IdentifyData;
|
||||||
@ -1297,9 +1305,9 @@ AtaPassThruPassThru (
|
|||||||
//
|
//
|
||||||
// If the data buffer described by InDataBuffer/OutDataBuffer and InTransferLength/OutTransferLength
|
// If the data buffer described by InDataBuffer/OutDataBuffer and InTransferLength/OutTransferLength
|
||||||
// is too big to be transferred in a single command, then no data is transferred and EFI_BAD_BUFFER_SIZE
|
// is too big to be transferred in a single command, then no data is transferred and EFI_BAD_BUFFER_SIZE
|
||||||
// is returned.
|
// is returned.
|
||||||
//
|
//
|
||||||
if (((Packet->InTransferLength != 0) && (Packet->InTransferLength > MaxSectorCount * 0x200)) ||
|
if (((Packet->InTransferLength != 0) && (Packet->InTransferLength > MaxSectorCount * 0x200)) ||
|
||||||
((Packet->OutTransferLength != 0) && (Packet->OutTransferLength > MaxSectorCount * 0x200))) {
|
((Packet->OutTransferLength != 0) && (Packet->OutTransferLength > MaxSectorCount * 0x200))) {
|
||||||
return EFI_BAD_BUFFER_SIZE;
|
return EFI_BAD_BUFFER_SIZE;
|
||||||
}
|
}
|
||||||
@ -1312,7 +1320,7 @@ AtaPassThruPassThru (
|
|||||||
if (Task == NULL) {
|
if (Task == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
Task->Signature = ATA_NONBLOCKING_TASK_SIGNATURE;
|
Task->Signature = ATA_NONBLOCKING_TASK_SIGNATURE;
|
||||||
Task->Port = Port;
|
Task->Port = Port;
|
||||||
Task->PortMultiplier = PortMultiplierPort;
|
Task->PortMultiplier = PortMultiplierPort;
|
||||||
@ -1356,7 +1364,7 @@ AtaPassThruPassThru (
|
|||||||
If Port is the port number of the last port on the ATA controller, then EFI_NOT_FOUND is
|
If Port is the port number of the last port on the ATA controller, then EFI_NOT_FOUND is
|
||||||
returned.
|
returned.
|
||||||
|
|
||||||
@param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.
|
@param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.
|
||||||
@param[in, out] Port On input, a pointer to the port number on the ATA controller.
|
@param[in, out] Port On input, a pointer to the port number on the ATA controller.
|
||||||
On output, a pointer to the next port number on the ATA
|
On output, a pointer to the next port number on the ATA
|
||||||
controller. An input value of 0xFFFF retrieves the first port
|
controller. An input value of 0xFFFF retrieves the first port
|
||||||
@ -1436,36 +1444,36 @@ Exit:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Used to retrieve the list of legal port multiplier port numbers for ATA devices on a port of an ATA
|
Used to retrieve the list of legal port multiplier port numbers for ATA devices on a port of an ATA
|
||||||
controller. These can either be the list of port multiplier ports where ATA devices are actually
|
controller. These can either be the list of port multiplier ports where ATA devices are actually
|
||||||
present on port or the list of legal port multiplier ports on that port. Regardless, the caller of this
|
present on port or the list of legal port multiplier ports on that port. Regardless, the caller of this
|
||||||
function must probe the port number and port multiplier port number returned to see if an ATA
|
function must probe the port number and port multiplier port number returned to see if an ATA
|
||||||
device is actually present.
|
device is actually present.
|
||||||
|
|
||||||
The GetNextDevice() function retrieves the port multiplier port number of an ATA device
|
The GetNextDevice() function retrieves the port multiplier port number of an ATA device
|
||||||
present on a port of an ATA controller.
|
present on a port of an ATA controller.
|
||||||
|
|
||||||
If PortMultiplierPort points to a port multiplier port number value that was returned on a
|
If PortMultiplierPort points to a port multiplier port number value that was returned on a
|
||||||
previous call to GetNextDevice(), then the port multiplier port number of the next ATA device
|
previous call to GetNextDevice(), then the port multiplier port number of the next ATA device
|
||||||
on the port of the ATA controller is returned in PortMultiplierPort, and EFI_SUCCESS is
|
on the port of the ATA controller is returned in PortMultiplierPort, and EFI_SUCCESS is
|
||||||
returned.
|
returned.
|
||||||
|
|
||||||
If PortMultiplierPort points to 0xFFFF, then the port multiplier port number of the first
|
If PortMultiplierPort points to 0xFFFF, then the port multiplier port number of the first
|
||||||
ATA device on port of the ATA controller is returned in PortMultiplierPort and
|
ATA device on port of the ATA controller is returned in PortMultiplierPort and
|
||||||
EFI_SUCCESS is returned.
|
EFI_SUCCESS is returned.
|
||||||
|
|
||||||
If PortMultiplierPort is not 0xFFFF and the value pointed to by PortMultiplierPort
|
If PortMultiplierPort is not 0xFFFF and the value pointed to by PortMultiplierPort
|
||||||
was not returned on a previous call to GetNextDevice(), then EFI_INVALID_PARAMETER
|
was not returned on a previous call to GetNextDevice(), then EFI_INVALID_PARAMETER
|
||||||
is returned.
|
is returned.
|
||||||
|
|
||||||
If PortMultiplierPort is the port multiplier port number of the last ATA device on the port of
|
If PortMultiplierPort is the port multiplier port number of the last ATA device on the port of
|
||||||
the ATA controller, then EFI_NOT_FOUND is returned.
|
the ATA controller, then EFI_NOT_FOUND is returned.
|
||||||
|
|
||||||
@param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.
|
@param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.
|
||||||
@param[in] Port The port number present on the ATA controller.
|
@param[in] Port The port number present on the ATA controller.
|
||||||
@param[in, out] PortMultiplierPort On input, a pointer to the port multiplier port number of an
|
@param[in, out] PortMultiplierPort On input, a pointer to the port multiplier port number of an
|
||||||
ATA device present on the ATA controller.
|
ATA device present on the ATA controller.
|
||||||
If on input a PortMultiplierPort of 0xFFFF is specified,
|
If on input a PortMultiplierPort of 0xFFFF is specified,
|
||||||
then the port multiplier port number of the first ATA device
|
then the port multiplier port number of the first ATA device
|
||||||
is returned. On output, a pointer to the port multiplier port
|
is returned. On output, a pointer to the port multiplier port
|
||||||
number of the next ATA device present on an ATA controller.
|
number of the next ATA device present on an ATA controller.
|
||||||
@ -1635,7 +1643,7 @@ AtaPassThruBuildDevicePath (
|
|||||||
|
|
||||||
The GetDevice() function determines the port and port multiplier port number associated with
|
The GetDevice() function determines the port and port multiplier port number associated with
|
||||||
the ATA device described by DevicePath. If DevicePath is a device path node type that the
|
the ATA device described by DevicePath. If DevicePath is a device path node type that the
|
||||||
ATA Pass Thru driver supports, then the ATA Pass Thru driver will attempt to translate the contents
|
ATA Pass Thru driver supports, then the ATA Pass Thru driver will attempt to translate the contents
|
||||||
DevicePath into a port number and port multiplier port number.
|
DevicePath into a port number and port multiplier port number.
|
||||||
|
|
||||||
If this translation is successful, then that port number and port multiplier port number are returned
|
If this translation is successful, then that port number and port multiplier port number are returned
|
||||||
@ -1643,11 +1651,11 @@ AtaPassThruBuildDevicePath (
|
|||||||
|
|
||||||
If DevicePath, Port, or PortMultiplierPort are NULL, then EFI_INVALID_PARAMETER is returned.
|
If DevicePath, Port, or PortMultiplierPort are NULL, then EFI_INVALID_PARAMETER is returned.
|
||||||
|
|
||||||
If DevicePath is not a device path node type that the ATA Pass Thru driver supports, then
|
If DevicePath is not a device path node type that the ATA Pass Thru driver supports, then
|
||||||
EFI_UNSUPPORTED is returned.
|
EFI_UNSUPPORTED is returned.
|
||||||
|
|
||||||
If DevicePath is a device path node type that the ATA Pass Thru driver supports, but there is not
|
If DevicePath is a device path node type that the ATA Pass Thru driver supports, but there is not
|
||||||
a valid translation from DevicePath to a port number and port multiplier port number, then
|
a valid translation from DevicePath to a port number and port multiplier port number, then
|
||||||
EFI_NOT_FOUND is returned.
|
EFI_NOT_FOUND is returned.
|
||||||
|
|
||||||
@param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.
|
@param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.
|
||||||
@ -1759,7 +1767,7 @@ AtaPassThruResetPort (
|
|||||||
If this ATA controller does not support a device reset operation, then EFI_UNSUPPORTED is
|
If this ATA controller does not support a device reset operation, then EFI_UNSUPPORTED is
|
||||||
returned.
|
returned.
|
||||||
|
|
||||||
If Port or PortMultiplierPort are not in a valid range for this ATA controller, then
|
If Port or PortMultiplierPort are not in a valid range for this ATA controller, then
|
||||||
EFI_INVALID_PARAMETER is returned.
|
EFI_INVALID_PARAMETER is returned.
|
||||||
|
|
||||||
If a device error occurs while executing that device reset operation, then EFI_DEVICE_ERROR
|
If a device error occurs while executing that device reset operation, then EFI_DEVICE_ERROR
|
||||||
@ -1795,9 +1803,9 @@ AtaPassThruResetDevice (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel. This function
|
Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel. This function
|
||||||
supports both blocking I/O and nonblocking I/O. The blocking I/O functionality is required, and the
|
supports both blocking I/O and nonblocking I/O. The blocking I/O functionality is required, and the
|
||||||
nonblocking I/O functionality is optional.
|
nonblocking I/O functionality is optional.
|
||||||
|
|
||||||
@param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
|
@param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
|
||||||
@param Target The Target is an array of size TARGET_MAX_BYTES and it represents
|
@param Target The Target is an array of size TARGET_MAX_BYTES and it represents
|
||||||
@ -1866,7 +1874,7 @@ ExtScsiPassThruPassThru (
|
|||||||
(Packet->CdbLength != 12) && (Packet->CdbLength != 16)) {
|
(Packet->CdbLength != 12) && (Packet->CdbLength != 16)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((This->Mode->IoAlign > 1) && !IS_ALIGNED(Packet->InDataBuffer, This->Mode->IoAlign)) {
|
if ((This->Mode->IoAlign > 1) && !IS_ALIGNED(Packet->InDataBuffer, This->Mode->IoAlign)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
@ -1886,7 +1894,7 @@ ExtScsiPassThruPassThru (
|
|||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// The layout of Target array:
|
// The layout of Target array:
|
||||||
// ________________________________________________________________________
|
// ________________________________________________________________________
|
||||||
// | Byte 0 | Byte 1 | ... | TARGET_MAX_BYTES - 1 |
|
// | Byte 0 | Byte 1 | ... | TARGET_MAX_BYTES - 1 |
|
||||||
@ -1943,10 +1951,10 @@ ExtScsiPassThruPassThru (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Used to retrieve the list of legal Target IDs and LUNs for SCSI devices on a SCSI channel. These
|
Used to retrieve the list of legal Target IDs and LUNs for SCSI devices on a SCSI channel. These
|
||||||
can either be the list SCSI devices that are actually present on the SCSI channel, or the list of legal
|
can either be the list SCSI devices that are actually present on the SCSI channel, or the list of legal
|
||||||
Target Ids and LUNs for the SCSI channel. Regardless, the caller of this function must probe the
|
Target Ids and LUNs for the SCSI channel. Regardless, the caller of this function must probe the
|
||||||
Target ID and LUN returned to see if a SCSI device is actually present at that location on the SCSI
|
Target ID and LUN returned to see if a SCSI device is actually present at that location on the SCSI
|
||||||
channel.
|
channel.
|
||||||
|
|
||||||
@param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
|
@param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
|
||||||
@ -2027,7 +2035,7 @@ ExtScsiPassThruGetNextTargetLun (
|
|||||||
DeviceInfo = ATA_ATAPI_DEVICE_INFO_FROM_THIS (Node);
|
DeviceInfo = ATA_ATAPI_DEVICE_INFO_FROM_THIS (Node);
|
||||||
|
|
||||||
if ((DeviceInfo->Type == EfiIdeCdrom) &&
|
if ((DeviceInfo->Type == EfiIdeCdrom) &&
|
||||||
((Target8[0] < DeviceInfo->Port) ||
|
((Target8[0] < DeviceInfo->Port) ||
|
||||||
((Target8[0] == DeviceInfo->Port) &&
|
((Target8[0] == DeviceInfo->Port) &&
|
||||||
(Target8[1] < DeviceInfo->PortMultiplier)))) {
|
(Target8[1] < DeviceInfo->PortMultiplier)))) {
|
||||||
Target8[0] = (UINT8)DeviceInfo->Port;
|
Target8[0] = (UINT8)DeviceInfo->Port;
|
||||||
@ -2067,7 +2075,7 @@ Exit:
|
|||||||
//
|
//
|
||||||
Instance->PreviousTargetId = *Target16;
|
Instance->PreviousTargetId = *Target16;
|
||||||
Instance->PreviousLun = *Lun;
|
Instance->PreviousLun = *Lun;
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2134,7 +2142,7 @@ ExtScsiPassThruBuildDevicePath (
|
|||||||
if (SearchDeviceInfoList(Instance, Port, PortMultiplier, EfiIdeCdrom) == NULL) {
|
if (SearchDeviceInfoList(Instance, Port, PortMultiplier, EfiIdeCdrom) == NULL) {
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Instance->Mode == EfiAtaIdeMode) {
|
if (Instance->Mode == EfiAtaIdeMode) {
|
||||||
DevicePathNode = AllocateCopyPool (sizeof (ATAPI_DEVICE_PATH), &mAtapiDevicePathTemplate);
|
DevicePathNode = AllocateCopyPool (sizeof (ATAPI_DEVICE_PATH), &mAtapiDevicePathTemplate);
|
||||||
if (DevicePathNode == NULL) {
|
if (DevicePathNode == NULL) {
|
||||||
@ -2293,10 +2301,10 @@ ExtScsiPassThruResetTargetLun (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Used to retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. These can either
|
Used to retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. These can either
|
||||||
be the list SCSI devices that are actually present on the SCSI channel, or the list of legal Target IDs
|
be the list SCSI devices that are actually present on the SCSI channel, or the list of legal Target IDs
|
||||||
for the SCSI channel. Regardless, the caller of this function must probe the Target ID returned to
|
for the SCSI channel. Regardless, the caller of this function must probe the Target ID returned to
|
||||||
see if a SCSI device is actually present at that location on the SCSI channel.
|
see if a SCSI device is actually present at that location on the SCSI channel.
|
||||||
|
|
||||||
@param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
|
@param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
|
||||||
@param Target (TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.
|
@param Target (TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.
|
||||||
@ -2366,7 +2374,7 @@ ExtScsiPassThruGetNextTarget (
|
|||||||
DeviceInfo = ATA_ATAPI_DEVICE_INFO_FROM_THIS (Node);
|
DeviceInfo = ATA_ATAPI_DEVICE_INFO_FROM_THIS (Node);
|
||||||
|
|
||||||
if ((DeviceInfo->Type == EfiIdeCdrom) &&
|
if ((DeviceInfo->Type == EfiIdeCdrom) &&
|
||||||
((Target8[0] < DeviceInfo->Port) ||
|
((Target8[0] < DeviceInfo->Port) ||
|
||||||
((Target8[0] == DeviceInfo->Port) &&
|
((Target8[0] == DeviceInfo->Port) &&
|
||||||
(Target8[1] < DeviceInfo->PortMultiplier)))) {
|
(Target8[1] < DeviceInfo->PortMultiplier)))) {
|
||||||
Target8[0] = (UINT8)DeviceInfo->Port;
|
Target8[0] = (UINT8)DeviceInfo->Port;
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Header file for ATA/ATAPI PASS THRU driver.
|
Header file for ATA/ATAPI PASS THRU driver.
|
||||||
|
|
||||||
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
|
||||||
This program and the accompanying materials
|
|
||||||
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
|
|
||||||
http://opensource.org/licenses/bsd-license.php
|
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
This program and the accompanying materials
|
||||||
|
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
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
#ifndef __ATA_ATAPI_PASS_THRU_H__
|
#ifndef __ATA_ATAPI_PASS_THRU_H__
|
||||||
@ -95,7 +95,7 @@ typedef struct {
|
|||||||
|
|
||||||
EFI_IDE_REGISTERS IdeRegisters[EfiIdeMaxChannel];
|
EFI_IDE_REGISTERS IdeRegisters[EfiIdeMaxChannel];
|
||||||
EFI_AHCI_REGISTERS AhciRegisters;
|
EFI_AHCI_REGISTERS AhciRegisters;
|
||||||
|
|
||||||
//
|
//
|
||||||
// The attached device list
|
// The attached device list
|
||||||
//
|
//
|
||||||
@ -103,18 +103,18 @@ typedef struct {
|
|||||||
UINT64 OriginalPciAttributes;
|
UINT64 OriginalPciAttributes;
|
||||||
|
|
||||||
//
|
//
|
||||||
// For AtaPassThru protocol, using the following bytes to record the previous call in
|
// For AtaPassThru protocol, using the following bytes to record the previous call in
|
||||||
// GetNextPort()/GetNextDevice().
|
// GetNextPort()/GetNextDevice().
|
||||||
//
|
//
|
||||||
UINT16 PreviousPort;
|
UINT16 PreviousPort;
|
||||||
UINT16 PreviousPortMultiplier;
|
UINT16 PreviousPortMultiplier;
|
||||||
//
|
//
|
||||||
// For ExtScsiPassThru protocol, using the following bytes to record the previous call in
|
// For ExtScsiPassThru protocol, using the following bytes to record the previous call in
|
||||||
// GetNextTarget()/GetNextTargetLun().
|
// GetNextTarget()/GetNextTargetLun().
|
||||||
//
|
//
|
||||||
UINT16 PreviousTargetId;
|
UINT16 PreviousTargetId;
|
||||||
UINT64 PreviousLun;
|
UINT64 PreviousLun;
|
||||||
|
|
||||||
//
|
//
|
||||||
// For Non-blocking.
|
// For Non-blocking.
|
||||||
//
|
//
|
||||||
@ -136,7 +136,7 @@ struct _ATA_NONBLOCK_TASK {
|
|||||||
EFI_EVENT Event;
|
EFI_EVENT Event;
|
||||||
UINT64 RetryTimes;
|
UINT64 RetryTimes;
|
||||||
VOID *Map; // Pointer to map.
|
VOID *Map; // Pointer to map.
|
||||||
VOID *TableMap;// Pointer to PRD table map.
|
VOID *TableMap;// Pointer to PRD table map.
|
||||||
EFI_ATA_DMA_PRD *MapBaseAddress; // Pointer to range Base address for Map.
|
EFI_ATA_DMA_PRD *MapBaseAddress; // Pointer to range Base address for Map.
|
||||||
UINTN PageCount; // The page numbers used by PCIO freebuffer.
|
UINTN PageCount; // The page numbers used by PCIO freebuffer.
|
||||||
};
|
};
|
||||||
@ -303,33 +303,33 @@ AtaAtapiPassThruComponentNameGetControllerName (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Tests to see if this driver supports a given controller. If a child device is provided,
|
Tests to see if this driver supports a given controller. If a child device is provided,
|
||||||
it further tests to see if this driver supports creating a handle for the specified child device.
|
it further tests to see if this driver supports creating a handle for the specified child device.
|
||||||
|
|
||||||
This function checks to see if the driver specified by This supports the device specified by
|
This function checks to see if the driver specified by This supports the device specified by
|
||||||
ControllerHandle. Drivers will typically use the device path attached to
|
ControllerHandle. Drivers will typically use the device path attached to
|
||||||
ControllerHandle and/or the services from the bus I/O abstraction attached to
|
ControllerHandle and/or the services from the bus I/O abstraction attached to
|
||||||
ControllerHandle to determine if the driver supports ControllerHandle. This function
|
ControllerHandle to determine if the driver supports ControllerHandle. This function
|
||||||
may be called many times during platform initialization. In order to reduce boot times, the tests
|
may be called many times during platform initialization. In order to reduce boot times, the tests
|
||||||
performed by this function must be very small, and take as little time as possible to execute. This
|
performed by this function must be very small, and take as little time as possible to execute. This
|
||||||
function must not change the state of any hardware devices, and this function must be aware that the
|
function must not change the state of any hardware devices, and this function must be aware that the
|
||||||
device specified by ControllerHandle may already be managed by the same driver or a
|
device specified by ControllerHandle may already be managed by the same driver or a
|
||||||
different driver. This function must match its calls to AllocatePages() with FreePages(),
|
different driver. This function must match its calls to AllocatePages() with FreePages(),
|
||||||
AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
|
AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
|
||||||
Because ControllerHandle may have been previously started by the same driver, if a protocol is
|
Because ControllerHandle may have been previously started by the same driver, if a protocol is
|
||||||
already in the opened state, then it must not be closed with CloseProtocol(). This is required
|
already in the opened state, then it must not be closed with CloseProtocol(). This is required
|
||||||
to guarantee the state of ControllerHandle is not modified by this function.
|
to guarantee the state of ControllerHandle is not modified by this function.
|
||||||
|
|
||||||
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
||||||
@param[in] ControllerHandle The handle of the controller to test. This handle
|
@param[in] ControllerHandle The handle of the controller to test. This handle
|
||||||
must support a protocol interface that supplies
|
must support a protocol interface that supplies
|
||||||
an I/O abstraction to the driver.
|
an I/O abstraction to the driver.
|
||||||
@param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
|
@param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
|
||||||
parameter is ignored by device drivers, and is optional for bus
|
parameter is ignored by device drivers, and is optional for bus
|
||||||
drivers. For bus drivers, if this parameter is not NULL, then
|
drivers. For bus drivers, if this parameter is not NULL, then
|
||||||
the bus driver must determine if the bus controller specified
|
the bus driver must determine if the bus controller specified
|
||||||
by ControllerHandle and the child controller specified
|
by ControllerHandle and the child controller specified
|
||||||
by RemainingDevicePath are both supported by this
|
by RemainingDevicePath are both supported by this
|
||||||
bus driver.
|
bus driver.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The device specified by ControllerHandle and
|
@retval EFI_SUCCESS The device specified by ControllerHandle and
|
||||||
@ -356,28 +356,28 @@ AtaAtapiPassThruSupported (
|
|||||||
Starts a device controller or a bus controller.
|
Starts a device controller or a bus controller.
|
||||||
|
|
||||||
The Start() function is designed to be invoked from the EFI boot service ConnectController().
|
The Start() function is designed to be invoked from the EFI boot service ConnectController().
|
||||||
As a result, much of the error checking on the parameters to Start() has been moved into this
|
As a result, much of the error checking on the parameters to Start() has been moved into this
|
||||||
common boot service. It is legal to call Start() from other locations,
|
common boot service. It is legal to call Start() from other locations,
|
||||||
but the following calling restrictions must be followed, or the system behavior will not be deterministic.
|
but the following calling restrictions must be followed, or the system behavior will not be deterministic.
|
||||||
1. ControllerHandle must be a valid EFI_HANDLE.
|
1. ControllerHandle must be a valid EFI_HANDLE.
|
||||||
2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
|
2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
|
||||||
EFI_DEVICE_PATH_PROTOCOL.
|
EFI_DEVICE_PATH_PROTOCOL.
|
||||||
3. Prior to calling Start(), the Supported() function for the driver specified by This must
|
3. Prior to calling Start(), the Supported() function for the driver specified by This must
|
||||||
have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
|
have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
|
||||||
|
|
||||||
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
||||||
@param[in] ControllerHandle The handle of the controller to start. This handle
|
@param[in] ControllerHandle The handle of the controller to start. This handle
|
||||||
must support a protocol interface that supplies
|
must support a protocol interface that supplies
|
||||||
an I/O abstraction to the driver.
|
an I/O abstraction to the driver.
|
||||||
@param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
|
@param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
|
||||||
parameter is ignored by device drivers, and is optional for bus
|
parameter is ignored by device drivers, and is optional for bus
|
||||||
drivers. For a bus driver, if this parameter is NULL, then handles
|
drivers. For a bus driver, if this parameter is NULL, then handles
|
||||||
for all the children of Controller are created by this driver.
|
for all the children of Controller are created by this driver.
|
||||||
If this parameter is not NULL and the first Device Path Node is
|
If this parameter is not NULL and the first Device Path Node is
|
||||||
not the End of Device Path Node, then only the handle for the
|
not the End of Device Path Node, then only the handle for the
|
||||||
child device specified by the first Device Path Node of
|
child device specified by the first Device Path Node of
|
||||||
RemainingDevicePath is created by this driver.
|
RemainingDevicePath is created by this driver.
|
||||||
If the first Device Path Node of RemainingDevicePath is
|
If the first Device Path Node of RemainingDevicePath is
|
||||||
the End of Device Path Node, no child handle is created by this
|
the End of Device Path Node, no child handle is created by this
|
||||||
driver.
|
driver.
|
||||||
|
|
||||||
@ -397,10 +397,10 @@ AtaAtapiPassThruStart (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Stops a device controller or a bus controller.
|
Stops a device controller or a bus controller.
|
||||||
|
|
||||||
The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
|
The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
|
||||||
As a result, much of the error checking on the parameters to Stop() has been moved
|
As a result, much of the error checking on the parameters to Stop() has been moved
|
||||||
into this common boot service. It is legal to call Stop() from other locations,
|
into this common boot service. It is legal to call Stop() from other locations,
|
||||||
but the following calling restrictions must be followed, or the system behavior will not be deterministic.
|
but the following calling restrictions must be followed, or the system behavior will not be deterministic.
|
||||||
1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
|
1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
|
||||||
same driver's Start() function.
|
same driver's Start() function.
|
||||||
@ -408,13 +408,13 @@ AtaAtapiPassThruStart (
|
|||||||
EFI_HANDLE. In addition, all of these handles must have been created in this driver's
|
EFI_HANDLE. In addition, all of these handles must have been created in this driver's
|
||||||
Start() function, and the Start() function must have called OpenProtocol() on
|
Start() function, and the Start() function must have called OpenProtocol() on
|
||||||
ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
|
ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
|
||||||
|
|
||||||
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
||||||
@param[in] ControllerHandle A handle to the device being stopped. The handle must
|
@param[in] ControllerHandle A handle to the device being stopped. The handle must
|
||||||
support a bus specific I/O protocol for the driver
|
support a bus specific I/O protocol for the driver
|
||||||
to use to stop the device.
|
to use to stop the device.
|
||||||
@param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
|
@param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
|
||||||
@param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
|
@param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
|
||||||
if NumberOfChildren is 0.
|
if NumberOfChildren is 0.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The device was stopped.
|
@retval EFI_SUCCESS The device was stopped.
|
||||||
@ -432,13 +432,13 @@ AtaAtapiPassThruStop (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Traverse the attached ATA devices list to find out the device to access.
|
Traverse the attached ATA devices list to find out the device to access.
|
||||||
|
|
||||||
@param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
|
@param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
|
||||||
@param[in] Port The port number of the ATA device to send the command.
|
@param[in] Port The port number of the ATA device to send the command.
|
||||||
@param[in] PortMultiplierPort The port multiplier port number of the ATA device to send the command.
|
@param[in] PortMultiplierPort The port multiplier port number of the ATA device to send the command.
|
||||||
If there is no port multiplier, then specify 0.
|
If there is no port multiplier, then specify 0.
|
||||||
@param[in] DeviceType The device type of the ATA device.
|
@param[in] DeviceType The device type of the ATA device.
|
||||||
|
|
||||||
@retval The pointer to the data structure of the device info to access.
|
@retval The pointer to the data structure of the device info to access.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@ -454,9 +454,9 @@ SearchDeviceInfoList (
|
|||||||
/**
|
/**
|
||||||
Allocate device info data structure to contain device info.
|
Allocate device info data structure to contain device info.
|
||||||
And insert the data structure to the tail of device list for tracing.
|
And insert the data structure to the tail of device list for tracing.
|
||||||
|
|
||||||
@param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
|
@param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
|
||||||
@param[in] Port The port number of the ATA device to send the command.
|
@param[in] Port The port number of the ATA device to send the command.
|
||||||
@param[in] PortMultiplierPort The port multiplier port number of the ATA device to send the command.
|
@param[in] PortMultiplierPort The port multiplier port number of the ATA device to send the command.
|
||||||
If there is no port multiplier, then specify 0.
|
If there is no port multiplier, then specify 0.
|
||||||
@param[in] DeviceType The device type of the ATA device.
|
@param[in] DeviceType The device type of the ATA device.
|
||||||
@ -478,7 +478,7 @@ CreateNewDeviceInfo (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Destroy all attached ATA devices info.
|
Destroy all attached ATA devices info.
|
||||||
|
|
||||||
@param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
|
@param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@ -490,21 +490,24 @@ DestroyDeviceInfoList (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Destroy all pending non blocking tasks.
|
Destroy all pending non blocking tasks.
|
||||||
|
|
||||||
@param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
|
@param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
|
||||||
|
@param[in] IsSigEvent Indicate whether signal the task event when remove the
|
||||||
|
task.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
DestroyAsynTaskList (
|
DestroyAsynTaskList (
|
||||||
IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance
|
IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance,
|
||||||
|
IN BOOLEAN IsSigEvent
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Enumerate all attached ATA devices at IDE mode or AHCI mode separately.
|
Enumerate all attached ATA devices at IDE mode or AHCI mode separately.
|
||||||
|
|
||||||
The function is designed to enumerate all attached ATA devices.
|
The function is designed to enumerate all attached ATA devices.
|
||||||
|
|
||||||
@param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
|
@param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Successfully enumerate attached ATA devices.
|
@retval EFI_SUCCESS Successfully enumerate attached ATA devices.
|
||||||
@ -526,9 +529,9 @@ EnumerateAttachedDevice (
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
AsyncNonBlockingTransferRoutine (
|
AsyncNonBlockingTransferRoutine (
|
||||||
EFI_EVENT Event,
|
EFI_EVENT Event,
|
||||||
VOID* Context
|
VOID* Context
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -537,8 +540,8 @@ AsyncNonBlockingTransferRoutine (
|
|||||||
supports both blocking I/O and non-blocking I/O. The blocking I/O functionality is required,
|
supports both blocking I/O and non-blocking I/O. The blocking I/O functionality is required,
|
||||||
and the non-blocking I/O functionality is optional.
|
and the non-blocking I/O functionality is optional.
|
||||||
|
|
||||||
@param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.
|
@param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.
|
||||||
@param[in] Port The port number of the ATA device to send the command.
|
@param[in] Port The port number of the ATA device to send the command.
|
||||||
@param[in] PortMultiplierPort The port multiplier port number of the ATA device to send the command.
|
@param[in] PortMultiplierPort The port multiplier port number of the ATA device to send the command.
|
||||||
If there is no port multiplier, then specify 0.
|
If there is no port multiplier, then specify 0.
|
||||||
@param[in, out] Packet A pointer to the ATA command to send to the ATA device specified by Port
|
@param[in, out] Packet A pointer to the ATA command to send to the ATA device specified by Port
|
||||||
@ -548,11 +551,11 @@ AsyncNonBlockingTransferRoutine (
|
|||||||
Event is not NULL and non blocking I/O is supported, then non-blocking
|
Event is not NULL and non blocking I/O is supported, then non-blocking
|
||||||
I/O is performed, and Event will be signaled when the ATA command completes.
|
I/O is performed, and Event will be signaled when the ATA command completes.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The ATA command was sent by the host. For bi-directional commands,
|
@retval EFI_SUCCESS The ATA command was sent by the host. For bi-directional commands,
|
||||||
InTransferLength bytes were transferred from InDataBuffer. For write and
|
InTransferLength bytes were transferred from InDataBuffer. For write and
|
||||||
bi-directional commands, OutTransferLength bytes were transferred by OutDataBuffer.
|
bi-directional commands, OutTransferLength bytes were transferred by OutDataBuffer.
|
||||||
@retval EFI_BAD_BUFFER_SIZE The ATA command was not executed. The number of bytes that could be transferred
|
@retval EFI_BAD_BUFFER_SIZE The ATA command was not executed. The number of bytes that could be transferred
|
||||||
is returned in InTransferLength. For write and bi-directional commands,
|
is returned in InTransferLength. For write and bi-directional commands,
|
||||||
OutTransferLength bytes were transferred by OutDataBuffer.
|
OutTransferLength bytes were transferred by OutDataBuffer.
|
||||||
@retval EFI_NOT_READY The ATA command could not be sent because there are too many ATA commands
|
@retval EFI_NOT_READY The ATA command could not be sent because there are too many ATA commands
|
||||||
already queued. The caller may retry again later.
|
already queued. The caller may retry again later.
|
||||||
@ -590,7 +593,7 @@ AtaPassThruPassThru (
|
|||||||
If Port is the port number of the last port on the ATA controller, then EFI_NOT_FOUND is
|
If Port is the port number of the last port on the ATA controller, then EFI_NOT_FOUND is
|
||||||
returned.
|
returned.
|
||||||
|
|
||||||
@param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.
|
@param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.
|
||||||
@param[in, out] Port On input, a pointer to the port number on the ATA controller.
|
@param[in, out] Port On input, a pointer to the port number on the ATA controller.
|
||||||
On output, a pointer to the next port number on the ATA
|
On output, a pointer to the next port number on the ATA
|
||||||
controller. An input value of 0xFFFF retrieves the first port
|
controller. An input value of 0xFFFF retrieves the first port
|
||||||
@ -610,36 +613,36 @@ AtaPassThruGetNextPort (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Used to retrieve the list of legal port multiplier port numbers for ATA devices on a port of an ATA
|
Used to retrieve the list of legal port multiplier port numbers for ATA devices on a port of an ATA
|
||||||
controller. These can either be the list of port multiplier ports where ATA devices are actually
|
controller. These can either be the list of port multiplier ports where ATA devices are actually
|
||||||
present on port or the list of legal port multiplier ports on that port. Regardless, the caller of this
|
present on port or the list of legal port multiplier ports on that port. Regardless, the caller of this
|
||||||
function must probe the port number and port multiplier port number returned to see if an ATA
|
function must probe the port number and port multiplier port number returned to see if an ATA
|
||||||
device is actually present.
|
device is actually present.
|
||||||
|
|
||||||
The GetNextDevice() function retrieves the port multiplier port number of an ATA device
|
The GetNextDevice() function retrieves the port multiplier port number of an ATA device
|
||||||
present on a port of an ATA controller.
|
present on a port of an ATA controller.
|
||||||
|
|
||||||
If PortMultiplierPort points to a port multiplier port number value that was returned on a
|
If PortMultiplierPort points to a port multiplier port number value that was returned on a
|
||||||
previous call to GetNextDevice(), then the port multiplier port number of the next ATA device
|
previous call to GetNextDevice(), then the port multiplier port number of the next ATA device
|
||||||
on the port of the ATA controller is returned in PortMultiplierPort, and EFI_SUCCESS is
|
on the port of the ATA controller is returned in PortMultiplierPort, and EFI_SUCCESS is
|
||||||
returned.
|
returned.
|
||||||
|
|
||||||
If PortMultiplierPort points to 0xFFFF, then the port multiplier port number of the first
|
If PortMultiplierPort points to 0xFFFF, then the port multiplier port number of the first
|
||||||
ATA device on port of the ATA controller is returned in PortMultiplierPort and
|
ATA device on port of the ATA controller is returned in PortMultiplierPort and
|
||||||
EFI_SUCCESS is returned.
|
EFI_SUCCESS is returned.
|
||||||
|
|
||||||
If PortMultiplierPort is not 0xFFFF and the value pointed to by PortMultiplierPort
|
If PortMultiplierPort is not 0xFFFF and the value pointed to by PortMultiplierPort
|
||||||
was not returned on a previous call to GetNextDevice(), then EFI_INVALID_PARAMETER
|
was not returned on a previous call to GetNextDevice(), then EFI_INVALID_PARAMETER
|
||||||
is returned.
|
is returned.
|
||||||
|
|
||||||
If PortMultiplierPort is the port multiplier port number of the last ATA device on the port of
|
If PortMultiplierPort is the port multiplier port number of the last ATA device on the port of
|
||||||
the ATA controller, then EFI_NOT_FOUND is returned.
|
the ATA controller, then EFI_NOT_FOUND is returned.
|
||||||
|
|
||||||
@param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.
|
@param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.
|
||||||
@param[in] Port The port number present on the ATA controller.
|
@param[in] Port The port number present on the ATA controller.
|
||||||
@param[in, out] PortMultiplierPort On input, a pointer to the port multiplier port number of an
|
@param[in, out] PortMultiplierPort On input, a pointer to the port multiplier port number of an
|
||||||
ATA device present on the ATA controller.
|
ATA device present on the ATA controller.
|
||||||
If on input a PortMultiplierPort of 0xFFFF is specified,
|
If on input a PortMultiplierPort of 0xFFFF is specified,
|
||||||
then the port multiplier port number of the first ATA device
|
then the port multiplier port number of the first ATA device
|
||||||
is returned. On output, a pointer to the port multiplier port
|
is returned. On output, a pointer to the port multiplier port
|
||||||
number of the next ATA device present on an ATA controller.
|
number of the next ATA device present on an ATA controller.
|
||||||
@ -705,7 +708,7 @@ AtaPassThruBuildDevicePath (
|
|||||||
|
|
||||||
The GetDevice() function determines the port and port multiplier port number associated with
|
The GetDevice() function determines the port and port multiplier port number associated with
|
||||||
the ATA device described by DevicePath. If DevicePath is a device path node type that the
|
the ATA device described by DevicePath. If DevicePath is a device path node type that the
|
||||||
ATA Pass Thru driver supports, then the ATA Pass Thru driver will attempt to translate the contents
|
ATA Pass Thru driver supports, then the ATA Pass Thru driver will attempt to translate the contents
|
||||||
DevicePath into a port number and port multiplier port number.
|
DevicePath into a port number and port multiplier port number.
|
||||||
|
|
||||||
If this translation is successful, then that port number and port multiplier port number are returned
|
If this translation is successful, then that port number and port multiplier port number are returned
|
||||||
@ -713,11 +716,11 @@ AtaPassThruBuildDevicePath (
|
|||||||
|
|
||||||
If DevicePath, Port, or PortMultiplierPort are NULL, then EFI_INVALID_PARAMETER is returned.
|
If DevicePath, Port, or PortMultiplierPort are NULL, then EFI_INVALID_PARAMETER is returned.
|
||||||
|
|
||||||
If DevicePath is not a device path node type that the ATA Pass Thru driver supports, then
|
If DevicePath is not a device path node type that the ATA Pass Thru driver supports, then
|
||||||
EFI_UNSUPPORTED is returned.
|
EFI_UNSUPPORTED is returned.
|
||||||
|
|
||||||
If DevicePath is a device path node type that the ATA Pass Thru driver supports, but there is not
|
If DevicePath is a device path node type that the ATA Pass Thru driver supports, but there is not
|
||||||
a valid translation from DevicePath to a port number and port multiplier port number, then
|
a valid translation from DevicePath to a port number and port multiplier port number, then
|
||||||
EFI_NOT_FOUND is returned.
|
EFI_NOT_FOUND is returned.
|
||||||
|
|
||||||
@param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.
|
@param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.
|
||||||
@ -784,7 +787,7 @@ AtaPassThruResetPort (
|
|||||||
If this ATA controller does not support a device reset operation, then EFI_UNSUPPORTED is
|
If this ATA controller does not support a device reset operation, then EFI_UNSUPPORTED is
|
||||||
returned.
|
returned.
|
||||||
|
|
||||||
If Port or PortMultiplierPort are not in a valid range for this ATA controller, then
|
If Port or PortMultiplierPort are not in a valid range for this ATA controller, then
|
||||||
EFI_INVALID_PARAMETER is returned.
|
EFI_INVALID_PARAMETER is returned.
|
||||||
|
|
||||||
If a device error occurs while executing that device reset operation, then EFI_DEVICE_ERROR
|
If a device error occurs while executing that device reset operation, then EFI_DEVICE_ERROR
|
||||||
@ -817,9 +820,9 @@ AtaPassThruResetDevice (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel. This function
|
Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel. This function
|
||||||
supports both blocking I/O and nonblocking I/O. The blocking I/O functionality is required, and the
|
supports both blocking I/O and nonblocking I/O. The blocking I/O functionality is required, and the
|
||||||
nonblocking I/O functionality is optional.
|
nonblocking I/O functionality is optional.
|
||||||
|
|
||||||
@param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
|
@param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
|
||||||
@param Target The Target is an array of size TARGET_MAX_BYTES and it represents
|
@param Target The Target is an array of size TARGET_MAX_BYTES and it represents
|
||||||
@ -868,10 +871,10 @@ ExtScsiPassThruPassThru (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Used to retrieve the list of legal Target IDs and LUNs for SCSI devices on a SCSI channel. These
|
Used to retrieve the list of legal Target IDs and LUNs for SCSI devices on a SCSI channel. These
|
||||||
can either be the list SCSI devices that are actually present on the SCSI channel, or the list of legal
|
can either be the list SCSI devices that are actually present on the SCSI channel, or the list of legal
|
||||||
Target Ids and LUNs for the SCSI channel. Regardless, the caller of this function must probe the
|
Target Ids and LUNs for the SCSI channel. Regardless, the caller of this function must probe the
|
||||||
Target ID and LUN returned to see if a SCSI device is actually present at that location on the SCSI
|
Target ID and LUN returned to see if a SCSI device is actually present at that location on the SCSI
|
||||||
channel.
|
channel.
|
||||||
|
|
||||||
@param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
|
@param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
|
||||||
@ -1007,13 +1010,13 @@ ExtScsiPassThruResetTargetLun (
|
|||||||
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
|
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
|
||||||
IN UINT8 *Target,
|
IN UINT8 *Target,
|
||||||
IN UINT64 Lun
|
IN UINT64 Lun
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Used to retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. These can either
|
Used to retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. These can either
|
||||||
be the list SCSI devices that are actually present on the SCSI channel, or the list of legal Target IDs
|
be the list SCSI devices that are actually present on the SCSI channel, or the list of legal Target IDs
|
||||||
for the SCSI channel. Regardless, the caller of this function must probe the Target ID returned to
|
for the SCSI channel. Regardless, the caller of this function must probe the Target ID returned to
|
||||||
see if a SCSI device is actually present at that location on the SCSI channel.
|
see if a SCSI device is actually present at that location on the SCSI channel.
|
||||||
|
|
||||||
@param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
|
@param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
|
||||||
@param Target (TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.
|
@param Target (TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.
|
||||||
@ -1040,9 +1043,9 @@ ExtScsiPassThruGetNextTarget (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize ATA host controller at IDE mode.
|
Initialize ATA host controller at IDE mode.
|
||||||
|
|
||||||
The function is designed to initialize ATA host controller.
|
The function is designed to initialize ATA host controller.
|
||||||
|
|
||||||
@param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
|
@param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@ -1054,9 +1057,9 @@ IdeModeInitialization (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize ATA host controller at AHCI mode.
|
Initialize ATA host controller at AHCI mode.
|
||||||
|
|
||||||
The function is designed to initialize ATA host controller.
|
The function is designed to initialize ATA host controller.
|
||||||
|
|
||||||
@param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
|
@param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@ -1068,7 +1071,7 @@ AhciModeInitialization (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Start a non data transfer on specific port.
|
Start a non data transfer on specific port.
|
||||||
|
|
||||||
@param[in] PciIo The PCI IO protocol instance.
|
@param[in] PciIo The PCI IO protocol instance.
|
||||||
@param[in] AhciRegisters The pointer to the EFI_AHCI_REGISTERS.
|
@param[in] AhciRegisters The pointer to the EFI_AHCI_REGISTERS.
|
||||||
@param[in] Port The number of port.
|
@param[in] Port The number of port.
|
||||||
@ -1099,7 +1102,7 @@ AhciNonDataTransfer (
|
|||||||
IN UINT8 AtapiCommandLength,
|
IN UINT8 AtapiCommandLength,
|
||||||
IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock,
|
IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock,
|
||||||
IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock,
|
IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock,
|
||||||
IN UINT64 Timeout,
|
IN UINT64 Timeout,
|
||||||
IN ATA_NONBLOCK_TASK *Task
|
IN ATA_NONBLOCK_TASK *Task
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1131,24 +1134,24 @@ AhciNonDataTransfer (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
AhciDmaTransfer (
|
AhciDmaTransfer (
|
||||||
IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance,
|
IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance,
|
||||||
IN EFI_AHCI_REGISTERS *AhciRegisters,
|
IN EFI_AHCI_REGISTERS *AhciRegisters,
|
||||||
IN UINT8 Port,
|
IN UINT8 Port,
|
||||||
IN UINT8 PortMultiplier,
|
IN UINT8 PortMultiplier,
|
||||||
IN EFI_AHCI_ATAPI_COMMAND *AtapiCommand OPTIONAL,
|
IN EFI_AHCI_ATAPI_COMMAND *AtapiCommand OPTIONAL,
|
||||||
IN UINT8 AtapiCommandLength,
|
IN UINT8 AtapiCommandLength,
|
||||||
IN BOOLEAN Read,
|
IN BOOLEAN Read,
|
||||||
IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock,
|
IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock,
|
||||||
IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock,
|
IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock,
|
||||||
IN OUT VOID *MemoryAddr,
|
IN OUT VOID *MemoryAddr,
|
||||||
IN UINT32 DataCount,
|
IN UINT32 DataCount,
|
||||||
IN UINT64 Timeout,
|
IN UINT64 Timeout,
|
||||||
IN ATA_NONBLOCK_TASK *Task
|
IN ATA_NONBLOCK_TASK *Task
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Start a PIO data transfer on specific port.
|
Start a PIO data transfer on specific port.
|
||||||
|
|
||||||
@param[in] PciIo The PCI IO protocol instance.
|
@param[in] PciIo The PCI IO protocol instance.
|
||||||
@param[in] AhciRegisters The pointer to the EFI_AHCI_REGISTERS.
|
@param[in] AhciRegisters The pointer to the EFI_AHCI_REGISTERS.
|
||||||
@param[in] Port The number of port.
|
@param[in] Port The number of port.
|
||||||
@ -1179,13 +1182,13 @@ AhciPioTransfer (
|
|||||||
IN UINT8 Port,
|
IN UINT8 Port,
|
||||||
IN UINT8 PortMultiplier,
|
IN UINT8 PortMultiplier,
|
||||||
IN EFI_AHCI_ATAPI_COMMAND *AtapiCommand OPTIONAL,
|
IN EFI_AHCI_ATAPI_COMMAND *AtapiCommand OPTIONAL,
|
||||||
IN UINT8 AtapiCommandLength,
|
IN UINT8 AtapiCommandLength,
|
||||||
IN BOOLEAN Read,
|
IN BOOLEAN Read,
|
||||||
IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock,
|
IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock,
|
||||||
IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock,
|
IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock,
|
||||||
IN OUT VOID *MemoryAddr,
|
IN OUT VOID *MemoryAddr,
|
||||||
IN UINT32 DataCount,
|
IN UINT32 DataCount,
|
||||||
IN UINT64 Timeout,
|
IN UINT64 Timeout,
|
||||||
IN ATA_NONBLOCK_TASK *Task
|
IN ATA_NONBLOCK_TASK *Task
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1273,7 +1276,7 @@ AtaUdmaInOut (
|
|||||||
@param[in] Timeout The time to complete the command, uses 100ns as a unit.
|
@param[in] Timeout The time to complete the command, uses 100ns as a unit.
|
||||||
@param[in] Task Optional. Pointer to the ATA_NONBLOCK_TASK
|
@param[in] Task Optional. Pointer to the ATA_NONBLOCK_TASK
|
||||||
used by non-blocking mode.
|
used by non-blocking mode.
|
||||||
|
|
||||||
@retval EFI_SUCCESS send out the ATA command and device send required data successfully.
|
@retval EFI_SUCCESS send out the ATA command and device send required data successfully.
|
||||||
@retval EFI_DEVICE_ERROR command sent failed.
|
@retval EFI_DEVICE_ERROR command sent failed.
|
||||||
|
|
||||||
@ -1288,7 +1291,7 @@ AtaPioDataInOut (
|
|||||||
IN BOOLEAN Read,
|
IN BOOLEAN Read,
|
||||||
IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock,
|
IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock,
|
||||||
IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock,
|
IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock,
|
||||||
IN UINT64 Timeout,
|
IN UINT64 Timeout,
|
||||||
IN ATA_NONBLOCK_TASK *Task
|
IN ATA_NONBLOCK_TASK *Task
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/** @file
|
/** @file
|
||||||
This file implements protocol interfaces for ATA bus driver.
|
This file implements protocol interfaces for ATA bus driver.
|
||||||
|
|
||||||
This file implements protocol interfaces: Driver Binding protocol,
|
This file implements protocol interfaces: Driver Binding protocol,
|
||||||
Block IO protocol and DiskInfo protocol.
|
Block IO protocol and DiskInfo protocol.
|
||||||
|
|
||||||
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
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
|
||||||
@ -58,7 +58,7 @@ ATA_DEVICE gAtaDeviceTemplate = {
|
|||||||
FALSE, // LogicPartition
|
FALSE, // LogicPartition
|
||||||
FALSE, // ReadOnly
|
FALSE, // ReadOnly
|
||||||
FALSE, // WritingCache
|
FALSE, // WritingCache
|
||||||
0x200, // BlockSize
|
0x200, // BlockSize
|
||||||
0, // IoAlign
|
0, // IoAlign
|
||||||
0, // LastBlock
|
0, // LastBlock
|
||||||
0, // LowestAlignedLba
|
0, // LowestAlignedLba
|
||||||
@ -87,7 +87,8 @@ ATA_DEVICE gAtaDeviceTemplate = {
|
|||||||
NULL, // IdentifyData
|
NULL, // IdentifyData
|
||||||
NULL, // ControllerNameTable
|
NULL, // ControllerNameTable
|
||||||
{L'\0', }, // ModelName
|
{L'\0', }, // ModelName
|
||||||
{NULL, NULL} // AtaTaskList
|
{NULL, NULL}, // AtaTaskList
|
||||||
|
{NULL, NULL} // AtaSubTaskList
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -147,10 +148,11 @@ ReleaseAtaResources (
|
|||||||
IN ATA_DEVICE *AtaDevice
|
IN ATA_DEVICE *AtaDevice
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ATA_BUS_ASYN_TASK *Task;
|
ATA_BUS_ASYN_SUB_TASK *SubTask;
|
||||||
LIST_ENTRY *Entry;
|
ATA_BUS_ASYN_TASK *AtaTask;
|
||||||
LIST_ENTRY *DelEntry;
|
LIST_ENTRY *Entry;
|
||||||
EFI_TPL OldTpl;
|
LIST_ENTRY *DelEntry;
|
||||||
|
EFI_TPL OldTpl;
|
||||||
|
|
||||||
FreeUnicodeStringTable (AtaDevice->ControllerNameTable);
|
FreeUnicodeStringTable (AtaDevice->ControllerNameTable);
|
||||||
FreeAlignedBuffer (AtaDevice->Asb, sizeof (EFI_ATA_STATUS_BLOCK));
|
FreeAlignedBuffer (AtaDevice->Asb, sizeof (EFI_ATA_STATUS_BLOCK));
|
||||||
@ -159,19 +161,34 @@ ReleaseAtaResources (
|
|||||||
FreePool (AtaDevice->DevicePath);
|
FreePool (AtaDevice->DevicePath);
|
||||||
}
|
}
|
||||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||||
|
if (!IsListEmpty (&AtaDevice->AtaSubTaskList)) {
|
||||||
|
//
|
||||||
|
// Free the Subtask list.
|
||||||
|
//
|
||||||
|
for(Entry = AtaDevice->AtaSubTaskList.ForwardLink;
|
||||||
|
Entry != (&AtaDevice->AtaSubTaskList);
|
||||||
|
) {
|
||||||
|
DelEntry = Entry;
|
||||||
|
Entry = Entry->ForwardLink;
|
||||||
|
SubTask = ATA_AYNS_SUB_TASK_FROM_ENTRY (DelEntry);
|
||||||
|
|
||||||
|
RemoveEntryList (DelEntry);
|
||||||
|
FreeAtaSubTask (SubTask);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!IsListEmpty (&AtaDevice->AtaTaskList)) {
|
if (!IsListEmpty (&AtaDevice->AtaTaskList)) {
|
||||||
//
|
//
|
||||||
// Free the Subtask list.
|
// Free the Subtask list.
|
||||||
//
|
//
|
||||||
for(Entry = AtaDevice->AtaTaskList.ForwardLink;
|
for(Entry = AtaDevice->AtaTaskList.ForwardLink;
|
||||||
Entry != (&AtaDevice->AtaTaskList);
|
Entry != (&AtaDevice->AtaTaskList);
|
||||||
) {
|
) {
|
||||||
DelEntry = Entry;
|
DelEntry = Entry;
|
||||||
Entry = Entry->ForwardLink;
|
Entry = Entry->ForwardLink;
|
||||||
Task = ATA_AYNS_TASK_FROM_ENTRY (DelEntry);
|
AtaTask = ATA_AYNS_TASK_FROM_ENTRY (DelEntry);
|
||||||
|
|
||||||
RemoveEntryList (DelEntry);
|
RemoveEntryList (DelEntry);
|
||||||
FreeAtaSubTask (Task);
|
FreePool (AtaTask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gBS->RestoreTPL (OldTpl);
|
gBS->RestoreTPL (OldTpl);
|
||||||
@ -183,7 +200,7 @@ ReleaseAtaResources (
|
|||||||
Registers an ATA device.
|
Registers an ATA device.
|
||||||
|
|
||||||
This function allocates an ATA device structure for the ATA device specified by
|
This function allocates an ATA device structure for the ATA device specified by
|
||||||
Port and PortMultiplierPort if the ATA device is identified as a valid one.
|
Port and PortMultiplierPort if the ATA device is identified as a valid one.
|
||||||
Then it will create child handle and install Block IO and Disk Info protocol on
|
Then it will create child handle and install Block IO and Disk Info protocol on
|
||||||
it.
|
it.
|
||||||
|
|
||||||
@ -217,7 +234,7 @@ RegisterAtaDevice (
|
|||||||
RemainingDevicePath = NULL;
|
RemainingDevicePath = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Build device path
|
// Build device path
|
||||||
//
|
//
|
||||||
AtaPassThru = AtaBusDriverData->AtaPassThru;
|
AtaPassThru = AtaBusDriverData->AtaPassThru;
|
||||||
Status = AtaPassThru->BuildDevicePath (AtaPassThru, Port, PortMultiplierPort, &NewDevicePathNode);
|
Status = AtaPassThru->BuildDevicePath (AtaPassThru, Port, PortMultiplierPort, &NewDevicePathNode);
|
||||||
@ -273,9 +290,10 @@ RegisterAtaDevice (
|
|||||||
// Initial Ata Task List
|
// Initial Ata Task List
|
||||||
//
|
//
|
||||||
InitializeListHead (&AtaDevice->AtaTaskList);
|
InitializeListHead (&AtaDevice->AtaTaskList);
|
||||||
|
InitializeListHead (&AtaDevice->AtaSubTaskList);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Try to identify the ATA device via the ATA pass through command.
|
// Try to identify the ATA device via the ATA pass through command.
|
||||||
//
|
//
|
||||||
Status = DiscoverAtaDevice (AtaDevice);
|
Status = DiscoverAtaDevice (AtaDevice);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
@ -363,7 +381,7 @@ Done:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status) && (AtaDevice != NULL)) {
|
if (EFI_ERROR (Status) && (AtaDevice != NULL)) {
|
||||||
ReleaseAtaResources (AtaDevice);
|
ReleaseAtaResources (AtaDevice);
|
||||||
DEBUG ((EFI_D_ERROR | EFI_D_INIT, "Failed to initialize Port %x PortMultiplierPort %x, status = %r\n", Port, PortMultiplierPort, Status));
|
DEBUG ((EFI_D_ERROR | EFI_D_INIT, "Failed to initialize Port %x PortMultiplierPort %x, status = %r\n", Port, PortMultiplierPort, Status));
|
||||||
}
|
}
|
||||||
return Status;
|
return Status;
|
||||||
@ -373,8 +391,8 @@ Done:
|
|||||||
/**
|
/**
|
||||||
Unregisters an ATA device.
|
Unregisters an ATA device.
|
||||||
|
|
||||||
This function removes the protocols installed on the controller handle and
|
This function removes the protocols installed on the controller handle and
|
||||||
frees the resources allocated for the ATA device.
|
frees the resources allocated for the ATA device.
|
||||||
|
|
||||||
@param This The pointer to EFI_DRIVER_BINDING_PROTOCOL instance.
|
@param This The pointer to EFI_DRIVER_BINDING_PROTOCOL instance.
|
||||||
@param Controller The controller handle of the ATA device.
|
@param Controller The controller handle of the ATA device.
|
||||||
@ -433,7 +451,7 @@ UnregisterAtaDevice (
|
|||||||
AtaDevice = ATA_DEVICE_FROM_BLOCK_IO (BlockIo);
|
AtaDevice = ATA_DEVICE_FROM_BLOCK_IO (BlockIo);
|
||||||
} else {
|
} else {
|
||||||
AtaDevice = ATA_DEVICE_FROM_BLOCK_IO2 (BlockIo2);
|
AtaDevice = ATA_DEVICE_FROM_BLOCK_IO2 (BlockIo2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Close the child handle
|
// Close the child handle
|
||||||
@ -512,33 +530,33 @@ UnregisterAtaDevice (
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Tests to see if this driver supports a given controller. If a child device is provided,
|
Tests to see if this driver supports a given controller. If a child device is provided,
|
||||||
it further tests to see if this driver supports creating a handle for the specified child device.
|
it further tests to see if this driver supports creating a handle for the specified child device.
|
||||||
|
|
||||||
This function checks to see if the driver specified by This supports the device specified by
|
This function checks to see if the driver specified by This supports the device specified by
|
||||||
ControllerHandle. Drivers will typically use the device path attached to
|
ControllerHandle. Drivers will typically use the device path attached to
|
||||||
ControllerHandle and/or the services from the bus I/O abstraction attached to
|
ControllerHandle and/or the services from the bus I/O abstraction attached to
|
||||||
ControllerHandle to determine if the driver supports ControllerHandle. This function
|
ControllerHandle to determine if the driver supports ControllerHandle. This function
|
||||||
may be called many times during platform initialization. In order to reduce boot times, the tests
|
may be called many times during platform initialization. In order to reduce boot times, the tests
|
||||||
performed by this function must be very small, and take as little time as possible to execute. This
|
performed by this function must be very small, and take as little time as possible to execute. This
|
||||||
function must not change the state of any hardware devices, and this function must be aware that the
|
function must not change the state of any hardware devices, and this function must be aware that the
|
||||||
device specified by ControllerHandle may already be managed by the same driver or a
|
device specified by ControllerHandle may already be managed by the same driver or a
|
||||||
different driver. This function must match its calls to AllocatePages() with FreePages(),
|
different driver. This function must match its calls to AllocatePages() with FreePages(),
|
||||||
AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
|
AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
|
||||||
Since ControllerHandle may have been previously started by the same driver, if a protocol is
|
Since ControllerHandle may have been previously started by the same driver, if a protocol is
|
||||||
already in the opened state, then it must not be closed with CloseProtocol(). This is required
|
already in the opened state, then it must not be closed with CloseProtocol(). This is required
|
||||||
to guarantee the state of ControllerHandle is not modified by this function.
|
to guarantee the state of ControllerHandle is not modified by this function.
|
||||||
|
|
||||||
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
||||||
@param[in] ControllerHandle The handle of the controller to test. This handle
|
@param[in] ControllerHandle The handle of the controller to test. This handle
|
||||||
must support a protocol interface that supplies
|
must support a protocol interface that supplies
|
||||||
an I/O abstraction to the driver.
|
an I/O abstraction to the driver.
|
||||||
@param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
|
@param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
|
||||||
parameter is ignored by device drivers, and is optional for bus
|
parameter is ignored by device drivers, and is optional for bus
|
||||||
drivers. For bus drivers, if this parameter is not NULL, then
|
drivers. For bus drivers, if this parameter is not NULL, then
|
||||||
the bus driver must determine if the bus controller specified
|
the bus driver must determine if the bus controller specified
|
||||||
by ControllerHandle and the child controller specified
|
by ControllerHandle and the child controller specified
|
||||||
by RemainingDevicePath are both supported by this
|
by RemainingDevicePath are both supported by this
|
||||||
bus driver.
|
bus driver.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The device specified by ControllerHandle and
|
@retval EFI_SUCCESS The device specified by ControllerHandle and
|
||||||
@ -626,28 +644,28 @@ AtaBusDriverBindingSupported (
|
|||||||
Starts a device controller or a bus controller.
|
Starts a device controller or a bus controller.
|
||||||
|
|
||||||
The Start() function is designed to be invoked from the EFI boot service ConnectController().
|
The Start() function is designed to be invoked from the EFI boot service ConnectController().
|
||||||
As a result, much of the error checking on the parameters to Start() has been moved into this
|
As a result, much of the error checking on the parameters to Start() has been moved into this
|
||||||
common boot service. It is legal to call Start() from other locations,
|
common boot service. It is legal to call Start() from other locations,
|
||||||
but the following calling restrictions must be followed or the system behavior will not be deterministic.
|
but the following calling restrictions must be followed or the system behavior will not be deterministic.
|
||||||
1. ControllerHandle must be a valid EFI_HANDLE.
|
1. ControllerHandle must be a valid EFI_HANDLE.
|
||||||
2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
|
2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
|
||||||
EFI_DEVICE_PATH_PROTOCOL.
|
EFI_DEVICE_PATH_PROTOCOL.
|
||||||
3. Prior to calling Start(), the Supported() function for the driver specified by This must
|
3. Prior to calling Start(), the Supported() function for the driver specified by This must
|
||||||
have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
|
have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
|
||||||
|
|
||||||
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
||||||
@param[in] ControllerHandle The handle of the controller to start. This handle
|
@param[in] ControllerHandle The handle of the controller to start. This handle
|
||||||
must support a protocol interface that supplies
|
must support a protocol interface that supplies
|
||||||
an I/O abstraction to the driver.
|
an I/O abstraction to the driver.
|
||||||
@param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
|
@param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
|
||||||
parameter is ignored by device drivers, and is optional for bus
|
parameter is ignored by device drivers, and is optional for bus
|
||||||
drivers. For a bus driver, if this parameter is NULL, then handles
|
drivers. For a bus driver, if this parameter is NULL, then handles
|
||||||
for all the children of Controller are created by this driver.
|
for all the children of Controller are created by this driver.
|
||||||
If this parameter is not NULL and the first Device Path Node is
|
If this parameter is not NULL and the first Device Path Node is
|
||||||
not the End of Device Path Node, then only the handle for the
|
not the End of Device Path Node, then only the handle for the
|
||||||
child device specified by the first Device Path Node of
|
child device specified by the first Device Path Node of
|
||||||
RemainingDevicePath is created by this driver.
|
RemainingDevicePath is created by this driver.
|
||||||
If the first Device Path Node of RemainingDevicePath is
|
If the first Device Path Node of RemainingDevicePath is
|
||||||
the End of Device Path Node, no child handle is created by this
|
the End of Device Path Node, no child handle is created by this
|
||||||
driver.
|
driver.
|
||||||
|
|
||||||
@ -798,10 +816,10 @@ ErrorExit:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Stops a device controller or a bus controller.
|
Stops a device controller or a bus controller.
|
||||||
|
|
||||||
The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
|
The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
|
||||||
As a result, much of the error checking on the parameters to Stop() has been moved
|
As a result, much of the error checking on the parameters to Stop() has been moved
|
||||||
into this common boot service. It is legal to call Stop() from other locations,
|
into this common boot service. It is legal to call Stop() from other locations,
|
||||||
but the following calling restrictions must be followed or the system behavior will not be deterministic.
|
but the following calling restrictions must be followed or the system behavior will not be deterministic.
|
||||||
1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
|
1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
|
||||||
same driver's Start() function.
|
same driver's Start() function.
|
||||||
@ -809,13 +827,13 @@ ErrorExit:
|
|||||||
EFI_HANDLE. In addition, all of these handles must have been created in this driver's
|
EFI_HANDLE. In addition, all of these handles must have been created in this driver's
|
||||||
Start() function, and the Start() function must have called OpenProtocol() on
|
Start() function, and the Start() function must have called OpenProtocol() on
|
||||||
ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
|
ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
|
||||||
|
|
||||||
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
||||||
@param[in] ControllerHandle A handle to the device being stopped. The handle must
|
@param[in] ControllerHandle A handle to the device being stopped. The handle must
|
||||||
support a bus specific I/O protocol for the driver
|
support a bus specific I/O protocol for the driver
|
||||||
to use to stop the device.
|
to use to stop the device.
|
||||||
@param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
|
@param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
|
||||||
@param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
|
@param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
|
||||||
if NumberOfChildren is 0.
|
if NumberOfChildren is 0.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The device was stopped.
|
@retval EFI_SUCCESS The device was stopped.
|
||||||
@ -924,7 +942,7 @@ AtaBlockIoReset (
|
|||||||
Read/Write BufferSize bytes from Lba from/into Buffer.
|
Read/Write BufferSize bytes from Lba from/into Buffer.
|
||||||
|
|
||||||
@param[in] This Indicates a pointer to the calling context. Either be
|
@param[in] This Indicates a pointer to the calling context. Either be
|
||||||
block I/O or block I/O2.
|
block I/O or block I/O2.
|
||||||
@param[in] MediaId The media ID that the read/write request is for.
|
@param[in] MediaId The media ID that the read/write request is for.
|
||||||
@param[in] Lba The starting logical block address to be read/written.
|
@param[in] Lba The starting logical block address to be read/written.
|
||||||
The caller is responsible for reading/writing to only
|
The caller is responsible for reading/writing to only
|
||||||
@ -942,7 +960,7 @@ AtaBlockIoReset (
|
|||||||
@retval EFI_NO_MEDIA There is no media in the device.
|
@retval EFI_NO_MEDIA There is no media in the device.
|
||||||
@retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
|
@retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
|
||||||
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
|
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
|
||||||
@retval EFI_INVALID_PARAMETER The read/write request contains LBAs that are not valid,
|
@retval EFI_INVALID_PARAMETER The read/write request contains LBAs that are not valid,
|
||||||
or the buffer is not on proper alignment.
|
or the buffer is not on proper alignment.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@ -987,13 +1005,13 @@ BlockIoReadWrite (
|
|||||||
|
|
||||||
if (BufferSize == 0) {
|
if (BufferSize == 0) {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockSize = Media->BlockSize;
|
BlockSize = Media->BlockSize;
|
||||||
if ((BufferSize % BlockSize) != 0) {
|
if ((BufferSize % BlockSize) != 0) {
|
||||||
return EFI_BAD_BUFFER_SIZE;
|
return EFI_BAD_BUFFER_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NumberOfBlocks = BufferSize / BlockSize;
|
NumberOfBlocks = BufferSize / BlockSize;
|
||||||
if ((Lba + NumberOfBlocks - 1) > Media->LastBlock) {
|
if ((Lba + NumberOfBlocks - 1) > Media->LastBlock) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
@ -1005,12 +1023,12 @@ BlockIoReadWrite (
|
|||||||
}
|
}
|
||||||
|
|
||||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Invoke low level AtaDevice Access Routine.
|
// Invoke low level AtaDevice Access Routine.
|
||||||
//
|
//
|
||||||
Status = AccessAtaDevice (AtaDevice, Buffer, Lba, NumberOfBlocks, IsWrite, Token);
|
Status = AccessAtaDevice (AtaDevice, Buffer, Lba, NumberOfBlocks, IsWrite, Token);
|
||||||
|
|
||||||
gBS->RestoreTPL (OldTpl);
|
gBS->RestoreTPL (OldTpl);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
@ -1032,7 +1050,7 @@ BlockIoReadWrite (
|
|||||||
@retval EFI_NO_MEDIA There is no media in the device.
|
@retval EFI_NO_MEDIA There is no media in the device.
|
||||||
@retval EFI_MEDIA_CHANGED The MediaId does not matched the current device.
|
@retval EFI_MEDIA_CHANGED The MediaId does not matched the current device.
|
||||||
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
|
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
|
||||||
@retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
|
@retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
|
||||||
or the buffer is not on proper alignment.
|
or the buffer is not on proper alignment.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@ -1066,7 +1084,7 @@ AtaBlockIoReadBlocks (
|
|||||||
@retval EFI_NO_MEDIA There is no media in the device.
|
@retval EFI_NO_MEDIA There is no media in the device.
|
||||||
@retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
|
@retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
|
||||||
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
|
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
|
||||||
@retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
|
@retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
|
||||||
or the buffer is not on proper alignment.
|
or the buffer is not on proper alignment.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@ -1162,7 +1180,7 @@ AtaBlockIoResetEx (
|
|||||||
@retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
|
@retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
|
||||||
@retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the
|
@retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the
|
||||||
intrinsic block size of the device.
|
intrinsic block size of the device.
|
||||||
@retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
|
@retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
|
||||||
or the buffer is not on proper alignment.
|
or the buffer is not on proper alignment.
|
||||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack
|
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack
|
||||||
of resources.
|
of resources.
|
||||||
@ -1201,7 +1219,7 @@ AtaBlockIoReadBlocksEx (
|
|||||||
@retval EFI_NO_MEDIA There is no media in the device.
|
@retval EFI_NO_MEDIA There is no media in the device.
|
||||||
@retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
|
@retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
|
||||||
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
|
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
|
||||||
@retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
|
@retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
|
||||||
or the buffer is not on proper alignment.
|
or the buffer is not on proper alignment.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@ -1249,7 +1267,7 @@ AtaBlockIoFlushBlocksEx (
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
Provides inquiry information for the controller type.
|
Provides inquiry information for the controller type.
|
||||||
|
|
||||||
This function is used by the IDE bus driver to get inquiry data. Data format
|
This function is used by the IDE bus driver to get inquiry data. Data format
|
||||||
of Identify data is defined by the Interface GUID.
|
of Identify data is defined by the Interface GUID.
|
||||||
|
|
||||||
@ -1258,9 +1276,9 @@ AtaBlockIoFlushBlocksEx (
|
|||||||
@param[in, out] InquiryDataSize Pointer to the value for the inquiry data size.
|
@param[in, out] InquiryDataSize Pointer to the value for the inquiry data size.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The command was accepted without any errors.
|
@retval EFI_SUCCESS The command was accepted without any errors.
|
||||||
@retval EFI_NOT_FOUND Device does not support this data class
|
@retval EFI_NOT_FOUND Device does not support this data class
|
||||||
@retval EFI_DEVICE_ERROR Error reading InquiryData from device
|
@retval EFI_DEVICE_ERROR Error reading InquiryData from device
|
||||||
@retval EFI_BUFFER_TOO_SMALL InquiryDataSize not big enough
|
@retval EFI_BUFFER_TOO_SMALL InquiryDataSize not big enough
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -1281,16 +1299,16 @@ AtaDiskInfoInquiry (
|
|||||||
This function is used by the IDE bus driver to get identify data. Data format
|
This function is used by the IDE bus driver to get identify data. Data format
|
||||||
of Identify data is defined by the Interface GUID.
|
of Identify data is defined by the Interface GUID.
|
||||||
|
|
||||||
@param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL
|
@param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL
|
||||||
instance.
|
instance.
|
||||||
@param[in, out] IdentifyData Pointer to a buffer for the identify data.
|
@param[in, out] IdentifyData Pointer to a buffer for the identify data.
|
||||||
@param[in, out] IdentifyDataSize Pointer to the value for the identify data
|
@param[in, out] IdentifyDataSize Pointer to the value for the identify data
|
||||||
size.
|
size.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The command was accepted without any errors.
|
@retval EFI_SUCCESS The command was accepted without any errors.
|
||||||
@retval EFI_NOT_FOUND Device does not support this data class
|
@retval EFI_NOT_FOUND Device does not support this data class
|
||||||
@retval EFI_DEVICE_ERROR Error reading IdentifyData from device
|
@retval EFI_DEVICE_ERROR Error reading IdentifyData from device
|
||||||
@retval EFI_BUFFER_TOO_SMALL IdentifyDataSize not big enough
|
@retval EFI_BUFFER_TOO_SMALL IdentifyDataSize not big enough
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -1319,8 +1337,8 @@ AtaDiskInfoIdentify (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Provides sense data information for the controller type.
|
Provides sense data information for the controller type.
|
||||||
|
|
||||||
This function is used by the IDE bus driver to get sense data.
|
This function is used by the IDE bus driver to get sense data.
|
||||||
Data format of Sense data is defined by the Interface GUID.
|
Data format of Sense data is defined by the Interface GUID.
|
||||||
|
|
||||||
@param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
|
@param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
|
||||||
@ -1350,7 +1368,7 @@ AtaDiskInfoSenseData (
|
|||||||
/**
|
/**
|
||||||
This function is used by the IDE bus driver to get controller information.
|
This function is used by the IDE bus driver to get controller information.
|
||||||
|
|
||||||
@param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
|
@param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
|
||||||
@param[out] IdeChannel Pointer to the Ide Channel number. Primary or secondary.
|
@param[out] IdeChannel Pointer to the Ide Channel number. Primary or secondary.
|
||||||
@param[out] IdeDevice Pointer to the Ide Device number. Master or slave.
|
@param[out] IdeDevice Pointer to the Ide Device number. Master or slave.
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
This file defines common data structures, macro definitions and some module
|
This file defines common data structures, macro definitions and some module
|
||||||
internal function header files.
|
internal function header files.
|
||||||
|
|
||||||
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
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
|
||||||
@ -35,6 +35,7 @@
|
|||||||
#include <Library/MemoryAllocationLib.h>
|
#include <Library/MemoryAllocationLib.h>
|
||||||
#include <Library/UefiBootServicesTableLib.h>
|
#include <Library/UefiBootServicesTableLib.h>
|
||||||
#include <Library/DevicePathLib.h>
|
#include <Library/DevicePathLib.h>
|
||||||
|
#include <Library/TimerLib.h>
|
||||||
|
|
||||||
#include <IndustryStandard/Atapi.h>
|
#include <IndustryStandard/Atapi.h>
|
||||||
|
|
||||||
@ -54,12 +55,12 @@
|
|||||||
#define MAX_28BIT_ADDRESSING_CAPACITY 0xfffffff
|
#define MAX_28BIT_ADDRESSING_CAPACITY 0xfffffff
|
||||||
|
|
||||||
//
|
//
|
||||||
// The maximum ATA transaction sector count in 28 bit addressing mode.
|
// The maximum ATA transaction sector count in 28 bit addressing mode.
|
||||||
//
|
//
|
||||||
#define MAX_28BIT_TRANSFER_BLOCK_NUM 0x100
|
#define MAX_28BIT_TRANSFER_BLOCK_NUM 0x100
|
||||||
|
|
||||||
//
|
//
|
||||||
// The maximum ATA transaction sector count in 48 bit addressing mode.
|
// The maximum ATA transaction sector count in 48 bit addressing mode.
|
||||||
//
|
//
|
||||||
//#define MAX_48BIT_TRANSFER_BLOCK_NUM 0x10000
|
//#define MAX_48BIT_TRANSFER_BLOCK_NUM 0x10000
|
||||||
|
|
||||||
@ -72,27 +73,15 @@
|
|||||||
#define MAX_48BIT_TRANSFER_BLOCK_NUM 0xFFFF
|
#define MAX_48BIT_TRANSFER_BLOCK_NUM 0xFFFF
|
||||||
|
|
||||||
//
|
//
|
||||||
// The maximum model name in ATA identify data
|
// The maximum model name in ATA identify data
|
||||||
//
|
//
|
||||||
#define MAX_MODEL_NAME_LEN 40
|
#define MAX_MODEL_NAME_LEN 40
|
||||||
|
|
||||||
#define ATA_TASK_SIGNATURE SIGNATURE_32 ('A', 'T', 'S', 'K')
|
#define ATA_TASK_SIGNATURE SIGNATURE_32 ('A', 'T', 'S', 'K')
|
||||||
#define ATA_DEVICE_SIGNATURE SIGNATURE_32 ('A', 'B', 'I', 'D')
|
#define ATA_DEVICE_SIGNATURE SIGNATURE_32 ('A', 'B', 'I', 'D')
|
||||||
|
#define ATA_SUB_TASK_SIGNATURE SIGNATURE_32 ('A', 'S', 'T', 'S')
|
||||||
#define IS_ALIGNED(addr, size) (((UINTN) (addr) & (size - 1)) == 0)
|
#define IS_ALIGNED(addr, size) (((UINTN) (addr) & (size - 1)) == 0)
|
||||||
|
|
||||||
//
|
|
||||||
// Task for the non blocking I/O
|
|
||||||
//
|
|
||||||
typedef struct {
|
|
||||||
UINT32 Signature;
|
|
||||||
EFI_BLOCK_IO2_TOKEN *Token;
|
|
||||||
UINTN *UnsignalledEventCount;
|
|
||||||
EFI_ATA_PASS_THRU_COMMAND_PACKET Packet;
|
|
||||||
BOOLEAN *IsError;// Indicate whether meeting error during source allocation for new task.
|
|
||||||
LIST_ENTRY TaskEntry;
|
|
||||||
} ATA_BUS_ASYN_TASK;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// ATA bus data structure for ATA controller
|
// ATA bus data structure for ATA controller
|
||||||
//
|
//
|
||||||
@ -140,12 +129,41 @@ typedef struct {
|
|||||||
CHAR16 ModelName[MAX_MODEL_NAME_LEN + 1];
|
CHAR16 ModelName[MAX_MODEL_NAME_LEN + 1];
|
||||||
|
|
||||||
LIST_ENTRY AtaTaskList;
|
LIST_ENTRY AtaTaskList;
|
||||||
|
LIST_ENTRY AtaSubTaskList;
|
||||||
} ATA_DEVICE;
|
} ATA_DEVICE;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Sub-Task for the non blocking I/O
|
||||||
|
//
|
||||||
|
typedef struct {
|
||||||
|
UINT32 Signature;
|
||||||
|
ATA_DEVICE *AtaDevice;
|
||||||
|
EFI_BLOCK_IO2_TOKEN *Token;
|
||||||
|
UINTN *UnsignalledEventCount;
|
||||||
|
EFI_ATA_PASS_THRU_COMMAND_PACKET Packet;
|
||||||
|
BOOLEAN *IsError;// Indicate whether meeting error during source allocation for new task.
|
||||||
|
LIST_ENTRY TaskEntry;
|
||||||
|
} ATA_BUS_ASYN_SUB_TASK;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Task for the non blocking I/O
|
||||||
|
//
|
||||||
|
typedef struct {
|
||||||
|
UINT32 Signature;
|
||||||
|
EFI_BLOCK_IO2_TOKEN *Token;
|
||||||
|
ATA_DEVICE *AtaDevice;
|
||||||
|
UINT8 *Buffer;
|
||||||
|
EFI_LBA StartLba;
|
||||||
|
UINTN NumberOfBlocks;
|
||||||
|
BOOLEAN IsWrite;
|
||||||
|
LIST_ENTRY TaskEntry;
|
||||||
|
} ATA_BUS_ASYN_TASK;
|
||||||
|
|
||||||
#define ATA_DEVICE_FROM_BLOCK_IO(a) CR (a, ATA_DEVICE, BlockIo, ATA_DEVICE_SIGNATURE)
|
#define ATA_DEVICE_FROM_BLOCK_IO(a) CR (a, ATA_DEVICE, BlockIo, ATA_DEVICE_SIGNATURE)
|
||||||
#define ATA_DEVICE_FROM_BLOCK_IO2(a) CR (a, ATA_DEVICE, BlockIo2, ATA_DEVICE_SIGNATURE)
|
#define ATA_DEVICE_FROM_BLOCK_IO2(a) CR (a, ATA_DEVICE, BlockIo2, ATA_DEVICE_SIGNATURE)
|
||||||
#define ATA_DEVICE_FROM_DISK_INFO(a) CR (a, ATA_DEVICE, DiskInfo, ATA_DEVICE_SIGNATURE)
|
#define ATA_DEVICE_FROM_DISK_INFO(a) CR (a, ATA_DEVICE, DiskInfo, ATA_DEVICE_SIGNATURE)
|
||||||
#define ATA_DEVICE_FROM_STORAGE_SECURITY(a) CR (a, ATA_DEVICE, StorageSecurity, ATA_DEVICE_SIGNATURE)
|
#define ATA_DEVICE_FROM_STORAGE_SECURITY(a) CR (a, ATA_DEVICE, StorageSecurity, ATA_DEVICE_SIGNATURE)
|
||||||
|
#define ATA_AYNS_SUB_TASK_FROM_ENTRY(a) CR (a, ATA_BUS_ASYN_SUB_TASK, TaskEntry, ATA_SUB_TASK_SIGNATURE)
|
||||||
#define ATA_AYNS_TASK_FROM_ENTRY(a) CR (a, ATA_BUS_ASYN_TASK, TaskEntry, ATA_TASK_SIGNATURE)
|
#define ATA_AYNS_TASK_FROM_ENTRY(a) CR (a, ATA_BUS_ASYN_TASK, TaskEntry, ATA_TASK_SIGNATURE)
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -191,22 +209,22 @@ FreeAlignedBuffer (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Free SubTask.
|
Free SubTask.
|
||||||
|
|
||||||
@param[in, out] Task Pointer to task to be freed.
|
@param[in, out] Task Pointer to task to be freed.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
FreeAtaSubTask (
|
FreeAtaSubTask (
|
||||||
IN OUT ATA_BUS_ASYN_TASK *Task
|
IN OUT ATA_BUS_ASYN_SUB_TASK *Task
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Wrapper for EFI_ATA_PASS_THRU_PROTOCOL.ResetDevice().
|
Wrapper for EFI_ATA_PASS_THRU_PROTOCOL.ResetDevice().
|
||||||
|
|
||||||
This function wraps the ResetDevice() invocation for ATA pass through function
|
This function wraps the ResetDevice() invocation for ATA pass through function
|
||||||
for an ATA device.
|
for an ATA device.
|
||||||
|
|
||||||
@param AtaDevice The ATA child device involved for the operation.
|
@param AtaDevice The ATA child device involved for the operation.
|
||||||
|
|
||||||
@ -230,7 +248,7 @@ ResetAtaDevice (
|
|||||||
|
|
||||||
@retval EFI_SUCCESS The device is successfully identified and Media information
|
@retval EFI_SUCCESS The device is successfully identified and Media information
|
||||||
is correctly initialized.
|
is correctly initialized.
|
||||||
@return others Some error occurs when discovering the ATA device.
|
@return others Some error occurs when discovering the ATA device.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -253,10 +271,10 @@ DiscoverAtaDevice (
|
|||||||
@param[in, out] Token A pointer to the token associated with the transaction.
|
@param[in, out] Token A pointer to the token associated with the transaction.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The data transfer is complete successfully.
|
@retval EFI_SUCCESS The data transfer is complete successfully.
|
||||||
@return others Some error occurs when transferring data.
|
@return others Some error occurs when transferring data.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
AccessAtaDevice(
|
AccessAtaDevice(
|
||||||
IN OUT ATA_DEVICE *AtaDevice,
|
IN OUT ATA_DEVICE *AtaDevice,
|
||||||
IN OUT UINT8 *Buffer,
|
IN OUT UINT8 *Buffer,
|
||||||
@ -291,7 +309,7 @@ AccessAtaDevice(
|
|||||||
written to the buffer. Ignore it when IsTrustSend is TRUE.
|
written to the buffer. Ignore it when IsTrustSend is TRUE.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The data transfer is complete successfully.
|
@retval EFI_SUCCESS The data transfer is complete successfully.
|
||||||
@return others Some error occurs when transferring data.
|
@return others Some error occurs when transferring data.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -311,33 +329,33 @@ TrustTransferAtaDevice (
|
|||||||
// Protocol interface prototypes
|
// Protocol interface prototypes
|
||||||
//
|
//
|
||||||
/**
|
/**
|
||||||
Tests to see if this driver supports a given controller. If a child device is provided,
|
Tests to see if this driver supports a given controller. If a child device is provided,
|
||||||
it further tests to see if this driver supports creating a handle for the specified child device.
|
it further tests to see if this driver supports creating a handle for the specified child device.
|
||||||
|
|
||||||
This function checks to see if the driver specified by This supports the device specified by
|
This function checks to see if the driver specified by This supports the device specified by
|
||||||
ControllerHandle. Drivers will typically use the device path attached to
|
ControllerHandle. Drivers will typically use the device path attached to
|
||||||
ControllerHandle and/or the services from the bus I/O abstraction attached to
|
ControllerHandle and/or the services from the bus I/O abstraction attached to
|
||||||
ControllerHandle to determine if the driver supports ControllerHandle. This function
|
ControllerHandle to determine if the driver supports ControllerHandle. This function
|
||||||
may be called many times during platform initialization. In order to reduce boot times, the tests
|
may be called many times during platform initialization. In order to reduce boot times, the tests
|
||||||
performed by this function must be very small, and take as little time as possible to execute. This
|
performed by this function must be very small, and take as little time as possible to execute. This
|
||||||
function must not change the state of any hardware devices, and this function must be aware that the
|
function must not change the state of any hardware devices, and this function must be aware that the
|
||||||
device specified by ControllerHandle may already be managed by the same driver or a
|
device specified by ControllerHandle may already be managed by the same driver or a
|
||||||
different driver. This function must match its calls to AllocatePages() with FreePages(),
|
different driver. This function must match its calls to AllocatePages() with FreePages(),
|
||||||
AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
|
AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
|
||||||
Since ControllerHandle may have been previously started by the same driver, if a protocol is
|
Since ControllerHandle may have been previously started by the same driver, if a protocol is
|
||||||
already in the opened state, then it must not be closed with CloseProtocol(). This is required
|
already in the opened state, then it must not be closed with CloseProtocol(). This is required
|
||||||
to guarantee the state of ControllerHandle is not modified by this function.
|
to guarantee the state of ControllerHandle is not modified by this function.
|
||||||
|
|
||||||
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
||||||
@param[in] ControllerHandle The handle of the controller to test. This handle
|
@param[in] ControllerHandle The handle of the controller to test. This handle
|
||||||
must support a protocol interface that supplies
|
must support a protocol interface that supplies
|
||||||
an I/O abstraction to the driver.
|
an I/O abstraction to the driver.
|
||||||
@param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
|
@param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
|
||||||
parameter is ignored by device drivers, and is optional for bus
|
parameter is ignored by device drivers, and is optional for bus
|
||||||
drivers. For bus drivers, if this parameter is not NULL, then
|
drivers. For bus drivers, if this parameter is not NULL, then
|
||||||
the bus driver must determine if the bus controller specified
|
the bus driver must determine if the bus controller specified
|
||||||
by ControllerHandle and the child controller specified
|
by ControllerHandle and the child controller specified
|
||||||
by RemainingDevicePath are both supported by this
|
by RemainingDevicePath are both supported by this
|
||||||
bus driver.
|
bus driver.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The device specified by ControllerHandle and
|
@retval EFI_SUCCESS The device specified by ControllerHandle and
|
||||||
@ -364,28 +382,28 @@ AtaBusDriverBindingSupported (
|
|||||||
Starts a device controller or a bus controller.
|
Starts a device controller or a bus controller.
|
||||||
|
|
||||||
The Start() function is designed to be invoked from the EFI boot service ConnectController().
|
The Start() function is designed to be invoked from the EFI boot service ConnectController().
|
||||||
As a result, much of the error checking on the parameters to Start() has been moved into this
|
As a result, much of the error checking on the parameters to Start() has been moved into this
|
||||||
common boot service. It is legal to call Start() from other locations,
|
common boot service. It is legal to call Start() from other locations,
|
||||||
but the following calling restrictions must be followed or the system behavior will not be deterministic.
|
but the following calling restrictions must be followed or the system behavior will not be deterministic.
|
||||||
1. ControllerHandle must be a valid EFI_HANDLE.
|
1. ControllerHandle must be a valid EFI_HANDLE.
|
||||||
2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
|
2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
|
||||||
EFI_DEVICE_PATH_PROTOCOL.
|
EFI_DEVICE_PATH_PROTOCOL.
|
||||||
3. Prior to calling Start(), the Supported() function for the driver specified by This must
|
3. Prior to calling Start(), the Supported() function for the driver specified by This must
|
||||||
have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
|
have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
|
||||||
|
|
||||||
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
||||||
@param[in] ControllerHandle The handle of the controller to start. This handle
|
@param[in] ControllerHandle The handle of the controller to start. This handle
|
||||||
must support a protocol interface that supplies
|
must support a protocol interface that supplies
|
||||||
an I/O abstraction to the driver.
|
an I/O abstraction to the driver.
|
||||||
@param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
|
@param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
|
||||||
parameter is ignored by device drivers, and is optional for bus
|
parameter is ignored by device drivers, and is optional for bus
|
||||||
drivers. For a bus driver, if this parameter is NULL, then handles
|
drivers. For a bus driver, if this parameter is NULL, then handles
|
||||||
for all the children of Controller are created by this driver.
|
for all the children of Controller are created by this driver.
|
||||||
If this parameter is not NULL and the first Device Path Node is
|
If this parameter is not NULL and the first Device Path Node is
|
||||||
not the End of Device Path Node, then only the handle for the
|
not the End of Device Path Node, then only the handle for the
|
||||||
child device specified by the first Device Path Node of
|
child device specified by the first Device Path Node of
|
||||||
RemainingDevicePath is created by this driver.
|
RemainingDevicePath is created by this driver.
|
||||||
If the first Device Path Node of RemainingDevicePath is
|
If the first Device Path Node of RemainingDevicePath is
|
||||||
the End of Device Path Node, no child handle is created by this
|
the End of Device Path Node, no child handle is created by this
|
||||||
driver.
|
driver.
|
||||||
|
|
||||||
@ -405,10 +423,10 @@ AtaBusDriverBindingStart (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Stops a device controller or a bus controller.
|
Stops a device controller or a bus controller.
|
||||||
|
|
||||||
The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
|
The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
|
||||||
As a result, much of the error checking on the parameters to Stop() has been moved
|
As a result, much of the error checking on the parameters to Stop() has been moved
|
||||||
into this common boot service. It is legal to call Stop() from other locations,
|
into this common boot service. It is legal to call Stop() from other locations,
|
||||||
but the following calling restrictions must be followed or the system behavior will not be deterministic.
|
but the following calling restrictions must be followed or the system behavior will not be deterministic.
|
||||||
1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
|
1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
|
||||||
same driver's Start() function.
|
same driver's Start() function.
|
||||||
@ -416,13 +434,13 @@ AtaBusDriverBindingStart (
|
|||||||
EFI_HANDLE. In addition, all of these handles must have been created in this driver's
|
EFI_HANDLE. In addition, all of these handles must have been created in this driver's
|
||||||
Start() function, and the Start() function must have called OpenProtocol() on
|
Start() function, and the Start() function must have called OpenProtocol() on
|
||||||
ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
|
ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
|
||||||
|
|
||||||
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
||||||
@param[in] ControllerHandle A handle to the device being stopped. The handle must
|
@param[in] ControllerHandle A handle to the device being stopped. The handle must
|
||||||
support a bus specific I/O protocol for the driver
|
support a bus specific I/O protocol for the driver
|
||||||
to use to stop the device.
|
to use to stop the device.
|
||||||
@param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
|
@param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
|
||||||
@param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
|
@param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
|
||||||
if NumberOfChildren is 0.
|
if NumberOfChildren is 0.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The device was stopped.
|
@retval EFI_SUCCESS The device was stopped.
|
||||||
@ -600,7 +618,7 @@ AtaBlockIoReset (
|
|||||||
@retval EFI_NO_MEDIA There is no media in the device.
|
@retval EFI_NO_MEDIA There is no media in the device.
|
||||||
@retval EFI_MEDIA_CHANGED The MediaId does not matched the current device.
|
@retval EFI_MEDIA_CHANGED The MediaId does not matched the current device.
|
||||||
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
|
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
|
||||||
@retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
|
@retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
|
||||||
or the buffer is not on proper alignment.
|
or the buffer is not on proper alignment.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@ -631,7 +649,7 @@ AtaBlockIoReadBlocks (
|
|||||||
@retval EFI_NO_MEDIA There is no media in the device.
|
@retval EFI_NO_MEDIA There is no media in the device.
|
||||||
@retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
|
@retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
|
||||||
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
|
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
|
||||||
@retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
|
@retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
|
||||||
or the buffer is not on proper alignment.
|
or the buffer is not on proper alignment.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@ -700,7 +718,7 @@ AtaBlockIoResetEx (
|
|||||||
@retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
|
@retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
|
||||||
@retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the
|
@retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the
|
||||||
intrinsic block size of the device.
|
intrinsic block size of the device.
|
||||||
@retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
|
@retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
|
||||||
or the buffer is not on proper alignment.
|
or the buffer is not on proper alignment.
|
||||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack
|
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack
|
||||||
of resources.
|
of resources.
|
||||||
@ -735,7 +753,7 @@ AtaBlockIoReadBlocksEx (
|
|||||||
@retval EFI_NO_MEDIA There is no media in the device.
|
@retval EFI_NO_MEDIA There is no media in the device.
|
||||||
@retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
|
@retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
|
||||||
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
|
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
|
||||||
@retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
|
@retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
|
||||||
or the buffer is not on proper alignment.
|
or the buffer is not on proper alignment.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@ -770,7 +788,7 @@ AtaBlockIoFlushBlocksEx (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Provides inquiry information for the controller type.
|
Provides inquiry information for the controller type.
|
||||||
|
|
||||||
This function is used by the IDE bus driver to get inquiry data. Data format
|
This function is used by the IDE bus driver to get inquiry data. Data format
|
||||||
of Identify data is defined by the Interface GUID.
|
of Identify data is defined by the Interface GUID.
|
||||||
|
|
||||||
@ -779,9 +797,9 @@ AtaBlockIoFlushBlocksEx (
|
|||||||
@param[in, out] InquiryDataSize Pointer to the value for the inquiry data size.
|
@param[in, out] InquiryDataSize Pointer to the value for the inquiry data size.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The command was accepted without any errors.
|
@retval EFI_SUCCESS The command was accepted without any errors.
|
||||||
@retval EFI_NOT_FOUND Device does not support this data class
|
@retval EFI_NOT_FOUND Device does not support this data class
|
||||||
@retval EFI_DEVICE_ERROR Error reading InquiryData from device
|
@retval EFI_DEVICE_ERROR Error reading InquiryData from device
|
||||||
@retval EFI_BUFFER_TOO_SMALL InquiryDataSize not big enough
|
@retval EFI_BUFFER_TOO_SMALL InquiryDataSize not big enough
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -799,16 +817,16 @@ AtaDiskInfoInquiry (
|
|||||||
This function is used by the IDE bus driver to get identify data. Data format
|
This function is used by the IDE bus driver to get identify data. Data format
|
||||||
of Identify data is defined by the Interface GUID.
|
of Identify data is defined by the Interface GUID.
|
||||||
|
|
||||||
@param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL
|
@param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL
|
||||||
instance.
|
instance.
|
||||||
@param[in, out] IdentifyData Pointer to a buffer for the identify data.
|
@param[in, out] IdentifyData Pointer to a buffer for the identify data.
|
||||||
@param[in, out] IdentifyDataSize Pointer to the value for the identify data
|
@param[in, out] IdentifyDataSize Pointer to the value for the identify data
|
||||||
size.
|
size.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The command was accepted without any errors.
|
@retval EFI_SUCCESS The command was accepted without any errors.
|
||||||
@retval EFI_NOT_FOUND Device does not support this data class
|
@retval EFI_NOT_FOUND Device does not support this data class
|
||||||
@retval EFI_DEVICE_ERROR Error reading IdentifyData from device
|
@retval EFI_DEVICE_ERROR Error reading IdentifyData from device
|
||||||
@retval EFI_BUFFER_TOO_SMALL IdentifyDataSize not big enough
|
@retval EFI_BUFFER_TOO_SMALL IdentifyDataSize not big enough
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -822,8 +840,8 @@ AtaDiskInfoIdentify (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Provides sense data information for the controller type.
|
Provides sense data information for the controller type.
|
||||||
|
|
||||||
This function is used by the IDE bus driver to get sense data.
|
This function is used by the IDE bus driver to get sense data.
|
||||||
Data format of Sense data is defined by the Interface GUID.
|
Data format of Sense data is defined by the Interface GUID.
|
||||||
|
|
||||||
@param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
|
@param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
|
||||||
@ -850,7 +868,7 @@ AtaDiskInfoSenseData (
|
|||||||
/**
|
/**
|
||||||
This function is used by the IDE bus driver to get controller information.
|
This function is used by the IDE bus driver to get controller information.
|
||||||
|
|
||||||
@param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
|
@param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
|
||||||
@param[out] IdeChannel Pointer to the Ide Channel number. Primary or secondary.
|
@param[out] IdeChannel Pointer to the Ide Channel number. Primary or secondary.
|
||||||
@param[out] IdeDevice Pointer to the Ide Device number. Master or slave.
|
@param[out] IdeDevice Pointer to the Ide Device number. Master or slave.
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
## @file
|
## @file
|
||||||
# ATA Bus driver to enumerate and identfy ATA devices.
|
# ATA Bus driver to enumerate and identfy ATA devices.
|
||||||
#
|
#
|
||||||
# This driver follows UEFI driver model and layers on ATA Pass Thru protocol defined
|
# This driver follows UEFI driver model and layers on ATA Pass Thru protocol defined
|
||||||
# in UEFI spec 2.2. It installs Block IO and Disk Info protocol for each ATA device
|
# in UEFI spec 2.2. It installs Block IO and Disk Info protocol for each ATA device
|
||||||
@ -30,9 +30,9 @@
|
|||||||
#
|
#
|
||||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||||
#
|
#
|
||||||
# DRIVER_BINDING = gAtaBusDriverBinding
|
# DRIVER_BINDING = gAtaBusDriverBinding
|
||||||
# COMPONENT_NAME = gAtaBusComponentName
|
# COMPONENT_NAME = gAtaBusComponentName
|
||||||
# COMPONENT_NAME2 = gAtaBusComponentName2
|
# COMPONENT_NAME2 = gAtaBusComponentName2
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -41,7 +41,7 @@
|
|||||||
AtaBus.c
|
AtaBus.c
|
||||||
AtaPassThruExecute.c
|
AtaPassThruExecute.c
|
||||||
ComponentName.c
|
ComponentName.c
|
||||||
|
|
||||||
[Packages]
|
[Packages]
|
||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
|
|
||||||
@ -54,7 +54,7 @@
|
|||||||
BaseLib
|
BaseLib
|
||||||
UefiDriverEntryPoint
|
UefiDriverEntryPoint
|
||||||
DebugLib
|
DebugLib
|
||||||
|
TimerLib
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
gEfiDiskInfoIdeInterfaceGuid # CONSUMES ## GUID
|
gEfiDiskInfoIdeInterfaceGuid # CONSUMES ## GUID
|
||||||
|
@ -6,11 +6,11 @@
|
|||||||
through command and protocol.
|
through command and protocol.
|
||||||
|
|
||||||
NOTE: This file also implements the StorageSecurityCommandProtocol(SSP). For input
|
NOTE: This file also implements the StorageSecurityCommandProtocol(SSP). For input
|
||||||
parameter SecurityProtocolSpecificData, ATA spec has no explicitly definition
|
parameter SecurityProtocolSpecificData, ATA spec has no explicitly definition
|
||||||
for Security Protocol Specific layout. This implementation uses big endian for
|
for Security Protocol Specific layout. This implementation uses big endian for
|
||||||
Cylinder register.
|
Cylinder register.
|
||||||
|
|
||||||
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
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
|
||||||
@ -73,7 +73,7 @@ UINT8 mAtaCommands[][2][2] = {
|
|||||||
//
|
//
|
||||||
// Look up table (UdmaValid, IsTrustSend) for ATA_CMD
|
// Look up table (UdmaValid, IsTrustSend) for ATA_CMD
|
||||||
//
|
//
|
||||||
UINT8 mAtaTrustCommands[2][2] = {
|
UINT8 mAtaTrustCommands[2][2] = {
|
||||||
{
|
{
|
||||||
ATA_CMD_TRUST_RECEIVE, // PIO read
|
ATA_CMD_TRUST_RECEIVE, // PIO read
|
||||||
ATA_CMD_TRUST_SEND // PIO write
|
ATA_CMD_TRUST_SEND // PIO write
|
||||||
@ -102,7 +102,7 @@ UINTN mMaxTransferBlockNumber[] = {
|
|||||||
transaction.
|
transaction.
|
||||||
|
|
||||||
@param[in, out] AtaDevice The ATA child device involved for the operation.
|
@param[in, out] AtaDevice The ATA child device involved for the operation.
|
||||||
@param[in, out] TaskPacket Pointer to a Pass Thru Command Packet. Optional,
|
@param[in, out] TaskPacket Pointer to a Pass Thru Command Packet. Optional,
|
||||||
if it is NULL, blocking mode, and use the packet
|
if it is NULL, blocking mode, and use the packet
|
||||||
in AtaDevice. If it is not NULL, non blocking mode,
|
in AtaDevice. If it is not NULL, non blocking mode,
|
||||||
and pass down this Packet.
|
and pass down this Packet.
|
||||||
@ -127,7 +127,7 @@ AtaDevicePassThru (
|
|||||||
EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet;
|
EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Assemble packet. If it is non blocking mode, the Ata driver should keep each
|
// Assemble packet. If it is non blocking mode, the Ata driver should keep each
|
||||||
// subtask and clean them when the event is signaled.
|
// subtask and clean them when the event is signaled.
|
||||||
//
|
//
|
||||||
if (TaskPacket != NULL) {
|
if (TaskPacket != NULL) {
|
||||||
@ -152,7 +152,7 @@ AtaDevicePassThru (
|
|||||||
);
|
);
|
||||||
//
|
//
|
||||||
// Ensure ATA pass through caller and callee have the same
|
// Ensure ATA pass through caller and callee have the same
|
||||||
// interpretation of ATA pass through protocol.
|
// interpretation of ATA pass through protocol.
|
||||||
//
|
//
|
||||||
ASSERT (Status != EFI_INVALID_PARAMETER);
|
ASSERT (Status != EFI_INVALID_PARAMETER);
|
||||||
ASSERT (Status != EFI_BAD_BUFFER_SIZE);
|
ASSERT (Status != EFI_BAD_BUFFER_SIZE);
|
||||||
@ -165,7 +165,7 @@ AtaDevicePassThru (
|
|||||||
Wrapper for EFI_ATA_PASS_THRU_PROTOCOL.ResetDevice().
|
Wrapper for EFI_ATA_PASS_THRU_PROTOCOL.ResetDevice().
|
||||||
|
|
||||||
This function wraps the ResetDevice() invocation for ATA pass through function
|
This function wraps the ResetDevice() invocation for ATA pass through function
|
||||||
for an ATA device.
|
for an ATA device.
|
||||||
|
|
||||||
@param AtaDevice The ATA child device involved for the operation.
|
@param AtaDevice The ATA child device involved for the operation.
|
||||||
|
|
||||||
@ -178,9 +178,9 @@ ResetAtaDevice (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;
|
EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;
|
||||||
|
|
||||||
AtaPassThru = AtaDevice->AtaBusDriverData->AtaPassThru;
|
AtaPassThru = AtaDevice->AtaBusDriverData->AtaPassThru;
|
||||||
|
|
||||||
return AtaPassThru->ResetDevice (
|
return AtaPassThru->ResetDevice (
|
||||||
AtaPassThru,
|
AtaPassThru,
|
||||||
AtaDevice->Port,
|
AtaDevice->Port,
|
||||||
@ -192,7 +192,7 @@ ResetAtaDevice (
|
|||||||
/**
|
/**
|
||||||
Prints ATA model name to ATA device structure.
|
Prints ATA model name to ATA device structure.
|
||||||
|
|
||||||
This function converts ATA device model name from ATA identify data
|
This function converts ATA device model name from ATA identify data
|
||||||
to a string in ATA device structure. It needs to change the character
|
to a string in ATA device structure. It needs to change the character
|
||||||
order in the original model name string.
|
order in the original model name string.
|
||||||
|
|
||||||
@ -271,7 +271,7 @@ GetAtapi6Capacity (
|
|||||||
/**
|
/**
|
||||||
Identifies ATA device via the Identify data.
|
Identifies ATA device via the Identify data.
|
||||||
|
|
||||||
This function identifies the ATA device and initializes the Media information in
|
This function identifies the ATA device and initializes the Media information in
|
||||||
Block IO protocol interface.
|
Block IO protocol interface.
|
||||||
|
|
||||||
@param AtaDevice The ATA child device involved for the operation.
|
@param AtaDevice The ATA child device involved for the operation.
|
||||||
@ -363,7 +363,7 @@ IdentifyAtaDevice (
|
|||||||
AtaDevice->BlockIo.Revision = EFI_BLOCK_IO_PROTOCOL_REVISION2;
|
AtaDevice->BlockIo.Revision = EFI_BLOCK_IO_PROTOCOL_REVISION2;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Get ATA model name from identify data structure.
|
// Get ATA model name from identify data structure.
|
||||||
//
|
//
|
||||||
PrintAtaModelName (AtaDevice);
|
PrintAtaModelName (AtaDevice);
|
||||||
|
|
||||||
@ -382,7 +382,7 @@ IdentifyAtaDevice (
|
|||||||
|
|
||||||
@retval EFI_SUCCESS The device is successfully identified and Media information
|
@retval EFI_SUCCESS The device is successfully identified and Media information
|
||||||
is correctly initialized.
|
is correctly initialized.
|
||||||
@return others Some error occurs when discovering the ATA device.
|
@return others Some error occurs when discovering the ATA device.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -437,7 +437,7 @@ DiscoverAtaDevice (
|
|||||||
interface of ATA pass through.
|
interface of ATA pass through.
|
||||||
|
|
||||||
@param[in, out] AtaDevice The ATA child device involved for the operation.
|
@param[in, out] AtaDevice The ATA child device involved for the operation.
|
||||||
@param[in, out] TaskPacket Pointer to a Pass Thru Command Packet. Optional,
|
@param[in, out] TaskPacket Pointer to a Pass Thru Command Packet. Optional,
|
||||||
if it is NULL, blocking mode, and use the packet
|
if it is NULL, blocking mode, and use the packet
|
||||||
in AtaDevice. If it is not NULL, non blocking mode,
|
in AtaDevice. If it is not NULL, non blocking mode,
|
||||||
and pass down this Packet.
|
and pass down this Packet.
|
||||||
@ -452,7 +452,7 @@ DiscoverAtaDevice (
|
|||||||
request is completed.
|
request is completed.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The data transfer is complete successfully.
|
@retval EFI_SUCCESS The data transfer is complete successfully.
|
||||||
@return others Some error occurs when transferring data.
|
@return others Some error occurs when transferring data.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -462,7 +462,7 @@ TransferAtaDevice (
|
|||||||
IN OUT VOID *Buffer,
|
IN OUT VOID *Buffer,
|
||||||
IN EFI_LBA StartLba,
|
IN EFI_LBA StartLba,
|
||||||
IN UINT32 TransferLength,
|
IN UINT32 TransferLength,
|
||||||
IN BOOLEAN IsWrite,
|
IN BOOLEAN IsWrite,
|
||||||
IN EFI_EVENT Event OPTIONAL
|
IN EFI_EVENT Event OPTIONAL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -470,7 +470,7 @@ TransferAtaDevice (
|
|||||||
EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet;
|
EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Ensure AtaDevice->UdmaValid, AtaDevice->Lba48Bit and IsWrite are valid boolean values
|
// Ensure AtaDevice->UdmaValid, AtaDevice->Lba48Bit and IsWrite are valid boolean values
|
||||||
//
|
//
|
||||||
ASSERT ((UINTN) AtaDevice->UdmaValid < 2);
|
ASSERT ((UINTN) AtaDevice->UdmaValid < 2);
|
||||||
ASSERT ((UINTN) AtaDevice->Lba48Bit < 2);
|
ASSERT ((UINTN) AtaDevice->Lba48Bit < 2);
|
||||||
@ -519,15 +519,15 @@ TransferAtaDevice (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Free SubTask.
|
Free SubTask.
|
||||||
|
|
||||||
@param[in, out] Task Pointer to task to be freed.
|
@param[in, out] Task Pointer to task to be freed.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
FreeAtaSubTask (
|
FreeAtaSubTask (
|
||||||
IN OUT ATA_BUS_ASYN_TASK *Task
|
IN OUT ATA_BUS_ASYN_SUB_TASK *Task
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (Task->Packet.Asb != NULL) {
|
if (Task->Packet.Asb != NULL) {
|
||||||
@ -549,17 +549,23 @@ FreeAtaSubTask (
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
AtaNonBlockingCallBack (
|
AtaNonBlockingCallBack (
|
||||||
IN EFI_EVENT Event,
|
IN EFI_EVENT Event,
|
||||||
IN VOID *Context
|
IN VOID *Context
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ATA_BUS_ASYN_TASK *Task;
|
ATA_BUS_ASYN_SUB_TASK *Task;
|
||||||
|
ATA_BUS_ASYN_TASK *AtaTask;
|
||||||
|
ATA_DEVICE *AtaDevice;
|
||||||
|
LIST_ENTRY *Entry;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
|
||||||
Task = (ATA_BUS_ASYN_TASK *) Context;
|
Task = (ATA_BUS_ASYN_SUB_TASK *) Context;
|
||||||
gBS->CloseEvent (Event);
|
gBS->CloseEvent (Event);
|
||||||
|
|
||||||
|
AtaDevice = Task->AtaDevice;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check the command status.
|
// Check the command status.
|
||||||
// If there is error during the sub task source allocation, the error status
|
// If there is error during the sub task source allocation, the error status
|
||||||
@ -594,9 +600,34 @@ AtaNonBlockingCallBack (
|
|||||||
gBS->SignalEvent (Task->Token->Event);
|
gBS->SignalEvent (Task->Token->Event);
|
||||||
DEBUG ((EFI_D_BLKIO, "Signal the upper layer event!\n"));
|
DEBUG ((EFI_D_BLKIO, "Signal the upper layer event!\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (Task->UnsignalledEventCount);
|
FreePool (Task->UnsignalledEventCount);
|
||||||
FreePool (Task->IsError);
|
FreePool (Task->IsError);
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Finish all subtasks and move to the next task in AtaTaskList.
|
||||||
|
//
|
||||||
|
if (!IsListEmpty (&AtaDevice->AtaTaskList)) {
|
||||||
|
Entry = GetFirstNode (&AtaDevice->AtaTaskList);
|
||||||
|
AtaTask = ATA_AYNS_TASK_FROM_ENTRY (Entry);
|
||||||
|
DEBUG ((EFI_D_BLKIO, "Start to embark a new Ata Task\n"));
|
||||||
|
DEBUG ((EFI_D_BLKIO, "AtaTask->NumberOfBlocks = %x; AtaTask->Token=%x\n", AtaTask->NumberOfBlocks, AtaTask->Token));
|
||||||
|
Status = AccessAtaDevice (
|
||||||
|
AtaTask->AtaDevice,
|
||||||
|
AtaTask->Buffer,
|
||||||
|
AtaTask->StartLba,
|
||||||
|
AtaTask->NumberOfBlocks,
|
||||||
|
AtaTask->IsWrite,
|
||||||
|
AtaTask->Token
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
AtaTask->Token->TransactionStatus = Status;
|
||||||
|
gBS->SignalEvent (AtaTask->Token->Event);
|
||||||
|
}
|
||||||
|
RemoveEntryList (Entry);
|
||||||
|
FreePool (AtaTask);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG ((
|
DEBUG ((
|
||||||
@ -630,10 +661,10 @@ AtaNonBlockingCallBack (
|
|||||||
@param[in, out] Token A pointer to the token associated with the transaction.
|
@param[in, out] Token A pointer to the token associated with the transaction.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The data transfer is complete successfully.
|
@retval EFI_SUCCESS The data transfer is complete successfully.
|
||||||
@return others Some error occurs when transferring data.
|
@return others Some error occurs when transferring data.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
AccessAtaDevice(
|
AccessAtaDevice(
|
||||||
IN OUT ATA_DEVICE *AtaDevice,
|
IN OUT ATA_DEVICE *AtaDevice,
|
||||||
IN OUT UINT8 *Buffer,
|
IN OUT UINT8 *Buffer,
|
||||||
@ -647,9 +678,10 @@ AccessAtaDevice(
|
|||||||
UINTN MaxTransferBlockNumber;
|
UINTN MaxTransferBlockNumber;
|
||||||
UINTN TransferBlockNumber;
|
UINTN TransferBlockNumber;
|
||||||
UINTN BlockSize;
|
UINTN BlockSize;
|
||||||
|
ATA_BUS_ASYN_SUB_TASK *SubTask;
|
||||||
UINTN *EventCount;
|
UINTN *EventCount;
|
||||||
UINTN TempCount;
|
UINTN TempCount;
|
||||||
ATA_BUS_ASYN_TASK *Task;
|
ATA_BUS_ASYN_TASK *AtaTask;
|
||||||
EFI_EVENT SubEvent;
|
EFI_EVENT SubEvent;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
BOOLEAN *IsError;
|
BOOLEAN *IsError;
|
||||||
@ -660,11 +692,12 @@ AccessAtaDevice(
|
|||||||
EventCount = NULL;
|
EventCount = NULL;
|
||||||
IsError = NULL;
|
IsError = NULL;
|
||||||
Index = 0;
|
Index = 0;
|
||||||
Task = NULL;
|
SubTask = NULL;
|
||||||
SubEvent = NULL;
|
SubEvent = NULL;
|
||||||
|
AtaTask = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Ensure AtaDevice->Lba48Bit is a valid boolean value
|
// Ensure AtaDevice->Lba48Bit is a valid boolean value
|
||||||
//
|
//
|
||||||
ASSERT ((UINTN) AtaDevice->Lba48Bit < 2);
|
ASSERT ((UINTN) AtaDevice->Lba48Bit < 2);
|
||||||
MaxTransferBlockNumber = mMaxTransferBlockNumber[AtaDevice->Lba48Bit];
|
MaxTransferBlockNumber = mMaxTransferBlockNumber[AtaDevice->Lba48Bit];
|
||||||
@ -674,22 +707,52 @@ AccessAtaDevice(
|
|||||||
// Initial the return status and shared account for Non Blocking.
|
// Initial the return status and shared account for Non Blocking.
|
||||||
//
|
//
|
||||||
if ((Token != NULL) && (Token->Event != NULL)) {
|
if ((Token != NULL) && (Token->Event != NULL)) {
|
||||||
Token->TransactionStatus = EFI_SUCCESS;
|
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||||
|
if (!IsListEmpty (&AtaDevice->AtaSubTaskList)) {
|
||||||
|
AtaTask = AllocateZeroPool (sizeof (ATA_BUS_ASYN_TASK));
|
||||||
|
if (AtaTask == NULL) {
|
||||||
|
gBS->RestoreTPL (OldTpl);
|
||||||
|
return EFI_OUT_OF_RESOURCES;
|
||||||
|
}
|
||||||
|
AtaTask->AtaDevice = AtaDevice;
|
||||||
|
AtaTask->Buffer = Buffer;
|
||||||
|
AtaTask->IsWrite = IsWrite;
|
||||||
|
AtaTask->NumberOfBlocks = NumberOfBlocks;
|
||||||
|
AtaTask->Signature = ATA_TASK_SIGNATURE;
|
||||||
|
AtaTask->StartLba = StartLba;
|
||||||
|
AtaTask->Token = Token;
|
||||||
|
|
||||||
|
InsertTailList (&AtaDevice->AtaTaskList, &AtaTask->TaskEntry);
|
||||||
|
gBS->RestoreTPL (OldTpl);
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
gBS->RestoreTPL (OldTpl);
|
||||||
|
|
||||||
|
Token->TransactionStatus = EFI_SUCCESS;
|
||||||
EventCount = AllocateZeroPool (sizeof (UINTN));
|
EventCount = AllocateZeroPool (sizeof (UINTN));
|
||||||
if (EventCount == NULL) {
|
if (EventCount == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
IsError = AllocateZeroPool (sizeof (BOOLEAN));
|
IsError = AllocateZeroPool (sizeof (BOOLEAN));
|
||||||
if (IsError == NULL) {
|
if (IsError == NULL) {
|
||||||
FreePool (EventCount);
|
FreePool (EventCount);
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
DEBUG ((EFI_D_BLKIO, "Allocation IsError Addr=%x\n", IsError));
|
||||||
*IsError = FALSE;
|
*IsError = FALSE;
|
||||||
|
|
||||||
TempCount = (NumberOfBlocks + MaxTransferBlockNumber - 1) / MaxTransferBlockNumber;
|
TempCount = (NumberOfBlocks + MaxTransferBlockNumber - 1) / MaxTransferBlockNumber;
|
||||||
*EventCount = TempCount;
|
*EventCount = TempCount;
|
||||||
|
DEBUG ((EFI_D_BLKIO, "AccessAtaDevice, NumberOfBlocks=%x\n", NumberOfBlocks));
|
||||||
|
DEBUG ((EFI_D_BLKIO, "AccessAtaDevice, MaxTransferBlockNumber=%x\n", MaxTransferBlockNumber));
|
||||||
|
DEBUG ((EFI_D_BLKIO, "AccessAtaDevice, EventCount=%x\n", TempCount));
|
||||||
|
}else {
|
||||||
|
while (!IsListEmpty (&AtaDevice->AtaTaskList) || !IsListEmpty (&AtaDevice->AtaSubTaskList)) {
|
||||||
|
//
|
||||||
|
// Stall for 100us.
|
||||||
|
//
|
||||||
|
MicroSecondDelay (100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@ -705,27 +768,29 @@ AccessAtaDevice(
|
|||||||
// Create sub event for the sub ata task. Non-blocking mode.
|
// Create sub event for the sub ata task. Non-blocking mode.
|
||||||
//
|
//
|
||||||
if ((Token != NULL) && (Token->Event != NULL)) {
|
if ((Token != NULL) && (Token->Event != NULL)) {
|
||||||
Task = NULL;
|
SubTask = NULL;
|
||||||
SubEvent = NULL;
|
SubEvent = NULL;
|
||||||
|
|
||||||
Task = AllocateZeroPool (sizeof (ATA_BUS_ASYN_TASK));
|
SubTask = AllocateZeroPool (sizeof (ATA_BUS_ASYN_SUB_TASK));
|
||||||
if (Task == NULL) {
|
if (SubTask == NULL) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto EXIT;
|
goto EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||||
Task->UnsignalledEventCount = EventCount;
|
SubTask->UnsignalledEventCount = EventCount;
|
||||||
Task->Token = Token;
|
SubTask->Signature = ATA_SUB_TASK_SIGNATURE;
|
||||||
Task->IsError = IsError;
|
SubTask->AtaDevice = AtaDevice;
|
||||||
InsertTailList (&AtaDevice->AtaTaskList, &Task->TaskEntry);
|
SubTask->Token = Token;
|
||||||
gBS->RestoreTPL (OldTpl);
|
SubTask->IsError = IsError;
|
||||||
|
InsertTailList (&AtaDevice->AtaSubTaskList, &SubTask->TaskEntry);
|
||||||
|
gBS->RestoreTPL (OldTpl);
|
||||||
|
|
||||||
Status = gBS->CreateEvent (
|
Status = gBS->CreateEvent (
|
||||||
EVT_NOTIFY_SIGNAL,
|
EVT_NOTIFY_SIGNAL,
|
||||||
TPL_NOTIFY,
|
TPL_NOTIFY,
|
||||||
AtaNonBlockingCallBack,
|
AtaNonBlockingCallBack,
|
||||||
Task,
|
SubTask,
|
||||||
&SubEvent
|
&SubEvent
|
||||||
);
|
);
|
||||||
//
|
//
|
||||||
@ -737,11 +802,12 @@ AccessAtaDevice(
|
|||||||
goto EXIT;
|
goto EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = TransferAtaDevice (AtaDevice, &Task->Packet, Buffer, StartLba, (UINT32) TransferBlockNumber, IsWrite, SubEvent);
|
Status = TransferAtaDevice (AtaDevice, &SubTask->Packet, Buffer, StartLba, (UINT32) TransferBlockNumber, IsWrite, SubEvent);
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// Blocking Mode.
|
// Blocking Mode.
|
||||||
//
|
//
|
||||||
|
DEBUG ((EFI_D_BLKIO, "Blocking AccessAtaDevice, TransferBlockNumber=%x; StartLba = %x\n", TransferBlockNumber, StartLba));
|
||||||
Status = TransferAtaDevice (AtaDevice, NULL, Buffer, StartLba, (UINT32) TransferBlockNumber, IsWrite, NULL);
|
Status = TransferAtaDevice (AtaDevice, NULL, Buffer, StartLba, (UINT32) TransferBlockNumber, IsWrite, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -764,24 +830,23 @@ EXIT:
|
|||||||
Token->TransactionStatus = Status;
|
Token->TransactionStatus = Status;
|
||||||
*EventCount = (*EventCount) - (TempCount - Index);
|
*EventCount = (*EventCount) - (TempCount - Index);
|
||||||
*IsError = TRUE;
|
*IsError = TRUE;
|
||||||
|
|
||||||
if (*EventCount == 0) {
|
if (*EventCount == 0) {
|
||||||
FreePool (EventCount);
|
FreePool (EventCount);
|
||||||
FreePool (IsError);
|
FreePool (IsError);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Task != NULL) {
|
if (SubTask != NULL) {
|
||||||
RemoveEntryList (&Task->TaskEntry);
|
RemoveEntryList (&SubTask->TaskEntry);
|
||||||
FreeAtaSubTask (Task);
|
FreeAtaSubTask (SubTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SubEvent != NULL) {
|
if (SubEvent != NULL) {
|
||||||
gBS->CloseEvent (SubEvent);
|
gBS->CloseEvent (SubEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
gBS->RestoreTPL (OldTpl);
|
gBS->RestoreTPL (OldTpl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@ -812,7 +877,7 @@ EXIT:
|
|||||||
written to the buffer. Ignore it when IsTrustSend is TRUE.
|
written to the buffer. Ignore it when IsTrustSend is TRUE.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The data transfer is complete successfully.
|
@retval EFI_SUCCESS The data transfer is complete successfully.
|
||||||
@return others Some error occurs when transferring data.
|
@return others Some error occurs when transferring data.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -835,7 +900,7 @@ TrustTransferAtaDevice (
|
|||||||
EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;
|
EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Ensure AtaDevice->UdmaValid and IsTrustSend are valid boolean values
|
// Ensure AtaDevice->UdmaValid and IsTrustSend are valid boolean values
|
||||||
//
|
//
|
||||||
ASSERT ((UINTN) AtaDevice->UdmaValid < 2);
|
ASSERT ((UINTN) AtaDevice->UdmaValid < 2);
|
||||||
ASSERT ((UINTN) IsTrustSend < 2);
|
ASSERT ((UINTN) IsTrustSend < 2);
|
||||||
@ -852,12 +917,12 @@ TrustTransferAtaDevice (
|
|||||||
Acb->AtaSectorCount = (UINT8) (TransferLength / 512);
|
Acb->AtaSectorCount = (UINT8) (TransferLength / 512);
|
||||||
Acb->AtaSectorNumber = (UINT8) ((TransferLength / 512) >> 8);
|
Acb->AtaSectorNumber = (UINT8) ((TransferLength / 512) >> 8);
|
||||||
//
|
//
|
||||||
// NOTE: ATA Spec has no explicitly definition for Security Protocol Specific layout.
|
// NOTE: ATA Spec has no explicitly definition for Security Protocol Specific layout.
|
||||||
// Here use big endian for Cylinder register.
|
// Here use big endian for Cylinder register.
|
||||||
//
|
//
|
||||||
Acb->AtaCylinderHigh = (UINT8) SecurityProtocolSpecificData;
|
Acb->AtaCylinderHigh = (UINT8) SecurityProtocolSpecificData;
|
||||||
Acb->AtaCylinderLow = (UINT8) (SecurityProtocolSpecificData >> 8);
|
Acb->AtaCylinderLow = (UINT8) (SecurityProtocolSpecificData >> 8);
|
||||||
Acb->AtaDeviceHead = (UINT8) (BIT7 | BIT6 | BIT5 | (AtaDevice->PortMultiplierPort << 4));
|
Acb->AtaDeviceHead = (UINT8) (BIT7 | BIT6 | BIT5 | (AtaDevice->PortMultiplierPort << 4));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Prepare for ATA pass through packet.
|
// Prepare for ATA pass through packet.
|
||||||
@ -877,7 +942,7 @@ TrustTransferAtaDevice (
|
|||||||
CopyMem (NewBuffer, Buffer, TransferLength);
|
CopyMem (NewBuffer, Buffer, TransferLength);
|
||||||
FreePool (Buffer);
|
FreePool (Buffer);
|
||||||
Buffer = NewBuffer;
|
Buffer = NewBuffer;
|
||||||
}
|
}
|
||||||
Packet->OutDataBuffer = Buffer;
|
Packet->OutDataBuffer = Buffer;
|
||||||
Packet->OutTransferLength = (UINT32) TransferLength;
|
Packet->OutTransferLength = (UINT32) TransferLength;
|
||||||
Packet->Protocol = mAtaPassThruCmdProtocols[AtaDevice->UdmaValid][IsTrustSend];
|
Packet->Protocol = mAtaPassThruCmdProtocols[AtaDevice->UdmaValid][IsTrustSend];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user