VirtualBox

Changeset 7635 in vbox for trunk/include/VBox/pdmdev.h


Ignore:
Timestamp:
Mar 28, 2008 5:15:38 PM (17 years ago)
Author:
vboxsync
Message:

The new MMIO2 code.
WARNING! This changes the pci mapping protocol for MMIO2 so it's working the same way as I/O ports and normal MMIO memory. External users of the interface will have to update their mapping routines.

File:
1 edited

Legend:

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

    r5999 r7635  
    644644    DECLR3CALLBACKMEMBER(void,  pfnIoApicSetIrq,(PPDMDEVINS pDevIns, int iIrq, int iLevel));
    645645
     646    /**
     647     * Checks if the given address is an MMIO2 base address or not.
     648     *
     649     * @returns true/false accordingly.
     650     * @param   pDevIns         The PCI device instance.
     651     * @param   pOwner          The owner of the memory, optional.
     652     * @param   GCPhys          The address to check.
     653     */
     654    DECLR3CALLBACKMEMBER(bool,  pfnIsMMIO2Base,(PPDMDEVINS pDevIns, PPDMDEVINS pOwner, RTGCPHYS GCPhys));
     655
     656    /**
     657     * Gets the address of the GC PCI Bus helpers.
     658     *
     659     * This should be called at both construction and relocation time
     660     * to obtain the correct address of the GC helpers.
     661     *
     662     * @returns GC pointer to the PCI Bus helpers.
     663     * @param   pDevIns         Device instance of the PCI Bus.
     664     * @thread  EMT only.
     665     */
     666    DECLR3CALLBACKMEMBER(PCPDMPCIHLPGC, pfnGetGCHelpers,(PPDMDEVINS pDevIns));
     667
     668    /**
     669     * Gets the address of the R0 PCI Bus helpers.
     670     *
     671     * This should be called at both construction and relocation time
     672     * to obtain the correct address of the GC helpers.
     673     *
     674     * @returns R0 pointer to the PCI Bus helpers.
     675     * @param   pDevIns         Device instance of the PCI Bus.
     676     * @thread  EMT only.
     677     */
     678    DECLR3CALLBACKMEMBER(PCPDMPCIHLPR0, pfnGetR0Helpers,(PPDMDEVINS pDevIns));
     679
    646680#ifdef VBOX_WITH_PDM_LOCK
    647681    /**
     
    662696    DECLR3CALLBACKMEMBER(void,  pfnUnlock,(PPDMDEVINS pDevIns));
    663697#endif
    664 
    665     /**
    666      * Gets the address of the GC PCI Bus helpers.
    667      *
    668      * This should be called at both construction and relocation time
    669      * to obtain the correct address of the GC helpers.
    670      *
    671      * @returns GC pointer to the PCI Bus helpers.
    672      * @param   pDevIns         Device instance of the PCI Bus.
    673      * @thread  EMT only.
    674      */
    675     DECLR3CALLBACKMEMBER(PCPDMPCIHLPGC, pfnGetGCHelpers,(PPDMDEVINS pDevIns));
    676 
    677     /**
    678      * Gets the address of the R0 PCI Bus helpers.
    679      *
    680      * This should be called at both construction and relocation time
    681      * to obtain the correct address of the GC helpers.
    682      *
    683      * @returns R0 pointer to the PCI Bus helpers.
    684      * @param   pDevIns         Device instance of the PCI Bus.
    685      * @thread  EMT only.
    686      */
    687     DECLR3CALLBACKMEMBER(PCPDMPCIHLPR0, pfnGetR0Helpers,(PPDMDEVINS pDevIns));
    688698
    689699    /** Just a safety precaution. */
     
    696706
    697707/** Current PDMPCIHLPR3 version number. */
    698 #define PDM_PCIHLPR3_VERSION  0xf1010000
     708#define PDM_PCIHLPR3_VERSION  0xf1020000
    699709
    700710
     
    17091719     */
    17101720    DECLR3CALLBACKMEMBER(int, pfnIOPortDeregister,(PPDMDEVINS pDevIns, RTIOPORT Port, RTUINT cPorts));
    1711 
    17121721
    17131722    /**
     
    25692578    DECLR3CALLBACKMEMBER(int, pfnROMProtectShadow,(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange));
    25702579
     2580    /**
     2581     * Allocate and register a MMIO2 region.
     2582     *
     2583     * As mentioned elsewhere, MMIO2 is just RAM spelled differently. It's
     2584     * RAM associated with a device. It is also non-shared memory with a
     2585     * permanent ring-3 mapping and page backing (presently).
     2586     *
     2587     * @returns VBox status.
     2588     * @param   pDevIns         The device instance.
     2589     * @param   iRegion         The region number. Use the PCI region number as
     2590     *                          this must be known to the PCI bus device too. If it's not associated
     2591     *                          with the PCI device, then any number up to UINT8_MAX is fine.
     2592     * @param   cb              The size (in bytes) of the region.
     2593     * @param   ppv             Where to store the address of the ring-3 mapping of the memory.
     2594     * @param   pszDesc         Pointer to description string. This must not be freed.
     2595     * @thread  EMT.
     2596     */
     2597    DECLR3CALLBACKMEMBER(int, pfnMMIO2Register,(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS cb, void **ppv, const char *pszDesc));
     2598
     2599    /**
     2600     * Deregisters and frees a MMIO2 region.
     2601     *
     2602     * Any physical (and virtual) access handlers registered for the region must
     2603     * be deregistered before calling this function.
     2604     *
     2605     * @returns VBox status code.
     2606     * @param   pDevIns         The device instance.
     2607     * @param   iRegion         The region number used during registration.
     2608     * @thread  EMT.
     2609     */
     2610    DECLR3CALLBACKMEMBER(int, pfnMMIO2Deregister,(PPDMDEVINS pDevIns, uint32_t iRegion));
     2611
     2612    /**
     2613     * Maps a MMIO2 region into the physical memory space.
     2614     *
     2615     * A MMIO2 range may overlap with base memory if a lot of RAM
     2616     * is configured for the VM, in which case we'll drop the base
     2617     * memory pages. Presently we will make no attempt to preserve
     2618     * anything that happens to be present in the base memory that
     2619     * is replaced, this is of course incorrectly but it's too much
     2620     * effort.
     2621     *
     2622     * @returns VBox status code.
     2623     * @param   pDevIns         The device instance.
     2624     * @param   iRegion         The region number used during registration.
     2625     * @param   GCPhys          The physical address to map it at.
     2626     * @thread  EMT.
     2627     */
     2628    DECLR3CALLBACKMEMBER(int, pfnMMIO2Map,(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS GCPhys));
     2629
     2630    /**
     2631     * Unmaps a MMIO2 region previously mapped using pfnMMIO2Map.
     2632     *
     2633     * @returns VBox status code.
     2634     * @param   pDevIns         The device instance.
     2635     * @param   iRegion         The region number used during registration.
     2636     * @param   GCPhys          The physical address it's currently mapped at.
     2637     * @thread  EMT.
     2638     */
     2639    DECLR3CALLBACKMEMBER(int, pfnMMIO2Unmap,(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS GCPhys));
     2640
     2641    /**
     2642     * Maps a portion of an MMIO2 region into the hypervisor region.
     2643     *
     2644     * Callers of this API must never deregister the MMIO2 region before the
     2645     * VM is powered off.
     2646     *
     2647     * @return VBox status code.
     2648     * @param   pDevIns     The device owning the MMIO2 memory.
     2649     * @param   iRegion     The region.
     2650     * @param   off         The offset into the region. Will be rounded down to closest page boundrary.
     2651     * @param   cb          The number of bytes to map. Will be rounded up to the closest page boundrary.
     2652     * @param   pszDesc     Mapping description.
     2653     * @param   pGCPtr      Where to store the GC address.
     2654     */
     2655    DECLR3CALLBACKMEMBER(int, pfnMMHyperMapMMIO2,(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS off, RTGCPHYS cb,
     2656                                                  const char *pszDesc, PRTGCPTR pGCPtr));
     2657
    25712658    /** @} */
    25722659
     
    25812668
    25822669/** Current PDMDEVHLP version number. */
    2583 #define PDM_DEVHLP_VERSION  0xf2050000
     2670#define PDM_DEVHLP_VERSION  0xf2050001
    25842671
    25852672
     
    30443131    return pDevIns->pDevHlp->pfnROMRegister(pDevIns, GCPhysStart, cbRange, pvBinary, fShadow, pszDesc);
    30453132}
    3046 
    30473133/**
    30483134 * @copydoc PDMDEVHLP::pfnROMProtectShadow
     
    30513137{
    30523138    return pDevIns->pDevHlp->pfnROMProtectShadow(pDevIns, GCPhysStart, cbRange);
     3139}
     3140
     3141/**
     3142 * @copydoc PDMDEVHLP::pfnMMIO2Register
     3143 */
     3144DECLINLINE(int) PDMDevHlpMMIO2Register(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS cb, void **ppv, const char *pszDesc)
     3145{
     3146    return pDevIns->pDevHlp->pfnMMIO2Register(pDevIns, iRegion, cb, ppv, pszDesc);
     3147}
     3148
     3149/**
     3150 * @copydoc PDMDEVHLP::pfnMMIO2Deregister
     3151 */
     3152DECLINLINE(int) PDMDevHlpMMIO2Deregister(PPDMDEVINS pDevIns, uint32_t iRegion)
     3153{
     3154    return pDevIns->pDevHlp->pfnMMIO2Deregister(pDevIns, iRegion);
     3155}
     3156
     3157/**
     3158 * @copydoc PDMDEVHLP::pfnMMIO2Map
     3159 */
     3160DECLINLINE(int) PDMDevHlpMMIO2Map(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS GCPhys)
     3161{
     3162    return pDevIns->pDevHlp->pfnMMIO2Map(pDevIns, iRegion, GCPhys);
     3163}
     3164
     3165/**
     3166 * @copydoc PDMDEVHLP::pfnMMIO2Unmap
     3167 */
     3168DECLINLINE(int) PDMDevHlpMMIO2Unmap(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS GCPhys)
     3169{
     3170    return pDevIns->pDevHlp->pfnMMIO2Unmap(pDevIns, iRegion, GCPhys);
     3171}
     3172
     3173/**
     3174 * @copydoc PDMDEVHLP::pfnMMHyperMapMMIO2
     3175 */
     3176DECLINLINE(int) PDMDevHlpMMHyperMapMMIO2(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS off, RTGCPHYS cb,
     3177                                         const char *pszDesc, PRTGCPTR pGCPtr)
     3178{
     3179    return pDevIns->pDevHlp->pfnMMHyperMapMMIO2(pDevIns, iRegion, off, cb, pszDesc, pGCPtr);
    30533180}
    30543181
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