summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2013-04-15 01:55:52 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2013-04-15 01:55:52 +0000
commitc44f5b8c0920f2a73058a49c58f08bd1a5744758 (patch)
treec9fcc93d788304da153745da734d8e01eca4825e
parentada8c4de7f3f7a5eb6b30861c97ebd0aa46a502d (diff)
downloadedk2-c44f5b8c0920f2a73058a49c58f08bd1a5744758.zip
edk2-c44f5b8c0920f2a73058a49c58f08bd1a5744758.tar.gz
edk2-c44f5b8c0920f2a73058a49c58f08bd1a5744758.tar.bz2
Sync patches r13648, r13663 and part of patch r13680 from main trunk.
1. Add 4 INIT flags in Debug Agent Library. 2. 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. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/branches/UDK2010.SR1@14275 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c18
-rw-r--r--MdeModulePkg/Include/Library/DebugAgentLib.h23
2 files changed, 24 insertions, 17 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;
diff --git a/MdeModulePkg/Include/Library/DebugAgentLib.h b/MdeModulePkg/Include/Library/DebugAgentLib.h
index f945b0c..01b06a7 100644
--- a/MdeModulePkg/Include/Library/DebugAgentLib.h
+++ b/MdeModulePkg/Include/Library/DebugAgentLib.h
@@ -1,7 +1,7 @@
/** @file
Debug Agent Library provide source-level debug capability.
-Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2010 - 2012, 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 that accompanies this distribution.
The full text of the license may be found at
@@ -15,15 +15,18 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __DEBUG_AGENT_LIB_H__
#define __DEBUG_AGENT_LIB_H__
-#define DEBUG_AGENT_INIT_PREMEM_SEC 1
-#define DEBUG_AGENT_INIT_POSTMEM_SEC 2
-#define DEBUG_AGENT_INIT_DXE_CORE 3
-#define DEBUG_AGENT_INIT_SMM 4
-#define DEBUG_AGENT_INIT_ENTER_SMI 5
-#define DEBUG_AGENT_INIT_EXIT_SMI 6
-#define DEBUG_AGENT_INIT_S3 7
-#define DEBUG_AGENT_INIT_DXE_AP 8
-
+#define DEBUG_AGENT_INIT_PREMEM_SEC 1
+#define DEBUG_AGENT_INIT_POSTMEM_SEC 2
+#define DEBUG_AGENT_INIT_DXE_CORE 3
+#define DEBUG_AGENT_INIT_SMM 4
+#define DEBUG_AGENT_INIT_ENTER_SMI 5
+#define DEBUG_AGENT_INIT_EXIT_SMI 6
+#define DEBUG_AGENT_INIT_S3 7
+#define DEBUG_AGENT_INIT_DXE_AP 8
+#define DEBUG_AGENT_INIT_PEI 9
+#define DEBUG_AGENT_INIT_DXE_LOAD 10
+#define DEBUG_AGENT_INIT_DXE_UNLOAD 11
+#define DEBUG_AGENT_INIT_THUNK_PEI_IA32TOX64 12
//
// Context for DEBUG_AGENT_INIT_POSTMEM_SEC