36 END_ENTIRE_DEVICE_PATH_SUBTYPE,
38 END_DEVICE_PATH_LENGTH,
61 OUT UINT8 *Is64BitCapable
66 if (UsbBus->Usb2Hc !=
NULL) {
67 Status = UsbBus->Usb2Hc->GetCapability (
74 Status = UsbBus->UsbHc->GetRootHubPortNumber (UsbBus->UsbHc, NumOfPort);
76 *MaxSpeed = EFI_USB_SPEED_FULL;
77 *Is64BitCapable = (UINT8)
FALSE;
103 if (UsbBus->Usb2Hc !=
NULL) {
104 Status = UsbBus->Usb2Hc->GetRootHubPortStatus (UsbBus->Usb2Hc, PortIndex, PortStatus);
106 Status = UsbBus->UsbHc->GetRootHubPortStatus (UsbBus->UsbHc, PortIndex, PortStatus);
132 if (UsbBus->Usb2Hc !=
NULL) {
133 Status = UsbBus->Usb2Hc->SetRootHubPortFeature (UsbBus->Usb2Hc, PortIndex, Feature);
135 Status = UsbBus->UsbHc->SetRootHubPortFeature (UsbBus->UsbHc, PortIndex, Feature);
161 if (UsbBus->Usb2Hc !=
NULL) {
162 Status = UsbBus->Usb2Hc->ClearRootHubPortFeature (UsbBus->Usb2Hc, PortIndex, Feature);
164 Status = UsbBus->UsbHc->ClearRootHubPortFeature (UsbBus->UsbHc, PortIndex, Feature);
201 OUT UINT32 *UsbResult
205 BOOLEAN IsSlowDevice;
207 if (UsbBus->Usb2Hc !=
NULL) {
208 Status = UsbBus->Usb2Hc->ControlTransfer (
222 IsSlowDevice = (BOOLEAN)(EFI_USB_SPEED_LOW == DevSpeed);
223 Status = UsbBus->UsbHc->ControlTransfer (
272 IN OUT UINT8 *DataToggle,
275 OUT UINT32 *UsbResult
280 if (UsbBus->Usb2Hc !=
NULL) {
281 Status = UsbBus->Usb2Hc->BulkTransfer (
296 Status = UsbBus->UsbHc->BulkTransfer (
341 IN BOOLEAN IsNewTransfer,
342 IN OUT UINT8 *DataToggle,
347 IN VOID *Context OPTIONAL
351 BOOLEAN IsSlowDevice;
353 if (UsbBus->Usb2Hc !=
NULL) {
354 Status = UsbBus->Usb2Hc->AsyncInterruptTransfer (
369 IsSlowDevice = (BOOLEAN)(EFI_USB_SPEED_LOW == DevSpeed);
371 Status = UsbBus->UsbHc->AsyncInterruptTransfer (
419 IN OUT UINT8 *DataToggle,
422 OUT UINT32 *UsbResult
426 BOOLEAN IsSlowDevice;
428 if (UsbBus->Usb2Hc !=
NULL) {
429 Status = UsbBus->Usb2Hc->SyncInterruptTransfer (
443 IsSlowDevice = (BOOLEAN)((EFI_USB_SPEED_LOW == DevSpeed) ?
TRUE :
FALSE);
444 Status = UsbBus->UsbHc->SyncInterruptTransfer (
480 if (Bus->Usb2Hc !=
NULL) {
481 Status =
gBS->OpenProtocol (
483 &gEfiUsb2HcProtocolGuid,
487 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
490 Status =
gBS->OpenProtocol (
492 &gEfiUsbHcProtocolGuid,
496 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
516 if (Bus->Usb2Hc !=
NULL) {
519 &gEfiUsb2HcProtocolGuid,
526 &gEfiUsbHcProtocolGuid,
548 Tpl =
gBS->RaiseTPL (TPL_HIGH_LEVEL);
549 gBS->RestoreTPL (Tpl);
576 UsbDevicePathBeginPtr = DevicePath;
590 UsbDevicePathEndPtr = UsbDevicePathBeginPtr;
614 ASSERT (UsbDevicePathPtr !=
NULL);
615 CopyMem (UsbDevicePathPtr, UsbDevicePathBeginPtr, Size);
621 return UsbDevicePathPtr;
644 UINTN UsbDpDevicePathSize;
649 if ((UsbIoDPList ==
NULL) || (UsbDP ==
NULL)) {
654 ListIndex = UsbIoDPList->ForwardLink;
655 while (ListIndex != UsbIoDPList) {
660 ASSERT (ListItem->DevicePath !=
NULL);
664 if ((
CompareMem (UsbDP, ListItem->DevicePath, UsbDpDevicePathSize)) == 0) {
670 ListIndex = ListIndex->ForwardLink;
698 if ((UsbIoDPList ==
NULL) || (UsbDP ==
NULL)) {
699 return EFI_INVALID_PARAMETER;
710 ASSERT (ListItem !=
NULL);
711 ListItem->Signature = DEVICE_PATH_LIST_ITEM_SIGNATURE;
748 IfDesc = UsbIf->IfDesc;
749 ASSERT (IfDesc->ActiveIndex < USB_MAX_INTERFACE_SETTING);
750 ActIfDesc = &(IfDesc->Settings[IfDesc->ActiveIndex]->Desc);
751 DevDesc = &(UsbIf->Device->DevDesc->Desc);
759 if ((ActIfDesc->InterfaceClass == USB_HUB_CLASS_CODE) &&
760 (ActIfDesc->InterfaceSubClass == USB_HUB_SUBCLASS_CODE))
768 if (((UsbClassDevicePathPtr->VendorId == 0xffff) || (UsbClassDevicePathPtr->VendorId == DevDesc->IdVendor)) &&
769 ((UsbClassDevicePathPtr->ProductId == 0xffff) || (UsbClassDevicePathPtr->ProductId == DevDesc->IdProduct)))
774 if (DevDesc->DeviceClass == 0) {
775 if (((UsbClassDevicePathPtr->DeviceClass == ActIfDesc->InterfaceClass) ||
776 (UsbClassDevicePathPtr->DeviceClass == 0xff)) &&
777 ((UsbClassDevicePathPtr->DeviceSubClass == ActIfDesc->InterfaceSubClass) ||
778 (UsbClassDevicePathPtr->DeviceSubClass == 0xff)) &&
779 ((UsbClassDevicePathPtr->DeviceProtocol == ActIfDesc->InterfaceProtocol) ||
780 (UsbClassDevicePathPtr->DeviceProtocol == 0xff)))
784 }
else if (((UsbClassDevicePathPtr->DeviceClass == DevDesc->DeviceClass) ||
785 (UsbClassDevicePathPtr->DeviceClass == 0xff)) &&
786 ((UsbClassDevicePathPtr->DeviceSubClass == DevDesc->DeviceSubClass) ||
787 (UsbClassDevicePathPtr->DeviceSubClass == 0xff)) &&
788 ((UsbClassDevicePathPtr->DeviceProtocol == DevDesc->DeviceProtocol) ||
789 (UsbClassDevicePathPtr->DeviceProtocol == 0xff)))
831 IfDesc = UsbIf->IfDesc;
832 ASSERT (IfDesc->ActiveIndex < USB_MAX_INTERFACE_SETTING);
833 ActIfDesc = &(IfDesc->Settings[IfDesc->ActiveIndex]->Desc);
834 DevDesc = &(UsbIf->Device->DevDesc->Desc);
839 if ((ActIfDesc->InterfaceClass == USB_HUB_CLASS_CODE) &&
840 (ActIfDesc->InterfaceSubClass == USB_HUB_SUBCLASS_CODE))
848 if ((DevDesc->IdVendor != UsbWWIDDevicePathPtr->VendorId) ||
849 (DevDesc->IdProduct != UsbWWIDDevicePathPtr->ProductId) ||
850 (ActIfDesc->InterfaceNumber != UsbWWIDDevicePathPtr->InterfaceNumber))
858 if (DevDesc->StrSerialNumber == 0) {
865 CompareStr = (CHAR16 *)(
UINTN)(UsbWWIDDevicePathPtr + 1);
867 if (CompareStr[CompareLen - 1] == L
'\0') {
874 for (Index = 0; Index < UsbIf->Device->TotalLangId; Index++) {
875 StrDesc =
UsbGetOneString (UsbIf->Device, DevDesc->StrSerialNumber, UsbIf->Device->LangId[Index]);
876 if (StrDesc ==
NULL) {
880 Length = (StrDesc->Length - 2) /
sizeof (CHAR16);
881 if ((Length >= CompareLen) &&
882 (
CompareMem (StrDesc->String + Length - CompareLen, CompareStr, CompareLen * sizeof (CHAR16)) == 0))
912 if (UsbIoDPList ==
NULL) {
913 return EFI_INVALID_PARAMETER;
916 ListIndex = UsbIoDPList->ForwardLink;
917 while (ListIndex != UsbIoDPList) {
922 if (ListItem->DevicePath !=
NULL) {
929 ListIndex = ListIndex->ForwardLink;
965 ( (RemainingDevicePath->SubType !=
MSG_USB_DP) &&
970 return EFI_INVALID_PARAMETER;
974 if (UsbBusId ==
NULL) {
975 return EFI_INVALID_PARAMETER;
978 Bus = USB_BUS_FROM_THIS (UsbBusId);
980 if (RemainingDevicePath ==
NULL) {
987 ASSERT (!EFI_ERROR (Status));
1003 ASSERT (DevicePathPtr !=
NULL);
1004 Status =
AddUsbDPToList (DevicePathPtr, &Bus->WantedUsbIoDPList);
1005 ASSERT (!EFI_ERROR (Status));
1032 UINTN FirstDevicePathSize;
1037 if ((UsbIf ==
NULL) || (Bus ==
NULL)) {
1058 WantedUsbIoDPListPtr = &Bus->WantedUsbIoDPList;
1063 ASSERT (DevicePathPtr !=
NULL);
1066 WantedListIndex = WantedUsbIoDPListPtr->ForwardLink;
1067 while (WantedListIndex != WantedUsbIoDPListPtr) {
1070 switch (WantedListItem->DevicePath->
SubType) {
1075 WantedListItem->DevicePath,
1107 WantedListIndex = WantedListIndex->ForwardLink;
1110 gBS->FreePool (DevicePathPtr);
1143 UINTN UsbIoHandleCount;
1147 if (UsbBusId ==
NULL) {
1148 return EFI_INVALID_PARAMETER;
1151 Bus = USB_BUS_FROM_THIS (UsbBusId);
1156 UsbIoHandleCount = 0;
1157 Status =
gBS->LocateHandleBuffer (
ByProtocol, &gEfiUsbIoProtocolGuid,
NULL, &UsbIoHandleCount, &UsbIoBuffer);
1158 if ((Status == EFI_NOT_FOUND) || (UsbIoHandleCount == 0)) {
1162 ASSERT (!EFI_ERROR (Status));
1164 for (Index = 0; Index < UsbIoHandleCount; Index++) {
1169 UsbIoDevicePath =
NULL;
1170 Status =
gBS->HandleProtocol (UsbIoBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID *)&UsbIoDevicePath);
1171 if (EFI_ERROR (Status) || (UsbIoDevicePath ==
NULL)) {
1187 Status =
gBS->HandleProtocol (
1189 &gEfiUsbIoProtocolGuid,
1192 if (EFI_ERROR (Status)) {
1196 UsbIf = USB_INTERFACE_FROM_USBIO (UsbIo);
1199 if (!UsbIf->IsManaged) {
1203 DEBUG ((DEBUG_INFO,
"UsbBusRecursivelyConnectWantedUsbIo: TPL before connect is %d\n", (UINT32)
UsbGetCurrentTpl ()));
1205 UsbIf->IsManaged = (BOOLEAN) !EFI_ERROR (Status);
1206 DEBUG ((DEBUG_INFO,
"UsbBusRecursivelyConnectWantedUsbIo: TPL after connect is %d\n", (UINT32)
UsbGetCurrentTpl ()));
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
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)
NODE Child(IN NODE LoopVar6, IN UINT8 LoopVar5)
#define MESSAGING_DEVICE_PATH
UINTN EFIAPI DevicePathNodeLength(IN CONST VOID *Node)
BOOLEAN EFIAPI IsDevicePathEnd(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI NextDevicePathNode(IN CONST VOID *Node)
UINTN EFIAPI GetDevicePathSize(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI DuplicateDevicePath(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
VOID EFIAPI SetDevicePathEndNode(OUT VOID *Node)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define DEBUG(Expression)
#define CR(Record, TYPE, Field, TestSignature)
EFI_STATUS(EFIAPI * EFI_ASYNC_USB_TRANSFER_CALLBACK)(IN VOID *Data, IN UINTN DataLength, IN VOID *Context, IN UINT32 Status)
EFI_USB_STRING_DESCRIPTOR * UsbGetOneString(IN USB_DEVICE *UsbDev, IN UINT8 Index, IN UINT16 LangId)
EFI_STATUS UsbHcSyncInterruptTransfer(IN USB_BUS *UsbBus, IN UINT8 DevAddr, IN UINT8 EpAddr, IN UINT8 DevSpeed, IN UINTN MaxPacket, IN OUT VOID *Data, IN OUT UINTN *DataLength, IN OUT UINT8 *DataToggle, IN UINTN TimeOut, IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator, OUT UINT32 *UsbResult)
EFI_STATUS UsbHcGetRootHubPortStatus(IN USB_BUS *UsbBus, IN UINT8 PortIndex, OUT EFI_USB_PORT_STATUS *PortStatus)
EFI_STATUS UsbOpenHostProtoByChild(IN USB_BUS *Bus, IN EFI_HANDLE Child)
BOOLEAN MatchUsbWwid(IN USB_WWID_DEVICE_PATH *UsbWWIDDevicePathPtr, IN USB_INTERFACE *UsbIf)
EFI_TPL UsbGetCurrentTpl(VOID)
EFI_STATUS EFIAPI UsbBusAddWantedUsbIoDP(IN EFI_USB_BUS_PROTOCOL *UsbBusId, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
EFI_STATUS EFIAPI AddUsbDPToList(IN EFI_DEVICE_PATH_PROTOCOL *UsbDP, IN LIST_ENTRY *UsbIoDPList)
EFI_STATUS UsbHcClearRootHubPortFeature(IN USB_BUS *UsbBus, IN UINT8 PortIndex, IN EFI_USB_PORT_FEATURE Feature)
EFI_STATUS UsbHcAsyncInterruptTransfer(IN USB_BUS *UsbBus, IN UINT8 DevAddr, IN UINT8 EpAddr, IN UINT8 DevSpeed, IN UINTN MaxPacket, IN BOOLEAN IsNewTransfer, IN OUT UINT8 *DataToggle, IN UINTN PollingInterval, IN UINTN DataLength, IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator, IN EFI_ASYNC_USB_TRANSFER_CALLBACK Callback, IN VOID *Context OPTIONAL)
EFI_STATUS UsbHcSetRootHubPortFeature(IN USB_BUS *UsbBus, IN UINT8 PortIndex, IN EFI_USB_PORT_FEATURE Feature)
BOOLEAN EFIAPI MatchUsbClass(IN USB_CLASS_DEVICE_PATH *UsbClassDevicePathPtr, IN USB_INTERFACE *UsbIf)
EFI_STATUS UsbHcBulkTransfer(IN USB_BUS *UsbBus, IN UINT8 DevAddr, IN UINT8 EpAddr, IN UINT8 DevSpeed, IN UINTN MaxPacket, IN UINT8 BufferNum, IN OUT VOID *Data[], IN OUT UINTN *DataLength, IN OUT UINT8 *DataToggle, IN UINTN TimeOut, IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator, OUT UINT32 *UsbResult)
BOOLEAN EFIAPI SearchUsbDPInList(IN EFI_DEVICE_PATH_PROTOCOL *UsbDP, IN LIST_ENTRY *UsbIoDPList)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI GetUsbDPFromFullDP(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS EFIAPI UsbBusFreeUsbDPList(IN LIST_ENTRY *UsbIoDPList)
BOOLEAN EFIAPI UsbBusIsWantedUsbIO(IN USB_BUS *Bus, IN USB_INTERFACE *UsbIf)
VOID UsbCloseHostProtoByChild(IN USB_BUS *Bus, IN EFI_HANDLE Child)
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)
EFI_STATUS EFIAPI UsbBusRecursivelyConnectWantedUsbIo(IN EFI_USB_BUS_PROTOCOL *UsbBusId)
EFI_STATUS UsbHcGetCapability(IN USB_BUS *UsbBus, OUT UINT8 *MaxSpeed, OUT UINT8 *NumOfPort, OUT UINT8 *Is64BitCapable)
EFI_HANDLE DriverBindingHandle