VirtualBox

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

PDM,Devices: Support for multiple PCI devices/function in a single PDM device.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/VMMDev/VMMDev.cpp

    r64356 r64373  
    28792879 * @callback_method_impl{FNPCIIOREGIONMAP,MMIO/MMIO2 regions}
    28802880 */
    2881 static DECLCALLBACK(int)
    2882 vmmdevIORAMRegionMap(PPCIDEVICE pPciDev, int iRegion, RTGCPHYS GCPhysAddress, RTGCPHYS cb, PCIADDRESSSPACE enmType)
     2881static DECLCALLBACK(int) vmmdevIORAMRegionMap(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, uint32_t iRegion,
     2882                                              RTGCPHYS GCPhysAddress, RTGCPHYS cb, PCIADDRESSSPACE enmType)
    28832883{
    28842884    RT_NOREF1(cb);
     
    28982898            pThis->GCPhysVMMDevRAM = GCPhysAddress;
    28992899            Assert(pThis->GCPhysVMMDevRAM == GCPhysAddress);
    2900             rc = PDMDevHlpMMIOExMap(pPciDev->pDevIns, pPciDev, iRegion, GCPhysAddress);
     2900            rc = PDMDevHlpMMIOExMap(pDevIns, pPciDev, iRegion, GCPhysAddress);
    29012901        }
    29022902        else
     
    29202920            pThis->GCPhysVMMDevHeap = GCPhysAddress;
    29212921            Assert(pThis->GCPhysVMMDevHeap == GCPhysAddress);
    2922             rc = PDMDevHlpMMIOExMap(pPciDev->pDevIns, pPciDev, iRegion, GCPhysAddress);
     2922            rc = PDMDevHlpMMIOExMap(pDevIns, pPciDev, iRegion, GCPhysAddress);
    29232923            if (RT_SUCCESS(rc))
    2924                 rc = PDMDevHlpRegisterVMMDevHeap(pPciDev->pDevIns, GCPhysAddress, pThis->pVMMDevHeapR3, VMMDEV_HEAP_SIZE);
     2924                rc = PDMDevHlpRegisterVMMDevHeap(pDevIns, GCPhysAddress, pThis->pVMMDevHeapR3, VMMDEV_HEAP_SIZE);
    29252925        }
    29262926        else
     
    29292929             * It is about to be unmapped, just clean up.
    29302930             */
    2931             PDMDevHlpRegisterVMMDevHeap(pPciDev->pDevIns, NIL_RTGCPHYS, pThis->pVMMDevHeapR3, VMMDEV_HEAP_SIZE);
     2931            PDMDevHlpRegisterVMMDevHeap(pDevIns, NIL_RTGCPHYS, pThis->pVMMDevHeapR3, VMMDEV_HEAP_SIZE);
    29322932            pThis->GCPhysVMMDevHeap = NIL_RTGCPHYS32;
    29332933            rc = VINF_SUCCESS;
     
    29472947 * @callback_method_impl{FNPCIIOREGIONMAP,I/O Port Region}
    29482948 */
    2949 static DECLCALLBACK(int)
    2950 vmmdevIOPortRegionMap(PPCIDEVICE pPciDev, int iRegion, RTGCPHYS GCPhysAddress, RTGCPHYS cb, PCIADDRESSSPACE enmType)
     2949static DECLCALLBACK(int) vmmdevIOPortRegionMap(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, uint32_t iRegion,
     2950                                              RTGCPHYS GCPhysAddress, RTGCPHYS cb, PCIADDRESSSPACE enmType)
    29512951{
    29522952    RT_NOREF3(iRegion, cb, enmType);
     
    29602960     * Register our port IO handlers.
    29612961     */
    2962     int rc = PDMDevHlpIOPortRegister(pPciDev->pDevIns, (RTIOPORT)GCPhysAddress + VMMDEV_PORT_OFF_REQUEST, 1,
     2962    int rc = PDMDevHlpIOPortRegister(pDevIns, (RTIOPORT)GCPhysAddress + VMMDEV_PORT_OFF_REQUEST, 1,
    29632963                                     pThis, vmmdevRequestHandler, NULL, NULL, NULL, "VMMDev Request Handler");
    29642964    AssertRC(rc);
     
    41464146
    41474147    /*
    4148      * Allocate and initialize the MMIO2 memory.
    4149      */
    4150     rc = PDMDevHlpMMIO2Register(pDevIns, 1 /*iRegion*/, VMMDEV_RAM_SIZE, 0 /*fFlags*/, (void **)&pThis->pVMMDevRAMR3, "VMMDev");
    4151     if (RT_FAILURE(rc))
    4152         return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS,
    4153                                    N_("Failed to allocate %u bytes of memory for the VMM device"), VMMDEV_RAM_SIZE);
    4154     vmmdevInitRam(pThis);
    4155 
    4156     if (pThis->fHeapEnabled)
    4157     {
    4158         rc = PDMDevHlpMMIO2Register(pDevIns, 2 /*iRegion*/, VMMDEV_HEAP_SIZE, 0 /*fFlags*/, (void **)&pThis->pVMMDevHeapR3, "VMMDev Heap");
    4159         if (RT_FAILURE(rc))
    4160             return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS,
    4161                                        N_("Failed to allocate %u bytes of memory for the VMM device heap"), PAGE_SIZE);
    4162 
    4163         /* Register the memory area with PDM so HM can access it before it's mapped. */
    4164         rc = PDMDevHlpRegisterVMMDevHeap(pDevIns, NIL_RTGCPHYS, pThis->pVMMDevHeapR3, VMMDEV_HEAP_SIZE);
    4165         AssertLogRelRCReturn(rc, rc);
    4166     }
    4167 
    4168     /*
    41694148     * Register the PCI device.
    41704149     */
     
    41854164        if (RT_FAILURE(rc))
    41864165            return rc;
     4166    }
     4167
     4168    /*
     4169     * Allocate and initialize the MMIO2 memory.
     4170     */
     4171    rc = PDMDevHlpMMIO2Register(pDevIns, &pThis->PciDev, 1 /*iRegion*/, VMMDEV_RAM_SIZE, 0 /*fFlags*/,
     4172                                (void **)&pThis->pVMMDevRAMR3, "VMMDev");
     4173    if (RT_FAILURE(rc))
     4174        return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS,
     4175                                   N_("Failed to allocate %u bytes of memory for the VMM device"), VMMDEV_RAM_SIZE);
     4176    vmmdevInitRam(pThis);
     4177
     4178    if (pThis->fHeapEnabled)
     4179    {
     4180        rc = PDMDevHlpMMIO2Register(pDevIns, &pThis->PciDev, 2 /*iRegion*/, VMMDEV_HEAP_SIZE, 0 /*fFlags*/,
     4181                                    (void **)&pThis->pVMMDevHeapR3, "VMMDev Heap");
     4182        if (RT_FAILURE(rc))
     4183            return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS,
     4184                                       N_("Failed to allocate %u bytes of memory for the VMM device heap"), PAGE_SIZE);
     4185
     4186        /* Register the memory area with PDM so HM can access it before it's mapped. */
     4187        rc = PDMDevHlpRegisterVMMDevHeap(pDevIns, NIL_RTGCPHYS, pThis->pVMMDevHeapR3, VMMDEV_HEAP_SIZE);
     4188        AssertLogRelRCReturn(rc, rc);
    41874189    }
    41884190
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