Hi, Reza This is a reason to use IdeInit.ChannelCount rather than the constant value. Some platforms may only expose one ide channel to external. By this way, we can skip unnecessary enumeration time according to platform policy.
Do you see any real impact with original code? Thanks Feng -----Original Message----- From: [email protected] [mailto:[email protected]] Sent: Friday, August 15, 2014 08:20 To: [email protected] Cc: [email protected] Subject: [edk2] [PATCH 4/6] MdeModulePkg: IdeMode should not depend on SataController From: Reza Jelveh <[email protected]> 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 <[email protected]> --- 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 [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-devel ------------------------------------------------------------------------------ _______________________________________________ edk2-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-devel
