- Timestamp:
- May 16, 2019 2:38:19 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 130596
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/USB/DevOHCI.cpp
r78530 r78549 2095 2095 * Sets up a OHCI transport buffer. 2096 2096 * 2097 * @returns Flags whether the buffer could be initialised successfully. 2098 * @param pThis The OHCI instance. 2099 * @param pBuf Ohci buffer. 2097 * @param pBuf OHCI buffer. 2100 2098 * @param cbp Current buffer pointer. 32-bit physical address. 2101 2099 * @param be Last byte in buffer (BufferEnd). 32-bit physical address. 2102 2100 */ 2103 static bool ohciR3BufInit(POHCI pThis, POHCIBUF pBuf, uint32_t cbp, uint32_t be) 2104 { 2105 if (RT_UNLIKELY(be < cbp)) 2106 { 2107 LogRelMax(10, ("OHCI#%d: cbp=%#010x be=%#010x\n", pThis->pDevInsR3->iInstance, cbp, be)); 2108 return false; 2109 } 2110 2101 static void ohciR3BufInit(POHCIBUF pBuf, uint32_t cbp, uint32_t be) 2102 { 2111 2103 if (!cbp || !be) 2112 2104 { … … 2115 2107 Log2(("ohci: cbp=%#010x be=%#010x cbTotal=0 EMPTY\n", cbp, be)); 2116 2108 } 2117 else if ((cbp & ~0xfff) == (be & ~0xfff) )2109 else if ((cbp & ~0xfff) == (be & ~0xfff) && (cbp <= be)) 2118 2110 { 2119 2111 pBuf->aVecs[0].Addr = cbp; … … 2133 2125 Log2(("ohci: cbp=%#010x be=%#010x cbTotal=%u PAGE FLIP\n", cbp, be, pBuf->cbTotal)); 2134 2126 } 2135 2136 return true;2137 2127 } 2138 2128 … … 2684 2674 */ 2685 2675 OHCIBUF Buf; 2686 if (!ohciR3BufInit(pThis, &Buf, pTd->cbp, pTd->be)) 2687 { 2688 ohciR3RaiseUnrecoverableError(pThis, 1); 2689 return; 2690 } 2676 ohciR3BufInit(&Buf, pTd->cbp, pTd->be); 2691 2677 uint32_t NewCbp; 2692 2678 if (cbLeft >= Buf.cbTotal) … … 2717 2703 && Buf.aVecs[1].cb > (cbLeft - Buf.aVecs[0].cb))) 2718 2704 { 2719 ohciR3RaiseUnrecoverableError(pThis, 2);2705 ohciR3RaiseUnrecoverableError(pThis, 1); 2720 2706 return; 2721 2707 } … … 2979 2965 ohciR3ReadTd(pThis, TdAddr, &Td); 2980 2966 OHCIBUF Buf; 2981 if (!ohciR3BufInit(pThis, &Buf, Td.cbp, Td.be)) 2982 { 2983 ohciR3RaiseUnrecoverableError(pThis, 3); 2984 return false; 2985 } 2967 ohciR3BufInit(&Buf, Td.cbp, Td.be); 2986 2968 2987 2969 *pNextTdAddr = Td.NextTD & ED_PTR_MASK; … … 3003 2985 default: 3004 2986 Log(("ohciR3ServiceTd: Invalid direction!!!! Td.hwinfo=%#x Ed.hwdinfo=%#x\n", Td.hwinfo, pEd->hwinfo)); 3005 ohciR3RaiseUnrecoverableError(pThis, 4);2987 ohciR3RaiseUnrecoverableError(pThis, 2); 3006 2988 return false; 3007 2989 } … … 3041 3023 && Buf.aVecs[1].cb > (pUrb->cbData - Buf.aVecs[0].cb))) 3042 3024 { 3043 ohciR3RaiseUnrecoverableError(pThis, 5);3025 ohciR3RaiseUnrecoverableError(pThis, 3); 3044 3026 VUSBIRhFreeUrb(pThis->RootHub.pIRhConn, pUrb); 3045 3027 return false; … … 3120 3102 /* read the head */ 3121 3103 ohciR3ReadTd(pThis, TdAddr, &Head.Td); 3122 if (!ohciR3BufInit(pThis, &Head.Buf, Head.Td.cbp, Head.Td.be)) 3123 { 3124 ohciR3RaiseUnrecoverableError(pThis, 6); 3125 return false; 3126 } 3104 ohciR3BufInit(&Head.Buf, Head.Td.cbp, Head.Td.be); 3127 3105 Head.TdAddr = TdAddr; 3128 3106 Head.pNext = NULL; … … 3142 3120 pCur->TdAddr = pTail->Td.NextTD & ED_PTR_MASK; 3143 3121 ohciR3ReadTd(pThis, pCur->TdAddr, &pCur->Td); 3144 if (!ohciR3BufInit(pThis, &pCur->Buf, pCur->Td.cbp, pCur->Td.be)) 3145 { 3146 ohciR3RaiseUnrecoverableError(pThis, 7); 3147 return false; 3148 } 3122 ohciR3BufInit(&pCur->Buf, pCur->Td.cbp, pCur->Td.be); 3149 3123 3150 3124 /* Don't combine if the direction doesn't match up. There can't actually be … … 3180 3154 default: 3181 3155 Log(("ohciR3ServiceTdMultiple: Invalid direction!!!! Head.Td.hwinfo=%#x Ed.hwdinfo=%#x\n", Head.Td.hwinfo, pEd->hwinfo)); 3182 ohciR3RaiseUnrecoverableError(pThis, 8);3156 ohciR3RaiseUnrecoverableError(pThis, 4); 3183 3157 return false; 3184 3158 } … … 3359 3333 default: 3360 3334 Log(("ohciR3ServiceIsochronousTd: Invalid direction!!!! Ed.hwdinfo=%#x\n", pEd->hwinfo)); 3361 ohciR3RaiseUnrecoverableError(pThis, 9);3335 ohciR3RaiseUnrecoverableError(pThis, 5); 3362 3336 return false; 3363 3337 } … … 3392 3366 { 3393 3367 Log(("ITdAddr=%RX32 PSW%d.offset=%#x < offPrev=%#x!\n", ITdAddr, iR, off, offPrev)); /* => Unrecoverable Error*/ 3394 ohciR3RaiseUnrecoverableError(pThis, 10);3368 ohciR3RaiseUnrecoverableError(pThis, 6); 3395 3369 return false; 3396 3370 } … … 3398 3372 { 3399 3373 Log(("ITdAddr=%RX32 PSW%d.CC=%#x < 'Not Accessed'!\n", ITdAddr, iR, PSW >> ITD_PSW_CC_SHIFT)); /* => Unrecoverable Error*/ 3400 ohciR3RaiseUnrecoverableError(pThis, 11);3374 ohciR3RaiseUnrecoverableError(pThis, 7); 3401 3375 return false; 3402 3376 } … … 3411 3385 { 3412 3386 Log(("ITdAddr=%RX32 offEnd=%#x < offPrev=%#x!\n", ITdAddr, offEnd, offPrev)); /* => Unrecoverable Error*/ 3413 ohciR3RaiseUnrecoverableError(pThis, 12);3387 ohciR3RaiseUnrecoverableError(pThis, 8); 3414 3388 return false; 3415 3389 }
Note:
See TracChangeset
for help on using the changeset viewer.