2 Implementation of the command set of USB Mass Storage Specification
3 for Bootability, Revision 1.0.
5 Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 Execute REQUEST SENSE Command to retrieve sense data from device.
21 @param UsbMass The device whose sense data is requested.
23 @retval EFI_SUCCESS The command is excuted successfully.
24 @retval EFI_DEVICE_ERROR Failed to request sense.
25 @retval EFI_NO_RESPONSE The device media doesn't response this request.
26 @retval EFI_INVALID_PARAMETER The command has some invalid parameters.
27 @retval EFI_WRITE_PROTECTED The device is write protected.
28 @retval EFI_MEDIA_CHANGED The device media has been changed.
33 IN USB_MASS_DEVICE
*UsbMass
36 USB_BOOT_REQUEST_SENSE_CMD SenseCmd
;
37 USB_BOOT_REQUEST_SENSE_DATA SenseData
;
38 EFI_BLOCK_IO_MEDIA
*Media
;
39 USB_MASS_TRANSPORT
*Transport
;
43 Transport
= UsbMass
->Transport
;
46 // Request the sense data from the device
48 ZeroMem (&SenseCmd
, sizeof (USB_BOOT_REQUEST_SENSE_CMD
));
49 ZeroMem (&SenseData
, sizeof (USB_BOOT_REQUEST_SENSE_DATA
));
51 SenseCmd
.OpCode
= USB_BOOT_REQUEST_SENSE_OPCODE
;
52 SenseCmd
.Lun
= (UINT8
) (USB_BOOT_LUN (UsbMass
->Lun
));
53 SenseCmd
.AllocLen
= (UINT8
) sizeof (USB_BOOT_REQUEST_SENSE_DATA
);
55 Status
= Transport
->ExecCommand (
58 sizeof (USB_BOOT_REQUEST_SENSE_CMD
),
61 sizeof (USB_BOOT_REQUEST_SENSE_DATA
),
63 USB_BOOT_GENERAL_CMD_TIMEOUT
,
66 if (EFI_ERROR (Status
) || CmdResult
!= USB_MASS_CMD_SUCCESS
) {
67 DEBUG ((EFI_D_ERROR
, "UsbBootRequestSense: (%r) CmdResult=0x%x\n", Status
, CmdResult
));
68 if (!EFI_ERROR (Status
)) {
69 Status
= EFI_DEVICE_ERROR
;
75 // If sense data is retrieved successfully, interpret the sense data
76 // and update the media status if necessary.
78 Media
= &UsbMass
->BlockIoMedia
;
80 switch (USB_BOOT_SENSE_KEY (SenseData
.SenseKey
)) {
82 case USB_BOOT_SENSE_NO_SENSE
:
83 Status
= EFI_NO_RESPONSE
;
86 case USB_BOOT_SENSE_RECOVERED
:
88 // Suppose hardware can handle this case, and recover later by itself
90 Status
= EFI_NOT_READY
;
93 case USB_BOOT_SENSE_NOT_READY
:
94 Status
= EFI_DEVICE_ERROR
;
95 if (SenseData
.Asc
== USB_BOOT_ASC_NO_MEDIA
) {
96 Media
->MediaPresent
= FALSE
;
97 Status
= EFI_NO_MEDIA
;
98 } else if (SenseData
.Asc
== USB_BOOT_ASC_NOT_READY
) {
99 Status
= EFI_NOT_READY
;
103 case USB_BOOT_SENSE_ILLEGAL_REQUEST
:
104 Status
= EFI_INVALID_PARAMETER
;
107 case USB_BOOT_SENSE_UNIT_ATTENTION
:
108 Status
= EFI_DEVICE_ERROR
;
109 if (SenseData
.Asc
== USB_BOOT_ASC_MEDIA_CHANGE
) {
111 // If MediaChange, reset ReadOnly and new MediaId
113 Status
= EFI_MEDIA_CHANGED
;
114 Media
->ReadOnly
= FALSE
;
119 case USB_BOOT_SENSE_DATA_PROTECT
:
120 Status
= EFI_WRITE_PROTECTED
;
121 Media
->ReadOnly
= TRUE
;
125 Status
= EFI_DEVICE_ERROR
;
129 DEBUG ((EFI_D_INFO
, "UsbBootRequestSense: (%r) with sense key %x/%x/%x\n",
131 USB_BOOT_SENSE_KEY (SenseData
.SenseKey
),
141 Execute the USB mass storage bootability commands.
143 This function executes the USB mass storage bootability commands.
144 If execution failed, retrieve the error by REQUEST_SENSE, then
145 update the device's status, such as ReadyOnly.
147 @param UsbMass The device to issue commands to
148 @param Cmd The command to execute
149 @param CmdLen The length of the command
150 @param DataDir The direction of data transfer
151 @param Data The buffer to hold the data
152 @param DataLen The length of expected data
153 @param Timeout The timeout used to transfer
155 @retval EFI_SUCCESS Command is excuted successfully
156 @retval Others Command execution failed.
161 IN USB_MASS_DEVICE
*UsbMass
,
164 IN EFI_USB_DATA_DIRECTION DataDir
,
170 USB_MASS_TRANSPORT
*Transport
;
174 Transport
= UsbMass
->Transport
;
175 Status
= Transport
->ExecCommand (
187 // If ExecCommand() returns no error and CmdResult is success,
188 // then the commnad transfer is successful.
190 if ((CmdResult
== USB_MASS_CMD_SUCCESS
) && !EFI_ERROR (Status
)) {
194 DEBUG ((EFI_D_INFO
, "UsbBootExecCmd: Fail to Exec 0x%x Cmd /w %r\n",
195 *(UINT8
*)Cmd
,Status
));
198 // If command execution failed, then retrieve error info via sense request.
200 return UsbBootRequestSense (UsbMass
);
205 Execute the USB mass storage bootability commands with retrial.
207 This function executes USB mass storage bootability commands.
208 If the device isn't ready, wait for it. If the device is ready
209 and error occurs, retry the command again until it exceeds the
210 limit of retrial times.
212 @param UsbMass The device to issue commands to
213 @param Cmd The command to execute
214 @param CmdLen The length of the command
215 @param DataDir The direction of data transfer
216 @param Data The buffer to hold the data
217 @param DataLen The length of expected data
218 @param Timeout The timeout used to transfer
220 @retval EFI_SUCCESS The command is executed successfully.
221 @retval EFI_MEDIA_CHANGED The device media has been changed.
222 @retval Others Command execution failed after retrial.
226 UsbBootExecCmdWithRetry (
227 IN USB_MASS_DEVICE
*UsbMass
,
230 IN EFI_USB_DATA_DIRECTION DataDir
,
240 Status
= EFI_SUCCESS
;
242 for (Retry
= 0, Terminate
= 0; Retry
< USB_BOOT_COMMAND_RETRY
; Retry
++) {
243 Status
= UsbBootExecCmd (
252 if (Status
== EFI_SUCCESS
|| Status
== EFI_MEDIA_CHANGED
) {
256 // If the device isn't ready, just wait for it without limit on retrial times.
258 if (Status
== EFI_NOT_READY
&& Terminate
< 3) {
269 Execute TEST UNIT READY command to check if the device is ready.
271 @param UsbMass The device to test
273 @retval EFI_SUCCESS The device is ready.
274 @retval Others Device not ready.
279 IN USB_MASS_DEVICE
*UsbMass
282 USB_BOOT_TEST_UNIT_READY_CMD TestCmd
;
284 ZeroMem (&TestCmd
, sizeof (USB_BOOT_TEST_UNIT_READY_CMD
));
286 TestCmd
.OpCode
= USB_BOOT_TEST_UNIT_READY_OPCODE
;
287 TestCmd
.Lun
= (UINT8
) (USB_BOOT_LUN (UsbMass
->Lun
));
289 return UsbBootExecCmdWithRetry (
292 (UINT8
) sizeof (USB_BOOT_TEST_UNIT_READY_CMD
),
296 USB_BOOT_GENERAL_CMD_TIMEOUT
302 Execute INQUIRY Command to request information regarding parameters of
303 the device be sent to the host computer.
305 @param UsbMass The device to inquire.
307 @retval EFI_SUCCESS INQUIRY Command is executed successfully.
308 @retval Others INQUIRY Command is not executed successfully.
313 IN USB_MASS_DEVICE
*UsbMass
316 USB_BOOT_INQUIRY_CMD InquiryCmd
;
317 EFI_BLOCK_IO_MEDIA
*Media
;
320 Media
= &(UsbMass
->BlockIoMedia
);
322 ZeroMem (&InquiryCmd
, sizeof (USB_BOOT_INQUIRY_CMD
));
323 ZeroMem (&UsbMass
->InquiryData
, sizeof (USB_BOOT_INQUIRY_DATA
));
325 InquiryCmd
.OpCode
= USB_BOOT_INQUIRY_OPCODE
;
326 InquiryCmd
.Lun
= (UINT8
) (USB_BOOT_LUN (UsbMass
->Lun
));
327 InquiryCmd
.AllocLen
= (UINT8
) sizeof (USB_BOOT_INQUIRY_DATA
);
329 Status
= UsbBootExecCmdWithRetry (
332 (UINT8
) sizeof (USB_BOOT_INQUIRY_CMD
),
334 &UsbMass
->InquiryData
,
335 sizeof (USB_BOOT_INQUIRY_DATA
),
336 USB_BOOT_GENERAL_CMD_TIMEOUT
338 if (EFI_ERROR (Status
)) {
343 // Get information from PDT (Peripheral Device Type) field and Removable Medium Bit
344 // from the inquiry data.
346 UsbMass
->Pdt
= (UINT8
) (USB_BOOT_PDT (UsbMass
->InquiryData
.Pdt
));
347 Media
->RemovableMedia
= (BOOLEAN
) (USB_BOOT_REMOVABLE (UsbMass
->InquiryData
.Removable
));
349 // Set block size to the default value of 512 Bytes, in case no media is present at first time.
351 Media
->BlockSize
= 0x0200;
358 Execute READ CAPACITY command to request information regarding
359 the capacity of the installed medium of the device.
361 This function executes READ CAPACITY command to get the capacity
362 of the USB mass storage media, including the presence, block size,
363 and last block number.
365 @param UsbMass The device to retireve disk gemotric.
367 @retval EFI_SUCCESS The disk geometry is successfully retrieved.
368 @retval EFI_NOT_READY The returned block size is zero.
369 @retval Other READ CAPACITY command execution failed.
373 UsbBootReadCapacity (
374 IN USB_MASS_DEVICE
*UsbMass
377 USB_BOOT_READ_CAPACITY_CMD CapacityCmd
;
378 USB_BOOT_READ_CAPACITY_DATA CapacityData
;
379 EFI_BLOCK_IO_MEDIA
*Media
;
383 Media
= &UsbMass
->BlockIoMedia
;
385 ZeroMem (&CapacityCmd
, sizeof (USB_BOOT_READ_CAPACITY_CMD
));
386 ZeroMem (&CapacityData
, sizeof (USB_BOOT_READ_CAPACITY_DATA
));
388 CapacityCmd
.OpCode
= USB_BOOT_READ_CAPACITY_OPCODE
;
389 CapacityCmd
.Lun
= (UINT8
) (USB_BOOT_LUN (UsbMass
->Lun
));
391 Status
= UsbBootExecCmdWithRetry (
394 (UINT8
) sizeof (USB_BOOT_READ_CAPACITY_CMD
),
397 sizeof (USB_BOOT_READ_CAPACITY_DATA
),
398 USB_BOOT_GENERAL_CMD_TIMEOUT
400 if (EFI_ERROR (Status
)) {
405 // Get the information on media presence, block size, and last block number
406 // from READ CAPACITY data.
408 Media
->MediaPresent
= TRUE
;
409 Media
->LastBlock
= SwapBytes32 (ReadUnaligned32 ((CONST UINT32
*) CapacityData
.LastLba
));
411 BlockSize
= SwapBytes32 (ReadUnaligned32 ((CONST UINT32
*) CapacityData
.BlockLen
));
412 if (BlockSize
== 0) {
416 return UsbBootRequestSense (UsbMass
);
418 Media
->BlockSize
= BlockSize
;
421 DEBUG ((EFI_D_INFO
, "UsbBootReadCapacity Success LBA=%ld BlockSize=%d\n",
422 Media
->LastBlock
, Media
->BlockSize
));
428 Retrieves SCSI mode sense information via MODE SENSE(6) command.
430 @param UsbMass The device whose sense data is requested.
432 @retval EFI_SUCCESS SCSI mode sense information retrieved successfully.
433 @retval Other Command execution failed.
438 IN USB_MASS_DEVICE
*UsbMass
442 USB_SCSI_MODE_SENSE6_CMD ModeSenseCmd
;
443 USB_SCSI_MODE_SENSE6_PARA_HEADER ModeParaHeader
;
444 EFI_BLOCK_IO_MEDIA
*Media
;
446 Media
= &UsbMass
->BlockIoMedia
;
448 ZeroMem (&ModeSenseCmd
, sizeof (USB_SCSI_MODE_SENSE6_CMD
));
449 ZeroMem (&ModeParaHeader
, sizeof (USB_SCSI_MODE_SENSE6_PARA_HEADER
));
452 // MODE SENSE(6) command is defined in Section 8.2.10 of SCSI-2 Spec
454 ModeSenseCmd
.OpCode
= USB_SCSI_MODE_SENSE6_OPCODE
;
455 ModeSenseCmd
.Lun
= (UINT8
) USB_BOOT_LUN (UsbMass
->Lun
);
456 ModeSenseCmd
.PageCode
= 0x3F;
457 ModeSenseCmd
.AllocateLen
= (UINT8
) sizeof (USB_SCSI_MODE_SENSE6_PARA_HEADER
);
459 Status
= UsbBootExecCmdWithRetry (
462 (UINT8
) sizeof (USB_SCSI_MODE_SENSE6_CMD
),
465 sizeof (USB_SCSI_MODE_SENSE6_PARA_HEADER
),
466 USB_BOOT_GENERAL_CMD_TIMEOUT
470 // Format of device-specific parameter byte of the mode parameter header is defined in
471 // Section 8.2.10 of SCSI-2 Spec.
472 // BIT7 of this byte is indicates whether the medium is write protected.
474 if (!EFI_ERROR (Status
)) {
475 Media
->ReadOnly
= (BOOLEAN
) ((ModeParaHeader
.DevicePara
& BIT7
) != 0);
483 Get the parameters for the USB mass storage media.
485 This function get the parameters for the USB mass storage media,
486 It is used both to initialize the media during the Start() phase
487 of Driver Binding Protocol and to re-initialize it when the media is
488 changed. Althought the RemoveableMedia is unlikely to change,
489 it is also included here.
491 @param UsbMass The device to retrieve disk gemotric.
493 @retval EFI_SUCCESS The disk gemotric is successfully retrieved.
494 @retval Other Failed to get the parameters.
499 IN USB_MASS_DEVICE
*UsbMass
502 EFI_BLOCK_IO_MEDIA
*Media
;
506 Media
= &(UsbMass
->BlockIoMedia
);
507 CmdSet
= ((EFI_USB_INTERFACE_DESCRIPTOR
*) (UsbMass
->Context
))->InterfaceSubClass
;
509 Status
= UsbBootInquiry (UsbMass
);
510 if (EFI_ERROR (Status
)) {
511 DEBUG ((EFI_D_ERROR
, "UsbBootGetParams: UsbBootInquiry (%r)\n", Status
));
516 // Don't use the Removable bit in inquiry data to test whether the media
517 // is removable because many flash disks wrongly set this bit.
519 if ((UsbMass
->Pdt
== USB_PDT_CDROM
) || (UsbMass
->Pdt
== USB_PDT_OPTICAL
)) {
521 // CD-Rom device and Non-CD optical device
523 UsbMass
->OpticalStorage
= TRUE
;
525 // Default value 2048 Bytes, in case no media present at first time
527 Media
->BlockSize
= 0x0800;
530 if ((UsbMass
->Pdt
!= USB_PDT_CDROM
) && (CmdSet
== USB_MASS_STORE_SCSI
)) {
532 // ModeSense is required for the device with PDT of 0x00/0x07/0x0E,
533 // which is from [MassStorageBootabilitySpec-Page7].
534 // ModeSense(10) is useless here, while ModeSense(6) defined in SCSI
535 // could get the information of WriteProtected.
536 // Since not all device support this command, so skip if fail.
538 UsbScsiModeSense (UsbMass
);
541 return UsbBootReadCapacity (UsbMass
);
546 Detect whether the removable media is present and whether it has changed.
548 @param UsbMass The device to check.
550 @retval EFI_SUCCESS The media status is successfully checked.
551 @retval Other Failed to detect media.
556 IN USB_MASS_DEVICE
*UsbMass
559 EFI_BLOCK_IO_MEDIA OldMedia
;
560 EFI_BLOCK_IO_MEDIA
*Media
;
565 Media
= &UsbMass
->BlockIoMedia
;
567 CopyMem (&OldMedia
, &(UsbMass
->BlockIoMedia
), sizeof (EFI_BLOCK_IO_MEDIA
));
569 CmdSet
= ((EFI_USB_INTERFACE_DESCRIPTOR
*) (UsbMass
->Context
))->InterfaceSubClass
;
571 Status
= UsbBootIsUnitReady (UsbMass
);
572 if (EFI_ERROR (Status
)) {
576 if ((UsbMass
->Pdt
!= USB_PDT_CDROM
) && (CmdSet
== USB_MASS_STORE_SCSI
)) {
578 // MODE SENSE is required for the device with PDT of 0x00/0x07/0x0E,
579 // according to Section 4 of USB Mass Storage Specification for Bootability.
580 // MODE SENSE(10) is useless here, while MODE SENSE(6) defined in SCSI
581 // could get the information of Write Protected.
582 // Since not all device support this command, skip if fail.
584 UsbScsiModeSense (UsbMass
);
587 Status
= UsbBootReadCapacity (UsbMass
);
588 if (EFI_ERROR (Status
)) {
589 DEBUG ((EFI_D_ERROR
, "UsbBootDetectMedia: UsbBootReadCapacity (%r)\n", Status
));
597 // Detect whether it is necessary to reinstall the Block I/O Protocol.
599 // MediaId may change in RequestSense for MediaChanged
600 // MediaPresent may change in RequestSense for NoMedia
601 // MediaReadOnly may change in RequestSense for WriteProtected or MediaChanged
602 // MediaPresent/BlockSize/LastBlock may change in ReadCapacity
604 if ((Media
->MediaId
!= OldMedia
.MediaId
) ||
605 (Media
->MediaPresent
!= OldMedia
.MediaPresent
) ||
606 (Media
->ReadOnly
!= OldMedia
.ReadOnly
) ||
607 (Media
->BlockSize
!= OldMedia
.BlockSize
) ||
608 (Media
->LastBlock
!= OldMedia
.LastBlock
)) {
611 // This function is called by Block I/O Protocol APIs, which run at TPL_NOTIFY.
612 // Here we temporarily restore TPL to TPL_CALLBACK to invoke ReinstallProtocolInterface().
614 OldTpl
= EfiGetCurrentTpl ();
615 gBS
->RestoreTPL (TPL_CALLBACK
);
617 gBS
->ReinstallProtocolInterface (
619 &gEfiBlockIoProtocolGuid
,
624 ASSERT (EfiGetCurrentTpl () == TPL_CALLBACK
);
625 gBS
->RaiseTPL (OldTpl
);
628 // Update MediaId after reinstalling Block I/O Protocol.
630 if (Media
->MediaPresent
!= OldMedia
.MediaPresent
) {
631 if (Media
->MediaPresent
) {
638 if ((Media
->ReadOnly
!= OldMedia
.ReadOnly
) ||
639 (Media
->BlockSize
!= OldMedia
.BlockSize
) ||
640 (Media
->LastBlock
!= OldMedia
.LastBlock
)) {
650 Read some blocks from the device.
652 @param UsbMass The USB mass storage device to read from
653 @param Lba The start block number
654 @param TotalBlock Total block number to read
655 @param Buffer The buffer to read to
657 @retval EFI_SUCCESS Data are read into the buffer
658 @retval Others Failed to read all the data
663 IN USB_MASS_DEVICE
*UsbMass
,
669 USB_BOOT_READ10_CMD ReadCmd
;
676 BlockSize
= UsbMass
->BlockIoMedia
.BlockSize
;
677 Status
= EFI_SUCCESS
;
679 while (TotalBlock
> 0) {
681 // Split the total blocks into smaller pieces to ease the pressure
682 // on the device. We must split the total block because the READ10
683 // command only has 16 bit transfer length (in the unit of block).
685 Count
= (UINT16
)((TotalBlock
< USB_BOOT_IO_BLOCKS
) ? TotalBlock
: USB_BOOT_IO_BLOCKS
);
686 ByteSize
= (UINT32
)Count
* BlockSize
;
689 // USB command's upper limit timeout is 5s. [USB2.0-9.2.6.1]
691 Timeout
= (UINT32
) USB_BOOT_GENERAL_CMD_TIMEOUT
;
694 // Fill in the command then execute
696 ZeroMem (&ReadCmd
, sizeof (USB_BOOT_READ10_CMD
));
698 ReadCmd
.OpCode
= USB_BOOT_READ10_OPCODE
;
699 ReadCmd
.Lun
= (UINT8
) (USB_BOOT_LUN (UsbMass
->Lun
));
700 WriteUnaligned32 ((UINT32
*) ReadCmd
.Lba
, SwapBytes32 (Lba
));
701 WriteUnaligned16 ((UINT16
*) ReadCmd
.TransferLen
, SwapBytes16 (Count
));
703 Status
= UsbBootExecCmdWithRetry (
706 (UINT8
) sizeof (USB_BOOT_READ10_CMD
),
712 if (EFI_ERROR (Status
)) {
717 Buffer
+= Count
* BlockSize
;
726 Write some blocks to the device.
728 @param UsbMass The USB mass storage device to write to
729 @param Lba The start block number
730 @param TotalBlock Total block number to write
731 @param Buffer Pointer to the source buffer for the data.
733 @retval EFI_SUCCESS Data are written into the buffer
734 @retval Others Failed to write all the data
739 IN USB_MASS_DEVICE
*UsbMass
,
745 USB_BOOT_WRITE10_CMD WriteCmd
;
752 BlockSize
= UsbMass
->BlockIoMedia
.BlockSize
;
753 Status
= EFI_SUCCESS
;
755 while (TotalBlock
> 0) {
757 // Split the total blocks into smaller pieces to ease the pressure
758 // on the device. We must split the total block because the WRITE10
759 // command only has 16 bit transfer length (in the unit of block).
761 Count
= (UINT16
)((TotalBlock
< USB_BOOT_IO_BLOCKS
) ? TotalBlock
: USB_BOOT_IO_BLOCKS
);
762 ByteSize
= (UINT32
)Count
* BlockSize
;
765 // USB command's upper limit timeout is 5s. [USB2.0-9.2.6.1]
767 Timeout
= (UINT32
) USB_BOOT_GENERAL_CMD_TIMEOUT
;
770 // Fill in the write10 command block
772 ZeroMem (&WriteCmd
, sizeof (USB_BOOT_WRITE10_CMD
));
774 WriteCmd
.OpCode
= USB_BOOT_WRITE10_OPCODE
;
775 WriteCmd
.Lun
= (UINT8
) (USB_BOOT_LUN (UsbMass
->Lun
));
776 WriteUnaligned32 ((UINT32
*) WriteCmd
.Lba
, SwapBytes32 (Lba
));
777 WriteUnaligned16 ((UINT16
*) WriteCmd
.TransferLen
, SwapBytes16 (Count
));
779 Status
= UsbBootExecCmdWithRetry (
782 (UINT8
) sizeof (USB_BOOT_WRITE10_CMD
),
788 if (EFI_ERROR (Status
)) {
793 Buffer
+= Count
* BlockSize
;
801 Use the USB clear feature control transfer to clear the endpoint stall condition.
803 @param UsbIo The USB I/O Protocol instance
804 @param EndpointAddr The endpoint to clear stall for
806 @retval EFI_SUCCESS The endpoint stall condition is cleared.
807 @retval Others Failed to clear the endpoint stall condition.
811 UsbClearEndpointStall (
812 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
813 IN UINT8 EndpointAddr
816 EFI_USB_DEVICE_REQUEST Request
;
821 Request
.RequestType
= 0x02;
822 Request
.Request
= USB_REQ_CLEAR_FEATURE
;
823 Request
.Value
= USB_FEATURE_ENDPOINT_HALT
;
824 Request
.Index
= EndpointAddr
;
826 Timeout
= USB_BOOT_GENERAL_CMD_TIMEOUT
/ USB_MASS_1_MILLISECOND
;
828 Status
= UsbIo
->UsbControlTransfer (