diff options
author | Feng Tian <feng.tian@intel.com> | 2014-11-10 05:46:21 +0000 |
---|---|---|
committer | erictian <erictian@Edk2> | 2014-11-10 05:46:21 +0000 |
commit | 1ff1dd0ff97b05bf88e50120ba49b435601d5ee8 (patch) | |
tree | 8f4029eb16e8ff7ab63c0d7b2b8b3797d8f4b993 /MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c | |
parent | 33985e3b52ee2e4b5064331134d983e55a7da904 (diff) | |
download | edk2-platforms-1ff1dd0ff97b05bf88e50120ba49b435601d5ee8.tar.xz |
MdeModulePkg/AtaAtapiPassThru: don't write read-only AHCI MMIO register
Per AHCI 1.1 spec, AE bit of GHC register is read-only if CAP.SAM is 1
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16321 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c')
-rw-r--r-- | MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c index 72b1e5cc7e..186d40c062 100644 --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c @@ -1440,8 +1440,19 @@ AhciReset ( {
UINT64 Delay;
UINT32 Value;
+ UINT32 Capability;
- AhciOrReg (PciIo, EFI_AHCI_GHC_OFFSET, EFI_AHCI_GHC_ENABLE);
+ //
+ // Collect AHCI controller information
+ //
+ Capability = AhciReadReg (PciIo, EFI_AHCI_CAPABILITY_OFFSET);
+
+ //
+ // Enable AE before accessing any AHCI registers if Supports AHCI Mode Only is not set
+ //
+ if ((Capability & EFI_AHCI_CAP_SAM) == 0) {
+ AhciOrReg (PciIo, EFI_AHCI_GHC_OFFSET, EFI_AHCI_GHC_ENABLE);
+ }
AhciOrReg (PciIo, EFI_AHCI_GHC_OFFSET, EFI_AHCI_GHC_RESET);
@@ -2245,15 +2256,17 @@ AhciModeInitialization ( }
//
- // Enable AE before accessing any AHCI registers
+ // Collect AHCI controller information
//
- AhciOrReg (PciIo, EFI_AHCI_GHC_OFFSET, EFI_AHCI_GHC_ENABLE);
-
+ Capability = AhciReadReg (PciIo, EFI_AHCI_CAPABILITY_OFFSET);
+
//
- // Collect AHCI controller information
+ // Enable AE before accessing any AHCI registers if Supports AHCI Mode Only is not set
//
- Capability = AhciReadReg(PciIo, EFI_AHCI_CAPABILITY_OFFSET);
-
+ if ((Capability & EFI_AHCI_CAP_SAM) == 0) {
+ AhciOrReg (PciIo, EFI_AHCI_GHC_OFFSET, EFI_AHCI_GHC_ENABLE);
+ }
+
//
// Get the number of command slots per port supported by this HBA.
//
|