VirtualBox

Changeset 80679 in vbox


Ignore:
Timestamp:
Sep 9, 2019 6:26:59 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
133216
Message:

IOM,PDM,RTC: Add port sub-descriptions for a range. Fixed bug in statistics collection causing all access to be attributed to the first port in the range. Rearranged the stats for new I/O ports. bugref:9218

Location:
trunk
Files:
8 edited

Legend:

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

    r80649 r80679  
    243243typedef FNIOMIOPORTOUTSTRING *PFNIOMIOPORTOUTSTRING;
    244244
     245/**
     246 * I/O port description.
     247 *
     248 * If both pszIn and pszOut are NULL, the entry is considered a terminator.
     249 */
     250typedef struct IOMIOPORTDESC
     251{
     252    /** Brief description / name of the IN port. */
     253    const char *pszIn;
     254    /** Brief description / name of the OUT port. */
     255    const char *pszOut;
     256    /** Detailed description of the IN port, optional. */
     257    const char *pszInDetail;
     258    /** Detialed description of the OUT port, optional. */
     259    const char *pszOutDetail;
     260} IOMIOPORTDESC;
     261/** Pointer to an I/O port description. */
     262typedef IOMIOPORTDESC const *PCIOMIOPORTDESC;
     263
    245264
    246265/**
     
    321340                                       uint32_t iPciRegion, PFNIOMIOPORTOUT pfnOut, PFNIOMIOPORTIN pfnIn,
    322341                                       PFNIOMIOPORTOUTSTRING pfnOutStr, PFNIOMIOPORTINSTRING pfnInStr, RTR3PTR pvUser,
    323                                        const char *pszDesc, PIOMIOPORTHANDLE phIoPorts);
     342                                       const char *pszDesc, PCIOMIOPORTDESC paExtDescs, PIOMIOPORTHANDLE phIoPorts);
    324343VMMR3_INT_DECL(int)  IOMR3IoPortMap(PVM pVM, PPDMDEVINS pDevIns, IOMIOPORTHANDLE hIoPorts, RTIOPORT Port);
    325344VMMR3_INT_DECL(int)  IOMR3IoPortUnmap(PVM pVM, PPDMDEVINS pDevIns, IOMIOPORTHANDLE hIoPorts);
  • trunk/include/VBox/vmm/pdmdev.h

    r80673 r80679  
    21902190     * @param   pvUser      User argument to pass to the callbacks.
    21912191     * @param   pszDesc     Pointer to description string. This must not be freed.
     2192     * @param   paExtDescs  Extended per-port descriptions, optional.  Partial range
     2193     *                      coverage is allowed.  This must not be freed.
    21922194     * @param   phIoPorts   Where to return the I/O port range handle.
    21932195     *
     
    21982200     *          PDMDevHlpIoPortUnmap.
    21992201     */
    2200     DECLR3CALLBACKMEMBER(int, pfnIoPortCreateEx,(PPDMDEVINS pDevIns, RTIOPORT cPorts,
    2201                                                  uint32_t fFlags, PPDMPCIDEV pPciDev, uint32_t iPciRegion,
    2202                                                  PFNIOMIOPORTOUT pfnOut, PFNIOMIOPORTIN pfnIn,
    2203                                                  PFNIOMIOPORTOUTSTRING pfnOutStr, PFNIOMIOPORTINSTRING pfnInStr,
    2204                                                  RTR3PTR pvUser, const char *pszDesc, PIOMIOPORTHANDLE phIoPorts));
     2202    DECLR3CALLBACKMEMBER(int, pfnIoPortCreateEx,(PPDMDEVINS pDevIns, RTIOPORT cPorts, uint32_t fFlags, PPDMPCIDEV pPciDev,
     2203                                                 uint32_t iPciRegion, PFNIOMIOPORTOUT pfnOut, PFNIOMIOPORTIN pfnIn,
     2204                                                 PFNIOMIOPORTOUTSTRING pfnOutStr, PFNIOMIOPORTINSTRING pfnInStr, RTR3PTR pvUser,
     2205                                                 const char *pszDesc, PCIOMIOPORTDESC paExtDescs, PIOMIOPORTHANDLE phIoPorts));
    22052206
    22062207    /**
     
    53705371 */
    53715372DECLINLINE(int) PDMDevHlpIoPortCreateAndMap(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts, PFNIOMIOPORTOUT pfnOut,
    5372                                             PFNIOMIOPORTIN pfnIn, const char *pszDesc, PIOMIOPORTHANDLE phIoPorts)
     5373                                            PFNIOMIOPORTIN pfnIn, const char *pszDesc, PCIOMIOPORTDESC paExtDescs,
     5374                                            PIOMIOPORTHANDLE phIoPorts)
    53735375{
    53745376    int rc = pDevIns->pHlpR3->pfnIoPortCreateEx(pDevIns, cPorts, 0, NULL, UINT32_MAX,
    5375                                                 pfnOut, pfnIn, NULL, NULL, NULL, pszDesc, phIoPorts);
     5377                                                pfnOut, pfnIn, NULL, NULL, NULL, pszDesc, paExtDescs, phIoPorts);
    53765378    if (RT_SUCCESS(rc))
    53775379        rc = pDevIns->pHlpR3->pfnIoPortMap(pDevIns, *phIoPorts, Port);
     
    53845386DECLINLINE(int) PDMDevHlpIoPortCreate(PPDMDEVINS pDevIns, RTIOPORT cPorts, PPDMPCIDEV pPciDev, uint32_t iPciRegion,
    53855387                                      PFNIOMIOPORTOUT pfnOut, PFNIOMIOPORTIN pfnIn, void *pvUser, const char *pszDesc,
    5386                                       PIOMIOPORTHANDLE phIoPorts)
     5388                                      PCIOMIOPORTDESC paExtDescs, PIOMIOPORTHANDLE phIoPorts)
    53875389{
    53885390    return pDevIns->pHlpR3->pfnIoPortCreateEx(pDevIns, cPorts, 0, pPciDev, iPciRegion,
    5389                                               pfnOut, pfnIn, NULL, NULL, pvUser, pszDesc, phIoPorts);
     5391                                              pfnOut, pfnIn, NULL, NULL, pvUser, pszDesc, paExtDescs, phIoPorts);
    53905392}
    53915393
     
    53955397DECLINLINE(int) PDMDevHlpIoPortCreateEx(PPDMDEVINS pDevIns, RTIOPORT cPorts, uint32_t fFlags, PPDMPCIDEV pPciDev,
    53965398                                        uint32_t iPciRegion, PFNIOMIOPORTOUT pfnOut, PFNIOMIOPORTIN pfnIn,
    5397                                         PFNIOMIOPORTOUTSTRING pfnOutStr, PFNIOMIOPORTINSTRING pfnInStr,
    5398                                         void *pvUser, const char *pszDesc, PIOMIOPORTHANDLE phIoPorts)
     5399                                        PFNIOMIOPORTOUTSTRING pfnOutStr, PFNIOMIOPORTINSTRING pfnInStr, void *pvUser,
     5400                                        const char *pszDesc, PCIOMIOPORTDESC paExtDescs, PIOMIOPORTHANDLE phIoPorts)
    53995401{
    54005402    return pDevIns->pHlpR3->pfnIoPortCreateEx(pDevIns, cPorts, fFlags, pPciDev, iPciRegion,
    5401                                               pfnOut, pfnIn, pfnOutStr, pfnInStr, pvUser, pszDesc, phIoPorts);
     5403                                              pfnOut, pfnIn, pfnOutStr, pfnInStr, pvUser, pszDesc, paExtDescs, phIoPorts);
    54025404}
    54035405
  • trunk/src/VBox/Devices/PC/DevRTC.cpp

    r80672 r80679  
    12041204     * Register I/O ports.
    12051205     */
     1206    static const IOMIOPORTDESC g_aIoPortDescs[] =
     1207    {
     1208        { NULL, "ADDR - CMOS Bank #1", NULL, NULL },
     1209        { "DATA - CMOS Bank #1", "DATA - CMOS Bank #1", NULL, NULL },
     1210        { NULL, "ADDR - CMOS Bank #2", NULL, NULL },
     1211        { "DATA - CMOS Bank #2", "DATA - CMOS Bank #2", NULL, NULL },
     1212        { NULL, NULL, NULL, NULL }
     1213    };
    12061214    rc = PDMDevHlpIoPortCreateAndMap(pDevIns, pThis->IOPortBase, 4, rtcIOPortWrite, rtcIOPortRead,
    1207                                      "MC146818 RTC/CMOS", &pThis->hIoPorts);
     1215                                     "MC146818 RTC/CMOS", g_aIoPortDescs, &pThis->hIoPorts);
    12081216    AssertRCReturn(rc, rc);
    12091217
  • trunk/src/VBox/VMM/VMMAll/IOMAll.cpp

    r80641 r80679  
    9393     * Get the entry for the current context.
    9494     */
    95     CTX_SUFF(PIOMIOPORTENTRY) pRegEntry = iomIoPortGetEntry(pVM, Port, &pVCpu->iom.s.idxIoPortLastRead);
     95    uint16_t offPort;
     96    CTX_SUFF(PIOMIOPORTENTRY) pRegEntry = iomIoPortGetEntry(pVM, Port, &offPort, &pVCpu->iom.s.idxIoPortLastRead);
    9697    if (pRegEntry)
    9798    {
    9899#ifdef VBOX_WITH_STATISTICS
    99         PIOMIOPORTSTATSENTRY  pStats    = iomIoPortGetStats(pVM, pRegEntry);
     100        PIOMIOPORTSTATSENTRY  pStats    = iomIoPortGetStats(pVM, pRegEntry, offPort);
    100101#endif
    101102
     
    337338     * Get the entry for the current context.
    338339     */
    339     CTX_SUFF(PIOMIOPORTENTRY) pRegEntry = iomIoPortGetEntry(pVM, uPort, &pVCpu->iom.s.idxIoPortLastReadStr);
     340    uint16_t offPort;
     341    CTX_SUFF(PIOMIOPORTENTRY) pRegEntry = iomIoPortGetEntry(pVM, uPort, &offPort, &pVCpu->iom.s.idxIoPortLastReadStr);
    340342    if (pRegEntry)
    341343    {
    342344#ifdef VBOX_WITH_STATISTICS
    343         PIOMIOPORTSTATSENTRY  pStats    = iomIoPortGetStats(pVM, pRegEntry);
     345        PIOMIOPORTSTATSENTRY  pStats    = iomIoPortGetStats(pVM, pRegEntry, offPort);
    344346#endif
    345347
     
    658660     * Get the entry for the current context.
    659661     */
    660     CTX_SUFF(PIOMIOPORTENTRY) pRegEntry = iomIoPortGetEntry(pVM, Port, &pVCpu->iom.s.idxIoPortLastWrite);
     662    uint16_t offPort;
     663    CTX_SUFF(PIOMIOPORTENTRY) pRegEntry = iomIoPortGetEntry(pVM, Port, &offPort, &pVCpu->iom.s.idxIoPortLastWrite);
    661664    if (pRegEntry)
    662665    {
    663666#ifdef VBOX_WITH_STATISTICS
    664         PIOMIOPORTSTATSENTRY  pStats    = iomIoPortGetStats(pVM, pRegEntry);
     667        PIOMIOPORTSTATSENTRY  pStats    = iomIoPortGetStats(pVM, pRegEntry, offPort);
    665668#endif
    666669
     
    878881     * Get the entry for the current context.
    879882     */
    880     CTX_SUFF(PIOMIOPORTENTRY) pRegEntry = iomIoPortGetEntry(pVM, uPort, &pVCpu->iom.s.idxIoPortLastWriteStr);
     883    uint16_t offPort;
     884    CTX_SUFF(PIOMIOPORTENTRY) pRegEntry = iomIoPortGetEntry(pVM, uPort, &offPort, &pVCpu->iom.s.idxIoPortLastWriteStr);
    881885    if (pRegEntry)
    882886    {
    883887#ifdef VBOX_WITH_STATISTICS
    884         PIOMIOPORTSTATSENTRY  pStats    = iomIoPortGetStats(pVM, pRegEntry);
     888        PIOMIOPORTSTATSENTRY  pStats    = iomIoPortGetStats(pVM, pRegEntry, offPort);
    885889#endif
    886890
  • trunk/src/VBox/VMM/VMMR3/IOM.cpp

    r80649 r80679  
    454454                                       uint32_t iPciRegion, PFNIOMIOPORTOUT pfnOut, PFNIOMIOPORTIN pfnIn,
    455455                                       PFNIOMIOPORTOUTSTRING pfnOutStr, PFNIOMIOPORTINSTRING pfnInStr, RTR3PTR pvUser,
    456                                        const char *pszDesc, PIOMIOPORTHANDLE phIoPorts)
     456                                       const char *pszDesc, PCIOMIOPORTDESC paExtDescs, PIOMIOPORTHANDLE phIoPorts)
    457457{
    458458    /*
     
    477477    AssertReturn(*pszDesc != '\0', VERR_INVALID_POINTER);
    478478    AssertReturn(strlen(pszDesc) < 128, VERR_INVALID_POINTER);
     479    if (paExtDescs)
     480    {
     481        AssertPtrReturn(paExtDescs, VERR_INVALID_POINTER);
     482        for (size_t i = 0;; i++)
     483        {
     484            const char *pszIn  = paExtDescs[i].pszIn;
     485            const char *pszOut = paExtDescs[i].pszIn;
     486            if (!pszIn && !pszOut)
     487                break;
     488            AssertReturn(i < _8K, VERR_OUT_OF_RANGE);
     489            AssertReturn(!pszIn  || strlen(pszIn)  < 128, VERR_INVALID_POINTER);
     490            AssertReturn(!pszOut || strlen(pszOut) < 128, VERR_INVALID_POINTER);
     491        }
     492    }
    479493
    480494    /*
     
    515529    pVM->iom.s.paIoPortRegs[idx].pfnInStrCallback   = pfnInStr  ? pfnInStr  : iomR3IOPortDummyInStr;
    516530    pVM->iom.s.paIoPortRegs[idx].pszDesc            = pszDesc;
     531    pVM->iom.s.paIoPortRegs[idx].paExtDescs         = paExtDescs;
    517532    pVM->iom.s.paIoPortRegs[idx].pPciDev            = pPciDev;
    518533    pVM->iom.s.paIoPortRegs[idx].iPciRegion         = iPciRegion;
     
    772787static void iomR3IoPortRegStats(PVM pVM, PIOMIOPORTENTRYR3 pRegEntry)
    773788{
    774     PIOMIOPORTSTATSENTRY pStats   = &pVM->iom.s.paIoPortStats[pRegEntry->idxStats];
    775     const char * const   pszDesc  = pRegEntry->pszDesc;
    776     unsigned             uPort    = pRegEntry->uPort;
    777     unsigned const       uEndPort = uPort + (unsigned)pRegEntry->cPorts;
     789    PIOMIOPORTSTATSENTRY pStats     = &pVM->iom.s.paIoPortStats[pRegEntry->idxStats];
     790    PCIOMIOPORTDESC      pExtDesc   = pRegEntry->paExtDescs;
     791    unsigned             uPort      = pRegEntry->uPort;
     792    unsigned const       uFirstPort = uPort;
     793    unsigned const       uEndPort   = uPort + pRegEntry->cPorts;
     794
     795    /* Register a dummy statistics for the prefix. */
     796    char                 szName[80];
     797    size_t cchPrefix;
     798    if (uFirstPort < uEndPort - 1)
     799        cchPrefix = RTStrPrintf(szName, sizeof(szName), "/IOM/NewPorts/%04x-%04x", uFirstPort, uEndPort - 1);
     800    else
     801        cchPrefix = RTStrPrintf(szName, sizeof(szName), "/IOM/NewPorts/%04x", uPort);
     802    int rc = STAMR3Register(pVM, &pRegEntry->idxSelf, STAMTYPE_U16, STAMVISIBILITY_ALWAYS, szName,
     803                            STAMUNIT_NONE, pRegEntry->pszDesc);
     804    AssertRC(rc);
     805
     806
     807    /* Register stats for each port under it */
    778808    do
    779809    {
    780         char   szName[80];
    781         size_t cchBaseNm = RTStrPrintf(szName, sizeof(szName), "/IOM/NewStylePorts/%04x-", uPort);
    782         int    rc;
     810        size_t cchBaseNm;
     811        if (uFirstPort < uEndPort - 1)
     812            cchBaseNm = cchPrefix + RTStrPrintf(&szName[cchPrefix], sizeof(szName) - cchPrefix, "/%04x-", uPort);
     813        else
     814        {
     815            szName[cchPrefix] = '/';
     816            cchBaseNm = cchPrefix + 1;
     817        }
    783818
    784819# define SET_NM_SUFFIX(a_sz) memcpy(&szName[cchBaseNm], a_sz, sizeof(a_sz));
     820        const char * const pszInDesc  = pExtDesc ? pExtDesc->pszIn  : NULL;
     821        const char * const pszOutDesc = pExtDesc ? pExtDesc->pszOut : NULL;
    785822
    786823        /* register the statistics counters. */
    787824        SET_NM_SUFFIX("In-R3");
    788         rc = STAMR3Register(pVM, &pStats->InR3,      STAMTYPE_COUNTER, STAMVISIBILITY_USED, szName, STAMUNIT_OCCURENCES, pszDesc); AssertRC(rc);
     825        rc = STAMR3Register(pVM, &pStats->InR3,      STAMTYPE_COUNTER, STAMVISIBILITY_USED, szName, STAMUNIT_OCCURENCES, pszInDesc); AssertRC(rc);
    789826        SET_NM_SUFFIX("Out-R3");
    790         rc = STAMR3Register(pVM, &pStats->OutR3,     STAMTYPE_COUNTER, STAMVISIBILITY_USED, szName, STAMUNIT_OCCURENCES, pszDesc); AssertRC(rc);
     827        rc = STAMR3Register(pVM, &pStats->OutR3,     STAMTYPE_COUNTER, STAMVISIBILITY_USED, szName, STAMUNIT_OCCURENCES, pszOutDesc); AssertRC(rc);
    791828        SET_NM_SUFFIX("In-RZ");
    792         rc = STAMR3Register(pVM, &pStats->InRZ,      STAMTYPE_COUNTER, STAMVISIBILITY_USED, szName, STAMUNIT_OCCURENCES, pszDesc); AssertRC(rc);
     829        rc = STAMR3Register(pVM, &pStats->InRZ,      STAMTYPE_COUNTER, STAMVISIBILITY_USED, szName, STAMUNIT_OCCURENCES, pszInDesc); AssertRC(rc);
    793830        SET_NM_SUFFIX("Out-RZ");
    794         rc = STAMR3Register(pVM, &pStats->OutRZ,     STAMTYPE_COUNTER, STAMVISIBILITY_USED, szName, STAMUNIT_OCCURENCES, pszDesc); AssertRC(rc);
     831        rc = STAMR3Register(pVM, &pStats->OutRZ,     STAMTYPE_COUNTER, STAMVISIBILITY_USED, szName, STAMUNIT_OCCURENCES, pszOutDesc); AssertRC(rc);
    795832        SET_NM_SUFFIX("In-RZtoR3");
    796         rc = STAMR3Register(pVM, &pStats->InRZToR3,  STAMTYPE_COUNTER, STAMVISIBILITY_USED, szName, STAMUNIT_OCCURENCES, pszDesc); AssertRC(rc);
     833        rc = STAMR3Register(pVM, &pStats->InRZToR3,  STAMTYPE_COUNTER, STAMVISIBILITY_USED, szName, STAMUNIT_OCCURENCES, NULL); AssertRC(rc);
    797834        SET_NM_SUFFIX("Out-RZtoR3");
    798         rc = STAMR3Register(pVM, &pStats->OutRZToR3, STAMTYPE_COUNTER, STAMVISIBILITY_USED, szName, STAMUNIT_OCCURENCES, pszDesc); AssertRC(rc);
     835        rc = STAMR3Register(pVM, &pStats->OutRZToR3, STAMTYPE_COUNTER, STAMVISIBILITY_USED, szName, STAMUNIT_OCCURENCES, NULL); AssertRC(rc);
    799836
    800837        /* Profiling */
    801         SET_NM_SUFFIX("In-R3/Prof");
    802         rc = STAMR3Register(pVM, &pStats->ProfInR3,  STAMTYPE_PROFILE, STAMVISIBILITY_USED, szName, STAMUNIT_TICKS_PER_CALL, pszDesc); AssertRC(rc);
    803         SET_NM_SUFFIX("Out-R3/Prof");
    804         rc = STAMR3Register(pVM, &pStats->ProfOutR3, STAMTYPE_PROFILE, STAMVISIBILITY_USED, szName, STAMUNIT_TICKS_PER_CALL, pszDesc); AssertRC(rc);
    805         SET_NM_SUFFIX("In-RZ/Prof");
    806         rc = STAMR3Register(pVM, &pStats->ProfInRZ,  STAMTYPE_PROFILE, STAMVISIBILITY_USED, szName, STAMUNIT_TICKS_PER_CALL, pszDesc); AssertRC(rc);
    807         SET_NM_SUFFIX("Out-RZ/Prof");
    808         rc = STAMR3Register(pVM, &pStats->ProfOutRZ, STAMTYPE_PROFILE, STAMVISIBILITY_USED, szName, STAMUNIT_TICKS_PER_CALL, pszDesc); AssertRC(rc);
     838        SET_NM_SUFFIX("In-R3-Prof");
     839        rc = STAMR3Register(pVM, &pStats->ProfInR3,  STAMTYPE_PROFILE, STAMVISIBILITY_USED, szName, STAMUNIT_TICKS_PER_CALL, pszInDesc); AssertRC(rc);
     840        SET_NM_SUFFIX("Out-R3-Prof");
     841        rc = STAMR3Register(pVM, &pStats->ProfOutR3, STAMTYPE_PROFILE, STAMVISIBILITY_USED, szName, STAMUNIT_TICKS_PER_CALL, pszOutDesc); AssertRC(rc);
     842        SET_NM_SUFFIX("In-RZ-Prof");
     843        rc = STAMR3Register(pVM, &pStats->ProfInRZ,  STAMTYPE_PROFILE, STAMVISIBILITY_USED, szName, STAMUNIT_TICKS_PER_CALL, pszInDesc); AssertRC(rc);
     844        SET_NM_SUFFIX("Out-RZ-Prof");
     845        rc = STAMR3Register(pVM, &pStats->ProfOutRZ, STAMTYPE_PROFILE, STAMVISIBILITY_USED, szName, STAMUNIT_TICKS_PER_CALL, pszOutDesc); AssertRC(rc);
    809846
    810847        pStats++;
    811848        uPort++;
     849        if (pExtDesc)
     850            pExtDesc = pszInDesc || pszOutDesc ? pExtDesc + 1 : NULL;
    812851    } while (uPort < uEndPort);
    813852}
     
    819858static void iomR3IoPortDeregStats(PVM pVM, PIOMIOPORTENTRYR3 pRegEntry, unsigned uPort)
    820859{
    821     PIOMIOPORTSTATSENTRY pStats   = &pVM->iom.s.paIoPortStats[pRegEntry->idxStats];
    822     unsigned const       uEndPort = uPort + (unsigned)pRegEntry->cPorts;
    823     do
    824     {
    825         char szPrefix[80];
    826         RTStrPrintf(szPrefix, sizeof(szPrefix), "/IOM/NewStylePorts/%04x-", uPort);
    827         STAMR3DeregisterByPrefix(pVM->pUVM, szPrefix);
    828 
    829         pStats++;
    830         uPort++;
    831     } while (uPort < uEndPort);
     860    char   szPrefix[80];
     861    size_t cchPrefix;
     862    if (pRegEntry->cPorts > 1)
     863        cchPrefix = RTStrPrintf(szPrefix, sizeof(szPrefix), "/IOM/NewPorts/%04x-%04x/", uPort, uPort + pRegEntry->cPorts - 1);
     864    else
     865        cchPrefix = RTStrPrintf(szPrefix, sizeof(szPrefix), "/IOM/NewPorts/%04x/", uPort);
     866    STAMR3DeregisterByPrefix(pVM->pUVM, szPrefix);
    832867}
    833868
  • trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp

    r80677 r80679  
    9898
    9999/** @interface_method_impl{PDMDEVHLPR3,pfnIoPortCreateEx} */
    100 static DECLCALLBACK(int) pdmR3DevHlp_IoPortCreateEx(PPDMDEVINS pDevIns, RTIOPORT cPorts,
    101                                                     uint32_t fFlags, PPDMPCIDEV pPciDev, uint32_t iPciRegion,
    102                                                     PFNIOMIOPORTOUT pfnOut, PFNIOMIOPORTIN pfnIn,
    103                                                     PFNIOMIOPORTOUTSTRING pfnOutStr, PFNIOMIOPORTINSTRING pfnInStr,
    104                                                     RTR3PTR pvUser, const char *pszDesc, PIOMIOPORTHANDLE phIoPorts)
    105 {
    106     PDMDEV_ASSERT_DEVINS(pDevIns);
    107     LogFlow(("pdmR3DevHlp_IoPortCreateEx: caller='%s'/%d: cPorts=%#x fFlags=%#x pPciDev=%p iPciRegion=%#x pfnOut=%p pfnIn=%p pfnOutStr=%p pfnInStr=%p pvUser=%p pszDesc=%p:{%s} phIoPorts=%p\n",
     100static DECLCALLBACK(int) pdmR3DevHlp_IoPortCreateEx(PPDMDEVINS pDevIns, RTIOPORT cPorts, uint32_t fFlags, PPDMPCIDEV pPciDev,
     101                                                    uint32_t iPciRegion, PFNIOMIOPORTOUT pfnOut, PFNIOMIOPORTIN pfnIn,
     102                                                    PFNIOMIOPORTOUTSTRING pfnOutStr, PFNIOMIOPORTINSTRING pfnInStr, RTR3PTR pvUser,
     103                                                    const char *pszDesc, PCIOMIOPORTDESC paExtDescs, PIOMIOPORTHANDLE phIoPorts)
     104{
     105    PDMDEV_ASSERT_DEVINS(pDevIns);
     106    LogFlow(("pdmR3DevHlp_IoPortCreateEx: caller='%s'/%d: cPorts=%#x fFlags=%#x pPciDev=%p iPciRegion=%#x pfnOut=%p pfnIn=%p pfnOutStr=%p pfnInStr=%p pvUser=%p pszDesc=%p:{%s} paExtDescs=%p phIoPorts=%p\n",
    108107             pDevIns->pReg->szName, pDevIns->iInstance, cPorts, fFlags, pPciDev, iPciRegion, pfnOut, pfnIn, pfnOutStr, pfnInStr,
    109              pvUser, pszDesc, pszDesc, phIoPorts));
     108             pvUser, pszDesc, pszDesc, paExtDescs, phIoPorts));
    110109    PVM pVM = pDevIns->Internal.s.pVMR3;
    111110    VM_ASSERT_EMT0_RETURN(pVM, VERR_VM_THREAD_NOT_EMT);
     
    113112
    114113    int rc = IOMR3IoPortCreate(pVM, pDevIns, cPorts, fFlags, pPciDev, iPciRegion,
    115                                pfnOut, pfnIn, pfnOutStr, pfnInStr, pvUser, pszDesc, phIoPorts);
     114                               pfnOut, pfnIn, pfnOutStr, pfnInStr, pvUser, pszDesc, paExtDescs, phIoPorts);
    116115
    117116    LogFlow(("pdmR3DevHlp_IoPortCreateEx: caller='%s'/%d: returns %Rrc (*phIoPorts=%#x)\n",
  • trunk/src/VBox/VMM/include/IOMInline.h

    r80675 r80679  
    3838 * @param   pVM             The cross context VM structure.
    3939 * @param   uPort           The I/O port lookup.
     40 * @param   poffPort        Where to the port offset relative to the start of
     41 *                          the I/O port range.
    4042 * @param   pidxLastHint    Pointer to IOMCPU::idxIoPortLastRead or
    4143 *                          IOMCPU::idxIoPortLastWrite.
     
    4648 *          entry.
    4749 */
    48 DECLINLINE(CTX_SUFF(PIOMIOPORTENTRY)) iomIoPortGetEntry(PVMCC pVM, RTIOPORT uPort, uint16_t *pidxLastHint)
     50DECLINLINE(CTX_SUFF(PIOMIOPORTENTRY)) iomIoPortGetEntry(PVMCC pVM, RTIOPORT uPort, PRTIOPORT poffPort, uint16_t *pidxLastHint)
    4951{
    5052    Assert(IOM_IS_SHARED_LOCK_OWNER(pVM));
    5153
    5254#ifdef IN_RING0
    53     uint32_t              iEnd      = RT_MIN(pVM->iom.s.cIoPortLookupEntries, pVM->iomr0.s.cIoPortAlloc);
    54     PIOMIOPORTLOOKUPENTRY paLookup  = pVM->iomr0.s.paIoPortLookup;
     55    uint32_t               iEnd      = RT_MIN(pVM->iom.s.cIoPortLookupEntries, pVM->iomr0.s.cIoPortAlloc);
     56    PCIOMIOPORTLOOKUPENTRY paLookup  = pVM->iomr0.s.paIoPortLookup;
    5557#else
    56     uint32_t              iEnd      = pVM->iom.s.cIoPortLookupEntries;
    57     PIOMIOPORTLOOKUPENTRY paLookup  = pVM->iom.s.paIoPortLookup;
     58    uint32_t               iEnd      = pVM->iom.s.cIoPortLookupEntries;
     59    PCIOMIOPORTLOOKUPENTRY paLookup  = pVM->iom.s.paIoPortLookup;
    5860#endif
    5961    if (iEnd > 0)
     
    6769        for (;;)
    6870        {
    69             PIOMIOPORTLOOKUPENTRY pCur = &paLookup[i];
     71            PCIOMIOPORTLOOKUPENTRY pCur = &paLookup[i];
    7072            if (pCur->uFirstPort > uPort)
    7173            {
     
    7375                    iEnd = i;
    7476                else
    75                     return NULL;
     77                    break;
    7678            }
    7779            else if (pCur->uLastPort < uPort)
     
    8183                    iFirst = i;
    8284                else
    83                     return NULL;
     85                    break;
    8486            }
    8587            else
    8688            {
    8789                *pidxLastHint = (uint16_t)i;
     90                *poffPort     = uPort - pCur->uFirstPort;
    8891
    8992                /*
     
    107110        }
    108111    }
     112    *poffPort = 0;
    109113    return NULL;
    110114}
     
    120124 * @param   pVM         The cross context VM structure.
    121125 * @param   pRegEntry   The I/O port entry to get stats for.
    122  */
    123 DECLINLINE(PIOMIOPORTSTATSENTRY) iomIoPortGetStats(PVMCC pVM, CTX_SUFF(PIOMIOPORTENTRY) pRegEntry)
     126 * @param   offPort     The offset of the  port relative to the start of the
     127 *                      registration entry.
     128 */
     129DECLINLINE(PIOMIOPORTSTATSENTRY) iomIoPortGetStats(PVMCC pVM, CTX_SUFF(PIOMIOPORTENTRY) pRegEntry, uint16_t offPort)
    124130{
    125131    size_t idxStats = pRegEntry->idxStats;
     132    idxStats += offPort;
    126133# ifdef IN_RING0
    127134    if (idxStats < pVM->iomr0.s.cIoPortStatsAllocation)
  • trunk/src/VBox/VMM/include/IOMInternal.h

    r80641 r80679  
    205205    /** Description / Name. For easing debugging. */
    206206    R3PTRTYPE(const char *)             pszDesc;
     207    /** Extended port description table, optional. */
     208    R3PTRTYPE(PCIOMIOPORTDESC)          paExtDescs;
    207209    /** PCI device the registration is associated with. */
    208210    R3PTRTYPE(PPDMPCIDEV)               pPciDev;
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