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

Currently IdeMode depends on SataController to set ChannelCount to
enumerate IDE devices. SataController sets ChannelCount to
ICH_IDE_MAX_CHANNEL, which is 2.

IdeMode should not be dependent on SataController and just use this
constant directly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Reza Jelveh <reza.jel...@tuhh.de>
---
 MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c | 5 ++---
 MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.h | 5 +++++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c 
b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c
index e5beea6..2c554e0 100644
--- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c
+++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c
@@ -2797,14 +2797,12 @@ IdeModeInitialization (
   EFI_STATUS                        Status;
   EFI_IDE_CONTROLLER_INIT_PROTOCOL  *IdeInit;
   EFI_PCI_IO_PROTOCOL               *PciIo;
-  UINT8                             Channel;
   UINT8                             IdeChannel;
   BOOLEAN                           ChannelEnabled;
   UINT8                             MaxDevices;
 
   IdeInit = Instance->IdeControllerInit;
   PciIo   = Instance->PciIo;
-  Channel = IdeInit->ChannelCount;
 
   //
   // Obtain IDE IO port registers' base addresses
@@ -2814,7 +2812,8 @@ IdeModeInitialization (
     goto ErrorExit;
   }
 
-  for (IdeChannel = 0; IdeChannel < Channel; IdeChannel++) {
+
+  for (IdeChannel = 0; IdeChannel < ICH_IDE_MAX_CHANNEL; IdeChannel++) {
     IdeInit->NotifyPhase (IdeInit, EfiIdeBeforeChannelEnumeration, IdeChannel);
 
     //
diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.h 
b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.h
index 67fff64..d2590d9 100644
--- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.h
+++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.h
@@ -77,6 +77,11 @@ typedef enum {
 #define EFI_ATA_MODE_MDMA        0x04
 #define EFI_ATA_MODE_UDMA        0x08
 
+//
+// Supports 2 channel max
+//
+#define ICH_IDE_MAX_CHANNEL 0x02
+
 typedef struct {
   UINT32  RegionBaseAddr;
   UINT16  ByteCount;
-- 
1.9.2


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

Reply via email to