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
This commit is contained in:
li-elvin 2011-08-04 02:23:39 +00:00
parent 486aace42c
commit c5493c54d5
1 changed files with 14 additions and 4 deletions

View File

@ -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;