VirtualBox

Changeset 64406 in vbox


Ignore:
Timestamp:
Oct 24, 2016 7:25:03 PM (8 years ago)
Author:
vboxsync
Message:

PDMPCIDEVREG_DEV_NO_SAME_AS_PREV: Extended the search to previous PDM device instances in order to make it easier to do one PCI function per instance.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/pdmdev.h

    r64387 r64406  
    23442344# define PDMPCIDEVREG_CFG_NEXT              UINT32_MAX
    23452345/** Same device number as the previous PCI device registered with the PDM device.
    2346  * This is handy when registering multiple PCI device functions
    2347  * and the device number is left up to the PCI bus. */
     2346 * This is handy when registering multiple PCI device functions and the device
     2347 * number is left up to the PCI bus.  In order to facilitate on PDM device
     2348 * instance for each PCI function, this searches earlier PDM device
     2349 * instances as well. */
    23482350# define PDMPCIDEVREG_DEV_NO_SAME_AS_PREV   UINT8_C(0xfd)
    23492351/** Use the first unused device number (all functions must be unused). */
  • trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp

    r64390 r64406  
    12991299    if (uPciDevNo == PDMPCIDEVREG_DEV_NO_SAME_AS_PREV)
    13001300    {
    1301         AssertLogRelMsgReturn(pPrevPciDev, ("'%s'/%d: Can't use PDMPCIDEVREG_DEV_NO_SAME_AS_PREV with the first PCI device!\n",
    1302                                             pDevIns->pReg->szName, pDevIns->iInstance),
    1303                               VERR_WRONG_ORDER);
    1304         uPciDevNo = pPrevPciDev->uDevFn >> 3;
     1301        if (pPrevPciDev)
     1302            uPciDevNo = pPrevPciDev->uDevFn >> 3;
     1303        else
     1304        {
     1305            /* Look for PCI device registered with an earlier device instance so we can more
     1306               easily have multiple functions spanning multiple PDM device instances. */
     1307            PPDMPCIDEV pOtherPciDev = NULL;
     1308            PPDMDEVINS pPrevIns = pDevIns->Internal.s.pDevR3->pInstances;
     1309            while (pPrevIns != pDevIns && pPrevIns)
     1310            {
     1311                pOtherPciDev = pPrevIns->Internal.s.pHeadPciDevR3;
     1312                pPrevIns = pPrevIns->Internal.s.pNextR3;
     1313            }
     1314            Assert(pPrevIns == pDevIns);
     1315            AssertLogRelMsgReturn(pOtherPciDev,
     1316                                  ("'%s'/%d: Can't use PDMPCIDEVREG_DEV_NO_SAME_AS_PREV without a previously registered PCI device by the same or earlier PDM device instance!\n",
     1317                                   pDevIns->pReg->szName, pDevIns->iInstance),
     1318                                  VERR_WRONG_ORDER);
     1319
     1320            while (pOtherPciDev->Int.s.pNextR3)
     1321                pOtherPciDev = pOtherPciDev->Int.s.pNextR3;
     1322            uPciDevNo = pOtherPciDev->uDevFn >> 3;
     1323        }
    13051324    }
    13061325
  • trunk/src/VBox/VMM/include/PDMInternal.h

    r64387 r64406  
    142142    PVMR3                           pVMR3;
    143143    /** Associated PCI device list head (first is default). (R3 ptr) */
    144     R3PTRTYPE(PPDMPCIDEV)        pHeadPciDevR3;
     144    R3PTRTYPE(PPDMPCIDEV)           pHeadPciDevR3;
    145145
    146146    /** R0 pointer to the VM this instance was created for. */
    147147    PVMR0                           pVMR0;
    148148    /** Associated PCI device list head (first is default). (R0 ptr) */
    149     R0PTRTYPE(PPDMPCIDEV)        pHeadPciDevR0;
     149    R0PTRTYPE(PPDMPCIDEV)           pHeadPciDevR0;
    150150
    151151    /** RC pointer to the VM this instance was created for. */
    152152    PVMRC                           pVMRC;
    153153    /** Associated PCI device list head (first is default). (RC ptr) */
    154     RCPTRTYPE(PPDMPCIDEV)        pHeadPciDevRC;
     154    RCPTRTYPE(PPDMPCIDEV)           pHeadPciDevRC;
    155155
    156156    /** Flags, see PDMDEVINSINT_FLAGS_XXX. */
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