Changeset 11200 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Aug 6, 2008 11:03:46 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevPCNet.cpp
r11199 r11200 1167 1167 uint32_t cb; 1168 1168 int rc = CTXALLSUFF(pData->pfnEMInterpretInstruction)(pVM, pRegFrame, pvFault, &cb); 1169 if ( VBOX_SUCCESS(rc) && cb)1169 if (RT_SUCCESS(rc) && cb) 1170 1170 { 1171 1171 if ( (GCPhysFault >= pData->GCTDRA && GCPhysFault + cb < pcnetTdraAddr(pData, 0)) … … 1178 1178 1179 1179 int rc = PDMCritSectEnter(&pData->CritSect, VERR_SEM_BUSY); 1180 if ( VBOX_SUCCESS(rc))1180 if (RT_SUCCESS(rc)) 1181 1181 { 1182 1182 STAM_COUNTER_INC(&CTXALLSUFF(pData->StatRingWrite)); ; … … 1222 1222 { 1223 1223 PPDMDEVINS pDevIns = (PPDMDEVINS)pvUser; 1224 PCNetState *pData = PDMINS 2DATA(pDevIns, PCNetState *);1224 PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *); 1225 1225 1226 1226 Log(("#%d pcnetHandleRingWrite: write to %#010x\n", PCNET_INST_NR, GCPhys)); … … 1617 1617 static DECLCALLBACK(void) pcnetWakeupReceive(PPDMDEVINS pDevIns) 1618 1618 { 1619 PCNetState *pData = PDMINS 2DATA(pDevIns, PCNetState *);1619 PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *); 1620 1620 STAM_COUNTER_INC(&pData->StatRxOverflowWakeup); 1621 1621 if (pData->hEventOutOfRxSpace != NIL_RTSEMEVENT) … … 1993 1993 static DECLCALLBACK(bool) pcnetXmitQueueConsumer(PPDMDEVINS pDevIns, PPDMQUEUEITEMCORE pItem) 1994 1994 { 1995 PCNetState *pData = PDMINS 2DATA(pDevIns, PCNetState *);1995 PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *); 1996 1996 NOREF(pItem); 1997 1997 … … 2468 2468 static DECLCALLBACK(int) pcnetAsyncSendThread(PPDMDEVINS pDevIns, PPDMTHREAD pThread) 2469 2469 { 2470 PCNetState *pData = PDMINS 2DATA(pDevIns, PCNetState *);2470 PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *); 2471 2471 2472 2472 /* … … 2528 2528 static DECLCALLBACK(int) pcnetAsyncSendThreadWakeUp(PPDMDEVINS pDevIns, PPDMTHREAD pThread) 2529 2529 { 2530 PCNetState *pData = PDMINS 2DATA(pDevIns, PCNetState *);2530 PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *); 2531 2531 return RTSemEventSignal(pData->hSendEventSem); 2532 2532 } … … 3419 3419 RTIOPORT Port, uint32_t *pu32, unsigned cb) 3420 3420 { 3421 PCNetState *pData = PDMINS 2DATA(pDevIns, PCNetState *);3421 PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *); 3422 3422 int rc; 3423 3423 … … 3465 3465 RTIOPORT Port, uint32_t u32, unsigned cb) 3466 3466 { 3467 PCNetState *pData = PDMINS 2DATA(pDevIns, PCNetState *);3467 PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *); 3468 3468 int rc; 3469 3469 … … 3507 3507 RTIOPORT Port, uint32_t *pu32, unsigned cb) 3508 3508 { 3509 PCNetState *pData = PDMINS 2DATA(pDevIns, PCNetState *);3509 PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *); 3510 3510 int rc = VINF_SUCCESS; 3511 3511 … … 3548 3548 RTIOPORT Port, uint32_t u32, unsigned cb) 3549 3549 { 3550 PCNetState *pData = PDMINS 2DATA(pDevIns, PCNetState *);3550 PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *); 3551 3551 int rc = VINF_SUCCESS; 3552 3552 … … 3691 3691 static DECLCALLBACK(void) pcnetTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer) 3692 3692 { 3693 PCNetState *pData = PDMINS 2DATA(pDevIns, PCNetState *);3693 PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *); 3694 3694 int rc; 3695 3695 … … 3714 3714 static DECLCALLBACK(void) pcnetTimerSoftInt(PPDMDEVINS pDevIns, PTMTIMER pTimer) 3715 3715 { 3716 PCNetState *pData = PDMINS 2DATA(pDevIns, PCNetState *);3716 PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *); 3717 3717 3718 3718 pData->aCSR[7] |= 0x0800; /* STINT */ … … 3734 3734 static DECLCALLBACK(void) pcnetTimerRestore(PPDMDEVINS pDevIns, PTMTIMER pTimer) 3735 3735 { 3736 PCNetState *pData = PDMINS 2DATA(pDevIns, PCNetState *);3736 PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *); 3737 3737 int rc = PDMCritSectEnter(&pData->CritSect, VERR_SEM_BUSY); 3738 3738 AssertReleaseRC(rc); … … 3741 3741 if (pData->cLinkDownReported <= PCNET_MAX_LINKDOWN_REPORTED) 3742 3742 rc = TMTimerSetMillies(pData->pTimerRestore, 1500); 3743 if ( VBOX_FAILURE(rc))3743 if (RT_FAILURE(rc)) 3744 3744 { 3745 3745 pData->fLinkTempDown = false; … … 3787 3787 rc = PDMDevHlpIOPortRegister(pDevIns, Port, 0x10, 0, pcnetIOPortAPromWrite, 3788 3788 pcnetIOPortAPromRead, NULL, NULL, "PCNet ARPOM"); 3789 if ( VBOX_FAILURE(rc))3789 if (RT_FAILURE(rc)) 3790 3790 return rc; 3791 3791 rc = PDMDevHlpIOPortRegister(pDevIns, Port + 0x10, 0x10, 0, pcnetIOPortWrite, 3792 3792 pcnetIOPortRead, NULL, NULL, "PCNet"); 3793 if ( VBOX_FAILURE(rc))3793 if (RT_FAILURE(rc)) 3794 3794 return rc; 3795 3795 … … 3798 3798 rc = PDMDevHlpIOPortRegisterGC(pDevIns, Port, 0x10, 0, "pcnetIOPortAPromWrite", 3799 3799 "pcnetIOPortAPromRead", NULL, NULL, "PCNet aprom"); 3800 if ( VBOX_FAILURE(rc))3800 if (RT_FAILURE(rc)) 3801 3801 return rc; 3802 3802 rc = PDMDevHlpIOPortRegisterGC(pDevIns, Port + 0x10, 0x10, 0, "pcnetIOPortWrite", 3803 3803 "pcnetIOPortRead", NULL, NULL, "PCNet"); 3804 if ( VBOX_FAILURE(rc))3804 if (RT_FAILURE(rc)) 3805 3805 return rc; 3806 3806 } … … 3809 3809 rc = PDMDevHlpIOPortRegisterR0(pDevIns, Port, 0x10, 0, "pcnetIOPortAPromWrite", 3810 3810 "pcnetIOPortAPromRead", NULL, NULL, "PCNet aprom"); 3811 if ( VBOX_FAILURE(rc))3811 if (RT_FAILURE(rc)) 3812 3812 return rc; 3813 3813 rc = PDMDevHlpIOPortRegisterR0(pDevIns, Port + 0x10, 0x10, 0, "pcnetIOPortWrite", 3814 3814 "pcnetIOPortRead", NULL, NULL, "PCNet"); 3815 if ( VBOX_FAILURE(rc))3815 if (RT_FAILURE(rc)) 3816 3816 return rc; 3817 3817 } … … 3846 3846 rc = PDMDevHlpMMIORegister(pPciDev->pDevIns, GCPhysAddress, cb, pData, 3847 3847 pcnetMMIOWrite, pcnetMMIORead, NULL, "PCNet"); 3848 if ( VBOX_FAILURE(rc))3848 if (RT_FAILURE(rc)) 3849 3849 return rc; 3850 3850 pData->MMIOBase = GCPhysAddress; … … 3885 3885 static DECLCALLBACK(void) pcnetInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 3886 3886 { 3887 PCNetState *pData = PDMINS 2DATA(pDevIns, PCNetState *);3887 PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *); 3888 3888 bool fRcvRing = false; 3889 3889 bool fXmtRing = false; … … 4112 4112 static DECLCALLBACK(int) pcnetSavePrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle) 4113 4113 { 4114 PCNetState *pData = PDMINS 2DATA(pDevIns, PCNetState *);4114 PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *); 4115 4115 4116 4116 int rc = PDMCritSectEnter(&pData->CritSect, VERR_SEM_BUSY); … … 4131 4131 static DECLCALLBACK(int) pcnetSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle) 4132 4132 { 4133 PCNetState *pData = PDMINS 2DATA(pDevIns, PCNetState *);4133 PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *); 4134 4134 int rc = VINF_SUCCESS; 4135 4135 … … 4155 4155 #else 4156 4156 rc = TMR3TimerSave(pData->CTX_SUFF(pTimerPoll), pSSMHandle); 4157 if ( VBOX_FAILURE(rc))4157 if (RT_FAILURE(rc)) 4158 4158 return rc; 4159 4159 #endif … … 4173 4173 static DECLCALLBACK(int) pcnetLoadPrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle) 4174 4174 { 4175 PCNetState *pData = PDMINS 2DATA(pDevIns, PCNetState *);4175 PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *); 4176 4176 4177 4177 int rc = PDMCritSectEnter(&pData->CritSect, VERR_SEM_BUSY); … … 4193 4193 static DECLCALLBACK(int) pcnetLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t u32Version) 4194 4194 { 4195 PCNetState *pData = PDMINS 2DATA(pDevIns, PCNetState *);4195 PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *); 4196 4196 RTMAC Mac; 4197 4197 if ( SSM_VERSION_MAJOR_CHANGED(u32Version, PCNET_SAVEDSTATE_VERSION) … … 4532 4532 static DECLCALLBACK(void) pcnetReset(PPDMDEVINS pDevIns) 4533 4533 { 4534 PCNetState *pData = PDMINS 2DATA(pDevIns, PCNetState *);4534 PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *); 4535 4535 if (pData->fLinkTempDown) 4536 4536 { … … 4552 4552 static DECLCALLBACK(void) pcnetRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta) 4553 4553 { 4554 PCNetState *pData = PDMINS 2DATA(pDevIns, PCNetState *);4554 PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *); 4555 4555 pData->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 4556 4556 pData->pXmitQueueRC = PDMQueueRCPtr(pData->pXmitQueueR3); … … 4579 4579 static DECLCALLBACK(int) pcnetDestruct(PPDMDEVINS pDevIns) 4580 4580 { 4581 PCNetState *pData = PDMINS 2DATA(pDevIns, PCNetState *);4581 PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *); 4582 4582 4583 4583 if (PDMCritSectIsInitialized(&pData->CritSect)) … … 4618 4618 static DECLCALLBACK(int) pcnetConstruct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfgHandle) 4619 4619 { 4620 PCNetState *pData = PDMINS 2DATA(pDevIns, PCNetState *);4620 PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *); 4621 4621 PPDMIBASE pBase; 4622 4622 char szTmp[128]; … … 4647 4647 */ 4648 4648 rc = CFGMR3QueryBytes(pCfgHandle, "MAC", &pData->MacConfigured, sizeof(pData->MacConfigured)); 4649 if ( VBOX_FAILURE(rc))4649 if (RT_FAILURE(rc)) 4650 4650 return PDMDEV_SET_ERROR(pDevIns, rc, 4651 4651 N_("Configuration error: Failed to get the \"MAC\" value")); 4652 4652 rc = CFGMR3QueryBoolDef(pCfgHandle, "CableConnected", &pData->fLinkUp, true); 4653 if ( VBOX_FAILURE(rc))4653 if (RT_FAILURE(rc)) 4654 4654 return PDMDEV_SET_ERROR(pDevIns, rc, 4655 4655 N_("Configuration error: Failed to get the \"CableConnected\" value")); 4656 4656 4657 4657 rc = CFGMR3QueryBoolDef(pCfgHandle, "Am79C973", &pData->fAm79C973, false); 4658 if ( VBOX_FAILURE(rc))4658 if (RT_FAILURE(rc)) 4659 4659 return PDMDEV_SET_ERROR(pDevIns, rc, 4660 4660 N_("Configuration error: Failed to get the \"Am79C973\" value")); 4661 4661 4662 4662 rc = CFGMR3QueryU32Def(pCfgHandle, "LineSpeed", &pData->u32LinkSpeed, 1000000); /* 1GBit/s (in kbps units)*/ 4663 if ( VBOX_FAILURE(rc))4663 if (RT_FAILURE(rc)) 4664 4664 return PDMDEV_SET_ERROR(pDevIns, rc, 4665 4665 N_("Configuration error: Failed to get the \"LineSpeed\" value")); … … 4667 4667 #ifdef PCNET_GC_ENABLED 4668 4668 rc = CFGMR3QueryBoolDef(pCfgHandle, "GCEnabled", &pData->fGCEnabled, true); 4669 if ( VBOX_FAILURE(rc))4669 if (RT_FAILURE(rc)) 4670 4670 return PDMDEV_SET_ERROR(pDevIns, rc, 4671 4671 N_("Configuration error: Failed to get the \"GCEnabled\" value")); 4672 4672 4673 4673 rc = CFGMR3QueryBoolDef(pCfgHandle, "R0Enabled", &pData->fR0Enabled, true); 4674 if ( VBOX_FAILURE(rc))4674 if (RT_FAILURE(rc)) 4675 4675 return PDMDEV_SET_ERROR(pDevIns, rc, 4676 4676 N_("Configuration error: Failed to get the \"R0Enabled\" value")); … … 4736 4736 */ 4737 4737 rc = PDMDevHlpPCIRegister(pDevIns, &pData->PciDev); 4738 if ( VBOX_FAILURE(rc))4738 if (RT_FAILURE(rc)) 4739 4739 return rc; 4740 4740 rc = PDMDevHlpPCIIORegionRegister(pDevIns, 0, PCNET_IOPORT_SIZE, 4741 4741 PCI_ADDRESS_SPACE_IO, pcnetIOPortMap); 4742 if ( VBOX_FAILURE(rc))4742 if (RT_FAILURE(rc)) 4743 4743 return rc; 4744 4744 rc = PDMDevHlpPCIIORegionRegister(pDevIns, 1, PCNET_PNPMMIO_SIZE, 4745 4745 PCI_ADDRESS_SPACE_MEM, pcnetMMIOMap); 4746 if ( VBOX_FAILURE(rc))4746 if (RT_FAILURE(rc)) 4747 4747 return rc; 4748 4748 … … 4751 4751 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 4752 4752 fPrivIfEnabled = true; 4753 else if ( VBOX_FAILURE(rc))4753 else if (RT_FAILURE(rc)) 4754 4754 return PDMDEV_SET_ERROR(pDevIns, rc, 4755 4755 N_("Configuration error: Failed to get the \"PrivIfEnabled\" value")); … … 4762 4762 */ 4763 4763 rc = PDMDevHlpMMIO2Register(pDevIns, 2, PCNET_GUEST_SHARED_MEMORY_SIZE, 0, (void **)&pData->pSharedMMIOR3, "PCNetShMem"); 4764 if ( VBOX_FAILURE(rc))4764 if (RT_FAILURE(rc)) 4765 4765 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, 4766 4766 N_("Failed to allocate %u bytes of memory for the PCNet device"), PCNET_GUEST_SHARED_MEMORY_SIZE); 4767 4767 rc = PDMDevHlpMMHyperMapMMIO2(pDevIns, 2, 0, 8192, "PCNetShMem", &pData->pSharedMMIORC); 4768 if ( VBOX_FAILURE(rc))4768 if (RT_FAILURE(rc)) 4769 4769 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, 4770 4770 N_("Failed to map 8192 bytes of memory for the PCNet device into the hyper memory")); … … 4774 4774 rc = PDMDevHlpPCIIORegionRegister(pDevIns, 2, PCNET_GUEST_SHARED_MEMORY_SIZE, 4775 4775 PCI_ADDRESS_SPACE_MEM, pcnetMMIOSharedMap); 4776 if ( VBOX_FAILURE(rc))4776 if (RT_FAILURE(rc)) 4777 4777 return rc; 4778 4778 } … … 4783 4783 */ 4784 4784 rc = PDMR3GetSymbolR0Lazy(PDMDevHlpGetVM(pDevIns), NULL, "EMInterpretInstruction", &pData->pfnEMInterpretInstructionR0); 4785 if ( VBOX_SUCCESS(rc))4785 if (RT_SUCCESS(rc)) 4786 4786 rc = PDMR3GetSymbolGCLazy(PDMDevHlpGetVM(pDevIns), NULL, "EMInterpretInstruction", (RTGCPTR *)&pData->pfnEMInterpretInstructionRC); 4787 4787 AssertLogRelMsgRCReturn(rc, ("PDMR3GetSymbolGCLazy(EMInterpretInstruction) -> %Vrc\n", rc), rc); … … 4789 4789 rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, pcnetTimer, 4790 4790 "PCNet Poll Timer", &pData->pTimerPollR3); 4791 if ( VBOX_FAILURE(rc))4791 if (RT_FAILURE(rc)) 4792 4792 return rc; 4793 4793 pData->pTimerPollR0 = TMTimerR0Ptr(pData->pTimerPollR3); … … 4813 4813 pcnetSavePrep, pcnetSaveExec, NULL, 4814 4814 pcnetLoadPrep, pcnetLoadExec, NULL); 4815 if ( VBOX_FAILURE(rc))4815 if (RT_FAILURE(rc)) 4816 4816 return rc; 4817 4817 … … 4823 4823 RTStrPrintf(szName, sizeof(szName), "PCNet#%d", iInstance); 4824 4824 rc = PDMDevHlpCritSectInit(pDevIns, &pData->CritSect, szName); 4825 if ( VBOX_FAILURE(rc))4825 if (RT_FAILURE(rc)) 4826 4826 return rc; 4827 4827 … … 4834 4834 rc = PDMDevHlpPDMQueueCreate(pDevIns, sizeof(PDMQUEUEITEMCORE), 1, 0, 4835 4835 pcnetXmitQueueConsumer, true, &pData->pXmitQueueR3); 4836 if ( VBOX_FAILURE(rc))4836 if (RT_FAILURE(rc)) 4837 4837 return rc; 4838 4838 pData->pXmitQueueR0 = PDMQueueR0Ptr(pData->pXmitQueueR3); … … 4844 4844 rc = PDMDevHlpPDMQueueCreate(pDevIns, sizeof(PDMQUEUEITEMCORE), 1, 0, 4845 4845 pcnetCanRxQueueConsumer, true, &pData->pCanRxQueueR3); 4846 if ( VBOX_FAILURE(rc))4846 if (RT_FAILURE(rc)) 4847 4847 return rc; 4848 4848 pData->pCanRxQueueR0 = PDMQueueR0Ptr(pData->pCanRxQueueR3); … … 4859 4859 */ 4860 4860 rc = PDMDevHlpDriverAttach(pDevIns, PDM_STATUS_LUN, &pData->IBase, &pBase, "Status Port"); 4861 if ( VBOX_SUCCESS(rc))4861 if (RT_SUCCESS(rc)) 4862 4862 pData->pLedsConnector = (PPDMILEDCONNECTORS) 4863 4863 pBase->pfnQueryInterface(pBase, PDMINTERFACE_LED_CONNECTORS); … … 4872 4872 */ 4873 4873 rc = PDMDevHlpDriverAttach(pDevIns, 0, &pData->IBase, &pData->pDrvBase, "Network Port"); 4874 if ( VBOX_SUCCESS(rc))4874 if (RT_SUCCESS(rc)) 4875 4875 { 4876 4876 if (rc == VINF_NAT_DNS)
Note:
See TracChangeset
for help on using the changeset viewer.