VirtualBox

Changeset 44699 in vbox for trunk


Ignore:
Timestamp:
Feb 14, 2013 8:07:57 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
83798
Message:

DevOHCI.cpp: pOhci -> pThis, like the rest.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/USB/DevOHCI.cpp

    r44698 r44699  
    766766static DECLCALLBACK(bool)   ohciRhXferError(PVUSBIROOTHUBPORT pInterface, PVUSBURB pUrb);
    767767
    768 static int                  ohci_in_flight_find(POHCI pOhci, uint32_t GCPhysTD);
     768static int                  ohci_in_flight_find(POHCI pThis, uint32_t GCPhysTD);
    769769# if defined(VBOX_STRICT) || defined(LOG_ENABLED)
    770 static int                  ohci_in_done_queue_find(POHCI pOhci, uint32_t GCPhysTD);
     770static int                  ohci_in_done_queue_find(POHCI pThis, uint32_t GCPhysTD);
    771771# endif
    772772static DECLCALLBACK(void)   ohciR3LoadReattachDevices(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser);
     
    817817
    818818/* Carry out a hardware remote wakeup */
    819 static void ohci_remote_wakeup(POHCI pOhci)
    820 {
    821     if ((pOhci->ctl & OHCI_CTL_HCFS) != OHCI_USB_SUSPEND)
     819static void ohci_remote_wakeup(POHCI pThis)
     820{
     821    if ((pThis->ctl & OHCI_CTL_HCFS) != OHCI_USB_SUSPEND)
    822822        return;
    823     if (!(pOhci->RootHub.status & OHCI_RHS_DRWE))
     823    if (!(pThis->RootHub.status & OHCI_RHS_DRWE))
    824824        return;
    825     ohciBusResume(pOhci, true /* hardware */);
     825    ohciBusResume(pThis, true /* hardware */);
    826826}
    827827
     
    849849static DECLCALLBACK(int) ohciRhQueryStatusLed(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed)
    850850{
    851     POHCI pOhci = (POHCI)((uintptr_t)pInterface - RT_OFFSETOF(OHCI, RootHub.ILeds));
     851    POHCI pThis = (POHCI)((uintptr_t)pInterface - RT_OFFSETOF(OHCI, RootHub.ILeds));
    852852    if (iLUN == 0)
    853853    {
    854         *ppLed = &pOhci->RootHub.Led;
     854        *ppLed = &pThis->RootHub.Led;
    855855        return VINF_SUCCESS;
    856856    }
     
    872872static DECLCALLBACK(unsigned) ohciRhGetAvailablePorts(PVUSBIROOTHUBPORT pInterface, PVUSBPORTBITMAP pAvailable)
    873873{
    874     POHCI pOhci = VUSBIROOTHUBPORT_2_OHCI(pInterface);
     874    POHCI pThis = VUSBIROOTHUBPORT_2_OHCI(pInterface);
    875875    unsigned iPort;
    876876    unsigned cPorts = 0;
     
    878878    memset(pAvailable, 0, sizeof(*pAvailable));
    879879
    880     PDMCritSectEnter(pOhci->pDevInsR3->pCritSectRoR3, VERR_IGNORED);
    881     for (iPort = 0; iPort < RT_ELEMENTS(pOhci->RootHub.aPorts); iPort++)
    882     {
    883         if (!pOhci->RootHub.aPorts[iPort].pDev)
     880    PDMCritSectEnter(pThis->pDevInsR3->pCritSectRoR3, VERR_IGNORED);
     881    for (iPort = 0; iPort < RT_ELEMENTS(pThis->RootHub.aPorts); iPort++)
     882    {
     883        if (!pThis->RootHub.aPorts[iPort].pDev)
    884884        {
    885885            cPorts++;
     
    887887        }
    888888    }
    889     PDMCritSectLeave(pOhci->pDevInsR3->pCritSectRoR3);
     889    PDMCritSectLeave(pThis->pDevInsR3->pCritSectRoR3);
    890890
    891891    return cPorts;
     
    914914static DECLCALLBACK(int) ohciRhAttach(PVUSBIROOTHUBPORT pInterface, PVUSBIDEVICE pDev, unsigned uPort)
    915915{
    916     POHCI pOhci = VUSBIROOTHUBPORT_2_OHCI(pInterface);
     916    POHCI pThis = VUSBIROOTHUBPORT_2_OHCI(pInterface);
    917917    LogFlow(("ohciRhAttach: pDev=%p uPort=%u\n", pDev, uPort));
    918     PDMCritSectEnter(pOhci->pDevInsR3->pCritSectRoR3, VERR_IGNORED);
     918    PDMCritSectEnter(pThis->pDevInsR3->pCritSectRoR3, VERR_IGNORED);
    919919
    920920    /*
    921921     * Validate and adjust input.
    922922     */
    923     Assert(uPort >= 1 && uPort <= RT_ELEMENTS(pOhci->RootHub.aPorts));
     923    Assert(uPort >= 1 && uPort <= RT_ELEMENTS(pThis->RootHub.aPorts));
    924924    uPort--;
    925     Assert(!pOhci->RootHub.aPorts[uPort].pDev);
     925    Assert(!pThis->RootHub.aPorts[uPort].pDev);
    926926
    927927    /*
    928928     * Attach it.
    929929     */
    930     pOhci->RootHub.aPorts[uPort].fReg = OHCI_PORT_R_CURRENT_CONNECT_STATUS | OHCI_PORT_R_CONNECT_STATUS_CHANGE;
    931     pOhci->RootHub.aPorts[uPort].pDev = pDev;
    932     rhport_power(&pOhci->RootHub, uPort, 1 /* power on */);
    933 
    934     ohci_remote_wakeup(pOhci);
    935     ohciSetInterrupt(pOhci, OHCI_INTR_ROOT_HUB_STATUS_CHANGE);
    936 
    937     PDMCritSectLeave(pOhci->pDevInsR3->pCritSectRoR3);
     930    pThis->RootHub.aPorts[uPort].fReg = OHCI_PORT_R_CURRENT_CONNECT_STATUS | OHCI_PORT_R_CONNECT_STATUS_CHANGE;
     931    pThis->RootHub.aPorts[uPort].pDev = pDev;
     932    rhport_power(&pThis->RootHub, uPort, 1 /* power on */);
     933
     934    ohci_remote_wakeup(pThis);
     935    ohciSetInterrupt(pThis, OHCI_INTR_ROOT_HUB_STATUS_CHANGE);
     936
     937    PDMCritSectLeave(pThis->pDevInsR3->pCritSectRoR3);
    938938    return VINF_SUCCESS;
    939939}
     
    949949static DECLCALLBACK(void) ohciRhDetach(PVUSBIROOTHUBPORT pInterface, PVUSBIDEVICE pDev, unsigned uPort)
    950950{
    951     POHCI pOhci = VUSBIROOTHUBPORT_2_OHCI(pInterface);
     951    POHCI pThis = VUSBIROOTHUBPORT_2_OHCI(pInterface);
    952952    LogFlow(("ohciRhDetach: pDev=%p uPort=%u\n", pDev, uPort));
    953     PDMCritSectEnter(pOhci->pDevInsR3->pCritSectRoR3, VERR_IGNORED);
     953    PDMCritSectEnter(pThis->pDevInsR3->pCritSectRoR3, VERR_IGNORED);
    954954
    955955    /*
    956956     * Validate and adjust input.
    957957     */
    958     Assert(uPort >= 1 && uPort <= RT_ELEMENTS(pOhci->RootHub.aPorts));
     958    Assert(uPort >= 1 && uPort <= RT_ELEMENTS(pThis->RootHub.aPorts));
    959959    uPort--;
    960     Assert(pOhci->RootHub.aPorts[uPort].pDev == pDev);
     960    Assert(pThis->RootHub.aPorts[uPort].pDev == pDev);
    961961
    962962    /*
    963963     * Detach it.
    964964     */
    965     pOhci->RootHub.aPorts[uPort].pDev = NULL;
    966     if (pOhci->RootHub.aPorts[uPort].fReg & OHCI_PORT_PES)
    967         pOhci->RootHub.aPorts[uPort].fReg = OHCI_PORT_R_CONNECT_STATUS_CHANGE | OHCI_PORT_PESC;
     965    pThis->RootHub.aPorts[uPort].pDev = NULL;
     966    if (pThis->RootHub.aPorts[uPort].fReg & OHCI_PORT_PES)
     967        pThis->RootHub.aPorts[uPort].fReg = OHCI_PORT_R_CONNECT_STATUS_CHANGE | OHCI_PORT_PESC;
    968968    else
    969         pOhci->RootHub.aPorts[uPort].fReg = OHCI_PORT_R_CONNECT_STATUS_CHANGE;
    970 
    971     ohci_remote_wakeup(pOhci);
    972     ohciSetInterrupt(pOhci, OHCI_INTR_ROOT_HUB_STATUS_CHANGE);
    973 
    974     PDMCritSectLeave(pOhci->pDevInsR3->pCritSectRoR3);
     969        pThis->RootHub.aPorts[uPort].fReg = OHCI_PORT_R_CONNECT_STATUS_CHANGE;
     970
     971    ohci_remote_wakeup(pThis);
     972    ohciSetInterrupt(pThis, OHCI_INTR_ROOT_HUB_STATUS_CHANGE);
     973
     974    PDMCritSectLeave(pThis->pDevInsR3->pCritSectRoR3);
    975975}
    976976
     
    10091009static DECLCALLBACK(int) ohciRhReset(PVUSBIROOTHUBPORT pInterface, bool fResetOnLinux)
    10101010{
    1011     POHCI pOhci = VUSBIROOTHUBPORT_2_OHCI(pInterface);
    1012     PDMCritSectEnter(pOhci->pDevInsR3->pCritSectRoR3, VERR_IGNORED);
    1013 
    1014     pOhci->RootHub.status = 0;
    1015     pOhci->RootHub.desc_a = OHCI_RHA_NPS | OHCI_NDP;
    1016     pOhci->RootHub.desc_b = 0x0; /* Impl. specific */
     1011    POHCI pThis = VUSBIROOTHUBPORT_2_OHCI(pInterface);
     1012    PDMCritSectEnter(pThis->pDevInsR3->pCritSectRoR3, VERR_IGNORED);
     1013
     1014    pThis->RootHub.status = 0;
     1015    pThis->RootHub.desc_a = OHCI_RHA_NPS | OHCI_NDP;
     1016    pThis->RootHub.desc_b = 0x0; /* Impl. specific */
    10171017
    10181018    /*
     
    10281028     * into this. For the time being we stick with simple.
    10291029     */
    1030     for (unsigned iPort = 0; iPort < RT_ELEMENTS(pOhci->RootHub.aPorts); iPort++)
    1031     {
    1032         if (pOhci->RootHub.aPorts[iPort].pDev)
     1030    for (unsigned iPort = 0; iPort < RT_ELEMENTS(pThis->RootHub.aPorts); iPort++)
     1031    {
     1032        if (pThis->RootHub.aPorts[iPort].pDev)
    10331033        {
    1034             pOhci->RootHub.aPorts[iPort].fReg = OHCI_PORT_R_CURRENT_CONNECT_STATUS | OHCI_PORT_R_CONNECT_STATUS_CHANGE;
     1034            pThis->RootHub.aPorts[iPort].fReg = OHCI_PORT_R_CURRENT_CONNECT_STATUS | OHCI_PORT_R_CONNECT_STATUS_CHANGE;
    10351035            if (fResetOnLinux)
    10361036            {
    1037                 PVM pVM = PDMDevHlpGetVM(pOhci->CTX_SUFF(pDevIns));
    1038                 VUSBIDevReset(pOhci->RootHub.aPorts[iPort].pDev, fResetOnLinux, ohciRhResetDoneOneDev, pOhci, pVM);
     1037                PVM pVM = PDMDevHlpGetVM(pThis->CTX_SUFF(pDevIns));
     1038                VUSBIDevReset(pThis->RootHub.aPorts[iPort].pDev, fResetOnLinux, ohciRhResetDoneOneDev, pThis, pVM);
    10391039            }
    10401040        }
    10411041        else
    1042             pOhci->RootHub.aPorts[iPort].fReg = 0;
    1043     }
    1044 
    1045     PDMCritSectLeave(pOhci->pDevInsR3->pCritSectRoR3);
     1042            pThis->RootHub.aPorts[iPort].fReg = 0;
     1043    }
     1044
     1045    PDMCritSectLeave(pThis->pDevInsR3->pCritSectRoR3);
    10461046    return VINF_SUCCESS;
    10471047}
     
    10541054 * and device construction.
    10551055 *
    1056  * @param   pOhci           The ohci instance data.
     1056 * @param   pThis           The ohci instance data.
    10571057 * @param   fNewMode        The new mode of operation. This is UsbSuspend if it's a
    10581058 *                          software reset, and UsbReset if it's a hardware reset / cold boot.
     
    10671067 * @remark  This hasn't got anything to do with software setting the mode to UsbReset.
    10681068 */
    1069 static void ohciDoReset(POHCI pOhci, uint32_t fNewMode, bool fResetOnLinux)
     1069static void ohciDoReset(POHCI pThis, uint32_t fNewMode, bool fResetOnLinux)
    10701070{
    10711071    Log(("ohci: %s reset%s\n", fNewMode == OHCI_USB_RESET ? "hardware" : "software",
     
    10791079     * any more when a reset has been signaled.
    10801080     */
    1081     pOhci->RootHub.pIRhConn->pfnCancelAllUrbs(pOhci->RootHub.pIRhConn);
     1081    pThis->RootHub.pIRhConn->pfnCancelAllUrbs(pThis->RootHub.pIRhConn);
    10821082
    10831083    /*
     
    10851085     */
    10861086    if (fNewMode == OHCI_USB_RESET)
    1087         pOhci->ctl |= OHCI_CTL_RWC;                     /* We're the firmware, set RemoteWakeupConnected. */
     1087        pThis->ctl |= OHCI_CTL_RWC;                     /* We're the firmware, set RemoteWakeupConnected. */
    10881088    else
    1089         pOhci->ctl &= OHCI_CTL_IR | OHCI_CTL_RWC;       /* IR and RWC are preserved on software reset. */
    1090     pOhci->ctl |= fNewMode;
    1091     pOhci->status = 0;
    1092     pOhci->intr_status = 0;
    1093     pOhci->intr = OHCI_INTR_MASTER_INTERRUPT_ENABLED;   /* (We follow the text and the not reset value column,) */
    1094 
    1095     pOhci->hcca = 0;
    1096     pOhci->per_cur = 0;
    1097     pOhci->ctrl_head = pOhci->ctrl_cur = 0;
    1098     pOhci->bulk_head = pOhci->bulk_cur = 0;
    1099     pOhci->done = 0;
    1100 
    1101     pOhci->fsmps = 0x2778;                              /* To-Be-Defined, use the value linux sets...*/
    1102     pOhci->fit = 0;
    1103     pOhci->fi = 11999;                                  /* (12MHz ticks, one frame is 1ms) */
    1104     pOhci->frt = 0;
    1105     pOhci->HcFmNumber = 0;
    1106     pOhci->pstart = 0;
    1107 
    1108     pOhci->dqic = 0x7;
    1109     pOhci->fno = 0;
     1089        pThis->ctl &= OHCI_CTL_IR | OHCI_CTL_RWC;       /* IR and RWC are preserved on software reset. */
     1090    pThis->ctl |= fNewMode;
     1091    pThis->status = 0;
     1092    pThis->intr_status = 0;
     1093    pThis->intr = OHCI_INTR_MASTER_INTERRUPT_ENABLED;   /* (We follow the text and the not reset value column,) */
     1094
     1095    pThis->hcca = 0;
     1096    pThis->per_cur = 0;
     1097    pThis->ctrl_head = pThis->ctrl_cur = 0;
     1098    pThis->bulk_head = pThis->bulk_cur = 0;
     1099    pThis->done = 0;
     1100
     1101    pThis->fsmps = 0x2778;                              /* To-Be-Defined, use the value linux sets...*/
     1102    pThis->fit = 0;
     1103    pThis->fi = 11999;                                  /* (12MHz ticks, one frame is 1ms) */
     1104    pThis->frt = 0;
     1105    pThis->HcFmNumber = 0;
     1106    pThis->pstart = 0;
     1107
     1108    pThis->dqic = 0x7;
     1109    pThis->fno = 0;
    11101110
    11111111    /*
     
    11161116     */
    11171117    if (fNewMode == OHCI_USB_RESET)
    1118         VUSBIDevReset(pOhci->RootHub.pIDev, fResetOnLinux, NULL, NULL, NULL);
     1118        VUSBIDevReset(pThis->RootHub.pIDev, fResetOnLinux, NULL, NULL, NULL);
    11191119}
    11201120#endif /* IN_RING3 */
     
    11231123 * Reads physical memory.
    11241124 */
    1125 DECLINLINE(void) ohciPhysRead(POHCI pOhci, uint32_t Addr, void *pvBuf, size_t cbBuf)
     1125DECLINLINE(void) ohciPhysRead(POHCI pThis, uint32_t Addr, void *pvBuf, size_t cbBuf)
    11261126{
    11271127    if (cbBuf)
    1128         PDMDevHlpPhysRead(pOhci->CTX_SUFF(pDevIns), Addr, pvBuf, cbBuf);
     1128        PDMDevHlpPhysRead(pThis->CTX_SUFF(pDevIns), Addr, pvBuf, cbBuf);
    11291129}
    11301130
     
    11321132 * Writes physical memory.
    11331133 */
    1134 DECLINLINE(void) ohciPhysWrite(POHCI pOhci, uint32_t Addr, const void *pvBuf, size_t cbBuf)
     1134DECLINLINE(void) ohciPhysWrite(POHCI pThis, uint32_t Addr, const void *pvBuf, size_t cbBuf)
    11351135{
    11361136    if (cbBuf)
    1137         PDMDevHlpPhysWrite(pOhci->CTX_SUFF(pDevIns), Addr, pvBuf, cbBuf);
     1137        PDMDevHlpPhysWrite(pThis->CTX_SUFF(pDevIns), Addr, pvBuf, cbBuf);
    11381138}
    11391139
     
    11411141 * Read an array of dwords from physical memory and correct endianness.
    11421142 */
    1143 DECLINLINE(void) ohciGetDWords(POHCI pOhci, uint32_t Addr, uint32_t *pau32s, int c32s)
    1144 {
    1145     ohciPhysRead(pOhci, Addr, pau32s, c32s * sizeof(uint32_t));
     1143DECLINLINE(void) ohciGetDWords(POHCI pThis, uint32_t Addr, uint32_t *pau32s, int c32s)
     1144{
     1145    ohciPhysRead(pThis, Addr, pau32s, c32s * sizeof(uint32_t));
    11461146#if BYTE_ORDER != LITTLE_ENDIAN
    11471147    for(int i = 0; i < c32s; i++)
     
    11531153 * Write an array of dwords from physical memory and correct endianness.
    11541154 */
    1155 DECLINLINE(void) ohciPutDWords(POHCI pOhci, uint32_t Addr, const uint32_t *pau32s, int cu32s)
     1155DECLINLINE(void) ohciPutDWords(POHCI pThis, uint32_t Addr, const uint32_t *pau32s, int cu32s)
    11561156{
    11571157#if BYTE_ORDER == LITTLE_ENDIAN
    1158     ohciPhysWrite(pOhci, Addr, pau32s, cu32s << 2);
     1158    ohciPhysWrite(pThis, Addr, pau32s, cu32s << 2);
    11591159#else
    11601160    for (int i = 0; i < c32s; i++, pau32s++, Addr += sizeof(*pau32s))
    11611161    {
    11621162        uint32_t u32Tmp = RT_H2LE_U32(*pau32s);
    1163         ohciPhysWrite(pOhci, Addr, (uint8_t *)&u32Tmp, sizeof(u32Tmp));
     1163        ohciPhysWrite(pThis, Addr, (uint8_t *)&u32Tmp, sizeof(u32Tmp));
    11641164    }
    11651165#endif
     
    11721172 * Reads an OHCIED.
    11731173 */
    1174 DECLINLINE(void) ohciReadEd(POHCI pOhci, uint32_t EdAddr, POHCIED pEd)
    1175 {
    1176     ohciGetDWords(pOhci, EdAddr, (uint32_t *)pEd, sizeof(*pEd) >> 2);
     1174DECLINLINE(void) ohciReadEd(POHCI pThis, uint32_t EdAddr, POHCIED pEd)
     1175{
     1176    ohciGetDWords(pThis, EdAddr, (uint32_t *)pEd, sizeof(*pEd) >> 2);
    11771177}
    11781178
     
    11801180 * Reads an OHCITD.
    11811181 */
    1182 DECLINLINE(void) ohciReadTd(POHCI pOhci, uint32_t TdAddr, POHCITD pTd)
    1183 {
    1184     ohciGetDWords(pOhci, TdAddr, (uint32_t *)pTd, sizeof(*pTd) >> 2);
     1182DECLINLINE(void) ohciReadTd(POHCI pThis, uint32_t TdAddr, POHCITD pTd)
     1183{
     1184    ohciGetDWords(pThis, TdAddr, (uint32_t *)pTd, sizeof(*pTd) >> 2);
    11851185#ifdef LOG_ENABLED
    11861186    if (LogIs3Enabled())
     
    12161216             */
    12171217            uint8_t abXpTd[0x80];
    1218             ohciPhysRead(pOhci, TdAddr, abXpTd, sizeof(abXpTd));
     1218            ohciPhysRead(pThis, TdAddr, abXpTd, sizeof(abXpTd));
    12191219            Log3(("WinXpTd: alloc=%d PhysSelf=%RX32 s2=%RX32 magic=%RX32 s4=%RX32 s5=%RX32\n"
    12201220                  "%.*Rhxd\n",
     
    12331233 * Reads an OHCIITD.
    12341234 */
    1235 DECLINLINE(void) ohciReadITd(POHCI pOhci, uint32_t ITdAddr, POHCIITD pITd)
    1236 {
    1237     ohciGetDWords(pOhci, ITdAddr, (uint32_t *)pITd, sizeof(*pITd) / sizeof(uint32_t));
     1235DECLINLINE(void) ohciReadITd(POHCI pThis, uint32_t ITdAddr, POHCIITD pITd)
     1236{
     1237    ohciGetDWords(pThis, ITdAddr, (uint32_t *)pITd, sizeof(*pITd) / sizeof(uint32_t));
    12381238#ifdef LOG_ENABLED
    12391239    if (LogIs3Enabled())
     
    12411241        Log3(("ohciReadITd(,%#010x,): SF=%#06x (%#RX32) DI=%#x FC=%d CC=%#x BP0=%#010x NextTD=%#010x BE=%#010x\n",
    12421242              ITdAddr,
    1243               pITd->HwInfo & 0xffff, pOhci->HcFmNumber,
     1243              pITd->HwInfo & 0xffff, pThis->HcFmNumber,
    12441244              (pITd->HwInfo >> 21) & 7,
    12451245              (pITd->HwInfo >> 24) & 7,
     
    12651265 * Writes an OHCIED.
    12661266 */
    1267 DECLINLINE(void) ohciWriteEd(POHCI pOhci, uint32_t EdAddr, PCOHCIED pEd)
     1267DECLINLINE(void) ohciWriteEd(POHCI pThis, uint32_t EdAddr, PCOHCIED pEd)
    12681268{
    12691269#ifdef LOG_ENABLED
     
    12731273        uint32_t    hichg;
    12741274
    1275         ohciGetDWords(pOhci, EdAddr, (uint32_t *)&EdOld, sizeof(EdOld) >> 2);
     1275        ohciGetDWords(pThis, EdAddr, (uint32_t *)&EdOld, sizeof(EdOld) >> 2);
    12761276        hichg = EdOld.hwinfo ^ pEd->hwinfo;
    12771277        Log3(("ohciWriteEd(,%#010x,): %sFA=%#x %sEN=%#x %sD=%#x %sS=%d %sK=%d %sF=%d %sMPS=%#x %sTailP=%#010x %sHeadP=%#010x %sH=%d %sC=%d %sNextED=%#010x\n",
     
    12921292#endif
    12931293
    1294     ohciPutDWords(pOhci, EdAddr, (uint32_t *)pEd, sizeof(*pEd) >> 2);
     1294    ohciPutDWords(pThis, EdAddr, (uint32_t *)pEd, sizeof(*pEd) >> 2);
    12951295}
    12961296
     
    12991299 * Writes an OHCITD.
    13001300 */
    1301 DECLINLINE(void) ohciWriteTd(POHCI pOhci, uint32_t TdAddr, PCOHCITD pTd, const char *pszLogMsg)
     1301DECLINLINE(void) ohciWriteTd(POHCI pThis, uint32_t TdAddr, PCOHCITD pTd, const char *pszLogMsg)
    13021302{
    13031303#ifdef LOG_ENABLED
     
    13051305    {
    13061306        OHCITD TdOld;
    1307         ohciGetDWords(pOhci, TdAddr, (uint32_t *)&TdOld, sizeof(TdOld) >> 2);
     1307        ohciGetDWords(pThis, TdAddr, (uint32_t *)&TdOld, sizeof(TdOld) >> 2);
    13081308        uint32_t hichg = TdOld.hwinfo ^ pTd->hwinfo;
    13091309        Log3(("ohciWriteTd(,%#010x,): %sR=%d %sDP=%d %sDI=%#x %sT=%d %sEC=%d %sCC=%#x %sCBP=%#010x %sNextTD=%#010x %sBE=%#010x (%s)\n",
     
    13211321    }
    13221322#endif
    1323     ohciPutDWords(pOhci, TdAddr, (uint32_t *)pTd, sizeof(*pTd) >> 2);
     1323    ohciPutDWords(pThis, TdAddr, (uint32_t *)pTd, sizeof(*pTd) >> 2);
    13241324}
    13251325
     
    13271327 * Writes an OHCIITD.
    13281328 */
    1329 DECLINLINE(void) ohciWriteITd(POHCI pOhci, uint32_t ITdAddr, PCOHCIITD pITd, const char *pszLogMsg)
     1329DECLINLINE(void) ohciWriteITd(POHCI pThis, uint32_t ITdAddr, PCOHCIITD pITd, const char *pszLogMsg)
    13301330{
    13311331#ifdef LOG_ENABLED
     
    13331333    {
    13341334        OHCIITD ITdOld;
    1335         ohciGetDWords(pOhci, ITdAddr, (uint32_t *)&ITdOld, sizeof(ITdOld) / sizeof(uint32_t));
     1335        ohciGetDWords(pThis, ITdAddr, (uint32_t *)&ITdOld, sizeof(ITdOld) / sizeof(uint32_t));
    13361336        uint32_t HIChg = ITdOld.HwInfo ^ pITd->HwInfo;
    13371337        Log3(("ohciWriteITd(,%#010x,): %sSF=%#x (now=%#RX32) %sDI=%#x %sFC=%d %sCC=%#x %sBP0=%#010x %sNextTD=%#010x %sBE=%#010x (%s)\n",
    13381338              ITdAddr,
    1339               (HIChg & 0xffff) & 1 ? "*" : "", pITd->HwInfo & 0xffff, pOhci->HcFmNumber,
     1339              (HIChg & 0xffff) & 1 ? "*" : "", pITd->HwInfo & 0xffff, pThis->HcFmNumber,
    13401340              (HIChg >> 21)    & 7 ? "*" : "", (pITd->HwInfo >> 21) & 7,
    13411341              (HIChg >> 24)    & 7 ? "*" : "", (pITd->HwInfo >> 24) & 7,
     
    13561356    }
    13571357#endif
    1358     ohciPutDWords(pOhci, ITdAddr, (uint32_t *)pITd, sizeof(*pITd) / sizeof(uint32_t));
     1358    ohciPutDWords(pThis, ITdAddr, (uint32_t *)pITd, sizeof(*pITd) / sizeof(uint32_t));
    13591359}
    13601360
     
    13651365 * Core TD queue dumper. LOG_ENABLED builds only.
    13661366 */
    1367 DECLINLINE(void) ohciDumpTdQueueCore(POHCI pOhci, uint32_t GCPhysHead, uint32_t GCPhysTail, bool fFull)
     1367DECLINLINE(void) ohciDumpTdQueueCore(POHCI pThis, uint32_t GCPhysHead, uint32_t GCPhysTail, bool fFull)
    13681368{
    13691369    uint32_t GCPhys = GCPhysHead;
     
    13731373        OHCITD Td;
    13741374        Log4(("%#010x%s%s", GCPhys,
    1375               GCPhys && ohci_in_flight_find(pOhci, GCPhys) >= 0 ? "~" : "",
    1376               GCPhys && ohci_in_done_queue_find(pOhci, GCPhys) >= 0 ? "^" : ""));
     1375              GCPhys && ohci_in_flight_find(pThis, GCPhys) >= 0 ? "~" : "",
     1376              GCPhys && ohci_in_done_queue_find(pThis, GCPhys) >= 0 ? "^" : ""));
    13771377        if (GCPhys == 0 || GCPhys == GCPhysTail)
    13781378            break;
    13791379
    13801380        /* can't use ohciReadTd() because of Log4. */
    1381         ohciGetDWords(pOhci, GCPhys, (uint32_t *)&Td, sizeof(Td) >> 2);
     1381        ohciGetDWords(pThis, GCPhys, (uint32_t *)&Td, sizeof(Td) >> 2);
    13821382        if (fFull)
    13831383            Log4((" [R=%d DP=%d DI=%d T=%d EC=%d CC=%#x CBP=%#010x NextTD=%#010x BE=%#010x] -> ",
     
    14021402 * Dumps a TD queue. LOG_ENABLED builds only.
    14031403 */
    1404 DECLINLINE(void) ohciDumpTdQueue(POHCI pOhci, uint32_t GCPhysHead, const char *pszMsg)
     1404DECLINLINE(void) ohciDumpTdQueue(POHCI pThis, uint32_t GCPhysHead, const char *pszMsg)
    14051405{
    14061406    if (pszMsg)
    14071407        Log4(("%s: ", pszMsg));
    1408     ohciDumpTdQueueCore(pOhci, GCPhysHead, 0, true);
     1408    ohciDumpTdQueueCore(pThis, GCPhysHead, 0, true);
    14091409    Log4(("\n"));
    14101410}
     
    14131413 * Core ITD queue dumper. LOG_ENABLED builds only.
    14141414 */
    1415 DECLINLINE(void) ohciDumpITdQueueCore(POHCI pOhci, uint32_t GCPhysHead, uint32_t GCPhysTail, bool fFull)
     1415DECLINLINE(void) ohciDumpITdQueueCore(POHCI pThis, uint32_t GCPhysHead, uint32_t GCPhysTail, bool fFull)
    14161416{
    14171417    uint32_t GCPhys = GCPhysHead;
     
    14211421        OHCIITD ITd;
    14221422        Log4(("%#010x%s%s", GCPhys,
    1423               GCPhys && ohci_in_flight_find(pOhci, GCPhys) >= 0 ? "~" : "",
    1424               GCPhys && ohci_in_done_queue_find(pOhci, GCPhys) >= 0 ? "^" : ""));
     1423              GCPhys && ohci_in_flight_find(pThis, GCPhys) >= 0 ? "~" : "",
     1424              GCPhys && ohci_in_done_queue_find(pThis, GCPhys) >= 0 ? "^" : ""));
    14251425        if (GCPhys == 0 || GCPhys == GCPhysTail)
    14261426            break;
    14271427
    14281428        /* can't use ohciReadTd() because of Log4. */
    1429         ohciGetDWords(pOhci, GCPhys, (uint32_t *)&ITd, sizeof(ITd) / sizeof(uint32_t));
     1429        ohciGetDWords(pThis, GCPhys, (uint32_t *)&ITd, sizeof(ITd) / sizeof(uint32_t));
    14301430        /*if (fFull)
    14311431            Log4((" [R=%d DP=%d DI=%d T=%d EC=%d CC=%#x CBP=%#010x NextTD=%#010x BE=%#010x] -> ",
     
    14501450 * Dumps a ED list. LOG_ENABLED builds only.
    14511451 */
    1452 DECLINLINE(void) ohciDumpEdList(POHCI pOhci, uint32_t GCPhysHead, const char *pszMsg, bool fTDs)
     1452DECLINLINE(void) ohciDumpEdList(POHCI pThis, uint32_t GCPhysHead, const char *pszMsg, bool fTDs)
    14531453{
    14541454    uint32_t GCPhys = GCPhysHead;
     
    14681468
    14691469        /* TDs */
    1470         ohciReadEd(pOhci, GCPhys, &Ed);
     1470        ohciReadEd(pThis, GCPhys, &Ed);
    14711471        if (Ed.hwinfo & ED_HWINFO_ISO)
    14721472            Log4(("[I]"));
     
    14831483        {
    14841484            if (Ed.hwinfo & ED_HWINFO_ISO)
    1485                 ohciDumpITdQueueCore(pOhci, Ed.HeadP & ED_PTR_MASK, Ed.TailP & ED_PTR_MASK, false);
     1485                ohciDumpITdQueueCore(pThis, Ed.HeadP & ED_PTR_MASK, Ed.TailP & ED_PTR_MASK, false);
    14861486            else
    1487                 ohciDumpTdQueueCore(pOhci, Ed.HeadP & ED_PTR_MASK, Ed.TailP & ED_PTR_MASK, false);
     1487                ohciDumpTdQueueCore(pThis, Ed.HeadP & ED_PTR_MASK, Ed.TailP & ED_PTR_MASK, false);
    14881488            Log4(("}"));
    14891489        }
     
    14991499
    15001500
    1501 DECLINLINE(int) ohci_in_flight_find_free(POHCI pOhci, const int iStart)
     1501DECLINLINE(int) ohci_in_flight_find_free(POHCI pThis, const int iStart)
    15021502{
    15031503    unsigned i = iStart;
    1504     while (i < RT_ELEMENTS(pOhci->aInFlight))
    1505     {
    1506         if (pOhci->aInFlight[i].GCPhysTD == 0)
     1504    while (i < RT_ELEMENTS(pThis->aInFlight))
     1505    {
     1506        if (pThis->aInFlight[i].GCPhysTD == 0)
    15071507            return i;
    15081508        i++;
     
    15111511    while (i-- > 0)
    15121512    {
    1513         if (pOhci->aInFlight[i].GCPhysTD == 0)
     1513        if (pThis->aInFlight[i].GCPhysTD == 0)
    15141514            return i;
    15151515    }
     
    15211521 * Record an in-flight TD.
    15221522 *
    1523  * @param   pOhci       OHCI instance data.
     1523 * @param   pThis       OHCI instance data.
    15241524 * @param   GCPhysTD    Physical address of the TD.
    15251525 * @param   pUrb        The URB.
    15261526 */
    1527 static void ohci_in_flight_add(POHCI pOhci, uint32_t GCPhysTD, PVUSBURB pUrb)
    1528 {
    1529     int i = ohci_in_flight_find_free(pOhci, (GCPhysTD >> 4) % RT_ELEMENTS(pOhci->aInFlight));
     1527static void ohci_in_flight_add(POHCI pThis, uint32_t GCPhysTD, PVUSBURB pUrb)
     1528{
     1529    int i = ohci_in_flight_find_free(pThis, (GCPhysTD >> 4) % RT_ELEMENTS(pThis->aInFlight));
    15301530    if (i >= 0)
    15311531    {
    15321532#ifdef LOG_ENABLED
    1533         pUrb->Hci.u32FrameNo = pOhci->HcFmNumber;
     1533        pUrb->Hci.u32FrameNo = pThis->HcFmNumber;
    15341534#endif
    1535         pOhci->aInFlight[i].GCPhysTD = GCPhysTD;
    1536         pOhci->aInFlight[i].pUrb = pUrb;
    1537         pOhci->cInFlight++;
     1535        pThis->aInFlight[i].GCPhysTD = GCPhysTD;
     1536        pThis->aInFlight[i].pUrb = pUrb;
     1537        pThis->cInFlight++;
    15381538        return;
    15391539    }
    1540     AssertMsgFailed(("Out of space cInFlight=%d!\n", pOhci->cInFlight));
     1540    AssertMsgFailed(("Out of space cInFlight=%d!\n", pThis->cInFlight));
    15411541}
    15421542
     
    15451545 * Record in-flight TDs for an URB.
    15461546 *
    1547  * @param   pOhci       OHCI instance data.
     1547 * @param   pThis       OHCI instance data.
    15481548 * @param   pUrb        The URB.
    15491549 */
    1550 static void ohci_in_flight_add_urb(POHCI pOhci, PVUSBURB pUrb)
     1550static void ohci_in_flight_add_urb(POHCI pThis, PVUSBURB pUrb)
    15511551{
    15521552    for (unsigned iTd = 0; iTd < pUrb->Hci.cTds; iTd++)
    1553         ohci_in_flight_add(pOhci, pUrb->Hci.paTds[iTd].TdAddr, pUrb);
     1553        ohci_in_flight_add(pThis, pUrb->Hci.paTds[iTd].TdAddr, pUrb);
    15541554}
    15551555
     
    15601560 * @returns Index of the record.
    15611561 * @returns -1 if not found.
    1562  * @param   pOhci       OHCI instance data.
     1562 * @param   pThis       OHCI instance data.
    15631563 * @param   GCPhysTD    Physical address of the TD.
    15641564 * @remark  This has to be fast.
    15651565 */
    1566 static int ohci_in_flight_find(POHCI pOhci, uint32_t GCPhysTD)
    1567 {
    1568     unsigned cLeft = pOhci->cInFlight;
    1569     unsigned i = (GCPhysTD >> 4) % RT_ELEMENTS(pOhci->aInFlight);
     1566static int ohci_in_flight_find(POHCI pThis, uint32_t GCPhysTD)
     1567{
     1568    unsigned cLeft = pThis->cInFlight;
     1569    unsigned i = (GCPhysTD >> 4) % RT_ELEMENTS(pThis->aInFlight);
    15701570    const int iLast = i;
    1571     while (i < RT_ELEMENTS(pOhci->aInFlight))
    1572     {
    1573         if (pOhci->aInFlight[i].GCPhysTD == GCPhysTD)
     1571    while (i < RT_ELEMENTS(pThis->aInFlight))
     1572    {
     1573        if (pThis->aInFlight[i].GCPhysTD == GCPhysTD)
    15741574            return i;
    1575         if (pOhci->aInFlight[i].GCPhysTD)
     1575        if (pThis->aInFlight[i].GCPhysTD)
    15761576            if (cLeft-- <= 1)
    15771577                return -1;
     
    15811581    while (i-- > 0)
    15821582    {
    1583         if (pOhci->aInFlight[i].GCPhysTD == GCPhysTD)
     1583        if (pThis->aInFlight[i].GCPhysTD == GCPhysTD)
    15841584            return i;
    1585         if (pOhci->aInFlight[i].GCPhysTD)
     1585        if (pThis->aInFlight[i].GCPhysTD)
    15861586            if (cLeft-- <= 1)
    15871587                return -1;
     
    15951595 *
    15961596 * @returns true if in flight, false if not.
    1597  * @param   pOhci       OHCI instance data.
     1597 * @param   pThis       OHCI instance data.
    15981598 * @param   GCPhysTD    Physical address of the TD.
    15991599 */
    1600 static bool ohciIsTdInFlight(POHCI pOhci, uint32_t GCPhysTD)
    1601 {
    1602     return ohci_in_flight_find(pOhci, GCPhysTD) >= 0;
     1600static bool ohciIsTdInFlight(POHCI pThis, uint32_t GCPhysTD)
     1601{
     1602    return ohci_in_flight_find(pThis, GCPhysTD) >= 0;
    16031603}
    16041604
     
    16081608 * @returns pointer to URB if TD is in flight.
    16091609 * @returns NULL if not in flight.
    1610  * @param   pOhci       OHCI instance data.
     1610 * @param   pThis       OHCI instance data.
    16111611 * @param   GCPhysTD    Physical address of the TD.
    16121612 */
    1613 static PVUSBURB ohciTdInFlightUrb(POHCI pOhci, uint32_t GCPhysTD)
     1613static PVUSBURB ohciTdInFlightUrb(POHCI pThis, uint32_t GCPhysTD)
    16141614{
    16151615    int i;
    16161616
    1617     i = ohci_in_flight_find(pOhci, GCPhysTD);
     1617    i = ohci_in_flight_find(pThis, GCPhysTD);
    16181618    if ( i >= 0 )
    1619         return pOhci->aInFlight[i].pUrb;
     1619        return pThis->aInFlight[i].pUrb;
    16201620    return NULL;
    16211621}
     
    16261626 * @returns 0 if found. For logged builds this is the number of frames the TD has been in-flight.
    16271627 * @returns -1 if not found.
    1628  * @param   pOhci       OHCI instance data.
     1628 * @param   pThis       OHCI instance data.
    16291629 * @param   GCPhysTD    Physical address of the TD.
    16301630 */
    1631 static int ohci_in_flight_remove(POHCI pOhci, uint32_t GCPhysTD)
    1632 {
    1633     int i = ohci_in_flight_find(pOhci, GCPhysTD);
     1631static int ohci_in_flight_remove(POHCI pThis, uint32_t GCPhysTD)
     1632{
     1633    int i = ohci_in_flight_find(pThis, GCPhysTD);
    16341634    if (i >= 0)
    16351635    {
    16361636#ifdef LOG_ENABLED
    1637         const int cFramesInFlight = pOhci->HcFmNumber - pOhci->aInFlight[i].pUrb->Hci.u32FrameNo;
     1637        const int cFramesInFlight = pThis->HcFmNumber - pThis->aInFlight[i].pUrb->Hci.u32FrameNo;
    16381638#else
    16391639        const int cFramesInFlight = 0;
    16401640#endif
    16411641        Log2(("ohci_in_flight_remove: reaping TD=%#010x %d frames (%#010x-%#010x)\n",
    1642               GCPhysTD, cFramesInFlight, pOhci->aInFlight[i].pUrb->Hci.u32FrameNo, pOhci->HcFmNumber));
    1643         pOhci->aInFlight[i].GCPhysTD = 0;
    1644         pOhci->aInFlight[i].pUrb = NULL;
    1645         pOhci->cInFlight--;
     1642              GCPhysTD, cFramesInFlight, pThis->aInFlight[i].pUrb->Hci.u32FrameNo, pThis->HcFmNumber));
     1643        pThis->aInFlight[i].GCPhysTD = 0;
     1644        pThis->aInFlight[i].pUrb = NULL;
     1645        pThis->cInFlight--;
    16461646        return cFramesInFlight;
    16471647    }
     
    16561656 * @returns 0 if found. For logged builds this is the number of frames the TD has been in-flight.
    16571657 * @returns -1 if not found.
    1658  * @param   pOhci       OHCI instance data.
     1658 * @param   pThis       OHCI instance data.
    16591659 * @param   pUrb        The URB.
    16601660 */
    1661 static int ohci_in_flight_remove_urb(POHCI pOhci, PVUSBURB pUrb)
    1662 {
    1663     int cFramesInFlight = ohci_in_flight_remove(pOhci, pUrb->Hci.paTds[0].TdAddr);
     1661static int ohci_in_flight_remove_urb(POHCI pThis, PVUSBURB pUrb)
     1662{
     1663    int cFramesInFlight = ohci_in_flight_remove(pThis, pUrb->Hci.paTds[0].TdAddr);
    16641664    if (pUrb->Hci.cTds > 1)
    16651665    {
    16661666        for (unsigned iTd = 1; iTd < pUrb->Hci.cTds; iTd++)
    1667             if (ohci_in_flight_remove(pOhci, pUrb->Hci.paTds[iTd].TdAddr) < 0)
     1667            if (ohci_in_flight_remove(pThis, pUrb->Hci.paTds[iTd].TdAddr) < 0)
    16681668                cFramesInFlight = -1;
    16691669    }
     
    16761676/**
    16771677 * Empties the in-done-queue.
    1678  * @param   pOhci       OHCI instance data.
    1679  */
    1680 static void ohci_in_done_queue_zap(POHCI pOhci)
    1681 {
    1682     pOhci->cInDoneQueue = 0;
     1678 * @param   pThis       OHCI instance data.
     1679 */
     1680static void ohci_in_done_queue_zap(POHCI pThis)
     1681{
     1682    pThis->cInDoneQueue = 0;
    16831683}
    16841684
     
    16871687 * @returns >= 0 on success.
    16881688 * @returns -1 if not found.
    1689  * @param   pOhci       OHCI instance data.
     1689 * @param   pThis       OHCI instance data.
    16901690 * @param   GCPhysTD    Physical address of the TD.
    16911691 */
    1692 static int ohci_in_done_queue_find(POHCI pOhci, uint32_t GCPhysTD)
    1693 {
    1694     unsigned i = pOhci->cInDoneQueue;
     1692static int ohci_in_done_queue_find(POHCI pThis, uint32_t GCPhysTD)
     1693{
     1694    unsigned i = pThis->cInDoneQueue;
    16951695    while (i-- > 0)
    1696         if (pOhci->aInDoneQueue[i].GCPhysTD == GCPhysTD)
     1696        if (pThis->aInDoneQueue[i].GCPhysTD == GCPhysTD)
    16971697            return i;
    16981698    return -1;
     
    17011701/**
    17021702 * Checks that the specified TD is not in the done queue.
    1703  * @param   pOhci       OHCI instance data.
     1703 * @param   pThis       OHCI instance data.
    17041704 * @param   GCPhysTD    Physical address of the TD.
    17051705 */
    1706 static bool ohci_in_done_queue_check(POHCI pOhci, uint32_t GCPhysTD)
    1707 {
    1708     int i = ohci_in_done_queue_find(pOhci, GCPhysTD);
     1706static bool ohci_in_done_queue_check(POHCI pThis, uint32_t GCPhysTD)
     1707{
     1708    int i = ohci_in_done_queue_find(pThis, GCPhysTD);
    17091709#if 0
    17101710    /* This condition has been observed with the USB tablet emulation or with
     
    17271727/**
    17281728 * Adds a TD to the in-done-queue tracking, checking that it's not there already.
    1729  * @param   pOhci       OHCI instance data.
     1729 * @param   pThis       OHCI instance data.
    17301730 * @param   GCPhysTD    Physical address of the TD.
    17311731 */
    1732 static void ohci_in_done_queue_add(POHCI pOhci, uint32_t GCPhysTD)
    1733 {
    1734     Assert(pOhci->cInDoneQueue + 1 <= RT_ELEMENTS(pOhci->aInDoneQueue));
    1735     if (ohci_in_done_queue_check(pOhci, GCPhysTD))
    1736         pOhci->aInDoneQueue[pOhci->cInDoneQueue++].GCPhysTD = GCPhysTD;
     1732static void ohci_in_done_queue_add(POHCI pThis, uint32_t GCPhysTD)
     1733{
     1734    Assert(pThis->cInDoneQueue + 1 <= RT_ELEMENTS(pThis->aInDoneQueue));
     1735    if (ohci_in_done_queue_check(pThis, GCPhysTD))
     1736        pThis->aInDoneQueue[pThis->cInDoneQueue++].GCPhysTD = GCPhysTD;
    17371737}
    17381738# endif /* VBOX_STRICT */
     
    18221822
    18231823/** A worker for ohciUnlinkTds(). */
    1824 static bool ohciUnlinkIsochronousTdInList(POHCI pOhci, uint32_t TdAddr, POHCIITD pITd, POHCIED pEd)
     1824static bool ohciUnlinkIsochronousTdInList(POHCI pThis, uint32_t TdAddr, POHCIITD pITd, POHCIED pEd)
    18251825{
    18261826    const uint32_t  LastTdAddr = pEd->TailP & ED_PTR_MASK;
     
    18351835    {
    18361836        OHCIITD ITd;
    1837         ohciReadITd(pOhci, CurTdAddr, &ITd);
     1837        ohciReadITd(pThis, CurTdAddr, &ITd);
    18381838        if ((ITd.NextTD & ED_PTR_MASK) == TdAddr)
    18391839        {
    18401840            ITd.NextTD = (pITd->NextTD & ED_PTR_MASK) | (ITd.NextTD & ~ED_PTR_MASK);
    1841             ohciWriteITd(pOhci, CurTdAddr, &ITd, "ohciUnlinkIsocTdInList");
     1841            ohciWriteITd(pThis, CurTdAddr, &ITd, "ohciUnlinkIsocTdInList");
    18421842            pITd->NextTD &= ~ED_PTR_MASK;
    18431843            return true;
     
    18541854
    18551855/** A worker for ohciUnlinkTds(). */
    1856 static bool ohciUnlinkGeneralTdInList(POHCI pOhci, uint32_t TdAddr, POHCITD pTd, POHCIED pEd)
     1856static bool ohciUnlinkGeneralTdInList(POHCI pThis, uint32_t TdAddr, POHCITD pTd, POHCIED pEd)
    18571857{
    18581858    const uint32_t  LastTdAddr = pEd->TailP & ED_PTR_MASK;
     
    18671867    {
    18681868        OHCITD Td;
    1869         ohciReadTd(pOhci, CurTdAddr, &Td);
     1869        ohciReadTd(pThis, CurTdAddr, &Td);
    18701870        if ((Td.NextTD & ED_PTR_MASK) == TdAddr)
    18711871        {
    18721872            Td.NextTD = (pTd->NextTD & ED_PTR_MASK) | (Td.NextTD & ~ED_PTR_MASK);
    1873             ohciWriteTd(pOhci, CurTdAddr, &Td, "ohciUnlinkGeneralTdInList");
     1873            ohciWriteTd(pThis, CurTdAddr, &Td, "ohciUnlinkGeneralTdInList");
    18741874            pTd->NextTD &= ~ED_PTR_MASK;
    18751875            return true;
     
    18911891 * @returns false if the TD was not found in the list.
    18921892 */
    1893 static bool ohciUnlinkTds(POHCI pOhci, PVUSBURB pUrb, POHCIED pEd)
     1893static bool ohciUnlinkTds(POHCI pThis, PVUSBURB pUrb, POHCIED pEd)
    18941894{
    18951895    /*
     
    19231923                 * the current isochronous code.
    19241924                 */
    1925                 if (!ohciUnlinkIsochronousTdInList(pOhci, ITdAddr, pITd, pEd))
     1925                if (!ohciUnlinkIsochronousTdInList(pThis, ITdAddr, pITd, pEd))
    19261926                    return false;
    19271927            }
     
    19791979                 * solution. For now we'll hope the HCD handles it...
    19801980                 */
    1981                 if (!ohciUnlinkGeneralTdInList(pOhci, TdAddr, pTd, pEd))
     1981                if (!ohciUnlinkGeneralTdInList(pThis, TdAddr, pTd, pEd))
    19821982                    return false;
    19831983            }
     
    20032003 *
    20042004 * @returns true if the URB has been canceled, otherwise false.
    2005  * @param   pOhci       The OHCI instance.
     2005 * @param   pThis       The OHCI instance.
    20062006 * @param   pUrb        The URB in question.
    20072007 * @param   pEd         The ED pointer (optional).
    20082008 */
    2009 static bool ohciHasUrbBeenCanceled(POHCI pOhci, PVUSBURB pUrb, PCOHCIED pEd)
     2009static bool ohciHasUrbBeenCanceled(POHCI pThis, PVUSBURB pUrb, PCOHCIED pEd)
    20102010{
    20112011    if (!pUrb)
     
    20192019    if (!pEd)
    20202020    {
    2021         ohciReadEd(pOhci, pUrb->Hci.EdAddr, &Ed);
     2021        ohciReadEd(pThis, pUrb->Hci.EdAddr, &Ed);
    20222022        pEd = &Ed;
    20232023    }
     
    20372037                Log(("%s: ohciHasUrbBeenCanceled: iTd=%d cTds=%d TdAddr=%#010RX32 canceled (tail)! [iso]\n",
    20382038                     pUrb->pszDesc, iTd, pUrb->Hci.cTds, pUrb->Hci.paTds[iTd].TdAddr));
    2039                 STAM_COUNTER_INC(&pOhci->StatCanceledIsocUrbs);
     2039                STAM_COUNTER_INC(&pThis->StatCanceledIsocUrbs);
    20402040                return true;
    20412041            }
    2042             ohciReadITd(pOhci, pUrb->Hci.paTds[iTd].TdAddr, &u.ITd);
     2042            ohciReadITd(pThis, pUrb->Hci.paTds[iTd].TdAddr, &u.ITd);
    20432043            if (    u.au32[0] != pUrb->Hci.paTds[iTd].TdCopy[0]     /* hwinfo */
    20442044                ||  u.au32[1] != pUrb->Hci.paTds[iTd].TdCopy[1]     /* bp0 */
     
    20572057                      "!= %.*Rhxs (copy)\n",
    20582058                      sizeof(u.ITd), &u.ITd, sizeof(u.ITd), &pUrb->Hci.paTds[iTd].TdCopy[0]));
    2059                 STAM_COUNTER_INC(&pOhci->StatCanceledIsocUrbs);
     2059                STAM_COUNTER_INC(&pThis->StatCanceledIsocUrbs);
    20602060                return true;
    20612061            }
     
    20772077                Log(("%s: ohciHasUrbBeenCanceled: iTd=%d cTds=%d TdAddr=%#010RX32 canceled (tail)!\n",
    20782078                     pUrb->pszDesc, iTd, pUrb->Hci.cTds, pUrb->Hci.paTds[iTd].TdAddr));
    2079                 STAM_COUNTER_INC(&pOhci->StatCanceledGenUrbs);
     2079                STAM_COUNTER_INC(&pThis->StatCanceledGenUrbs);
    20802080                return true;
    20812081            }
    2082             ohciReadTd(pOhci, pUrb->Hci.paTds[iTd].TdAddr, &u.Td);
     2082            ohciReadTd(pThis, pUrb->Hci.paTds[iTd].TdAddr, &u.Td);
    20832083            if (    u.au32[0] != pUrb->Hci.paTds[iTd].TdCopy[0]     /* hwinfo */
    20842084                ||  u.au32[1] != pUrb->Hci.paTds[iTd].TdCopy[1]     /* cbp */
     
    20932093                      "!= %.*Rhxs (copy)\n",
    20942094                      sizeof(u.Td), &u.Td, sizeof(u.Td), &pUrb->Hci.paTds[iTd].TdCopy[0]));
    2095                 STAM_COUNTER_INC(&pOhci->StatCanceledGenUrbs);
     2095                STAM_COUNTER_INC(&pThis->StatCanceledGenUrbs);
    20962096                return true;
    20972097            }
     
    21322132 * In general, all URBs should have status OK.
    21332133 */
    2134 static void ohciRhXferCompleteIsochronousURB(POHCI pOhci, PVUSBURB pUrb, POHCIED pEd, int cFmAge)
     2134static void ohciRhXferCompleteIsochronousURB(POHCI pThis, PVUSBURB pUrb, POHCIED pEd, int cFmAge)
    21352135{
    21362136    /*
     
    21922192                                /* both */
    21932193                                const unsigned cb0 = 0x1000 - off;
    2194                                 ohciPhysWrite(pOhci, (pITd->BP0 & ITD_BP0_MASK) + off, pb, cb0);
    2195                                 ohciPhysWrite(pOhci, pITd->BE & ITD_BP0_MASK, pb + cb0, cb - cb0);
     2194                                ohciPhysWrite(pThis, (pITd->BP0 & ITD_BP0_MASK) + off, pb, cb0);
     2195                                ohciPhysWrite(pThis, pITd->BE & ITD_BP0_MASK, pb + cb0, cb - cb0);
    21962196                            }
    21972197                            else /* only in the 2nd page */
    2198                                 ohciPhysWrite(pOhci, (pITd->BE & ITD_BP0_MASK) + (off & ITD_BP0_MASK), pb, cb);
     2198                                ohciPhysWrite(pThis, (pITd->BE & ITD_BP0_MASK) + (off & ITD_BP0_MASK), pb, cb);
    21992199                        }
    22002200                        else /* only in the 1st page */
    2201                             ohciPhysWrite(pOhci, (pITd->BP0 & ITD_BP0_MASK) + off, pb, cb);
     2201                            ohciPhysWrite(pThis, (pITd->BP0 & ITD_BP0_MASK) + off, pb, cb);
    22022202                        Log5(("packet %d: off=%#x cb=%#x pb=%p (%#x)\n"
    22032203                              "%.*Rhxd\n",
     
    22442244            DoneInt = 0; /* It's cleared on error. */
    22452245        if (    DoneInt != 0x7
    2246             &&  DoneInt < pOhci->dqic)
    2247             pOhci->dqic = DoneInt;
     2246            &&  DoneInt < pThis->dqic)
     2247            pThis->dqic = DoneInt;
    22482248
    22492249        /*
     
    22512251         */
    22522252#ifdef LOG_ENABLED
    2253         if (!pOhci->done)
    2254             pOhci->u32FmDoneQueueTail = pOhci->HcFmNumber;
     2253        if (!pThis->done)
     2254            pThis->u32FmDoneQueueTail = pThis->HcFmNumber;
    22552255# ifdef VBOX_STRICT
    2256         ohci_in_done_queue_add(pOhci, ITdAddr);
     2256        ohci_in_done_queue_add(pThis, ITdAddr);
    22572257# endif
    22582258#endif
    2259         pITd->NextTD = pOhci->done;
    2260         pOhci->done = ITdAddr;
     2259        pITd->NextTD = pThis->done;
     2260        pThis->done = ITdAddr;
    22612261
    22622262        Log(("%s: ohciRhXferCompleteIsochronousURB: ITdAddr=%#010x EdAddr=%#010x SF=%#x (%#x) CC=%#x FC=%d "
     
    22642264             pUrb->pszDesc, ITdAddr,
    22652265             pUrb->Hci.EdAddr,
    2266              pITd->HwInfo & ITD_HWINFO_SF, pOhci->HcFmNumber,
     2266             pITd->HwInfo & ITD_HWINFO_SF, pThis->HcFmNumber,
    22672267             (pITd->HwInfo & ITD_HWINFO_CC) >> ITD_HWINFO_CC_SHIFT,
    22682268             (pITd->HwInfo & ITD_HWINFO_FC) >> ITD_HWINFO_FC_SHIFT,
     
    22762276             pITd->aPSW[7] >> ITD_PSW_CC_SHIFT, pITd->aPSW[7] & ITD_PSW_SIZE,
    22772277             R));
    2278         ohciWriteITd(pOhci, ITdAddr, pITd, "retired");
     2278        ohciWriteITd(pThis, ITdAddr, pITd, "retired");
    22792279    }
    22802280}
     
    22852285 * a URB made up of general TDs.
    22862286 */
    2287 static void ohciRhXferCompleteGeneralURB(POHCI pOhci, PVUSBURB pUrb, POHCIED pEd, int cFmAge)
     2287static void ohciRhXferCompleteGeneralURB(POHCI pThis, PVUSBURB pUrb, POHCIED pEd, int cFmAge)
    22882288{
    22892289    /*
     
    23242324        {
    23252325            Assert(Buf.cVecs > 0);
    2326             ohciPhysWrite(pOhci, Buf.aVecs[0].Addr, pb, Buf.aVecs[0].cb);
     2326            ohciPhysWrite(pThis, Buf.aVecs[0].Addr, pb, Buf.aVecs[0].cb);
    23272327            if (Buf.cVecs > 1)
    2328                 ohciPhysWrite(pOhci, Buf.aVecs[1].Addr, pb + Buf.aVecs[0].cb, Buf.aVecs[1].cb);
     2328                ohciPhysWrite(pThis, Buf.aVecs[1].Addr, pb + Buf.aVecs[0].cb, Buf.aVecs[1].cb);
    23292329        }
    23302330
     
    23482348            uint32_t DoneInt = (pTd->hwinfo & TD_HWINFO_DI) >> 21;
    23492349            if (    DoneInt != 0x7
    2350                 &&  DoneInt < pOhci->dqic)
    2351                 pOhci->dqic = DoneInt;
     2350                &&  DoneInt < pThis->dqic)
     2351                pThis->dqic = DoneInt;
    23522352            Log(("%s: ohciRhXferCompleteGeneralURB: ED=%#010x TD=%#010x Age=%d cbTotal=%#x NewCbp=%#010RX32 dqic=%d\n",
    2353                  pUrb->pszDesc, pUrb->Hci.EdAddr, TdAddr, cFmAge, pUrb->enmStatus, Buf.cbTotal, NewCbp, pOhci->dqic));
     2353                 pUrb->pszDesc, pUrb->Hci.EdAddr, TdAddr, cFmAge, pUrb->enmStatus, Buf.cbTotal, NewCbp, pThis->dqic));
    23542354        }
    23552355        else
     
    23582358                 pUrb->pszDesc, pUrb->Hci.EdAddr, TdAddr, cFmAge, pUrb->enmStatus));
    23592359            pEd->HeadP |= ED_HEAD_HALTED;
    2360             pOhci->dqic = 0; /* "If the Transfer Descriptor is being retired with an error,
     2360            pThis->dqic = 0; /* "If the Transfer Descriptor is being retired with an error,
    23612361                             *  then the Done Queue Interrupt Counter is cleared as if the
    23622362                             *  InterruptDelay field were zero."
     
    23882388         */
    23892389#ifdef LOG_ENABLED
    2390         if (!pOhci->done)
    2391             pOhci->u32FmDoneQueueTail = pOhci->HcFmNumber;
     2390        if (!pThis->done)
     2391            pThis->u32FmDoneQueueTail = pThis->HcFmNumber;
    23922392# ifdef VBOX_STRICT
    2393         ohci_in_done_queue_add(pOhci, TdAddr);
     2393        ohci_in_done_queue_add(pThis, TdAddr);
    23942394# endif
    23952395#endif
    2396         pTd->NextTD = pOhci->done;
    2397         pOhci->done = TdAddr;
    2398 
    2399         ohciWriteTd(pOhci, TdAddr, pTd, "retired");
     2396        pTd->NextTD = pThis->done;
     2397        pThis->done = TdAddr;
     2398
     2399        ohciWriteTd(pThis, TdAddr, pTd, "retired");
    24002400
    24012401        /*
     
    24252425static DECLCALLBACK(void) ohciRhXferCompletion(PVUSBIROOTHUBPORT pInterface, PVUSBURB pUrb)
    24262426{
    2427     POHCI pOhci = VUSBIROOTHUBPORT_2_OHCI(pInterface);
     2427    POHCI pThis = VUSBIROOTHUBPORT_2_OHCI(pInterface);
    24282428    LogFlow(("%s: ohciRhXferCompletion: EdAddr=%#010RX32 cTds=%d TdAddr0=%#010RX32\n",
    24292429             pUrb->pszDesc, pUrb->Hci.EdAddr, pUrb->Hci.cTds, pUrb->Hci.paTds[0].TdAddr));
    2430     Assert(PDMCritSectIsOwner(pOhci->pDevInsR3->pCritSectRoR3));
    2431 
    2432     pOhci->fIdle = false;   /* Mark as active */
     2430    Assert(PDMCritSectIsOwner(pThis->pDevInsR3->pCritSectRoR3));
     2431
     2432    pThis->fIdle = false;   /* Mark as active */
    24332433
    24342434    /* get the current end point descriptor. */
    24352435    OHCIED Ed;
    2436     ohciReadEd(pOhci, pUrb->Hci.EdAddr, &Ed);
     2436    ohciReadEd(pThis, pUrb->Hci.EdAddr, &Ed);
    24372437
    24382438    /*
     
    24462446     * with the data copying, buffer pointer advancing and error handling.
    24472447     */
    2448     int cFmAge = ohci_in_flight_remove_urb(pOhci, pUrb);
     2448    int cFmAge = ohci_in_flight_remove_urb(pThis, pUrb);
    24492449    if (pUrb->enmStatus == VUSBSTATUS_UNDO)
    24502450    {
     
    24522452        Log(("%s: ohciRhXferCompletion: CANCELED {ED=%#010x cTds=%d TD0=%#010x age %d}\n",
    24532453             pUrb->pszDesc, pUrb->Hci.EdAddr, pUrb->Hci.cTds, pUrb->Hci.paTds[0].TdAddr, cFmAge));
    2454         STAM_COUNTER_INC(&pOhci->StatDroppedUrbs);
     2454        STAM_COUNTER_INC(&pThis->StatDroppedUrbs);
    24552455        return;
    24562456    }
     
    24592459        ||  (Ed.hwinfo & ED_HWINFO_SKIP)
    24602460        ||  cFmAge < 0
    2461         ||  (fHasBeenCanceled = ohciHasUrbBeenCanceled(pOhci, pUrb, &Ed))
    2462         ||  !ohciUnlinkTds(pOhci, pUrb, &Ed)
     2461        ||  (fHasBeenCanceled = ohciHasUrbBeenCanceled(pThis, pUrb, &Ed))
     2462        ||  !ohciUnlinkTds(pThis, pUrb, &Ed)
    24632463       )
    24642464    {
     
    24712471             fHasBeenCanceled                                       ? " td canceled" : ""));
    24722472        NOREF(fHasBeenCanceled);
    2473         STAM_COUNTER_INC(&pOhci->StatDroppedUrbs);
     2473        STAM_COUNTER_INC(&pThis->StatDroppedUrbs);
    24742474        return;
    24752475    }
     
    24802480     */
    24812481    if (pUrb->enmType == VUSBXFERTYPE_ISOC)
    2482         ohciRhXferCompleteIsochronousURB(pOhci, pUrb, &Ed, cFmAge);
     2482        ohciRhXferCompleteIsochronousURB(pThis, pUrb, &Ed, cFmAge);
    24832483    else
    2484         ohciRhXferCompleteGeneralURB(pOhci, pUrb, &Ed, cFmAge);
     2484        ohciRhXferCompleteGeneralURB(pThis, pUrb, &Ed, cFmAge);
    24852485
    24862486    /* finally write back the endpoint descriptor. */
    2487     ohciWriteEd(pOhci, pUrb->Hci.EdAddr, &Ed);
     2487    ohciWriteEd(pThis, pUrb->Hci.EdAddr, &Ed);
    24882488}
    24892489
     
    25022502static DECLCALLBACK(bool) ohciRhXferError(PVUSBIROOTHUBPORT pInterface, PVUSBURB pUrb)
    25032503{
    2504     POHCI pOhci = VUSBIROOTHUBPORT_2_OHCI(pInterface);
    2505     Assert(PDMCritSectIsOwner(pOhci->pDevInsR3->pCritSectRoR3));
     2504    POHCI pThis = VUSBIROOTHUBPORT_2_OHCI(pInterface);
     2505    Assert(PDMCritSectIsOwner(pThis->pDevInsR3->pCritSectRoR3));
    25062506
    25072507    /*
     
    25262526    const uint32_t  TdAddr = pUrb->Hci.paTds[0].TdAddr;
    25272527/** @todo IMPORTANT! we must check if the ED is still valid at this point!!! */
    2528     if (ohciHasUrbBeenCanceled(pOhci, pUrb, NULL))
     2528    if (ohciHasUrbBeenCanceled(pThis, pUrb, NULL))
    25292529    {
    25302530        Log(("%s: ohciRhXferError: TdAddr0=%#x canceled!\n", pUrb->pszDesc, TdAddr));
     
    25402540    cErrs++;
    25412541    pTd->hwinfo |= (cErrs % TD_ERRORS_MAX) << TD_ERRORS_SHIFT;
    2542     ohciWriteTd(pOhci, TdAddr, pTd, "ohciRhXferError");
     2542    ohciWriteTd(pThis, TdAddr, pTd, "ohciRhXferError");
    25432543
    25442544    if (cErrs >= TD_ERRORS_MAX - 1)
     
    25552555 * Service a general transport descriptor.
    25562556 */
    2557 static bool ohciServiceTd(POHCI pOhci, VUSBXFERTYPE enmType, PCOHCIED pEd, uint32_t EdAddr, uint32_t TdAddr, uint32_t *pNextTdAddr, const char *pszListName)
     2557static bool ohciServiceTd(POHCI pThis, VUSBXFERTYPE enmType, PCOHCIED pEd, uint32_t EdAddr, uint32_t TdAddr, uint32_t *pNextTdAddr, const char *pszListName)
    25582558{
    25592559    /*
     
    25612561     */
    25622562    OHCITD Td;
    2563     ohciReadTd(pOhci, TdAddr, &Td);
     2563    ohciReadTd(pThis, TdAddr, &Td);
    25642564    OHCIBUF Buf;
    25652565    ohciBufInit(&Buf, Td.cbp, Td.be);
     
    25892589    }
    25902590
    2591     pOhci->fIdle = false;   /* Mark as active */
     2591    pThis->fIdle = false;   /* Mark as active */
    25922592
    25932593    /*
    25942594     * Allocate and initialize a new URB.
    25952595     */
    2596     PVUSBURB pUrb = VUSBIRhNewUrb(pOhci->RootHub.pIRhConn, pEd->hwinfo & ED_HWINFO_FUNCTION, Buf.cbTotal, 1);
     2596    PVUSBURB pUrb = VUSBIRhNewUrb(pThis->RootHub.pIRhConn, pEd->hwinfo & ED_HWINFO_FUNCTION, Buf.cbTotal, 1);
    25972597    if (!pUrb)
    25982598        return false;                   /* retry later... */
     
    26072607    pUrb->Hci.fUnlinked = false;
    26082608    pUrb->Hci.paTds[0].TdAddr = TdAddr;
    2609     pUrb->Hci.u32FrameNo = pOhci->HcFmNumber;
     2609    pUrb->Hci.u32FrameNo = pThis->HcFmNumber;
    26102610    AssertCompile(sizeof(pUrb->Hci.paTds[0].TdCopy) >= sizeof(Td));
    26112611    memcpy(pUrb->Hci.paTds[0].TdCopy, &Td, sizeof(Td));
     
    26232623        &&  enmDir != VUSBDIRECTION_IN)
    26242624    {
    2625         ohciPhysRead(pOhci, Buf.aVecs[0].Addr, pUrb->abData, Buf.aVecs[0].cb);
     2625        ohciPhysRead(pThis, Buf.aVecs[0].Addr, pUrb->abData, Buf.aVecs[0].cb);
    26262626        if (Buf.cVecs > 1)
    2627             ohciPhysRead(pOhci, Buf.aVecs[1].Addr, &pUrb->abData[Buf.aVecs[0].cb], Buf.aVecs[1].cb);
     2627            ohciPhysRead(pThis, Buf.aVecs[1].Addr, &pUrb->abData[Buf.aVecs[0].cb], Buf.aVecs[1].cb);
    26282628    }
    26292629
     
    26312631     * Submit the URB.
    26322632     */
    2633     ohci_in_flight_add(pOhci, TdAddr, pUrb);
     2633    ohci_in_flight_add(pThis, TdAddr, pUrb);
    26342634    Log(("%s: ohciServiceTd: submitting TdAddr=%#010x EdAddr=%#010x cbData=%#x\n",
    26352635         pUrb->pszDesc, TdAddr, EdAddr, pUrb->cbData));
    26362636
    2637     int rc = VUSBIRhSubmitUrb(pOhci->RootHub.pIRhConn, pUrb, &pOhci->RootHub.Led);
     2637    int rc = VUSBIRhSubmitUrb(pThis->RootHub.pIRhConn, pUrb, &pThis->RootHub.Led);
    26382638    if (RT_SUCCESS(rc))
    26392639        return true;
     
    26422642    Log(("ohciServiceTd: failed submitting TdAddr=%#010x EdAddr=%#010x pUrb=%p!!\n",
    26432643         TdAddr, EdAddr, pUrb));
    2644     ohci_in_flight_remove(pOhci, TdAddr);
     2644    ohci_in_flight_remove(pThis, TdAddr);
    26452645    return false;
    26462646}
     
    26502650 * Service a the head TD of an endpoint.
    26512651 */
    2652 static bool ohciServiceHeadTd(POHCI pOhci, VUSBXFERTYPE enmType, PCOHCIED pEd, uint32_t EdAddr, const char *pszListName)
     2652static bool ohciServiceHeadTd(POHCI pThis, VUSBXFERTYPE enmType, PCOHCIED pEd, uint32_t EdAddr, const char *pszListName)
    26532653{
    26542654    /*
     
    26562656     */
    26572657    uint32_t TdAddr = pEd->HeadP & ED_PTR_MASK;
    2658     if (ohciIsTdInFlight(pOhci, TdAddr))
     2658    if (ohciIsTdInFlight(pThis, TdAddr))
    26592659        return false;
    26602660#if defined(VBOX_STRICT) || defined(LOG_ENABLED)
    2661     ohci_in_done_queue_check(pOhci, TdAddr);
     2661    ohci_in_done_queue_check(pThis, TdAddr);
    26622662#endif
    2663     return ohciServiceTd(pOhci, enmType, pEd, EdAddr, TdAddr, &TdAddr, pszListName);
     2663    return ohciServiceTd(pThis, enmType, pEd, EdAddr, TdAddr, &TdAddr, pszListName);
    26642664}
    26652665
     
    26682668 * Service one or more general transport descriptors (bulk or interrupt).
    26692669 */
    2670 static bool ohciServiceTdMultiple(POHCI pOhci, VUSBXFERTYPE enmType, PCOHCIED pEd, uint32_t EdAddr,
     2670static bool ohciServiceTdMultiple(POHCI pThis, VUSBXFERTYPE enmType, PCOHCIED pEd, uint32_t EdAddr,
    26712671                                  uint32_t TdAddr, uint32_t *pNextTdAddr, const char *pszListName)
    26722672{
     
    26872687
    26882688    /* read the head */
    2689     ohciReadTd(pOhci, TdAddr, &Head.Td);
     2689    ohciReadTd(pThis, TdAddr, &Head.Td);
    26902690    ohciBufInit(&Head.Buf, Head.Td.cbp, Head.Td.be);
    26912691    Head.TdAddr = TdAddr;
     
    27052705        pCur->pNext = NULL;
    27062706        pCur->TdAddr = pTail->Td.NextTD & ED_PTR_MASK;
    2707         ohciReadTd(pOhci, pCur->TdAddr, &pCur->Td);
     2707        ohciReadTd(pThis, pCur->TdAddr, &pCur->Td);
    27082708        ohciBufInit(&pCur->Buf, pCur->Td.cbp, pCur->Td.be);
    27092709
     
    27442744    }
    27452745
    2746     pOhci->fIdle = false;   /* Mark as active */
     2746    pThis->fIdle = false;   /* Mark as active */
    27472747
    27482748    /*
    27492749     * Allocate and initialize a new URB.
    27502750     */
    2751     PVUSBURB pUrb = VUSBIRhNewUrb(pOhci->RootHub.pIRhConn, pEd->hwinfo & ED_HWINFO_FUNCTION, cbTotal, cTds);
     2751    PVUSBURB pUrb = VUSBIRhNewUrb(pThis->RootHub.pIRhConn, pEd->hwinfo & ED_HWINFO_FUNCTION, cbTotal, cTds);
    27522752    if (!pUrb)
    27532753        /* retry later... */
     
    27632763    pUrb->Hci.EdAddr = EdAddr;
    27642764    pUrb->Hci.fUnlinked = false;
    2765     pUrb->Hci.u32FrameNo = pOhci->HcFmNumber;
     2765    pUrb->Hci.u32FrameNo = pThis->HcFmNumber;
    27662766#ifdef LOG_ENABLED
    27672767    static unsigned s_iSerial = 0;
     
    27812781            &&  pCur->Buf.cVecs > 0)
    27822782        {
    2783             ohciPhysRead(pOhci, pCur->Buf.aVecs[0].Addr, pb, pCur->Buf.aVecs[0].cb);
     2783            ohciPhysRead(pThis, pCur->Buf.aVecs[0].Addr, pb, pCur->Buf.aVecs[0].cb);
    27842784            if (pCur->Buf.cVecs > 1)
    2785                 ohciPhysRead(pOhci, pCur->Buf.aVecs[1].Addr, pb + pCur->Buf.aVecs[0].cb, pCur->Buf.aVecs[1].cb);
     2785                ohciPhysRead(pThis, pCur->Buf.aVecs[1].Addr, pb + pCur->Buf.aVecs[0].cb, pCur->Buf.aVecs[1].cb);
    27862786        }
    27872787        pb += pCur->Buf.cbTotal;
     
    27962796     * Submit the URB.
    27972797     */
    2798     ohci_in_flight_add_urb(pOhci, pUrb);
     2798    ohci_in_flight_add_urb(pThis, pUrb);
    27992799    Log(("%s: ohciServiceTdMultiple: submitting cbData=%#x EdAddr=%#010x cTds=%d TdAddr0=%#010x\n",
    28002800         pUrb->pszDesc, pUrb->cbData, EdAddr, cTds, TdAddr));
    2801     int rc = VUSBIRhSubmitUrb(pOhci->RootHub.pIRhConn, pUrb, &pOhci->RootHub.Led);
     2801    int rc = VUSBIRhSubmitUrb(pThis->RootHub.pIRhConn, pUrb, &pThis->RootHub.Led);
    28022802    if (RT_SUCCESS(rc))
    28032803        return true;
     
    28072807         pUrb, cbTotal, EdAddr, cTds, TdAddr, rc));
    28082808    for (struct OHCITDENTRY *pCur = &Head; pCur; pCur = pCur->pNext, iTd++)
    2809         ohci_in_flight_remove(pOhci, pCur->TdAddr);
     2809        ohci_in_flight_remove(pThis, pCur->TdAddr);
    28102810    return false;
    28112811}
     
    28152815 * Service the head TD of an endpoint.
    28162816 */
    2817 static bool ohciServiceHeadTdMultiple(POHCI pOhci, VUSBXFERTYPE enmType, PCOHCIED pEd, uint32_t EdAddr, const char *pszListName)
     2817static bool ohciServiceHeadTdMultiple(POHCI pThis, VUSBXFERTYPE enmType, PCOHCIED pEd, uint32_t EdAddr, const char *pszListName)
    28182818{
    28192819    /*
     
    28212821     */
    28222822    uint32_t TdAddr = pEd->HeadP & ED_PTR_MASK;
    2823     if (ohciIsTdInFlight(pOhci, TdAddr))
     2823    if (ohciIsTdInFlight(pThis, TdAddr))
    28242824        return false;
    28252825#if defined(VBOX_STRICT) || defined(LOG_ENABLED)
    2826     ohci_in_done_queue_check(pOhci, TdAddr);
     2826    ohci_in_done_queue_check(pThis, TdAddr);
    28272827#endif
    2828     return ohciServiceTdMultiple(pOhci, enmType, pEd, EdAddr, TdAddr, &TdAddr, pszListName);
     2828    return ohciServiceTdMultiple(pThis, enmType, pEd, EdAddr, TdAddr, &TdAddr, pszListName);
    28292829}
    28302830
     
    28342834 * that belongs to the past.
    28352835 */
    2836 static bool ohciServiceIsochronousTdUnlink(POHCI pOhci, POHCIITD pITd, uint32_t ITdAddr, uint32_t ITdAddrPrev,
     2836static bool ohciServiceIsochronousTdUnlink(POHCI pThis, POHCIITD pITd, uint32_t ITdAddr, uint32_t ITdAddrPrev,
    28372837                                           PVUSBURB pUrb, POHCIED pEd, uint32_t EdAddr)
    28382838{
     
    28472847    {
    28482848        /* Get validate the previous TD */
    2849         int iInFlightPrev = ohci_in_flight_find(pOhci, ITdAddr);
     2849        int iInFlightPrev = ohci_in_flight_find(pThis, ITdAddr);
    28502850        AssertMsgReturn(iInFlightPrev >= 0, ("ITdAddr=%#RX32\n", ITdAddr), false);
    2851         PVUSBURB pUrbPrev = pOhci->aInFlight[iInFlightPrev].pUrb;
    2852         if (ohciHasUrbBeenCanceled(pOhci, pUrbPrev, pEd)) /* ensures the copy is correct. */
     2851        PVUSBURB pUrbPrev = pThis->aInFlight[iInFlightPrev].pUrb;
     2852        if (ohciHasUrbBeenCanceled(pThis, pUrbPrev, pEd)) /* ensures the copy is correct. */
    28532853            return false;
    28542854
     
    28562856        POHCIITD pITdPrev = ((POHCIITD)pUrbPrev->Hci.paTds[0].TdCopy);
    28572857        pITdPrev->NextTD = (pITdPrev->NextTD & ~ED_PTR_MASK) | ITdAddrNext;
    2858         ohciWriteITd(pOhci, ITdAddrPrev, pITdPrev, "ohciServiceIsochronousEndpoint");
     2858        ohciWriteITd(pThis, ITdAddrPrev, pITdPrev, "ohciServiceIsochronousEndpoint");
    28592859    }
    28602860    else
     
    28622862        /* It's the head node. update the copy from the caller and write it back. */
    28632863        pEd->HeadP = (pEd->HeadP & ~ED_PTR_MASK) | ITdAddrNext;
    2864         ohciWriteEd(pOhci, EdAddr, pEd);
     2864        ohciWriteEd(pThis, EdAddr, pEd);
    28652865    }
    28662866
     
    28722872    {
    28732873        pUrb->Hci.fUnlinked = true;
    2874         if (ohciHasUrbBeenCanceled(pOhci, pUrb, pEd)) /* ensures the copy is correct (paranoia). */
     2874        if (ohciHasUrbBeenCanceled(pThis, pUrb, pEd)) /* ensures the copy is correct (paranoia). */
    28752875            return false;
    28762876
     
    28832883        pITd->HwInfo |= OHCI_CC_DATA_OVERRUN;
    28842884
    2885         pITd->NextTD = pOhci->done;
    2886         pOhci->done = ITdAddr;
    2887 
    2888         pOhci->dqic = 0;
    2889     }
    2890 
    2891     ohciWriteITd(pOhci, ITdAddr, pITd, "ohciServiceIsochronousTdUnlink");
     2885        pITd->NextTD = pThis->done;
     2886        pThis->done = ITdAddr;
     2887
     2888        pThis->dqic = 0;
     2889    }
     2890
     2891    ohciWriteITd(pThis, ITdAddr, pITd, "ohciServiceIsochronousTdUnlink");
    28922892    return true;
    28932893}
     
    29012901 * @param   R       The start packet (frame) relative to the start of frame in HwInfo.
    29022902 */
    2903 static bool ohciServiceIsochronousTd(POHCI pOhci, POHCIITD pITd, uint32_t ITdAddr, const unsigned R, PCOHCIED pEd, uint32_t EdAddr)
     2903static bool ohciServiceIsochronousTd(POHCI pThis, POHCIITD pITd, uint32_t ITdAddr, const unsigned R, PCOHCIED pEd, uint32_t EdAddr)
    29042904{
    29052905    /*
     
    29552955    Assert(cbTotal <= 0x2000);
    29562956
    2957     pOhci->fIdle = false;   /* Mark as active */
     2957    pThis->fIdle = false;   /* Mark as active */
    29582958
    29592959    /*
    29602960     * Allocate and initialize a new URB.
    29612961     */
    2962     PVUSBURB pUrb = VUSBIRhNewUrb(pOhci->RootHub.pIRhConn, pEd->hwinfo & ED_HWINFO_FUNCTION, cbTotal, 1);
     2962    PVUSBURB pUrb = VUSBIRhNewUrb(pThis->RootHub.pIRhConn, pEd->hwinfo & ED_HWINFO_FUNCTION, cbTotal, 1);
    29632963    if (!pUrb)
    29642964        /* retry later... */
     
    29722972    pUrb->Hci.EdAddr = EdAddr;
    29732973    pUrb->Hci.fUnlinked = false;
    2974     pUrb->Hci.u32FrameNo = pOhci->HcFmNumber;
     2974    pUrb->Hci.u32FrameNo = pThis->HcFmNumber;
    29752975    pUrb->Hci.paTds[0].TdAddr = ITdAddr;
    29762976    AssertCompile(sizeof(pUrb->Hci.paTds[0].TdCopy) >= sizeof(*pITd));
     
    29962996                /* both pages. */
    29972997                const unsigned cb0 = 0x1000 - off0;
    2998                 ohciPhysRead(pOhci, (pITd->BP0 & ITD_BP0_MASK) + off0, &pUrb->abData[0], cb0);
    2999                 ohciPhysRead(pOhci, pITd->BE & ITD_BP0_MASK, &pUrb->abData[cb0], offEnd & 0xfff);
     2998                ohciPhysRead(pThis, (pITd->BP0 & ITD_BP0_MASK) + off0, &pUrb->abData[0], cb0);
     2999                ohciPhysRead(pThis, pITd->BE & ITD_BP0_MASK, &pUrb->abData[cb0], offEnd & 0xfff);
    30003000            }
    30013001            else /* a portion of the 1st page. */
    3002                 ohciPhysRead(pOhci, (pITd->BP0 & ITD_BP0_MASK) + off0, pUrb->abData, offEnd - off0);
     3002                ohciPhysRead(pThis, (pITd->BP0 & ITD_BP0_MASK) + off0, pUrb->abData, offEnd - off0);
    30033003        }
    30043004        else /* a portion of the 2nd page. */
    3005             ohciPhysRead(pOhci, (pITd->BE & UINT32_C(0xfffff000)) + (off0 & 0xfff), pUrb->abData, cbTotal);
     3005            ohciPhysRead(pThis, (pITd->BE & UINT32_C(0xfffff000)) + (off0 & 0xfff), pUrb->abData, cbTotal);
    30063006    }
    30073007
     
    30203020     * Submit the URB.
    30213021     */
    3022     ohci_in_flight_add_urb(pOhci, pUrb);
     3022    ohci_in_flight_add_urb(pThis, pUrb);
    30233023    Log(("%s: ohciServiceIsochronousTd: submitting cbData=%#x cIsocPkts=%d EdAddr=%#010x TdAddr=%#010x SF=%#x (%#x)\n",
    3024          pUrb->pszDesc, pUrb->cbData, pUrb->cIsocPkts, EdAddr, ITdAddr, pITd->HwInfo & ITD_HWINFO_SF, pOhci->HcFmNumber));
    3025     int rc = VUSBIRhSubmitUrb(pOhci->RootHub.pIRhConn, pUrb, &pOhci->RootHub.Led);
     3024         pUrb->pszDesc, pUrb->cbData, pUrb->cIsocPkts, EdAddr, ITdAddr, pITd->HwInfo & ITD_HWINFO_SF, pThis->HcFmNumber));
     3025    int rc = VUSBIRhSubmitUrb(pThis->RootHub.pIRhConn, pUrb, &pThis->RootHub.Led);
    30263026    if (RT_SUCCESS(rc))
    30273027        return true;
     
    30303030    Log(("ohciServiceIsochronousTd: failed submitting pUrb=%p cbData=%#x EdAddr=%#010x cTds=%d ITdAddr0=%#010x - rc=%Rrc\n",
    30313031         pUrb, cbTotal, EdAddr, 1, ITdAddr, rc));
    3032     ohci_in_flight_remove(pOhci, ITdAddr);
     3032    ohci_in_flight_remove(pThis, ITdAddr);
    30333033    return false;
    30343034}
     
    30383038 * Service an isochronous endpoint.
    30393039 */
    3040 static void ohciServiceIsochronousEndpoint(POHCI pOhci, POHCIED pEd, uint32_t EdAddr)
     3040static void ohciServiceIsochronousEndpoint(POHCI pThis, POHCIED pEd, uint32_t EdAddr)
    30413041{
    30423042    /*
     
    30623062    uint32_t ITdAddrPrev = 0;
    30633063    uint32_t u32NextFrame = UINT32_MAX;
    3064     const uint16_t u16CurFrame = pOhci->HcFmNumber;
     3064    const uint16_t u16CurFrame = pThis->HcFmNumber;
    30653065    for (;;)
    30663066    {
     
    30743074         * is difficult enough as it is.
    30753075         */
    3076         pOhci->fIdle = false;
     3076        pThis->fIdle = false;
    30773077
    30783078        /*
    30793079         * Read the current ITD and check what we're supposed to do about it.
    30803080         */
    3081         ohciReadITd(pOhci, ITdAddr, &ITd);
     3081        ohciReadITd(pThis, ITdAddr, &ITd);
    30823082        const uint32_t  ITdAddrNext = ITd.NextTD & ED_PTR_MASK;
    30833083        const int16_t   R = u16CurFrame - (uint16_t)(ITd.HwInfo & ITD_HWINFO_SF); /* 4.3.2.3 */
     
    30963096                &&  (uint16_t)u32NextFrame != (uint16_t)(ITd.HwInfo & ITD_HWINFO_SF))
    30973097                break;
    3098             if (ohci_in_flight_find(pOhci, ITdAddr) < 0)
    3099                 if (!ohciServiceIsochronousTd(pOhci, &ITd, ITdAddr, R < 0 ? 0 : R, pEd, EdAddr))
     3098            if (ohci_in_flight_find(pThis, ITdAddr) < 0)
     3099                if (!ohciServiceIsochronousTd(pThis, &ITd, ITdAddr, R < 0 ? 0 : R, pEd, EdAddr))
    31003100                    break;
    31013101
     
    31183118             * time will show.
    31193119             */
    3120             int iInFlight = ohci_in_flight_find(pOhci, ITdAddr);
     3120            int iInFlight = ohci_in_flight_find(pThis, ITdAddr);
    31213121            if (iInFlight >= 0)
    31223122                ITdAddrPrev = ITdAddr;
    3123             else if (!ohciServiceIsochronousTdUnlink(pOhci, &ITd, ITdAddr, ITdAddrPrev,
     3123            else if (!ohciServiceIsochronousTdUnlink(pThis, &ITd, ITdAddr, ITdAddrPrev,
    31243124                                                     NULL, pEd, EdAddr))
    31253125            {
     
    31363136             * are successful with the first URB but then it goes too slowly...
    31373137             */
    3138             int iInFlight = ohci_in_flight_find(pOhci, ITdAddr);
    3139             if (!ohciServiceIsochronousTdUnlink(pOhci, &ITd, ITdAddr, ITdAddrPrev,
    3140                                                 iInFlight < 0 ? NULL : pOhci->aInFlight[iInFlight].pUrb,
     3138            int iInFlight = ohci_in_flight_find(pThis, ITdAddr);
     3139            if (!ohciServiceIsochronousTdUnlink(pThis, &ITd, ITdAddr, ITdAddrPrev,
     3140                                                iInFlight < 0 ? NULL : pThis->aInFlight[iInFlight].pUrb,
    31413141                                                pEd, EdAddr))
    31423142            {
     
    31873187 * derived from USB tracing done in the guests and guest source code (when available).
    31883188 */
    3189 static void ohciServiceBulkList(POHCI pOhci)
     3189static void ohciServiceBulkList(POHCI pThis)
    31903190{
    31913191#ifdef LOG_ENABLED
    31923192    if (g_fLogBulkEPs)
    3193         ohciDumpEdList(pOhci, pOhci->bulk_head, "Bulk before", true);
    3194     if (pOhci->bulk_cur)
    3195         Log(("ohciServiceBulkList: bulk_cur=%#010x before listprocessing!!! HCD have positioned us!!!\n", pOhci->bulk_cur));
     3193        ohciDumpEdList(pThis, pThis->bulk_head, "Bulk before", true);
     3194    if (pThis->bulk_cur)
     3195        Log(("ohciServiceBulkList: bulk_cur=%#010x before listprocessing!!! HCD have positioned us!!!\n", pThis->bulk_cur));
    31963196#endif
    31973197
     
    32013201     *   our way thru to the end each time.
    32023202     */
    3203     pOhci->status &= ~OHCI_STATUS_BLF;
    3204     pOhci->fBulkNeedsCleaning = false;
    3205     pOhci->bulk_cur = 0;
    3206 
    3207     uint32_t EdAddr = pOhci->bulk_head;
     3203    pThis->status &= ~OHCI_STATUS_BLF;
     3204    pThis->fBulkNeedsCleaning = false;
     3205    pThis->bulk_cur = 0;
     3206
     3207    uint32_t EdAddr = pThis->bulk_head;
    32083208    while (EdAddr)
    32093209    {
    32103210        OHCIED Ed;
    3211         ohciReadEd(pOhci, EdAddr, &Ed);
     3211        ohciReadEd(pThis, EdAddr, &Ed);
    32123212        Assert(!(Ed.hwinfo & ED_HWINFO_ISO)); /* the guest is screwing us */
    32133213        if (ohciIsEdReady(&Ed))
    32143214        {
    3215             pOhci->status |= OHCI_STATUS_BLF;
    3216             pOhci->fBulkNeedsCleaning = true;
     3215            pThis->status |= OHCI_STATUS_BLF;
     3216            pThis->fBulkNeedsCleaning = true;
    32173217
    32183218#if 1
     
    32253225             * on a bulk endpoint.
    32263226             */
    3227             ohciServiceHeadTdMultiple(pOhci, VUSBXFERTYPE_BULK, &Ed, EdAddr, "Bulk");
     3227            ohciServiceHeadTdMultiple(pThis, VUSBXFERTYPE_BULK, &Ed, EdAddr, "Bulk");
    32283228#else
    32293229            /*
     
    32323232             */
    32333233            uint32_t TdAddr = Ed.HeadP & ED_PTR_MASK;
    3234             if (!ohciIsTdInFlight(pOhci, TdAddr))
     3234            if (!ohciIsTdInFlight(pThis, TdAddr))
    32353235            {
    32363236                do
    32373237                {
    3238                     if (!ohciServiceTdMultiple(pOhci, VUSBXFERTYPE_BULK, &Ed, EdAddr, TdAddr, &TdAddr, "Bulk"))
     3238                    if (!ohciServiceTdMultiple(pThis, VUSBXFERTYPE_BULK, &Ed, EdAddr, TdAddr, &TdAddr, "Bulk"))
    32393239                    {
    32403240                        LogFlow(("ohciServiceBulkList: ohciServiceTdMultiple -> false\n"));
     
    32483248                    }
    32493249
    3250                     ohciReadEd(pOhci, EdAddr, &Ed); /* It might have been updated on URB completion. */
     3250                    ohciReadEd(pThis, EdAddr, &Ed); /* It might have been updated on URB completion. */
    32513251                } while (ohciIsEdReady(&Ed));
    32523252            }
     
    32623262                 */
    32633263                uint32_t TdAddr = Ed.HeadP & ED_PTR_MASK;
    3264                 PVUSBURB pUrb = ohciTdInFlightUrb(pOhci, TdAddr);
     3264                PVUSBURB pUrb = ohciTdInFlightUrb(pThis, TdAddr);
    32653265                if (pUrb)
    3266                     pOhci->RootHub.pIRhConn->pfnCancelUrbsEp(pOhci->RootHub.pIRhConn, pUrb);
     3266                    pThis->RootHub.pIRhConn->pfnCancelUrbsEp(pThis->RootHub.pIRhConn, pUrb);
    32673267            }
    32683268        }
     
    32753275#ifdef LOG_ENABLED
    32763276    if (g_fLogBulkEPs)
    3277         ohciDumpEdList(pOhci, pOhci->bulk_head, "Bulk after ", true);
     3277        ohciDumpEdList(pThis, pThis->bulk_head, "Bulk after ", true);
    32783278#endif
    32793279}
     
    32873287 * and would block further communication.
    32883288 */
    3289 static void ohciUndoBulkList(POHCI pOhci)
     3289static void ohciUndoBulkList(POHCI pThis)
    32903290{
    32913291#ifdef LOG_ENABLED
    32923292    if (g_fLogBulkEPs)
    3293         ohciDumpEdList(pOhci, pOhci->bulk_head, "Bulk before", true);
    3294     if (pOhci->bulk_cur)
    3295         Log(("ohciUndoBulkList: bulk_cur=%#010x before list processing!!! HCD has positioned us!!!\n", pOhci->bulk_cur));
     3293        ohciDumpEdList(pThis, pThis->bulk_head, "Bulk before", true);
     3294    if (pThis->bulk_cur)
     3295        Log(("ohciUndoBulkList: bulk_cur=%#010x before list processing!!! HCD has positioned us!!!\n", pThis->bulk_cur));
    32963296#endif
    32973297
    32983298    /* This flag follows OHCI_STATUS_BLF, but BLF doesn't change when list processing is disabled. */
    3299     pOhci->fBulkNeedsCleaning = false;
    3300 
    3301     uint32_t EdAddr = pOhci->bulk_head;
     3299    pThis->fBulkNeedsCleaning = false;
     3300
     3301    uint32_t EdAddr = pThis->bulk_head;
    33023302    while (EdAddr)
    33033303    {
    33043304        OHCIED Ed;
    3305         ohciReadEd(pOhci, EdAddr, &Ed);
     3305        ohciReadEd(pThis, EdAddr, &Ed);
    33063306        Assert(!(Ed.hwinfo & ED_HWINFO_ISO)); /* the guest is screwing us */
    33073307        if (ohciIsEdPresent(&Ed))
    33083308        {
    33093309            uint32_t TdAddr = Ed.HeadP & ED_PTR_MASK;
    3310             if (ohciIsTdInFlight(pOhci, TdAddr))
     3310            if (ohciIsTdInFlight(pThis, TdAddr))
    33113311            {
    33123312                LogFlow(("ohciUndoBulkList: Ed=%#010RX32 Ed.TailP=%#010RX32 UNDO\n", EdAddr, Ed.TailP));
    3313                 PVUSBURB pUrb = ohciTdInFlightUrb(pOhci, TdAddr);
     3313                PVUSBURB pUrb = ohciTdInFlightUrb(pThis, TdAddr);
    33143314                if (pUrb)
    3315                     pOhci->RootHub.pIRhConn->pfnCancelUrbsEp(pOhci->RootHub.pIRhConn, pUrb);
     3315                    pThis->RootHub.pIRhConn->pfnCancelUrbsEp(pThis->RootHub.pIRhConn, pUrb);
    33163316            }
    33173317        }
     
    33283328 * care of at VUSB level (unlike the other transfer types).
    33293329 */
    3330 static void ohciServiceCtrlList(POHCI pOhci)
     3330static void ohciServiceCtrlList(POHCI pThis)
    33313331{
    33323332#ifdef LOG_ENABLED
    33333333    if (g_fLogControlEPs)
    3334         ohciDumpEdList(pOhci, pOhci->ctrl_head, "Ctrl before", true);
    3335     if (pOhci->ctrl_cur)
    3336         Log(("ohciServiceCtrlList: ctrl_cur=%010x before list processing!!! HCD have positioned us!!!\n", pOhci->ctrl_cur));
     3334        ohciDumpEdList(pThis, pThis->ctrl_head, "Ctrl before", true);
     3335    if (pThis->ctrl_cur)
     3336        Log(("ohciServiceCtrlList: ctrl_cur=%010x before list processing!!! HCD have positioned us!!!\n", pThis->ctrl_cur));
    33373337#endif
    33383338
     
    33423342     *   our way thru to the end each time.
    33433343     */
    3344     pOhci->status &= ~OHCI_STATUS_CLF;
    3345     pOhci->ctrl_cur = 0;
    3346 
    3347     uint32_t EdAddr = pOhci->ctrl_head;
     3344    pThis->status &= ~OHCI_STATUS_CLF;
     3345    pThis->ctrl_cur = 0;
     3346
     3347    uint32_t EdAddr = pThis->ctrl_head;
    33483348    while (EdAddr)
    33493349    {
    33503350        OHCIED Ed;
    3351         ohciReadEd(pOhci, EdAddr, &Ed);
     3351        ohciReadEd(pThis, EdAddr, &Ed);
    33523352        Assert(!(Ed.hwinfo & ED_HWINFO_ISO)); /* the guest is screwing us */
    33533353        if (ohciIsEdReady(&Ed))
     
    33623362            do
    33633363            {
    3364                 if (    !ohciServiceHeadTd(pOhci, VUSBXFERTYPE_CTRL, &Ed, EdAddr, "Control")
    3365                     ||  ohciIsTdInFlight(pOhci, Ed.HeadP & ED_PTR_MASK))
     3364                if (    !ohciServiceHeadTd(pThis, VUSBXFERTYPE_CTRL, &Ed, EdAddr, "Control")
     3365                    ||  ohciIsTdInFlight(pThis, Ed.HeadP & ED_PTR_MASK))
    33663366                {
    3367                     pOhci->status |= OHCI_STATUS_CLF;
     3367                    pThis->status |= OHCI_STATUS_CLF;
    33683368                    break;
    33693369                }
    3370                 ohciReadEd(pOhci, EdAddr, &Ed); /* It might have been updated on URB completion. */
     3370                ohciReadEd(pThis, EdAddr, &Ed); /* It might have been updated on URB completion. */
    33713371            } while (ohciIsEdReady(&Ed));
    33723372#else
    33733373            /* Simplistic, for debugging. */
    3374             ohciServiceHeadTd(pOhci, VUSBXFERTYPE_CTRL, &Ed, EdAddr, "Control");
    3375             pOhci->status |= OHCI_STATUS_CLF;
     3374            ohciServiceHeadTd(pThis, VUSBXFERTYPE_CTRL, &Ed, EdAddr, "Control");
     3375            pThis->status |= OHCI_STATUS_CLF;
    33763376#endif
    33773377        }
     
    33833383#ifdef LOG_ENABLED
    33843384    if (g_fLogControlEPs)
    3385         ohciDumpEdList(pOhci, pOhci->ctrl_head, "Ctrl after ", true);
     3385        ohciDumpEdList(pThis, pThis->ctrl_head, "Ctrl after ", true);
    33863386#endif
    33873387}
     
    33953395 * code (when available).
    33963396 */
    3397 static void ohciServicePeriodicList(POHCI pOhci)
     3397static void ohciServicePeriodicList(POHCI pThis)
    33983398{
    33993399    /*
    34003400     * Read the list head from the HCCA.
    34013401     */
    3402     const unsigned  iList = pOhci->HcFmNumber % OHCI_HCCA_NUM_INTR;
     3402    const unsigned  iList = pThis->HcFmNumber % OHCI_HCCA_NUM_INTR;
    34033403    uint32_t        EdAddr;
    3404     ohciGetDWords(pOhci, pOhci->hcca + iList * sizeof(EdAddr), &EdAddr, 1);
     3404    ohciGetDWords(pThis, pThis->hcca + iList * sizeof(EdAddr), &EdAddr, 1);
    34053405
    34063406#ifdef LOG_ENABLED
     
    34103410        char sz[48];
    34113411        RTStrPrintf(sz, sizeof(sz), "Int%02x before", iList);
    3412         ohciDumpEdList(pOhci, EdAddrHead, sz, true);
     3412        ohciDumpEdList(pThis, EdAddrHead, sz, true);
    34133413    }
    34143414#endif
     
    34203420    {
    34213421        OHCIED Ed;
    3422         ohciReadEd(pOhci, EdAddr, &Ed);
     3422        ohciReadEd(pThis, EdAddr, &Ed);
    34233423
    34243424        if (ohciIsEdReady(&Ed))
     
    34343434                 * Presently we will only process the head URB on an interrupt endpoint.
    34353435                 */
    3436                 ohciServiceHeadTdMultiple(pOhci, VUSBXFERTYPE_INTR, &Ed, EdAddr, "Periodic");
     3436                ohciServiceHeadTdMultiple(pThis, VUSBXFERTYPE_INTR, &Ed, EdAddr, "Periodic");
    34373437            }
    3438             else if (pOhci->ctl & OHCI_CTL_IE)
     3438            else if (pThis->ctl & OHCI_CTL_IE)
    34393439            {
    34403440                /*
    34413441                 * Presently only the head ITD.
    34423442                 */
    3443                 ohciServiceIsochronousEndpoint(pOhci, &Ed, EdAddr);
     3443                ohciServiceIsochronousEndpoint(pThis, &Ed, EdAddr);
    34443444            }
    34453445            else
     
    34563456        char sz[48];
    34573457        RTStrPrintf(sz, sizeof(sz), "Int%02x after ", iList);
    3458         ohciDumpEdList(pOhci, EdAddrHead, sz, true);
     3458        ohciDumpEdList(pThis, EdAddrHead, sz, true);
    34593459    }
    34603460#endif
     
    34653465 * Update the HCCA.
    34663466 *
    3467  * @param   pOhci   The OHCI instance data.
    3468  */
    3469 static void ohciUpdateHCCA(POHCI pOhci)
     3467 * @param   pThis   The OHCI instance data.
     3468 */
     3469static void ohciUpdateHCCA(POHCI pThis)
    34703470{
    34713471    struct ohci_hcca hcca;
    3472     ohciPhysRead(pOhci, pOhci->hcca + OHCI_HCCA_OFS, &hcca, sizeof(hcca));
    3473 
    3474     hcca.frame = RT_H2LE_U16((uint16_t)pOhci->HcFmNumber);
     3472    ohciPhysRead(pThis, pThis->hcca + OHCI_HCCA_OFS, &hcca, sizeof(hcca));
     3473
     3474    hcca.frame = RT_H2LE_U16((uint16_t)pThis->HcFmNumber);
    34753475    hcca.pad = 0;
    34763476
    34773477    bool fWriteDoneHeadInterrupt = false;
    3478     if (    pOhci->dqic == 0
    3479         &&  (pOhci->intr_status & OHCI_INTR_WRITE_DONE_HEAD) == 0)
    3480     {
    3481         uint32_t done = pOhci->done;
    3482 
    3483         if (pOhci->intr_status & ~(  OHCI_INTR_MASTER_INTERRUPT_ENABLED | OHCI_INTR_OWNERSHIP_CHANGE
     3478    if (    pThis->dqic == 0
     3479        &&  (pThis->intr_status & OHCI_INTR_WRITE_DONE_HEAD) == 0)
     3480    {
     3481        uint32_t done = pThis->done;
     3482
     3483        if (pThis->intr_status & ~(  OHCI_INTR_MASTER_INTERRUPT_ENABLED | OHCI_INTR_OWNERSHIP_CHANGE
    34843484                                   | OHCI_INTR_WRITE_DONE_HEAD) )
    34853485            done |= 0x1;
    34863486
    34873487        hcca.done = RT_H2LE_U32(done);
    3488         pOhci->done = 0;
    3489         pOhci->dqic = 0x7;
     3488        pThis->done = 0;
     3489        pThis->dqic = 0x7;
    34903490
    34913491        Log(("ohci: Writeback Done (%#010x) on frame %#x (age %#x)\n", hcca.done,
    3492              pOhci->HcFmNumber, pOhci->HcFmNumber - pOhci->u32FmDoneQueueTail));
     3492             pThis->HcFmNumber, pThis->HcFmNumber - pThis->u32FmDoneQueueTail));
    34933493#ifdef LOG_ENABLED
    3494         ohciDumpTdQueue(pOhci, hcca.done & ED_PTR_MASK, "DoneQueue");
     3494        ohciDumpTdQueue(pThis, hcca.done & ED_PTR_MASK, "DoneQueue");
    34953495#endif
    34963496        Assert(RT_OFFSETOF(struct ohci_hcca, done) == 4);
    34973497#if defined(VBOX_STRICT) || defined(LOG_ENABLED)
    3498         ohci_in_done_queue_zap(pOhci);
     3498        ohci_in_done_queue_zap(pThis);
    34993499#endif
    35003500        fWriteDoneHeadInterrupt = true;
    35013501    }
    35023502
    3503     ohciPhysWrite(pOhci, pOhci->hcca + OHCI_HCCA_OFS, (uint8_t *)&hcca, sizeof(hcca));
     3503    ohciPhysWrite(pThis, pThis->hcca + OHCI_HCCA_OFS, (uint8_t *)&hcca, sizeof(hcca));
    35043504    if (fWriteDoneHeadInterrupt)
    3505         ohciSetInterrupt(pOhci, OHCI_INTR_WRITE_DONE_HEAD);
     3505        ohciSetInterrupt(pThis, OHCI_INTR_WRITE_DONE_HEAD);
    35063506}
    35073507
     
    35103510 * Calculate frame timer variables given a frame rate (1,000 Hz is the full speed).
    35113511 */
    3512 static void ohciCalcTimerIntervals(POHCI pOhci, uint32_t u32FrameRate)
     3512static void ohciCalcTimerIntervals(POHCI pThis, uint32_t u32FrameRate)
    35133513{
    35143514    Assert(u32FrameRate <= OHCI_DEFAULT_TIMER_FREQ);
    35153515
    35163516
    3517     pOhci->cTicksPerFrame = pOhci->u64TimerHz / u32FrameRate;
    3518     if (!pOhci->cTicksPerFrame)
    3519         pOhci->cTicksPerFrame = 1;
    3520     pOhci->cTicksPerUsbTick   = pOhci->u64TimerHz >= VUSB_BUS_HZ ? pOhci->u64TimerHz / VUSB_BUS_HZ : 1;
    3521     pOhci->uFrameRate         = u32FrameRate;
     3517    pThis->cTicksPerFrame = pThis->u64TimerHz / u32FrameRate;
     3518    if (!pThis->cTicksPerFrame)
     3519        pThis->cTicksPerFrame = 1;
     3520    pThis->cTicksPerUsbTick   = pThis->u64TimerHz >= VUSB_BUS_HZ ? pThis->u64TimerHz / VUSB_BUS_HZ : 1;
     3521    pThis->uFrameRate         = u32FrameRate;
    35223522}
    35233523
     
    35263526 * Generate a Start-Of-Frame event, and set a timer for End-Of-Frame.
    35273527 */
    3528 static void ohciStartOfFrame(POHCI pOhci)
    3529 {
    3530     uint32_t    uNewFrameRate = pOhci->uFrameRate;
     3528static void ohciStartOfFrame(POHCI pThis)
     3529{
     3530    uint32_t    uNewFrameRate = pThis->uFrameRate;
    35313531#ifdef LOG_ENABLED
    3532     const uint32_t status_old = pOhci->status;
     3532    const uint32_t status_old = pThis->status;
    35333533#endif
    35343534
     
    35363536     * Update HcFmRemaining.FRT and re-arm the timer.
    35373537     */
    3538     pOhci->frt = pOhci->fit;
     3538    pThis->frt = pThis->fit;
    35393539#if 1 /* This is required for making the quickcam work on the mac. Should really look
    35403540         into that adaptive polling stuff... */
    3541     pOhci->SofTime += pOhci->cTicksPerFrame;
    3542     const uint64_t u64Now = TMTimerGet(pOhci->CTX_SUFF(pEndOfFrameTimer));
    3543     if (pOhci->SofTime + pOhci->cTicksPerFrame < u64Now)
    3544         pOhci->SofTime = u64Now - pOhci->cTicksPerFrame / 2;
     3541    pThis->SofTime += pThis->cTicksPerFrame;
     3542    const uint64_t u64Now = TMTimerGet(pThis->CTX_SUFF(pEndOfFrameTimer));
     3543    if (pThis->SofTime + pThis->cTicksPerFrame < u64Now)
     3544        pThis->SofTime = u64Now - pThis->cTicksPerFrame / 2;
    35453545#else
    3546     pOhci->SofTime = TMTimerGet(pOhci->CTX_SUFF(pEndOfFrameTimer));
     3546    pThis->SofTime = TMTimerGet(pThis->CTX_SUFF(pEndOfFrameTimer));
    35473547#endif
    3548     TMTimerSet(pOhci->CTX_SUFF(pEndOfFrameTimer), pOhci->SofTime + pOhci->cTicksPerFrame);
     3548    TMTimerSet(pThis->CTX_SUFF(pEndOfFrameTimer), pThis->SofTime + pThis->cTicksPerFrame);
    35493549
    35503550    /*
     
    35523552     * the bus with a hcca of 0 to work around problem with a specific controller.
    35533553     */
    3554     bool fValidHCCA = !(    pOhci->hcca >= OHCI_HCCA_MASK
    3555                         ||  pOhci->hcca < ~OHCI_HCCA_MASK);
     3554    bool fValidHCCA = !(    pThis->hcca >= OHCI_HCCA_MASK
     3555                        ||  pThis->hcca < ~OHCI_HCCA_MASK);
    35563556
    35573557#if 0 /* moved down for higher speed. */
     
    35613561     */
    35623562    if (fValidHCCA)
    3563         ohciUpdateHCCA(pOhci);
     3563        ohciUpdateHCCA(pThis);
    35643564#endif
    35653565
    35663566    /* "After writing to HCCA, HC will set SF in HcInterruptStatus" - guest isn't executing, so ignore the order! */
    3567     ohciSetInterrupt(pOhci, OHCI_INTR_START_OF_FRAME);
    3568 
    3569     if (pOhci->fno)
    3570     {
    3571         ohciSetInterrupt(pOhci, OHCI_INTR_FRAMENUMBER_OVERFLOW);
    3572         pOhci->fno = 0;
     3567    ohciSetInterrupt(pThis, OHCI_INTR_START_OF_FRAME);
     3568
     3569    if (pThis->fno)
     3570    {
     3571        ohciSetInterrupt(pThis, OHCI_INTR_FRAMENUMBER_OVERFLOW);
     3572        pThis->fno = 0;
    35733573    }
    35743574
     
    35773577    {
    35783578        Log(("ohciStartOfFrame: skipping hcca part because hcca=%RX32 (our 'valid' range: %RX32-%RX32)\n",
    3579              pOhci->hcca, ~OHCI_HCCA_MASK, OHCI_HCCA_MASK));
     3579             pThis->hcca, ~OHCI_HCCA_MASK, OHCI_HCCA_MASK));
    35803580        return;
    35813581    }
     
    35843584     * Periodic EPs.
    35853585     */
    3586     if (pOhci->ctl & OHCI_CTL_PLE)
    3587         ohciServicePeriodicList(pOhci);
     3586    if (pThis->ctl & OHCI_CTL_PLE)
     3587        ohciServicePeriodicList(pThis);
    35883588
    35893589    /*
    35903590     * Control EPs.
    35913591     */
    3592     if (    (pOhci->ctl & OHCI_CTL_CLE)
    3593         &&  (pOhci->status & OHCI_STATUS_CLF) )
    3594         ohciServiceCtrlList(pOhci);
     3592    if (    (pThis->ctl & OHCI_CTL_CLE)
     3593        &&  (pThis->status & OHCI_STATUS_CLF) )
     3594        ohciServiceCtrlList(pThis);
    35953595
    35963596    /*
    35973597     * Bulk EPs.
    35983598     */
    3599     if (    (pOhci->ctl & OHCI_CTL_BLE)
    3600         &&  (pOhci->status & OHCI_STATUS_BLF))
    3601         ohciServiceBulkList(pOhci);
    3602     else if ((pOhci->status & OHCI_STATUS_BLF)
    3603         &&    pOhci->fBulkNeedsCleaning)
    3604         ohciUndoBulkList(pOhci);    /* If list disabled but not empty, abort endpoints. */
     3599    if (    (pThis->ctl & OHCI_CTL_BLE)
     3600        &&  (pThis->status & OHCI_STATUS_BLF))
     3601        ohciServiceBulkList(pThis);
     3602    else if ((pThis->status & OHCI_STATUS_BLF)
     3603        &&    pThis->fBulkNeedsCleaning)
     3604        ohciUndoBulkList(pThis);    /* If list disabled but not empty, abort endpoints. */
    36053605
    36063606#if 1
     
    36183618     * as it was submitted.
    36193619     */
    3620     ohciUpdateHCCA(pOhci);
     3620    ohciUpdateHCCA(pThis);
    36213621#endif
    36223622
    36233623#ifdef LOG_ENABLED
    3624     if (pOhci->status ^ status_old)
    3625     {
    3626         uint32_t val = pOhci->status;
     3624    if (pThis->status ^ status_old)
     3625    {
     3626        uint32_t val = pThis->status;
    36273627        uint32_t chg = val ^ status_old; NOREF(chg);
    36283628        Log2(("ohciStartOfFrame: HcCommandStatus=%#010x: %sHCR=%d %sCLF=%d %sBLF=%d %sOCR=%d %sSOC=%d\n",
     
    36393639     * Adjust the frame timer interval based on idle detection.
    36403640     */
    3641     if (pOhci->fIdle)
    3642     {
    3643         pOhci->cIdleCycles++;
     3641    if (pThis->fIdle)
     3642    {
     3643        pThis->cIdleCycles++;
    36443644        /* Set the new frame rate based on how long we've been idle. Tunable. */
    3645         switch (pOhci->cIdleCycles)
     3645        switch (pThis->cIdleCycles)
    36463646        {
    36473647        case 4: uNewFrameRate = 500;    break;  /*  2ms interval */
     
    36513651        }
    36523652        /* Avoid overflow. */
    3653         if (pOhci->cIdleCycles > 60000)
    3654             pOhci->cIdleCycles = 20000;
     3653        if (pThis->cIdleCycles > 60000)
     3654            pThis->cIdleCycles = 20000;
    36553655    }
    36563656    else
    36573657    {
    3658         if (pOhci->cIdleCycles)
     3658        if (pThis->cIdleCycles)
    36593659        {
    3660             pOhci->cIdleCycles = 0;
     3660            pThis->cIdleCycles = 0;
    36613661            uNewFrameRate      = OHCI_DEFAULT_TIMER_FREQ;
    36623662        }
    36633663    }
    3664     if (uNewFrameRate != pOhci->uFrameRate)
    3665     {
    3666         ohciCalcTimerIntervals(pOhci, uNewFrameRate);
     3664    if (uNewFrameRate != pThis->uFrameRate)
     3665    {
     3666        ohciCalcTimerIntervals(pThis, uNewFrameRate);
    36673667        if (uNewFrameRate == OHCI_DEFAULT_TIMER_FREQ)
    36683668        {
    36693669            /* If we're switching back to full speed, re-program the timer immediately to minimize latency. */
    3670             TMTimerSet(pOhci->CTX_SUFF(pEndOfFrameTimer), pOhci->SofTime + pOhci->cTicksPerFrame);
     3670            TMTimerSet(pThis->CTX_SUFF(pEndOfFrameTimer), pThis->SofTime + pThis->cTicksPerFrame);
    36713671        }
    36723672    }
     
    36763676 * Updates the HcFmNumber and FNO registers.
    36773677 */
    3678 static void bump_frame_number(POHCI pOhci)
    3679 {
    3680     const uint16_t u16OldFmNumber = pOhci->HcFmNumber++;
    3681     if ((u16OldFmNumber ^ pOhci->HcFmNumber) & RT_BIT(15))
    3682         pOhci->fno = 1;
     3678static void bump_frame_number(POHCI pThis)
     3679{
     3680    const uint16_t u16OldFmNumber = pThis->HcFmNumber++;
     3681    if ((u16OldFmNumber ^ pThis->HcFmNumber) & RT_BIT(15))
     3682        pThis->fno = 1;
    36833683}
    36843684
     
    36883688static void ohciFrameBoundaryTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
    36893689{
    3690     POHCI pOhci = (POHCI)pvUser;
    3691     STAM_PROFILE_START(&pOhci->StatTimer, a);
     3690    POHCI pThis = (POHCI)pvUser;
     3691    STAM_PROFILE_START(&pThis->StatTimer, a);
    36923692
    36933693    /* Reset idle detection flag */
    3694     pOhci->fIdle = true;
    3695 
    3696     VUSBIRhReapAsyncUrbs(pOhci->RootHub.pIRhConn, 0);
     3694    pThis->fIdle = true;
     3695
     3696    VUSBIRhReapAsyncUrbs(pThis->RootHub.pIRhConn, 0);
    36973697
    36983698    /* Frame boundary, so do EOF stuff here */
    3699     bump_frame_number(pOhci);
    3700     if ( (pOhci->dqic != 0x7) && (pOhci->dqic != 0) )
    3701         pOhci->dqic--;
     3699    bump_frame_number(pThis);
     3700    if ( (pThis->dqic != 0x7) && (pThis->dqic != 0) )
     3701        pThis->dqic--;
    37023702
    37033703    /* Start the next frame */
    3704     ohciStartOfFrame(pOhci);
    3705 
    3706     STAM_PROFILE_STOP(&pOhci->StatTimer, a);
     3704    ohciStartOfFrame(pThis);
     3705
     3706    STAM_PROFILE_STOP(&pThis->StatTimer, a);
    37073707}
    37083708
     
    37113711 * next frame
    37123712 */
    3713 static void ohciBusStart(POHCI pOhci)
    3714 {
    3715     VUSBIDevPowerOn(pOhci->RootHub.pIDev);
    3716     bump_frame_number(pOhci);
    3717     pOhci->dqic = 0x7;
    3718 
    3719     Log(("ohci: %s: Bus started\n", pOhci->PciDev.name));
    3720 
    3721     pOhci->SofTime = TMTimerGet(pOhci->CTX_SUFF(pEndOfFrameTimer)) - pOhci->cTicksPerFrame;
    3722     pOhci->fIdle = false;   /* Assume we won't be idle */
    3723     ohciStartOfFrame(pOhci);
     3713static void ohciBusStart(POHCI pThis)
     3714{
     3715    VUSBIDevPowerOn(pThis->RootHub.pIDev);
     3716    bump_frame_number(pThis);
     3717    pThis->dqic = 0x7;
     3718
     3719    Log(("ohci: %s: Bus started\n", pThis->PciDev.name));
     3720
     3721    pThis->SofTime = TMTimerGet(pThis->CTX_SUFF(pEndOfFrameTimer)) - pThis->cTicksPerFrame;
     3722    pThis->fIdle = false;   /* Assume we won't be idle */
     3723    ohciStartOfFrame(pThis);
    37243724}
    37253725
     
    37273727 * Stop sending SOF tokens on the bus
    37283728 */
    3729 static void ohciBusStop(POHCI pOhci)
    3730 {
    3731     if (pOhci->CTX_SUFF(pEndOfFrameTimer))
    3732         TMTimerStop(pOhci->CTX_SUFF(pEndOfFrameTimer));
    3733     VUSBIDevPowerOff(pOhci->RootHub.pIDev);
     3729static void ohciBusStop(POHCI pThis)
     3730{
     3731    if (pThis->CTX_SUFF(pEndOfFrameTimer))
     3732        TMTimerStop(pThis->CTX_SUFF(pEndOfFrameTimer));
     3733    VUSBIDevPowerOff(pThis->RootHub.pIDev);
    37343734}
    37353735
     
    37373737 * Move in to resume state
    37383738 */
    3739 static void ohciBusResume(POHCI pOhci, bool fHardware)
    3740 {
    3741     pOhci->ctl &= ~OHCI_CTL_HCFS;
    3742     pOhci->ctl |= OHCI_USB_RESUME;
    3743 
    3744     Log(("pOhci: ohciBusResume fHardware=%RTbool RWE=%s\n",
    3745          fHardware, (pOhci->ctl & OHCI_CTL_RWE) ? "on" : "off"));
    3746 
    3747     if (fHardware && (pOhci->ctl & OHCI_CTL_RWE))
    3748         ohciSetInterrupt(pOhci, OHCI_INTR_RESUME_DETECT);
    3749 
    3750     ohciBusStart(pOhci);
     3739static void ohciBusResume(POHCI pThis, bool fHardware)
     3740{
     3741    pThis->ctl &= ~OHCI_CTL_HCFS;
     3742    pThis->ctl |= OHCI_USB_RESUME;
     3743
     3744    Log(("pThis: ohciBusResume fHardware=%RTbool RWE=%s\n",
     3745         fHardware, (pThis->ctl & OHCI_CTL_RWE) ? "on" : "off"));
     3746
     3747    if (fHardware && (pThis->ctl & OHCI_CTL_RWE))
     3748        ohciSetInterrupt(pThis, OHCI_INTR_RESUME_DETECT);
     3749
     3750    ohciBusStart(pThis);
    37513751}
    37523752
     
    37843784 * Read the HcRevision register.
    37853785 */
    3786 static int HcRevision_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
     3786static int HcRevision_r(PCOHCI pThis, uint32_t iReg, uint32_t *pu32Value)
    37873787{
    37883788    Log2(("HcRevision_r() -> 0x10\n"));
     
    37943794 * Write to the HcRevision register.
    37953795 */
    3796 static int HcRevision_w(POHCI pOhci, uint32_t iReg, uint32_t u32Value)
     3796static int HcRevision_w(POHCI pThis, uint32_t iReg, uint32_t u32Value)
    37973797{
    37983798    Log2(("HcRevision_w(%#010x) - denied\n", u32Value));
     
    38043804 * Read the HcControl register.
    38053805 */
    3806 static int HcControl_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    3807 {
    3808     uint32_t ctl = pOhci->ctl;
     3806static int HcControl_r(PCOHCI pThis, uint32_t iReg, uint32_t *pu32Value)
     3807{
     3808    uint32_t ctl = pThis->ctl;
    38093809    Log2(("HcControl_r -> %#010x - CBSR=%d PLE=%d IE=%d CLE=%d BLE=%d HCFS=%#x IR=%d RWC=%d RWE=%d\n",
    38103810          ctl, ctl & 3, (ctl >> 2) & 1, (ctl >> 3) & 1, (ctl >> 4) & 1, (ctl >> 5) & 1, (ctl >> 6) & 3, (ctl >> 8) & 1,
     
    38173817 * Write the HcControl register.
    38183818 */
    3819 static int HcControl_w(POHCI pOhci, uint32_t iReg, uint32_t val)
     3819static int HcControl_w(POHCI pThis, uint32_t iReg, uint32_t val)
    38203820{
    38213821    /* log it. */
    3822     uint32_t chg = pOhci->ctl ^ val; NOREF(chg);
     3822    uint32_t chg = pThis->ctl ^ val; NOREF(chg);
    38233823    Log2(("HcControl_w(%#010x) => %sCBSR=%d %sPLE=%d %sIE=%d %sCLE=%d %sBLE=%d %sHCFS=%#x %sIR=%d %sRWC=%d %sRWE=%d\n",
    38243824          val,
     
    38363836
    38373837    /* see what changed and take action on that. */
    3838     uint32_t old_state = pOhci->ctl & OHCI_CTL_HCFS;
     3838    uint32_t old_state = pThis->ctl & OHCI_CTL_HCFS;
    38393839    uint32_t new_state = val & OHCI_CTL_HCFS;
    38403840
    38413841#ifdef IN_RING3
    3842     pOhci->ctl = val;
     3842    pThis->ctl = val;
    38433843    if (new_state != old_state)
    38443844    {
     
    38473847            case OHCI_USB_OPERATIONAL:
    38483848                LogRel(("OHCI: USB Operational\n"));
    3849                 ohciBusStart(pOhci);
     3849                ohciBusStart(pThis);
    38503850                break;
    38513851            case OHCI_USB_SUSPEND:
    3852                 ohciBusStop(pOhci);
     3852                ohciBusStop(pThis);
    38533853                LogRel(("OHCI: USB Suspended\n"));
    38543854                break;
    38553855            case OHCI_USB_RESUME:
    38563856                LogRel(("OHCI: USB Resume\n"));
    3857                 ohciBusResume(pOhci, false /* not hardware */);
     3857                ohciBusResume(pThis, false /* not hardware */);
    38583858                break;
    38593859            case OHCI_USB_RESET:
    38603860            {
    38613861                LogRel(("OHCI: USB Reset\n"));
    3862                 ohciBusStop(pOhci);
     3862                ohciBusStop(pThis);
    38633863                /** @todo This should probably do a real reset, but we don't implement
    38643864                 * that correctly in the roothub reset callback yet. check it's
    38653865                 * comments and argument for more details. */
    3866                 VUSBIDevReset(pOhci->RootHub.pIDev, false /* don't do a real reset */, NULL, NULL, NULL);
     3866                VUSBIDevReset(pThis->RootHub.pIDev, false /* don't do a real reset */, NULL, NULL, NULL);
    38673867                break;
    38683868            }
     
    38753875        return VINF_IOM_R3_MMIO_WRITE;
    38763876    }
    3877     pOhci->ctl = val;
     3877    pThis->ctl = val;
    38783878#endif /* !IN_RING3 */
    38793879
     
    38843884 * Read the HcCommandStatus register.
    38853885 */
    3886 static int HcCommandStatus_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    3887 {
    3888     uint32_t status = pOhci->status;
     3886static int HcCommandStatus_r(PCOHCI pThis, uint32_t iReg, uint32_t *pu32Value)
     3887{
     3888    uint32_t status = pThis->status;
    38893889    Log2(("HcCommandStatus_r() -> %#010x - HCR=%d CLF=%d BLF=%d OCR=%d SOC=%d\n",
    38903890          status, status & 1, (status >> 1) & 1, (status >> 2) & 1, (status >> 3) & 1, (status >> 16) & 3));
     
    38963896 * Write to the HcCommandStatus register.
    38973897 */
    3898 static int HcCommandStatus_w(POHCI pOhci, uint32_t iReg, uint32_t val)
     3898static int HcCommandStatus_w(POHCI pThis, uint32_t iReg, uint32_t val)
    38993899{
    39003900    /* log */
    3901     uint32_t chg = pOhci->status ^ val; NOREF(chg);
     3901    uint32_t chg = pThis->status ^ val; NOREF(chg);
    39023902    Log2(("HcCommandStatus_w(%#010x) => %sHCR=%d %sCLF=%d %sBLF=%d %sOCR=%d %sSOC=%d\n",
    39033903          val,
     
    39063906          chg & RT_BIT(2) ? "*" : "", (val >> 2) & 1,
    39073907          chg & RT_BIT(3) ? "*" : "", (val >> 3) & 1,
    3908           chg & (3<<16)? "!!!":"", (pOhci->status >> 16) & 3));
     3908          chg & (3<<16)? "!!!":"", (pThis->status >> 16) & 3));
    39093909    if (val & ~0x0003000f)
    39103910        Log2(("Unknown bits %#x are set!!!\n", val & ~0x0003000f));
     
    39153915#ifdef IN_RING3
    39163916    /* "bits written as '0' remain unchanged in the register" */
    3917     pOhci->status |= val;
    3918     if (pOhci->status & OHCI_STATUS_HCR)
     3917    pThis->status |= val;
     3918    if (pThis->status & OHCI_STATUS_HCR)
    39193919    {
    39203920        LogRel(("OHCI: Software reset\n"));
    3921         ohciDoReset(pOhci, OHCI_USB_SUSPEND, false /* N/A */);
     3921        ohciDoReset(pThis, OHCI_USB_SUSPEND, false /* N/A */);
    39223922    }
    39233923#else
    3924     if ((pOhci->status | val) & OHCI_STATUS_HCR)
     3924    if ((pThis->status | val) & OHCI_STATUS_HCR)
    39253925    {
    39263926        LogFlow(("HcCommandStatus_w: reset -> VINF_IOM_R3_MMIO_WRITE\n"));
    39273927        return VINF_IOM_R3_MMIO_WRITE;
    39283928    }
    3929     pOhci->status |= val;
     3929    pThis->status |= val;
    39303930#endif
    39313931    return VINF_SUCCESS;
     
    39353935 * Read the HcInterruptStatus register.
    39363936 */
    3937 static int HcInterruptStatus_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    3938 {
    3939     uint32_t val = pOhci->intr_status;
     3937static int HcInterruptStatus_r(PCOHCI pThis, uint32_t iReg, uint32_t *pu32Value)
     3938{
     3939    uint32_t val = pThis->intr_status;
    39403940    Log2(("HcInterruptStatus_r() -> %#010x - SO=%d WDH=%d SF=%d RD=%d UE=%d FNO=%d RHSC=%d OC=%d\n",
    39413941          val, val & 1, (val >> 1) & 1, (val >> 2) & 1, (val >> 3) & 1, (val >> 4) & 1, (val >> 5) & 1,
     
    39483948 * Write to the HcInterruptStatus register.
    39493949 */
    3950 static int HcInterruptStatus_w(POHCI pOhci, uint32_t iReg, uint32_t val)
    3951 {
    3952     uint32_t res = pOhci->intr_status & ~val;
    3953     uint32_t chg = pOhci->intr_status ^ res; NOREF(chg);
     3950static int HcInterruptStatus_w(POHCI pThis, uint32_t iReg, uint32_t val)
     3951{
     3952    uint32_t res = pThis->intr_status & ~val;
     3953    uint32_t chg = pThis->intr_status ^ res; NOREF(chg);
    39543954    Log2(("HcInterruptStatus_w(%#010x) => %sSO=%d %sWDH=%d %sSF=%d %sRD=%d %sUE=%d %sFNO=%d %sRHSC=%d %sOC=%d\n",
    39553955          val,
     
    39693969     * register by writing '1' to bit positions to be cleared"
    39703970     */
    3971     pOhci->intr_status &= ~val;
    3972     ohciUpdateInterrupt(pOhci, "HcInterruptStatus_w");
     3971    pThis->intr_status &= ~val;
     3972    ohciUpdateInterrupt(pThis, "HcInterruptStatus_w");
    39733973    return VINF_SUCCESS;
    39743974}
     
    39773977 * Read the HcInterruptEnable register
    39783978 */
    3979 static int HcInterruptEnable_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    3980 {
    3981     uint32_t val = pOhci->intr;
     3979static int HcInterruptEnable_r(PCOHCI pThis, uint32_t iReg, uint32_t *pu32Value)
     3980{
     3981    uint32_t val = pThis->intr;
    39823982    Log2(("HcInterruptEnable_r() -> %#010x - SO=%d WDH=%d SF=%d RD=%d UE=%d FNO=%d RHSC=%d OC=%d MIE=%d\n",
    39833983          val, val & 1, (val >> 1) & 1, (val >> 2) & 1, (val >> 3) & 1, (val >> 4) & 1, (val >> 5) & 1,
     
    39903990 * Writes to the HcInterruptEnable register.
    39913991 */
    3992 static int HcInterruptEnable_w(POHCI pOhci, uint32_t iReg, uint32_t val)
    3993 {
    3994     uint32_t res = pOhci->intr | val;
    3995     uint32_t chg = pOhci->intr ^ res; NOREF(chg);
     3992static int HcInterruptEnable_w(POHCI pThis, uint32_t iReg, uint32_t val)
     3993{
     3994    uint32_t res = pThis->intr | val;
     3995    uint32_t chg = pThis->intr ^ res; NOREF(chg);
    39963996    Log2(("HcInterruptEnable_w(%#010x) => %sSO=%d %sWDH=%d %sSF=%d %sRD=%d %sUE=%d %sFNO=%d %sRHSC=%d %sOC=%d %sMIE=%d\n",
    39973997          val,
     
    40084008        Log2(("Uknown bits %#x are set!!!\n", val & ~0xc000007f));
    40094009
    4010     pOhci->intr |= val;
    4011     ohciUpdateInterrupt(pOhci, "HcInterruptEnable_w");
     4010    pThis->intr |= val;
     4011    ohciUpdateInterrupt(pThis, "HcInterruptEnable_w");
    40124012    return VINF_SUCCESS;
    40134013}
     
    40164016 * Reads the HcInterruptDisable register.
    40174017 */
    4018 static int HcInterruptDisable_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
     4018static int HcInterruptDisable_r(PCOHCI pThis, uint32_t iReg, uint32_t *pu32Value)
    40194019{
    40204020#if 1 /** @todo r=bird: "On read, the current value of the HcInterruptEnable register is returned." */
    4021     uint32_t val = pOhci->intr;
     4021    uint32_t val = pThis->intr;
    40224022#else /* old code. */
    4023     uint32_t val = ~pOhci->intr;
     4023    uint32_t val = ~pThis->intr;
    40244024#endif
    40254025    Log2(("HcInterruptDisable_r() -> %#010x - SO=%d WDH=%d SF=%d RD=%d UE=%d FNO=%d RHSC=%d OC=%d MIE=%d\n",
     
    40344034 * Writes to the HcInterruptDisable register.
    40354035 */
    4036 static int HcInterruptDisable_w(POHCI pOhci, uint32_t iReg, uint32_t val)
    4037 {
    4038     uint32_t res = pOhci->intr & ~val;
    4039     uint32_t chg = pOhci->intr ^ res; NOREF(chg);
     4036static int HcInterruptDisable_w(POHCI pThis, uint32_t iReg, uint32_t val)
     4037{
     4038    uint32_t res = pThis->intr & ~val;
     4039    uint32_t chg = pThis->intr ^ res; NOREF(chg);
    40404040    Log2(("HcInterruptDisable_w(%#010x) => %sSO=%d %sWDH=%d %sSF=%d %sRD=%d %sUE=%d %sFNO=%d %sRHSC=%d %sOC=%d %sMIE=%d\n",
    40414041          val,
     
    40524052     * interrupts you don't know about. */
    40534053
    4054     pOhci->intr &= ~val;
    4055     ohciUpdateInterrupt(pOhci, "HcInterruptDisable_w");
     4054    pThis->intr &= ~val;
     4055    ohciUpdateInterrupt(pThis, "HcInterruptDisable_w");
    40564056    return VINF_SUCCESS;
    40574057}
     
    40604060 * Read the HcHCCA register (Host Controller Communications Area physical address).
    40614061 */
    4062 static int HcHCCA_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    4063 {
    4064     Log2(("HcHCCA_r() -> %#010x\n", pOhci->hcca));
    4065     *pu32Value = pOhci->hcca;
     4062static int HcHCCA_r(PCOHCI pThis, uint32_t iReg, uint32_t *pu32Value)
     4063{
     4064    Log2(("HcHCCA_r() -> %#010x\n", pThis->hcca));
     4065    *pu32Value = pThis->hcca;
    40664066    return VINF_SUCCESS;
    40674067}
     
    40704070 * Write to the HcHCCA register (Host Controller Communications Area physical address).
    40714071 */
    4072 static int HcHCCA_w(POHCI pOhci, uint32_t iReg, uint32_t Value)
    4073 {
    4074     Log2(("HcHCCA_w(%#010x) - old=%#010x new=%#010x\n", Value, pOhci->hcca, Value & OHCI_HCCA_MASK));
    4075     pOhci->hcca = Value & OHCI_HCCA_MASK;
     4072static int HcHCCA_w(POHCI pThis, uint32_t iReg, uint32_t Value)
     4073{
     4074    Log2(("HcHCCA_w(%#010x) - old=%#010x new=%#010x\n", Value, pThis->hcca, Value & OHCI_HCCA_MASK));
     4075    pThis->hcca = Value & OHCI_HCCA_MASK;
    40764076    return VINF_SUCCESS;
    40774077}
     
    40804080 * Read the HcPeriodCurrentED register.
    40814081 */
    4082 static int HcPeriodCurrentED_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    4083 {
    4084     Log2(("HcPeriodCurrentED_r() -> %#010x\n", pOhci->per_cur));
    4085     *pu32Value = pOhci->per_cur;
     4082static int HcPeriodCurrentED_r(PCOHCI pThis, uint32_t iReg, uint32_t *pu32Value)
     4083{
     4084    Log2(("HcPeriodCurrentED_r() -> %#010x\n", pThis->per_cur));
     4085    *pu32Value = pThis->per_cur;
    40864086    return VINF_SUCCESS;
    40874087}
     
    40904090 * Write to the HcPeriodCurrentED register.
    40914091 */
    4092 static int HcPeriodCurrentED_w(POHCI pOhci, uint32_t iReg, uint32_t val)
     4092static int HcPeriodCurrentED_w(POHCI pThis, uint32_t iReg, uint32_t val)
    40934093{
    40944094    Log(("HcPeriodCurrentED_w(%#010x) - old=%#010x new=%#010x (This is a read only register, only the linux guys don't respect that!)\n",
    4095          val, pOhci->per_cur, val & ~7));
    4096     //AssertMsgFailed(("HCD (Host Controller Driver) should not write to HcPeriodCurrentED! val=%#010x (old=%#010x)\n", val, pOhci->per_cur));
     4095         val, pThis->per_cur, val & ~7));
     4096    //AssertMsgFailed(("HCD (Host Controller Driver) should not write to HcPeriodCurrentED! val=%#010x (old=%#010x)\n", val, pThis->per_cur));
    40974097    AssertMsg(!(val & 7), ("Invalid alignment, val=%#010x\n", val));
    4098     pOhci->per_cur = val & ~7;
     4098    pThis->per_cur = val & ~7;
    40994099    return VINF_SUCCESS;
    41004100}
     
    41034103 * Read the HcControlHeadED register.
    41044104 */
    4105 static int HcControlHeadED_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    4106 {
    4107     Log2(("HcControlHeadED_r() -> %#010x\n", pOhci->ctrl_head));
    4108     *pu32Value = pOhci->ctrl_head;
     4105static int HcControlHeadED_r(PCOHCI pThis, uint32_t iReg, uint32_t *pu32Value)
     4106{
     4107    Log2(("HcControlHeadED_r() -> %#010x\n", pThis->ctrl_head));
     4108    *pu32Value = pThis->ctrl_head;
    41094109    return VINF_SUCCESS;
    41104110}
     
    41134113 * Write to the HcControlHeadED register.
    41144114 */
    4115 static int HcControlHeadED_w(POHCI pOhci, uint32_t iReg, uint32_t val)
    4116 {
    4117     Log2(("HcControlHeadED_w(%#010x) - old=%#010x new=%#010x\n", val, pOhci->ctrl_head, val & ~7));
     4115static int HcControlHeadED_w(POHCI pThis, uint32_t iReg, uint32_t val)
     4116{
     4117    Log2(("HcControlHeadED_w(%#010x) - old=%#010x new=%#010x\n", val, pThis->ctrl_head, val & ~7));
    41184118    AssertMsg(!(val & 7), ("Invalid alignment, val=%#010x\n", val));
    4119     pOhci->ctrl_head = val & ~7;
     4119    pThis->ctrl_head = val & ~7;
    41204120    return VINF_SUCCESS;
    41214121}
     
    41244124 * Read the HcControlCurrentED register.
    41254125 */
    4126 static int HcControlCurrentED_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    4127 {
    4128     Log2(("HcControlCurrentED_r() -> %#010x\n", pOhci->ctrl_cur));
    4129     *pu32Value = pOhci->ctrl_cur;
     4126static int HcControlCurrentED_r(PCOHCI pThis, uint32_t iReg, uint32_t *pu32Value)
     4127{
     4128    Log2(("HcControlCurrentED_r() -> %#010x\n", pThis->ctrl_cur));
     4129    *pu32Value = pThis->ctrl_cur;
    41304130    return VINF_SUCCESS;
    41314131}
     
    41344134 * Write to the HcControlCurrentED register.
    41354135 */
    4136 static int HcControlCurrentED_w(POHCI pOhci, uint32_t iReg, uint32_t val)
    4137 {
    4138     Log2(("HcControlCurrentED_w(%#010x) - old=%#010x new=%#010x\n", val, pOhci->ctrl_cur, val & ~7));
    4139     AssertMsg(!(pOhci->ctl & OHCI_CTL_CLE), ("Illegal write! HcControl.ControlListEnabled is set! val=%#010x\n", val));
     4136static int HcControlCurrentED_w(POHCI pThis, uint32_t iReg, uint32_t val)
     4137{
     4138    Log2(("HcControlCurrentED_w(%#010x) - old=%#010x new=%#010x\n", val, pThis->ctrl_cur, val & ~7));
     4139    AssertMsg(!(pThis->ctl & OHCI_CTL_CLE), ("Illegal write! HcControl.ControlListEnabled is set! val=%#010x\n", val));
    41404140    AssertMsg(!(val & 7), ("Invalid alignment, val=%#010x\n", val));
    4141     pOhci->ctrl_cur = val & ~7;
     4141    pThis->ctrl_cur = val & ~7;
    41424142    return VINF_SUCCESS;
    41434143}
     
    41464146 * Read the HcBulkHeadED register.
    41474147 */
    4148 static int HcBulkHeadED_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    4149 {
    4150     Log2(("HcBulkHeadED_r() -> %#010x\n", pOhci->bulk_head));
    4151     *pu32Value = pOhci->bulk_head;
     4148static int HcBulkHeadED_r(PCOHCI pThis, uint32_t iReg, uint32_t *pu32Value)
     4149{
     4150    Log2(("HcBulkHeadED_r() -> %#010x\n", pThis->bulk_head));
     4151    *pu32Value = pThis->bulk_head;
    41524152    return VINF_SUCCESS;
    41534153}
     
    41564156 * Write to the HcBulkHeadED register.
    41574157 */
    4158 static int HcBulkHeadED_w(POHCI pOhci, uint32_t iReg, uint32_t val)
    4159 {
    4160     Log2(("HcBulkHeadED_w(%#010x) - old=%#010x new=%#010x\n", val, pOhci->bulk_head, val & ~7));
     4158static int HcBulkHeadED_w(POHCI pThis, uint32_t iReg, uint32_t val)
     4159{
     4160    Log2(("HcBulkHeadED_w(%#010x) - old=%#010x new=%#010x\n", val, pThis->bulk_head, val & ~7));
    41614161    AssertMsg(!(val & 7), ("Invalid alignment, val=%#010x\n", val));
    4162     pOhci->bulk_head = val & ~7; /** @todo The ATI OHCI controller on my machine enforces 16-byte address alignment. */
     4162    pThis->bulk_head = val & ~7; /** @todo The ATI OHCI controller on my machine enforces 16-byte address alignment. */
    41634163    return VINF_SUCCESS;
    41644164}
     
    41674167 * Read the HcBulkCurrentED register.
    41684168 */
    4169 static int HcBulkCurrentED_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    4170 {
    4171     Log2(("HcBulkCurrentED_r() -> %#010x\n", pOhci->bulk_cur));
    4172     *pu32Value = pOhci->bulk_cur;
     4169static int HcBulkCurrentED_r(PCOHCI pThis, uint32_t iReg, uint32_t *pu32Value)
     4170{
     4171    Log2(("HcBulkCurrentED_r() -> %#010x\n", pThis->bulk_cur));
     4172    *pu32Value = pThis->bulk_cur;
    41734173    return VINF_SUCCESS;
    41744174}
     
    41774177 * Write to the HcBulkCurrentED register.
    41784178 */
    4179 static int HcBulkCurrentED_w(POHCI pOhci, uint32_t iReg, uint32_t val)
    4180 {
    4181     Log2(("HcBulkCurrentED_w(%#010x) - old=%#010x new=%#010x\n", val, pOhci->bulk_cur, val & ~7));
    4182     AssertMsg(!(pOhci->ctl & OHCI_CTL_BLE), ("Illegal write! HcControl.BulkListEnabled is set! val=%#010x\n", val));
     4179static int HcBulkCurrentED_w(POHCI pThis, uint32_t iReg, uint32_t val)
     4180{
     4181    Log2(("HcBulkCurrentED_w(%#010x) - old=%#010x new=%#010x\n", val, pThis->bulk_cur, val & ~7));
     4182    AssertMsg(!(pThis->ctl & OHCI_CTL_BLE), ("Illegal write! HcControl.BulkListEnabled is set! val=%#010x\n", val));
    41834183    AssertMsg(!(val & 7), ("Invalid alignment, val=%#010x\n", val));
    4184     pOhci->bulk_cur = val & ~7;
     4184    pThis->bulk_cur = val & ~7;
    41854185    return VINF_SUCCESS;
    41864186}
     
    41904190 * Read the HcDoneHead register.
    41914191 */
    4192 static int HcDoneHead_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    4193 {
    4194     Log2(("HcDoneHead_r() -> 0x%#08x\n", pOhci->done));
    4195     *pu32Value = pOhci->done;
     4192static int HcDoneHead_r(PCOHCI pThis, uint32_t iReg, uint32_t *pu32Value)
     4193{
     4194    Log2(("HcDoneHead_r() -> 0x%#08x\n", pThis->done));
     4195    *pu32Value = pThis->done;
    41964196    return VINF_SUCCESS;
    41974197}
     
    42004200 * Write to the HcDoneHead register.
    42014201 */
    4202 static int HcDoneHead_w(POHCI pOhci, uint32_t iReg, uint32_t val)
     4202static int HcDoneHead_w(POHCI pThis, uint32_t iReg, uint32_t val)
    42034203{
    42044204    Log2(("HcDoneHead_w(0x%#08x) - denied!!!\n", val));
     
    42114211 * Read the HcFmInterval (Fm=Frame) register.
    42124212 */
    4213 static int HcFmInterval_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    4214 {
    4215     uint32_t val = (pOhci->fit << 31) | (pOhci->fsmps << 16) | (pOhci->fi);
     4213static int HcFmInterval_r(PCOHCI pThis, uint32_t iReg, uint32_t *pu32Value)
     4214{
     4215    uint32_t val = (pThis->fit << 31) | (pThis->fsmps << 16) | (pThis->fi);
    42164216    Log2(("HcFmInterval_r() -> 0x%#08x - FI=%d FSMPS=%d FIT=%d\n",
    42174217          val, val & 0x3fff, (val >> 16) & 0x7fff, val >> 31));
     
    42234223 * Write to the HcFmInterval (Fm = Frame) register.
    42244224 */
    4225 static int HcFmInterval_w(POHCI pOhci, uint32_t iReg, uint32_t val)
     4225static int HcFmInterval_w(POHCI pThis, uint32_t iReg, uint32_t val)
    42264226{
    42274227    /* log */
    4228     uint32_t chg = val ^ ((pOhci->fit << 31) | (pOhci->fsmps << 16) | pOhci->fi); NOREF(chg);
     4228    uint32_t chg = val ^ ((pThis->fit << 31) | (pThis->fsmps << 16) | pThis->fi); NOREF(chg);
    42294229    Log2(("HcFmInterval_w(%#010x) => %sFI=%d %sFSMPS=%d %sFIT=%d\n",
    42304230          val,
     
    42324232          chg & 0x7fff0000 ? "*" : "", (val >> 16) & 0x7fff,
    42334233          chg >> 31        ? "*" : "", (val >> 31) & 1));
    4234     if ( pOhci->fi != (val & OHCI_FMI_FI) )
    4235     {
    4236         Log(("ohci: FrameInterval: %#010x -> %#010x\n", pOhci->fi, val & OHCI_FMI_FI));
    4237         AssertMsg(pOhci->fit != ((val >> OHCI_FMI_FIT_SHIFT) & 1), ("HCD didn't toggle the FIT bit!!!\n"));
     4234    if ( pThis->fi != (val & OHCI_FMI_FI) )
     4235    {
     4236        Log(("ohci: FrameInterval: %#010x -> %#010x\n", pThis->fi, val & OHCI_FMI_FI));
     4237        AssertMsg(pThis->fit != ((val >> OHCI_FMI_FIT_SHIFT) & 1), ("HCD didn't toggle the FIT bit!!!\n"));
    42384238    }
    42394239
    42404240    /* update */
    4241     pOhci->fi = val & OHCI_FMI_FI;
    4242     pOhci->fit = (val & OHCI_FMI_FIT) >> OHCI_FMI_FIT_SHIFT;
    4243     pOhci->fsmps = (val & OHCI_FMI_FSMPS) >> OHCI_FMI_FSMPS_SHIFT;
     4241    pThis->fi = val & OHCI_FMI_FI;
     4242    pThis->fit = (val & OHCI_FMI_FIT) >> OHCI_FMI_FIT_SHIFT;
     4243    pThis->fsmps = (val & OHCI_FMI_FSMPS) >> OHCI_FMI_FSMPS_SHIFT;
    42444244    return VINF_SUCCESS;
    42454245}
     
    42484248 * Read the HcFmRemaining (Fm = Frame) register.
    42494249 */
    4250 static int HcFmRemaining_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    4251 {
    4252     uint32_t Value = pOhci->frt << 31;
    4253     if ((pOhci->ctl & OHCI_CTL_HCFS) == OHCI_USB_OPERATIONAL)
     4250static int HcFmRemaining_r(PCOHCI pThis, uint32_t iReg, uint32_t *pu32Value)
     4251{
     4252    uint32_t Value = pThis->frt << 31;
     4253    if ((pThis->ctl & OHCI_CTL_HCFS) == OHCI_USB_OPERATIONAL)
    42544254    {
    42554255        /*
    42564256         * Being in USB operational state guarantees SofTime was set already.
    42574257         */
    4258         uint64_t tks = TMTimerGet(pOhci->CTX_SUFF(pEndOfFrameTimer)) - pOhci->SofTime;
    4259         if (tks < pOhci->cTicksPerFrame)  /* avoid muldiv if possible */
     4258        uint64_t tks = TMTimerGet(pThis->CTX_SUFF(pEndOfFrameTimer)) - pThis->SofTime;
     4259        if (tks < pThis->cTicksPerFrame)  /* avoid muldiv if possible */
    42604260        {
    42614261            uint16_t fr;
    4262             tks = ASMMultU64ByU32DivByU32(1, tks, pOhci->cTicksPerUsbTick);
    4263             fr = (uint16_t)(pOhci->fi - tks);
     4262            tks = ASMMultU64ByU32DivByU32(1, tks, pThis->cTicksPerUsbTick);
     4263            fr = (uint16_t)(pThis->fi - tks);
    42644264            Value |= fr;
    42654265        }
     
    42744274 * Write to the HcFmRemaining (Fm = Frame) register.
    42754275 */
    4276 static int HcFmRemaining_w(POHCI pOhci, uint32_t iReg, uint32_t val)
     4276static int HcFmRemaining_w(POHCI pThis, uint32_t iReg, uint32_t val)
    42774277{
    42784278    Log2(("HcFmRemaining_w(%#010x) - denied\n", val));
     
    42844284 * Read the HcFmNumber (Fm = Frame) register.
    42854285 */
    4286 static int HcFmNumber_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    4287 {
    4288     uint32_t val = (uint16_t)pOhci->HcFmNumber;
    4289     Log2(("HcFmNumber_r() -> %#010x - FN=%#x(%d) (32-bit=%#x(%d))\n", val, val, val, pOhci->HcFmNumber, pOhci->HcFmNumber));
     4286static int HcFmNumber_r(PCOHCI pThis, uint32_t iReg, uint32_t *pu32Value)
     4287{
     4288    uint32_t val = (uint16_t)pThis->HcFmNumber;
     4289    Log2(("HcFmNumber_r() -> %#010x - FN=%#x(%d) (32-bit=%#x(%d))\n", val, val, val, pThis->HcFmNumber, pThis->HcFmNumber));
    42904290    *pu32Value = val;
    42914291    return VINF_SUCCESS;
     
    42954295 * Write to the HcFmNumber (Fm = Frame) register.
    42964296 */
    4297 static int HcFmNumber_w(POHCI pOhci, uint32_t iReg, uint32_t val)
     4297static int HcFmNumber_w(POHCI pThis, uint32_t iReg, uint32_t val)
    42984298{
    42994299    Log2(("HcFmNumber_w(%#010x) - denied\n", val));
     
    43064306 * The register determines when in a frame to switch from control&bulk to periodic lists.
    43074307 */
    4308 static int HcPeriodicStart_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    4309 {
    4310     Log2(("HcPeriodicStart_r() -> %#010x - PS=%d\n", pOhci->pstart, pOhci->pstart & 0x3fff));
    4311     *pu32Value = pOhci->pstart;
     4308static int HcPeriodicStart_r(PCOHCI pThis, uint32_t iReg, uint32_t *pu32Value)
     4309{
     4310    Log2(("HcPeriodicStart_r() -> %#010x - PS=%d\n", pThis->pstart, pThis->pstart & 0x3fff));
     4311    *pu32Value = pThis->pstart;
    43124312    return VINF_SUCCESS;
    43134313}
     
    43174317 * The register determines when in a frame to switch from control&bulk to periodic lists.
    43184318 */
    4319 static int HcPeriodicStart_w(POHCI pOhci, uint32_t iReg, uint32_t val)
     4319static int HcPeriodicStart_w(POHCI pThis, uint32_t iReg, uint32_t val)
    43204320{
    43214321    Log2(("HcPeriodicStart_w(%#010x) => PS=%d\n", val, val & 0x3fff));
    43224322    if (val & ~0x3fff)
    43234323        Log2(("Unknown bits %#x are set!!!\n", val & ~0x3fff));
    4324     pOhci->pstart = val; /** @todo r=bird: should we support setting the other bits? */
     4324    pThis->pstart = val; /** @todo r=bird: should we support setting the other bits? */
    43254325    return VINF_SUCCESS;
    43264326}
     
    43294329 * Read the HcLSThreshold register.
    43304330 */
    4331 static int HcLSThreshold_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
     4331static int HcLSThreshold_r(PCOHCI pThis, uint32_t iReg, uint32_t *pu32Value)
    43324332{
    43334333    Log2(("HcLSThreshold_r() -> %#010x\n", OHCI_LS_THRESH));
     
    43484348 *
    43494349 */
    4350 static int HcLSThreshold_w(POHCI pOhci, uint32_t iReg, uint32_t val)
     4350static int HcLSThreshold_w(POHCI pThis, uint32_t iReg, uint32_t val)
    43514351{
    43524352    Log2(("HcLSThreshold_w(%#010x) => LST=0x%03x(%d)\n", val, val & 0x0fff));
     
    43604360 * Read the HcRhDescriptorA register.
    43614361 */
    4362 static int HcRhDescriptorA_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    4363 {
    4364     uint32_t val = pOhci->RootHub.desc_a;
     4362static int HcRhDescriptorA_r(PCOHCI pThis, uint32_t iReg, uint32_t *pu32Value)
     4363{
     4364    uint32_t val = pThis->RootHub.desc_a;
    43654365#if 0 /* annoying */
    43664366    Log2(("HcRhDescriptorA_r() -> %#010x - NDP=%d PSM=%d NPS=%d DT=%d OCPM=%d NOCP=%d POTGT=%#x\n",
     
    43754375 * Write to the HcRhDescriptorA register.
    43764376 */
    4377 static int HcRhDescriptorA_w(POHCI pOhci, uint32_t iReg, uint32_t val)
    4378 {
    4379     uint32_t chg = val ^ pOhci->RootHub.desc_a; NOREF(chg);
     4377static int HcRhDescriptorA_w(POHCI pThis, uint32_t iReg, uint32_t val)
     4378{
     4379    uint32_t chg = val ^ pThis->RootHub.desc_a; NOREF(chg);
    43804380    Log2(("HcRhDescriptorA_w(%#010x) => %sNDP=%d %sPSM=%d %sNPS=%d %sDT=%d %sOCPM=%d %sNOCP=%d %sPOTGT=%#x - %sPowerSwitching Set%sPower\n",
    43814381          val,
     
    43964396    {
    43974397        Log(("ohci: %s: invalid write to NDP or DT in roothub descriptor A!!! val=0x%.8x\n",
    4398                 pOhci->PciDev.name, val));
     4398                pThis->PciDev.name, val));
    43994399        val &= ~(OHCI_RHA_NDP | OHCI_RHA_DT);
    44004400        val |= OHCI_NDP;
    44014401    }
    44024402
    4403     pOhci->RootHub.desc_a = val;
     4403    pThis->RootHub.desc_a = val;
    44044404    return VINF_SUCCESS;
    44054405}
     
    44084408 * Read the HcRhDescriptorB register.
    44094409 */
    4410 static int HcRhDescriptorB_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    4411 {
    4412     uint32_t val = pOhci->RootHub.desc_b;
     4410static int HcRhDescriptorB_r(PCOHCI pThis, uint32_t iReg, uint32_t *pu32Value)
     4411{
     4412    uint32_t val = pThis->RootHub.desc_b;
    44134413    Log2(("HcRhDescriptorB_r() -> %#010x - DR=0x%04x PPCM=0x%04x\n",
    44144414          val, val & 0xffff, val >> 16));
     
    44204420 * Write to the HcRhDescriptorB register.
    44214421 */
    4422 static int HcRhDescriptorB_w(POHCI pOhci, uint32_t iReg, uint32_t val)
    4423 {
    4424     uint32_t chg = pOhci->RootHub.desc_b ^ val; NOREF(chg);
     4422static int HcRhDescriptorB_w(POHCI pThis, uint32_t iReg, uint32_t val)
     4423{
     4424    uint32_t chg = pThis->RootHub.desc_b ^ val; NOREF(chg);
    44254425    Log2(("HcRhDescriptorB_w(%#010x) => %sDR=0x%04x %sPPCM=0x%04x\n",
    44264426          val,
     
    44284428          chg >> 16    ? "!!!" : "", val >> 16));
    44294429
    4430     if ( pOhci->RootHub.desc_b != val )
     4430    if ( pThis->RootHub.desc_b != val )
    44314431        Log(("ohci: %s: unsupported write to root descriptor B!!! 0x%.8x -> 0x%.8x\n",
    4432                 pOhci->PciDev.name,
    4433                 pOhci->RootHub.desc_b, val));
    4434     pOhci->RootHub.desc_b = val;
     4432                pThis->PciDev.name,
     4433                pThis->RootHub.desc_b, val));
     4434    pThis->RootHub.desc_b = val;
    44354435    return VINF_SUCCESS;
    44364436}
     
    44394439 * Read the HcRhStatus (Rh = Root Hub) register.
    44404440 */
    4441 static int HcRhStatus_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
    4442 {
    4443     uint32_t val = pOhci->RootHub.status;
     4441static int HcRhStatus_r(PCOHCI pThis, uint32_t iReg, uint32_t *pu32Value)
     4442{
     4443    uint32_t val = pThis->RootHub.status;
    44444444    if (val & (OHCI_RHS_LPSC | OHCI_RHS_OCIC))
    44454445        Log2(("HcRhStatus_r() -> %#010x - LPS=%d OCI=%d DRWE=%d LPSC=%d OCIC=%d CRWE=%d\n",
     
    44524452 * Write to the HcRhStatus (Rh = Root Hub) register.
    44534453 */
    4454 static int HcRhStatus_w(POHCI pOhci, uint32_t iReg, uint32_t val)
     4454static int HcRhStatus_w(POHCI pThis, uint32_t iReg, uint32_t val)
    44554455{
    44564456#ifdef IN_RING3
    44574457    /* log */
    4458     uint32_t old = pOhci->RootHub.status;
     4458    uint32_t old = pThis->RootHub.status;
    44594459    uint32_t chg;
    44604460    if (val & ~0x80038003)
     
    44684468    /* write 1 to clear OCIC */
    44694469    if ( val & OHCI_RHS_OCIC )
    4470         pOhci->RootHub.status &= ~OHCI_RHS_OCIC;
     4470        pThis->RootHub.status &= ~OHCI_RHS_OCIC;
    44714471
    44724472    /* SetGlobalPower */
     
    44744474    {
    44754475        int i;
    4476         Log2(("ohci: %s: global power up\n", pOhci->PciDev.name));
     4476        Log2(("ohci: %s: global power up\n", pThis->PciDev.name));
    44774477        for (i = 0; i < OHCI_NDP; i++)
    4478             rhport_power(&pOhci->RootHub, i, true /* power up */);
     4478            rhport_power(&pThis->RootHub, i, true /* power up */);
    44794479    }
    44804480
     
    44834483    {
    44844484        int i;
    4485         Log2(("ohci: %s: global power down\n", pOhci->PciDev.name));
     4485        Log2(("ohci: %s: global power down\n", pThis->PciDev.name));
    44864486        for (i = 0; i < OHCI_NDP; i++)
    4487             rhport_power(&pOhci->RootHub, i, false /* power down */);
     4487            rhport_power(&pThis->RootHub, i, false /* power down */);
    44884488    }
    44894489
    44904490    if ( val & OHCI_RHS_DRWE )
    4491         pOhci->RootHub.status |= OHCI_RHS_DRWE;
     4491        pThis->RootHub.status |= OHCI_RHS_DRWE;
    44924492
    44934493    if ( val & OHCI_RHS_CRWE )
    4494         pOhci->RootHub.status &= ~OHCI_RHS_DRWE;
    4495 
    4496     chg = pOhci->RootHub.status ^ old;
     4494        pThis->RootHub.status &= ~OHCI_RHS_DRWE;
     4495
     4496    chg = pThis->RootHub.status ^ old;
    44974497    Log2(("HcRhStatus_w(%#010x) => %sCGP=%d %sOCI=%d %sSRWE=%d %sSGP=%d %sOCIC=%d %sCRWE=%d\n",
    44984498          val,
     
    45124512 * Read the HcRhPortStatus register of a port.
    45134513 */
    4514 static int HcRhPortStatus_r(PCOHCI pOhci, uint32_t iReg, uint32_t *pu32Value)
     4514static int HcRhPortStatus_r(PCOHCI pThis, uint32_t iReg, uint32_t *pu32Value)
    45154515{
    45164516    const unsigned i = iReg - 21;
    4517     uint32_t val = pOhci->RootHub.aPorts[i].fReg | OHCI_PORT_R_POWER_STATUS; /* PortPowerStatus: see todo on power in _w function. */
     4517    uint32_t val = pThis->RootHub.aPorts[i].fReg | OHCI_PORT_R_POWER_STATUS; /* PortPowerStatus: see todo on power in _w function. */
    45184518    if (val & OHCI_PORT_R_RESET_STATUS)
    45194519    {
     
    45404540static DECLCALLBACK(void) uchi_port_reset_done(PVUSBIDEVICE pDev, int rc, void *pvUser)
    45414541{
    4542     POHCI pOhci = (POHCI)pvUser;
     4542    POHCI pThis = (POHCI)pvUser;
    45434543
    45444544    /*
     
    45474547    POHCIHUBPORT pPort = NULL;
    45484548    unsigned iPort;
    4549     for (iPort = 0; iPort < RT_ELEMENTS(pOhci->RootHub.aPorts); iPort++) /* lazy bird */
    4550         if (pOhci->RootHub.aPorts[iPort].pDev == pDev)
     4549    for (iPort = 0; iPort < RT_ELEMENTS(pThis->RootHub.aPorts); iPort++) /* lazy bird */
     4550        if (pThis->RootHub.aPorts[iPort].pDev == pDev)
    45514551        {
    4552             pPort = &pOhci->RootHub.aPorts[iPort];
     4552            pPort = &pThis->RootHub.aPorts[iPort];
    45534553            break;
    45544554        }
     
    45934593
    45944594    /* Raise roothub status change interrupt. */
    4595     ohciSetInterrupt(pOhci, OHCI_INTR_ROOT_HUB_STATUS_CHANGE);
     4595    ohciSetInterrupt(pThis, OHCI_INTR_ROOT_HUB_STATUS_CHANGE);
    45964596}
    45974597
     
    46334633 * Write to the HcRhPortStatus register of a port.
    46344634 */
    4635 static int HcRhPortStatus_w(POHCI pOhci, uint32_t iReg, uint32_t val)
     4635static int HcRhPortStatus_w(POHCI pThis, uint32_t iReg, uint32_t val)
    46364636{
    46374637#ifdef IN_RING3
    46384638    const unsigned  i = iReg - 21;
    4639     POHCIHUBPORT    p = &pOhci->RootHub.aPorts[i];
     4639    POHCIHUBPORT    p = &pThis->RootHub.aPorts[i];
    46404640    uint32_t        old_state = p->fReg;
    46414641
     
    46724672    }
    46734673
    4674     if (rhport_set_if_connected(&pOhci->RootHub, i, val & OHCI_PORT_W_SET_ENABLE))
     4674    if (rhport_set_if_connected(&pThis->RootHub, i, val & OHCI_PORT_W_SET_ENABLE))
    46754675        Log2(("HcRhPortStatus_w(): port %u: ENABLE\n", i));
    46764676
    4677     if (rhport_set_if_connected(&pOhci->RootHub, i, val & OHCI_PORT_W_SET_SUSPEND))
     4677    if (rhport_set_if_connected(&pThis->RootHub, i, val & OHCI_PORT_W_SET_SUSPEND))
    46784678        Log2(("HcRhPortStatus_w(): port %u: SUSPEND - not implemented correctly!!!\n", i));
    46794679
    46804680    if (val & OHCI_PORT_W_SET_RESET)
    46814681    {
    4682         if (rhport_set_if_connected(&pOhci->RootHub, i, val & OHCI_PORT_W_SET_RESET))
     4682        if (rhport_set_if_connected(&pThis->RootHub, i, val & OHCI_PORT_W_SET_RESET))
    46834683        {
    4684             PVM pVM = PDMDevHlpGetVM(pOhci->CTX_SUFF(pDevIns));
     4684            PVM pVM = PDMDevHlpGetVM(pThis->CTX_SUFF(pDevIns));
    46854685            p->fReg &= ~OHCI_PORT_R_RESET_STATUS_CHANGE;
    4686             VUSBIDevReset(p->pDev, false /* don't reset on linux */, uchi_port_reset_done, pOhci, pVM);
     4686            VUSBIDevReset(p->pDev, false /* don't reset on linux */, uchi_port_reset_done, pThis, pVM);
    46874687        }
    46884688        else if (p->fReg & OHCI_PORT_R_RESET_STATUS)
     
    46944694    }
    46954695
    4696     if (!(pOhci->RootHub.desc_a & OHCI_RHA_NPS))
     4696    if (!(pThis->RootHub.desc_a & OHCI_RHA_NPS))
    46974697    {
    46984698        /** @todo To implement per-device power-switching
     
    47014701         */
    47024702        if (val & OHCI_PORT_W_CLEAR_POWER)
    4703             rhport_power(&pOhci->RootHub, i, false /* power down */);
     4703            rhport_power(&pThis->RootHub, i, false /* power down */);
    47044704        if (val & OHCI_PORT_W_SET_POWER)
    4705             rhport_power(&pOhci->RootHub, i, true /* power up */);
     4705            rhport_power(&pThis->RootHub, i, true /* power up */);
    47064706    }
    47074707
     
    47094709    if (val & OHCI_PORT_W_CLEAR_SUSPEND_STATUS)
    47104710    {
    4711         rhport_power(&pOhci->RootHub, i, true /* power up */);
    4712         pOhci->RootHub.aPorts[i].fReg &= ~OHCI_PORT_R_SUSPEND_STATUS;
    4713         pOhci->RootHub.aPorts[i].fReg |= OHCI_PORT_R_SUSPEND_STATUS_CHANGE;
    4714         ohciSetInterrupt(pOhci, OHCI_INTR_ROOT_HUB_STATUS_CHANGE);
     4711        rhport_power(&pThis->RootHub, i, true /* power up */);
     4712        pThis->RootHub.aPorts[i].fReg &= ~OHCI_PORT_R_SUSPEND_STATUS;
     4713        pThis->RootHub.aPorts[i].fReg |= OHCI_PORT_R_SUSPEND_STATUS_CHANGE;
     4714        ohciSetInterrupt(pThis, OHCI_INTR_ROOT_HUB_STATUS_CHANGE);
    47154715    }
    47164716
     
    47864786PDMBOTHCBDECL(int) ohciMmioRead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb)
    47874787{
    4788     POHCI pOhci = PDMINS_2_DATA(pDevIns, POHCI);
     4788    POHCI pThis = PDMINS_2_DATA(pDevIns, POHCI);
    47894789
    47904790    /* Paranoia: Assert that IOMMMIO_FLAGS_READ_DWORD works. */
     
    47964796     */
    47974797    int rc;
    4798     const uint32_t iReg = (GCPhysAddr - pOhci->MMIOBase) >> 2;
     4798    const uint32_t iReg = (GCPhysAddr - pThis->MMIOBase) >> 2;
    47994799    if (iReg < RT_ELEMENTS(g_aOpRegs))
    48004800    {
    48014801        const OHCIOPREG *pReg = &g_aOpRegs[iReg];
    4802         rc = pReg->pfnRead(pOhci, iReg, (uint32_t *)pv);
     4802        rc = pReg->pfnRead(pThis, iReg, (uint32_t *)pv);
    48034803    }
    48044804    else
     
    48164816PDMBOTHCBDECL(int) ohciMmioWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void const *pv, unsigned cb)
    48174817{
    4818     POHCI pOhci = PDMINS_2_DATA(pDevIns, POHCI);
     4818    POHCI pThis = PDMINS_2_DATA(pDevIns, POHCI);
    48194819
    48204820    /* Paranoia: Assert that IOMMMIO_FLAGS_WRITE_DWORD_ZEROED works. */
     
    48264826     */
    48274827    int rc;
    4828     const uint32_t iReg = (GCPhysAddr - pOhci->MMIOBase) >> 2;
     4828    const uint32_t iReg = (GCPhysAddr - pThis->MMIOBase) >> 2;
    48294829    if (iReg < RT_ELEMENTS(g_aOpRegs))
    48304830    {
    48314831        const OHCIOPREG *pReg = &g_aOpRegs[iReg];
    4832         rc = pReg->pfnWrite(pOhci, iReg, *(uint32_t const *)pv);
     4832        rc = pReg->pfnWrite(pThis, iReg, *(uint32_t const *)pv);
    48334833    }
    48344834    else
     
    48474847static DECLCALLBACK(int) ohciR3Map(PPCIDEVICE pPciDev, int iRegion, RTGCPHYS GCPhysAddress, uint32_t cb, PCIADDRESSSPACE enmType)
    48484848{
    4849     POHCI pOhci = (POHCI)pPciDev;
    4850     int rc = PDMDevHlpMMIORegister(pOhci->CTX_SUFF(pDevIns), GCPhysAddress, cb, NULL /*pvUser*/,
     4849    POHCI pThis = (POHCI)pPciDev;
     4850    int rc = PDMDevHlpMMIORegister(pThis->CTX_SUFF(pDevIns), GCPhysAddress, cb, NULL /*pvUser*/,
    48514851                                   IOMMMIO_FLAGS_READ_DWORD | IOMMMIO_FLAGS_WRITE_DWORD_ZEROED
    48524852                                   | IOMMMIO_FLAGS_DBGSTOP_ON_COMPLICATED_WRITE,
     
    48554855        return rc;
    48564856
    4857     if (pOhci->fRZEnabled)
    4858     {
    4859         rc = PDMDevHlpMMIORegisterRC(pOhci->CTX_SUFF(pDevIns), GCPhysAddress, cb,
     4857    if (pThis->fRZEnabled)
     4858    {
     4859        rc = PDMDevHlpMMIORegisterRC(pThis->CTX_SUFF(pDevIns), GCPhysAddress, cb,
    48604860                                     NIL_RTRCPTR /*pvUser*/, "ohciMmioWrite", "ohciMmioRead");
    48614861        if (RT_FAILURE(rc))
    48624862            return rc;
    48634863
    4864         rc = PDMDevHlpMMIORegisterR0(pOhci->CTX_SUFF(pDevIns), GCPhysAddress, cb,
     4864        rc = PDMDevHlpMMIORegisterR0(pThis->CTX_SUFF(pDevIns), GCPhysAddress, cb,
    48654865                                     NIL_RTR0PTR /*pvUser*/, "ohciMmioWrite", "ohciMmioRead");
    48664866        if (RT_FAILURE(rc))
     
    48684868    }
    48694869
    4870     pOhci->MMIOBase = GCPhysAddress;
     4870    pThis->MMIOBase = GCPhysAddress;
    48714871    return VINF_SUCCESS;
    48724872}
     
    48834883static DECLCALLBACK(int) ohciR3SavePrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
    48844884{
    4885     POHCI pOhci = PDMINS_2_DATA(pDevIns, POHCI);
    4886     POHCIROOTHUB pRh = &pOhci->RootHub;
     4885    POHCI pThis = PDMINS_2_DATA(pDevIns, POHCI);
     4886    POHCIROOTHUB pRh = &pThis->RootHub;
    48874887    LogFlow(("ohciR3SavePrep: \n"));
    48884888
     
    48904890     * Detach all proxied devices.
    48914891     */
    4892     PDMCritSectEnter(pOhci->pDevInsR3->pCritSectRoR3, VERR_IGNORED);
     4892    PDMCritSectEnter(pThis->pDevInsR3->pCritSectRoR3, VERR_IGNORED);
    48934893    /** @todo we a) can't tell which are proxied, and b) this won't work well when continuing after saving! */
    48944894    for (unsigned i = 0; i < RT_ELEMENTS(pRh->aPorts); i++)
     
    49064906        }
    49074907    }
    4908     PDMCritSectLeave(pOhci->pDevInsR3->pCritSectRoR3);
     4908    PDMCritSectLeave(pThis->pDevInsR3->pCritSectRoR3);
    49094909
    49104910    /*
    49114911     * Kill old load data which might be hanging around.
    49124912     */
    4913     if (pOhci->pLoad)
    4914     {
    4915         TMR3TimerDestroy(pOhci->pLoad->pTimer);
    4916         MMR3HeapFree(pOhci->pLoad);
    4917         pOhci->pLoad = NULL;
     4913    if (pThis->pLoad)
     4914    {
     4915        TMR3TimerDestroy(pThis->pLoad->pTimer);
     4916        MMR3HeapFree(pThis->pLoad);
     4917        pThis->pLoad = NULL;
    49184918    }
    49194919    return VINF_SUCCESS;
     
    49304930static DECLCALLBACK(int) ohciR3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
    49314931{
    4932     POHCI pOhci = PDMINS_2_DATA(pDevIns, POHCI);
     4932    POHCI pThis = PDMINS_2_DATA(pDevIns, POHCI);
    49334933    LogFlow(("ohciR3SaveExec: \n"));
    49344934
    4935     int rc = SSMR3PutStructEx(pSSM, pOhci, sizeof(*pOhci), 0 /*fFlags*/, &g_aOhciFields[0], NULL);
     4935    int rc = SSMR3PutStructEx(pSSM, pThis, sizeof(*pThis), 0 /*fFlags*/, &g_aOhciFields[0], NULL);
    49364936    if (RT_SUCCESS(rc))
    4937         rc = TMR3TimerSave(pOhci->CTX_SUFF(pEndOfFrameTimer), pSSM);
     4937        rc = TMR3TimerSave(pThis->CTX_SUFF(pEndOfFrameTimer), pSSM);
    49384938    return rc;
    49394939}
     
    49494949static DECLCALLBACK(int) ohciR3SaveDone(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
    49504950{
    4951     POHCI pOhci = PDMINS_2_DATA(pDevIns, POHCI);
    4952     POHCIROOTHUB pRh = &pOhci->RootHub;
     4951    POHCI pThis = PDMINS_2_DATA(pDevIns, POHCI);
     4952    POHCIROOTHUB pRh = &pThis->RootHub;
    49534953    OHCIROOTHUB Rh;
    49544954    unsigned i;
     
    49894989{
    49904990    int rc = VINF_SUCCESS;
    4991     POHCI pOhci = PDMINS_2_DATA(pDevIns, POHCI);
     4991    POHCI pThis = PDMINS_2_DATA(pDevIns, POHCI);
    49924992    LogFlow(("ohciR3LoadPrep:\n"));
    4993     if (!pOhci->pLoad)
    4994     {
    4995         POHCIROOTHUB pRh = &pOhci->RootHub;
     4993    if (!pThis->pLoad)
     4994    {
     4995        POHCIROOTHUB pRh = &pThis->RootHub;
    49964996        OHCILOAD Load;
    49974997        unsigned i;
     
    50195019        if (Load.cDevs)
    50205020        {
    5021             pOhci->pLoad = (POHCILOAD)PDMDevHlpMMHeapAlloc(pDevIns, sizeof(Load));
    5022             if (!pOhci->pLoad)
     5021            pThis->pLoad = (POHCILOAD)PDMDevHlpMMHeapAlloc(pDevIns, sizeof(Load));
     5022            if (!pThis->pLoad)
    50235023                return VERR_NO_MEMORY;
    5024             *pOhci->pLoad = Load;
     5024            *pThis->pLoad = Load;
    50255025        }
    50265026    }
     
    50425042static DECLCALLBACK(int) ohciR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
    50435043{
    5044     POHCI       pOhci = PDMINS_2_DATA(pDevIns, POHCI);
     5044    POHCI       pThis = PDMINS_2_DATA(pDevIns, POHCI);
    50455045    int         rc;
    50465046    LogFlow(("ohciR3LoadExec:\n"));
     
    50495049    if (uVersion == OHCI_SAVED_STATE_VERSION)
    50505050    {
    5051         rc = SSMR3GetStructEx(pSSM, pOhci, sizeof(*pOhci), 0 /*fFlags*/, &g_aOhciFields[0], NULL);
     5051        rc = SSMR3GetStructEx(pSSM, pThis, sizeof(*pThis), 0 /*fFlags*/, &g_aOhciFields[0], NULL);
    50525052        if (RT_FAILURE(rc))
    50535053            return rc;
     
    51155115            SSMFIELD_ENTRY_OLD_PAD_HC64(  RootHub.aPorts[7].Alignment0, 4),
    51165116            SSMFIELD_ENTRY_OLD_HCPTR(     RootHub.aPorts[7].pDev),
    5117             SSMFIELD_ENTRY_OLD_HCPTR(     RootHub.pOhci),
     5117            SSMFIELD_ENTRY_OLD_HCPTR(     RootHub.pThis),
    51185118            SSMFIELD_ENTRY(         OHCI, ctl),
    51195119            SSMFIELD_ENTRY(         OHCI, status),
     
    51495149
    51505150        /* deserialize the struct */
    5151         rc = SSMR3GetStructEx(pSSM, pOhci, sizeof(*pOhci), SSMSTRUCT_FLAGS_NO_MARKERS /*fFlags*/, &s_aOhciFields22[0], NULL);
     5151        rc = SSMR3GetStructEx(pSSM, pThis, sizeof(*pThis), SSMSTRUCT_FLAGS_NO_MARKERS /*fFlags*/, &s_aOhciFields22[0], NULL);
    51525152        if (RT_FAILURE(rc))
    51535153            return rc;
     
    51665166     * Finally restore the timer.
    51675167     */
    5168     return TMR3TimerLoad(pOhci->pEndOfFrameTimerR3, pSSM);
     5168    return TMR3TimerLoad(pThis->pEndOfFrameTimerR3, pSSM);
    51695169}
    51705170
     
    51795179static DECLCALLBACK(int) ohciR3LoadDone(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
    51805180{
    5181     POHCI pOhci = PDMINS_2_DATA(pDevIns, POHCI);
     5181    POHCI pThis = PDMINS_2_DATA(pDevIns, POHCI);
    51825182    LogFlow(("ohciR3LoadDone:\n"));
    51835183
     
    51855185     * Start a timer if we've got devices to reattach
    51865186     */
    5187     if (pOhci->pLoad)
    5188     {
    5189         int rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, ohciR3LoadReattachDevices, pOhci,
     5187    if (pThis->pLoad)
     5188    {
     5189        int rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, ohciR3LoadReattachDevices, pThis,
    51905190                                        TMTIMER_FLAGS_NO_CRIT_SECT, "OHCI reattach devices on load",
    5191                                         &pOhci->pLoad->pTimer);
     5191                                        &pThis->pLoad->pTimer);
    51925192        if (RT_SUCCESS(rc))
    5193             rc = TMTimerSetMillies(pOhci->pLoad->pTimer, 250);
     5193            rc = TMTimerSetMillies(pThis->pLoad->pTimer, 250);
    51945194        return rc;
    51955195    }
     
    52045204static DECLCALLBACK(void) ohciR3LoadReattachDevices(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
    52055205{
    5206     POHCI pOhci = (POHCI)pvUser;
    5207     POHCILOAD pLoad = pOhci->pLoad;
    5208     POHCIROOTHUB pRh = &pOhci->RootHub;
     5206    POHCI pThis = (POHCI)pvUser;
     5207    POHCILOAD pLoad = pThis->pLoad;
     5208    POHCIROOTHUB pRh = &pThis->RootHub;
    52095209    LogFlow(("ohciR3LoadReattachDevices:\n"));
    52105210
     
    52205220    TMR3TimerDestroy(pTimer);
    52215221    MMR3HeapFree(pLoad);
    5222     pOhci->pLoad = NULL;
     5222    pThis->pLoad = NULL;
    52235223}
    52245224
     
    52325232static DECLCALLBACK(void) ohciR3Reset(PPDMDEVINS pDevIns)
    52335233{
    5234     POHCI pOhci = PDMINS_2_DATA(pDevIns, POHCI);
     5234    POHCI pThis = PDMINS_2_DATA(pDevIns, POHCI);
    52355235    LogFlow(("ohciR3Reset:\n"));
    52365236
     
    52435243     *            just one way of getting into the UsbReset state.
    52445244     */
    5245     ohciBusStop(pOhci);
    5246     ohciDoReset(pOhci, OHCI_USB_RESET, true /* reset devices */);
     5245    ohciBusStop(pThis);
     5246    ohciDoReset(pThis, OHCI_USB_RESET, true /* reset devices */);
    52475247}
    52485248
     
    52575257static DECLCALLBACK(void) ohciR3InfoRegs(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
    52585258{
    5259     POHCI pOhci = PDMINS_2_DATA(pDevIns, POHCI);
     5259    POHCI pThis = PDMINS_2_DATA(pDevIns, POHCI);
    52605260    uint32_t val, ctl, status;
    52615261
    52625262    /* Control register */
    5263     ctl = pOhci->ctl;
     5263    ctl = pThis->ctl;
    52645264    pHlp->pfnPrintf(pHlp, "HcControl: %08x - CBSR=%d PLE=%d IE=%d CLE=%d BLE=%d HCFS=%#x IR=%d RWC=%d RWE=%d\n",
    52655265          ctl, ctl & 3, (ctl >> 2) & 1, (ctl >> 3) & 1, (ctl >> 4) & 1, (ctl >> 5) & 1, (ctl >> 6) & 3, (ctl >> 8) & 1,
     
    52675267
    52685268    /* Command status register */
    5269     status = pOhci->status;
     5269    status = pThis->status;
    52705270    pHlp->pfnPrintf(pHlp, "HcCommandStatus:   %08x - HCR=%d CLF=%d BLF=%d OCR=%d SOC=%d\n",
    52715271          status, status & 1, (status >> 1) & 1, (status >> 2) & 1, (status >> 3) & 1, (status >> 16) & 3);
    52725272
    52735273    /* Interrupt status register */
    5274     val = pOhci->intr_status;
     5274    val = pThis->intr_status;
    52755275    pHlp->pfnPrintf(pHlp, "HcInterruptStatus: %08x - SO=%d WDH=%d SF=%d RD=%d UE=%d FNO=%d RHSC=%d OC=%d\n",
    52765276          val, val & 1, (val >> 1) & 1, (val >> 2) & 1, (val >> 3) & 1, (val >> 4) & 1, (val >> 5) & 1,
     
    52785278
    52795279    /* Interrupt enable register */
    5280     val = pOhci->intr;
     5280    val = pThis->intr;
    52815281    pHlp->pfnPrintf(pHlp, "HcInterruptEnable: %08x - SO=%d WDH=%d SF=%d RD=%d UE=%d FNO=%d RHSC=%d OC=%d MIE=%d\n",
    52825282          val, val & 1, (val >> 1) & 1, (val >> 2) & 1, (val >> 3) & 1, (val >> 4) & 1, (val >> 5) & 1,
     
    52845284
    52855285    /* HCCA address register */
    5286     pHlp->pfnPrintf(pHlp, "HcHCCA: %08x\n", pOhci->hcca);
     5286    pHlp->pfnPrintf(pHlp, "HcHCCA: %08x\n", pThis->hcca);
    52875287
    52885288    /* Current periodic ED register */
    5289     pHlp->pfnPrintf(pHlp, "HcPeriodCurrentED:  %08x\n", pOhci->per_cur);
     5289    pHlp->pfnPrintf(pHlp, "HcPeriodCurrentED:  %08x\n", pThis->per_cur);
    52905290
    52915291    /* Control ED registers */
    5292     pHlp->pfnPrintf(pHlp, "HcControlHeadED:    %08x\n", pOhci->ctrl_head);
    5293     pHlp->pfnPrintf(pHlp, "HcControlCurrentED: %08x\n", pOhci->ctrl_cur);
     5292    pHlp->pfnPrintf(pHlp, "HcControlHeadED:    %08x\n", pThis->ctrl_head);
     5293    pHlp->pfnPrintf(pHlp, "HcControlCurrentED: %08x\n", pThis->ctrl_cur);
    52945294
    52955295    /* Bulk ED registers */
    5296     pHlp->pfnPrintf(pHlp, "HcBulkHeadED:       %08x\n", pOhci->bulk_head);
    5297     pHlp->pfnPrintf(pHlp, "HcBulkCurrentED:    %08x\n", pOhci->bulk_cur);
     5296    pHlp->pfnPrintf(pHlp, "HcBulkHeadED:       %08x\n", pThis->bulk_head);
     5297    pHlp->pfnPrintf(pHlp, "HcBulkCurrentED:    %08x\n", pThis->bulk_cur);
    52985298
    52995299    /* Done head register */
    5300     pHlp->pfnPrintf(pHlp, "HcDoneHead:         %08x\n", pOhci->done);
     5300    pHlp->pfnPrintf(pHlp, "HcDoneHead:         %08x\n", pThis->done);
    53015301
    53025302    pHlp->pfnPrintf(pHlp, "\n");
     
    53135313static DECLCALLBACK(void) ohciR3Relocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta)
    53145314{
    5315     POHCI pOhci = PDMINS_2_DATA(pDevIns, POHCI);
    5316     pOhci->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
    5317     pOhci->pEndOfFrameTimerRC = TMTimerRCPtr(pOhci->pEndOfFrameTimerR3);
     5315    POHCI pThis = PDMINS_2_DATA(pDevIns, POHCI);
     5316    pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
     5317    pThis->pEndOfFrameTimerRC = TMTimerRCPtr(pThis->pEndOfFrameTimerR3);
    53185318}
    53195319
     
    53455345static DECLCALLBACK(int) ohciR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg)
    53465346{
    5347     POHCI pOhci = PDMINS_2_DATA(pDevIns, POHCI);
     5347    POHCI pThis = PDMINS_2_DATA(pDevIns, POHCI);
    53485348    PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
    53495349
     
    53515351     * Init instance data.
    53525352     */
    5353     pOhci->pDevInsR3 = pDevIns;
    5354     pOhci->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
    5355     pOhci->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
    5356 
    5357     PCIDevSetVendorId     (&pOhci->PciDev, 0x106b);
    5358     PCIDevSetDeviceId     (&pOhci->PciDev, 0x003f);
    5359     PCIDevSetClassProg    (&pOhci->PciDev, 0x10); /* OHCI */
    5360     PCIDevSetClassSub     (&pOhci->PciDev, 0x03);
    5361     PCIDevSetClassBase    (&pOhci->PciDev, 0x0c);
    5362     PCIDevSetInterruptPin (&pOhci->PciDev, 0x01);
     5353    pThis->pDevInsR3 = pDevIns;
     5354    pThis->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
     5355    pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
     5356
     5357    PCIDevSetVendorId     (&pThis->PciDev, 0x106b);
     5358    PCIDevSetDeviceId     (&pThis->PciDev, 0x003f);
     5359    PCIDevSetClassProg    (&pThis->PciDev, 0x10); /* OHCI */
     5360    PCIDevSetClassSub     (&pThis->PciDev, 0x03);
     5361    PCIDevSetClassBase    (&pThis->PciDev, 0x0c);
     5362    PCIDevSetInterruptPin (&pThis->PciDev, 0x01);
    53635363#ifdef VBOX_WITH_MSI_DEVICES
    5364     PCIDevSetStatus       (&pOhci->PciDev, VBOX_PCI_STATUS_CAP_LIST);
    5365     PCIDevSetCapabilityList(&pOhci->PciDev, 0x80);
     5364    PCIDevSetStatus       (&pThis->PciDev, VBOX_PCI_STATUS_CAP_LIST);
     5365    PCIDevSetCapabilityList(&pThis->PciDev, 0x80);
    53665366#endif
    53675367
    5368     pOhci->RootHub.pOhci                         = pOhci;
    5369     pOhci->RootHub.IBase.pfnQueryInterface       = ohciRhQueryInterface;
    5370     pOhci->RootHub.IRhPort.pfnGetAvailablePorts  = ohciRhGetAvailablePorts;
    5371     pOhci->RootHub.IRhPort.pfnGetUSBVersions     = ohciRhGetUSBVersions;
    5372     pOhci->RootHub.IRhPort.pfnAttach             = ohciRhAttach;
    5373     pOhci->RootHub.IRhPort.pfnDetach             = ohciRhDetach;
    5374     pOhci->RootHub.IRhPort.pfnReset              = ohciRhReset;
    5375     pOhci->RootHub.IRhPort.pfnXferCompletion     = ohciRhXferCompletion;
    5376     pOhci->RootHub.IRhPort.pfnXferError          = ohciRhXferError;
     5368    pThis->RootHub.pOhci                         = pThis;
     5369    pThis->RootHub.IBase.pfnQueryInterface       = ohciRhQueryInterface;
     5370    pThis->RootHub.IRhPort.pfnGetAvailablePorts  = ohciRhGetAvailablePorts;
     5371    pThis->RootHub.IRhPort.pfnGetUSBVersions     = ohciRhGetUSBVersions;
     5372    pThis->RootHub.IRhPort.pfnAttach             = ohciRhAttach;
     5373    pThis->RootHub.IRhPort.pfnDetach             = ohciRhDetach;
     5374    pThis->RootHub.IRhPort.pfnReset              = ohciRhReset;
     5375    pThis->RootHub.IRhPort.pfnXferCompletion     = ohciRhXferCompletion;
     5376    pThis->RootHub.IRhPort.pfnXferError          = ohciRhXferError;
    53775377
    53785378    /* USB LED */
    5379     pOhci->RootHub.Led.u32Magic                  = PDMLED_MAGIC;
    5380     pOhci->RootHub.ILeds.pfnQueryStatusLed       = ohciRhQueryStatusLed;
     5379    pThis->RootHub.Led.u32Magic                  = PDMLED_MAGIC;
     5380    pThis->RootHub.ILeds.pfnQueryStatusLed       = ohciRhQueryStatusLed;
    53815381
    53825382
     
    53855385     */
    53865386    PDMDEV_VALIDATE_CONFIG_RETURN(pDevIns, "RZEnabled", "");
    5387     int rc = CFGMR3QueryBoolDef(pCfg, "RZEnabled", &pOhci->fRZEnabled, true);
     5387    int rc = CFGMR3QueryBoolDef(pCfg, "RZEnabled", &pThis->fRZEnabled, true);
    53885388    AssertLogRelRCReturn(rc, rc);
    53895389
     
    53925392     * Register PCI device and I/O region.
    53935393     */
    5394     rc = PDMDevHlpPCIRegister(pDevIns, &pOhci->PciDev);
     5394    rc = PDMDevHlpPCIRegister(pDevIns, &pThis->PciDev);
    53955395    if (RT_FAILURE(rc))
    53965396        return rc;
     
    54055405    if (RT_FAILURE(rc))
    54065406    {
    5407         PCIDevSetCapabilityList(&pOhci->PciDev, 0x0);
     5407        PCIDevSetCapabilityList(&pThis->PciDev, 0x0);
    54085408        /* That's OK, we can work without MSI */
    54095409    }
     
    54175417     * Create the end-of-frame timer.
    54185418     */
    5419     rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, ohciFrameBoundaryTimer, pOhci,
     5419    rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, ohciFrameBoundaryTimer, pThis,
    54205420                                TMTIMER_FLAGS_DEFAULT_CRIT_SECT, "USB Frame Timer",
    5421                                 &pOhci->pEndOfFrameTimerR3);
     5421                                &pThis->pEndOfFrameTimerR3);
    54225422    if (RT_FAILURE(rc))
    54235423        return rc;
    5424     pOhci->pEndOfFrameTimerR0 = TMTimerR0Ptr(pOhci->pEndOfFrameTimerR3);
    5425     pOhci->pEndOfFrameTimerRC = TMTimerRCPtr(pOhci->pEndOfFrameTimerR3);
     5424    pThis->pEndOfFrameTimerR0 = TMTimerR0Ptr(pThis->pEndOfFrameTimerR3);
     5425    pThis->pEndOfFrameTimerRC = TMTimerRCPtr(pThis->pEndOfFrameTimerR3);
    54265426
    54275427    /*
    54285428     * Register the saved state data unit.
    54295429     */
    5430     rc = PDMDevHlpSSMRegisterEx(pDevIns, OHCI_SAVED_STATE_VERSION, sizeof(*pOhci), NULL,
     5430    rc = PDMDevHlpSSMRegisterEx(pDevIns, OHCI_SAVED_STATE_VERSION, sizeof(*pThis), NULL,
    54315431                                NULL, NULL, NULL,
    54325432                                ohciR3SavePrep, ohciR3SaveExec, ohciR3SaveDone,
     
    54385438     * Attach to the VBox USB RootHub Driver on LUN #0.
    54395439     */
    5440     rc = PDMDevHlpDriverAttach(pDevIns, 0, &pOhci->RootHub.IBase, &pOhci->RootHub.pIBase, "RootHub");
     5440    rc = PDMDevHlpDriverAttach(pDevIns, 0, &pThis->RootHub.IBase, &pThis->RootHub.pIBase, "RootHub");
    54415441    if (RT_FAILURE(rc))
    54425442    {
     
    54445444        return rc;
    54455445    }
    5446     pOhci->RootHub.pIRhConn = PDMIBASE_QUERY_INTERFACE(pOhci->RootHub.pIBase, VUSBIROOTHUBCONNECTOR);
    5447     AssertMsgReturn(pOhci->RootHub.pIRhConn,
     5446    pThis->RootHub.pIRhConn = PDMIBASE_QUERY_INTERFACE(pThis->RootHub.pIBase, VUSBIROOTHUBCONNECTOR);
     5447    AssertMsgReturn(pThis->RootHub.pIRhConn,
    54485448                    ("Configuration error: The driver doesn't provide the VUSBIROOTHUBCONNECTOR interface!\n"),
    54495449                    VERR_PDM_MISSING_INTERFACE);
    5450     pOhci->RootHub.pIDev = PDMIBASE_QUERY_INTERFACE(pOhci->RootHub.pIBase, VUSBIDEVICE);
    5451     AssertMsgReturn(pOhci->RootHub.pIDev,
     5450    pThis->RootHub.pIDev = PDMIBASE_QUERY_INTERFACE(pThis->RootHub.pIBase, VUSBIDEVICE);
     5451    AssertMsgReturn(pThis->RootHub.pIDev,
    54525452                    ("Configuration error: The driver doesn't provide the VUSBIDEVICE interface!\n"),
    54535453                    VERR_PDM_MISSING_INTERFACE);
     
    54575457     */
    54585458    PPDMIBASE pBase;
    5459     rc = PDMDevHlpDriverAttach(pDevIns, PDM_STATUS_LUN, &pOhci->RootHub.IBase, &pBase, "Status Port");
     5459    rc = PDMDevHlpDriverAttach(pDevIns, PDM_STATUS_LUN, &pThis->RootHub.IBase, &pBase, "Status Port");
    54605460    if (RT_SUCCESS(rc))
    5461         pOhci->RootHub.pLedsConnector = PDMIBASE_QUERY_INTERFACE(pBase, PDMILEDCONNECTORS);
     5461        pThis->RootHub.pLedsConnector = PDMIBASE_QUERY_INTERFACE(pBase, PDMILEDCONNECTORS);
    54625462    else if (rc != VERR_PDM_NO_ATTACHED_DRIVER)
    54635463    {
     
    54705470     * This assumes that the VM timer doesn't change frequency during the run.
    54715471     */
    5472     pOhci->u64TimerHz = TMTimerGetFreq(pOhci->CTX_SUFF(pEndOfFrameTimer));
    5473     ohciCalcTimerIntervals(pOhci, OHCI_DEFAULT_TIMER_FREQ);
     5472    pThis->u64TimerHz = TMTimerGetFreq(pThis->CTX_SUFF(pEndOfFrameTimer));
     5473    ohciCalcTimerIntervals(pThis, OHCI_DEFAULT_TIMER_FREQ);
    54745474    Log(("ohci: cTicksPerFrame=%RU64 cTicksPerUsbTick=%RU64\n",
    5475          pOhci->cTicksPerFrame, pOhci->cTicksPerUsbTick));
     5475         pThis->cTicksPerFrame, pThis->cTicksPerUsbTick));
    54765476
    54775477    /*
    54785478     * Do a hardware reset.
    54795479     */
    5480     ohciDoReset(pOhci, OHCI_USB_RESET, false /* don't reset devices */);
     5480    ohciDoReset(pThis, OHCI_USB_RESET, false /* don't reset devices */);
    54815481
    54825482#ifdef VBOX_WITH_STATISTICS
     
    54845484     * Register statistics.
    54855485     */
    5486     PDMDevHlpSTAMRegister(pDevIns, &pOhci->StatCanceledIsocUrbs, STAMTYPE_COUNTER, "/Devices/OHCI/CanceledIsocUrbs", STAMUNIT_OCCURENCES,     "Detected canceled isochronous URBs.");
    5487     PDMDevHlpSTAMRegister(pDevIns, &pOhci->StatCanceledGenUrbs,  STAMTYPE_COUNTER, "/Devices/OHCI/CanceledGenUrbs",  STAMUNIT_OCCURENCES,     "Detected canceled general URBs.");
    5488     PDMDevHlpSTAMRegister(pDevIns, &pOhci->StatDroppedUrbs,      STAMTYPE_COUNTER, "/Devices/OHCI/DroppedUrbs",      STAMUNIT_OCCURENCES,     "Dropped URBs (endpoint halted, or URB canceled).");
    5489     PDMDevHlpSTAMRegister(pDevIns, &pOhci->StatTimer,            STAMTYPE_PROFILE, "/Devices/OHCI/Timer",            STAMUNIT_TICKS_PER_CALL, "Profiling ohciFrameBoundaryTimer.");
     5486    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatCanceledIsocUrbs, STAMTYPE_COUNTER, "/Devices/OHCI/CanceledIsocUrbs", STAMUNIT_OCCURENCES,     "Detected canceled isochronous URBs.");
     5487    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatCanceledGenUrbs,  STAMTYPE_COUNTER, "/Devices/OHCI/CanceledGenUrbs",  STAMUNIT_OCCURENCES,     "Detected canceled general URBs.");
     5488    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatDroppedUrbs,      STAMTYPE_COUNTER, "/Devices/OHCI/DroppedUrbs",      STAMUNIT_OCCURENCES,     "Dropped URBs (endpoint halted, or URB canceled).");
     5489    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatTimer,            STAMTYPE_PROFILE, "/Devices/OHCI/Timer",            STAMUNIT_TICKS_PER_CALL, "Profiling ohciFrameBoundaryTimer.");
    54905490#endif
    54915491
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette