mirror of https://github.com/acidanthera/audk.git
MdeModulePkg/AtaAtapiPassThru: Add parameter check to ResetDevice() to follow UEFI spec.
Signed-off-by: Tian, Feng <feng.tian@intel.com> reviewed-by: Jin, Eric <eric.jin@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14764 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
c79351059e
commit
59b1b9d20a
|
@ -1809,6 +1809,17 @@ AtaPassThruResetDevice (
|
|||
IN UINT16 PortMultiplierPort
|
||||
)
|
||||
{
|
||||
ATA_ATAPI_PASS_THRU_INSTANCE *Instance;
|
||||
LIST_ENTRY *Node;
|
||||
|
||||
Instance = ATA_PASS_THRU_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
Node = SearchDeviceInfoList (Instance, Port, PortMultiplierPort, EfiIdeHarddisk);
|
||||
|
||||
if (Node == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// Return success directly then upper layer driver could think reset device operation is done.
|
||||
//
|
||||
|
@ -2313,6 +2324,37 @@ ExtScsiPassThruResetTargetLun (
|
|||
IN UINT64 Lun
|
||||
)
|
||||
{
|
||||
ATA_ATAPI_PASS_THRU_INSTANCE *Instance;
|
||||
LIST_ENTRY *Node;
|
||||
UINT8 Port;
|
||||
UINT8 PortMultiplier;
|
||||
|
||||
Instance = EXT_SCSI_PASS_THRU_PRIVATE_DATA_FROM_THIS (This);
|
||||
//
|
||||
// For ATAPI device, doesn't support multiple LUN device.
|
||||
//
|
||||
if (Lun != 0) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
//
|
||||
// The layout of Target array:
|
||||
// ________________________________________________________________________
|
||||
// | Byte 0 | Byte 1 | ... | TARGET_MAX_BYTES - 1 |
|
||||
// |_____________________|_____________________|_____|______________________|
|
||||
// | | The port multiplier | | |
|
||||
// | The port number | port number | N/A | N/A |
|
||||
// |_____________________|_____________________|_____|______________________|
|
||||
//
|
||||
// For ATAPI device, 2 bytes is enough to represent the location of SCSI device.
|
||||
//
|
||||
Port = Target[0];
|
||||
PortMultiplier = Target[1];
|
||||
|
||||
Node = SearchDeviceInfoList(Instance, Port, PortMultiplier, EfiIdeCdrom);
|
||||
if (Node == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// Return success directly then upper layer driver could think reset target LUN operation is done.
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue