36 UsbIoPpi = PeiBotDev->UsbIoPpi;
38 if (UsbIoPpi ==
NULL) {
39 return EFI_INVALID_PARAMETER;
44 DevReq.RequestType = 0x21;
45 DevReq.Request = 0xFF;
52 Status = UsbIoPpi->UsbControlTransfer (
65 EndpointAddr = (PeiBotDev->BulkInEndpoint)->EndpointAddress;
71 EndpointAddr = (PeiBotDev->BulkOutEndpoint)->EndpointAddress;
102 IN UINT8 CommandSize,
103 IN UINT32 DataTransferLength,
113 UsbIoPpi = PeiBotDev->UsbIoPpi;
120 Cbw.Signature = CBWSIG;
122 Cbw.DataTransferLength = DataTransferLength;
123 Cbw.Flags = (UINT8)((Direction == EfiUsbDataIn) ? 0x80 : 0);
125 Cbw.CmdLen = CommandSize;
127 CopyMem (Cbw.CmdBlock, Command, CommandSize);
129 DataSize =
sizeof (
CBW);
131 Status = UsbIoPpi->UsbBulkTransfer (
134 (PeiBotDev->BulkOutEndpoint)->EndpointAddress,
139 if (EFI_ERROR (Status)) {
144 return EFI_DEVICE_ERROR;
174 IN OUT VOID *DataBuffer,
186 UINTN TransferredSize;
188 UsbIoPpi = PeiBotDev->UsbIoPpi;
191 BufferPtr = (UINT8 *)DataBuffer;
197 if (Direction == EfiUsbDataIn) {
198 MaxPacketLen = (PeiBotDev->BulkInEndpoint)->MaxPacketSize;
199 EndpointAddr = (PeiBotDev->BulkInEndpoint)->EndpointAddress;
201 MaxPacketLen = (PeiBotDev->BulkOutEndpoint)->MaxPacketSize;
202 EndpointAddr = (PeiBotDev->BulkOutEndpoint)->EndpointAddress;
209 if (Remain > 16 * MaxPacketLen) {
210 Increment = 16 * MaxPacketLen;
215 Status = UsbIoPpi->UsbBulkTransfer (
224 TransferredSize += Increment;
226 if (EFI_ERROR (Status)) {
231 BufferPtr += Increment;
235 *DataSize = (UINT32)TransferredSize;
261 OUT UINT8 *TransferStatus,
271 UsbIoPpi = PeiBotDev->UsbIoPpi;
275 EndpointAddr = (PeiBotDev->BulkInEndpoint)->EndpointAddress;
277 DataSize =
sizeof (
CSW);
282 Status = UsbIoPpi->UsbBulkTransfer (
290 if (EFI_ERROR (Status)) {
294 if (Csw.Signature == CSWSIG) {
295 *TransferStatus = Csw.Status;
297 return EFI_DEVICE_ERROR;
325 IN UINT8 CommandSize,
327 IN UINT32 BufferLength,
329 IN UINT16 TimeOutInMilliSeconds
334 UINT8 TransferStatus;
348 TimeOutInMilliSeconds
351 if (EFI_ERROR (Status)) {
352 return EFI_DEVICE_ERROR;
361 BufferSize = BufferLength;
369 TimeOutInMilliSeconds
384 TimeOutInMilliSeconds
386 if (EFI_ERROR (Status)) {
388 return EFI_DEVICE_ERROR;
391 if (TransferStatus == 0x01) {
392 return EFI_DEVICE_ERROR;
395 return BotDataStatus;
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
EFI_STATUS BotStatusPhase(IN EFI_PEI_SERVICES **PeiServices, IN PEI_BOT_DEVICE *PeiBotDev, OUT UINT8 *TransferStatus, IN UINT16 Timeout)
EFI_STATUS BotCommandPhase(IN EFI_PEI_SERVICES **PeiServices, IN PEI_BOT_DEVICE *PeiBotDev, IN VOID *Command, IN UINT8 CommandSize, IN UINT32 DataTransferLength, IN EFI_USB_DATA_DIRECTION Direction, IN UINT16 Timeout)
EFI_STATUS BotDataPhase(IN EFI_PEI_SERVICES **PeiServices, IN PEI_BOT_DEVICE *PeiBotDev, IN UINT32 *DataSize, IN OUT VOID *DataBuffer, IN EFI_USB_DATA_DIRECTION Direction, IN UINT16 Timeout)
EFI_STATUS BotRecoveryReset(IN EFI_PEI_SERVICES **PeiServices, IN PEI_BOT_DEVICE *PeiBotDev)
EFI_STATUS PeiAtapiCommand(IN EFI_PEI_SERVICES **PeiServices, IN PEI_BOT_DEVICE *PeiBotDev, IN VOID *Command, IN UINT8 CommandSize, IN VOID *DataBuffer, IN UINT32 BufferLength, IN EFI_USB_DATA_DIRECTION Direction, IN UINT16 TimeOutInMilliSeconds)
EFI_STATUS PeiUsbClearEndpointHalt(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_IO_PPI *UsbIoPpi, IN UINT8 EndpointAddress)