VirtualBox

Changeset 35738 in vbox


Ignore:
Timestamp:
Jan 27, 2011 2:17:41 PM (14 years ago)
Author:
vboxsync
Message:

r=bird: Clean up of r69600 (PCIRAW), left a few review notes behind.

Location:
trunk
Files:
7 edited

Legend:

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

    r35676 r35738  
    920920
    921921#ifdef PCIDEVICEINT_DECLARED
     922/** @todo r=bird: These are internal methods and should start with lowercase
     923 *  prefix as well as including the 'Dev' bit: s/PCI\(Set|Get\)/pciDev\1/
     924 *
     925 *  Also: s/uFlags/fFlags/
     926 */
     927
    922928DECLINLINE(void) PCISetRequestedDevfunc(PPCIDEVICE pDev)
    923929{
     
    9991005    return (pDev->Int.s.uFlags & PCIDEV_FLAG_PASSTHROUGH) != 0;
    10001006}
    1001 #endif
    1002 
    1003 #ifdef __cplusplus
     1007
     1008#endif /* PCIDEVICEINT_DECLARED */
     1009
     1010#if defined(__cplusplus) && defined(IN_RING3)
     1011/**
     1012 * Document me.
     1013 *
     1014 * @remarks C++ classes (structs included) are not generally accepted in
     1015 *          VMM devices or drivers.  An exception may be granted for this class
     1016 *          if it's contained to ring-3 and that this is a one time exception
     1017 *          which sets no precedent.
     1018 */
    10041019struct PciBusAddress
    10051020{
     1021    /** @todo r=bird: Add 'm', or 'm_' to data members. This is general
     1022     *        practice in most of the source tree. */
    10061023    int  iBus;
    10071024    int  iDevice;
  • trunk/include/VBox/vmm/pdmdev.h

    r35676 r35738  
    44
    55/*
    6  * Copyright (C) 2006-2010 Oracle Corporation
     6 * Copyright (C) 2006-2011 Oracle Corporation
    77 *
    88 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    18221822#define PDM_HPETHLPR3_VERSION                   PDM_VERSION_MAKE(0xffec, 2, 0)
    18231823
     1824
     1825/**
     1826 * Raw PCI device registration structure.
     1827 */
    18241828typedef struct PDMPCIRAWREG
    18251829{
    18261830    /** Struct version+magic number (PDM_PCIRAWREG_VERSION). */
    1827      uint32_t            u32Version;
     1831    uint32_t                u32Version;
     1832    /** Just a safety precaution. */
     1833    uint32_t                u32TheEnd;
    18281834} PDMPCIRAWREG;
    1829 
    18301835/** Pointer to a raw PCI registration structure. */
    18311836typedef PDMPCIRAWREG *PPDMPCIRAWREG;
     1837
    18321838/** Current PDMPCIRAWREG version number. */
    1833 #define PDM_PCIRAWREG_VERSION                     PDM_VERSION_MAKE(0xffe3, 1, 0)
    1834 struct PDMPCIRAWHLPRC
    1835 {
     1839#define PDM_PCIRAWREG_VERSION                   PDM_VERSION_MAKE(0xffe1, 1, 0)
     1840
     1841/**
     1842 * Raw PCI device raw-mode context helpers.
     1843 */
     1844typedef struct PDMPCIRAWHLPRC
     1845{
     1846    /** Structure version and magic number (PDM_PCIRAWHLPRC_VERSION). */
    18361847    uint32_t u32Version;
    18371848    /** Just a safety precaution. */
    18381849    uint32_t u32TheEnd;
    1839 };
     1850} PDMPCIRAWHLPRC;
     1851/** Pointer to a raw PCI deviec raw-mode context helper structure. */
    18401852typedef RCPTRTYPE(PDMPCIRAWHLPRC *) PPDMPCIRAWHLPRC;
     1853/** Pointer to a const raw PCI deviec raw-mode context helper structure. */
    18411854typedef RCPTRTYPE(const PDMPCIRAWHLPRC *) PCPDMPCIRAWHLPRC;
    18421855
    1843 struct PDMPCIRAWHLPR0
    1844 {
    1845 uint32_t u32Version;
    1846 /** Just a safety precaution. */
    1847 uint32_t u32TheEnd;
    1848 };
     1856/** Current PDMPCIRAWHLPRC version number. */
     1857#define PDM_PCIRAWHLPRC_VERSION                 PDM_VERSION_MAKE(0xffe0, 1, 0)
     1858
     1859/**
     1860 * Raw PCI device ring-0 context helpers.
     1861 */
     1862typedef struct PDMPCIRAWHLPR0
     1863{
     1864    /** Structure version and magic number (PDM_PCIRAWHLPR0_VERSION). */
     1865    uint32_t u32Version;
     1866    /** Just a safety precaution. */
     1867    uint32_t u32TheEnd;
     1868} PDMPCIRAWHLPR0;
     1869/** Pointer to a raw PCI deviec ring-0 context helper structure. */
    18491870typedef R0PTRTYPE(PDMPCIRAWHLPR0 *) PPDMPCIRAWHLPR0;
     1871/** Pointer to a const raw PCI deviec ring-0 context helper structure. */
    18501872typedef R0PTRTYPE(const PDMPCIRAWHLPR0 *) PCPDMPCIRAWHLPR0;
    18511873
    1852 
    1853 typedef struct PDMPCIRAWHLPR3
    1854 {
    1855 uint32_t u32Version;
    1856 /**
    1857 * Gets the address of the RC PCI raw helpers.
    1858 *
    1859 * This should be called at both construction and relocation time
    1860 * to obtain the correct address of the RC helpers.
    1861 *
    1862 * @returns RC pointer to the PCI raw helpers.
    1863 * @param   pDevIns         Device instance of the raw PCI device.
    1864 */
    1865 DECLR3CALLBACKMEMBER(PCPDMPCIRAWHLPRC, pfnGetRCHelpers,(PPDMDEVINS pDevIns));
    1866 
    1867 /**
    1868 * Gets the address of the R0 PCI raw helpers.
    1869 *
    1870 * This should be called at both construction and relocation time
    1871 * to obtain the correct address of the R0 helpers.
    1872 *
    1873 * @returns R0 pointer to the PCI raw helpers.
    1874 * @param   pDevIns         Device instance of the raw PCI device.
    1875 */
    1876 DECLR3CALLBACKMEMBER(PCPDMPCIRAWHLPR0, pfnGetR0Helpers,(PPDMDEVINS pDevIns));
    1877 
    1878 /** Just a safety precaution. */
    1879 uint32_t                u32TheEnd;
    1880 } PDMPCIRAWHLPR3;
    1881 /** Pointer to raw PCI R3 helpers. */
    1882 typedef R3PTRTYPE(PDMPCIRAWHLPR3 *) PPDMPCIRAWHLPR3;
    1883 /** Pointer to const raw PCI R3 helpers. */
    1884 typedef R3PTRTYPE(const PDMPCIRAWHLPR3 *) PCPDMPCIRAWHLPR3;
    1885 
    1886 /** Current PDMPCIRAWHLPRC version number. */
    1887 #define PDM_PCIRAWHLPRC_VERSION                   PDM_VERSION_MAKE(0xfff0, 1, 0)
    1888 /** Current PDMPCIRAWHLPR0 version number. */
    1889 #define PDM_PCIRAWHLPR0_VERSION                   PDM_VERSION_MAKE(0xfff1, 1, 0)
    1890 /** Current PDMPCIRAWHLPR3 version number. */
    1891 #define PDM_PCIRAWHLPR3_VERSION                   PDM_VERSION_MAKE(0xfff2, 1, 0)
     1874/** Current PDMPCIRAWHLPR0 version number. */
     1875#define PDM_PCIRAWHLPR0_VERSION                 PDM_VERSION_MAKE(0xffdf, 1, 0)
     1876
     1877
     1878/**
     1879 * Raw PCI device ring-3 context helpers.
     1880 */
     1881typedef struct PDMPCIRAWHLPR3
     1882{
     1883    /** Undefined structure version and magic number. */
     1884    uint32_t u32Version;
     1885
     1886    /**
     1887     * Gets the address of the RC raw PCI device helpers.
     1888     *
     1889     * This should be called at both construction and relocation time to obtain
     1890     * the correct address of the RC helpers.
     1891     *
     1892     * @returns RC pointer to the raw PCI device helpers.
     1893     * @param   pDevIns         Device instance of the raw PCI device.
     1894     */
     1895    DECLR3CALLBACKMEMBER(PCPDMPCIRAWHLPRC, pfnGetRCHelpers,(PPDMDEVINS pDevIns));
     1896
     1897    /**
     1898     * Gets the address of the R0 raw PCI device helpers.
     1899     *
     1900     * This should be called at both construction and relocation time to obtain
     1901     * the correct address of the R0 helpers.
     1902     *
     1903     * @returns R0 pointer to the raw PCI device helpers.
     1904     * @param   pDevIns         Device instance of the raw PCI device.
     1905     */
     1906    DECLR3CALLBACKMEMBER(PCPDMPCIRAWHLPR0, pfnGetR0Helpers,(PPDMDEVINS pDevIns));
     1907
     1908    /** Just a safety precaution. */
     1909    uint32_t                u32TheEnd;
     1910} PDMPCIRAWHLPR3;
     1911/** Pointer to raw PCI R3 helpers. */
     1912typedef R3PTRTYPE(PDMPCIRAWHLPR3 *) PPDMPCIRAWHLPR3;
     1913/** Pointer to const raw PCI R3 helpers. */
     1914typedef R3PTRTYPE(const PDMPCIRAWHLPR3 *) PCPDMPCIRAWHLPR3;
     1915
     1916/** Current PDMPCIRAWHLPR3 version number. */
     1917#define PDM_PCIRAWHLPR3_VERSION                   PDM_VERSION_MAKE(0xffde, 1, 0)
     1918
    18921919
    18931920#ifdef IN_RING3
     
    29893016    DECLR3CALLBACKMEMBER(int, pfnHPETRegister,(PPDMDEVINS pDevIns, PPDMHPETREG pHpetReg, PCPDMHPETHLPR3 *ppHpetHlpR3));
    29903017
    2991     /** 
    2992      * Register the raw PCI device.
    2993      * 
    2994      * @returns VBox status code. 
    2995      * @param   pDevIns             The device instance. 
    2996      * @param   pHpetReg            Pointer to a raw PCI registration structure. 
    2997      * @param   ppHpetHlpR3         Where to store the pointer to the raw PCI
    2998      *                              helpers.
    2999      */ 
    3000     DECLR3CALLBACKMEMBER(int, pfnPciRawRegister,(PPDMDEVINS pDevIns, PPDMPCIRAWREG pPciRawReg, PCPDMPCIRAWHLPR3 *ppPciRawHlpR3)); 
     3018    /**
     3019     * Register a raw PCI device.
     3020     *
     3021     * @returns VBox status code.
     3022     * @param   pDevIns             The device instance.
     3023     * @param   pHpetReg            Pointer to a raw PCI registration structure.
     3024     * @param   ppPciRawHlpR3       Where to store the pointer to the raw PCI
     3025     *                              device helpers.
     3026     */
     3027    DECLR3CALLBACKMEMBER(int, pfnPciRawRegister,(PPDMDEVINS pDevIns, PPDMPCIRAWREG pPciRawReg, PCPDMPCIRAWHLPR3 *ppPciRawHlpR3));
    30013028
    30023029    /**
     
    33603387
    33613388/** Current PDMDEVHLPR3 version number. */
    3362 #define PDM_DEVHLPR3_VERSION                    PDM_VERSION_MAKE(0xffe7, 3, 0)
     3389#define PDM_DEVHLPR3_VERSION                    PDM_VERSION_MAKE(0xffe7, 4, 0)
    33633390
    33643391
     
    45334560}
    45344561
    4535 /** 
    4536  * @copydoc PDMDEVHLPR3::pfnPciRawRegister 
    4537  */ 
    4538 DECLINLINE(int) PDMDevHlpPciRawRegister(PPDMDEVINS pDevIns, PPDMPCIRAWREG pPciRawReg, PCPDMPCIRAWHLPR3 *ppPciRawHlpR3) 
    4539 { 
    4540     return pDevIns->pHlpR3->pfnPciRawRegister(pDevIns, pPciRawReg, ppPciRawHlpR3); 
    4541 } 
     4562/**
     4563 * @copydoc PDMDEVHLPR3::pfnPciRawRegister
     4564 */
     4565DECLINLINE(int) PDMDevHlpPciRawRegister(PPDMDEVINS pDevIns, PPDMPCIRAWREG pPciRawReg, PCPDMPCIRAWHLPR3 *ppPciRawHlpR3)
     4566{
     4567    return pDevIns->pHlpR3->pfnPciRawRegister(pDevIns, pPciRawReg, ppPciRawHlpR3);
     4568}
    45424569
    45434570/**
  • trunk/src/VBox/Devices/Bus/PCIInternal.h

    r35676 r35738  
    9999    /** I/O regions. */
    100100    PCIIOREGION                     aIORegions[PCI_NUM_REGIONS];
    101     /** Pointer to the PCI bus of the device. - R3 ptr */
     101    /** Pointer to the PCI bus of the device. (R3 ptr) */
    102102    R3PTRTYPE(struct PCIBus *)      pBusR3;
    103     /** Pointer to the PCI bus of the device. - R0 ptr */
     103    /** Pointer to the PCI bus of the device. (R0 ptr) */
    104104    R0PTRTYPE(struct PCIBus *)      pBusR0;
    105     /** Pointer to the PCI bus of the device. - RC ptr */
     105    /** Pointer to the PCI bus of the device. (RC ptr) */
    106106    RCPTRTYPE(struct PCIBus *)      pBusRC;
    107107#if HC_ARCH_BITS == 64
     
    109109#endif
    110110
    111     /* Page used for MSI-X state.             - R3 ptr */
     111    /** Page used for MSI-X state.             (R3 ptr) */
    112112    R3PTRTYPE(void*)                pMsixPageR3;
    113     /* Page used for MSI-X state.             - R0 ptr */
     113    /** Page used for MSI-X state.             (R0 ptr) */
    114114    R0PTRTYPE(void*)                pMsixPageR0;
    115     /* Page used for MSI-X state.             - RC ptr */
     115    /** Page used for MSI-X state.             (RC ptr) */
    116116    RCPTRTYPE(void*)                pMsixPageRC;
    117117#if HC_ARCH_BITS == 64
     
    125125    R3PTRTYPE(PFNPCICONFIGWRITE)    pfnConfigWrite;
    126126
    127     /* Flags of this PCI device, see PCIDEV_FLAG_ constants */
     127    /** Flags of this PCI device, see PCIDEV_FLAG_XXX constants.
     128     *  @todo s/uFlags/fFlags/g */
    128129    uint32_t                        uFlags;
    129130    /** Current state of the IRQ pin of the device. */
    130131    int32_t                         uIrqPinState;
    131132
    132     /* Offset of MSI PCI capability in config space, or 0 */
     133    /** Offset of MSI PCI capability in config space, or 0. */
    133134    uint8_t                         u8MsiCapOffset;
    134     /* Size of MSI PCI capability in config space, or 0 */
     135    /** Size of MSI PCI capability in config space, or 0. */
    135136    uint8_t                         u8MsiCapSize;
    136     /* Offset of MSI-X PCI capability in config space, or 0 */
     137    /** Offset of MSI-X PCI capability in config space, or 0. */
    137138    uint8_t                         u8MsixCapOffset;
    138     /* Size of MSI-X PCI capability in config space, or 0 */
     139    /** Size of MSI-X PCI capability in config space, or 0. */
    139140    uint8_t                         u8MsixCapSize;
    140141
    141142    uint32_t                        Alignment2;
    142143
    143     /* Pointer to bus specific data.                 - R3 ptr */
     144    /** Pointer to bus specific data.                 (R3 ptr) */
    144145    R3PTRTYPE(const void*)          pPciBusPtrR3;
    145146
     
    155156} PCIDEVICEINT;
    156157
    157 /* Indicate that PCIDEVICE::Int.s can be declared. */
     158/** Indicate that PCIDEVICE::Int.s can be declared. */
    158159#define PCIDEVICEINT_DECLARED
    159160
  • trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp

    r35676 r35738  
    55
    66/*
    7  * Copyright (C) 2006-2010 Oracle Corporation
     7 * Copyright (C) 2006-2011 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    669669 * @{
    670670 */
     671/* none */
    671672
    672673/**
     
    681682/** @} */
    682683
     684
    683685/** @name Raw PCI Ring-0 Helpers
    684686 * @{
    685687 */
     688/* none */
     689
    686690/**
    687691 * The Ring-0 PCI raw Helper Callbacks.
     
    694698
    695699/** @} */
     700
    696701
    697702/** @name Ring-0 Context Driver Helpers
  • trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp

    r35676 r35738  
    55
    66/*
    7  * Copyright (C) 2006-2010 Oracle Corporation
     7 * Copyright (C) 2006-2011 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    28122812}
    28132813
     2814
    28142815/** @interface_method_impl{PDMDEVHLPR3,pfnPciRawRegister} */
    28152816static DECLCALLBACK(int) pdmR3DevHlp_PciRawRegister(PPDMDEVINS pDevIns, PPDMPCIRAWREG pPciRawReg, PCPDMPCIRAWHLPR3 *ppPciRawHlpR3)
     
    28412842    return VINF_SUCCESS;
    28422843}
     2844
    28432845
    28442846/** @interface_method_impl{PDMDEVHLPR3,pfnDMACRegister} */
     
    35003502
    35013503/** @} */
     3504
  • trunk/src/VBox/VMM/VMMR3/PDMDevMiscHlp.cpp

    r35676 r35738  
    55
    66/*
    7  * Copyright (C) 2006-2010 Oracle Corporation
     7 * Copyright (C) 2006-2011 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    651651/** @} */
    652652
    653 /** @interface_method_impl{PDMPCIRAWHLPR3,pfnGetRCHelpers} */
    654 static DECLCALLBACK(PCPDMPCIRAWHLPRC) pdmR3PciRawHlp_GetRCHelpers(PPDMDEVINS pDevIns)
    655 {
    656     PDMDEV_ASSERT_DEVINS(pDevIns);
    657     VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    658     RTRCPTR pRCHelpers = 0;
    659     int rc = PDMR3LdrGetSymbolRC(pDevIns->Internal.s.pVMR3, NULL, "g_pdmRCPciRawHlp", &pRCHelpers);
    660     AssertReleaseRC(rc);
    661     AssertRelease(pRCHelpers);
    662     LogFlow(("pdmR3PciRawHlp_GetGCHelpers: caller='%s'/%d: returns %RRv\n",
    663              pDevIns->pReg->szName, pDevIns->iInstance, pRCHelpers));
    664     return pRCHelpers;
    665 }
    666 
    667 
    668 /** @interface_method_impl{PDMPCIRAWHLPR3,pfnGetR0Helpers} */
    669 static DECLCALLBACK(PCPDMPCIRAWHLPR0) pdmR3PciRawHlp_GetR0Helpers(PPDMDEVINS pDevIns)
    670 {
    671     PDMDEV_ASSERT_DEVINS(pDevIns);
    672     VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    673     PCPDMHPETHLPR0 pR0Helpers = 0;
    674     int rc = PDMR3LdrGetSymbolR0(pDevIns->Internal.s.pVMR3, NULL, "g_pdmR0PciRawHlp", &pR0Helpers);
    675     AssertReleaseRC(rc);
    676     AssertRelease(pR0Helpers);
    677     LogFlow(("pdmR3PciRawHlp_GetR0Helpers: caller='%s'/%d: returns %RHv\n",
    678              pDevIns->pReg->szName, pDevIns->iInstance, pR0Helpers));
    679     return pR0Helpers;
    680 }
    681 
    682 /**
    683  * Raw PCI Device Helpers.
    684  */
    685 const PDMPCIRAWHLPR3 g_pdmR3DevPciRawHlp =
    686 {
    687     PDM_PCIRAWHLPR3_VERSION,
    688     pdmR3PciRawHlp_GetRCHelpers,
    689     pdmR3PciRawHlp_GetR0Helpers,
    690     PDM_PCIRAWHLPR3_VERSION, /* the end */
    691 };
     653
     654/** @name Ring-3 Raw PCI Device Helpers
     655 * {@
     656 */
     657
     658/** @interface_method_impl{PDMPCIRAWHLPR3,pfnGetRCHelpers} */
     659static DECLCALLBACK(PCPDMPCIRAWHLPRC) pdmR3PciRawHlp_GetRCHelpers(PPDMDEVINS pDevIns)
     660{
     661    PDMDEV_ASSERT_DEVINS(pDevIns);
     662    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
     663    RTRCPTR pRCHelpers = NIL_RTRCPTR;
     664    int rc = PDMR3LdrGetSymbolRC(pDevIns->Internal.s.pVMR3, NULL, "g_pdmRCPciRawHlp", &pRCHelpers);
     665    AssertReleaseRC(rc);
     666    AssertRelease(pRCHelpers);
     667    LogFlow(("pdmR3PciRawHlp_GetGCHelpers: caller='%s'/%d: returns %RRv\n",
     668             pDevIns->pReg->szName, pDevIns->iInstance, pRCHelpers));
     669    return pRCHelpers;
     670}
     671
     672
     673/** @interface_method_impl{PDMPCIRAWHLPR3,pfnGetR0Helpers} */
     674static DECLCALLBACK(PCPDMPCIRAWHLPR0) pdmR3PciRawHlp_GetR0Helpers(PPDMDEVINS pDevIns)
     675{
     676    PDMDEV_ASSERT_DEVINS(pDevIns);
     677    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
     678    PCPDMHPETHLPR0 pR0Helpers = NIL_RTR0PTR;
     679    int rc = PDMR3LdrGetSymbolR0(pDevIns->Internal.s.pVMR3, NULL, "g_pdmR0PciRawHlp", &pR0Helpers);
     680    AssertReleaseRC(rc);
     681    AssertRelease(pR0Helpers);
     682    LogFlow(("pdmR3PciRawHlp_GetR0Helpers: caller='%s'/%d: returns %RHv\n",
     683             pDevIns->pReg->szName, pDevIns->iInstance, pR0Helpers));
     684    return pR0Helpers;
     685}
     686
     687
     688/**
     689 * Raw PCI Device Helpers.
     690 */
     691const PDMPCIRAWHLPR3 g_pdmR3DevPciRawHlp =
     692{
     693    PDM_PCIRAWHLPR3_VERSION,
     694    pdmR3PciRawHlp_GetRCHelpers,
     695    pdmR3PciRawHlp_GetR0Helpers,
     696    PDM_PCIRAWHLPR3_VERSION, /* the end */
     697};
     698
     699/** @} */
     700
    692701
    693702/* none yet */
  • trunk/src/VBox/VMM/VMMRC/PDMRCDevice.cpp

    r35346 r35738  
    55
    66/*
    7  * Copyright (C) 2006-2010 Oracle Corporation
     7 * Copyright (C) 2006-2011 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    4747extern DECLEXPORT(const PDMHPETHLPRC)   g_pdmRCHpetHlp;
    4848extern DECLEXPORT(const PDMDRVHLPRC)    g_pdmRCDrvHlp;
     49/** @todo missing PDMPCIRAWHLPRC  */
    4950RT_C_DECLS_END
    5051
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