summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Bus
diff options
context:
space:
mode:
authorTian, Feng <feng.tian@intel.com>2013-10-11 07:37:30 +0000
committererictian <erictian@6f19259b-4bc3-4df7-8a09-765794883524>2013-10-11 07:37:30 +0000
commit59b1b9d20a8726ba165bad000b5d1f3f9c8ed32b (patch)
tree5dc0341d19abd553b99cd727178cff137ccf3a10 /MdeModulePkg/Bus
parentc79351059ee7ee24ebed312413cb5e57076c5b56 (diff)
downloadedk2-platforms-59b1b9d20a8726ba165bad000b5d1f3f9c8ed32b.tar.xz
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
Diffstat (limited to 'MdeModulePkg/Bus')
-rw-r--r--MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c
index dbc4433723..cc575b98c7 100644
--- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c
+++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c
@@ -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.
//