Changeset 2597 in vbox
- Timestamp:
- May 11, 2007 6:19:23 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/pdm.h
r2576 r2597 3280 3280 3281 3281 /** 3282 * Register PCI configuration space read/write callbacks. 3283 * 3284 * @param pDevIns Device instance of the PCI Bus. 3285 * @param pPciDev The PCI device structure. 3286 * @param pfnRead Pointer to the user defined PCI config read function. 3287 * @param ppfnReadOld Pointer to function pointer which will receive the old (default) 3288 * PCI config read function. This way, user can decide when (and if) 3289 * to call default PCI config read function. Can be NULL. 3290 * @param pfnWrite Pointer to the user defined PCI config write function. 3291 * @param pfnWriteOld Pointer to function pointer which will receive the old (default) 3292 * PCI config write function. This way, user can decide when (and if) 3293 * to call default PCI config write function. Can be NULL. 3294 * @thread EMT 3295 */ 3296 DECLR3CALLBACKMEMBER(void, pfnSetConfigCallbacksHC,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PFNPCICONFIGREAD pfnRead, PPFNPCICONFIGREAD ppfnReadOld, 3297 PFNPCICONFIGWRITE pfnWrite, PPFNPCICONFIGWRITE ppfnWriteOld)); 3298 3299 /** 3282 3300 * Set the IRQ for a PCI device. 3283 3301 * … … 3330 3348 3331 3349 /** Current PDMPCIBUSREG version number. */ 3332 #define PDM_PCIBUSREG_VERSION 0xd00 100003350 #define PDM_PCIBUSREG_VERSION 0xd0020000 3333 3351 3334 3352 /** … … 4713 4731 4714 4732 /** 4733 * Register PCI configuration space read/write callbacks. 4734 * 4735 * @param pDevIns Device instance. 4736 * @param pPciDev The PCI device structure. 4737 * If NULL the default PCI device for this device instance is used. 4738 * @param pfnRead Pointer to the user defined PCI config read function. 4739 * @param ppfnReadOld Pointer to function pointer which will receive the old (default) 4740 * PCI config read function. This way, user can decide when (and if) 4741 * to call default PCI config read function. Can be NULL. 4742 * @param pfnWrite Pointer to the user defined PCI config write function. 4743 * @param pfnWriteOld Pointer to function pointer which will receive the old (default) 4744 * PCI config write function. This way, user can decide when (and if) 4745 * to call default PCI config write function. Can be NULL. 4746 * @thread EMT 4747 */ 4748 DECLR3CALLBACKMEMBER(void, pfnPCISetConfigCallbacks,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PFNPCICONFIGREAD pfnRead, PPFNPCICONFIGREAD ppfnReadOld, 4749 PFNPCICONFIGWRITE pfnWrite, PPFNPCICONFIGWRITE ppfnWriteOld)); 4750 4751 /** 4715 4752 * Set the IRQ for a PCI device. 4716 4753 * … … 5310 5347 5311 5348 /** Current PDMDEVHLP version number. */ 5312 #define PDM_DEVHLP_VERSION 0xf20 200005349 #define PDM_DEVHLP_VERSION 0xf2030000 5313 5350 5314 5351 … … 5778 5815 5779 5816 /** 5817 * @copydoc PDMDEVHLP::pfnPCISetConfigCallbacks 5818 */ 5819 DECLINLINE(void) PDMDevHlpPCISetConfigCallbacks(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PFNPCICONFIGREAD pfnRead, PPFNPCICONFIGREAD ppfnReadOld, 5820 PFNPCICONFIGWRITE pfnWrite, PPFNPCICONFIGWRITE ppfnWriteOld) 5821 { 5822 pDevIns->pDevHlp->pfnPCISetConfigCallbacks(pDevIns, pPciDev, pfnRead, ppfnReadOld, pfnWrite, ppfnWriteOld); 5823 } 5824 5825 /** 5780 5826 * @copydoc PDMDEVHLP::pfnDriverAttach 5781 5827 */ -
trunk/src/VBox/Devices/Bus/DevPCI.cpp
r2596 r2597 1321 1321 1322 1322 1323 /** 1324 * @copydoc PDMPCIBUSREG::pfnSetConfigCallbacksHC 1325 */ 1326 static DECLCALLBACK(void) pciSetConfigCallbacks(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PFNPCICONFIGREAD pfnRead, PPFNPCICONFIGREAD ppfnReadOld, 1327 PFNPCICONFIGWRITE pfnWrite, PPFNPCICONFIGWRITE ppfnWriteOld) 1328 { 1329 if (ppfnReadOld) 1330 *ppfnReadOld = pPciDev->Int.s.pfnConfigRead; 1331 pPciDev->Int.s.pfnConfigRead = pfnRead; 1332 1333 if (ppfnWriteOld) 1334 *ppfnWriteOld = pPciDev->Int.s.pfnConfigWrite; 1335 pPciDev->Int.s.pfnConfigWrite = pfnWrite; 1336 } 1337 1338 1323 1339 /** 1324 1340 * Called to perform the job of the bios. … … 1461 1477 pBus->pDevInsGC = PDMDEVINS_2_GCPTR(pDevIns); 1462 1478 1463 PciBusReg.u32Version = PDM_PCIBUSREG_VERSION; 1464 PciBusReg.pfnRegisterHC = pciRegister; 1465 PciBusReg.pfnIORegionRegisterHC = pciIORegionRegister; 1466 PciBusReg.pfnSetIrqHC = pciSetIrq; 1467 PciBusReg.pfnSaveExecHC = pciGenericSaveExec; 1468 PciBusReg.pfnLoadExecHC = pciGenericLoadExec; 1469 PciBusReg.pfnFakePCIBIOSHC = pciFakePCIBIOS; 1470 PciBusReg.pszSetIrqGC = fGCEnabled ? "pciSetIrq" : NULL; 1471 PciBusReg.pszSetIrqR0 = fR0Enabled ? "pciSetIrq" : NULL; 1479 PciBusReg.u32Version = PDM_PCIBUSREG_VERSION; 1480 PciBusReg.pfnRegisterHC = pciRegister; 1481 PciBusReg.pfnIORegionRegisterHC = pciIORegionRegister; 1482 PciBusReg.pfnSetConfigCallbacksHC = pciSetConfigCallbacks; 1483 PciBusReg.pfnSetIrqHC = pciSetIrq; 1484 PciBusReg.pfnSaveExecHC = pciGenericSaveExec; 1485 PciBusReg.pfnLoadExecHC = pciGenericLoadExec; 1486 PciBusReg.pfnFakePCIBIOSHC = pciFakePCIBIOS; 1487 PciBusReg.pszSetIrqGC = fGCEnabled ? "pciSetIrq" : NULL; 1488 PciBusReg.pszSetIrqR0 = fR0Enabled ? "pciSetIrq" : NULL; 1472 1489 rc = pDevIns->pDevHlp->pfnPCIBusRegister(pDevIns, &PciBusReg, &pBus->pPciHlpR3); 1473 1490 if (VBOX_FAILURE(rc)) -
trunk/src/VBox/VMM/PDMDevice.cpp
r2464 r2597 108 108 static DECLCALLBACK(int) pdmR3DevHlp_PCIRegister(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev); 109 109 static DECLCALLBACK(int) pdmR3DevHlp_PCIIORegionRegister(PPDMDEVINS pDevIns, int iRegion, uint32_t cbRegion, PCIADDRESSSPACE enmType, PFNPCIIOREGIONMAP pfnCallback); 110 static DECLCALLBACK(void) pdmR3DevHlp_PCISetConfigCallbacks(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PFNPCICONFIGREAD pfnRead, PPFNPCICONFIGREAD ppfnReadOld, 111 PFNPCICONFIGWRITE pfnWrite, PPFNPCICONFIGWRITE ppfnWriteOld); 110 112 static DECLCALLBACK(void) pdmR3DevHlp_PCISetIrq(PPDMDEVINS pDevIns, int iIrq, int iLevel); 111 113 static DECLCALLBACK(void) pdmR3DevHlp_PCISetIrqNoWait(PPDMDEVINS pDevIns, int iIrq, int iLevel); … … 288 290 pdmR3DevHlp_PCIRegister, 289 291 pdmR3DevHlp_PCIIORegionRegister, 292 pdmR3DevHlp_PCISetConfigCallbacks, 290 293 pdmR3DevHlp_PCISetIrq, 291 294 pdmR3DevHlp_PCISetIrqNoWait, … … 372 375 pdmR3DevHlp_PCIRegister, 373 376 pdmR3DevHlp_PCIIORegionRegister, 377 pdmR3DevHlp_PCISetConfigCallbacks, 374 378 pdmR3DevHlp_PCISetIrq, 375 379 pdmR3DevHlp_PCISetIrqNoWait, … … 1619 1623 { 1620 1624 PDMDEV_ASSERT_DEVINS(pDevIns); 1621 VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC); 1625 PVM pVM = pDevIns->Internal.s.pVMHC; 1626 VM_ASSERT_EMT(pVM); 1622 1627 LogFlow(("pdmR3DevHlp_PCIIORegionRegister: caller='%s'/%d: iRegion=%d cbRegion=%#x enmType=%d pfnCallback=%p\n", 1623 1628 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, iRegion, cbRegion, enmType, pfnCallback)); … … 1649 1654 return VERR_INVALID_PARAMETER; 1650 1655 } 1656 AssertRelease(VMR3GetState(pVM) != VMSTATE_RUNNING); 1651 1657 1652 1658 /* … … 1670 1676 PPDMPCIBUS pBus = pDevIns->Internal.s.pPciBusHC; 1671 1677 Assert(pBus); 1672 pdmLock(p DevIns->Internal.s.pVMHC);1678 pdmLock(pVM); 1673 1679 rc = pBus->pfnIORegionRegisterR3(pBus->pDevInsR3, pPciDev, iRegion, cbRegion, enmType, pfnCallback); 1674 pdmUnlock(p DevIns->Internal.s.pVMHC);1680 pdmUnlock(pVM); 1675 1681 } 1676 1682 else … … 1682 1688 LogFlow(("pdmR3DevHlp_PCIIORegionRegister: caller='%s'/%d: returns %Vrc\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, rc)); 1683 1689 return rc; 1690 } 1691 1692 1693 /** @copydoc PDMDEVHLP::pfnPCISetConfigCallbacks */ 1694 static DECLCALLBACK(void) pdmR3DevHlp_PCISetConfigCallbacks(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PFNPCICONFIGREAD pfnRead, PPFNPCICONFIGREAD ppfnReadOld, 1695 PFNPCICONFIGWRITE pfnWrite, PPFNPCICONFIGWRITE ppfnWriteOld) 1696 { 1697 PDMDEV_ASSERT_DEVINS(pDevIns); 1698 PVM pVM = pDevIns->Internal.s.pVMHC; 1699 VM_ASSERT_EMT(pVM); 1700 LogFlow(("pdmR3DevHlp_PCISetConfigCallbacks: caller='%s'/%d: pPciDev=%p pfnRead=%p ppfnReadOld=%p pfnWrite=%p ppfnWriteOld=%p\n", 1701 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pPciDev, pfnRead, ppfnReadOld, pfnWrite, ppfnWriteOld)); 1702 1703 /* 1704 * Validate input and resolve defaults. 1705 */ 1706 AssertPtr(pfnRead); 1707 AssertPtr(pfnWrite); 1708 AssertPtrNull(ppfnReadOld); 1709 AssertPtrNull(ppfnWriteOld); 1710 AssertPtrNull(pPciDev); 1711 1712 if (!pPciDev) 1713 pPciDev = pDevIns->Internal.s.pPciDeviceHC; 1714 AssertReleaseMsg(pPciDev, ("You must register your device first!\n")); 1715 PPDMPCIBUS pBus = pDevIns->Internal.s.pPciBusHC; 1716 AssertRelease(pBus); 1717 AssertRelease(VMR3GetState(pVM) != VMSTATE_RUNNING); 1718 1719 /* 1720 * Do the job. 1721 */ 1722 pdmLock(pVM); 1723 pBus->pfnSetConfigCallbacksR3(pBus->pDevInsR3, pPciDev, pfnRead, ppfnReadOld, pfnWrite, ppfnWriteOld); 1724 pdmUnlock(pVM); 1725 1726 LogFlow(("pdmR3DevHlp_PCISetConfigCallbacks: caller='%s'/%d: returns void\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance)); 1684 1727 } 1685 1728 … … 2434 2477 * Init the HC bits. 2435 2478 */ 2436 pPciBus->iBus = iBus; 2437 pPciBus->pDevInsR3 = pDevIns; 2438 pPciBus->pfnRegisterR3 = pPciBusReg->pfnRegisterHC; 2439 pPciBus->pfnIORegionRegisterR3 = pPciBusReg->pfnIORegionRegisterHC; 2440 pPciBus->pfnSetIrqR3 = pPciBusReg->pfnSetIrqHC; 2441 pPciBus->pfnSaveExecR3 = pPciBusReg->pfnSaveExecHC; 2442 pPciBus->pfnLoadExecR3 = pPciBusReg->pfnLoadExecHC; 2443 pPciBus->pfnFakePCIBIOSR3 = pPciBusReg->pfnFakePCIBIOSHC; 2479 pPciBus->iBus = iBus; 2480 pPciBus->pDevInsR3 = pDevIns; 2481 pPciBus->pfnRegisterR3 = pPciBusReg->pfnRegisterHC; 2482 pPciBus->pfnIORegionRegisterR3 = pPciBusReg->pfnIORegionRegisterHC; 2483 pPciBus->pfnSetConfigCallbacksR3 = pPciBusReg->pfnSetConfigCallbacksHC; 2484 pPciBus->pfnSetIrqR3 = pPciBusReg->pfnSetIrqHC; 2485 pPciBus->pfnSaveExecR3 = pPciBusReg->pfnSaveExecHC; 2486 pPciBus->pfnLoadExecR3 = pPciBusReg->pfnLoadExecHC; 2487 pPciBus->pfnFakePCIBIOSR3 = pPciBusReg->pfnFakePCIBIOSHC; 2444 2488 2445 2489 Log(("PDM: Registered PCI bus device '%s'/%d pDevIns=%p\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pDevIns)); -
trunk/src/VBox/VMM/PDMInternal.h
r2565 r2597 362 362 DECLR3CALLBACKMEMBER(int, pfnIORegionRegisterR3,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, int iRegion, uint32_t cbRegion, 363 363 PCIADDRESSSPACE enmType, PFNPCIIOREGIONMAP pfnCallback)); 364 /** @copydoc PDMPCIBUSREG::pfnSetConfigCallbacksHC */ 365 DECLR3CALLBACKMEMBER(void, pfnSetConfigCallbacksR3,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PFNPCICONFIGREAD pfnRead, 366 PPFNPCICONFIGREAD ppfnReadOld, PFNPCICONFIGWRITE pfnWrite, PPFNPCICONFIGWRITE ppfnWriteOld)); 364 367 /** @copydoc PDMPCIBUSREG::pfnSaveExecHC */ 365 368 DECLR3CALLBACKMEMBER(int, pfnSaveExecR3,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PSSMHANDLE pSSMHandle));
Note:
See TracChangeset
for help on using the changeset viewer.