Changeset 104276 in vbox for trunk/src/VBox/Devices/USB
- Timestamp:
- Apr 10, 2024 1:29:23 PM (8 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/USB/DevOHCI.cpp
r104250 r104276 693 693 /** RD - Resume detect. */ 694 694 #define OHCI_INTR_RESUME_DETECT RT_BIT(3) 695 /** UE - Unrecoverable error. */695 /** UE - ",erable error. */ 696 696 #define OHCI_INTR_UNRECOVERABLE_ERROR RT_BIT(4) 697 697 /** FNO - Frame number overflow. */ … … 2028 2028 } 2029 2029 2030 #if 0 2030 2031 /** 2031 2032 * Returns a URB associated with an in-flight TD, if any. … … 2045 2046 return NULL; 2046 2047 } 2048 #endif 2047 2049 2048 2050 /** … … 3078 3080 ohciR3Unlock(pThisCC); 3079 3081 return fRetire; 3082 } 3083 3084 3085 /** 3086 * Determine transfer direction from an endpoint descriptor. 3087 * NB: This may fail if the direction is not valid. If it does fail, 3088 * we do not raise an unrecoverable error but the caller may wish to. 3089 */ 3090 static bool ohciR3GetDirection(PPDMDEVINS pDevIns, POHCI pThis, POHCICC pThisCC, PCOHCIED pEd, VUSBDIRECTION *pEnmDir) 3091 { 3092 RT_NOREF(pThisCC); 3093 RT_NOREF(pThis); 3094 VUSBDIRECTION enmDir = VUSBDIRECTION_INVALID; 3095 3096 if (pEd->hwinfo & ED_HWINFO_ISO) 3097 { 3098 switch (pEd->hwinfo & ED_HWINFO_DIR) 3099 { 3100 case ED_HWINFO_OUT: enmDir = VUSBDIRECTION_OUT; break; 3101 case ED_HWINFO_IN: enmDir = VUSBDIRECTION_IN; break; 3102 default: 3103 Log(("ohciR3GetDirection: Invalid direction!!!! Ed.hwinfo=%#x\n", pEd->hwinfo)); 3104 *pEnmDir = VUSBDIRECTION_INVALID; 3105 return false; 3106 } 3107 } 3108 else 3109 { 3110 switch (pEd->hwinfo & ED_HWINFO_DIR) 3111 { 3112 case ED_HWINFO_OUT: enmDir = VUSBDIRECTION_OUT; break; 3113 case ED_HWINFO_IN: enmDir = VUSBDIRECTION_IN; break; 3114 default: 3115 /* We must read the TD to determine direction. */ 3116 uint32_t TdAddr = pEd->HeadP & ED_PTR_MASK; 3117 OHCITD Td; 3118 ohciR3ReadTd(pDevIns, TdAddr, &Td); 3119 switch (Td.hwinfo & TD_HWINFO_DIR) 3120 { 3121 case TD_HWINFO_OUT: enmDir = VUSBDIRECTION_OUT; break; 3122 case TD_HWINFO_IN: enmDir = VUSBDIRECTION_IN; break; 3123 case 0: enmDir = VUSBDIRECTION_SETUP; break; 3124 default: 3125 Log(("ohciR3GetDirection: Invalid direction!!!! Td.hwinfo=%#x Ed.hwinfo=%#x\n", Td.hwinfo, pEd->hwinfo)); 3126 *pEnmDir = VUSBDIRECTION_INVALID; 3127 return false; 3128 } 3129 } 3130 } 3131 3132 *pEnmDir = enmDir; 3133 return true; 3080 3134 } 3081 3135 … … 3834 3888 * cancel outstanding URBs, if any. 3835 3889 */ 3836 uint32_t TdAddr = Ed.HeadP & ED_PTR_MASK; 3837 PVUSBURB pUrb = ohciR3TdInFlightUrb(pThisCC, TdAddr); 3838 if (pUrb) 3839 pThisCC->RootHub.pIRhConn->pfnCancelUrbsEp(pThisCC->RootHub.pIRhConn, pUrb); 3890 uint8_t uAddr = Ed.hwinfo & ED_HWINFO_FUNCTION; 3891 uint8_t uEndPt = (Ed.hwinfo & ED_HWINFO_ENDPOINT) >> ED_HWINFO_ENDPOINT_SHIFT; 3892 VUSBDIRECTION enmDir; 3893 if (ohciR3GetDirection(pDevIns, pThis, pThisCC, &Ed, &enmDir)) 3894 { 3895 pThisCC->RootHub.pIRhConn->pfnAbortEpByAddr(pThisCC->RootHub.pIRhConn, uAddr, uEndPt, enmDir); 3896 } 3840 3897 } 3841 3898 } … … 3890 3947 { 3891 3948 LogFlow(("ohciR3UndoBulkList: Ed=%#010RX32 Ed.TailP=%#010RX32 UNDO\n", EdAddr, Ed.TailP)); 3892 PVUSBURB pUrb = ohciR3TdInFlightUrb(pThisCC, TdAddr); 3893 if (pUrb) 3894 pThisCC->RootHub.pIRhConn->pfnCancelUrbsEp(pThisCC->RootHub.pIRhConn, pUrb); 3949 /* First we need to determine the transfer direction, which may fail(!). */ 3950 uint8_t uAddr = Ed.hwinfo & ED_HWINFO_FUNCTION; 3951 uint8_t uEndPt = (Ed.hwinfo & ED_HWINFO_ENDPOINT) >> ED_HWINFO_ENDPOINT_SHIFT; 3952 VUSBDIRECTION enmDir; 3953 if (ohciR3GetDirection(pDevIns, pThis, pThisCC, &Ed, &enmDir)) 3954 { 3955 pThisCC->RootHub.pIRhConn->pfnAbortEpByAddr(pThisCC->RootHub.pIRhConn, uAddr, uEndPt, enmDir); 3956 } 3895 3957 } 3896 3958 } … … 4054 4116 /* If the ED is in 'skip' state, no transactions on it are allowed and we must 4055 4117 * cancel outstanding URBs, if any. 4118 * First we need to determine the transfer direction, which may fail(!). 4056 4119 */ 4057 uint32_t TdAddr = Ed.HeadP & ED_PTR_MASK; 4058 PVUSBURB pUrb = ohciR3TdInFlightUrb(pThisCC, TdAddr); 4059 if (pUrb) 4060 pThisCC->RootHub.pIRhConn->pfnCancelUrbsEp(pThisCC->RootHub.pIRhConn, pUrb); 4120 uint8_t uAddr = Ed.hwinfo & ED_HWINFO_FUNCTION; 4121 uint8_t uEndPt = (Ed.hwinfo & ED_HWINFO_ENDPOINT) >> ED_HWINFO_ENDPOINT_SHIFT; 4122 VUSBDIRECTION enmDir; 4123 if (ohciR3GetDirection(pDevIns, pThis, pThisCC, &Ed, &enmDir)) 4124 { 4125 pThisCC->RootHub.pIRhConn->pfnAbortEpByAddr(pThisCC->RootHub.pIRhConn, uAddr, uEndPt, enmDir); 4126 } 4061 4127 } 4062 4128 }
Note:
See TracChangeset
for help on using the changeset viewer.