TianoCore EDK2 master
Loading...
Searching...
No Matches
UsbDxeLib.c
Go to the documentation of this file.
1
12#include "UefiUsbLibInternal.h"
13
14static UINT8 *mConfigData = NULL;
15static EFI_USB_DEVICE_DESCRIPTOR mDeviceDescriptor;
16
44EFIAPI
47 IN UINT16 Value,
48 IN UINT16 Index,
49 IN UINT16 DescriptorLength,
50 OUT VOID *Descriptor,
51 OUT UINT32 *Status
52 )
53{
55
56 ASSERT (UsbIo != NULL);
57 ASSERT (Descriptor != NULL);
58 ASSERT (Status != NULL);
59
60 ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
61
62 DevReq.RequestType = USB_DEV_GET_DESCRIPTOR_REQ_TYPE;
63 DevReq.Request = USB_REQ_GET_DESCRIPTOR;
64 DevReq.Value = Value;
65 DevReq.Index = Index;
66 DevReq.Length = DescriptorLength;
67
68 return UsbIo->UsbControlTransfer (
69 UsbIo,
70 &DevReq,
71 EfiUsbDataIn,
72 PcdGet32 (PcdUsbTransferTimeoutValue),
73 Descriptor,
74 DescriptorLength,
75 Status
76 );
77}
78
103EFIAPI
105 IN EFI_USB_IO_PROTOCOL *UsbIo,
106 IN UINT16 Value,
107 IN UINT16 Index,
108 IN UINT16 DescriptorLength,
109 IN VOID *Descriptor,
110 OUT UINT32 *Status
111 )
112{
114
115 ASSERT (UsbIo != NULL);
116 ASSERT (Descriptor != NULL);
117 ASSERT (Status != NULL);
118
119 ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
120
121 DevReq.RequestType = USB_DEV_SET_DESCRIPTOR_REQ_TYPE;
122 DevReq.Request = USB_REQ_SET_DESCRIPTOR;
123 DevReq.Value = Value;
124 DevReq.Index = Index;
125 DevReq.Length = DescriptorLength;
126
127 return UsbIo->UsbControlTransfer (
128 UsbIo,
129 &DevReq,
130 EfiUsbDataOut,
131 PcdGet32 (PcdUsbTransferTimeoutValue),
132 Descriptor,
133 DescriptorLength,
134 Status
135 );
136}
137
160EFIAPI
162 IN EFI_USB_IO_PROTOCOL *UsbIo,
163 IN UINT16 Interface,
164 OUT UINT16 *AlternateSetting,
165 OUT UINT32 *Status
166 )
167{
169
170 ASSERT (UsbIo != NULL);
171 ASSERT (AlternateSetting != NULL);
172 ASSERT (Status != NULL);
173
174 *AlternateSetting = 0;
175
176 ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
177
178 DevReq.RequestType = USB_DEV_GET_INTERFACE_REQ_TYPE;
179 DevReq.Request = USB_REQ_GET_INTERFACE;
180 DevReq.Index = Interface;
181 DevReq.Length = 1;
182
183 return UsbIo->UsbControlTransfer (
184 UsbIo,
185 &DevReq,
186 EfiUsbDataIn,
187 PcdGet32 (PcdUsbTransferTimeoutValue),
188 AlternateSetting,
189 1,
190 Status
191 );
192}
193
215EFIAPI
217 IN EFI_USB_IO_PROTOCOL *UsbIo,
218 IN UINT16 Interface,
219 IN UINT16 AlternateSetting,
220 OUT UINT32 *Status
221 )
222{
224
225 ASSERT (UsbIo != NULL);
226 ASSERT (Status != NULL);
227
228 ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
229
230 DevReq.RequestType = USB_DEV_SET_INTERFACE_REQ_TYPE;
231 DevReq.Request = USB_REQ_SET_INTERFACE;
232 DevReq.Value = AlternateSetting;
233 DevReq.Index = Interface;
234
235 return UsbIo->UsbControlTransfer (
236 UsbIo,
237 &DevReq,
238 EfiUsbNoData,
239 PcdGet32 (PcdUsbTransferTimeoutValue),
240 NULL,
241 0,
242 Status
243 );
244}
245
267EFIAPI
269 IN EFI_USB_IO_PROTOCOL *UsbIo,
270 OUT UINT16 *ConfigurationValue,
271 OUT UINT32 *Status
272 )
273{
275
276 ASSERT (UsbIo != NULL);
277 ASSERT (ConfigurationValue != NULL);
278 ASSERT (Status != NULL);
279
280 *ConfigurationValue = 0;
281
282 ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
283
284 DevReq.RequestType = USB_DEV_GET_CONFIGURATION_REQ_TYPE;
285 DevReq.Request = USB_REQ_GET_CONFIG;
286 DevReq.Length = 1;
287
288 return UsbIo->UsbControlTransfer (
289 UsbIo,
290 &DevReq,
291 EfiUsbDataIn,
292 PcdGet32 (PcdUsbTransferTimeoutValue),
293 ConfigurationValue,
294 1,
295 Status
296 );
297}
298
319EFIAPI
321 IN EFI_USB_IO_PROTOCOL *UsbIo,
322 IN UINT16 ConfigurationValue,
323 OUT UINT32 *Status
324 )
325{
327
328 ASSERT (UsbIo != NULL);
329 ASSERT (Status != NULL);
330
331 ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
332
333 DevReq.RequestType = USB_DEV_SET_CONFIGURATION_REQ_TYPE;
334 DevReq.Request = USB_REQ_SET_CONFIG;
335 DevReq.Value = ConfigurationValue;
336
337 return UsbIo->UsbControlTransfer (
338 UsbIo,
339 &DevReq,
340 EfiUsbNoData,
341 PcdGet32 (PcdUsbTransferTimeoutValue),
342 NULL,
343 0,
344 Status
345 );
346}
347
372EFIAPI
374 IN EFI_USB_IO_PROTOCOL *UsbIo,
375 IN USB_TYPES_DEFINITION Recipient,
376 IN UINT16 Value,
377 IN UINT16 Target,
378 OUT UINT32 *Status
379 )
380{
382
383 ASSERT (UsbIo != NULL);
384 ASSERT (Status != NULL);
385
386 ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
387
388 switch (Recipient) {
389 case USB_TARGET_DEVICE:
390 DevReq.RequestType = USB_DEV_SET_FEATURE_REQ_TYPE_D;
391 break;
392
393 case USB_TARGET_INTERFACE:
394 DevReq.RequestType = USB_DEV_SET_FEATURE_REQ_TYPE_I;
395 break;
396
397 case USB_TARGET_ENDPOINT:
398 DevReq.RequestType = USB_DEV_SET_FEATURE_REQ_TYPE_E;
399 break;
400
401 default:
402 break;
403 }
404
405 //
406 // Fill device request, see USB1.1 spec
407 //
408 DevReq.Request = USB_REQ_SET_FEATURE;
409 DevReq.Value = Value;
410 DevReq.Index = Target;
411
412 return UsbIo->UsbControlTransfer (
413 UsbIo,
414 &DevReq,
415 EfiUsbNoData,
416 PcdGet32 (PcdUsbTransferTimeoutValue),
417 NULL,
418 0,
419 Status
420 );
421}
422
447EFIAPI
449 IN EFI_USB_IO_PROTOCOL *UsbIo,
450 IN USB_TYPES_DEFINITION Recipient,
451 IN UINT16 Value,
452 IN UINT16 Target,
453 OUT UINT32 *Status
454 )
455{
457
458 ASSERT (UsbIo != NULL);
459 ASSERT (Status != NULL);
460
461 ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
462
463 switch (Recipient) {
464 case USB_TARGET_DEVICE:
465 DevReq.RequestType = USB_DEV_CLEAR_FEATURE_REQ_TYPE_D;
466 break;
467
468 case USB_TARGET_INTERFACE:
469 DevReq.RequestType = USB_DEV_CLEAR_FEATURE_REQ_TYPE_I;
470 break;
471
472 case USB_TARGET_ENDPOINT:
473 DevReq.RequestType = USB_DEV_CLEAR_FEATURE_REQ_TYPE_E;
474 break;
475
476 default:
477 break;
478 }
479
480 //
481 // Fill device request, see USB1.1 spec
482 //
483 DevReq.Request = USB_REQ_CLEAR_FEATURE;
484 DevReq.Value = Value;
485 DevReq.Index = Target;
486
487 return UsbIo->UsbControlTransfer (
488 UsbIo,
489 &DevReq,
490 EfiUsbNoData,
491 PcdGet32 (PcdUsbTransferTimeoutValue),
492 NULL,
493 0,
494 Status
495 );
496}
497
523EFIAPI
525 IN EFI_USB_IO_PROTOCOL *UsbIo,
526 IN USB_TYPES_DEFINITION Recipient,
527 IN UINT16 Target,
528 OUT UINT16 *DeviceStatus,
529 OUT UINT32 *Status
530 )
531{
533
534 ASSERT (UsbIo != NULL);
535 ASSERT (DeviceStatus != NULL);
536 ASSERT (Status != NULL);
537
538 ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
539
540 switch (Recipient) {
541 case USB_TARGET_DEVICE:
542 DevReq.RequestType = USB_DEV_GET_STATUS_REQ_TYPE_D;
543 break;
544
545 case USB_TARGET_INTERFACE:
546 DevReq.RequestType = USB_DEV_GET_STATUS_REQ_TYPE_I;
547 break;
548
549 case USB_TARGET_ENDPOINT:
550 DevReq.RequestType = USB_DEV_GET_STATUS_REQ_TYPE_E;
551 break;
552
553 default:
554 break;
555 }
556
557 //
558 // Fill device request, see USB1.1 spec
559 //
560 DevReq.Request = USB_REQ_GET_STATUS;
561 DevReq.Value = 0;
562 DevReq.Index = Target;
563 DevReq.Length = 2;
564
565 return UsbIo->UsbControlTransfer (
566 UsbIo,
567 &DevReq,
568 EfiUsbDataIn,
569 PcdGet32 (PcdUsbTransferTimeoutValue),
570 DeviceStatus,
571 2,
572 Status
573 );
574}
575
598EFIAPI
600 IN EFI_USB_IO_PROTOCOL *UsbIo,
601 IN UINT8 Endpoint,
602 OUT UINT32 *Status
603 )
604{
605 EFI_STATUS Result;
606 EFI_USB_ENDPOINT_DESCRIPTOR EndpointDescriptor;
607 EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
608 UINT8 Index;
609
610 ASSERT (UsbIo != NULL);
611 ASSERT (Status != NULL);
612
613 ZeroMem (&EndpointDescriptor, sizeof (EFI_USB_ENDPOINT_DESCRIPTOR));
614 //
615 // First search the endpoint descriptor for that endpoint addr
616 //
617 Result = UsbIo->UsbGetInterfaceDescriptor (
618 UsbIo,
619 &InterfaceDescriptor
620 );
621 if (EFI_ERROR (Result)) {
622 return Result;
623 }
624
625 for (Index = 0; Index < InterfaceDescriptor.NumEndpoints; Index++) {
626 Result = UsbIo->UsbGetEndpointDescriptor (
627 UsbIo,
628 Index,
629 &EndpointDescriptor
630 );
631 if (EFI_ERROR (Result)) {
632 continue;
633 }
634
635 if (EndpointDescriptor.EndpointAddress == Endpoint) {
636 break;
637 }
638 }
639
640 if (Index == InterfaceDescriptor.NumEndpoints) {
641 //
642 // No such endpoint
643 //
644 return EFI_NOT_FOUND;
645 }
646
647 Result = UsbClearFeature (
648 UsbIo,
649 USB_TARGET_ENDPOINT,
650 USB_FEATURE_ENDPOINT_HALT,
651 EndpointDescriptor.EndpointAddress,
652 Status
653 );
654
655 return Result;
656}
657
670static
672InitUsbConfigDescriptorData (
674 )
675{
676 EFI_STATUS Status;
679 UINT8 ConfigNum;
680 UINT8 ConfigValue;
681 UINT32 UsbStatus;
682
683 //
684 // Get UsbIo device and configuration descriptors.
685 //
686 Status = UsbIo->UsbGetDeviceDescriptor (UsbIo, &DevDesc);
687 ASSERT_EFI_ERROR (Status);
688
689 Status = UsbIo->UsbGetConfigDescriptor (UsbIo, &CnfDesc);
690 ASSERT_EFI_ERROR (Status);
691
692 if (mConfigData != NULL) {
693 if ( (CompareMem (&DevDesc, &mDeviceDescriptor, sizeof (EFI_USB_DEVICE_DESCRIPTOR)) == 0)
694 && (CompareMem (&CnfDesc, mConfigData, sizeof (EFI_USB_CONFIG_DESCRIPTOR)) == 0))
695 {
696 return EFI_SUCCESS;
697 }
698
699 gBS->FreePool (mConfigData);
700 mConfigData = NULL;
701 }
702
703 CopyMem (&mDeviceDescriptor, &DevDesc, sizeof (EFI_USB_DEVICE_DESCRIPTOR));
704
705 //
706 // Examine device with multiple configurations: find configuration index of UsbIo config descriptor.
707 //
708 // Use EFI_USB_DEVICE_DESCRIPTOR.NumConfigurations to loop through configuration descriptors, match
709 // EFI_USB_CONFIG_DESCRIPTOR.ConfigurationValue to the configuration value reported by UsbIo->UsbGetConfigDescriptor.
710 // The index of the matched configuration is used in wValue of the following GET_DESCRIPTOR request.
711 //
712 ConfigValue = CnfDesc.ConfigurationValue;
713 for (ConfigNum = 0; ConfigNum < DevDesc.NumConfigurations; ConfigNum++) {
714 Status = UsbGetDescriptor (
715 UsbIo,
716 (USB_DESC_TYPE_CONFIG << 8) | ConfigNum,
717 0,
719 &CnfDesc,
720 &UsbStatus
721 );
722 ASSERT_EFI_ERROR (Status);
723
724 if (CnfDesc.ConfigurationValue == ConfigValue) {
725 break;
726 }
727 }
728
729 ASSERT (ConfigNum < DevDesc.NumConfigurations);
730 if (ConfigNum == DevDesc.NumConfigurations) {
731 return EFI_NOT_FOUND;
732 }
733
734 //
735 // ConfigNum has zero based index of the configuration that UsbIo belongs to. Use this index to retrieve
736 // full configuration descriptor data.
737 //
738 Status = gBS->AllocatePool (EfiBootServicesData, CnfDesc.TotalLength, (VOID **)&mConfigData);
739 ASSERT_EFI_ERROR (Status);
740
741 Status = UsbGetDescriptor (
742 UsbIo,
743 (USB_DESC_TYPE_CONFIG << 8) | ConfigNum,
744 0,
745 CnfDesc.TotalLength,
746 mConfigData,
747 &UsbStatus
748 );
749 ASSERT_EFI_ERROR (Status);
750
751 return Status;
752}
753
775static
777FindUsbDescriptor (
778 EFI_USB_IO_PROTOCOL *UsbIo,
779 UINT8 DescType,
780 UINT16 Setting,
781 UINTN Index,
782 VOID **Data
783 )
784{
786 EFI_STATUS Status;
787 UINT8 *BufferPtr;
788 UINT8 *BufferEnd;
789 UINT8 *ConfigEnd;
790 UINTN Idx;
791
792 //
793 // Find the interface descriptor referenced by UsbIo in the current configuration
794 //
795 Status = UsbIo->UsbGetInterfaceDescriptor (UsbIo, &IntfDesc);
796 ASSERT_EFI_ERROR (Status);
797
798 ConfigEnd = mConfigData + ((EFI_USB_CONFIG_DESCRIPTOR *)mConfigData)->TotalLength;
799
800 for (BufferPtr = mConfigData; BufferPtr < ConfigEnd; BufferPtr += BufferPtr[0]) {
801 if (BufferPtr[1] == USB_DESC_TYPE_INTERFACE) {
802 if ((BufferPtr[2] == IntfDesc.InterfaceNumber) && (BufferPtr[3] == (UINT8)Setting)) {
803 break;
804 }
805 }
806 }
807
808 if (BufferPtr >= ConfigEnd) {
809 return EFI_UNSUPPORTED;
810 }
811
812 //
813 // Found the beginning of the interface, find the ending
814 //
815 for (BufferEnd = BufferPtr + BufferPtr[0]; BufferEnd < ConfigEnd; BufferEnd += BufferEnd[0]) {
816 if (BufferEnd[1] == USB_DESC_TYPE_INTERFACE) {
817 break;
818 }
819 }
820
821 Idx = 0;
822
823 if (DescType == USB_DESC_TYPE_INTERFACE) {
824 *Data = BufferPtr;
825 return EFI_SUCCESS;
826 }
827
828 if ((DescType == USB_DESC_TYPE_ENDPOINT) || (DescType == USB_DESC_TYPE_CS_ENDPOINT)) {
829 while (BufferPtr < BufferEnd) {
830 BufferPtr += BufferPtr[0];
831 if (BufferPtr[1] == USB_DESC_TYPE_ENDPOINT) {
832 if (Idx == Index) {
833 if (DescType == USB_DESC_TYPE_CS_ENDPOINT) {
834 BufferPtr += BufferPtr[0];
835 if (BufferPtr[1] != USB_DESC_TYPE_CS_ENDPOINT) {
836 break;
837 }
838 }
839
840 *Data = BufferPtr;
841 return EFI_SUCCESS;
842 }
843
844 Idx++;
845 }
846 }
847 }
848
849 if (DescType == USB_DESC_TYPE_CS_INTERFACE) {
850 while (BufferPtr < BufferEnd) {
851 BufferPtr += BufferPtr[0];
852 if (BufferPtr[1] == USB_DESC_TYPE_CS_INTERFACE) {
853 if (Idx == Index) {
854 *Data = BufferPtr;
855 return EFI_SUCCESS;
856 }
857
858 Idx++;
859 }
860 }
861 }
862
863 return EFI_NOT_FOUND;
864}
865
874static
875UINT8
876FindNumberOfCsInterfaces (
877 VOID *Data
878 )
879{
880 UINT8 *Buffer;
881 UINT8 *ConfigEnd;
882 UINT8 Index;
883
884 Buffer = Data;
885 ConfigEnd = mConfigData + ((EFI_USB_CONFIG_DESCRIPTOR *)mConfigData)->TotalLength;
886
887 Index = 0;
888
889 for (Buffer += Buffer[0]; Buffer < ConfigEnd; Buffer += Buffer[0]) {
890 if (Buffer[1] == USB_DESC_TYPE_INTERFACE) {
891 break;
892 }
893
894 if (Buffer[1] == USB_DESC_TYPE_CS_INTERFACE) {
895 Index++;
896 }
897 }
898
899 return Index;
900}
901
924EFIAPI
927 IN UINT16 AlternateSetting,
929 OUT UINTN *CsInterfacesNumber
930 )
931{
932 EFI_STATUS Status;
933 VOID *Data;
934 EFI_TPL OldTpl;
935
936 if ((Descriptor == NULL) || (CsInterfacesNumber == NULL)) {
937 return EFI_INVALID_PARAMETER;
938 }
939
940 OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
941
942 Status = InitUsbConfigDescriptorData (This);
943 if (EFI_ERROR (Status)) {
944 Status = EFI_DEVICE_ERROR;
945 goto ON_EXIT;
946 }
947
948 Status = FindUsbDescriptor (This, USB_DESC_TYPE_INTERFACE, AlternateSetting, 0, &Data);
949 if (EFI_ERROR (Status)) {
950 goto ON_EXIT;
951 }
952
953 *CsInterfacesNumber = FindNumberOfCsInterfaces (Data);
954 CopyMem (Descriptor, Data, sizeof (EFI_USB_INTERFACE_DESCRIPTOR));
955
956ON_EXIT:
957 gBS->RestoreTPL (OldTpl);
958 return Status;
959}
960
985EFIAPI
988 IN UINT16 AlternateSetting,
989 IN UINTN Index,
991 )
992{
993 EFI_STATUS Status;
994 VOID *Data;
995 EFI_TPL OldTpl;
996
997 if (Descriptor == NULL) {
998 return EFI_INVALID_PARAMETER;
999 }
1000
1001 OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
1002
1003 Status = InitUsbConfigDescriptorData (This);
1004 if (EFI_ERROR (Status)) {
1005 Status = EFI_DEVICE_ERROR;
1006 goto ON_EXIT;
1007 }
1008
1009 Status = FindUsbDescriptor (This, USB_DESC_TYPE_ENDPOINT, AlternateSetting, Index, &Data);
1010 if (EFI_ERROR (Status)) {
1011 goto ON_EXIT;
1012 }
1013
1014 CopyMem (Descriptor, Data, sizeof (EFI_USB_ENDPOINT_DESCRIPTOR));
1015
1016ON_EXIT:
1017 gBS->RestoreTPL (OldTpl);
1018 return Status;
1019}
1020
1046EFIAPI
1048 IN EFI_USB_IO_PROTOCOL *This,
1049 IN UINT16 AlternateSetting,
1050 IN UINTN Index,
1051 IN OUT UINTN *BufferSize,
1052 OUT VOID *Buffer
1053 )
1054{
1055 EFI_STATUS Status;
1056 VOID *Data;
1057 UINT8 DescLength;
1058 EFI_TPL OldTpl;
1059
1060 if ((BufferSize == NULL) || ((Buffer == NULL) && (*BufferSize != 0))) {
1061 return EFI_INVALID_PARAMETER;
1062 }
1063
1064 OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
1065
1066 Status = InitUsbConfigDescriptorData (This);
1067 if (EFI_ERROR (Status)) {
1068 Status = EFI_DEVICE_ERROR;
1069 goto ON_EXIT;
1070 }
1071
1072 Status = FindUsbDescriptor (This, USB_DESC_TYPE_CS_INTERFACE, AlternateSetting, Index, &Data);
1073 if (EFI_ERROR (Status)) {
1074 goto ON_EXIT;
1075 }
1076
1077 DescLength = ((UINT8 *)Data)[0];
1078
1079 if ((Buffer == NULL) || (DescLength > *BufferSize)) {
1080 *BufferSize = DescLength;
1081 Status = EFI_BUFFER_TOO_SMALL;
1082 goto ON_EXIT;
1083 }
1084
1085 CopyMem (Buffer, Data, DescLength);
1086
1087ON_EXIT:
1088 gBS->RestoreTPL (OldTpl);
1089 return Status;
1090}
1091
1118EFIAPI
1120 IN EFI_USB_IO_PROTOCOL *This,
1121 IN UINT16 AlternateSetting,
1122 IN UINTN Index,
1123 IN OUT UINTN *BufferSize,
1124 OUT VOID *Buffer
1125 )
1126{
1127 EFI_STATUS Status;
1128 VOID *Data;
1129 UINT8 DescLength;
1130 EFI_TPL OldTpl;
1131
1132 if ((BufferSize == NULL) || ((Buffer == NULL) && (*BufferSize != 0))) {
1133 return EFI_INVALID_PARAMETER;
1134 }
1135
1136 OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
1137
1138 Status = InitUsbConfigDescriptorData (This);
1139 if (EFI_ERROR (Status)) {
1140 Status = EFI_DEVICE_ERROR;
1141 goto ON_EXIT;
1142 }
1143
1144 Status = FindUsbDescriptor (This, USB_DESC_TYPE_CS_ENDPOINT, AlternateSetting, Index, &Data);
1145 if (EFI_ERROR (Status)) {
1146 goto ON_EXIT;
1147 }
1148
1149 DescLength = ((UINT8 *)Data)[0];
1150
1151 if ((Buffer == NULL) || (DescLength > *BufferSize)) {
1152 *BufferSize = DescLength;
1153 Status = EFI_BUFFER_TOO_SMALL;
1154 goto ON_EXIT;
1155 }
1156
1157 CopyMem (Buffer, Data, DescLength);
1158
1159ON_EXIT:
1160 gBS->RestoreTPL (OldTpl);
1161 return Status;
1162}
1163
1174EFIAPI
1176 IN EFI_HANDLE ImageHandle,
1177 IN EFI_SYSTEM_TABLE *SystemTable
1178 )
1179{
1180 if (mConfigData != NULL) {
1181 gBS->FreePool (mConfigData);
1182 }
1183
1184 return EFI_SUCCESS;
1185}
UINT64 UINTN
INTN EFIAPI CompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
#define NULL
Definition: Base.h:319
#define VOID
Definition: Base.h:269
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:463
#define PcdGet32(TokenName)
Definition: PcdLib.h:362
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
UINTN EFI_TPL
Definition: UefiBaseType.h:41
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_BOOT_SERVICES * gBS
@ EfiBootServicesData
EFI_STATUS EFIAPI UsbGetConfiguration(IN EFI_USB_IO_PROTOCOL *UsbIo, OUT UINT16 *ConfigurationValue, OUT UINT32 *Status)
Definition: UsbDxeLib.c:268
EFI_STATUS EFIAPI UsbGetCsInterfaceDescriptor(IN EFI_USB_IO_PROTOCOL *This, IN UINT16 AlternateSetting, IN UINTN Index, IN OUT UINTN *BufferSize, OUT VOID *Buffer)
Definition: UsbDxeLib.c:1047
EFI_STATUS EFIAPI UsbSetDescriptor(IN EFI_USB_IO_PROTOCOL *UsbIo, IN UINT16 Value, IN UINT16 Index, IN UINT16 DescriptorLength, IN VOID *Descriptor, OUT UINT32 *Status)
Definition: UsbDxeLib.c:104
EFI_STATUS EFIAPI UefiUsbLibDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
Definition: UsbDxeLib.c:1175
EFI_STATUS EFIAPI UsbClearFeature(IN EFI_USB_IO_PROTOCOL *UsbIo, IN USB_TYPES_DEFINITION Recipient, IN UINT16 Value, IN UINT16 Target, OUT UINT32 *Status)
Definition: UsbDxeLib.c:448
EFI_STATUS EFIAPI UsbSetInterface(IN EFI_USB_IO_PROTOCOL *UsbIo, IN UINT16 Interface, IN UINT16 AlternateSetting, OUT UINT32 *Status)
Definition: UsbDxeLib.c:216
EFI_STATUS EFIAPI UsbClearEndpointHalt(IN EFI_USB_IO_PROTOCOL *UsbIo, IN UINT8 Endpoint, OUT UINT32 *Status)
Definition: UsbDxeLib.c:599
EFI_STATUS EFIAPI UsbGetInterface(IN EFI_USB_IO_PROTOCOL *UsbIo, IN UINT16 Interface, OUT UINT16 *AlternateSetting, OUT UINT32 *Status)
Definition: UsbDxeLib.c:161
EFI_STATUS EFIAPI UsbGetEndpointDescriptorSetting(IN EFI_USB_IO_PROTOCOL *This, IN UINT16 AlternateSetting, IN UINTN Index, OUT EFI_USB_ENDPOINT_DESCRIPTOR *Descriptor)
Definition: UsbDxeLib.c:986
EFI_STATUS EFIAPI UsbSetConfiguration(IN EFI_USB_IO_PROTOCOL *UsbIo, IN UINT16 ConfigurationValue, OUT UINT32 *Status)
Definition: UsbDxeLib.c:320
EFI_STATUS EFIAPI UsbSetFeature(IN EFI_USB_IO_PROTOCOL *UsbIo, IN USB_TYPES_DEFINITION Recipient, IN UINT16 Value, IN UINT16 Target, OUT UINT32 *Status)
Definition: UsbDxeLib.c:373
EFI_STATUS EFIAPI UsbGetStatus(IN EFI_USB_IO_PROTOCOL *UsbIo, IN USB_TYPES_DEFINITION Recipient, IN UINT16 Target, OUT UINT16 *DeviceStatus, OUT UINT32 *Status)
Definition: UsbDxeLib.c:524
EFI_STATUS EFIAPI UsbGetDescriptor(IN EFI_USB_IO_PROTOCOL *UsbIo, IN UINT16 Value, IN UINT16 Index, IN UINT16 DescriptorLength, OUT VOID *Descriptor, OUT UINT32 *Status)
Definition: UsbDxeLib.c:45
EFI_STATUS EFIAPI UsbGetInterfaceDescriptorSetting(IN EFI_USB_IO_PROTOCOL *This, IN UINT16 AlternateSetting, OUT EFI_USB_INTERFACE_DESCRIPTOR *Descriptor, OUT UINTN *CsInterfacesNumber)
Definition: UsbDxeLib.c:925
EFI_STATUS EFIAPI UsbGetCsEndpointDescriptor(IN EFI_USB_IO_PROTOCOL *This, IN UINT16 AlternateSetting, IN UINTN Index, IN OUT UINTN *BufferSize, OUT VOID *Buffer)
Definition: UsbDxeLib.c:1119