Changeset 26376 in vbox
- Timestamp:
- Feb 9, 2010 2:25:28 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 57469
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/pdmdev.h
r26172 r26376 1626 1626 1627 1627 /** Current PDMHPETREG version number. */ 1628 #define PDM_HPETREG_VERSION 0x1f01000 01628 #define PDM_HPETREG_VERSION 0x1f010001 1629 1629 1630 1630 /** … … 1636 1636 uint32_t u32Version; 1637 1637 1638 /** 1639 * Acquires the PDM lock. 1640 * 1641 * @returns VINF_SUCCESS on success. 1642 * @returns rc if we failed to acquire the lock. 1643 * @param pDevIns The HPET device instance. 1644 * @param rc What to return if we fail to acquire the lock. 1645 */ 1646 DECLRCCALLBACKMEMBER(int, pfnLock,(PPDMDEVINS pDevIns, int rc)); 1647 1648 /** 1649 * Releases the PDM lock. 1650 * 1651 * @param pDevIns The HPET device instance. 1652 */ 1653 DECLRCCALLBACKMEMBER(void, pfnUnlock,(PPDMDEVINS pDevIns)); 1638 /* just leave in case HPET will need PDM interaction in RC */ 1654 1639 1655 1640 /** Just a safety precaution. */ … … 1663 1648 1664 1649 /** Current PDMHPETHLPRC version number. */ 1665 #define PDM_HPETHLPRC_VERSION PDM_VERSION_MAKE(0xffee, 1, 0)1650 #define PDM_HPETHLPRC_VERSION PDM_VERSION_MAKE(0xffee, 1, 1) 1666 1651 1667 1652 … … 1674 1659 uint32_t u32Version; 1675 1660 1676 /** 1677 * Acquires the PDM lock. 1678 * 1679 * @returns VINF_SUCCESS on success. 1680 * @returns rc if we failed to acquire the lock. 1681 * @param pDevIns The HPET device instance. 1682 * @param rc What to return if we fail to acquire the lock. 1683 */ 1684 DECLR0CALLBACKMEMBER(int, pfnLock,(PPDMDEVINS pDevIns, int rc)); 1685 1686 /** 1687 * Releases the PDM lock. 1688 * 1689 * @param pDevIns The HPET device instance. 1690 */ 1691 DECLR0CALLBACKMEMBER(void, pfnUnlock,(PPDMDEVINS pDevIns)); 1661 1662 /* just leave in case HPET will need PDM interaction in R0 */ 1692 1663 1693 1664 /** Just a safety precaution. */ … … 1701 1672 1702 1673 /** Current PDMHPETHLPR0 version number. */ 1703 #define PDM_HPETHLPR0_VERSION PDM_VERSION_MAKE(0xffed, 1, 0)1674 #define PDM_HPETHLPR0_VERSION PDM_VERSION_MAKE(0xffed, 1, 1) 1704 1675 1705 1676 /** … … 1720 1691 */ 1721 1692 DECLR3CALLBACKMEMBER(int, pfnSetLegacyMode,(PPDMDEVINS pDevIns, bool fActivate)); 1722 1723 /**1724 * Acquires the PDM lock.1725 *1726 * @returns VINF_SUCCESS on success.1727 * @returns rc if we failed to acquire the lock.1728 * @param pDevIns The HPET device instance.1729 * @param rc What to return if we fail to acquire the lock.1730 */1731 DECLR3CALLBACKMEMBER(int, pfnLock,(PPDMDEVINS pDevIns, int rc));1732 1733 /**1734 * Releases the PDM lock.1735 *1736 * @param pDevIns The HPET device instance.1737 */1738 DECLR3CALLBACKMEMBER(void, pfnUnlock,(PPDMDEVINS pDevIns));1739 1693 1740 1694 /** -
trunk/src/VBox/Devices/PC/DevHPET.cpp
r26329 r26376 177 177 /* main counter */ 178 178 uint64_t u64HpetCounter; 179 180 /* Global device lock */ 181 PDMCRITSECT csLock; 179 182 } HpetState; 180 183 … … 199 202 static const bool fHpetLocking = true; 200 203 201 DECLINLINE(int) hpetLock(HpetState* pThis )204 DECLINLINE(int) hpetLock(HpetState* pThis, int rcBusy) 202 205 { 203 206 if (!fHpetLocking) 204 return 0; 205 206 return pThis->CTX_SUFF(pHpetHlp)->pfnLock(pThis->CTX_SUFF(pDevIns), 207 VERR_INTERNAL_ERROR); 207 return VINF_SUCCESS; 208 209 return PDMCritSectEnter(&pThis->csLock, rcBusy); 208 210 } 209 211 … … 213 215 return; 214 216 215 pThis->CTX_SUFF(pHpetHlp)->pfnUnlock(pThis->CTX_SUFF(pDevIns));217 PDMCritSectLeave(&pThis->csLock); 216 218 } 217 219 … … 706 708 LogFlow(("hpetMMIORead: %llx (%x)\n", (uint64_t)GCPhysAddr, iIndex)); 707 709 708 rc = hpetLock(pThis); 709 AssertLogRelRCReturn(rc, rc); 710 rc = hpetLock(pThis, VINF_IOM_HC_MMIO_READ); 711 if (RT_UNLIKELY(rc != VINF_SUCCESS)) 712 return rc; 710 713 711 714 switch (cb) … … 748 751 (uint64_t)GCPhysAddr, iIndex, *(uint32_t*)pv)); 749 752 750 rc = hpetLock(pThis); 751 AssertLogRelRCReturn(rc, rc); 753 rc = hpetLock(pThis, VINF_IOM_HC_MMIO_WRITE); 754 if (RT_UNLIKELY(rc != VINF_SUCCESS)) 755 return rc; 752 756 753 757 switch (cb) … … 921 925 return; 922 926 923 rc = hpetLock(pThis); 927 /* Lock in R3 must either block or succeed */ 928 rc = hpetLock(pThis, VERR_IGNORED); 929 924 930 AssertLogRelRCReturnVoid(rc); 925 931 … … 1122 1128 return rc; 1123 1129 } 1130 1131 /* 1132 * Initialize critical section. 1133 */ 1134 rc = PDMDevHlpCritSectInit(pDevIns, &pThis->csLock, RT_SRC_POS, "HPET"); 1135 if (RT_FAILURE(rc)) 1136 return PDMDEV_SET_ERROR(pDevIns, rc, N_("HPET cannot initialize critical section")); 1137 1124 1138 /* 1125 1139 * Register the MMIO range, PDM API requests page aligned -
trunk/src/VBox/VMM/PDMDevMiscHlp.cpp
r26165 r26376 564 564 } 565 565 566 567 /** @interface_method_impl{PDMHPETHLPR3,pfnLock} */568 static DECLCALLBACK(int) pdmR3HpetHlp_Lock(PPDMDEVINS pDevIns, int rc)569 {570 PDMDEV_ASSERT_DEVINS(pDevIns);571 LogFlow(("pdmR3HpetHlp_Lock: caller='%s'/%d: rc=%Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));572 return pdmLockEx(pDevIns->Internal.s.pVMR3, rc);573 }574 575 576 /** @interface_method_impl{PDMHPETHLPR3,pfnUnlock} */577 static DECLCALLBACK(void) pdmR3HpetHlp_Unlock(PPDMDEVINS pDevIns)578 {579 PDMDEV_ASSERT_DEVINS(pDevIns);580 LogFlow(("pdmR3HpetHlp_Unlock: caller='%s'/%d:\n", pDevIns->pReg->szName, pDevIns->iInstance));581 pdmUnlock(pDevIns->Internal.s.pVMR3);582 }583 584 585 566 /** @interface_method_impl{PDMHPETHLPR3,pfnGetRCHelpers} */ 586 567 static DECLCALLBACK(PCPDMHPETHLPRC) pdmR3HpetHlp_GetRCHelpers(PPDMDEVINS pDevIns) … … 620 601 PDM_HPETHLPR3_VERSION, 621 602 pdmR3HpetHlp_SetLegacyMode, 622 pdmR3HpetHlp_Lock,623 pdmR3HpetHlp_Unlock,624 603 pdmR3HpetHlp_GetRCHelpers, 625 604 pdmR3HpetHlp_GetR0Helpers, -
trunk/src/VBox/VMM/VMMGC/PDMGCDevice.cpp
r26271 r26376 587 587 */ 588 588 589 /** @interface_method_impl{PDMHPETHLPRC,pfnLock} */590 static DECLCALLBACK(int) pdmRCHpetHlp_Lock(PPDMDEVINS pDevIns, int rc)591 {592 PDMDEV_ASSERT_DEVINS(pDevIns);593 return pdmLockEx(pDevIns->Internal.s.pVMRC, rc);594 }595 596 597 /** @interface_method_impl{PDMHPETHLPRC,pfnUnlock} */598 static DECLCALLBACK(void) pdmRCHpetHlp_Unlock(PPDMDEVINS pDevIns)599 {600 PDMDEV_ASSERT_DEVINS(pDevIns);601 pdmUnlock(pDevIns->Internal.s.pVMRC);602 }603 604 589 605 590 /** … … 609 594 { 610 595 PDM_HPETHLPRC_VERSION, 611 pdmRCHpetHlp_Lock,612 pdmRCHpetHlp_Unlock,613 596 PDM_HPETHLPRC_VERSION, /* the end */ 614 597 }; … … 785 768 } 786 769 } 787 -
trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp
r26175 r26376 622 622 */ 623 623 624 /** @interface_method_impl{PDMHPETHLPR0,pfnLock} */625 static DECLCALLBACK(int) pdmR0HpetHlp_Lock(PPDMDEVINS pDevIns, int rc)626 {627 PDMDEV_ASSERT_DEVINS(pDevIns);628 return pdmLockEx(pDevIns->Internal.s.pVMR0, rc);629 }630 631 632 /** @interface_method_impl{PDMHPETHLPR0,pfnUnlock} */633 static DECLCALLBACK(void) pdmR0HpetHlp_Unlock(PPDMDEVINS pDevIns)634 {635 PDMDEV_ASSERT_DEVINS(pDevIns);636 pdmUnlock(pDevIns->Internal.s.pVMR0);637 }638 639 640 624 /** 641 625 * The Ring-0 HPET Helper Callbacks. … … 644 628 { 645 629 PDM_HPETHLPR0_VERSION, 646 pdmR0HpetHlp_Lock,647 pdmR0HpetHlp_Unlock,648 630 PDM_HPETHLPR0_VERSION, /* the end */ 649 631 }; … … 818 800 } 819 801 } 820
Note:
See TracChangeset
for help on using the changeset viewer.