VirtualBox

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


Ignore:
Timestamp:
Dec 1, 2019 3:38:40 AM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
135137
Message:

IOM,PDMDevHlp: Kicked out the old MMIO code. bugref:9218

File:
1 edited

Legend:

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

    r82299 r82313  
    25122512 *
    25132513 * @returns VBox status code.
    2514  * @param   pDevIns             The PCI bus device instance.
    25152514 * @param   pDev                The PCI device.
    25162515 * @param   iRegion             The region to unmap.
    25172516 */
    2518 static int devpciR3UnmapRegion(PPDMDEVINS pDevIns, PPDMPCIDEV pDev, int iRegion)
     2517static int devpciR3UnmapRegion(PPDMPCIDEV pDev, int iRegion)
    25192518{
    25202519    PPCIIOREGION pRegion = &pDev->Int.s.aIORegions[iRegion];
     
    25242523    if (pRegion->addr != INVALID_PCI_ADDRESS)
    25252524    {
    2526         if (   (pRegion->hHandle != UINT64_MAX)
    2527             || (pRegion->fFlags & PDMPCIDEV_IORGN_F_NEW_STYLE))
    2528         {
    2529             /*
    2530              * New style device with a IOM handle.  Do callout first (optional),
    2531              * then do the unmapping via handle.
    2532              */
    2533             if (pRegion->pfnMap)
    2534             {
    2535                 rc = pRegion->pfnMap(pDev->Int.s.pDevInsR3, pDev, iRegion,
    2536                                      NIL_RTGCPHYS, pRegion->size, (PCIADDRESSSPACE)(pRegion->type));
     2525        /*
     2526         * Do callout first (optional), then do the unmapping via handle if we've been handed one.
     2527         */
     2528        if (pRegion->pfnMap)
     2529        {
     2530            rc = pRegion->pfnMap(pDev->Int.s.pDevInsR3, pDev, iRegion,
     2531                                 NIL_RTGCPHYS, pRegion->size, (PCIADDRESSSPACE)(pRegion->type));
     2532            AssertRC(rc);
     2533        }
     2534
     2535        switch (pRegion->fFlags & PDMPCIDEV_IORGN_F_HANDLE_MASK)
     2536        {
     2537            case PDMPCIDEV_IORGN_F_IOPORT_HANDLE:
     2538                rc = PDMDevHlpIoPortUnmap(pDev->Int.s.pDevInsR3, (IOMIOPORTHANDLE)pRegion->hHandle);
    25372539                AssertRC(rc);
    2538             }
    2539 
    2540             switch (pRegion->fFlags & PDMPCIDEV_IORGN_F_HANDLE_MASK)
    2541             {
    2542                 case PDMPCIDEV_IORGN_F_IOPORT_HANDLE:
    2543                     rc = PDMDevHlpIoPortUnmap(pDev->Int.s.pDevInsR3, (IOMIOPORTHANDLE)pRegion->hHandle);
    2544                     AssertRC(rc);
    2545                     break;
    2546 
    2547                 case PDMPCIDEV_IORGN_F_MMIO_HANDLE:
    2548                     rc = PDMDevHlpMmioUnmap(pDev->Int.s.pDevInsR3, (IOMMMIOHANDLE)pRegion->hHandle);
    2549                     AssertRC(rc);
    2550                     break;
    2551 
    2552                 case PDMPCIDEV_IORGN_F_MMIO2_HANDLE:
    2553                     rc = PDMDevHlpMmio2Unmap(pDev->Int.s.pDevInsR3, (PGMMMIO2HANDLE)pRegion->hHandle);
    2554                     AssertRC(rc);
    2555                     break;
    2556 
    2557                 case PDMPCIDEV_IORGN_F_NO_HANDLE:
    2558                     Assert(pRegion->fFlags & PDMPCIDEV_IORGN_F_NEW_STYLE);
    2559                     Assert(pRegion->hHandle == UINT64_MAX);
    2560                     break;
    2561 
    2562                 default:
    2563                     AssertLogRelFailed();
    2564             }
    2565         }
    2566         else
    2567         {
    2568             /*
    2569              * Old style device, no handle here and only MMIOEx gets callouts.
    2570              */
    2571             if (pRegion->type & PCI_ADDRESS_SPACE_IO)
    2572                 AssertFailed();
    2573             else
    2574             {
    2575                 RTGCPHYS     GCPhysBase = pRegion->addr;
    2576 #ifdef VBOX_STRICT
    2577                 PDEVPCIBUSCC pBusCC     = PDMINS_2_DATA_CC(pDevIns, PDEVPCIBUSCC);
    2578                 Assert(!pBusCC->pPciHlpR3->pfnIsMMIOExBase(pDevIns, pDev->Int.s.pDevInsR3, GCPhysBase));
    2579 #else
    2580                 RT_NOREF(pDevIns);
    2581 #endif
    2582                 rc = PDMDevHlpMMIODeregister(pDev->Int.s.pDevInsR3, GCPhysBase, pRegion->size);
     2540                break;
     2541
     2542            case PDMPCIDEV_IORGN_F_MMIO_HANDLE:
     2543                rc = PDMDevHlpMmioUnmap(pDev->Int.s.pDevInsR3, (IOMMMIOHANDLE)pRegion->hHandle);
    25832544                AssertRC(rc);
    2584             }
     2545                break;
     2546
     2547            case PDMPCIDEV_IORGN_F_MMIO2_HANDLE:
     2548                rc = PDMDevHlpMmio2Unmap(pDev->Int.s.pDevInsR3, (PGMMMIO2HANDLE)pRegion->hHandle);
     2549                AssertRC(rc);
     2550                break;
     2551
     2552            case PDMPCIDEV_IORGN_F_NO_HANDLE:
     2553                Assert(pRegion->fFlags & PDMPCIDEV_IORGN_F_NEW_STYLE);
     2554                Assert(pRegion->hHandle == UINT64_MAX);
     2555                break;
     2556
     2557            default:
     2558                AssertLogRelFailed();
    25852559        }
    25862560        pRegion->addr = INVALID_PCI_ADDRESS;
     
    25942568 *
    25952569 * @returns VINF_SUCCESS of DBGFSTOP result.
    2596  * @param   pDevIns             The PCI bus device instance.
    25972570 * @param   pPciDev             The PCI device to update the mappings for.
    25982571 * @param   fP2PBridge          Whether this is a PCI to PCI bridge or not.
    25992572 */
    2600 static VBOXSTRICTRC devpciR3UpdateMappings(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, bool fP2PBridge)
     2573static VBOXSTRICTRC devpciR3UpdateMappings(PPDMPCIDEV pPciDev, bool fP2PBridge)
    26012574{
    26022575    /* safe, only needs to go to the config space array */
     
    26922665            /*
    26932666             * Do real unmapping and/or mapping if the address change.
    2694              *
    2695              * For new style device we'll do the actual mapping, whereas old ones
    2696              * are expected to do it themselves via the callback.
    26972667             */
    26982668            Log4(("devpciR3UpdateMappings: dev %u/%u (%s): iRegion=%u addr=%#RX64 uNew=%#RX64\n",
     
    27052675                         pPciDev->pszNameR3, iRegion, pRegion->addr, uNew, cbRegion, cbRegion));
    27062676
    2707                 int rc = devpciR3UnmapRegion(pDevIns, pPciDev, iRegion);
     2677                int rc = devpciR3UnmapRegion(pPciDev, iRegion);
    27082678                AssertLogRelRC(rc);
    27092679                pRegion->addr = uNew;
    27102680                if (uNew != INVALID_PCI_ADDRESS)
    27112681                {
    2712                     /* The callout is optional with new style devices: */
     2682                    /* The callout is optional (typically not used): */
    27132683                    if (!pRegion->pfnMap)
    27142684                        rc = VINF_SUCCESS;
     
    27202690                    }
    27212691
    2722                     /* We do the mapping for new-style devices: */
     2692                    /* We do the mapping for most devices: */
    27232693                    if (pRegion->hHandle != UINT64_MAX && rc != VINF_PCI_MAPPING_DONE)
    27242694                    {
     
    30092979             */
    30102980            if (fUpdateMappings)
    3011                 rcStrict = devpciR3UpdateMappings(pDevIns, pPciDev, fP2PBridge);
     2981                rcStrict = devpciR3UpdateMappings(pPciDev, fP2PBridge);
    30122982        }
    30132983    }
     
    34913461                            == PCI_ADDRESS_SPACE_BAR64;
    34923462
    3493         devpciR3UnmapRegion(pDevIns, pDev, iRegion);
     3463        devpciR3UnmapRegion(pDev, iRegion);
    34943464
    34953465        if (f64Bit)
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