VirtualBox

Changeset 39091 in vbox for trunk/src/VBox/Devices/Bus


Ignore:
Timestamp:
Oct 24, 2011 1:58:22 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
74523
Message:

More parameter warning fixes; made PciIch9 check the saved state version.

Location:
trunk/src/VBox/Devices/Bus
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Bus/DevPCI.cpp

    r38852 r39091  
    555555            }
    556556#else
     557            NOREF(len);
    557558            return VINF_IOM_HC_IOPORT_READ;
    558559#endif
     
    568569            Log(("pci_config_read: %s: addr=%02x val=%08x len=%d\n", pci_dev->name, config_addr, *pu32, len));
    569570#else
     571            NOREF(len);
    570572            return VINF_IOM_HC_IOPORT_READ;
    571573#endif
     
    12471249static DECLCALLBACK(int) pciGenericSaveExec(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PSSMHANDLE pSSM)
    12481250{
     1251    NOREF(pDevIns);
    12491252    return SSMR3PutMem(pSSM, &pPciDev->config[0], sizeof(pPciDev->config));
    12501253}
     
    12611264static DECLCALLBACK(int) pciGenericLoadExec(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PSSMHANDLE pSSM)
    12621265{
     1266    NOREF(pDevIns);
    12631267    return SSMR3GetMem(pSSM, &pPciDev->config[0], sizeof(pPciDev->config));
    12641268}
     
    18501854static DECLCALLBACK(int) pciIORegionRegister(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, int iRegion, uint32_t cbRegion, PCIADDRESSSPACE enmType, PFNPCIIOREGIONMAP pfnCallback)
    18511855{
     1856    NOREF(pDevIns);
     1857
    18521858    /*
    18531859     * Validate.
     
    18921898                                                PFNPCICONFIGWRITE pfnWrite, PPFNPCICONFIGWRITE ppfnWriteOld)
    18931899{
     1900    NOREF(pDevIns);
     1901
    18941902    if (ppfnReadOld)
    18951903        *ppfnReadOld = pPciDev->Int.s.pfnConfigRead;
     
    19711979{
    19721980    PPCIGLOBALS pGlobals = PDMINS_2_DATA(pDevIns, PPCIGLOBALS);
    1973     PPCIBUS     pBus = DEVINS_2_PCIBUS(pDevIns);
    19741981    uint16_t    router;
    19751982    uint8_t     irq_map;
    19761983    int         i;
     1984    NOREF(pszArgs);
    19771985
    19781986    router = pGlobals->PIIX3State.dev.devfn;
  • trunk/src/VBox/Devices/Bus/DevPciIch9.cpp

    r38853 r39091  
    179179DECLINLINE(void) ich9pciPhysToPciAddr(PICH9PCIGLOBALS pGlobals, RTGCPHYS GCPhysAddr, PciAddress* pPciAddr)
    180180{
     181    NOREF(pGlobals);
    181182    pPciAddr->iBus          = (GCPhysAddr >> 20) & ((1<<6)       - 1);
    182183    pPciAddr->iDeviceFunc   = (GCPhysAddr >> 12) & ((1<<(5+3))   - 1); // 5 bits - device, 3 bits - function
     
    295296            {
    296297                AssertPtr(pBridgeDevice->Int.s.pfnBridgeConfigWrite);
    297                 pBridgeDevice->Int.s.pfnBridgeConfigWrite(pBridgeDevice->pDevIns, pAddr->iBus, pAddr->iDeviceFunc, pAddr->iRegister, val, cb);
     298                pBridgeDevice->Int.s.pfnBridgeConfigWrite(pBridgeDevice->pDevIns, pAddr->iBus, pAddr->iDeviceFunc,
     299                                                          pAddr->iRegister, val, cb);
    298300            }
    299301            else
     
    301303                // do nothing, bridge not found
    302304            }
     305            NOREF(rcReschedule);
    303306#else
    304307            rc = rcReschedule;
    305             goto out;
    306308#endif
    307309        }
     
    316318#else
    317319            rc = rcReschedule;
    318             goto out;
    319320#endif
    320321        }
    321322    }
    322323
    323   out:
    324324    Log2(("ich9pciDataWriteAddr: %02x:%02x:%02x reg %x(%d) %x %Rrc\n",
    325325          pAddr->iBus, pAddr->iDeviceFunc >> 3, pAddr->iDeviceFunc & 0x7, pAddr->iRegister,
     
    398398            else
    399399                ich9pciNoMem(pu32, cb);
     400            NOREF(rcReschedule);
    400401#else
    401402            rc = rcReschedule;
    402             goto out;
    403403#endif
    404404        } else
     
    414414#else
    415415            rc = rcReschedule;
    416             goto out;
    417416#endif
    418417        }
     
    421420    }
    422421
    423   out:
    424422    Log3(("ich9pciDataReadAddr: %02x:%02x:%02x reg %x(%d) gave %x %Rrc\n",
    425423          pPciAddr->iBus, pPciAddr->iDeviceFunc >> 3, pPciAddr->iDeviceFunc & 0x7, pPciAddr->iRegister,
     
    486484DECLINLINE(int) ich9pciSlotGetPirq(uint8_t uBus, uint8_t uDevFn, int iIrqNum)
    487485{
     486    NOREF(uBus);
    488487    int iSlotAddend = (uDevFn >> 3) - 1;
    489488    return (iIrqNum + iSlotAddend) & 3;
     
    594593    PciAddress aDest;
    595594    uint32_t u32 = 0;
     595    NOREF(pvUser);
    596596
    597597    Log2(("ich9pciMcfgMMIOWrite: %RGp(%d) \n", GCPhysAddr, cb));
     
    627627    PciAddress  aDest;
    628628    uint32_t    rv;
     629    NOREF(pvUser);
    629630
    630631    LogFlow(("ich9pciMcfgMMIORead: %RGp(%d) \n", GCPhysAddr, cb));
     
    750751static void ich9pciUpdateMappings(PCIDevice* pDev)
    751752{
    752     PICH9PCIBUS pBus = pDev->Int.s.CTX_SUFF(pBus);
    753753    uint64_t uLast, uNew;
    754754
     
    861861static DECLCALLBACK(int) ich9pciRegisterMsi(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PPDMMSIREG pMsiReg)
    862862{
     863    NOREF(pDevIns);
    863864    int rc;
    864865
     
    899900static DECLCALLBACK(int) ich9pciIORegionRegister(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, int iRegion, uint32_t cbRegion, PCIADDRESSSPACE enmType, PFNPCIIOREGIONMAP pfnCallback)
    900901{
     902    NOREF(pDevIns);
     903
    901904    /*
    902905     * Validate.
     
    953956                                                    PFNPCICONFIGWRITE pfnWrite, PPFNPCICONFIGWRITE ppfnWriteOld)
    954957{
     958    NOREF(pDevIns);
     959
    955960    if (ppfnReadOld)
    956961        *ppfnReadOld = pPciDev->Int.s.pfnConfigRead;
     
    972977static DECLCALLBACK(int) ich9pciGenericSaveExec(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PSSMHANDLE pSSM)
    973978{
     979    NOREF(pDevIns);
    974980    Assert(!pciDevIsPassthrough(pPciDev));
    975981    return SSMR3PutMem(pSSM, &pPciDev->config[0], sizeof(pPciDev->config));
     
    13041310
    13051311    Assert(uPass == SSM_PASS_FINAL); NOREF(uPass);
     1312    if (uVersion != VBOX_ICH9PCI_SAVED_STATE_VERSION_CURRENT)
     1313        return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
    13061314
    13071315    /*
     
    13251333    }
    13261334
    1327     void* pvMsixPage = RTMemTmpAllocZ(0x1000);
     1335    void *pvMsixPage = RTMemTmpAllocZ(0x1000);
     1336    AssertReturn(pvMsixPage, VERR_NO_TMP_MEMORY);
     1337
    13281338    /*
    13291339     * Iterate all the devices.
     
    13371347        rc = SSMR3GetU32(pSSM, &u32);
    13381348        if (RT_FAILURE(rc))
    1339             return rc;
     1349            break;
    13401350        if (u32 == (uint32_t)~0)
    13411351            break;
    1342         if (    u32 >= RT_ELEMENTS(pBus->apDevices)
    1343             ||  u32 < i)
    1344         {
    1345             AssertMsgFailed(("u32=%#x i=%#x\n", u32, i));
    1346             goto out;
    1347         }
     1352        AssertMsgBreak(u32 < RT_ELEMENTS(pBus->apDevices) && u32 >= i, ("u32=%#x i=%#x\n", u32, i));
    13481353
    13491354        /* skip forward to the device checking that no new devices are present. */
     
    13561361                        PCIDevGetVendorId(pDev), PCIDevGetDeviceId(pDev)));
    13571362                if (SSMR3HandleGetAfter(pSSM) != SSMAFTER_DEBUG_IT)
    1358                     return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("New device in slot %#x, %s (vendor=%#06x device=%#06x)"),
    1359                                             i, pDev->name, PCIDevGetVendorId(pDev), PCIDevGetDeviceId(pDev));
     1363                {
     1364                    rc = SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("New device in slot %#x, %s (vendor=%#06x device=%#06x)"),
     1365                                          i, pDev->name, PCIDevGetVendorId(pDev), PCIDevGetDeviceId(pDev));
     1366                    break;
     1367                }
    13601368            }
    13611369        }
     1370        if (RT_FAILURE(rc))
     1371            break;
    13621372
    13631373        /* get the data */
     
    13701380        SSMR3GetMem(pSSM, DevTmp.config, sizeof(DevTmp.config));
    13711381
    1372         rc = SSMR3GetU32(pSSM, &DevTmp.Int.s.fFlags);
    1373         if (RT_FAILURE(rc))
    1374             goto out;
    1375 
    1376         rc = SSMR3GetS32(pSSM, &DevTmp.Int.s.uIrqPinState);
    1377         if (RT_FAILURE(rc))
    1378             goto out;
    1379 
    1380         rc = SSMR3GetU8(pSSM, &DevTmp.Int.s.u8MsiCapOffset);
    1381         if (RT_FAILURE(rc))
    1382             goto out;
    1383 
    1384         rc = SSMR3GetU8(pSSM, &DevTmp.Int.s.u8MsiCapSize);
    1385         if (RT_FAILURE(rc))
    1386             goto out;
    1387 
    1388         rc = SSMR3GetU8(pSSM, &DevTmp.Int.s.u8MsixCapOffset);
    1389         if (RT_FAILURE(rc))
    1390             goto out;
    1391 
     1382        SSMR3GetU32(pSSM, &DevTmp.Int.s.fFlags);
     1383        SSMR3GetS32(pSSM, &DevTmp.Int.s.uIrqPinState);
     1384        SSMR3GetU8(pSSM, &DevTmp.Int.s.u8MsiCapOffset);
     1385        SSMR3GetU8(pSSM, &DevTmp.Int.s.u8MsiCapSize);
     1386        SSMR3GetU8(pSSM, &DevTmp.Int.s.u8MsixCapOffset);
    13921387        rc = SSMR3GetU8(pSSM, &DevTmp.Int.s.u8MsixCapSize);
    13931388        if (RT_FAILURE(rc))
    1394             goto out;
     1389            break;
    13951390
    13961391        /* Load MSI-X page state */
     
    13981393        {
    13991394            Assert(pvMsixPage != NULL);
    1400             SSMR3GetMem(pSSM, pvMsixPage, 0x1000);
     1395            rc = SSMR3GetMem(pSSM, pvMsixPage, 0x1000);
    14011396            if (RT_FAILURE(rc))
    1402                 goto out;
     1397                break;
    14031398        }
    14041399
     
    14101405                    PCIDevGetVendorId(&DevTmp), PCIDevGetDeviceId(&DevTmp)));
    14111406            if (SSMR3HandleGetAfter(pSSM) != SSMAFTER_DEBUG_IT)
    1412                 return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Device in slot %#x has been removed! vendor=%#06x device=%#06x"),
    1413                                         i, PCIDevGetVendorId(&DevTmp), PCIDevGetDeviceId(&DevTmp));
     1407            {
     1408                rc = SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Device in slot %#x has been removed! vendor=%#06x device=%#06x"),
     1409                                      i, PCIDevGetVendorId(&DevTmp), PCIDevGetDeviceId(&DevTmp));
     1410                break;
     1411            }
    14141412            continue;
    14151413        }
    14161414
    14171415        /* match the vendor id assuming that this will never be changed. */
    1418         if (    PCIDevGetVendorId(&DevTmp) != PCIDevGetVendorId(pDev))
    1419             return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Device in slot %#x (%s) vendor id mismatch! saved=%.4Rhxs current=%.4Rhxs"),
    1420                                      i, pDev->name, PCIDevGetVendorId(&DevTmp), PCIDevGetVendorId(pDev));
     1416        if (PCIDevGetVendorId(&DevTmp) != PCIDevGetVendorId(pDev))
     1417        {
     1418            rc = SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Device in slot %#x (%s) vendor id mismatch! saved=%.4Rhxs current=%.4Rhxs"),
     1419                                  i, pDev->name, PCIDevGetVendorId(&DevTmp), PCIDevGetVendorId(pDev));
     1420            break;
     1421        }
    14211422
    14221423        /* commit the loaded device config. */
     
    14361437    }
    14371438
    1438   out:
    1439     if (pvMsixPage)
    1440         RTMemTmpFree(pvMsixPage);
     1439    RTMemTmpFree(pvMsixPage);
    14411440
    14421441    return rc;
     
    14531452static DECLCALLBACK(int) ich9pciGenericLoadExec(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PSSMHANDLE pSSM)
    14541453{
     1454    NOREF(pDevIns);
    14551455    Assert(!pciDevIsPassthrough(pPciDev));
    14561456    return SSMR3GetMem(pSSM, &pPciDev->config[0], sizeof(pPciDev->config));
     
    18221822static DECLCALLBACK(int) ich9pciFakePCIBIOS(PPDMDEVINS pDevIns)
    18231823{
    1824     unsigned    i;
    1825     uint8_t     elcr[2] = {0, 0};
    18261824    PICH9PCIGLOBALS pGlobals = PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS);
    1827     PVM         pVM = PDMDevHlpGetVM(pDevIns);
     1825    PVM             pVM = PDMDevHlpGetVM(pDevIns);
    18281826    Assert(pVM);
    18291827
     
    18441842     * Init the devices.
    18451843     */
    1846     for (i = 0; i < 256; i++)
     1844    for (int i = 0; i < 256; i++)
    18471845    {
    18481846        ich9pciBiosInitDevice(pGlobals, 0, i);
     
    19811979    bool     fUpdateMappings = false;
    19821980    bool     fP2PBridge = false;
    1983     bool     fPassthrough = pciDevIsPassthrough(aDev);
     1981    /*bool     fPassthrough = pciDevIsPassthrough(aDev);*/
    19841982    uint8_t  u8HeaderType = ich9pciGetByte(aDev, VBOX_PCI_HEADER_TYPE);
    19851983
     
    21022100static bool assignPosition(PICH9PCIBUS pBus, PPCIDEVICE pPciDev, const char *pszName, int iDevFn, PciAddress* aPosition)
    21032101{
     2102    NOREF(pszName);
    21042103    aPosition->iBus = 0;
    21052104    aPosition->iDeviceFunc = iDevFn;
     
    21072106
    21082107    /* Explicit slot request */
    2109     if (iDevFn >=0 && iDevFn < (int)RT_ELEMENTS(pBus->apDevices))
     2108    if (iDevFn >= 0 && iDevFn < (int)RT_ELEMENTS(pBus->apDevices))
    21102109        return true;
    21112110
     
    21332132}
    21342133
     2134#ifdef SOME_UNUSED_FUNCTION
    21352135static bool hasHardAssignedDevsInSlot(PICH9PCIBUS pBus, int iSlot)
    21362136{
     
    21472147           ;
    21482148}
     2149#endif
    21492150
    21502151static int ich9pciRegisterInternal(PICH9PCIBUS pBus, int iDev, PPCIDEVICE pPciDev, const char *pszName)
     
    25812582static void ich9pciResetDevice(PPCIDEVICE pDev)
    25822583{
    2583     PICH9PCIBUS pBus = pDev->Int.s.CTX_SUFF(pBus);
    2584     int rc;
    2585 
    25862584    /* Clear regions */
    25872585    for (int iRegion = 0; iRegion < PCI_NUM_REGIONS; iRegion++)
  • trunk/src/VBox/Devices/Bus/MsixCommon.cpp

    r37636 r39091  
    116116PDMBOTHCBDECL(int) msixMMIORead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb)
    117117{
    118     /// @todo: qword accesses?
     118    /// @todo qword accesses?
     119    NOREF(pDevIns);
    119120    AssertMsgReturn(cb == 4,
    120121                    ("MSI-X must be accessed with 4-byte reads"),
     
    153154{
    154155    Assert(enmType == PCI_ADDRESS_SPACE_MEM);
     156    NOREF(iRegion); NOREF(enmType);
    155157
    156158    int rc = PDMDevHlpMMIORegister(pPciDev->pDevIns, GCPhysAddress, cb, pPciDev,
     
    323325        msixCheckPendingVectors(pDevIns, pPciHlp, pDev);
    324326}
    325 uint32_t MsixPciConfigRead (PPDMDEVINS pDevIns, PPCIDEVICE pDev, uint32_t u32Address, unsigned len)
     327
     328
     329uint32_t MsixPciConfigRead(PPDMDEVINS pDevIns, PPCIDEVICE pDev, uint32_t u32Address, unsigned len)
    326330{
    327331    int32_t iOff = u32Address - pDev->Int.s.u8MsixCapOffset;
     332    NOREF(pDevIns);
    328333
    329334    Assert(iOff >= 0 && (pciDevIsMsixCapable(pDev) && iOff < pDev->Int.s.u8MsixCapSize));
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