diff options
author | erictian <erictian@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-08-22 07:12:10 +0000 |
---|---|---|
committer | erictian <erictian@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-08-22 07:12:10 +0000 |
commit | 7fb60a98ca3a78cf318703b99e64add9f4262fa5 (patch) | |
tree | e498f295528faa19c1f21f7a9428b613cbdb1fe7 /MdeModulePkg/Bus | |
parent | e407ceecc7ab0df3adc91ba258a5a6c8d9484f04 (diff) | |
download | edk2-7fb60a98ca3a78cf318703b99e64add9f4262fa5.zip edk2-7fb60a98ca3a78cf318703b99e64add9f4262fa5.tar.gz edk2-7fb60a98ca3a78cf318703b99e64add9f4262fa5.tar.bz2 |
MdeModulePkg/AtaAtapiPassThru: Move error check behind the place that SetupFIS frame is received.
This way is used to avoid that the subsequent operations are treated as failure if the last operation is wrong.
Signed-off-by: Tian Feng <feng.tian@intel.com>
Reviewed-by: Sun Rui <rui.sun@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13663 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Bus')
-rw-r--r-- | MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c index c2c2c28..7101c66 100644 --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c @@ -759,17 +759,21 @@ AhciPioTransfer ( Status = EFI_TIMEOUT;
Delay = (UINT32) (DivU64x32 (Timeout, 1000) + 1);
do {
- Offset = EFI_AHCI_PORT_START + Port * EFI_AHCI_PORT_REG_WIDTH + EFI_AHCI_PORT_TFD;
- PortTfd = AhciReadReg (PciIo, (UINT32) Offset);
-
- if ((PortTfd & EFI_AHCI_PORT_TFD_ERR) != 0) {
- Status = EFI_DEVICE_ERROR;
- break;
- }
Offset = FisBaseAddr + EFI_AHCI_PIO_FIS_OFFSET;
Status = AhciCheckMemSet (Offset, EFI_AHCI_FIS_TYPE_MASK, EFI_AHCI_FIS_PIO_SETUP, 0);
if (!EFI_ERROR (Status)) {
+ Offset = EFI_AHCI_PORT_START + Port * EFI_AHCI_PORT_REG_WIDTH + EFI_AHCI_PORT_TFD;
+ PortTfd = AhciReadReg (PciIo, (UINT32) Offset);
+ //
+ // PxTFD will be updated if there is a D2H or SetupFIS received.
+ // For PIO IN transfer, D2H means a device error. Therefore we only need to check the TFD after receiving a SetupFIS.
+ //
+ if ((PortTfd & EFI_AHCI_PORT_TFD_ERR) != 0) {
+ Status = EFI_DEVICE_ERROR;
+ break;
+ }
+
PrdCount = *(volatile UINT32 *) (&(AhciRegisters->AhciCmdList[0].AhciCmdPrdbc));
if (PrdCount == DataCount) {
break;
|