summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTian, Feng <feng.tian@intel.com>2014-07-22 03:06:43 +0000
committererictian <erictian@6f19259b-4bc3-4df7-8a09-765794883524>2014-07-22 03:06:43 +0000
commitf1bc233ae1255d64ce65948a208ab4b7810b01d4 (patch)
tree537a4692effe0fc9a2598852c0b75fc6c2a6b0eb
parentdcca25d17da32395b315804aaa811448dc317fed (diff)
downloadedk2-f1bc233ae1255d64ce65948a208ab4b7810b01d4.tar.gz
edk2-f1bc233ae1255d64ce65948a208ab4b7810b01d4.tar.bz2
edk2-f1bc233ae1255d64ce65948a208ab4b7810b01d4.zip
MdeModulePkg/AtaAtapiPassThru: Correct the algo of calculating PRDT number to avoid beyond the boundary of 32 bit.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Tian, Feng <feng.tian@intel.com> Reviewed-by: Zeng, Star <star.zeng@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15667 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c
index df22d517fd..7fc7a28126 100644
--- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c
+++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c
@@ -1,7 +1,7 @@
/** @file
The file for AHCI mode of ATA host controller.
- Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -532,7 +532,7 @@ AhciBuildCommand (
//
// Filling the PRDT
//
- PrdtNumber = (DataLength + EFI_AHCI_MAX_DATA_PER_PRDT - 1) / EFI_AHCI_MAX_DATA_PER_PRDT;
+ PrdtNumber = (UINT32)DivU64x32 (((UINT64)DataLength + EFI_AHCI_MAX_DATA_PER_PRDT - 1), EFI_AHCI_MAX_DATA_PER_PRDT);
//
// According to AHCI 1.3 spec, a PRDT entry can point to a maximum 4MB data block.