VirtualBox

儲存庫 vbox 的更動 49754


忽略:
時間撮記:
2013-12-3 下午01:15:15 (11 年 以前)
作者:
vboxsync
訊息:

DevPCNet: remove the private guest interface because it's unused for a long time

位置:
trunk
檔案:
刪除 1 筆資料
修改 2 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Devices/Network/DevPCNet.cpp

    r49414 r49754  
    5555#include <VBox/vmm/pdmnetifs.h>
    5656#include <VBox/vmm/pgm.h>
    57 #include <VBox/DevPCNet.h>
    5857#include <iprt/asm.h>
    5958#include <iprt/assert.h>
     
    273272    /** LUN\#0: The network config port interface. */
    274273    PDMINETWORKCONFIG                   INetworkConfig;
    275     /** The shared memory used for the private interface - R3. */
    276     R3PTRTYPE(PPCNETGUESTSHAREDMEMORY)  pSharedMMIOR3;
    277274    /** Software Interrupt timer - R3. */
    278275    PTMTIMERR3                          pTimerSoftIntR3;
     
    293290    /** Pointer to the connector of the attached network driver - R0. */
    294291    PPDMINETWORKUPR0                    pDrvR0;
    295     /** The shared memory used for the private interface - R0. */
    296     R0PTRTYPE(PPCNETGUESTSHAREDMEMORY)  pSharedMMIOR0;
    297292    /** Software Interrupt timer - R0. */
    298293    PTMTIMERR0                          pTimerSoftIntR0;
     
    310305    /** Pointer to the connector of the attached network driver - RC. */
    311306    PPDMINETWORKUPRC                    pDrvRC;
    312     /** The shared memory used for the private interface - RC. */
    313     RCPTRTYPE(PPCNETGUESTSHAREDMEMORY)  pSharedMMIORC;
    314307    /** Software Interrupt timer - RC. */
    315308    PTMTIMERRC                          pTimerSoftIntRC;
     
    319312#endif
    320313
    321 //#if HC_ARCH_BITS == 64
     314    /** Alignment padding. */
    322315    uint32_t                            Alignment1;
    323 //#endif
    324 
    325316    /** Register Address Pointer */
    326317    uint32_t                            u32RAP;
     
    342333     * seen by the guest. */
    343334    uint16_t                            u16CSR0LastSeenByGuest;
    344     uint16_t                            Alignment2[HC_ARCH_BITS == 32 ? 2 : 2];
    345335    /** Last time we polled the queues */
    346336    uint64_t                            u64LastPoll;
     
    351341    uint8_t                             abRecvBuf[4096];
    352342
    353     /** Unused / padding. */
    354     uint32_t                            u32Unused;
     343    /** Alignment padding. */
     344    uint32_t                            Alignment2;
    355345
    356346    /** Size of a RX/TX descriptor (8 or 16 bytes according to SWSTYLE */
     
    373363    RTMAC                               MacConfigured;
    374364    /** Alignment padding. */
    375     uint8_t                             Alignment4[HC_ARCH_BITS == 64 ? 2 : 2];
     365    uint8_t                             Alignment3[2];
    376366
    377367    /** The LED. */
     
    390380    /** True if we signal the guest that RX packets are missing. */
    391381    bool                                fSignalRxMiss;
    392     uint8_t                             Alignment5[HC_ARCH_BITS == 64 ? 2 : 6];
     382    /** Alignment padding. */
     383    uint8_t                             Alignment4[HC_ARCH_BITS == 64 ? 2 : 6];
    393384
    394385#ifdef PCNET_NO_POLLING
     
    405396    /** Error counter for bad receive descriptors. */
    406397    uint32_t                            uCntBadRMD;
    407 
    408     /** True if host and guest admitted to use the private interface. */
    409     bool                                fPrivIfEnabled;
     398    /* True if raw context is enabled. */
    410399    bool                                fGCEnabled;
     400    /* True if R0 context is enabled. */
    411401    bool                                fR0Enabled;
     402    /* True: Emulate Am79C973. False: Emulate 79C970A. */
    412403    bool                                fAm79C973;
     404    /* Link speed to be reported through CSR68. */
     405    bool                                Alignment5;
     406    /* Alignment padding. */
    413407    uint32_t                            u32LinkSpeed;
     408    /* MS to wait before we enable the link. */
    414409    uint32_t                            cMsLinkUpDelay;
     410    /* Alignment padding. */
    415411    uint32_t                            Alignment6;
    416412
     
    663659    uint8_t    ownbyte;
    664660
    665     if (pThis->fPrivIfEnabled)
    666     {
    667         /* RX/TX descriptors shared between host and guest => direct copy */
    668         uint8_t *pv = (uint8_t*)pThis->CTX_SUFF(pSharedMMIO)
    669                     + (addr - pThis->GCTDRA)
    670                     + pThis->CTX_SUFF(pSharedMMIO)->V.V1.offTxDescriptors;
    671         if (!(pv[7] & 0x80) && fRetIfNotOwn)
    672             return false;
    673         memcpy(tmd, pv, 16);
    674         return true;
    675     }
    676     else if (RT_UNLIKELY(BCR_SWSTYLE(pThis) == 0))
     661    if (RT_UNLIKELY(BCR_SWSTYLE(pThis) == 0))
    677662    {
    678663        uint16_t xda[4];
     
    725710    STAM_PROFILE_ADV_START(&pThis->CTX_SUFF_Z(StatTmdStore), a);
    726711    PPDMDEVINS pDevIns = PCNETSTATE_2_DEVINS(pThis);
    727     if (pThis->fPrivIfEnabled)
    728     {
    729         /* RX/TX descriptors shared between host and guest => direct copy */
    730         uint8_t *pv = (uint8_t*)pThis->CTX_SUFF(pSharedMMIO)
    731                     + (addr - pThis->GCTDRA)
    732                     + pThis->CTX_SUFF(pSharedMMIO)->V.V1.offTxDescriptors;
    733         memcpy(pv, tmd, 16);
    734         pv[7] &= ~0x80;
    735     }
    736     else if (RT_UNLIKELY(BCR_SWSTYLE(pThis) == 0))
     712    if (RT_UNLIKELY(BCR_SWSTYLE(pThis) == 0))
    737713    {
    738714        uint16_t xda[4];
     
    782758    uint8_t    ownbyte;
    783759
    784     if (pThis->fPrivIfEnabled)
    785     {
    786         /* RX/TX descriptors shared between host and guest => direct copy */
    787         uint8_t *pb = (uint8_t*)pThis->CTX_SUFF(pSharedMMIO)
    788                     + (addr - pThis->GCRDRA)
    789                     + pThis->CTX_SUFF(pSharedMMIO)->V.V1.offRxDescriptors;
    790         if (!(pb[7] & 0x80) && fRetIfNotOwn)
    791             return false;
    792         memcpy(rmd, pb, 16);
    793         return true;
    794     }
    795     else if (RT_UNLIKELY(BCR_SWSTYLE(pThis) == 0))
     760    if (RT_UNLIKELY(BCR_SWSTYLE(pThis) == 0))
    796761    {
    797762        uint16_t rda[4];
     
    843808{
    844809    PPDMDEVINS pDevIns = PCNETSTATE_2_DEVINS(pThis);
    845     if (pThis->fPrivIfEnabled)
    846     {
    847         /* RX/TX descriptors shared between host and guest => direct copy */
    848         uint8_t *pv = (uint8_t*)pThis->CTX_SUFF(pSharedMMIO)
    849                     + (addr - pThis->GCRDRA)
    850                     + pThis->CTX_SUFF(pSharedMMIO)->V.V1.offRxDescriptors;
    851         memcpy(pv, rmd, 16);
    852         pv[7] &= ~0x80;
    853     }
    854     else if (RT_UNLIKELY(BCR_SWSTYLE(pThis) == 0))
     810    if (RT_UNLIKELY(BCR_SWSTYLE(pThis) == 0))
    855811    {
    856812        uint16_t rda[4];
     
    893849{
    894850    PPDMDEVINS pDevIns = PCNETSTATE_2_DEVINS(pThis);
    895 
    896     if (!pThis->fPrivIfEnabled)
    897     {
    898         uint8_t aBuf[16];
    899         size_t cbDesc;
    900         if (RT_UNLIKELY(BCR_SWSTYLE(pThis) == 0))
    901             cbDesc = 8;
    902         else
    903             cbDesc = 16;
    904         PDMDevHlpPhysRead(pDevIns, addr, aBuf, cbDesc);
    905         PDMDevHlpPCIPhysWrite(pDevIns, addr, aBuf, cbDesc);
    906     }
     851    uint8_t aBuf[16];
     852    size_t cbDesc;
     853    if (RT_UNLIKELY(BCR_SWSTYLE(pThis) == 0))
     854        cbDesc = 8;
     855    else
     856        cbDesc = 16;
     857    PDMDevHlpPhysRead(pDevIns, addr, aBuf, cbDesc);
     858    PDMDevHlpPCIPhysWrite(pDevIns, addr, aBuf, cbDesc);
    907859}
    908860#endif /* IN_RING3 */
     
    945897} while (0)
    946898
    947 
    948 #ifdef IN_RING3
    949 /**
    950  * Initialize the shared memory for the private guest interface.
    951  *
    952  * @note Changing this layout will break SSM for guests using the private guest interface!
    953  */
    954 static void pcnetInitSharedMemory(PPCNETSTATE pThis)
    955 {
    956     /* Clear the entire block for pcnetReset usage. */
    957     memset(pThis->pSharedMMIOR3, 0, PCNET_GUEST_SHARED_MEMORY_SIZE);
    958 
    959     pThis->pSharedMMIOR3->u32Version = PCNET_GUEST_INTERFACE_VERSION;
    960     uint32_t off = 2048; /* Leave some space for more fields within the header */
    961 
    962     /*
    963      * The Descriptor arrays.
    964      */
    965     pThis->pSharedMMIOR3->V.V1.offTxDescriptors = off;
    966     off = RT_ALIGN(off + PCNET_GUEST_TX_DESCRIPTOR_SIZE * PCNET_GUEST_MAX_TX_DESCRIPTORS, 32);
    967 
    968     pThis->pSharedMMIOR3->V.V1.offRxDescriptors = off;
    969     off = RT_ALIGN(off + PCNET_GUEST_RX_DESCRIPTOR_SIZE * PCNET_GUEST_MAX_RX_DESCRIPTORS, 32);
    970 
    971     /* Make sure all the descriptors are mapped into HMA space (and later ring-0). The 8192
    972        bytes limit is hardcoded in the PDMDevHlpMMHyperMapMMIO2 call down in pcnetConstruct. */
    973     AssertRelease(off <= 8192);
    974 
    975     /*
    976      * The buffer arrays.
    977      */
    978 #if 0
    979     /* Don't allocate TX buffers since Windows guests cannot use it */
    980     pThis->pSharedMMIOR3->V.V1.offTxBuffers = off;
    981     off = RT_ALIGN(off + PCNET_GUEST_NIC_BUFFER_SIZE * PCNET_GUEST_MAX_TX_DESCRIPTORS, 32);
    982 #endif
    983 
    984     pThis->pSharedMMIOR3->V.V1.offRxBuffers = off;
    985     pThis->pSharedMMIOR3->fFlags = PCNET_GUEST_FLAGS_ADMIT_HOST;
    986     off = RT_ALIGN(off + PCNET_GUEST_NIC_BUFFER_SIZE * PCNET_GUEST_MAX_RX_DESCRIPTORS, 32);
    987     AssertRelease(off <= PCNET_GUEST_SHARED_MEMORY_SIZE);
    988 
    989     /* Update the header with the final size. */
    990     pThis->pSharedMMIOR3->cbUsed = off;
    991 }
    992 #endif /* IN_RING3 */
    993899
    994900#define MULTICAST_FILTER_LEN 8
     
    14311337}
    14321338
    1433 /**
    1434  * Enable/disable the private guest interface.
    1435  */
    1436 static void pcnetEnablePrivateIf(PPCNETSTATE pThis)
    1437 {
    1438     bool fPrivIfEnabled =       pThis->pSharedMMIOR3
    1439                           && !!(pThis->CTX_SUFF(pSharedMMIO)->fFlags & PCNET_GUEST_FLAGS_ADMIT_GUEST);
    1440     if (fPrivIfEnabled != pThis->fPrivIfEnabled)
    1441     {
    1442         pThis->fPrivIfEnabled = fPrivIfEnabled;
    1443         LogRel(("PCNet#%d: %s private interface\n", PCNET_INST_NR, fPrivIfEnabled ? "Enabling" : "Disabling"));
    1444     }
    1445 }
    1446 
    14471339#ifdef IN_RING3
    14481340#ifdef PCNET_NO_POLLING
     
    15601452} while (0)
    15611453
    1562     pcnetEnablePrivateIf(pThis);
    1563 
    15641454    if (BCR_SSIZE32(pThis))
    15651455    {
     
    16471537    if (!CSR_DRX(pThis))
    16481538        pThis->aCSR[0] |= 0x0020;    /* set RXON */
    1649     pcnetEnablePrivateIf(pThis);
    16501539    pThis->aCSR[0] &= ~0x0004;       /* clear STOP bit */
    16511540    pThis->aCSR[0] |=  0x0002;       /* STRT */
     
    16631552    pThis->aCSR[4] &= ~0x02c2;
    16641553    pThis->aCSR[5] &= ~0x0011;
    1665     pcnetEnablePrivateIf(pThis);
    16661554    pcnetPollTimer(pThis);
    16671555}
     
    43464234    SSMR3PutS32(pSSM, pThis->iISR);
    43474235    SSMR3PutU32(pSSM, pThis->u32Lnkst);
    4348     SSMR3PutBool(pSSM, pThis->fPrivIfEnabled);              /* >= If version 0.9 */
     4236    SSMR3PutBool(pSSM, false/* was ffPrivIfEnabled */);     /* >= If version 0.9 */
    43494237    SSMR3PutBool(pSSM, pThis->fSignalRxMiss);               /* >= If version 0.10 */
    43504238    SSMR3PutGCPhys32(pSSM, pThis->GCRDRA);
     
    44074295            || SSM_VERSION_MINOR(uVersion) >= 9)
    44084296        {
    4409             SSMR3GetBool(pSSM, &pThis->fPrivIfEnabled);
    4410             if (pThis->fPrivIfEnabled)
    4411                 LogRel(("PCNet#%d: Enabling private interface\n", PCNET_INST_NR));
     4297            bool fPrivIfEnabled = false;
     4298            SSMR3GetBool(pSSM, &fPrivIfEnabled);
     4299            if (fPrivIfEnabled)
     4300            {
     4301                /* no longer implemented */
     4302                LogRel(("PCNet#%d: Cannot enabling private interface!\n", PCNET_INST_NR));
     4303                return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
     4304            }
    44124305        }
    44134306        if (   SSM_VERSION_MAJOR(uVersion) >  0
     
    48654758        pcnetTimerRestore(pDevIns, pThis->pTimerRestore, pThis);
    48664759    }
    4867     if (pThis->pSharedMMIOR3)
    4868         pcnetInitSharedMemory(pThis);
    48694760
    48704761    /** @todo How to flush the queues? */
     
    48824773    pThis->pXmitQueueRC  = PDMQueueRCPtr(pThis->pXmitQueueR3);
    48834774    pThis->pCanRxQueueRC = PDMQueueRCPtr(pThis->pCanRxQueueR3);
    4884     if (pThis->pSharedMMIOR3)
    4885         pThis->pSharedMMIORC += offDelta;
    48864775#ifdef PCNET_NO_POLLING
    48874776    pThis->pfnEMInterpretInstructionRC += offDelta;
     
    50664955    if (RT_FAILURE(rc))
    50674956        return rc;
    5068 
    5069     bool fPrivIfEnabled;
    5070     rc = CFGMR3QueryBool(pCfg, "PrivIfEnabled", &fPrivIfEnabled);
    5071     if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    5072         fPrivIfEnabled = true;
    5073     else if (RT_FAILURE(rc))
    5074         return PDMDEV_SET_ERROR(pDevIns, rc,
    5075                                 N_("Configuration error: Failed to get the \"PrivIfEnabled\" value"));
    5076 
    5077     if (fPrivIfEnabled)
    5078     {
    5079         /*
    5080          * Initialize shared memory between host and guest for descriptors and RX buffers. Most guests
    5081          * should not care if there is an additional PCI resource but just in case we made this configurable.
    5082          */
    5083         rc = PDMDevHlpMMIO2Register(pDevIns, 2, PCNET_GUEST_SHARED_MEMORY_SIZE, 0, (void **)&pThis->pSharedMMIOR3, "PCNetShMem");
    5084         if (RT_FAILURE(rc))
    5085             return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS,
    5086                                        N_("Failed to allocate %u bytes of memory for the PCNet device"), PCNET_GUEST_SHARED_MEMORY_SIZE);
    5087         rc = PDMDevHlpMMHyperMapMMIO2(pDevIns, 2, 0, 8192, "PCNetShMem", &pThis->pSharedMMIORC);
    5088         if (RT_FAILURE(rc))
    5089             return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS,
    5090                                        N_("Failed to map 8192 bytes of memory for the PCNet device into the hyper memory"));
    5091         pThis->pSharedMMIOR0 = (uintptr_t)pThis->pSharedMMIOR3; /** @todo @bugref{1865}: Map MMIO2 into ring-0. */
    5092 
    5093         pcnetInitSharedMemory(pThis);
    5094         rc = PDMDevHlpPCIIORegionRegister(pDevIns, 2, PCNET_GUEST_SHARED_MEMORY_SIZE,
    5095                                           PCI_ADDRESS_SPACE_MEM, pcnetMMIOSharedMap);
    5096         if (RT_FAILURE(rc))
    5097             return rc;
    5098     }
    50994957
    51004958#ifdef PCNET_NO_POLLING
  • trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp

    r49173 r49754  
    525525    GEN_CHECK_OFF(PCNETSTATE, pfnEMInterpretInstructionR0
    526526#endif
    527     GEN_CHECK_OFF(PCNETSTATE, pSharedMMIOR3);
    528     GEN_CHECK_OFF(PCNETSTATE, pSharedMMIOR0);
    529     GEN_CHECK_OFF(PCNETSTATE, pSharedMMIORC);
    530     GEN_CHECK_OFF(PCNETSTATE, fPrivIfEnabled);
    531527    GEN_CHECK_OFF(PCNETSTATE, fGCEnabled);
    532528    GEN_CHECK_OFF(PCNETSTATE, fR0Enabled);
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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