diff options
author | erictian <erictian@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-11-09 06:39:56 +0000 |
---|---|---|
committer | erictian <erictian@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-11-09 06:39:56 +0000 |
commit | 6b13aa602aa1f44743d40691baff2714d842c550 (patch) | |
tree | c5608d8f59b3d2b6057d510ad11d067a1dc32180 /MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c | |
parent | f3b4867f949355f4ecd47a31bbddbaa502dd95b9 (diff) | |
download | edk2-6b13aa602aa1f44743d40691baff2714d842c550.zip edk2-6b13aa602aa1f44743d40691baff2714d842c550.tar.gz edk2-6b13aa602aa1f44743d40691baff2714d842c550.tar.bz2 |
MdeModulePkg/AtaAtapiPassThru: valid ports transverse algo of AHCI controller is updated to handle inconsecutive case
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13932 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c')
-rw-r--r-- | MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c index 7101c66..1c45312 100644 --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c @@ -2202,8 +2202,19 @@ AhciModeInitialization ( return EFI_OUT_OF_RESOURCES;
}
- for (Port = 0; Port < MaxPortNumber; Port ++) {
+ for (Port = 0; Port < EFI_AHCI_MAX_PORTS; Port ++) {
if ((PortImplementBitMap & (BIT0 << Port)) != 0) {
+ //
+ // According to AHCI spec, MaxPortNumber should be equal or greater than the number of implemented ports.
+ //
+ if ((MaxPortNumber--) == 0) {
+ //
+ // Should never be here.
+ //
+ ASSERT (FALSE);
+ return EFI_SUCCESS;
+ }
+
IdeInit->NotifyPhase (IdeInit, EfiIdeBeforeChannelEnumeration, Port);
//
|