Changeset 82141 in vbox
- Timestamp:
- Nov 24, 2019 12:45:04 AM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 134951
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevPCNet.cpp
r82140 r82141 1896 1896 { 1897 1897 /* Not owned by controller. This should not be possible as 1898 * we already called pcnet CanReceive(). */1898 * we already called pcnetR3CanReceive(). */ 1899 1899 LogRel(("PCnet#%d: no buffer: RCVRC=%d\n", PCNET_INST_NR, CSR_RCVRC(pThis))); 1900 1900 /* Dump the status of all RX descriptors */ … … 2769 2769 /* 2770 2770 * The second case is important for pcnetWaitReceiveAvail(): If CSR_CRST(pThis) was 2771 * true but pcnet CanReceive() returned false for some other reason we need to check2771 * true but pcnetR3CanReceive() returned false for some other reason we need to check 2772 2772 * _now_ if we have to wakeup pcnetWaitReceiveAvail(). 2773 2773 */ … … 3798 3798 /* -=-=-=-=-=- MMIO -=-=-=-=-=- */ 3799 3799 3800 static void pcnetMMIOWriteU8(PPCNETSTATE pThis, RTGCPHYS off, uint32_t val) 3800 #ifdef IN_RING3 3801 3802 static void pcnetR3MmioWriteU8(PPCNETSTATE pThis, RTGCPHYS off, uint32_t val) 3801 3803 { 3802 3804 #ifdef PCNET_DEBUG_IO 3803 Log2(("#%d pcnet MMIOWriteU8: off=%#010x val=%#04x\n", PCNET_INST_NR, off, val));3805 Log2(("#%d pcnetR3MmioWriteU8: off=%#010x val=%#04x\n", PCNET_INST_NR, off, val)); 3804 3806 #endif 3805 3807 if (!(off & 0x10)) … … 3807 3809 } 3808 3810 3809 static uint32_t pcnet MMIOReadU8(PPCNETSTATE pThis, RTGCPHYS addr)3811 static uint32_t pcnetR3MmioReadU8(PPCNETSTATE pThis, RTGCPHYS addr) 3810 3812 { 3811 3813 uint32_t val = ~0U; … … 3813 3815 val = pcnetAPROMReadU8(pThis, addr); 3814 3816 #ifdef PCNET_DEBUG_IO 3815 Log2(("#%d pcnet MMIOReadU8: 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)); 3816 3818 #endif 3817 3819 return val; 3818 3820 } 3819 3821 3820 static VBOXSTRICTRC pcnet MMIOWriteU16(PPDMDEVINS pDevIns, PPCNETSTATE pThis, RTGCPHYS off, uint32_t val)3822 static VBOXSTRICTRC pcnetR3MmioWriteU16(PPDMDEVINS pDevIns, PPCNETSTATE pThis, RTGCPHYS off, uint32_t val) 3821 3823 { 3822 3824 VBOXSTRICTRC rcStrict; 3823 3825 #ifdef PCNET_DEBUG_IO 3824 Log2(("#%d pcnet MMIOWriteU16: off=%#010x val=%#06x\n", PCNET_INST_NR, off, val));3826 Log2(("#%d pcnetR3MmioWriteU16: off=%#010x val=%#06x\n", PCNET_INST_NR, off, val)); 3825 3827 #endif 3826 3828 if (off & 0x10) … … 3839 3841 } 3840 3842 3841 static uint32_t pcnet MMIOReadU16(PPDMDEVINS pDevIns, PPCNETSTATE pThis, RTGCPHYS addr)3843 static uint32_t pcnetR3MmioReadU16(PPDMDEVINS pDevIns, PPCNETSTATE pThis, RTGCPHYS addr) 3842 3844 { 3843 3845 uint32_t val = ~0U; … … 3852 3854 } 3853 3855 #ifdef PCNET_DEBUG_IO 3854 Log2(("#%d pcnet MMIOReadU16: 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)); 3855 3857 #endif 3856 3858 return val; 3857 3859 } 3858 3860 3859 static VBOXSTRICTRC pcnet MMIOWriteU32(PPDMDEVINS pDevIns, PPCNETSTATE pThis, RTGCPHYS off, uint32_t val)3861 static VBOXSTRICTRC pcnetR3MmioWriteU32(PPDMDEVINS pDevIns, PPCNETSTATE pThis, RTGCPHYS off, uint32_t val) 3860 3862 { 3861 3863 VBOXSTRICTRC rcStrict; 3862 3864 #ifdef PCNET_DEBUG_IO 3863 Log2(("#%d pcnet MMIOWriteU32: off=%#010x val=%#010x\n", PCNET_INST_NR, off, val));3865 Log2(("#%d pcnetR3MmioWriteU32: off=%#010x val=%#010x\n", PCNET_INST_NR, off, val)); 3864 3866 #endif 3865 3867 if (off & 0x10) … … 3880 3882 } 3881 3883 3882 static uint32_t pcnet MMIOReadU32(PPDMDEVINS pDevIns, PPCNETSTATE pThis, RTGCPHYS addr)3884 static uint32_t pcnetR3MmioReadU32(PPDMDEVINS pDevIns, PPCNETSTATE pThis, RTGCPHYS addr) 3883 3885 { 3884 3886 uint32_t val; … … 3897 3899 } 3898 3900 #ifdef PCNET_DEBUG_IO 3899 Log2(("#%d pcnet MMIOReadU32: addr=%#010x val=%#010x\n", PCNET_INST_NR, addr, val));3901 Log2(("#%d pcnetR3MmioReadU32: addr=%#010x val=%#010x\n", PCNET_INST_NR, addr, val)); 3900 3902 #endif 3901 3903 return val; 3902 3904 } 3903 3905 3904 #ifdef IN_RING33905 3906 3906 3907 /** … … 3922 3923 switch (cb) 3923 3924 { 3924 case 1: *(uint8_t *)pv = pcnet MMIOReadU8 (pThis, off); break;3925 case 2: *(uint16_t *)pv = pcnet MMIOReadU16(pDevIns, pThis, off); break;3926 case 4: *(uint32_t *)pv = pcnet MMIOReadU32(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; 3927 3928 default: 3928 3929 rc = PDMDevHlpDBGFStop(pDevIns, RT_SRC_POS, "pcnetR3MmioRead: unsupported op size: address=%RGp cb=%u\n", off, cb); … … 3957 3958 switch (cb) 3958 3959 { 3959 case 1: pcnet MMIOWriteU8(pThis, off, *(uint8_t *)pv); break;3960 case 2: rc = pcnet MMIOWriteU16(pDevIns, pThis, off, *(uint16_t *)pv); break;3961 case 4: rc = pcnet MMIOWriteU32(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; 3962 3963 default: 3963 3964 rc = PDMDevHlpDBGFStop(pDevIns, RT_SRC_POS, "pcnetR3MmioWrite: unsupported op size: address=%RGp cb=%u\n", off, cb); … … 4090 4091 * @callback_method_impl{FNDBGFHANDLERDEV} 4091 4092 */ 4092 static DECLCALLBACK(void) pcnet Info(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)4093 static DECLCALLBACK(void) pcnetR3Info(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 4093 4094 { 4094 4095 PPCNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PPCNETSTATE); … … 4363 4364 * @param pThis The PCnet shared instance data. 4364 4365 */ 4365 static void pcnet TempLinkDown(PPDMDEVINS pDevIns, PPCNETSTATE pThis)4366 static void pcnetR3TempLinkDown(PPDMDEVINS pDevIns, PPCNETSTATE pThis) 4366 4367 { 4367 4368 if (pThis->fLinkUp) … … 4386 4387 * @param pSSM The saved state handle. 4387 4388 */ 4388 static void pcnet SaveConfig(PCPDMDEVHLPR3 pHlp, PPCNETSTATE pThis, PSSMHANDLE pSSM)4389 static void pcnetR3SaveConfig(PCPDMDEVHLPR3 pHlp, PPCNETSTATE pThis, PSSMHANDLE pSSM) 4389 4390 { 4390 4391 pHlp->pfnSSMPutMem(pSSM, &pThis->MacConfigured, sizeof(pThis->MacConfigured)); … … 4401 4402 RT_NOREF(uPass); 4402 4403 PPCNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PPCNETSTATE); 4403 pcnet SaveConfig(pDevIns->pHlpR3, pThis, pSSM);4404 pcnetR3SaveConfig(pDevIns->pHlpR3, pThis, pSSM); 4404 4405 return VINF_SSM_DONT_CALL_AGAIN; 4405 4406 } … … 4445 4446 pHlp->pfnSSMPutU16(pSSM, pThis->u16CSR0LastSeenByGuest); 4446 4447 pHlp->pfnSSMPutU64(pSSM, pThis->u64LastPoll); 4447 pcnet SaveConfig(pHlp, pThis, pSSM);4448 pcnetR3SaveConfig(pHlp, pThis, pSSM); 4448 4449 4449 4450 int rc = VINF_SUCCESS; … … 4588 4589 been lost, unless we've been teleported here. */ 4589 4590 if (!PDMDevHlpVMTeleportedAndNotFullyResumedYet(pDevIns)) 4590 pcnet TempLinkDown(pDevIns, pThis);4591 pcnetR3TempLinkDown(pDevIns, pThis); 4591 4592 } 4592 4593 … … 4616 4617 * Check if the device/driver can receive data now. 4617 4618 * 4618 * Worker for pcnet NetworkDown_WaitReceiveAvail(). This must be called before4619 * Worker for pcnetR3NetworkDown_WaitReceiveAvail(). This must be called before 4619 4620 * the pfnRecieve() method is called. 4620 4621 * … … 4622 4623 * @param pThis The PCnet shared instance data. 4623 4624 */ 4624 static int pcnet CanReceive(PPCNETSTATE pThis)4625 static int pcnetR3CanReceive(PPCNETSTATE pThis) 4625 4626 { 4626 4627 int rc = PDMCritSectEnter(&pThis->CritSect, VERR_SEM_BUSY); … … 4652 4653 * @interface_method_impl{PDMINETWORKDOWN,pfnWaitReceiveAvail} 4653 4654 */ 4654 static DECLCALLBACK(int) pcnet NetworkDown_WaitReceiveAvail(PPDMINETWORKDOWN pInterface, RTMSINTERVAL cMillies)4655 static DECLCALLBACK(int) pcnetR3NetworkDown_WaitReceiveAvail(PPDMINETWORKDOWN pInterface, RTMSINTERVAL cMillies) 4655 4656 { 4656 4657 PPCNETSTATE pThis = RT_FROM_MEMBER(pInterface, PCNETSTATE, INetworkDown); 4657 4658 PPDMDEVINS pDevIns = pThis->pDevInsR3; 4658 4659 4659 int rc = pcnet CanReceive(pThis);4660 int rc = pcnetR3CanReceive(pThis); 4660 4661 if (RT_SUCCESS(rc)) 4661 4662 return VINF_SUCCESS; … … 4670 4671 || enmVMState == VMSTATE_RUNNING_LS)) 4671 4672 { 4672 int rc2 = pcnet CanReceive(pThis);4673 int rc2 = pcnetR3CanReceive(pThis); 4673 4674 if (RT_SUCCESS(rc2)) 4674 4675 { … … 4676 4677 break; 4677 4678 } 4678 LogFlow(("pcnet NetworkDown_WaitReceiveAvail: waiting cMillies=%u...\n", cMillies));4679 LogFlow(("pcnetR3NetworkDown_WaitReceiveAvail: waiting cMillies=%u...\n", cMillies)); 4679 4680 /* Start the poll timer once which will remain active as long fMaybeOutOfSpace 4680 4681 * is true -- even if (transmit) polling is disabled (CSR_DPOLL). */ … … 4697 4698 * @interface_method_impl{PDMINETWORKDOWN,pfnReceive} 4698 4699 */ 4699 static DECLCALLBACK(int) pcnet NetworkDown_Receive(PPDMINETWORKDOWN pInterface, const void *pvBuf, size_t cb)4700 static DECLCALLBACK(int) pcnetR3NetworkDown_Receive(PPDMINETWORKDOWN pInterface, const void *pvBuf, size_t cb) 4700 4701 { 4701 4702 PPCNETSTATE pThis = RT_FROM_MEMBER(pInterface, PCNETSTATE, INetworkDown); … … 4751 4752 * @interface_method_impl{PDMINETWORKDOWN,pfnXmitPending} 4752 4753 */ 4753 static DECLCALLBACK(void) pcnet NetworkDown_XmitPending(PPDMINETWORKDOWN pInterface)4754 static DECLCALLBACK(void) pcnetR3NetworkDown_XmitPending(PPDMINETWORKDOWN pInterface) 4754 4755 { 4755 4756 PPCNETSTATE pThis = RT_FROM_MEMBER(pInterface, PCNETSTATE, INetworkDown); … … 4763 4764 * @interface_method_impl{PDMINETWORKCONFIG,pfnGetMac} 4764 4765 */ 4765 static DECLCALLBACK(int) pcnet GetMac(PPDMINETWORKCONFIG pInterface, PRTMAC pMac)4766 static DECLCALLBACK(int) pcnetR3NetworkConfig_GetMac(PPDMINETWORKCONFIG pInterface, PRTMAC pMac) 4766 4767 { 4767 4768 PPCNETSTATE pThis = RT_FROM_MEMBER(pInterface, PCNETSTATE, INetworkConfig); … … 4774 4775 * @interface_method_impl{PDMINETWORKCONFIG,pfnGetLinkState} 4775 4776 */ 4776 static DECLCALLBACK(PDMNETWORKLINKSTATE) pcnet GetLinkState(PPDMINETWORKCONFIG pInterface)4777 static DECLCALLBACK(PDMNETWORKLINKSTATE) pcnetR3NetworkConfig_GetLinkState(PPDMINETWORKCONFIG pInterface) 4777 4778 { 4778 4779 PPCNETSTATE pThis = RT_FROM_MEMBER(pInterface, PCNETSTATE, INetworkConfig); … … 4791 4792 * @interface_method_impl{PDMINETWORKCONFIG,pfnSetLinkState} 4792 4793 */ 4793 static DECLCALLBACK(int) pcnet SetLinkState(PPDMINETWORKCONFIG pInterface, PDMNETWORKLINKSTATE enmState)4794 static DECLCALLBACK(int) pcnetR3NetworkConfig_SetLinkState(PPDMINETWORKCONFIG pInterface, PDMNETWORKLINKSTATE enmState) 4794 4795 { 4795 4796 PPCNETSTATE pThis = RT_FROM_MEMBER(pInterface, PCNETSTATE, INetworkConfig); … … 4802 4803 if (enmState == PDMNETWORKLINKSTATE_DOWN_RESUME) 4803 4804 { 4804 pcnet TempLinkDown(pDevIns, pThis);4805 pcnetR3TempLinkDown(pDevIns, pThis); 4805 4806 /* 4806 4807 * Note that we do not notify the driver about the link state change because … … 4957 4958 */ 4958 4959 if (RT_SUCCESS(rc)) 4959 pcnet TempLinkDown(pDevIns, pThis);4960 pcnetR3TempLinkDown(pDevIns, pThis); 4960 4961 4961 4962 PDMCritSectLeave(&pThis->CritSect); … … 5146 5147 pThis->IBase.pfnQueryInterface = pcnetQueryInterface; 5147 5148 /* INeworkPort */ 5148 pThis->INetworkDown.pfnWaitReceiveAvail = pcnet NetworkDown_WaitReceiveAvail;5149 pThis->INetworkDown.pfnReceive = pcnet NetworkDown_Receive;5150 pThis->INetworkDown.pfnXmitPending = pcnet NetworkDown_XmitPending;5149 pThis->INetworkDown.pfnWaitReceiveAvail = pcnetR3NetworkDown_WaitReceiveAvail; 5150 pThis->INetworkDown.pfnReceive = pcnetR3NetworkDown_Receive; 5151 pThis->INetworkDown.pfnXmitPending = pcnetR3NetworkDown_XmitPending; 5151 5152 /* INetworkConfig */ 5152 pThis->INetworkConfig.pfnGetMac = pcnet GetMac;5153 pThis->INetworkConfig.pfnGetLinkState = pcnet GetLinkState;5154 pThis->INetworkConfig.pfnSetLinkState = pcnet SetLinkState;5153 pThis->INetworkConfig.pfnGetMac = pcnetR3NetworkConfig_GetMac; 5154 pThis->INetworkConfig.pfnGetLinkState = pcnetR3NetworkConfig_GetLinkState; 5155 pThis->INetworkConfig.pfnSetLinkState = pcnetR3NetworkConfig_SetLinkState; 5155 5156 /* ILeds */ 5156 5157 pThis->ILeds.pfnQueryStatusLed = pcnetQueryStatusLed; … … 5338 5339 */ 5339 5340 RTStrPrintf(szTmp, sizeof(szTmp), "pcnet%d", pDevIns->iInstance); 5340 PDMDevHlpDBGFInfoRegister(pDevIns, szTmp, "PCNET info.", pcnet Info);5341 PDMDevHlpDBGFInfoRegister(pDevIns, szTmp, "PCNET info.", pcnetR3Info); 5341 5342 5342 5343 /*
Note:
See TracChangeset
for help on using the changeset viewer.