VirtualBox

Changeset 11200 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Aug 6, 2008 11:03:46 PM (16 years ago)
Author:
vboxsync
Message:

DevPCNet: Cosmetics.

File:
1 edited

Legend:

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

    r11199 r11200  
    11671167    uint32_t cb;
    11681168    int rc = CTXALLSUFF(pData->pfnEMInterpretInstruction)(pVM, pRegFrame, pvFault, &cb);
    1169     if (VBOX_SUCCESS(rc) && cb)
     1169    if (RT_SUCCESS(rc) && cb)
    11701170    {
    11711171        if (    (GCPhysFault >= pData->GCTDRA && GCPhysFault + cb < pcnetTdraAddr(pData, 0))
     
    11781178
    11791179            int rc = PDMCritSectEnter(&pData->CritSect, VERR_SEM_BUSY);
    1180             if (VBOX_SUCCESS(rc))
     1180            if (RT_SUCCESS(rc))
    11811181            {
    11821182                STAM_COUNTER_INC(&CTXALLSUFF(pData->StatRingWrite)); ;
     
    12221222{
    12231223    PPDMDEVINS  pDevIns = (PPDMDEVINS)pvUser;
    1224     PCNetState *pData   = PDMINS2DATA(pDevIns, PCNetState *);
     1224    PCNetState *pData   = PDMINS_2_DATA(pDevIns, PCNetState *);
    12251225
    12261226    Log(("#%d pcnetHandleRingWrite: write to %#010x\n", PCNET_INST_NR, GCPhys));
     
    16171617static DECLCALLBACK(void) pcnetWakeupReceive(PPDMDEVINS pDevIns)
    16181618{
    1619     PCNetState *pData = PDMINS2DATA(pDevIns, PCNetState *);
     1619    PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *);
    16201620    STAM_COUNTER_INC(&pData->StatRxOverflowWakeup);
    16211621    if (pData->hEventOutOfRxSpace != NIL_RTSEMEVENT)
     
    19931993static DECLCALLBACK(bool) pcnetXmitQueueConsumer(PPDMDEVINS pDevIns, PPDMQUEUEITEMCORE pItem)
    19941994{
    1995     PCNetState *pData = PDMINS2DATA(pDevIns, PCNetState *);
     1995    PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *);
    19961996    NOREF(pItem);
    19971997
     
    24682468static DECLCALLBACK(int) pcnetAsyncSendThread(PPDMDEVINS pDevIns, PPDMTHREAD pThread)
    24692469{
    2470     PCNetState *pData = PDMINS2DATA(pDevIns, PCNetState *);
     2470    PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *);
    24712471
    24722472    /*
     
    25282528static DECLCALLBACK(int) pcnetAsyncSendThreadWakeUp(PPDMDEVINS pDevIns, PPDMTHREAD pThread)
    25292529{
    2530     PCNetState *pData = PDMINS2DATA(pDevIns, PCNetState *);
     2530    PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *);
    25312531    return RTSemEventSignal(pData->hSendEventSem);
    25322532}
     
    34193419                                        RTIOPORT Port, uint32_t *pu32, unsigned cb)
    34203420{
    3421     PCNetState *pData = PDMINS2DATA(pDevIns, PCNetState *);
     3421    PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *);
    34223422    int        rc;
    34233423
     
    34653465                                         RTIOPORT Port, uint32_t u32, unsigned cb)
    34663466{
    3467     PCNetState *pData = PDMINS2DATA(pDevIns, PCNetState *);
     3467    PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *);
    34683468    int        rc;
    34693469
     
    35073507                                   RTIOPORT Port, uint32_t *pu32, unsigned cb)
    35083508{
    3509     PCNetState *pData = PDMINS2DATA(pDevIns, PCNetState *);
     3509    PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *);
    35103510    int         rc    = VINF_SUCCESS;
    35113511
     
    35483548                                    RTIOPORT Port, uint32_t u32, unsigned cb)
    35493549{
    3550     PCNetState *pData = PDMINS2DATA(pDevIns, PCNetState *);
     3550    PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *);
    35513551    int         rc    = VINF_SUCCESS;
    35523552
     
    36913691static DECLCALLBACK(void) pcnetTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer)
    36923692{
    3693     PCNetState *pData = PDMINS2DATA(pDevIns, PCNetState *);
     3693    PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *);
    36943694    int         rc;
    36953695
     
    37143714static DECLCALLBACK(void) pcnetTimerSoftInt(PPDMDEVINS pDevIns, PTMTIMER pTimer)
    37153715{
    3716     PCNetState *pData = PDMINS2DATA(pDevIns, PCNetState *);
     3716    PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *);
    37173717
    37183718    pData->aCSR[7] |= 0x0800; /* STINT */
     
    37343734static DECLCALLBACK(void) pcnetTimerRestore(PPDMDEVINS pDevIns, PTMTIMER pTimer)
    37353735{
    3736     PCNetState *pData = PDMINS2DATA(pDevIns, PCNetState *);
     3736    PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *);
    37373737    int         rc = PDMCritSectEnter(&pData->CritSect, VERR_SEM_BUSY);
    37383738    AssertReleaseRC(rc);
     
    37413741    if (pData->cLinkDownReported <= PCNET_MAX_LINKDOWN_REPORTED)
    37423742        rc = TMTimerSetMillies(pData->pTimerRestore, 1500);
    3743     if (VBOX_FAILURE(rc))
     3743    if (RT_FAILURE(rc))
    37443744    {
    37453745        pData->fLinkTempDown = false;
     
    37873787    rc = PDMDevHlpIOPortRegister(pDevIns, Port, 0x10, 0, pcnetIOPortAPromWrite,
    37883788                                 pcnetIOPortAPromRead, NULL, NULL, "PCNet ARPOM");
    3789     if (VBOX_FAILURE(rc))
     3789    if (RT_FAILURE(rc))
    37903790        return rc;
    37913791    rc = PDMDevHlpIOPortRegister(pDevIns, Port + 0x10, 0x10, 0, pcnetIOPortWrite,
    37923792                                 pcnetIOPortRead, NULL, NULL, "PCNet");
    3793     if (VBOX_FAILURE(rc))
     3793    if (RT_FAILURE(rc))
    37943794        return rc;
    37953795
     
    37983798        rc = PDMDevHlpIOPortRegisterGC(pDevIns, Port, 0x10, 0, "pcnetIOPortAPromWrite",
    37993799                                       "pcnetIOPortAPromRead", NULL, NULL, "PCNet aprom");
    3800         if (VBOX_FAILURE(rc))
     3800        if (RT_FAILURE(rc))
    38013801            return rc;
    38023802        rc = PDMDevHlpIOPortRegisterGC(pDevIns, Port + 0x10, 0x10, 0, "pcnetIOPortWrite",
    38033803                                       "pcnetIOPortRead", NULL, NULL, "PCNet");
    3804         if (VBOX_FAILURE(rc))
     3804        if (RT_FAILURE(rc))
    38053805            return rc;
    38063806    }
     
    38093809        rc = PDMDevHlpIOPortRegisterR0(pDevIns, Port, 0x10, 0, "pcnetIOPortAPromWrite",
    38103810                                       "pcnetIOPortAPromRead", NULL, NULL, "PCNet aprom");
    3811         if (VBOX_FAILURE(rc))
     3811        if (RT_FAILURE(rc))
    38123812            return rc;
    38133813        rc = PDMDevHlpIOPortRegisterR0(pDevIns, Port + 0x10, 0x10, 0, "pcnetIOPortWrite",
    38143814                                       "pcnetIOPortRead", NULL, NULL, "PCNet");
    3815         if (VBOX_FAILURE(rc))
     3815        if (RT_FAILURE(rc))
    38163816            return rc;
    38173817    }
     
    38463846    rc = PDMDevHlpMMIORegister(pPciDev->pDevIns, GCPhysAddress, cb, pData,
    38473847                               pcnetMMIOWrite, pcnetMMIORead, NULL, "PCNet");
    3848     if (VBOX_FAILURE(rc))
     3848    if (RT_FAILURE(rc))
    38493849        return rc;
    38503850    pData->MMIOBase = GCPhysAddress;
     
    38853885static DECLCALLBACK(void) pcnetInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
    38863886{
    3887     PCNetState *pData = PDMINS2DATA(pDevIns, PCNetState *);
     3887    PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *);
    38883888    bool        fRcvRing = false;
    38893889    bool        fXmtRing = false;
     
    41124112static DECLCALLBACK(int) pcnetSavePrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle)
    41134113{
    4114     PCNetState *pData = PDMINS2DATA(pDevIns, PCNetState *);
     4114    PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *);
    41154115
    41164116    int rc = PDMCritSectEnter(&pData->CritSect, VERR_SEM_BUSY);
     
    41314131static DECLCALLBACK(int) pcnetSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle)
    41324132{
    4133     PCNetState *pData = PDMINS2DATA(pDevIns, PCNetState *);
     4133    PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *);
    41344134    int rc = VINF_SUCCESS;
    41354135
     
    41554155#else
    41564156    rc = TMR3TimerSave(pData->CTX_SUFF(pTimerPoll), pSSMHandle);
    4157     if (VBOX_FAILURE(rc))
     4157    if (RT_FAILURE(rc))
    41584158        return rc;
    41594159#endif
     
    41734173static DECLCALLBACK(int) pcnetLoadPrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle)
    41744174{
    4175     PCNetState *pData = PDMINS2DATA(pDevIns, PCNetState *);
     4175    PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *);
    41764176
    41774177    int rc = PDMCritSectEnter(&pData->CritSect, VERR_SEM_BUSY);
     
    41934193static DECLCALLBACK(int) pcnetLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t u32Version)
    41944194{
    4195     PCNetState *pData = PDMINS2DATA(pDevIns, PCNetState *);
     4195    PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *);
    41964196    RTMAC       Mac;
    41974197    if (   SSM_VERSION_MAJOR_CHANGED(u32Version, PCNET_SAVEDSTATE_VERSION)
     
    45324532static DECLCALLBACK(void) pcnetReset(PPDMDEVINS pDevIns)
    45334533{
    4534     PCNetState *pData = PDMINS2DATA(pDevIns, PCNetState *);
     4534    PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *);
    45354535    if (pData->fLinkTempDown)
    45364536    {
     
    45524552static DECLCALLBACK(void) pcnetRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta)
    45534553{
    4554     PCNetState *pData = PDMINS2DATA(pDevIns, PCNetState *);
     4554    PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *);
    45554555    pData->pDevInsRC     = PDMDEVINS_2_RCPTR(pDevIns);
    45564556    pData->pXmitQueueRC  = PDMQueueRCPtr(pData->pXmitQueueR3);
     
    45794579static DECLCALLBACK(int) pcnetDestruct(PPDMDEVINS pDevIns)
    45804580{
    4581     PCNetState *pData = PDMINS2DATA(pDevIns, PCNetState *);
     4581    PCNetState *pData = PDMINS_2_DATA(pDevIns, PCNetState *);
    45824582
    45834583    if (PDMCritSectIsInitialized(&pData->CritSect))
     
    46184618static DECLCALLBACK(int) pcnetConstruct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfgHandle)
    46194619{
    4620     PCNetState     *pData = PDMINS2DATA(pDevIns, PCNetState *);
     4620    PCNetState     *pData = PDMINS_2_DATA(pDevIns, PCNetState *);
    46214621    PPDMIBASE       pBase;
    46224622    char            szTmp[128];
     
    46474647     */
    46484648    rc = CFGMR3QueryBytes(pCfgHandle, "MAC", &pData->MacConfigured, sizeof(pData->MacConfigured));
    4649     if (VBOX_FAILURE(rc))
     4649    if (RT_FAILURE(rc))
    46504650        return PDMDEV_SET_ERROR(pDevIns, rc,
    46514651                                N_("Configuration error: Failed to get the \"MAC\" value"));
    46524652    rc = CFGMR3QueryBoolDef(pCfgHandle, "CableConnected", &pData->fLinkUp, true);
    4653     if (VBOX_FAILURE(rc))
     4653    if (RT_FAILURE(rc))
    46544654        return PDMDEV_SET_ERROR(pDevIns, rc,
    46554655                                N_("Configuration error: Failed to get the \"CableConnected\" value"));
    46564656
    46574657    rc = CFGMR3QueryBoolDef(pCfgHandle, "Am79C973", &pData->fAm79C973, false);
    4658     if (VBOX_FAILURE(rc))
     4658    if (RT_FAILURE(rc))
    46594659        return PDMDEV_SET_ERROR(pDevIns, rc,
    46604660                                N_("Configuration error: Failed to get the \"Am79C973\" value"));
    46614661
    46624662    rc = CFGMR3QueryU32Def(pCfgHandle, "LineSpeed", &pData->u32LinkSpeed, 1000000); /* 1GBit/s (in kbps units)*/
    4663     if (VBOX_FAILURE(rc))
     4663    if (RT_FAILURE(rc))
    46644664        return PDMDEV_SET_ERROR(pDevIns, rc,
    46654665                                N_("Configuration error: Failed to get the \"LineSpeed\" value"));
     
    46674667#ifdef PCNET_GC_ENABLED
    46684668    rc = CFGMR3QueryBoolDef(pCfgHandle, "GCEnabled", &pData->fGCEnabled, true);
    4669     if (VBOX_FAILURE(rc))
     4669    if (RT_FAILURE(rc))
    46704670        return PDMDEV_SET_ERROR(pDevIns, rc,
    46714671                                N_("Configuration error: Failed to get the \"GCEnabled\" value"));
    46724672
    46734673    rc = CFGMR3QueryBoolDef(pCfgHandle, "R0Enabled", &pData->fR0Enabled, true);
    4674     if (VBOX_FAILURE(rc))
     4674    if (RT_FAILURE(rc))
    46754675        return PDMDEV_SET_ERROR(pDevIns, rc,
    46764676                                N_("Configuration error: Failed to get the \"R0Enabled\" value"));
     
    47364736     */
    47374737    rc = PDMDevHlpPCIRegister(pDevIns, &pData->PciDev);
    4738     if (VBOX_FAILURE(rc))
     4738    if (RT_FAILURE(rc))
    47394739        return rc;
    47404740    rc = PDMDevHlpPCIIORegionRegister(pDevIns, 0, PCNET_IOPORT_SIZE,
    47414741                                      PCI_ADDRESS_SPACE_IO, pcnetIOPortMap);
    4742     if (VBOX_FAILURE(rc))
     4742    if (RT_FAILURE(rc))
    47434743        return rc;
    47444744    rc = PDMDevHlpPCIIORegionRegister(pDevIns, 1, PCNET_PNPMMIO_SIZE,
    47454745                                      PCI_ADDRESS_SPACE_MEM, pcnetMMIOMap);
    4746     if (VBOX_FAILURE(rc))
     4746    if (RT_FAILURE(rc))
    47474747        return rc;
    47484748
     
    47514751    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    47524752        fPrivIfEnabled = true;
    4753     else if (VBOX_FAILURE(rc))
     4753    else if (RT_FAILURE(rc))
    47544754        return PDMDEV_SET_ERROR(pDevIns, rc,
    47554755                                N_("Configuration error: Failed to get the \"PrivIfEnabled\" value"));
     
    47624762         */
    47634763        rc = PDMDevHlpMMIO2Register(pDevIns, 2, PCNET_GUEST_SHARED_MEMORY_SIZE, 0, (void **)&pData->pSharedMMIOR3, "PCNetShMem");
    4764         if (VBOX_FAILURE(rc))
     4764        if (RT_FAILURE(rc))
    47654765            return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS,
    47664766                                       N_("Failed to allocate %u bytes of memory for the PCNet device"), PCNET_GUEST_SHARED_MEMORY_SIZE);
    47674767        rc = PDMDevHlpMMHyperMapMMIO2(pDevIns, 2, 0, 8192, "PCNetShMem", &pData->pSharedMMIORC);
    4768         if (VBOX_FAILURE(rc))
     4768        if (RT_FAILURE(rc))
    47694769            return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS,
    47704770                                       N_("Failed to map 8192 bytes of memory for the PCNet device into the hyper memory"));
     
    47744774        rc = PDMDevHlpPCIIORegionRegister(pDevIns, 2, PCNET_GUEST_SHARED_MEMORY_SIZE,
    47754775                                          PCI_ADDRESS_SPACE_MEM, pcnetMMIOSharedMap);
    4776         if (VBOX_FAILURE(rc))
     4776        if (RT_FAILURE(rc))
    47774777            return rc;
    47784778    }
     
    47834783     */
    47844784    rc = PDMR3GetSymbolR0Lazy(PDMDevHlpGetVM(pDevIns), NULL, "EMInterpretInstruction", &pData->pfnEMInterpretInstructionR0);
    4785     if (VBOX_SUCCESS(rc))
     4785    if (RT_SUCCESS(rc))
    47864786        rc = PDMR3GetSymbolGCLazy(PDMDevHlpGetVM(pDevIns), NULL, "EMInterpretInstruction", (RTGCPTR *)&pData->pfnEMInterpretInstructionRC);
    47874787    AssertLogRelMsgRCReturn(rc, ("PDMR3GetSymbolGCLazy(EMInterpretInstruction) -> %Vrc\n", rc), rc);
     
    47894789    rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, pcnetTimer,
    47904790                                "PCNet Poll Timer", &pData->pTimerPollR3);
    4791     if (VBOX_FAILURE(rc))
     4791    if (RT_FAILURE(rc))
    47924792        return rc;
    47934793    pData->pTimerPollR0 = TMTimerR0Ptr(pData->pTimerPollR3);
     
    48134813                              pcnetSavePrep, pcnetSaveExec, NULL,
    48144814                              pcnetLoadPrep, pcnetLoadExec, NULL);
    4815     if (VBOX_FAILURE(rc))
     4815    if (RT_FAILURE(rc))
    48164816        return rc;
    48174817
     
    48234823    RTStrPrintf(szName, sizeof(szName), "PCNet#%d", iInstance);
    48244824    rc = PDMDevHlpCritSectInit(pDevIns, &pData->CritSect, szName);
    4825     if (VBOX_FAILURE(rc))
     4825    if (RT_FAILURE(rc))
    48264826        return rc;
    48274827
     
    48344834    rc = PDMDevHlpPDMQueueCreate(pDevIns, sizeof(PDMQUEUEITEMCORE), 1, 0,
    48354835                                 pcnetXmitQueueConsumer, true, &pData->pXmitQueueR3);
    4836     if (VBOX_FAILURE(rc))
     4836    if (RT_FAILURE(rc))
    48374837        return rc;
    48384838    pData->pXmitQueueR0 = PDMQueueR0Ptr(pData->pXmitQueueR3);
     
    48444844    rc = PDMDevHlpPDMQueueCreate(pDevIns, sizeof(PDMQUEUEITEMCORE), 1, 0,
    48454845                                 pcnetCanRxQueueConsumer, true, &pData->pCanRxQueueR3);
    4846     if (VBOX_FAILURE(rc))
     4846    if (RT_FAILURE(rc))
    48474847        return rc;
    48484848    pData->pCanRxQueueR0 = PDMQueueR0Ptr(pData->pCanRxQueueR3);
     
    48594859     */
    48604860    rc = PDMDevHlpDriverAttach(pDevIns, PDM_STATUS_LUN, &pData->IBase, &pBase, "Status Port");
    4861     if (VBOX_SUCCESS(rc))
     4861    if (RT_SUCCESS(rc))
    48624862        pData->pLedsConnector = (PPDMILEDCONNECTORS)
    48634863            pBase->pfnQueryInterface(pBase, PDMINTERFACE_LED_CONNECTORS);
     
    48724872     */
    48734873    rc = PDMDevHlpDriverAttach(pDevIns, 0, &pData->IBase, &pData->pDrvBase, "Network Port");
    4874     if (VBOX_SUCCESS(rc))
     4874    if (RT_SUCCESS(rc))
    48754875    {
    48764876        if (rc == VINF_NAT_DNS)
Note: See TracChangeset for help on using the changeset viewer.

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