IN EFI_PCI_IO_PROTOCOL *PciIo,\r
IN EFI_IDE_REGISTERS *IdeRegisters,\r
IN OUT VOID *Buffer,\r
- IN UINT64 ByteCount,\r
+ IN OUT UINT32 *ByteCount,\r
IN BOOLEAN Read,\r
IN UINT64 Timeout\r
)\r
EFI_STATUS Status;\r
UINT16 *PtrBuffer;\r
\r
+ PtrBuffer = Buffer;\r
+ RequiredWordCount = *ByteCount >> 1;\r
+\r
//\r
// No data transfer is premitted.\r
//\r
- if (ByteCount == 0) {\r
+ if (RequiredWordCount == 0) {\r
return EFI_SUCCESS;\r
}\r
\r
- PtrBuffer = Buffer;\r
- RequiredWordCount = (UINT32)RShiftU64(ByteCount, 1);\r
//\r
- // ActuralWordCount means the word count of data really transferred.\r
+ // ActualWordCount means the word count of data really transferred.\r
//\r
ActualWordCount = 0;\r
\r
// to see whether indicates device is ready to transfer data.\r
//\r
Status = DRQReady2 (PciIo, IdeRegisters, Timeout);\r
- if ((Status == EFI_NOT_READY) && Read) {\r
- //\r
- // Device provided less data than we intended to read -- exit early.\r
- //\r
- return CheckStatusRegister (PciIo, IdeRegisters);\r
- }\r
if (EFI_ERROR (Status)) {\r
- return Status;\r
+ if (Status == EFI_NOT_READY) {\r
+ //\r
+ // Device provided less data than we intended to read, or wanted less\r
+ // data than we intended to write, but it may still be successful.\r
+ //\r
+ break;\r
+ } else {\r
+ return Status;\r
+ }\r
}\r
\r
//\r
return EFI_DEVICE_ERROR;\r
}\r
\r
+ *ByteCount = ActualWordCount << 1;\r
return Status;\r
}\r
\r
PciIo,\r
IdeRegisters,\r
Packet->InDataBuffer,\r
- Packet->InTransferLength,\r
+ &Packet->InTransferLength,\r
TRUE,\r
Packet->Timeout\r
);\r
PciIo,\r
IdeRegisters,\r
Packet->OutDataBuffer,\r
- Packet->OutTransferLength,\r
+ &Packet->OutTransferLength,\r
FALSE,\r
Packet->Timeout\r
);\r