@@ -98,13 +98,11 @@ OhciReset (
9898 Ohc = USB_OHCI_HC_DEV_FROM_THIS (This );
9999
100100 if ((Attributes & EFI_USB_HC_RESET_HOST_CONTROLLER ) != 0 ) {
101- gBS -> Stall (50 * 1000 );
102101 Status = OhciSetHcCommandStatus (Ohc , HC_RESET , HC_RESET );
103102 if (EFI_ERROR (Status )) {
104103 return EFI_DEVICE_ERROR ;
105104 }
106105
107- gBS -> Stall (50 * 1000 );
108106 //
109107 // Wait for host controller reset.
110108 //
@@ -159,11 +157,8 @@ OhciReset (
159157 OhciGetCapability (This , NULL , & NumOfPorts , NULL );
160158 for (Index = 0 ; Index < NumOfPorts ; Index ++ ) {
161159 if (!EFI_ERROR (OhciSetRootHubPortFeature (This , Index , EfiUsbPortReset ))) {
162- gBS -> Stall (200 * 1000 );
163160 OhciClearRootHubPortFeature (This , Index , EfiUsbPortReset );
164- gBS -> Stall (1000 );
165161 OhciSetRootHubPortFeature (This , Index , EfiUsbPortEnable );
166- gBS -> Stall (1000 );
167162 }
168163 }
169164
@@ -172,7 +167,7 @@ OhciReset (
172167 OhciSetMemoryPointer (Ohc , HC_BULK_HEAD , NULL );
173168 OhciSetHcControl (Ohc , PERIODIC_ENABLE | CONTROL_ENABLE | BULK_ENABLE , 1 ); /*ISOCHRONOUS_ENABLE*/
174169 OhciSetHcControl (Ohc , HC_FUNCTIONAL_STATE , HC_STATE_OPERATIONAL );
175- gBS -> Stall ( 50 * 1000 );
170+
176171 //
177172 // Wait till first SOF occurs, and then clear it
178173 //
@@ -403,8 +398,6 @@ OhciControlTransfer (
403398 return EFI_DEVICE_ERROR ;
404399 }
405400
406- gBS -> Stall (20 * 1000 );
407-
408401 OhciSetMemoryPointer (Ohc , HC_CONTROL_HEAD , NULL );
409402 Ed = OhciCreateED (Ohc );
410403 if (Ed == NULL ) {
@@ -587,8 +580,6 @@ OhciControlTransfer (
587580 goto UNMAP_DATA_BUFF ;
588581 }
589582
590- gBS -> Stall (20 * 1000 );
591-
592583 TimeCount = 0 ;
593584 Status = CheckIfDone (Ohc , CONTROL_LIST , Ed , HeadTd , & EdResult );
594585
@@ -614,7 +605,7 @@ OhciControlTransfer (
614605
615606 * DataLength = 0 ;
616607 } else {
617- DEBUG ((DEBUG_INFO , "Control transfer successed\r\n" ));
608+ DEBUG ((DEBUG_VERBOSE , "Control transfer successed\r\n" ));
618609 }
619610
620611UNMAP_DATA_BUFF :
@@ -763,8 +754,6 @@ OhciBulkTransfer (
763754 return EFI_DEVICE_ERROR ;
764755 }
765756
766- gBS -> Stall (20 * 1000 );
767-
768757 OhciSetMemoryPointer (Ohc , HC_BULK_HEAD , NULL );
769758
770759 Ed = OhciCreateED (Ohc );
@@ -885,8 +874,6 @@ OhciBulkTransfer (
885874 goto FREE_OHCI_TDBUFF ;
886875 }
887876
888- gBS -> Stall (20 * 1000 );
889-
890877 TimeCount = 0 ;
891878 Status = CheckIfDone (Ohc , BULK_LIST , Ed , HeadTd , & EdResult );
892879 while (Status == EFI_NOT_READY && TimeCount <= TimeOut ) {
@@ -907,7 +894,7 @@ OhciBulkTransfer (
907894
908895 * DataLength = 0 ;
909896 } else {
910- DEBUG ((DEBUG_INFO , "Bulk transfer successed\r\n" ));
897+ DEBUG ((DEBUG_VERBOSE , "Bulk transfer successed\r\n" ));
911898 }
912899
913900 // *DataToggle = (UINT8) OhciGetEDField (Ed, ED_DTTOGGLE);
@@ -2033,88 +2020,10 @@ OhcInitHC (
20332020 IN USB_OHCI_HC_DEV * Ohc
20342021 )
20352022{
2036- EFI_STATUS Status ;
2037- UINT8 Index ;
2038- UINT8 NumOfPorts ;
2039- UINT32 PowerOnGoodTime ;
2040- UINT32 Data32 ;
2041- BOOLEAN Flag = FALSE;
2042-
2043- Status = OhciSetHcCommandStatus (Ohc , HC_RESET , HC_RESET );
2044- if (EFI_ERROR (Status )) {
2045- return EFI_DEVICE_ERROR ;
2046- }
2047-
2048- gBS -> Stall (50 * 1000 );
2049- //
2050- // Wait for host controller reset.
2051- //
2052- PowerOnGoodTime = 50 ;
2053- do {
2054- gBS -> Stall (1000 );
2055- Data32 = OhciGetOperationalReg (Ohc , HC_COMMAND_STATUS );
2056- if ((Data32 & HC_RESET ) == 0 ) {
2057- Flag = TRUE;
2058- break ;
2059- }
2060- } while (PowerOnGoodTime -- );
2061-
2062- if (!Flag ) {
2063- return EFI_DEVICE_ERROR ;
2064- }
2065-
2066- OhciInitializeInterruptList (Ohc );
2067-
2068- OhciSetFrameInterval (Ohc , FRAME_INTERVAL , 0x2edf );
2069- Status = OhciSetHcControl (Ohc , HC_FUNCTIONAL_STATE , HC_STATE_RESET );
2070- if (EFI_ERROR (Status )) {
2071- return EFI_DEVICE_ERROR ;
2072- }
2073-
2074- gBS -> Stall (50 * 1000 );
2075- //
2076- // Initialize host controller operational registers
2077- //
2078- OhciSetFrameInterval (Ohc , FS_LARGEST_DATA_PACKET , 0x2778 );
2079- OhciSetFrameInterval (Ohc , FRAME_INTERVAL , 0x2edf );
2080- OhciSetPeriodicStart (Ohc , 0x2a2f );
2081- OhciSetHcControl (Ohc , CONTROL_BULK_RATIO , 0x3 );
2082- OhciSetHcCommandStatus (Ohc , CONTROL_LIST_FILLED | BULK_LIST_FILLED , 0 );
2083- OhciSetRootHubDescriptor (Ohc , RH_PSWITCH_MODE , 0 );
2084- OhciSetRootHubDescriptor (Ohc , RH_NO_PSWITCH | RH_NOC_PROT , 1 );
2085-
2086- OhciSetRootHubDescriptor (Ohc , RH_DEV_REMOVABLE , 0 );
2087- OhciSetRootHubDescriptor (Ohc , RH_PORT_PWR_CTRL_MASK , 0xffff );
2088- OhciSetRootHubStatus (Ohc , RH_LOCAL_PSTAT_CHANGE );
2089- OhciSetRootHubPortStatus (Ohc , 0 , RH_SET_PORT_POWER );
2090- OhciGetCapability (& Ohc -> Usb2Hc , NULL , & NumOfPorts , NULL );
2091-
2092- for (Index = 0 ; Index < NumOfPorts ; Index ++ ) {
2093- if (!EFI_ERROR (OhciSetRootHubPortFeature (& Ohc -> Usb2Hc , Index , EfiUsbPortReset ))) {
2094- gBS -> Stall (200 * 1000 );
2095- OhciClearRootHubPortFeature (& Ohc -> Usb2Hc , Index , EfiUsbPortReset );
2096- gBS -> Stall (1000 );
2097- OhciSetRootHubPortFeature (& Ohc -> Usb2Hc , Index , EfiUsbPortEnable );
2098- gBS -> Stall (1000 );
2099- }
2100- }
2101-
2102- OhciSetMemoryPointer (Ohc , HC_HCCA , Ohc -> HccaMemoryBlock );
2103- OhciSetMemoryPointer (Ohc , HC_CONTROL_HEAD , NULL );
2104- OhciSetMemoryPointer (Ohc , HC_BULK_HEAD , NULL );
2105- OhciSetHcControl (Ohc , PERIODIC_ENABLE | CONTROL_ENABLE | BULK_ENABLE , 1 );
2106- OhciSetHcControl (Ohc , HC_FUNCTIONAL_STATE , HC_STATE_OPERATIONAL );
2107-
2108- //
2109- // Wait till first SOF occurs, and then clear it
2110- //
2111- while (OhciGetHcInterruptStatus (Ohc , START_OF_FRAME ) == 0 ) {
2112- }
2113-
2114- OhciClearInterruptStatus (Ohc , START_OF_FRAME );
2115- gBS -> Stall (1000 );
2116-
2117- return EFI_SUCCESS ;
2023+ return OhciReset (
2024+ & Ohc -> Usb2Hc ,
2025+ EFI_USB_HC_RESET_GLOBAL | EFI_USB_HC_RESET_HOST_CONTROLLER
2026+ );
21182027}
21192028
21202029/**
0 commit comments