Changeset 82313 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Dec 1, 2019 3:38:40 AM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 135137
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevPciIch9.cpp
r82299 r82313 2512 2512 * 2513 2513 * @returns VBox status code. 2514 * @param pDevIns The PCI bus device instance.2515 2514 * @param pDev The PCI device. 2516 2515 * @param iRegion The region to unmap. 2517 2516 */ 2518 static int devpciR3UnmapRegion(PPDM DEVINS pDevIns, PPDMPCIDEV pDev, int iRegion)2517 static int devpciR3UnmapRegion(PPDMPCIDEV pDev, int iRegion) 2519 2518 { 2520 2519 PPCIIOREGION pRegion = &pDev->Int.s.aIORegions[iRegion]; … … 2524 2523 if (pRegion->addr != INVALID_PCI_ADDRESS) 2525 2524 { 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); 2537 2539 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); 2583 2544 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(); 2585 2559 } 2586 2560 pRegion->addr = INVALID_PCI_ADDRESS; … … 2594 2568 * 2595 2569 * @returns VINF_SUCCESS of DBGFSTOP result. 2596 * @param pDevIns The PCI bus device instance.2597 2570 * @param pPciDev The PCI device to update the mappings for. 2598 2571 * @param fP2PBridge Whether this is a PCI to PCI bridge or not. 2599 2572 */ 2600 static VBOXSTRICTRC devpciR3UpdateMappings(PPDM DEVINS pDevIns, PPDMPCIDEV pPciDev, bool fP2PBridge)2573 static VBOXSTRICTRC devpciR3UpdateMappings(PPDMPCIDEV pPciDev, bool fP2PBridge) 2601 2574 { 2602 2575 /* safe, only needs to go to the config space array */ … … 2692 2665 /* 2693 2666 * Do real unmapping and/or mapping if the address change. 2694 *2695 * For new style device we'll do the actual mapping, whereas old ones2696 * are expected to do it themselves via the callback.2697 2667 */ 2698 2668 Log4(("devpciR3UpdateMappings: dev %u/%u (%s): iRegion=%u addr=%#RX64 uNew=%#RX64\n", … … 2705 2675 pPciDev->pszNameR3, iRegion, pRegion->addr, uNew, cbRegion, cbRegion)); 2706 2676 2707 int rc = devpciR3UnmapRegion(p DevIns, pPciDev, iRegion);2677 int rc = devpciR3UnmapRegion(pPciDev, iRegion); 2708 2678 AssertLogRelRC(rc); 2709 2679 pRegion->addr = uNew; 2710 2680 if (uNew != INVALID_PCI_ADDRESS) 2711 2681 { 2712 /* The callout is optional with new style devices: */2682 /* The callout is optional (typically not used): */ 2713 2683 if (!pRegion->pfnMap) 2714 2684 rc = VINF_SUCCESS; … … 2720 2690 } 2721 2691 2722 /* We do the mapping for new-styledevices: */2692 /* We do the mapping for most devices: */ 2723 2693 if (pRegion->hHandle != UINT64_MAX && rc != VINF_PCI_MAPPING_DONE) 2724 2694 { … … 3009 2979 */ 3010 2980 if (fUpdateMappings) 3011 rcStrict = devpciR3UpdateMappings(p DevIns, pPciDev, fP2PBridge);2981 rcStrict = devpciR3UpdateMappings(pPciDev, fP2PBridge); 3012 2982 } 3013 2983 } … … 3491 3461 == PCI_ADDRESS_SPACE_BAR64; 3492 3462 3493 devpciR3UnmapRegion(pDev Ins, pDev, iRegion);3463 devpciR3UnmapRegion(pDev, iRegion); 3494 3464 3495 3465 if (f64Bit)
Note:
See TracChangeset
for help on using the changeset viewer.