TianoCore EDK2 master
Loading...
Searching...
No Matches
UsbDesc.c
Go to the documentation of this file.
1
10#include "UsbBus.h"
11
18VOID
21 )
22{
24 UINTN Index;
25
26 if (Setting->Endpoints != NULL) {
27 //
28 // Each interface setting may have several endpoints, free them first.
29 //
30 for (Index = 0; Index < Setting->Desc.NumEndpoints; Index++) {
31 Ep = Setting->Endpoints[Index];
32
33 if (Ep != NULL) {
34 FreePool (Ep);
35 }
36 }
37
38 //
39 // Only call FreePool() if NumEndpoints > 0.
40 //
41 if (Setting->Desc.NumEndpoints > 0) {
42 FreePool (Setting->Endpoints);
43 }
44 }
45
46 FreePool (Setting);
47}
48
56VOID
58 IN USB_CONFIG_DESC *Config
59 )
60{
61 USB_INTERFACE_DESC *Interface;
62 UINTN Index;
63 UINTN SetIndex;
64
65 if (Config->Interfaces != NULL) {
66 //
67 // A configuration may have several interfaces, free the interface
68 //
69 for (Index = 0; Index < Config->Desc.NumInterfaces; Index++) {
70 Interface = Config->Interfaces[Index];
71
72 if (Interface == NULL) {
73 continue;
74 }
75
76 //
77 // Each interface may have several settings, free the settings
78 //
79 for (SetIndex = 0; SetIndex < Interface->NumOfSetting; SetIndex++) {
80 if (Interface->Settings[SetIndex] != NULL) {
81 UsbFreeInterfaceDesc (Interface->Settings[SetIndex]);
82 }
83 }
84
85 FreePool (Interface);
86 }
87
88 FreePool (Config->Interfaces);
89 }
90
91 FreePool (Config);
92}
93
100VOID
102 IN USB_DEVICE_DESC *DevDesc
103 )
104{
105 UINTN Index;
106
107 if (DevDesc->Configs != NULL) {
108 for (Index = 0; Index < DevDesc->Desc.NumConfigurations; Index++) {
109 if (DevDesc->Configs[Index] != NULL) {
110 UsbFreeConfigDesc (DevDesc->Configs[Index]);
111 }
112 }
113
114 FreePool (DevDesc->Configs);
115 }
116
117 FreePool (DevDesc);
118}
119
131VOID *
133 IN UINT8 *DescBuf,
134 IN UINTN Len,
135 IN UINT8 Type,
136 OUT UINTN *Consumed
137 )
138{
139 USB_DESC_HEAD *Head;
140 UINTN DescLen;
141 UINTN CtrlLen;
142 UINTN Offset;
143 VOID *Desc;
144
145 DescLen = 0;
146 CtrlLen = 0;
147 *Consumed = 0;
148
149 switch (Type) {
150 case USB_DESC_TYPE_DEVICE:
151 DescLen = sizeof (EFI_USB_DEVICE_DESCRIPTOR);
152 CtrlLen = sizeof (USB_DEVICE_DESC);
153 break;
154
155 case USB_DESC_TYPE_CONFIG:
156 DescLen = sizeof (EFI_USB_CONFIG_DESCRIPTOR);
157 CtrlLen = sizeof (USB_CONFIG_DESC);
158 break;
159
160 case USB_DESC_TYPE_INTERFACE:
161 DescLen = sizeof (EFI_USB_INTERFACE_DESCRIPTOR);
162 CtrlLen = sizeof (USB_INTERFACE_SETTING);
163 break;
164
165 case USB_DESC_TYPE_ENDPOINT:
166 DescLen = sizeof (EFI_USB_ENDPOINT_DESCRIPTOR);
167 CtrlLen = sizeof (USB_ENDPOINT_DESC);
168 break;
169
170 default:
171 ASSERT (FALSE);
172 return NULL;
173 }
174
175 //
176 // Total length is too small that cannot hold the single descriptor header plus data.
177 //
178 if (Len <= sizeof (USB_DESC_HEAD)) {
179 DEBUG ((DEBUG_ERROR, "UsbCreateDesc: met mal-format descriptor, total length = %d!\n", Len));
180 return NULL;
181 }
182
183 //
184 // All the descriptor has a common LTV (Length, Type, Value)
185 // format. Skip the descriptor that isn't of this Type
186 //
187 Offset = 0;
188 Head = (USB_DESC_HEAD *)DescBuf;
189 while (Offset < Len - sizeof (USB_DESC_HEAD)) {
190 //
191 // Above condition make sure Head->Len and Head->Type are safe to access
192 //
193 Head = (USB_DESC_HEAD *)&DescBuf[Offset];
194
195 if (Head->Len == 0) {
196 DEBUG ((DEBUG_ERROR, "UsbCreateDesc: met mal-format descriptor, Head->Len = 0!\n"));
197 return NULL;
198 }
199
200 //
201 // Make sure no overflow when adding Head->Len to Offset.
202 //
203 if (Head->Len > MAX_UINTN - Offset) {
204 DEBUG ((DEBUG_ERROR, "UsbCreateDesc: met mal-format descriptor, Head->Len = %d!\n", Head->Len));
205 return NULL;
206 }
207
208 Offset += Head->Len;
209
210 if (Head->Type == Type) {
211 break;
212 }
213 }
214
215 //
216 // Head->Len is invalid resulting data beyond boundary, or
217 // Descriptor cannot be found: No such type.
218 //
219 if (Len < Offset) {
220 DEBUG ((DEBUG_ERROR, "UsbCreateDesc: met mal-format descriptor, Offset/Len = %d/%d!\n", Offset, Len));
221 return NULL;
222 }
223
224 if ((Head->Type != Type) || (Head->Len < DescLen)) {
225 DEBUG ((DEBUG_ERROR, "UsbCreateDesc: descriptor cannot be found, Header(T/L) = %d/%d!\n", Head->Type, Head->Len));
226 return NULL;
227 }
228
229 Desc = AllocateZeroPool ((UINTN)CtrlLen);
230 if (Desc == NULL) {
231 return NULL;
232 }
233
234 CopyMem (Desc, Head, (UINTN)DescLen);
235
236 *Consumed = Offset;
237
238 return Desc;
239}
240
253 IN UINT8 *DescBuf,
254 IN UINTN Len,
255 OUT UINTN *Consumed
256 )
257{
258 USB_INTERFACE_SETTING *Setting;
260 UINTN Index;
261 UINTN NumEp;
262 UINTN Used;
263 UINTN Offset;
264
265 *Consumed = 0;
266 Setting = UsbCreateDesc (DescBuf, Len, USB_DESC_TYPE_INTERFACE, &Used);
267
268 if (Setting == NULL) {
269 DEBUG ((DEBUG_ERROR, "UsbParseInterfaceDesc: failed to create interface descriptor\n"));
270 return NULL;
271 }
272
273 Offset = Used;
274
275 //
276 // Create an array to hold the interface's endpoints
277 //
278 NumEp = Setting->Desc.NumEndpoints;
279
280 DEBUG ((
281 DEBUG_INFO,
282 "UsbParseInterfaceDesc: interface %d(setting %d) has %d endpoints\n",
283 Setting->Desc.InterfaceNumber,
284 Setting->Desc.AlternateSetting,
285 (UINT32)NumEp
286 ));
287
288 if (NumEp == 0) {
289 goto ON_EXIT;
290 }
291
292 Setting->Endpoints = AllocateZeroPool (sizeof (USB_ENDPOINT_DESC *) * NumEp);
293
294 if (Setting->Endpoints == NULL) {
295 goto ON_ERROR;
296 }
297
298 //
299 // Create the endpoints for this interface
300 //
301 for (Index = 0; (Index < NumEp) && (Offset < Len); Index++) {
302 Ep = UsbCreateDesc (DescBuf + Offset, Len - Offset, USB_DESC_TYPE_ENDPOINT, &Used);
303
304 if (Ep == NULL) {
305 DEBUG ((DEBUG_ERROR, "UsbParseInterfaceDesc: failed to create endpoint(index %d)\n", (UINT32)Index));
306 goto ON_ERROR;
307 }
308
309 Setting->Endpoints[Index] = Ep;
310 Offset += Used;
311 }
312
313ON_EXIT:
314 *Consumed = Offset;
315 return Setting;
316
317ON_ERROR:
318 UsbFreeInterfaceDesc (Setting);
319 return NULL;
320}
321
333 IN UINT8 *DescBuf,
334 IN UINTN Len
335 )
336{
337 USB_CONFIG_DESC *Config;
338 USB_INTERFACE_SETTING *Setting;
339 USB_INTERFACE_DESC *Interface;
340 UINTN Index;
341 UINTN NumIf;
342 UINTN Consumed;
343
344 ASSERT (DescBuf != NULL);
345
346 Config = UsbCreateDesc (DescBuf, Len, USB_DESC_TYPE_CONFIG, &Consumed);
347
348 if (Config == NULL) {
349 return NULL;
350 }
351
352 //
353 // Initialize an array of setting for the configuration's interfaces.
354 //
355 NumIf = Config->Desc.NumInterfaces;
356 Config->Interfaces = AllocateZeroPool (sizeof (USB_INTERFACE_DESC *) * NumIf);
357
358 if (Config->Interfaces == NULL) {
359 goto ON_ERROR;
360 }
361
362 DEBUG ((
363 DEBUG_INFO,
364 "UsbParseConfigDesc: config %d has %d interfaces\n",
365 Config->Desc.ConfigurationValue,
366 (UINT32)NumIf
367 ));
368
369 for (Index = 0; Index < NumIf; Index++) {
370 Interface = AllocateZeroPool (sizeof (USB_INTERFACE_DESC));
371
372 if (Interface == NULL) {
373 goto ON_ERROR;
374 }
375
376 Config->Interfaces[Index] = Interface;
377 }
378
379 //
380 // If a configuration has several interfaces, these interfaces are
381 // numbered from zero to n. If a interface has several settings,
382 // these settings are also number from zero to m. The interface
383 // setting must be organized as |interface 0, setting 0|interface 0
384 // setting 1|interface 1, setting 0|interface 2, setting 0|. Check
385 // USB2.0 spec, page 267.
386 //
387 DescBuf += Consumed;
388 Len -= Consumed;
389
390 //
391 // Make allowances for devices that return extra data at the
392 // end of their config descriptors
393 //
394 while (Len >= sizeof (EFI_USB_INTERFACE_DESCRIPTOR)) {
395 Setting = UsbParseInterfaceDesc (DescBuf, Len, &Consumed);
396
397 if (Setting == NULL) {
398 DEBUG ((DEBUG_ERROR, "UsbParseConfigDesc: warning: failed to get interface setting, stop parsing now.\n"));
399 break;
400 } else if (Setting->Desc.InterfaceNumber >= NumIf) {
401 DEBUG ((DEBUG_ERROR, "UsbParseConfigDesc: malformatted interface descriptor\n"));
402
403 UsbFreeInterfaceDesc (Setting);
404 goto ON_ERROR;
405 }
406
407 //
408 // Insert the descriptor to the corresponding set.
409 //
410 Interface = Config->Interfaces[Setting->Desc.InterfaceNumber];
411
412 if (Interface->NumOfSetting >= USB_MAX_INTERFACE_SETTING) {
413 goto ON_ERROR;
414 }
415
416 Interface->Settings[Interface->NumOfSetting] = Setting;
417 Interface->NumOfSetting++;
418
419 DescBuf += Consumed;
420 Len -= Consumed;
421 }
422
423 return Config;
424
425ON_ERROR:
426 UsbFreeConfigDesc (Config);
427 return NULL;
428}
429
452 IN USB_DEVICE *UsbDev,
453 IN EFI_USB_DATA_DIRECTION Direction,
454 IN UINTN Type,
455 IN UINTN Target,
456 IN UINTN Request,
457 IN UINT16 Value,
458 IN UINT16 Index,
459 IN OUT VOID *Buf,
460 IN UINTN Length
461 )
462{
464 EFI_STATUS Status;
465 UINT32 Result;
466 UINTN Len;
467
468 ASSERT ((UsbDev != NULL) && (UsbDev->Bus != NULL));
469
470 DevReq.RequestType = USB_REQUEST_TYPE (Direction, Type, Target);
471 DevReq.Request = (UINT8)Request;
472 DevReq.Value = Value;
473 DevReq.Index = Index;
474 DevReq.Length = (UINT16)Length;
475
476 Len = Length;
477 Status = UsbHcControlTransfer (
478 UsbDev->Bus,
479 UsbDev->Address,
480 UsbDev->Speed,
481 UsbDev->MaxPacket0,
482 &DevReq,
483 Direction,
484 Buf,
485 &Len,
486 USB_GENERAL_DEVICE_REQUEST_TIMEOUT,
487 &UsbDev->Translator,
488 &Result
489 );
490
491 return Status;
492}
493
511 IN USB_DEVICE *UsbDev,
512 IN UINTN DescType,
513 IN UINTN DescIndex,
514 IN UINT16 LangId,
515 OUT VOID *Buf,
516 IN UINTN Length
517 )
518{
519 EFI_STATUS Status;
520
521 Status = UsbCtrlRequest (
522 UsbDev,
523 EfiUsbDataIn,
524 USB_REQ_TYPE_STANDARD,
525 USB_TARGET_DEVICE,
526 USB_REQ_GET_DESCRIPTOR,
527 (UINT16)((DescType << 8) | DescIndex),
528 LangId,
529 Buf,
530 Length
531 );
532
533 return Status;
534}
535
549 IN USB_DEVICE *UsbDev
550 )
551{
553 EFI_STATUS Status;
554 UINTN Index;
555
556 //
557 // Get the first 8 bytes of the device descriptor which contains
558 // max packet size for endpoint 0, which is at least 8.
559 //
560 for (Index = 0; Index < 3; Index++) {
561 Status = UsbCtrlGetDesc (UsbDev, USB_DESC_TYPE_DEVICE, 0, 0, &DevDesc, 8);
562
563 if (!EFI_ERROR (Status)) {
564 if ((DevDesc.BcdUSB >= 0x0300) && (DevDesc.MaxPacketSize0 == 9)) {
565 UsbDev->MaxPacket0 = 1 << 9;
566 return EFI_SUCCESS;
567 }
568
569 UsbDev->MaxPacket0 = DevDesc.MaxPacketSize0;
570 return EFI_SUCCESS;
571 }
572
573 gBS->Stall (USB_RETRY_MAX_PACK_SIZE_STALL);
574 }
575
576 return EFI_DEVICE_ERROR;
577}
578
590 IN USB_DEVICE *UsbDev
591 )
592{
593 USB_DEVICE_DESC *DevDesc;
594 EFI_STATUS Status;
595
596 DevDesc = AllocateZeroPool (sizeof (USB_DEVICE_DESC));
597
598 if (DevDesc == NULL) {
599 return EFI_OUT_OF_RESOURCES;
600 }
601
602 Status = UsbCtrlGetDesc (
603 UsbDev,
604 USB_DESC_TYPE_DEVICE,
605 0,
606 0,
607 DevDesc,
609 );
610
611 if (EFI_ERROR (Status)) {
612 gBS->FreePool (DevDesc);
613 } else {
614 UsbDev->DevDesc = DevDesc;
615 }
616
617 return Status;
618}
619
634 IN USB_DEVICE *UsbDev,
635 IN UINT8 Index,
636 IN UINT16 LangId
637 )
638{
640 EFI_STATUS Status;
641 UINT8 *Buf;
642
643 //
644 // First get two bytes which contains the string length.
645 //
646 Status = UsbCtrlGetDesc (UsbDev, USB_DESC_TYPE_STRING, Index, LangId, &Desc, 2);
647
648 //
649 // Reject if Length even cannot cover itself, or odd because Unicode string byte length should be even.
650 //
651 if (EFI_ERROR (Status) ||
652 (Desc.Length < OFFSET_OF (EFI_USB_STRING_DESCRIPTOR, Length) + sizeof (Desc.Length)) ||
653 (Desc.Length % 2 != 0)
654 )
655 {
656 return NULL;
657 }
658
659 Buf = AllocateZeroPool (Desc.Length);
660
661 if (Buf == NULL) {
662 return NULL;
663 }
664
665 Status = UsbCtrlGetDesc (
666 UsbDev,
667 USB_DESC_TYPE_STRING,
668 Index,
669 LangId,
670 Buf,
671 Desc.Length
672 );
673
674 if (EFI_ERROR (Status)) {
675 FreePool (Buf);
676 return NULL;
677 }
678
679 return (EFI_USB_STRING_DESCRIPTOR *)Buf;
680}
681
692 IN USB_DEVICE *UsbDev
693 )
694{
696 EFI_STATUS Status;
697 UINTN Index;
698 UINTN Max;
699 UINT16 *Point;
700
701 //
702 // The string of language ID zero returns the supported languages
703 //
704 Desc = UsbGetOneString (UsbDev, 0, 0);
705
706 if (Desc == NULL) {
707 return EFI_UNSUPPORTED;
708 }
709
710 if (Desc->Length < 4) {
711 Status = EFI_UNSUPPORTED;
712 goto ON_EXIT;
713 }
714
715 Status = EFI_SUCCESS;
716
717 Max = (Desc->Length - 2) / 2;
718 Max = MIN (Max, USB_MAX_LANG_ID);
719
720 Point = Desc->String;
721 for (Index = 0; Index < Max; Index++) {
722 UsbDev->LangId[Index] = *Point;
723 Point++;
724 }
725
726 UsbDev->TotalLangId = (UINT16)Max;
727
728ON_EXIT:
729 gBS->FreePool (Desc);
730 return Status;
731}
732
747 IN USB_DEVICE *UsbDev,
748 IN UINT8 Index
749 )
750{
752 EFI_STATUS Status;
753 VOID *Buf;
754
755 //
756 // First get four bytes which contains the total length
757 // for this configuration.
758 //
759 Status = UsbCtrlGetDesc (UsbDev, USB_DESC_TYPE_CONFIG, Index, 0, &Desc, 8);
760
761 if (EFI_ERROR (Status)) {
762 DEBUG ((
763 DEBUG_ERROR,
764 "UsbGetOneConfig: failed to get descript length(%d) - %r\n",
765 Desc.TotalLength,
766 Status
767 ));
768
769 return NULL;
770 }
771
772 DEBUG ((DEBUG_INFO, "UsbGetOneConfig: total length is %d\n", Desc.TotalLength));
773
774 //
775 // Reject if TotalLength even cannot cover itself.
776 //
777 if (Desc.TotalLength < OFFSET_OF (EFI_USB_CONFIG_DESCRIPTOR, TotalLength) + sizeof (Desc.TotalLength)) {
778 return NULL;
779 }
780
781 Buf = AllocateZeroPool (Desc.TotalLength);
782
783 if (Buf == NULL) {
784 return NULL;
785 }
786
787 Status = UsbCtrlGetDesc (UsbDev, USB_DESC_TYPE_CONFIG, Index, 0, Buf, Desc.TotalLength);
788
789 if (EFI_ERROR (Status)) {
790 DEBUG ((DEBUG_ERROR, "UsbGetOneConfig: failed to get full descript - %r\n", Status));
791
792 FreePool (Buf);
793 return NULL;
794 }
795
796 return Buf;
797}
798
812 IN USB_DEVICE *UsbDev
813 )
814{
816 USB_DEVICE_DESC *DevDesc;
817 USB_CONFIG_DESC *ConfigDesc;
818 UINT8 NumConfig;
819 EFI_STATUS Status;
820 UINT8 Index;
821
822 //
823 // Get the device descriptor, then allocate the configure
824 // descriptor pointer array to hold configurations.
825 //
826 Status = UsbGetDevDesc (UsbDev);
827
828 if (EFI_ERROR (Status)) {
829 DEBUG ((DEBUG_ERROR, "UsbBuildDescTable: failed to get device descriptor - %r\n", Status));
830 return Status;
831 }
832
833 DevDesc = UsbDev->DevDesc;
834 NumConfig = DevDesc->Desc.NumConfigurations;
835 if (NumConfig == 0) {
836 return EFI_DEVICE_ERROR;
837 }
838
839 DevDesc->Configs = AllocateZeroPool (NumConfig * sizeof (USB_CONFIG_DESC *));
840 if (DevDesc->Configs == NULL) {
841 return EFI_OUT_OF_RESOURCES;
842 }
843
844 DEBUG ((DEBUG_INFO, "UsbBuildDescTable: device has %d configures\n", NumConfig));
845
846 //
847 // Read each configurations, then parse them
848 //
849 for (Index = 0; Index < NumConfig; Index++) {
850 Config = UsbGetOneConfig (UsbDev, Index);
851
852 if (Config == NULL) {
853 DEBUG ((DEBUG_ERROR, "UsbBuildDescTable: failed to get configure (index %d)\n", Index));
854
855 //
856 // If we can get the default descriptor, it is likely that the
857 // device is still operational.
858 //
859 if (Index == 0) {
860 return EFI_DEVICE_ERROR;
861 }
862
863 break;
864 }
865
866 ConfigDesc = UsbParseConfigDesc ((UINT8 *)Config, Config->TotalLength);
867
868 FreePool (Config);
869
870 if (ConfigDesc == NULL) {
871 DEBUG ((DEBUG_ERROR, "UsbBuildDescTable: failed to parse configure (index %d)\n", Index));
872
873 //
874 // If we can get the default descriptor, it is likely that the
875 // device is still operational.
876 //
877 if (Index == 0) {
878 return EFI_DEVICE_ERROR;
879 }
880
881 break;
882 }
883
884 DevDesc->Configs[Index] = ConfigDesc;
885 }
886
887 //
888 // Don't return error even this function failed because
889 // it is possible for the device to not support strings.
890 //
891 Status = UsbBuildLangTable (UsbDev);
892
893 if (EFI_ERROR (Status)) {
894 DEBUG ((DEBUG_INFO, "UsbBuildDescTable: get language ID table - %r\n", Status));
895 }
896
897 return EFI_SUCCESS;
898}
899
912 IN USB_DEVICE *UsbDev,
913 IN UINT8 Address
914 )
915{
916 EFI_STATUS Status;
917
918 Status = UsbCtrlRequest (
919 UsbDev,
920 EfiUsbNoData,
921 USB_REQ_TYPE_STANDARD,
922 USB_TARGET_DEVICE,
923 USB_REQ_SET_ADDRESS,
924 Address,
925 0,
926 NULL,
927 0
928 );
929
930 return Status;
931}
932
947 IN USB_DEVICE *UsbDev,
948 IN UINT8 ConfigIndex
949 )
950{
951 EFI_STATUS Status;
952
953 Status = UsbCtrlRequest (
954 UsbDev,
955 EfiUsbNoData,
956 USB_REQ_TYPE_STANDARD,
957 USB_TARGET_DEVICE,
958 USB_REQ_SET_CONFIG,
959 ConfigIndex,
960 0,
961 NULL,
962 0
963 );
964
965 return Status;
966}
967
984 IN EFI_USB_IO_PROTOCOL *UsbIo,
985 IN UINTN Target,
986 IN UINT16 Feature,
987 IN UINT16 Index
988 )
989{
991 UINT32 UsbResult;
992 EFI_STATUS Status;
993
994 DevReq.RequestType = USB_REQUEST_TYPE (EfiUsbNoData, USB_REQ_TYPE_STANDARD, Target);
995 DevReq.Request = USB_REQ_CLEAR_FEATURE;
996 DevReq.Value = Feature;
997 DevReq.Index = Index;
998 DevReq.Length = 0;
999
1000 Status = UsbIo->UsbControlTransfer (
1001 UsbIo,
1002 &DevReq,
1003 EfiUsbNoData,
1004 USB_CLEAR_FEATURE_REQUEST_TIMEOUT,
1005 NULL,
1006 0,
1007 &UsbResult
1008 );
1009
1010 return Status;
1011}
UINT64 UINTN
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define NULL
Definition: Base.h:319
#define MIN(a, b)
Definition: Base.h:1007
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
#define OFFSET_OF(TYPE, Field)
Definition: Base.h:758
#define OUT
Definition: Base.h:284
#define DEBUG(Expression)
Definition: DebugLib.h:434
EFI_USB_DATA_DIRECTION
Definition: UsbIo.h:44
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_BOOT_SERVICES * gBS
EFI_STATUS UsbIoClearFeature(IN EFI_USB_IO_PROTOCOL *UsbIo, IN UINTN Target, IN UINT16 Feature, IN UINT16 Index)
Definition: UsbDesc.c:983
VOID UsbFreeConfigDesc(IN USB_CONFIG_DESC *Config)
Definition: UsbDesc.c:57
VOID * UsbCreateDesc(IN UINT8 *DescBuf, IN UINTN Len, IN UINT8 Type, OUT UINTN *Consumed)
Definition: UsbDesc.c:132
VOID UsbFreeInterfaceDesc(IN USB_INTERFACE_SETTING *Setting)
Definition: UsbDesc.c:19
EFI_STATUS UsbBuildDescTable(IN USB_DEVICE *UsbDev)
Definition: UsbDesc.c:811
EFI_USB_CONFIG_DESCRIPTOR * UsbGetOneConfig(IN USB_DEVICE *UsbDev, IN UINT8 Index)
Definition: UsbDesc.c:746
EFI_STATUS UsbBuildLangTable(IN USB_DEVICE *UsbDev)
Definition: UsbDesc.c:691
EFI_USB_STRING_DESCRIPTOR * UsbGetOneString(IN USB_DEVICE *UsbDev, IN UINT8 Index, IN UINT16 LangId)
Definition: UsbDesc.c:633
EFI_STATUS UsbGetDevDesc(IN USB_DEVICE *UsbDev)
Definition: UsbDesc.c:589
EFI_STATUS UsbSetConfig(IN USB_DEVICE *UsbDev, IN UINT8 ConfigIndex)
Definition: UsbDesc.c:946
EFI_STATUS UsbSetAddress(IN USB_DEVICE *UsbDev, IN UINT8 Address)
Definition: UsbDesc.c:911
EFI_STATUS UsbCtrlRequest(IN USB_DEVICE *UsbDev, IN EFI_USB_DATA_DIRECTION Direction, IN UINTN Type, IN UINTN Target, IN UINTN Request, IN UINT16 Value, IN UINT16 Index, IN OUT VOID *Buf, IN UINTN Length)
Definition: UsbDesc.c:451
USB_INTERFACE_SETTING * UsbParseInterfaceDesc(IN UINT8 *DescBuf, IN UINTN Len, OUT UINTN *Consumed)
Definition: UsbDesc.c:252
EFI_STATUS UsbGetMaxPacketSize0(IN USB_DEVICE *UsbDev)
Definition: UsbDesc.c:548
EFI_STATUS UsbCtrlGetDesc(IN USB_DEVICE *UsbDev, IN UINTN DescType, IN UINTN DescIndex, IN UINT16 LangId, OUT VOID *Buf, IN UINTN Length)
Definition: UsbDesc.c:510
USB_CONFIG_DESC * UsbParseConfigDesc(IN UINT8 *DescBuf, IN UINTN Len)
Definition: UsbDesc.c:332
VOID UsbFreeDevDesc(IN USB_DEVICE_DESC *DevDesc)
Definition: UsbDesc.c:101
EFI_STATUS UsbHcControlTransfer(IN USB_BUS *UsbBus, IN UINT8 DevAddr, IN UINT8 DevSpeed, IN UINTN MaxPacket, IN EFI_USB_DEVICE_REQUEST *Request, IN EFI_USB_DATA_DIRECTION Direction, IN OUT VOID *Data, IN OUT UINTN *DataLength, IN UINTN TimeOut, IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator, OUT UINT32 *UsbResult)
Definition: UsbUtility.c:190