summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerictian <erictian@6f19259b-4bc3-4df7-8a09-765794883524>2010-03-17 09:46:53 +0000
committererictian <erictian@6f19259b-4bc3-4df7-8a09-765794883524>2010-03-17 09:46:53 +0000
commitfa03149c12786e4cedd8579ca7cc770f35618f72 (patch)
treecbe0f837a2b26c1c6c15b5fc5c05f4c441c1fe92
parent9f50cb977c5067b80f369838c5ca74568efc4c7a (diff)
downloadedk2-platforms-fa03149c12786e4cedd8579ca7cc770f35618f72.tar.xz
The ATA alignment_logic_in_phy_blocks field doesn’t directly report the lowest aligned LBA. Instead, there’s some modulo arithmetic involved.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10265 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c
index 8df584506e..d11ebd9df0 100644
--- a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c
+++ b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c
@@ -304,7 +304,8 @@ IdentifyAtaDevice (
// Check lowest alignment of logical blocks within physical block
//
if ((IdentifyData->alignment_logic_in_phy_blocks & (BIT14 | BIT15)) == BIT14) {
- BlockMedia->LowestAlignedLba = (EFI_LBA) (IdentifyData->alignment_logic_in_phy_blocks & 0x3fff);
+ BlockMedia->LowestAlignedLba = (EFI_LBA) (BlockMedia->LogicalBlocksPerPhysicalBlock - (IdentifyData->alignment_logic_in_phy_blocks & 0x3fff)) %
+ BlockMedia->LogicalBlocksPerPhysicalBlock;
}
}
//