VirtualBox

Changeset 41847 in vbox for trunk/src/VBox/VMM/VMMR0


Ignore:
Timestamp:
Jun 20, 2012 1:43:46 PM (12 years ago)
Author:
vboxsync
Message:

PDM/PCI: Added pdm*DevHlp_PCIPhysRead/Write callbacks, renamed VINF_PGM_PCI_PHYS_*_BM_DISABLED to VINF_PDM_PCI_PHYS_*_BM_DISABLED.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp

    r41800 r41847  
    5757
    5858/*******************************************************************************
     59*   Prototypes                                                                 *
     60*******************************************************************************/
     61static int pdmR0DevHlp_PhysRead(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead);
     62static int pdmR0DevHlp_PhysWrite(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite);
     63
     64
     65/*******************************************************************************
    5966*   Internal Functions                                                         *
    6067*******************************************************************************/
     
    6673 * @{
    6774 */
     75
     76/** @interface_method_impl{PDMDEVHLPR0,pfnPCIPhysRead} */
     77static DECLCALLBACK(int) pdmR0DevHlp_PCIPhysRead(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead)
     78{
     79    PDMDEV_ASSERT_DEVINS(pDevIns);
     80    LogFlow(("pdmR0DevHlp_PCIPhysRead: caller=%p/%d: GCPhys=%RGp pvBuf=%p cbRead=%#x\n",
     81             pDevIns, pDevIns->iInstance, GCPhys, pvBuf, cbRead));
     82
     83    PCIDevice *pPciDev = pDevIns->Internal.s.pPciDeviceR0;
     84    AssertPtrReturn(pPciDev, VERR_INVALID_POINTER);
     85
     86    if (!PCIDevIsBusmaster(pPciDev))
     87    {
     88#ifdef DEBUG
     89        LogFlow(("%s: %RU16:%RU16: No bus master (anymore), skipping read %p (%z)\n", __FUNCTION__,
     90                 PCIDevGetVendorId(pPciDev), PCIDevGetDeviceId(pPciDev), pvBuf, cbRead));
     91#endif
     92        return VINF_PDM_PCI_PHYS_READ_BM_DISABLED;
     93    }
     94
     95    return pdmR0DevHlp_PhysRead(pDevIns, GCPhys, pvBuf, cbRead);
     96}
     97
     98
     99/** @interface_method_impl{PDMDEVHLPR0,pfnPCIPhysRead} */
     100static DECLCALLBACK(int) pdmR0DevHlp_PCIPhysWrite(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite)
     101{
     102    PDMDEV_ASSERT_DEVINS(pDevIns);
     103    LogFlow(("pdmR0DevHlp_PCIPhysWrite: caller=%p/%d: GCPhys=%RGp pvBuf=%p cbWrite=%#x\n",
     104             pDevIns, pDevIns->iInstance, GCPhys, pvBuf, cbWrite));
     105
     106    PCIDevice *pPciDev = pDevIns->Internal.s.pPciDeviceR0;
     107    AssertPtrReturn(pPciDev, VERR_INVALID_POINTER);
     108
     109    if (!PCIDevIsBusmaster(pPciDev))
     110    {
     111#ifdef DEBUG
     112        LogFlow(("%s: %RU16:%RU16: No bus master (anymore), skipping write %p (%z)\n", __FUNCTION__,
     113                 PCIDevGetVendorId(pPciDev), PCIDevGetDeviceId(pPciDev), pvBuf, cbWrite));
     114#endif
     115        return VINF_PDM_PCI_PHYS_WRITE_BM_DISABLED;
     116    }
     117
     118    return pdmR0DevHlp_PhysWrite(pDevIns, GCPhys, pvBuf, cbWrite);
     119}
     120
    68121
    69122/** @interface_method_impl{PDMDEVHLPR0,pfnPCISetIrq} */
     
    331384{
    332385    PDM_DEVHLPR0_VERSION,
     386    pdmR0DevHlp_PCIPhysRead,
     387    pdmR0DevHlp_PCIPhysWrite,
    333388    pdmR0DevHlp_PCISetIrq,
    334389    pdmR0DevHlp_ISASetIrq,
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette