VirtualBox

Changeset 81909 in vbox for trunk/include


Ignore:
Timestamp:
Nov 17, 2019 6:23:56 PM (5 years ago)
Author:
vboxsync
Message:

VMM,DevPIC: Refactored the PIC registration. bugreF:9218

File:
1 edited

Legend:

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

    r81853 r81909  
    12541254
    12551255/**
    1256  * Programmable Interrupt Controller registration structure.
     1256 * Programmable Interrupt Controller registration structure (all contexts).
    12571257 */
    12581258typedef struct PDMPICREG
     
    12701270     * @remarks Caller enters the PDM critical section.
    12711271     */
    1272     DECLR3CALLBACKMEMBER(void, pfnSetIrqR3,(PPDMDEVINS pDevIns, int iIrq, int iLevel, uint32_t uTagSrc));
     1272    DECLCALLBACKMEMBER(void, pfnSetIrq)(PPDMDEVINS pDevIns, int iIrq, int iLevel, uint32_t uTagSrc);
    12731273
    12741274    /**
     
    12801280     * @remarks Caller enters the PDM critical section.
    12811281     */
    1282     DECLR3CALLBACKMEMBER(int, pfnGetInterruptR3,(PPDMDEVINS pDevIns, uint32_t *puTagSrc));
    1283 
    1284     /** The name of the RC SetIrq entry point. */
    1285     const char         *pszSetIrqRC;
    1286     /** The name of the RC GetInterrupt entry point. */
    1287     const char         *pszGetInterruptRC;
    1288 
    1289     /** The name of the R0 SetIrq entry point. */
    1290     const char         *pszSetIrqR0;
    1291     /** The name of the R0 GetInterrupt entry point. */
    1292     const char         *pszGetInterruptR0;
     1282    DECLCALLBACKMEMBER(int, pfnGetInterrupt)(PPDMDEVINS pDevIns, uint32_t *puTagSrc);
     1283
     1284    /** Just a safety precaution. */
     1285    uint32_t                    u32TheEnd;
    12931286} PDMPICREG;
    12941287/** Pointer to a PIC registration structure. */
     
    12961289
    12971290/** Current PDMPICREG version number. */
    1298 #define PDM_PICREG_VERSION                      PDM_VERSION_MAKE(0xfffa, 2, 0)
    1299 
    1300 /**
    1301  * PIC RC helpers.
    1302  */
    1303 typedef struct PDMPICHLPRC
    1304 {
    1305     /** Structure version. PDM_PICHLPRC_VERSION defines the current version. */
     1291#define PDM_PICREG_VERSION                      PDM_VERSION_MAKE(0xfffa, 3, 0)
     1292
     1293/**
     1294 * PIC helpers, same in all contexts.
     1295 */
     1296typedef struct PDMPICHLP
     1297{
     1298    /** Structure version. PDM_PICHLP_VERSION defines the current version. */
    13061299    uint32_t                u32Version;
    13071300
     
    13111304     * @param   pDevIns         Device instance of the PIC.
    13121305     */
    1313     DECLRCCALLBACKMEMBER(void, pfnSetInterruptFF,(PPDMDEVINS pDevIns));
     1306    DECLCALLBACKMEMBER(void, pfnSetInterruptFF)(PPDMDEVINS pDevIns);
    13141307
    13151308    /**
     
    13181311     * @param   pDevIns         Device instance of the PIC.
    13191312     */
    1320     DECLRCCALLBACKMEMBER(void, pfnClearInterruptFF,(PPDMDEVINS pDevIns));
     1313    DECLCALLBACKMEMBER(void, pfnClearInterruptFF)(PPDMDEVINS pDevIns);
    13211314
    13221315    /**
     
    13281321     * @param   rc              What to return if we fail to acquire the lock.
    13291322     */
    1330     DECLRCCALLBACKMEMBER(int,   pfnLock,(PPDMDEVINS pDevIns, int rc));
     1323    DECLCALLBACKMEMBER(int,   pfnLock)(PPDMDEVINS pDevIns, int rc);
    13311324
    13321325    /**
     
    13351328     * @param   pDevIns         The PIC device instance.
    13361329     */
    1337     DECLRCCALLBACKMEMBER(void,  pfnUnlock,(PPDMDEVINS pDevIns));
     1330    DECLCALLBACKMEMBER(void,  pfnUnlock)(PPDMDEVINS pDevIns);
    13381331
    13391332    /** Just a safety precaution. */
    13401333    uint32_t                u32TheEnd;
    1341 } PDMPICHLPRC;
    1342 
    1343 /** Pointer to PIC RC helpers. */
    1344 typedef RCPTRTYPE(PDMPICHLPRC *) PPDMPICHLPRC;
    1345 /** Pointer to const PIC RC helpers. */
    1346 typedef RCPTRTYPE(const PDMPICHLPRC *) PCPDMPICHLPRC;
    1347 
    1348 /** Current PDMPICHLPRC version number. */
    1349 #define PDM_PICHLPRC_VERSION                    PDM_VERSION_MAKE(0xfff9, 2, 0)
    1350 
    1351 
    1352 /**
    1353  * PIC R0 helpers.
    1354  */
    1355 typedef struct PDMPICHLPR0
    1356 {
    1357     /** Structure version. PDM_PICHLPR0_VERSION defines the current version. */
    1358     uint32_t                u32Version;
    1359 
    1360     /**
    1361      * Set the interrupt force action flag.
    1362      *
    1363      * @param   pDevIns         Device instance of the PIC.
    1364      */
    1365     DECLR0CALLBACKMEMBER(void, pfnSetInterruptFF,(PPDMDEVINS pDevIns));
    1366 
    1367     /**
    1368      * Clear the interrupt force action flag.
    1369      *
    1370      * @param   pDevIns         Device instance of the PIC.
    1371      */
    1372     DECLR0CALLBACKMEMBER(void, pfnClearInterruptFF,(PPDMDEVINS pDevIns));
    1373 
    1374     /**
    1375      * Acquires the PDM lock.
    1376      *
    1377      * @returns VINF_SUCCESS on success.
    1378      * @returns rc if we failed to acquire the lock.
    1379      * @param   pDevIns         The PIC device instance.
    1380      * @param   rc              What to return if we fail to acquire the lock.
    1381      */
    1382     DECLR0CALLBACKMEMBER(int,   pfnLock,(PPDMDEVINS pDevIns, int rc));
    1383 
    1384     /**
    1385      * Releases the PDM lock.
    1386      *
    1387      * @param   pDevIns         The PCI device instance.
    1388      */
    1389     DECLR0CALLBACKMEMBER(void,  pfnUnlock,(PPDMDEVINS pDevIns));
    1390 
    1391     /** Just a safety precaution. */
    1392     uint32_t                u32TheEnd;
    1393 } PDMPICHLPR0;
    1394 
    1395 /** Pointer to PIC R0 helpers. */
    1396 typedef R0PTRTYPE(PDMPICHLPR0 *) PPDMPICHLPR0;
    1397 /** Pointer to const PIC R0 helpers. */
    1398 typedef R0PTRTYPE(const PDMPICHLPR0 *) PCPDMPICHLPR0;
    1399 
    1400 /** Current PDMPICHLPR0 version number. */
    1401 #define PDM_PICHLPR0_VERSION                    PDM_VERSION_MAKE(0xfff8, 1, 0)
    1402 
    1403 /**
    1404  * PIC R3 helpers.
    1405  */
    1406 typedef struct PDMPICHLPR3
    1407 {
    1408     /** Structure version. PDM_PICHLP_VERSION defines the current version. */
    1409     uint32_t                u32Version;
    1410 
    1411     /**
    1412      * Set the interrupt force action flag.
    1413      *
    1414      * @param   pDevIns         Device instance of the PIC.
    1415      */
    1416     DECLR3CALLBACKMEMBER(void, pfnSetInterruptFF,(PPDMDEVINS pDevIns));
    1417 
    1418     /**
    1419      * Clear the interrupt force action flag.
    1420      *
    1421      * @param   pDevIns         Device instance of the PIC.
    1422      */
    1423     DECLR3CALLBACKMEMBER(void, pfnClearInterruptFF,(PPDMDEVINS pDevIns));
    1424 
    1425     /**
    1426      * Acquires the PDM lock.
    1427      *
    1428      * @returns VINF_SUCCESS on success.
    1429      * @returns Fatal error on failure.
    1430      * @param   pDevIns         The PIC device instance.
    1431      * @param   rc              Dummy for making the interface identical to the RC and R0 versions.
    1432      */
    1433     DECLR3CALLBACKMEMBER(int,   pfnLock,(PPDMDEVINS pDevIns, int rc));
    1434 
    1435     /**
    1436      * Releases the PDM lock.
    1437      *
    1438      * @param   pDevIns         The PIC device instance.
    1439      */
    1440     DECLR3CALLBACKMEMBER(void,  pfnUnlock,(PPDMDEVINS pDevIns));
    1441 
    1442     /**
    1443      * Gets the address of the RC PIC helpers.
    1444      *
    1445      * This should be called at both construction and relocation time
    1446      * to obtain the correct address of the RC helpers.
    1447      *
    1448      * @returns RC pointer to the PIC helpers.
    1449      * @param   pDevIns         Device instance of the PIC.
    1450      */
    1451     DECLR3CALLBACKMEMBER(PCPDMPICHLPRC, pfnGetRCHelpers,(PPDMDEVINS pDevIns));
    1452 
    1453     /**
    1454      * Gets the address of the R0 PIC helpers.
    1455      *
    1456      * This should be called at both construction and relocation time
    1457      * to obtain the correct address of the R0 helpers.
    1458      *
    1459      * @returns R0 pointer to the PIC helpers.
    1460      * @param   pDevIns         Device instance of the PIC.
    1461      */
    1462     DECLR3CALLBACKMEMBER(PCPDMPICHLPR0, pfnGetR0Helpers,(PPDMDEVINS pDevIns));
    1463 
    1464     /** Just a safety precaution. */
    1465     uint32_t                u32TheEnd;
    1466 } PDMPICHLPR3;
    1467 
    1468 /** Pointer to PIC R3 helpers. */
    1469 typedef R3PTRTYPE(PDMPICHLPR3 *) PPDMPICHLPR3;
    1470 /** Pointer to const PIC R3 helpers. */
    1471 typedef R3PTRTYPE(const PDMPICHLPR3 *) PCPDMPICHLPR3;
    1472 
    1473 /** Current PDMPICHLPR3 version number. */
    1474 #define PDM_PICHLPR3_VERSION                    PDM_VERSION_MAKE(0xfff7, 1, 0)
    1475 
     1334} PDMPICHLP;
     1335/** Pointer to PIC helpers. */
     1336typedef PDMPICHLP *PPDMPICHLP;
     1337/** Pointer to const PIC helpers. */
     1338typedef const PDMPICHLP *PCPDMPICHLP;
     1339
     1340/** Current PDMPICHLP version number. */
     1341#define PDM_PICHLP_VERSION                      PDM_VERSION_MAKE(0xfff9, 3, 0)
    14761342
    14771343
     
    40333899     * @param   pDevIns             The device instance.
    40343900     * @param   pPicReg             Pointer to a PIC registration structure.
    4035      * @param   ppPicHlpR3          Where to store the pointer to the PIC HC
     3901     * @param   ppPicHlp            Where to store the pointer to the ring-3 PIC
    40363902     *                              helpers.
    4037      */
    4038     DECLR3CALLBACKMEMBER(int, pfnPICRegister,(PPDMDEVINS pDevIns, PPDMPICREG pPicReg, PCPDMPICHLPR3 *ppPicHlpR3));
     3903     * @sa      PDMDevHlpPICSetUpContext
     3904     */
     3905    DECLR3CALLBACKMEMBER(int, pfnPICRegister,(PPDMDEVINS pDevIns, PPDMPICREG pPicReg, PCPDMPICHLP *ppPicHlp));
    40393906
    40403907    /**
     
    49554822    DECLRCCALLBACKMEMBER(int, pfnPCIBusSetUpContext,(PPDMDEVINS pDevIns, PPDMPCIBUSREGRC pPciBusReg, PCPDMPCIHLPRC *ppPciHlp));
    49564823
     4824    /**
     4825     * Sets up the PIC for the raw-mode context.
     4826     *
     4827     * This must be called after ring-3 has registered the PIC using
     4828     * PDMDevHlpPICRegister().
     4829     *
     4830     * @returns VBox status code.
     4831     * @param   pDevIns     The device instance.
     4832     * @param   pPicReg     The PIC registration information for ring-0,
     4833     *                      considered volatile and copied.
     4834     * @param   ppPciHlp    Where to return the raw-mode PIC helpers.
     4835     */
     4836    DECLRCCALLBACKMEMBER(int, pfnPCISetUpContext,(PPDMDEVINS pDevIns, PPDMPICREG pPicReg, PCPDMPICHLP *ppPicHlp));
     4837
    49574838    /** Space reserved for future members.
    49584839     * @{ */
     
    49784859
    49794860/** Current PDMDEVHLP version number. */
    4980 #define PDM_DEVHLPRC_VERSION                    PDM_VERSION_MAKE(0xffe6, 10, 0)
     4861#define PDM_DEVHLPRC_VERSION                    PDM_VERSION_MAKE(0xffe6, 11, 0)
    49814862
    49824863
     
    54155296     * @param   pDevIns     The device instance.
    54165297     * @param   pPciBusReg  The PCI bus registration information for ring-0,
    5417      *                      considered volatile.
     5298     *                      considered volatile and copied.
    54185299     * @param   ppPciHlp    Where to return the ring-0 PCI bus helpers.
    54195300     */
    54205301    DECLR0CALLBACKMEMBER(int, pfnPCIBusSetUpContext,(PPDMDEVINS pDevIns, PPDMPCIBUSREGR0 pPciBusReg, PCPDMPCIHLPR0 *ppPciHlp));
     5302
     5303    /**
     5304     * Sets up the PIC for the ring-0 context.
     5305     *
     5306     * This must be called after ring-3 has registered the PIC using
     5307     * PDMDevHlpPICRegister().
     5308     *
     5309     * @returns VBox status code.
     5310     * @param   pDevIns     The device instance.
     5311     * @param   pPicReg     The PIC registration information for ring-0,
     5312     *                      considered volatile and copied.
     5313     * @param   ppPciHlp    Where to return the ring-0 PIC helpers.
     5314     */
     5315    DECLR0CALLBACKMEMBER(int, pfnPICSetUpContext,(PPDMDEVINS pDevIns, PPDMPICREG pPicReg, PCPDMPICHLP *ppPicHlp));
    54215316
    54225317    /** Space reserved for future members.
     
    54435338
    54445339/** Current PDMDEVHLP version number. */
    5445 #define PDM_DEVHLPR0_VERSION                    PDM_VERSION_MAKE(0xffe5, 11, 0)
     5340#define PDM_DEVHLPR0_VERSION                    PDM_VERSION_MAKE(0xffe5, 12, 0)
    54465341
    54475342
     
    77597654#endif
    77607655
    7761 #ifdef IN_RING3
     7656#if defined(IN_RING3) || defined(DOXYGEN_RUNNING)
    77627657
    77637658/**
     
    78767771 * @copydoc PDMDEVHLPR3::pfnPICRegister
    78777772 */
    7878 DECLINLINE(int) PDMDevHlpPICRegister(PPDMDEVINS pDevIns, PPDMPICREG pPicReg, PCPDMPICHLPR3 *ppPicHlpR3)
    7879 {
    7880     return pDevIns->pHlpR3->pfnPICRegister(pDevIns, pPicReg, ppPicHlpR3);
     7773DECLINLINE(int) PDMDevHlpPICRegister(PPDMDEVINS pDevIns, PPDMPICREG pPicReg, PCPDMPICHLP *ppPicHlp)
     7774{
     7775    return pDevIns->pHlpR3->pfnPICRegister(pDevIns, pPicReg, ppPicHlp);
    78817776}
    78827777
     
    80177912}
    80187913
    8019 #else  /* !IN_RING3 */
    8020 
    8021 /**
    8022  * @copydoc PDMDEVHLPR0::pfnPCIBusSetUp
     7914#endif /* IN_RING3 || DOXYGEN_RUNNING */
     7915
     7916#if !defined(IN_RING3) || defined(DOXYGEN_RUNNING)
     7917
     7918/**
     7919 * @copydoc PDMDEVHLPR0::pfnPCIBusSetUpContext
    80237920 */
    80247921DECLINLINE(int) PDMDevHlpPCIBusSetUpContext(PPDMDEVINS pDevIns, CTX_SUFF(PPDMPCIBUSREG) pPciBusReg, CTX_SUFF(PCPDMPCIHLP) *ppPciHlp)
    80257922{
    80267923    return pDevIns->CTX_SUFF(pHlp)->pfnPCIBusSetUpContext(pDevIns, pPciBusReg, ppPciHlp);
     7924}
     7925
     7926/**
     7927 * @copydoc PDMDEVHLPR0::pfnPICSetUpContext
     7928 */
     7929DECLINLINE(int) PDMDevHlpPICSetUpContext(PPDMDEVINS pDevIns, PPDMPICREG pPicReg, PCPDMPICHLP *ppPicHlp)
     7930{
     7931    return pDevIns->CTX_SUFF(pHlp)->pfnPICSetUpContext(pDevIns, pPicReg, ppPicHlp);
    80277932}
    80287933
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