VirtualBox

Changeset 82141 in vbox


Ignore:
Timestamp:
Nov 24, 2019 12:45:04 AM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
134951
Message:

DevPCNet: Converted MMIO handlers. [fixes] bugref:9218

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DevPCNet.cpp

    r82140 r82141  
    18961896        {
    18971897            /* Not owned by controller. This should not be possible as
    1898              * we already called pcnetCanReceive(). */
     1898             * we already called pcnetR3CanReceive(). */
    18991899            LogRel(("PCnet#%d: no buffer: RCVRC=%d\n", PCNET_INST_NR, CSR_RCVRC(pThis)));
    19001900            /* Dump the status of all RX descriptors */
     
    27692769        /*
    27702770         * The second case is important for pcnetWaitReceiveAvail(): If CSR_CRST(pThis) was
    2771          * true but pcnetCanReceive() returned false for some other reason we need to check
     2771         * true but pcnetR3CanReceive() returned false for some other reason we need to check
    27722772         * _now_ if we have to wakeup pcnetWaitReceiveAvail().
    27732773         */
     
    37983798/* -=-=-=-=-=- MMIO -=-=-=-=-=- */
    37993799
    3800 static void pcnetMMIOWriteU8(PPCNETSTATE pThis, RTGCPHYS off, uint32_t val)
     3800#ifdef IN_RING3
     3801
     3802static void pcnetR3MmioWriteU8(PPCNETSTATE pThis, RTGCPHYS off, uint32_t val)
    38013803{
    38023804#ifdef PCNET_DEBUG_IO
    3803     Log2(("#%d pcnetMMIOWriteU8: off=%#010x val=%#04x\n", PCNET_INST_NR, off, val));
     3805    Log2(("#%d pcnetR3MmioWriteU8: off=%#010x val=%#04x\n", PCNET_INST_NR, off, val));
    38043806#endif
    38053807    if (!(off & 0x10))
     
    38073809}
    38083810
    3809 static uint32_t pcnetMMIOReadU8(PPCNETSTATE pThis, RTGCPHYS addr)
     3811static uint32_t pcnetR3MmioReadU8(PPCNETSTATE pThis, RTGCPHYS addr)
    38103812{
    38113813    uint32_t val = ~0U;
     
    38133815        val = pcnetAPROMReadU8(pThis, addr);
    38143816#ifdef PCNET_DEBUG_IO
    3815     Log2(("#%d pcnetMMIOReadU8: addr=%#010x val=%#04x\n", PCNET_INST_NR, addr, val & 0xff));
     3817    Log2(("#%d pcnetR3MmioReadU8: addr=%#010x val=%#04x\n", PCNET_INST_NR, addr, val & 0xff));
    38163818#endif
    38173819    return val;
    38183820}
    38193821
    3820 static VBOXSTRICTRC pcnetMMIOWriteU16(PPDMDEVINS pDevIns, PPCNETSTATE pThis, RTGCPHYS off, uint32_t val)
     3822static VBOXSTRICTRC pcnetR3MmioWriteU16(PPDMDEVINS pDevIns, PPCNETSTATE pThis, RTGCPHYS off, uint32_t val)
    38213823{
    38223824    VBOXSTRICTRC rcStrict;
    38233825#ifdef PCNET_DEBUG_IO
    3824     Log2(("#%d pcnetMMIOWriteU16: off=%#010x val=%#06x\n", PCNET_INST_NR, off, val));
     3826    Log2(("#%d pcnetR3MmioWriteU16: off=%#010x val=%#06x\n", PCNET_INST_NR, off, val));
    38253827#endif
    38263828    if (off & 0x10)
     
    38393841}
    38403842
    3841 static uint32_t pcnetMMIOReadU16(PPDMDEVINS pDevIns, PPCNETSTATE pThis, RTGCPHYS addr)
     3843static uint32_t pcnetR3MmioReadU16(PPDMDEVINS pDevIns, PPCNETSTATE pThis, RTGCPHYS addr)
    38423844{
    38433845    uint32_t val = ~0U;
     
    38523854    }
    38533855#ifdef PCNET_DEBUG_IO
    3854     Log2(("#%d pcnetMMIOReadU16: addr=%#010x val = %#06x\n", PCNET_INST_NR, addr, val & 0xffff));
     3856    Log2(("#%d pcnetR3MmioReadU16: addr=%#010x val = %#06x\n", PCNET_INST_NR, addr, val & 0xffff));
    38553857#endif
    38563858    return val;
    38573859}
    38583860
    3859 static VBOXSTRICTRC pcnetMMIOWriteU32(PPDMDEVINS pDevIns, PPCNETSTATE pThis, RTGCPHYS off, uint32_t val)
     3861static VBOXSTRICTRC pcnetR3MmioWriteU32(PPDMDEVINS pDevIns, PPCNETSTATE pThis, RTGCPHYS off, uint32_t val)
    38603862{
    38613863    VBOXSTRICTRC rcStrict;
    38623864#ifdef PCNET_DEBUG_IO
    3863     Log2(("#%d pcnetMMIOWriteU32: off=%#010x val=%#010x\n", PCNET_INST_NR, off, val));
     3865    Log2(("#%d pcnetR3MmioWriteU32: off=%#010x val=%#010x\n", PCNET_INST_NR, off, val));
    38643866#endif
    38653867    if (off & 0x10)
     
    38803882}
    38813883
    3882 static uint32_t pcnetMMIOReadU32(PPDMDEVINS pDevIns, PPCNETSTATE pThis, RTGCPHYS addr)
     3884static uint32_t pcnetR3MmioReadU32(PPDMDEVINS pDevIns, PPCNETSTATE pThis, RTGCPHYS addr)
    38833885{
    38843886    uint32_t val;
     
    38973899    }
    38983900#ifdef PCNET_DEBUG_IO
    3899     Log2(("#%d pcnetMMIOReadU32: addr=%#010x val=%#010x\n", PCNET_INST_NR, addr, val));
     3901    Log2(("#%d pcnetR3MmioReadU32: addr=%#010x val=%#010x\n", PCNET_INST_NR, addr, val));
    39003902#endif
    39013903    return val;
    39023904}
    39033905
    3904 #ifdef IN_RING3
    39053906
    39063907/**
     
    39223923        switch (cb)
    39233924        {
    3924             case 1:  *(uint8_t  *)pv = pcnetMMIOReadU8 (pThis, off); break;
    3925             case 2:  *(uint16_t *)pv = pcnetMMIOReadU16(pDevIns, pThis, off); break;
    3926             case 4:  *(uint32_t *)pv = pcnetMMIOReadU32(pDevIns, pThis, off); break;
     3925            case 1:  *(uint8_t  *)pv = pcnetR3MmioReadU8 (pThis, off); break;
     3926            case 2:  *(uint16_t *)pv = pcnetR3MmioReadU16(pDevIns, pThis, off); break;
     3927            case 4:  *(uint32_t *)pv = pcnetR3MmioReadU32(pDevIns, pThis, off); break;
    39273928            default:
    39283929                rc = PDMDevHlpDBGFStop(pDevIns, RT_SRC_POS, "pcnetR3MmioRead: unsupported op size: address=%RGp cb=%u\n", off, cb);
     
    39573958        switch (cb)
    39583959        {
    3959             case 1:  pcnetMMIOWriteU8(pThis, off, *(uint8_t  *)pv); break;
    3960             case 2:  rc = pcnetMMIOWriteU16(pDevIns, pThis, off, *(uint16_t *)pv); break;
    3961             case 4:  rc = pcnetMMIOWriteU32(pDevIns, pThis, off, *(uint32_t *)pv); break;
     3960            case 1:  pcnetR3MmioWriteU8(pThis, off, *(uint8_t  *)pv); break;
     3961            case 2:  rc = pcnetR3MmioWriteU16(pDevIns, pThis, off, *(uint16_t *)pv); break;
     3962            case 4:  rc = pcnetR3MmioWriteU32(pDevIns, pThis, off, *(uint32_t *)pv); break;
    39623963            default:
    39633964                rc = PDMDevHlpDBGFStop(pDevIns, RT_SRC_POS, "pcnetR3MmioWrite: unsupported op size: address=%RGp cb=%u\n", off, cb);
     
    40904091 * @callback_method_impl{FNDBGFHANDLERDEV}
    40914092 */
    4092 static DECLCALLBACK(void) pcnetInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     4093static DECLCALLBACK(void) pcnetR3Info(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
    40934094{
    40944095    PPCNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PPCNETSTATE);
     
    43634364 * @param  pThis        The PCnet shared instance data.
    43644365 */
    4365 static void pcnetTempLinkDown(PPDMDEVINS pDevIns, PPCNETSTATE pThis)
     4366static void pcnetR3TempLinkDown(PPDMDEVINS pDevIns, PPCNETSTATE pThis)
    43664367{
    43674368    if (pThis->fLinkUp)
     
    43864387 * @param   pSSM        The saved state handle.
    43874388 */
    4388 static void pcnetSaveConfig(PCPDMDEVHLPR3 pHlp, PPCNETSTATE pThis, PSSMHANDLE pSSM)
     4389static void pcnetR3SaveConfig(PCPDMDEVHLPR3 pHlp, PPCNETSTATE pThis, PSSMHANDLE pSSM)
    43894390{
    43904391    pHlp->pfnSSMPutMem(pSSM, &pThis->MacConfigured, sizeof(pThis->MacConfigured));
     
    44014402    RT_NOREF(uPass);
    44024403    PPCNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PPCNETSTATE);
    4403     pcnetSaveConfig(pDevIns->pHlpR3, pThis, pSSM);
     4404    pcnetR3SaveConfig(pDevIns->pHlpR3, pThis, pSSM);
    44044405    return VINF_SSM_DONT_CALL_AGAIN;
    44054406}
     
    44454446    pHlp->pfnSSMPutU16(pSSM, pThis->u16CSR0LastSeenByGuest);
    44464447    pHlp->pfnSSMPutU64(pSSM, pThis->u64LastPoll);
    4447     pcnetSaveConfig(pHlp, pThis, pSSM);
     4448    pcnetR3SaveConfig(pHlp, pThis, pSSM);
    44484449
    44494450    int rc = VINF_SUCCESS;
     
    45884589           been lost, unless we've been teleported here. */
    45894590        if (!PDMDevHlpVMTeleportedAndNotFullyResumedYet(pDevIns))
    4590             pcnetTempLinkDown(pDevIns, pThis);
     4591            pcnetR3TempLinkDown(pDevIns, pThis);
    45914592    }
    45924593
     
    46164617 * Check if the device/driver can receive data now.
    46174618 *
    4618  * Worker for pcnetNetworkDown_WaitReceiveAvail().  This must be called before
     4619 * Worker for pcnetR3NetworkDown_WaitReceiveAvail().  This must be called before
    46194620 * the pfnRecieve() method is called.
    46204621 *
     
    46224623 * @param   pThis           The PCnet shared instance data.
    46234624 */
    4624 static int pcnetCanReceive(PPCNETSTATE pThis)
     4625static int pcnetR3CanReceive(PPCNETSTATE pThis)
    46254626{
    46264627    int rc = PDMCritSectEnter(&pThis->CritSect, VERR_SEM_BUSY);
     
    46524653 * @interface_method_impl{PDMINETWORKDOWN,pfnWaitReceiveAvail}
    46534654 */
    4654 static DECLCALLBACK(int) pcnetNetworkDown_WaitReceiveAvail(PPDMINETWORKDOWN pInterface, RTMSINTERVAL cMillies)
     4655static DECLCALLBACK(int) pcnetR3NetworkDown_WaitReceiveAvail(PPDMINETWORKDOWN pInterface, RTMSINTERVAL cMillies)
    46554656{
    46564657    PPCNETSTATE pThis = RT_FROM_MEMBER(pInterface, PCNETSTATE, INetworkDown);
    46574658    PPDMDEVINS  pDevIns = pThis->pDevInsR3;
    46584659
    4659     int rc = pcnetCanReceive(pThis);
     4660    int rc = pcnetR3CanReceive(pThis);
    46604661    if (RT_SUCCESS(rc))
    46614662        return VINF_SUCCESS;
     
    46704671                     || enmVMState == VMSTATE_RUNNING_LS))
    46714672    {
    4672         int rc2 = pcnetCanReceive(pThis);
     4673        int rc2 = pcnetR3CanReceive(pThis);
    46734674        if (RT_SUCCESS(rc2))
    46744675        {
     
    46764677            break;
    46774678        }
    4678         LogFlow(("pcnetNetworkDown_WaitReceiveAvail: waiting cMillies=%u...\n", cMillies));
     4679        LogFlow(("pcnetR3NetworkDown_WaitReceiveAvail: waiting cMillies=%u...\n", cMillies));
    46794680        /* Start the poll timer once which will remain active as long fMaybeOutOfSpace
    46804681         * is true -- even if (transmit) polling is disabled (CSR_DPOLL). */
     
    46974698 * @interface_method_impl{PDMINETWORKDOWN,pfnReceive}
    46984699 */
    4699 static DECLCALLBACK(int) pcnetNetworkDown_Receive(PPDMINETWORKDOWN pInterface, const void *pvBuf, size_t cb)
     4700static DECLCALLBACK(int) pcnetR3NetworkDown_Receive(PPDMINETWORKDOWN pInterface, const void *pvBuf, size_t cb)
    47004701{
    47014702    PPCNETSTATE pThis = RT_FROM_MEMBER(pInterface, PCNETSTATE, INetworkDown);
     
    47514752 * @interface_method_impl{PDMINETWORKDOWN,pfnXmitPending}
    47524753 */
    4753 static DECLCALLBACK(void) pcnetNetworkDown_XmitPending(PPDMINETWORKDOWN pInterface)
     4754static DECLCALLBACK(void) pcnetR3NetworkDown_XmitPending(PPDMINETWORKDOWN pInterface)
    47544755{
    47554756    PPCNETSTATE pThis = RT_FROM_MEMBER(pInterface, PCNETSTATE, INetworkDown);
     
    47634764 * @interface_method_impl{PDMINETWORKCONFIG,pfnGetMac}
    47644765 */
    4765 static DECLCALLBACK(int) pcnetGetMac(PPDMINETWORKCONFIG pInterface, PRTMAC pMac)
     4766static DECLCALLBACK(int) pcnetR3NetworkConfig_GetMac(PPDMINETWORKCONFIG pInterface, PRTMAC pMac)
    47664767{
    47674768    PPCNETSTATE pThis = RT_FROM_MEMBER(pInterface, PCNETSTATE, INetworkConfig);
     
    47744775 * @interface_method_impl{PDMINETWORKCONFIG,pfnGetLinkState}
    47754776 */
    4776 static DECLCALLBACK(PDMNETWORKLINKSTATE) pcnetGetLinkState(PPDMINETWORKCONFIG pInterface)
     4777static DECLCALLBACK(PDMNETWORKLINKSTATE) pcnetR3NetworkConfig_GetLinkState(PPDMINETWORKCONFIG pInterface)
    47774778{
    47784779    PPCNETSTATE pThis = RT_FROM_MEMBER(pInterface, PCNETSTATE, INetworkConfig);
     
    47914792 * @interface_method_impl{PDMINETWORKCONFIG,pfnSetLinkState}
    47924793 */
    4793 static DECLCALLBACK(int) pcnetSetLinkState(PPDMINETWORKCONFIG pInterface, PDMNETWORKLINKSTATE enmState)
     4794static DECLCALLBACK(int) pcnetR3NetworkConfig_SetLinkState(PPDMINETWORKCONFIG pInterface, PDMNETWORKLINKSTATE enmState)
    47944795{
    47954796    PPCNETSTATE     pThis   = RT_FROM_MEMBER(pInterface, PCNETSTATE, INetworkConfig);
     
    48024803    if (enmState == PDMNETWORKLINKSTATE_DOWN_RESUME)
    48034804    {
    4804         pcnetTempLinkDown(pDevIns, pThis);
     4805        pcnetR3TempLinkDown(pDevIns, pThis);
    48054806        /*
    48064807         * Note that we do not notify the driver about the link state change because
     
    49574958     */
    49584959    if (RT_SUCCESS(rc))
    4959         pcnetTempLinkDown(pDevIns, pThis);
     4960        pcnetR3TempLinkDown(pDevIns, pThis);
    49604961
    49614962    PDMCritSectLeave(&pThis->CritSect);
     
    51465147    pThis->IBase.pfnQueryInterface          = pcnetQueryInterface;
    51475148    /* INeworkPort */
    5148     pThis->INetworkDown.pfnWaitReceiveAvail = pcnetNetworkDown_WaitReceiveAvail;
    5149     pThis->INetworkDown.pfnReceive          = pcnetNetworkDown_Receive;
    5150     pThis->INetworkDown.pfnXmitPending      = pcnetNetworkDown_XmitPending;
     5149    pThis->INetworkDown.pfnWaitReceiveAvail = pcnetR3NetworkDown_WaitReceiveAvail;
     5150    pThis->INetworkDown.pfnReceive          = pcnetR3NetworkDown_Receive;
     5151    pThis->INetworkDown.pfnXmitPending      = pcnetR3NetworkDown_XmitPending;
    51515152    /* INetworkConfig */
    5152     pThis->INetworkConfig.pfnGetMac         = pcnetGetMac;
    5153     pThis->INetworkConfig.pfnGetLinkState   = pcnetGetLinkState;
    5154     pThis->INetworkConfig.pfnSetLinkState   = pcnetSetLinkState;
     5153    pThis->INetworkConfig.pfnGetMac         = pcnetR3NetworkConfig_GetMac;
     5154    pThis->INetworkConfig.pfnGetLinkState   = pcnetR3NetworkConfig_GetLinkState;
     5155    pThis->INetworkConfig.pfnSetLinkState   = pcnetR3NetworkConfig_SetLinkState;
    51555156    /* ILeds */
    51565157    pThis->ILeds.pfnQueryStatusLed          = pcnetQueryStatusLed;
     
    53385339     */
    53395340    RTStrPrintf(szTmp, sizeof(szTmp), "pcnet%d", pDevIns->iInstance);
    5340     PDMDevHlpDBGFInfoRegister(pDevIns, szTmp, "PCNET info.", pcnetInfo);
     5341    PDMDevHlpDBGFInfoRegister(pDevIns, szTmp, "PCNET info.", pcnetR3Info);
    53415342
    53425343    /*
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