- Timestamp:
- Jan 15, 2017 5:50:11 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
include/VBox/err.h (modified) (1 diff)
-
include/VBox/vmm/pdmdev.h (modified) (3 diffs)
-
include/VBox/vmm/pgm.h (modified) (1 diff)
-
src/VBox/VMM/VMMR3/PDMDevHlp.cpp (modified) (3 diffs)
-
src/VBox/VMM/VMMR3/PGMPhys.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/err.h
r64327 r65299 1720 1720 /** The display connector is resizing. */ 1721 1721 #define VINF_VGA_RESIZE_IN_PROGRESS (3501) 1722 /** Unexpected PCI region change during VGA saved state loading. */ 1723 #define VERR_VGA_UNEXPECTED_PCI_REGION_LOAD_CHANGE (-3502) 1722 1724 /** @} */ 1723 1725 -
trunk/include/VBox/vmm/pdmdev.h
r65101 r65299 1876 1876 1877 1877 /** Current PDMDEVHLPR3 version number. 1878 * @todo Next major revision should add piBus to pfnPCIBusRegister. */ 1879 #define PDM_DEVHLPR3_VERSION PDM_VERSION_MAKE_PP(0xffe7, 19, 1) 1878 * @todo Next major revision should add piBus to pfnPCIBusRegister, and move 1879 * pfnMMIOExReduce up to after pfnMMIOExUnmap. */ 1880 #define PDM_DEVHLPR3_VERSION PDM_VERSION_MAKE_PP(0xffe7, 19, 2) 1880 1881 //#define PDM_DEVHLPR3_VERSION PDM_VERSION_MAKE_PP(0xffe7, 20, 0) 1881 1882 … … 3265 3266 DECLR3CALLBACKMEMBER(VMRESUMEREASON, pfnVMGetResumeReason,(PPDMDEVINS pDevIns)); 3266 3267 3268 /** 3269 * Reduces the length of a MMIO2 or pre-registered MMIO range. 3270 * 3271 * This is for implementations of PDMPCIDEV::pfnRegionLoadChangeHookR3 and will 3272 * only work during saved state restore. It will not call the PCI bus code, as 3273 * that is expected to restore the saved resource configuration. 3274 * 3275 * It just adjusts the mapping length of the region so that when pfnMMIOExMap is 3276 * called it will only map @a cbRegion bytes and not the value set during 3277 * registration. 3278 * 3279 * @return VBox status code. 3280 * @param pDevIns The device owning the range. 3281 * @param pPciDev The PCI device the region is associated with, or 3282 * NULL if not associated with any. 3283 * @param iRegion The region. 3284 * @param cbRegion The new size, must be smaller. 3285 */ 3286 DECLR3CALLBACKMEMBER(int, pfnMMIOExReduce,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS cbRegion)); 3287 3267 3288 /** Space reserved for future members. 3268 3289 * @{ */ 3269 DECLR3CALLBACKMEMBER(void, pfnReserved1,(void));3270 3290 DECLR3CALLBACKMEMBER(void, pfnReserved2,(void)); 3271 3291 DECLR3CALLBACKMEMBER(void, pfnReserved3,(void)); … … 4384 4404 { 4385 4405 return pDevIns->pHlpR3->pfnMMIOExUnmap(pDevIns, pPciDev, iRegion, GCPhys); 4406 } 4407 4408 /** 4409 * @copydoc PDMDEVHLPR3::pfnMMIOExReduce 4410 */ 4411 DECLINLINE(int) PDMDevHlpMMIOExReduce(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS cbRegion) 4412 { 4413 return pDevIns->pHlpR3->pfnMMIOExReduce(pDevIns, pPciDev, iRegion, cbRegion); 4386 4414 } 4387 4415 -
trunk/include/VBox/vmm/pgm.h
r64373 r65299 747 747 VMMR3DECL(int) PGMR3PhysMMIOExMap(PVM pVM, PPDMDEVINS pDevIns, uint32_t iSubDev, uint32_t iRegion, RTGCPHYS GCPhys); 748 748 VMMR3DECL(int) PGMR3PhysMMIOExUnmap(PVM pVM, PPDMDEVINS pDevIns, uint32_t iSubDev, uint32_t iRegion, RTGCPHYS GCPhys); 749 VMMR3_INT_DECL(int) PGMR3PhysMMIOExReduce(PVM pVM, PPDMDEVINS pDevIns, uint32_t iSubDev, uint32_t iRegion, RTGCPHYS cbRegion); 749 750 VMMR3DECL(bool) PGMR3PhysMMIOExIsBase(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhys); 750 751 VMMR3_INT_DECL(int) PGMR3PhysMMIO2GetHCPhys(PVM pVM, PPDMDEVINS pDevIns, uint32_t iSubDev, uint32_t iRegion, RTGCPHYS off, PRTHCPHYS pHCPhys); -
trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp
r64844 r65299 591 591 592 592 LogFlow(("pdmR3DevHlp_MMIOExUnmap: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); 593 return rc; 594 } 595 596 597 /** 598 * @copydoc PDMDEVHLPR3::pfnMMIOExReduce 599 */ 600 static DECLCALLBACK(int) pdmR3DevHlp_MMIOExReduce(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS cbRegion) 601 { 602 PDMDEV_ASSERT_DEVINS(pDevIns); 603 VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3); 604 LogFlow(("pdmR3DevHlp_MMIOExReduce: caller='%s'/%d: pPciDev=%p:{%#x} iRegion=%#x cbRegion=%RGp\n", 605 pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pPciDev ? pPciDev->uDevFn : UINT32_MAX, iRegion, cbRegion)); 606 AssertReturn(!pPciDev || pPciDev->Int.s.pDevInsR3 != NULL, VERR_INVALID_PARAMETER); 607 608 int rc = PGMR3PhysMMIOExReduce(pDevIns->Internal.s.pVMR3, pDevIns, pPciDev ? pPciDev->Int.s.idxDevCfg : 254, iRegion, cbRegion); 609 610 LogFlow(("pdmR3DevHlp_MMIOExReduce: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); 593 611 return rc; 594 612 } … … 3678 3696 pdmR3DevHlp_VMGetSuspendReason, 3679 3697 pdmR3DevHlp_VMGetResumeReason, 3680 0,3698 pdmR3DevHlp_MMIOExReduce, 3681 3699 0, 3682 3700 0, … … 3935 3953 pdmR3DevHlp_VMGetSuspendReason, 3936 3954 pdmR3DevHlp_VMGetResumeReason, 3937 0,3955 pdmR3DevHlp_MMIOExReduce, 3938 3956 0, 3939 3957 0, -
trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp
r64911 r65299 2698 2698 pNew->RamRange.GCPhysLast = NIL_RTGCPHYS; 2699 2699 pNew->RamRange.pszDesc = pszDesc; 2700 pNew->RamRange.cb = (RTGCPHYS)cPagesTrackedByChunk << X86_PAGE_SHIFT;2700 pNew->RamRange.cb = pNew->cbReal = (RTGCPHYS)cPagesTrackedByChunk << X86_PAGE_SHIFT; 2701 2701 pNew->RamRange.fFlags |= PGM_RAM_RANGE_FLAGS_AD_HOC_MMIO_EX; 2702 2702 //pNew->RamRange.pvR3 = NULL; … … 3163 3163 * Free the memory. 3164 3164 */ 3165 uint32_t const cPages = pCur-> RamRange.cb>> PAGE_SHIFT;3165 uint32_t const cPages = pCur->cbReal >> PAGE_SHIFT; 3166 3166 if (pCur->fFlags & PGMREGMMIORANGE_F_MMIO2) 3167 3167 { … … 3674 3674 3675 3675 return VINF_SUCCESS; 3676 } 3677 3678 3679 /** 3680 * Reduces the mapping size of a MMIO2 or pre-registered MMIO region. 3681 * 3682 * This is mainly for dealing with old saved states after changing the default 3683 * size of a mapping region. See PGMDevHlpMMIOExReduce and 3684 * PDMPCIDEV::pfnRegionLoadChangeHookR3. 3685 * 3686 * The region must not currently be mapped when making this call. The VM state 3687 * must be state restore or VM construction. 3688 * 3689 * @returns VBox status code. 3690 * @param pVM The cross context VM structure. 3691 * @param pDevIns The device instance owning the region. 3692 * @param iSubDev The sub-device number of the registered region. 3693 * @param iRegion The index of the registered region. 3694 * @param cbRegion The new mapping size. 3695 */ 3696 VMMR3_INT_DECL(int) PGMR3PhysMMIOExReduce(PVM pVM, PPDMDEVINS pDevIns, uint32_t iSubDev, uint32_t iRegion, RTGCPHYS cbRegion) 3697 { 3698 /* 3699 * Validate input 3700 */ 3701 VM_ASSERT_EMT_RETURN(pVM, VERR_VM_THREAD_NOT_EMT); 3702 AssertPtrReturn(pDevIns, VERR_INVALID_PARAMETER); 3703 AssertReturn(iSubDev <= UINT8_MAX, VERR_INVALID_PARAMETER); 3704 AssertReturn(iRegion <= UINT8_MAX, VERR_INVALID_PARAMETER); 3705 AssertReturn(cbRegion >= X86_PAGE_SIZE, VERR_INVALID_PARAMETER); 3706 AssertReturn(!(cbRegion & X86_PAGE_OFFSET_MASK), VERR_UNSUPPORTED_ALIGNMENT); 3707 VMSTATE enmVmState = VMR3GetState(pVM); 3708 AssertLogRelMsgReturn( enmVmState == VMSTATE_CREATING 3709 || enmVmState == VMSTATE_LOADING, 3710 ("enmVmState=%d (%s)\n", enmVmState, VMR3GetStateName(enmVmState)), 3711 VERR_VM_INVALID_VM_STATE); 3712 3713 int rc = pgmLock(pVM); 3714 AssertRCReturn(rc, rc); 3715 3716 PPGMREGMMIORANGE pFirstMmio = pgmR3PhysMMIOExFind(pVM, pDevIns, iSubDev, iRegion); 3717 if (pFirstMmio) 3718 { 3719 Assert(pFirstMmio->fFlags & PGMREGMMIORANGE_F_FIRST_CHUNK); 3720 if (!(pFirstMmio->fFlags & PGMREGMMIORANGE_F_MAPPED)) 3721 { 3722 /* 3723 * NOTE! Current implementation does not support multiple ranges. 3724 * Implement when there is a real world need and thus a testcase. 3725 */ 3726 AssertLogRelMsgStmt(pFirstMmio->fFlags & PGMREGMMIORANGE_F_LAST_CHUNK, 3727 ("%s: %#x\n", pFirstMmio->RamRange.pszDesc, pFirstMmio->fFlags), 3728 rc = VERR_NOT_SUPPORTED); 3729 if (RT_SUCCESS(rc)) 3730 { 3731 /* 3732 * Make the change. 3733 */ 3734 Log(("PGMR3PhysMMIOExReduce: %s changes from %RGp bytes (%RGp) to %RGp bytes.\n", 3735 pFirstMmio->RamRange.pszDesc, pFirstMmio->RamRange.cb, pFirstMmio->cbReal, cbRegion)); 3736 3737 AssertLogRelMsgStmt(cbRegion <= pFirstMmio->cbReal, 3738 ("%s: cbRegion=%#RGp cbReal=%#RGp\n", pFirstMmio->RamRange.pszDesc, cbRegion, pFirstMmio->cbReal), 3739 rc = VERR_OUT_OF_RANGE); 3740 if (RT_SUCCESS(rc)) 3741 { 3742 pFirstMmio->RamRange.cb = cbRegion; 3743 } 3744 } 3745 } 3746 else 3747 rc = VERR_WRONG_ORDER; 3748 } 3749 else 3750 rc = VERR_NOT_FOUND; 3751 3752 pgmUnlock(pVM); 3753 return rc; 3676 3754 } 3677 3755
Note:
See TracChangeset
for help on using the changeset viewer.

