VirtualBox

Changeset 41847 in vbox


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.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/err.h

    r41825 r41847  
    569569/** PCI passthru is not supported by this build. */
    570570#define VERR_PGM_PCI_PASSTHRU_MISCONFIG         (-1682)
    571 /** PCI physical read with bus mastering disabled. */
    572 #define VINF_PGM_PCI_PHYS_READ_BM_DISABLED      (1683)
    573 /** PCI physical write with bus mastering disabled. */
    574 #define VINF_PGM_PCI_PHYS_WRITE_BM_DISABLED     (1684)
    575571/** @} */
    576572
     
    12151211 * misconfiguration or in rare cases a buggy pci device. */
    12161212#define VERR_PDM_NO_PCI_BUS                         (-2833)
     1213/** PCI physical read with bus mastering disabled. */
     1214#define VINF_PDM_PCI_PHYS_READ_BM_DISABLED          (2833)
    12171215/** The device is not a registered PCI device and thus cannot
    12181216 * perform any PCI operations. The device forgot to register it self. */
    12191217#define VERR_PDM_NOT_PCI_DEVICE                     (-2834)
     1218/** PCI physical write with bus mastering disabled. */
     1219#define VINF_PDM_PCI_PHYS_WRITE_BM_DISABLED         (2834)
    12201220
    12211221/** The version of the device registration structure is unknown
  • trunk/include/VBox/vmm/pdmdev.h

    r41826 r41847  
    21892189typedef struct PDMDEVHLPR3
    21902190{
    2191     /** Structure version. PDM_DEVHLP_VERSION defines the current version. */
     2191    /** Structure version. PDM_DEVHLPR3_VERSION defines the current version. */
    21922192    uint32_t                        u32Version;
    21932193
     
    28572857    DECLR3CALLBACKMEMBER(void, pfnSTAMRegisterV,(PPDMDEVINS pDevIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
    28582858                                                 STAMUNIT enmUnit, const char *pszDesc, const char *pszName, va_list args));
     2859
     2860    /**
     2861     * Reads data via bus mastering, if enabled. If no bus mastering is available,
     2862     * this function does nothing and returns VINF_PGM_PCI_PHYS_READ_BM_DISABLED.
     2863     *
     2864     * @return  IPRT status code.
     2865     */
     2866    DECLR3CALLBACKMEMBER(int, pfnPCIPhysRead,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead));
     2867
     2868    /**
     2869     * Writes data via bus mastering, if enabled. If no bus mastering is available,
     2870     * this function does nothing and returns VINF_PGM_PCI_PHYS_WRITE_BM_DISABLED.
     2871     *
     2872     * @return  IPRT status code.
     2873     */
     2874    DECLR3CALLBACKMEMBER(int, pfnPCIPhysWrite,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite));
    28592875
    28602876    /**
     
    35113527    /** @} */
    35123528
    3513     /** Just a safety precaution. (PDM_DEVHLP_VERSION) */
     3529    /** Just a safety precaution. (PDM_DEVHLPR3_VERSION) */
    35143530    uint32_t                        u32TheEnd;
    35153531} PDMDEVHLPR3;
     
    35213537
    35223538/** Current PDMDEVHLPR3 version number. */
    3523 #define PDM_DEVHLPR3_VERSION                    PDM_VERSION_MAKE(0xffe7, 8, 0)
     3539#define PDM_DEVHLPR3_VERSION                    PDM_VERSION_MAKE(0xffe7, 9, 0)
    35243540
    35253541
     
    35313547    /** Structure version. PDM_DEVHLPRC_VERSION defines the current version. */
    35323548    uint32_t                    u32Version;
     3549
     3550    /**
     3551     * Reads data via bus mastering, if enabled. If no bus mastering is available,
     3552     * this function does nothing and returns VINF_PGM_PCI_PHYS_READ_BM_DISABLED.
     3553     *
     3554     * @return  IPRT status code.
     3555     */
     3556    DECLRCCALLBACKMEMBER(int, pfnPCIDevPhysRead,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead));
     3557
     3558    /**
     3559     * Writes data via bus mastering, if enabled. If no bus mastering is available,
     3560     * this function does nothing and returns VINF_PGM_PCI_PHYS_WRITE_BM_DISABLED.
     3561     *
     3562     * @return  IPRT status code.
     3563     */
     3564    DECLRCCALLBACKMEMBER(int, pfnPCIDevPhysWrite,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite));
    35333565
    35343566    /**
     
    37123744
    37133745/** Current PDMDEVHLP version number. */
    3714 #define PDM_DEVHLPRC_VERSION                    PDM_VERSION_MAKE(0xffe6, 2, 0)
     3746#define PDM_DEVHLPRC_VERSION                    PDM_VERSION_MAKE(0xffe6, 3, 0)
    37153747
    37163748
     
    37223754    /** Structure version. PDM_DEVHLPR0_VERSION defines the current version. */
    37233755    uint32_t                    u32Version;
     3756
     3757    /**
     3758     * Reads data via bus mastering, if enabled. If no bus mastering is available,
     3759     * this function does nothing and returns VINF_PGM_PCI_PHYS_READ_BM_DISABLED.
     3760     *
     3761     * @return  IPRT status code.
     3762     */
     3763    DECLR0CALLBACKMEMBER(int, pfnPCIPhysRead,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead));
     3764
     3765    /**
     3766     * Writes data via bus mastering, if enabled. If no bus mastering is available,
     3767     * this function does nothing and returns VINF_PGM_PCI_PHYS_WRITE_BM_DISABLED.
     3768     *
     3769     * @return  IPRT status code.
     3770     */
     3771    DECLR0CALLBACKMEMBER(int, pfnPCIPhysWrite,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite));
    37243772
    37253773    /**
     
    39113959
    39123960/** Current PDMDEVHLP version number. */
    3913 #define PDM_DEVHLPR0_VERSION                    PDM_VERSION_MAKE(0xffe5, 2, 0)
     3961#define PDM_DEVHLPR0_VERSION                    PDM_VERSION_MAKE(0xffe5, 3, 0)
    39143962
    39153963
     
    46414689              PCIDevGetVendorId(pPciDev), PCIDevGetDeviceId(pPciDev), pvBuf, cbRead));
    46424690#endif
    4643         return VINF_PGM_PCI_PHYS_READ_BM_DISABLED;
     4691        return VINF_PDM_PCI_PHYS_READ_BM_DISABLED;
    46444692    }
    46454693
     
    46654713              PCIDevGetVendorId(pPciDev), PCIDevGetDeviceId(pPciDev), pvBuf, cbWrite));
    46664714#endif
    4667         return VINF_PGM_PCI_PHYS_WRITE_BM_DISABLED;
     4715        return VINF_PDM_PCI_PHYS_WRITE_BM_DISABLED;
    46684716    }
    46694717
  • 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,
  • trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp

    r41783 r41847  
    10631063
    10641064    NOREF(pVM);
     1065}
     1066
     1067
     1068/** @interface_method_impl{PDMDEVHLPR3,pfnPCIDevPhysRead} */
     1069static DECLCALLBACK(int) pdmR3DevHlp_PCIPhysRead(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead)
     1070{
     1071    PDMDEV_ASSERT_DEVINS(pDevIns);
     1072    return PDMDevHlpPCIDevPhysRead(pDevIns->Internal.s.pPciDeviceR3, GCPhys, pvBuf, cbRead);
     1073}
     1074
     1075
     1076/** @interface_method_impl{PDMDEVHLPR3,pfnPCIDevPhysWrite} */
     1077static DECLCALLBACK(int) pdmR3DevHlp_PCIPhysWrite(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite)
     1078{
     1079    PDMDEV_ASSERT_DEVINS(pDevIns);
     1080    return PDMDevHlpPCIDevPhysWrite(pDevIns->Internal.s.pPciDeviceR3, GCPhys, pvBuf, cbWrite);
    10651081}
    10661082
     
    33443360    pdmR3DevHlp_STAMRegisterF,
    33453361    pdmR3DevHlp_STAMRegisterV,
     3362    pdmR3DevHlp_PCIPhysRead,
     3363    pdmR3DevHlp_PCIPhysWrite,
    33463364    pdmR3DevHlp_PCIRegister,
    33473365    pdmR3DevHlp_PCIRegisterMsi,
     
    35633581    pdmR3DevHlp_STAMRegisterF,
    35643582    pdmR3DevHlp_STAMRegisterV,
     3583    pdmR3DevHlp_PCIPhysRead,
     3584    pdmR3DevHlp_PCIPhysWrite,
    35653585    pdmR3DevHlp_PCIRegister,
    35663586    pdmR3DevHlp_PCIRegisterMsi,
  • trunk/src/VBox/VMM/VMMRC/PDMRCDevice.cpp

    r41783 r41847  
    5555
    5656/*******************************************************************************
     57*   Prototypes                                                                 *
     58*******************************************************************************/
     59static int pdmRCDevHlp_PhysRead(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead);
     60static int pdmRCDevHlp_PhysWrite(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite);
     61
     62
     63/*******************************************************************************
    5764*   Internal Functions                                                         *
    5865*******************************************************************************/
     
    6370 * @{
    6471 */
     72
     73/** @interface_method_impl{PDMDEVHLPRC,pfnPCIPhysRead} */
     74static DECLCALLBACK(int) pdmRCDevHlp_PCIPhysRead(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead)
     75{
     76    PDMDEV_ASSERT_DEVINS(pDevIns);
     77    LogFlow(("pdmRCDevHlp_PCIPhysRead: caller=%p/%d: GCPhys=%RGp pvBuf=%p cbRead=%#x\n",
     78             pDevIns, pDevIns->iInstance, GCPhys, pvBuf, cbRead));
     79
     80    PCIDevice *pPciDev = pDevIns->Internal.s.pPciDeviceRC;
     81    AssertPtrReturn(pPciDev, VERR_INVALID_POINTER);
     82
     83    if (!PCIDevIsBusmaster(pPciDev))
     84    {
     85#ifdef DEBUG
     86        LogFlow(("%s: %RU16:%RU16: No bus master (anymore), skipping read %p (%z)\n", __FUNCTION__,
     87                 PCIDevGetVendorId(pPciDev), PCIDevGetDeviceId(pPciDev), pvBuf, cbRead));
     88#endif
     89        return VINF_PDM_PCI_PHYS_READ_BM_DISABLED;
     90    }
     91
     92    return pdmRCDevHlp_PhysRead(pDevIns, GCPhys, pvBuf, cbRead);
     93}
     94
     95
     96/** @interface_method_impl{PDMDEVHLPRC,pfnPCIPhysRead} */
     97static DECLCALLBACK(int) pdmRCDevHlp_PCIPhysWrite(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite)
     98{
     99    PDMDEV_ASSERT_DEVINS(pDevIns);
     100    LogFlow(("pdmRCDevHlp_PCIPhysWrite: caller=%p/%d: GCPhys=%RGp pvBuf=%p cbWrite=%#x\n",
     101             pDevIns, pDevIns->iInstance, GCPhys, pvBuf, cbWrite));
     102
     103    PCIDevice *pPciDev = pDevIns->Internal.s.pPciDeviceRC;
     104    AssertPtrReturn(pPciDev, VERR_INVALID_POINTER);
     105
     106    if (!PCIDevIsBusmaster(pPciDev))
     107    {
     108#ifdef DEBUG
     109        LogFlow(("%s: %RU16:%RU16: No bus master (anymore), skipping write %p (%z)\n", __FUNCTION__,
     110                 PCIDevGetVendorId(pPciDev), PCIDevGetDeviceId(pPciDev), pvBuf, cbWrite));
     111#endif
     112        return VINF_PDM_PCI_PHYS_WRITE_BM_DISABLED;
     113    }
     114
     115    return pdmRCDevHlp_PhysWrite(pDevIns, GCPhys, pvBuf, cbWrite);
     116}
     117
    65118
    66119/** @interface_method_impl{PDMDEVHLPRC,pfnPCISetIrq} */
     
    316369{
    317370    PDM_DEVHLPRC_VERSION,
     371    pdmRCDevHlp_PCIPhysRead,
     372    pdmRCDevHlp_PCIPhysWrite,
    318373    pdmRCDevHlp_PCISetIrq,
    319374    pdmRCDevHlp_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