summaryrefslogtreecommitdiff
path: root/IntelFrameworkModulePkg/Csm
diff options
context:
space:
mode:
authorli-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524>2011-08-04 02:23:39 +0000
committerli-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524>2011-08-04 02:23:39 +0000
commitc5493c54d5db5e5019c261ad15a28e9455c0d79d (patch)
treee5a5efcaa32bb2c75608263963f9fd7a9ae0d342 /IntelFrameworkModulePkg/Csm
parent486aace42ca6fd9bd80f80197f0bb24cec99f3b6 (diff)
downloadedk2-platforms-c5493c54d5db5e5019c261ad15a28e9455c0d79d.tar.xz
Normalize data transfer buffer in BlockIo thunk driver to avoid INT 13 Function 42H returning data boundary error (09H).
Signed-off-by: li-elvin Reviewed-by: erictian git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12084 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFrameworkModulePkg/Csm')
-rw-r--r--IntelFrameworkModulePkg/Csm/BiosThunk/BlockIoDxe/BiosInt13.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/IntelFrameworkModulePkg/Csm/BiosThunk/BlockIoDxe/BiosInt13.c b/IntelFrameworkModulePkg/Csm/BiosThunk/BlockIoDxe/BiosInt13.c
index c53490b0e3..63aa1a22c1 100644
--- a/IntelFrameworkModulePkg/Csm/BiosThunk/BlockIoDxe/BiosInt13.c
+++ b/IntelFrameworkModulePkg/Csm/BiosThunk/BlockIoDxe/BiosInt13.c
@@ -864,8 +864,13 @@ Edd11BiosReadBlocks (
AddressPacket->Zero = 0;
AddressPacket->NumberOfBlocks = (UINT8) NumberOfBlocks;
AddressPacket->Zero2 = 0;
- AddressPacket->SegOffset = EFI_SEGMENT (TransferBuffer) << 16;
- AddressPacket->SegOffset |= EFI_OFFSET (TransferBuffer);
+ //
+ // TransferBuffer has been 4KB alignment. Normalize TransferBuffer to make offset as 0 in seg:offset
+ // format to transfer maximum 127 blocks of data.
+ // Otherwise when offset adding data size exceeds 0xFFFF, if OpROM does not normalize TransferBuffer,
+ // INT13 function 42H will return data boundary error 09H.
+ //
+ AddressPacket->SegOffset = (UINT32) ((TransferBuffer >> 4) << 16);
AddressPacket->Lba = (UINT64) Lba;
Regs.H.AH = 0x42;
@@ -1012,8 +1017,13 @@ Edd11BiosWriteBlocks (
AddressPacket->Zero = 0;
AddressPacket->NumberOfBlocks = (UINT8) NumberOfBlocks;
AddressPacket->Zero2 = 0;
- AddressPacket->SegOffset = EFI_SEGMENT (TransferBuffer) << 16;
- AddressPacket->SegOffset |= EFI_OFFSET (TransferBuffer);
+ //
+ // TransferBuffer has been 4KB alignment. Normalize TransferBuffer to make offset as 0 in seg:offset
+ // format to transfer maximum 127 blocks of data.
+ // Otherwise when offset adding data size exceeds 0xFFFF, if OpROM does not normalize TransferBuffer,
+ // INT13 function 42H will return data boundary error 09H.
+ //
+ AddressPacket->SegOffset = (UINT32) ((TransferBuffer >> 4) << 16);
AddressPacket->Lba = (UINT64) Lba;
Regs.H.AH = 0x43;