VirtualBox

Changeset 80960 in vbox for trunk/include/VBox/vmm


Ignore:
Timestamp:
Sep 23, 2019 8:54:03 PM (5 years ago)
Author:
vboxsync
Message:

IOM,PDM,DevPCI,DevPciIch9,RTC: Fixes to the I/O port lookup table insertion code. Converted (mostly) the two PCI buses to the new PDM device style. The ICH9 variant wasn't actually dropping the default critsect, it turned out. Changed the new I/O port callbacks to return VBOXSTRICTRC rather than plain int. bugref:9218

Location:
trunk/include/VBox/vmm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/iom.h

    r80679 r80960  
    243243typedef FNIOMIOPORTOUTSTRING *PFNIOMIOPORTOUTSTRING;
    244244
     245
     246/**
     247 * Port I/O Handler for IN operations.
     248 *
     249 * @returns VINF_SUCCESS or VINF_EM_*.
     250 * @returns VERR_IOM_IOPORT_UNUSED if the port is really unused and a ~0 value should be returned.
     251 *
     252 * @param   pDevIns     The device instance.
     253 * @param   pvUser      User argument.
     254 * @param   uPort       Port number used for the IN operation.
     255 * @param   pu32        Where to store the result.  This is always a 32-bit
     256 *                      variable regardless of what @a cb might say.
     257 * @param   cb          Number of bytes read.
     258 * @remarks Caller enters the device critical section.
     259 */
     260typedef DECLCALLBACK(VBOXSTRICTRC) FNIOMIOPORTNEWIN(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT uPort, uint32_t *pu32, unsigned cb);
     261/** Pointer to a FNIOMIOPORTNEWIN(). */
     262typedef FNIOMIOPORTNEWIN *PFNIOMIOPORTNEWIN;
     263
     264/**
     265 * Port I/O Handler for string IN operations.
     266 *
     267 * @returns VINF_SUCCESS or VINF_EM_*.
     268 * @returns VERR_IOM_IOPORT_UNUSED if the port is really unused and a ~0 value should be returned.
     269 *
     270 * @param   pDevIns     The device instance.
     271 * @param   pvUser      User argument.
     272 * @param   uPort       Port number used for the IN operation.
     273 * @param   pbDst       Pointer to the destination buffer.
     274 * @param   pcTransfers Pointer to the number of transfer units to read, on
     275 *                      return remaining transfer units.
     276 * @param   cb          Size of the transfer unit (1, 2 or 4 bytes).
     277 * @remarks Caller enters the device critical section.
     278 */
     279typedef DECLCALLBACK(VBOXSTRICTRC) FNIOMIOPORTNEWINSTRING(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT uPort, uint8_t *pbDst,
     280                                                          uint32_t *pcTransfers, unsigned cb);
     281/** Pointer to a FNIOMIOPORTNEWINSTRING(). */
     282typedef FNIOMIOPORTNEWINSTRING *PFNIOMIOPORTNEWINSTRING;
     283
     284/**
     285 * Port I/O Handler for OUT operations.
     286 *
     287 * @returns VINF_SUCCESS or VINF_EM_*.
     288 *
     289 * @param   pDevIns     The device instance.
     290 * @param   pvUser      User argument.
     291 * @param   uPort       Port number used for the OUT operation.
     292 * @param   u32         The value to output.
     293 * @param   cb          The value size in bytes.
     294 * @remarks Caller enters the device critical section.
     295 */
     296typedef DECLCALLBACK(VBOXSTRICTRC) FNIOMIOPORTNEWOUT(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT uPort, uint32_t u32, unsigned cb);
     297/** Pointer to a FNIOMIOPORTNEWOUT(). */
     298typedef FNIOMIOPORTNEWOUT *PFNIOMIOPORTNEWOUT;
     299
     300/**
     301 * Port I/O Handler for string OUT operations.
     302 *
     303 * @returns VINF_SUCCESS or VINF_EM_*.
     304 *
     305 * @param   pDevIns     The device instance.
     306 * @param   pvUser      User argument.
     307 * @param   uPort       Port number used for the OUT operation.
     308 * @param   pbSrc       Pointer to the source buffer.
     309 * @param   pcTransfers Pointer to the number of transfer units to write, on
     310 *                      return remaining transfer units.
     311 * @param   cb          Size of the transfer unit (1, 2 or 4 bytes).
     312 * @remarks Caller enters the device critical section.
     313 */
     314typedef DECLCALLBACK(VBOXSTRICTRC) FNIOMIOPORTNEWOUTSTRING(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT uPort, const uint8_t *pbSrc,
     315                                                           uint32_t *pcTransfers, unsigned cb);
     316/** Pointer to a FNIOMIOPORTNEWOUTSTRING(). */
     317typedef FNIOMIOPORTNEWOUTSTRING *PFNIOMIOPORTNEWOUTSTRING;
     318
    245319/**
    246320 * I/O port description.
     
    338412
    339413VMMR3_INT_DECL(int)  IOMR3IoPortCreate(PVM pVM, PPDMDEVINS pDevIns, RTIOPORT cPorts, uint32_t fFlags, PPDMPCIDEV pPciDev,
    340                                        uint32_t iPciRegion, PFNIOMIOPORTOUT pfnOut, PFNIOMIOPORTIN pfnIn,
    341                                        PFNIOMIOPORTOUTSTRING pfnOutStr, PFNIOMIOPORTINSTRING pfnInStr, RTR3PTR pvUser,
     414                                       uint32_t iPciRegion, PFNIOMIOPORTNEWOUT pfnOut, PFNIOMIOPORTNEWIN pfnIn,
     415                                       PFNIOMIOPORTNEWOUTSTRING pfnOutStr, PFNIOMIOPORTNEWINSTRING pfnInStr, RTR3PTR pvUser,
    342416                                       const char *pszDesc, PCIOMIOPORTDESC paExtDescs, PIOMIOPORTHANDLE phIoPorts);
    343417VMMR3_INT_DECL(int)  IOMR3IoPortMap(PVM pVM, PPDMDEVINS pDevIns, IOMIOPORTHANDLE hIoPorts, RTIOPORT Port);
     
    409483VMMR0_INT_DECL(void) IOMR0CleanupVM(PGVM pGVM);
    410484VMMR0_INT_DECL(int)  IOMR0IoPortSetUpContext(PGVM pGVM, PPDMDEVINS pDevIns, IOMIOPORTHANDLE hIoPorts,
    411                                              PFNIOMIOPORTOUT pfnOut,  PFNIOMIOPORTIN pfnIn,
    412                                              PFNIOMIOPORTOUTSTRING pfnOutStr, PFNIOMIOPORTINSTRING pfnInStr, void *pvUser);
     485                                             PFNIOMIOPORTNEWOUT pfnOut,  PFNIOMIOPORTNEWIN pfnIn,
     486                                             PFNIOMIOPORTNEWOUTSTRING pfnOutStr, PFNIOMIOPORTNEWINSTRING pfnInStr, void *pvUser);
    413487VMMR0_INT_DECL(int)  IOMR0IoPortGrowRegistrationTables(PGVM pGVM, uint64_t cMinEntries);
    414488VMMR0_INT_DECL(int)  IOMR0IoPortGrowStatisticsTable(PGVM pGVM, uint64_t cMinEntries);
  • trunk/include/VBox/vmm/pdmdev.h

    r80943 r80960  
    10581058    DECLRCCALLBACKMEMBER(void,  pfnUnlock,(PPDMDEVINS pDevIns));
    10591059
     1060    /**
     1061     * Gets a bus by it's PDM ordinal (typically the parent bus).
     1062     *
     1063     * @returns Pointer to the device instance of the bus.
     1064     * @param   pDevIns         The PCI bus device instance.
     1065     * @param   idxPdmBus       The PDM ordinal value of the bus to get.
     1066     */
     1067    DECLRCCALLBACKMEMBER(PPDMDEVINS, pfnGetBusByNo,(PPDMDEVINS pDevIns, uint32_t idxPdmBus));
     1068
    10601069    /** Just a safety precaution. */
    10611070    uint32_t                    u32TheEnd;
     
    11111120    DECLR0CALLBACKMEMBER(void,  pfnIoApicSendMsi,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t uValue, uint32_t uTagSrc));
    11121121
    1113 
    11141122    /**
    11151123     * Acquires the PDM lock.
     
    11281136     */
    11291137    DECLR0CALLBACKMEMBER(void,  pfnUnlock,(PPDMDEVINS pDevIns));
     1138
     1139    /**
     1140     * Gets a bus by it's PDM ordinal (typically the parent bus).
     1141     *
     1142     * @returns Pointer to the device instance of the bus.
     1143     * @param   pDevIns         The PCI bus device instance.
     1144     * @param   idxPdmBus       The PDM ordinal value of the bus to get.
     1145     */
     1146    DECLR0CALLBACKMEMBER(PPDMDEVINS, pfnGetBusByNo,(PPDMDEVINS pDevIns, uint32_t idxPdmBus));
    11301147
    11311148    /** Just a safety precaution. */
     
    11381155
    11391156/** Current PDMPCIHLPR0 version number. */
    1140 #define PDM_PCIHLPR0_VERSION                    PDM_VERSION_MAKE(0xfffc, 3, 0)
     1157#define PDM_PCIHLPR0_VERSION                    PDM_VERSION_MAKE(0xfffc, 4, 0)
    11411158
    11421159/**
     
    11901207
    11911208    /**
    1192      * Gets the address of the RC PCI Bus helpers.
    1193      *
    1194      * This should be called at both construction and relocation time
    1195      * to obtain the correct address of the RC helpers.
    1196      *
    1197      * @returns RC pointer to the PCI Bus helpers.
    1198      * @param   pDevIns         Device instance of the PCI Bus.
    1199      * @thread  EMT only.
    1200      */
    1201     DECLR3CALLBACKMEMBER(PCPDMPCIHLPRC, pfnGetRCHelpers,(PPDMDEVINS pDevIns));
    1202 
    1203     /**
    1204      * Gets the address of the R0 PCI Bus helpers.
    1205      *
    1206      * This should be called at both construction and relocation time
    1207      * to obtain the correct address of the R0 helpers.
    1208      *
    1209      * @returns R0 pointer to the PCI Bus helpers.
    1210      * @param   pDevIns         Device instance of the PCI Bus.
    1211      * @thread  EMT only.
    1212      */
    1213     DECLR3CALLBACKMEMBER(PCPDMPCIHLPR0, pfnGetR0Helpers,(PPDMDEVINS pDevIns));
    1214 
    1215     /**
    12161209     * Acquires the PDM lock.
    12171210     *
     
    12291222     */
    12301223    DECLR3CALLBACKMEMBER(void,  pfnUnlock,(PPDMDEVINS pDevIns));
     1224
     1225    /**
     1226     * Gets a bus by it's PDM ordinal (typically the parent bus).
     1227     *
     1228     * @returns Pointer to the device instance of the bus.
     1229     * @param   pDevIns         The PCI bus device instance.
     1230     * @param   idxPdmBus       The PDM ordinal value of the bus to get.
     1231     */
     1232    DECLR3CALLBACKMEMBER(PPDMDEVINS, pfnGetBusByNo,(PPDMDEVINS pDevIns, uint32_t idxPdmBus));
    12311233
    12321234    /** Just a safety precaution. */
     
    12391241
    12401242/** Current PDMPCIHLPR3 version number. */
    1241 #define PDM_PCIHLPR3_VERSION                    PDM_VERSION_MAKE(0xfffb, 3, 1)
     1243#define PDM_PCIHLPR3_VERSION                    PDM_VERSION_MAKE(0xfffb, 4, 0)
    12421244
    12431245
     
    22972299     */
    22982300    DECLR3CALLBACKMEMBER(int, pfnIoPortCreateEx,(PPDMDEVINS pDevIns, RTIOPORT cPorts, uint32_t fFlags, PPDMPCIDEV pPciDev,
    2299                                                  uint32_t iPciRegion, PFNIOMIOPORTOUT pfnOut, PFNIOMIOPORTIN pfnIn,
    2300                                                  PFNIOMIOPORTOUTSTRING pfnOutStr, PFNIOMIOPORTINSTRING pfnInStr, RTR3PTR pvUser,
     2301                                                 uint32_t iPciRegion, PFNIOMIOPORTNEWOUT pfnOut, PFNIOMIOPORTNEWIN pfnIn,
     2302                                                 PFNIOMIOPORTNEWOUTSTRING pfnOutStr, PFNIOMIOPORTNEWINSTRING pfnInStr, RTR3PTR pvUser,
    23012303                                                 const char *pszDesc, PCIOMIOPORTDESC paExtDescs, PIOMIOPORTHANDLE phIoPorts));
    23022304
     
    44104412     */
    44114413    DECLRCCALLBACKMEMBER(int, pfnIoPortSetUpContextEx,(PPDMDEVINS pDevIns, IOMIOPORTHANDLE hIoPorts,
    4412                                                        PFNIOMIOPORTOUT pfnOut, PFNIOMIOPORTIN pfnIn,
    4413                                                        PFNIOMIOPORTOUTSTRING pfnOutStr, PFNIOMIOPORTINSTRING pfnInStr,
     4414                                                       PFNIOMIOPORTNEWOUT pfnOut, PFNIOMIOPORTNEWIN pfnIn,
     4415                                                       PFNIOMIOPORTNEWOUTSTRING pfnOutStr, PFNIOMIOPORTNEWINSTRING pfnInStr,
    44144416                                                       void *pvUser));
    44154417
     
    47664768     */
    47674769    DECLR0CALLBACKMEMBER(int, pfnIoPortSetUpContextEx,(PPDMDEVINS pDevIns, IOMIOPORTHANDLE hIoPorts,
    4768                                                        PFNIOMIOPORTOUT pfnOut, PFNIOMIOPORTIN pfnIn,
    4769                                                        PFNIOMIOPORTOUTSTRING pfnOutStr, PFNIOMIOPORTINSTRING pfnInStr,
     4770                                                       PFNIOMIOPORTNEWOUT pfnOut, PFNIOMIOPORTNEWIN pfnIn,
     4771                                                       PFNIOMIOPORTNEWOUTSTRING pfnOutStr, PFNIOMIOPORTNEWINSTRING pfnInStr,
    47704772                                                       void *pvUser));
    47714773
     
    55325534 * Combines PDMDevHlpIoPortCreate() & PDMDevHlpIoPortMap().
    55335535 */
    5534 DECLINLINE(int) PDMDevHlpIoPortCreateAndMap(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts, PFNIOMIOPORTOUT pfnOut,
    5535                                             PFNIOMIOPORTIN pfnIn, const char *pszDesc, PCIOMIOPORTDESC paExtDescs,
     5536DECLINLINE(int) PDMDevHlpIoPortCreateAndMap(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts, PFNIOMIOPORTNEWOUT pfnOut,
     5537                                            PFNIOMIOPORTNEWIN pfnIn, const char *pszDesc, PCIOMIOPORTDESC paExtDescs,
    55365538                                            PIOMIOPORTHANDLE phIoPorts)
    55375539{
     
    55475549 */
    55485550DECLINLINE(int) PDMDevHlpIoPortCreate(PPDMDEVINS pDevIns, RTIOPORT cPorts, PPDMPCIDEV pPciDev, uint32_t iPciRegion,
    5549                                       PFNIOMIOPORTOUT pfnOut, PFNIOMIOPORTIN pfnIn, void *pvUser, const char *pszDesc,
     5551                                      PFNIOMIOPORTNEWOUT pfnOut, PFNIOMIOPORTNEWIN pfnIn, void *pvUser, const char *pszDesc,
    55505552                                      PCIOMIOPORTDESC paExtDescs, PIOMIOPORTHANDLE phIoPorts)
    55515553{
     
    55585560 */
    55595561DECLINLINE(int) PDMDevHlpIoPortCreateEx(PPDMDEVINS pDevIns, RTIOPORT cPorts, uint32_t fFlags, PPDMPCIDEV pPciDev,
    5560                                         uint32_t iPciRegion, PFNIOMIOPORTOUT pfnOut, PFNIOMIOPORTIN pfnIn,
    5561                                         PFNIOMIOPORTOUTSTRING pfnOutStr, PFNIOMIOPORTINSTRING pfnInStr, void *pvUser,
     5562                                        uint32_t iPciRegion, PFNIOMIOPORTNEWOUT pfnOut, PFNIOMIOPORTNEWIN pfnIn,
     5563                                        PFNIOMIOPORTNEWOUTSTRING pfnOutStr, PFNIOMIOPORTNEWINSTRING pfnInStr, void *pvUser,
    55625564                                        const char *pszDesc, PCIOMIOPORTDESC paExtDescs, PIOMIOPORTHANDLE phIoPorts)
    55635565{
     
    55895591 */
    55905592DECLINLINE(int) PDMDevHlpIoPortSetUpContext(PPDMDEVINS pDevIns, IOMIOPORTHANDLE hIoPorts,
    5591                                             PFNIOMIOPORTOUT pfnOut, PFNIOMIOPORTIN pfnIn, void *pvUser)
     5593                                            PFNIOMIOPORTNEWOUT pfnOut, PFNIOMIOPORTNEWIN pfnIn, void *pvUser)
    55925594{
    55935595    return pDevIns->CTX_SUFF(pHlp)->pfnIoPortSetUpContextEx(pDevIns, hIoPorts, pfnOut, pfnIn, NULL, NULL, pvUser);
     
    55985600 */
    55995601DECLINLINE(int) PDMDevHlpIoPortSetUpContextEx(PPDMDEVINS pDevIns, IOMIOPORTHANDLE hIoPorts,
    5600                                               PFNIOMIOPORTOUT pfnOut, PFNIOMIOPORTIN pfnIn,
    5601                                               PFNIOMIOPORTOUTSTRING pfnOutStr, PFNIOMIOPORTINSTRING pfnInStr, void *pvUser)
     5602                                              PFNIOMIOPORTNEWOUT pfnOut, PFNIOMIOPORTNEWIN pfnIn,
     5603                                              PFNIOMIOPORTNEWOUTSTRING pfnOutStr, PFNIOMIOPORTNEWINSTRING pfnInStr, void *pvUser)
    56025604{
    56035605    return pDevIns->CTX_SUFF(pHlp)->pfnIoPortSetUpContextEx(pDevIns, hIoPorts, pfnOut, pfnIn, pfnOutStr, pfnInStr, pvUser);
  • trunk/include/VBox/vmm/pdmpcidevint.h

    r80943 r80960  
    178178    R3PTRTYPE(PFNPCIBRIDGECONFIGWRITE) pfnBridgeConfigWrite;
    179179
    180     /** Pointer to the PCI bus of the device. (R0 ptr)
    181      * @note Only used by ich9pcibridgeSetIrq to find the host (root) bus. */
    182     R0PTRTYPE(struct DEVPCIBUS *)   pBusR0;
    183180    /** Page used for MSI-X state.            (R0 ptr) */
    184181    R0PTRTYPE(void *)               pMsixPageR0;
    185 
    186     /** Pointer to the PCI bus of the device. (RC ptr)
    187      * @note Only used by ich9pcibridgeSetIrq to find the host (root) bus. */
    188     RCPTRTYPE(struct DEVPCIBUS *)   pBusRC;
    189182    /** Page used for MSI-X state.            (RC ptr) */
    190183    RCPTRTYPE(void *)               pMsixPageRC;
     
    211204    /** Offset to the PBA for MSI-X.   */
    212205    uint16_t                        offMsixPba;
    213 #if HC_ARCH_BITS == 32
    214     /** Add padding to align aIORegions to an 8 byte boundary. */
    215     uint8_t                         abPadding2[12];
    216 #endif
     206    /** Add padding to align aIORegions to an 16 byte boundary. */
     207    uint8_t                         abPadding2[HC_ARCH_BITS == 32 ? 4+8 : 4+8];
    217208
    218209    /** Pointer to bus specific data. (R3 ptr) */
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