From: Reza Jelveh <reza.jel...@tuhh.de>

Calling GetChannelInfo allows the Controller to initialize things that depend
on previous Ahci mode initialization.

Outside of DuetPkg AE needs to be enabled before accessing AHCI registers.
AhciModeInitialization is called after the IdeControllerInitProtocol is
initialized.

GetChannelInfo is called to allow initializations inside of SataController
that depend on AHCI registers.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Reza Jelveh <reza.jel...@tuhh.de>
---
 MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c 
b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c
index 72b1e5c..ae22caa 100644
--- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c
+++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c
@@ -2216,6 +2216,7 @@ AhciModeInitialization (
   EFI_PCI_IO_PROTOCOL              *PciIo;
   EFI_IDE_CONTROLLER_INIT_PROTOCOL *IdeInit;
   UINT32                           Capability;
+  BOOLEAN                          ChannelEnabled;
   UINT8                            MaxPortNumber;
   UINT32                           PortImplementBitMap;
 
@@ -2287,6 +2288,21 @@ AhciModeInitialization (
 
       IdeInit->NotifyPhase (IdeInit, EfiIdeBeforeChannelEnumeration, Port);
 
+      Status = IdeInit->GetChannelInfo (
+          IdeInit,
+          Port,
+          &ChannelEnabled,
+          &MaxPortNumber
+          );
+      if (EFI_ERROR (Status)) {
+        DEBUG ((EFI_D_ERROR, "[GetChannel, Status=%x]", Status));
+        continue;
+      }
+
+      if (!ChannelEnabled) {
+        continue;
+      }
+
       //
       // Initialize FIS Base Address Register and Command List Base Address 
Register for use.
       //
-- 
2.1.1


------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to