VirtualBox

Changeset 81908 in vbox for trunk/src


Ignore:
Timestamp:
Nov 17, 2019 3:12:57 PM (5 years ago)
Author:
vboxsync
Message:

DevPit-i8254: Cleanups. bugref:9218

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/DevPit-i8254.cpp

    r81907 r81908  
    273273
    274274
    275 /*********************************************************************************************************************************
    276 *   Internal Functions                                                                                                           *
    277 *********************************************************************************************************************************/
    278 #ifdef IN_RING3
    279 static void pit_irq_timer_update(PPDMDEVINS pDevIns, PPITSTATE pThis, PPITCHANNEL pChan,
    280                                  uint64_t current_time, uint64_t now, bool in_timer);
    281 #endif
    282 
    283 
    284 #ifdef IN_RING3
    285 # ifdef RT_OS_LINUX
    286 static int pitTryDeviceOpen(const char *pszPath, int flags)
    287 {
    288     int fd = open(pszPath, flags);
    289     if (fd == -1)
    290         LogRel(("PIT: speaker: cannot open \"%s\", errno=%d\n", pszPath, errno));
    291     else
    292         LogRel(("PIT: speaker: opened \"%s\"\n", pszPath));
    293     return fd;
    294 }
    295 
    296 static int pitTryDeviceOpenSanitizeIoctl(const char *pszPath, int flags)
    297 {
    298     int fd = open(pszPath, flags);
    299     if (fd == -1)
    300         LogRel(("PIT: speaker: cannot open \"%s\", errno=%d\n", pszPath, errno));
    301     else
    302     {
    303         int errno_eviocgsnd0 = 0;
    304         int errno_kiocsound = 0;
    305         if (ioctl(fd, EVIOCGSND(0)) == -1)
    306         {
    307             errno_eviocgsnd0 = errno;
    308             if (ioctl(fd, KIOCSOUND, 1) == -1)
    309                 errno_kiocsound = errno;
    310             else
    311                 ioctl(fd, KIOCSOUND, 0);
    312         }
    313         if (errno_eviocgsnd0 && errno_kiocsound)
    314         {
    315             LogRel(("PIT: speaker: cannot use \"%s\", ioctl failed errno=%d/errno=%d\n", pszPath, errno_eviocgsnd0, errno_kiocsound));
    316             close(fd);
    317             fd = -1;
    318         }
    319         else
    320             LogRel(("PIT: speaker: opened \"%s\"\n", pszPath));
    321     }
    322     return fd;
    323 }
    324 # endif /* RT_OS_LINUX */
    325 #endif /* IN_RING3 */
    326275
    327276static int pit_get_count(PPDMDEVINS pDevIns, PPITSTATE pThis, PPITCHANNEL pChan)
     
    371320    return counter;
    372321}
     322
    373323
    374324/* get pit output bit */
     
    437387#ifdef IN_RING3
    438388
    439 /* val must be 0 or 1 */
    440 static void pit_set_gate(PPDMDEVINS pDevIns, PPITSTATE pThis, int channel, int val)
    441 {
    442     PPITCHANNEL     pChan  = &pThis->channels[channel];
    443     TMTIMERHANDLE   hTimer = pThis->channels[0].hTimer;
    444 
    445     Assert((val & 1) == val);
    446     Assert(PDMDevHlpTimerIsLockOwner(pDevIns, hTimer));
    447 
    448     switch (EFFECTIVE_MODE(pChan->mode))
    449     {
    450         default:
    451         case 0:
    452         case 4:
    453             /* XXX: just disable/enable counting */
    454             break;
    455         case 1:
    456         case 5:
    457             if (pChan->gate < val)
    458             {
    459                 /* restart counting on rising edge */
    460                 Log(("pit_set_gate: restarting mode %d\n", pChan->mode));
    461                 pChan->count_load_time = PDMDevHlpTimerGet(pDevIns, hTimer);
    462                 pit_irq_timer_update(pDevIns, pThis, pChan, pChan->count_load_time, pChan->count_load_time, false);
    463             }
    464             break;
    465         case 2:
    466         case 3:
    467             if (pChan->gate < val)
    468             {
    469                 /* restart counting on rising edge */
    470                 Log(("pit_set_gate: restarting mode %d\n", pChan->mode));
    471                 pChan->count_load_time = pChan->u64ReloadTS = PDMDevHlpTimerGet(pDevIns, hTimer);
    472                 pit_irq_timer_update(pDevIns, pThis, pChan, pChan->count_load_time, pChan->count_load_time, false);
    473             }
    474             /* XXX: disable/enable counting */
    475             break;
    476     }
    477     pChan->gate = val;
    478 }
    479 
    480 static void pit_load_count(PPDMDEVINS pDevIns, PPITSTATE pThis, PPITCHANNEL pChan, int val)
    481 {
    482     TMTIMERHANDLE hTimer = pThis->channels[0].hTimer;
    483     Assert(PDMDevHlpTimerIsLockOwner(pDevIns, hTimer));
    484 
    485     if (val == 0)
    486         val = 0x10000;
    487     pChan->count_load_time = pChan->u64ReloadTS = PDMDevHlpTimerGet(pDevIns, hTimer);
    488     pChan->count = val;
    489     pit_irq_timer_update(pDevIns, pThis, pChan, pChan->count_load_time, pChan->count_load_time, false);
    490 
    491     /* log the new rate (ch 0 only). */
    492     if (pChan->hTimer != NIL_TMTIMERHANDLE /* ch 0 */)
    493     {
    494         if (pChan->cRelLogEntries < 32)
    495         {
    496             pChan->cRelLogEntries++;
    497             LogRel(("PIT: mode=%d count=%#x (%u) - %d.%02d Hz (ch=0)\n",
    498                     pChan->mode, pChan->count, pChan->count, PIT_FREQ / pChan->count, (PIT_FREQ * 100 / pChan->count) % 100));
    499         }
    500         else
    501             Log(("PIT: mode=%d count=%#x (%u) - %d.%02d Hz (ch=0)\n",
    502                  pChan->mode, pChan->count, pChan->count, PIT_FREQ / pChan->count, (PIT_FREQ * 100 / pChan->count) % 100));
    503         PDMDevHlpTimerSetFrequencyHint(pDevIns, hTimer, PIT_FREQ / pChan->count);
    504     }
    505     else
    506         Log(("PIT: mode=%d count=%#x (%u) - %d.%02d Hz (ch=%d)\n",
    507              pChan->mode, pChan->count, pChan->count, PIT_FREQ / pChan->count, (PIT_FREQ * 100 / pChan->count) % 100,
    508              pChan - &pThis->channels[0]));
    509 }
    510 
    511389/* return -1 if no transition will occur.  */
    512 static int64_t pit_get_next_transition_time(PPDMDEVINS pDevIns, PPITSTATE pThis, PPITCHANNEL pChan, uint64_t current_time)
     390static int64_t pitR3GetNextTransitionTime(PPDMDEVINS pDevIns, PPITSTATE pThis, PPITCHANNEL pChan, uint64_t current_time)
    513391{
    514392    TMTIMERHANDLE hTimer = pThis->channels[0].hTimer;
     
    540418        case 2:
    541419            base = (d / pChan->count) * pChan->count;
    542 #ifndef VBOX /* see above */
     420# ifndef VBOX /* see above */
    543421            if ((d - base) == 0 && d != 0)
    544422                next_time = base + pChan->count - 1;
    545423            else
    546 #endif
     424# endif
    547425                next_time = base + pChan->count;
    548426            break;
     
    563441        case 4:
    564442        case 5:
    565 #ifdef VBOX
     443# ifdef VBOX
    566444            if (d <= pChan->count)
    567445                next_time = pChan->count;
    568 #else
     446# else
    569447            if (d < pChan->count)
    570448                next_time = pChan->count;
    571449            else if (d == pChan->count)
    572450                next_time = pChan->count + 1;
    573 #endif
     451# endif
    574452            else
    575453                return -1;
     
    593471}
    594472
    595 static void pit_irq_timer_update(PPDMDEVINS pDevIns, PPITSTATE pThis, PPITCHANNEL pChan,
    596                                  uint64_t current_time, uint64_t now, bool in_timer)
     473
     474static void pitR3IrqTimerUpdate(PPDMDEVINS pDevIns, PPITSTATE pThis, PPITCHANNEL pChan,
     475                                uint64_t current_time, uint64_t now, bool in_timer)
    597476{
    598477    int64_t expire_time;
     
    602481    if (pChan->hTimer == NIL_TMTIMERHANDLE)
    603482        return;
    604     expire_time = pit_get_next_transition_time(pDevIns, pThis, pChan, current_time);
     483    expire_time = pitR3GetNextTransitionTime(pDevIns, pThis, pChan, current_time);
    605484    irq_level = pit_get_out1(pDevIns, pThis, pChan, current_time) ? PDM_IRQ_LEVEL_HIGH : PDM_IRQ_LEVEL_LOW;
    606485
     
    640519    if (expire_time != -1)
    641520    {
    642         Log3(("pit_irq_timer_update: next=%'RU64 now=%'RU64\n", expire_time, now));
     521        Log3(("pitR3IrqTimerUpdate: next=%'RU64 now=%'RU64\n", expire_time, now));
    643522        pChan->u64NextTS = expire_time;
    644523        PDMDevHlpTimerSet(pDevIns, pChan->hTimer, pChan->u64NextTS);
     
    653532}
    654533
     534
     535/* val must be 0 or 1 */
     536static void pitR3SetGate(PPDMDEVINS pDevIns, PPITSTATE pThis, int channel, int val)
     537{
     538    PPITCHANNEL     pChan  = &pThis->channels[channel];
     539    TMTIMERHANDLE   hTimer = pThis->channels[0].hTimer;
     540
     541    Assert((val & 1) == val);
     542    Assert(PDMDevHlpTimerIsLockOwner(pDevIns, hTimer));
     543
     544    switch (EFFECTIVE_MODE(pChan->mode))
     545    {
     546        default:
     547        case 0:
     548        case 4:
     549            /* XXX: just disable/enable counting */
     550            break;
     551        case 1:
     552        case 5:
     553            if (pChan->gate < val)
     554            {
     555                /* restart counting on rising edge */
     556                Log(("pitR3SetGate: restarting mode %d\n", pChan->mode));
     557                pChan->count_load_time = PDMDevHlpTimerGet(pDevIns, hTimer);
     558                pitR3IrqTimerUpdate(pDevIns, pThis, pChan, pChan->count_load_time, pChan->count_load_time, false);
     559            }
     560            break;
     561        case 2:
     562        case 3:
     563            if (pChan->gate < val)
     564            {
     565                /* restart counting on rising edge */
     566                Log(("pitR3SetGate: restarting mode %d\n", pChan->mode));
     567                pChan->count_load_time = pChan->u64ReloadTS = PDMDevHlpTimerGet(pDevIns, hTimer);
     568                pitR3IrqTimerUpdate(pDevIns, pThis, pChan, pChan->count_load_time, pChan->count_load_time, false);
     569            }
     570            /* XXX: disable/enable counting */
     571            break;
     572    }
     573    pChan->gate = val;
     574}
     575
     576
     577static void pitR3LoadCount(PPDMDEVINS pDevIns, PPITSTATE pThis, PPITCHANNEL pChan, int val)
     578{
     579    TMTIMERHANDLE hTimer = pThis->channels[0].hTimer;
     580    Assert(PDMDevHlpTimerIsLockOwner(pDevIns, hTimer));
     581
     582    if (val == 0)
     583        val = 0x10000;
     584    pChan->count_load_time = pChan->u64ReloadTS = PDMDevHlpTimerGet(pDevIns, hTimer);
     585    pChan->count = val;
     586    pitR3IrqTimerUpdate(pDevIns, pThis, pChan, pChan->count_load_time, pChan->count_load_time, false);
     587
     588    /* log the new rate (ch 0 only). */
     589    if (pChan->hTimer != NIL_TMTIMERHANDLE /* ch 0 */)
     590    {
     591        if (pChan->cRelLogEntries < 32)
     592        {
     593            pChan->cRelLogEntries++;
     594            LogRel(("PIT: mode=%d count=%#x (%u) - %d.%02d Hz (ch=0)\n",
     595                    pChan->mode, pChan->count, pChan->count, PIT_FREQ / pChan->count, (PIT_FREQ * 100 / pChan->count) % 100));
     596        }
     597        else
     598            Log(("PIT: mode=%d count=%#x (%u) - %d.%02d Hz (ch=0)\n",
     599                 pChan->mode, pChan->count, pChan->count, PIT_FREQ / pChan->count, (PIT_FREQ * 100 / pChan->count) % 100));
     600        PDMDevHlpTimerSetFrequencyHint(pDevIns, hTimer, PIT_FREQ / pChan->count);
     601    }
     602    else
     603        Log(("PIT: mode=%d count=%#x (%u) - %d.%02d Hz (ch=%d)\n",
     604             pChan->mode, pChan->count, pChan->count, PIT_FREQ / pChan->count, (PIT_FREQ * 100 / pChan->count) % 100,
     605             pChan - &pThis->channels[0]));
     606}
     607
    655608#endif /* IN_RING3 */
    656 
    657609
    658610/**
     
    841793            default:
    842794            case RW_STATE_LSB:
    843                 pit_load_count(pDevIns, pThis, pChan, u32);
     795                pitR3LoadCount(pDevIns, pThis, pChan, u32);
    844796                break;
    845797            case RW_STATE_MSB:
    846                 pit_load_count(pDevIns, pThis, pChan, u32 << 8);
     798                pitR3LoadCount(pDevIns, pThis, pChan, u32 << 8);
    847799                break;
    848800            case RW_STATE_WORD0:
     
    851803                break;
    852804            case RW_STATE_WORD1:
    853                 pit_load_count(pDevIns, pThis, pChan, pChan->write_latch | (u32 << 8));
     805                pitR3LoadCount(pDevIns, pThis, pChan, pChan->write_latch | (u32 << 8));
    854806                pChan->write_state = RW_STATE_WORD0;
    855807                break;
     
    922874
    923875        pThis->speaker_data_on = (u32 >> 1) & 1;
    924         pit_set_gate(pDevIns, pThis, 2, u32 & 1);
     876        pitR3SetGate(pDevIns, pThis, 2, u32 & 1);
    925877
    926878        /** @todo r=klaus move this to a (system-specific) driver, which can
     
    1019971 * @callback_method_impl{FNSSMDEVLIVEEXEC}
    1020972 */
    1021 static DECLCALLBACK(int) pitLiveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass)
     973static DECLCALLBACK(int) pitR3LiveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass)
    1022974{
    1023975    PPITSTATE     pThis = PDMDEVINS_2_DATA(pDevIns, PPITSTATE);
     
    1034986 * @callback_method_impl{FNSSMDEVSAVEEXEC}
    1035987 */
    1036 static DECLCALLBACK(int) pitSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
     988static DECLCALLBACK(int) pitR3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
    1037989{
    1038990    PPITSTATE     pThis = PDMDEVINS_2_DATA(pDevIns, PPITSTATE);
     
    1041993
    1042994    /* The config. */
    1043     pitLiveExec(pDevIns, pSSM, SSM_PASS_FINAL);
     995    pitR3LiveExec(pDevIns, pSSM, SSM_PASS_FINAL);
    1044996
    1045997    /* The state. */
     
    10681020
    10691021    pHlp->pfnSSMPutS32(pSSM, pThis->speaker_data_on);
    1070 #ifdef FAKE_REFRESH_CLOCK
     1022# ifdef FAKE_REFRESH_CLOCK
    10711023    pHlp->pfnSSMPutS32(pSSM, pThis->dummy_refresh_clock);
    1072 #else
     1024# else
    10731025    pHlp->pfnSSMPutS32(pSSM, 0);
    1074 #endif
     1026# endif
    10751027
    10761028    pHlp->pfnSSMPutBool(pSSM, pThis->fDisabledByHpet);
     
    10841036 * @callback_method_impl{FNSSMDEVLOADEXEC}
    10851037 */
    1086 static DECLCALLBACK(int) pitLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
     1038static DECLCALLBACK(int) pitR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
    10871039{
    10881040    PPITSTATE     pThis = PDMDEVINS_2_DATA(pDevIns, PPITSTATE);
     
    11531105
    11541106    pHlp->pfnSSMGetS32(pSSM, &pThis->speaker_data_on);
    1155 #ifdef FAKE_REFRESH_CLOCK
     1107# ifdef FAKE_REFRESH_CLOCK
    11561108    pHlp->pfnSSMGetS32(pSSM, &pThis->dummy_refresh_clock);
    1157 #else
     1109# else
    11581110    int32_t u32Dummy;
    11591111    pHlp->pfnSSMGetS32(pSSM, &u32Dummy);
    1160 #endif
     1112# endif
    11611113    if (uVersion > PIT_SAVED_STATE_VERSION_VBOX_31)
    11621114        pHlp->pfnSSMGetBool(pSSM, &pThis->fDisabledByHpet);
     
    11721124 * @param   pvUser          Pointer to the PIT channel state.
    11731125 */
    1174 static DECLCALLBACK(void) pitTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
     1126static DECLCALLBACK(void) pitR3Timer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
    11751127{
    11761128    PPITSTATE   pThis = PDMDEVINS_2_DATA(pDevIns, PPITSTATE);
     
    11791131    STAM_PROFILE_ADV_START(&pThis->StatPITHandler, a);
    11801132
    1181     Log(("pitTimer\n"));
     1133    Log(("pitR3Timer\n"));
    11821134    Assert(PDMDevHlpCritSectIsOwner(pDevIns, &pThis->CritSect));
    11831135    Assert(PDMDevHlpTimerIsLockOwner(pDevIns, pChan->hTimer));
    11841136
    1185     pit_irq_timer_update(pDevIns, pThis, pChan, pChan->next_transition_time, PDMDevHlpTimerGet(pDevIns, pChan->hTimer), true);
     1137    pitR3IrqTimerUpdate(pDevIns, pThis, pChan, pChan->next_transition_time, PDMDevHlpTimerGet(pDevIns, pChan->hTimer), true);
    11861138
    11871139    STAM_PROFILE_ADV_STOP(&pThis->StatPITHandler, a);
     
    11941146 * @callback_method_impl{FNDBGFHANDLERDEV}
    11951147 */
    1196 static DECLCALLBACK(void) pitInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     1148static DECLCALLBACK(void) pitR3Info(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
    11971149{
    11981150    RT_NOREF(pszArgs);
     
    12201172                        pChan->u64ReloadTS,       pChan->u64NextTS);
    12211173    }
    1222 #ifdef FAKE_REFRESH_CLOCK
     1174# ifdef FAKE_REFRESH_CLOCK
    12231175    pHlp->pfnPrintf(pHlp, "speaker_data_on=%#x dummy_refresh_clock=%#x\n",
    12241176                    pThis->speaker_data_on, pThis->dummy_refresh_clock);
    1225 #else
     1177# else
    12261178    pHlp->pfnPrintf(pHlp, "speaker_data_on=%#x\n", pThis->speaker_data_on);
    1227 #endif
     1179# endif
    12281180    if (pThis->fDisabledByHpet)
    12291181        pHlp->pfnPrintf(pHlp, "Disabled by HPET\n");
     
    12361188 * @interface_method_impl{PDMIHPETLEGACYNOTIFY,pfnModeChanged}
    12371189 */
    1238 static DECLCALLBACK(void) pitNotifyHpetLegacyNotify_ModeChanged(PPDMIHPETLEGACYNOTIFY pInterface, bool fActivated)
     1190static DECLCALLBACK(void) pitR3NotifyHpetLegacyNotify_ModeChanged(PPDMIHPETLEGACYNOTIFY pInterface, bool fActivated)
    12391191{
    12401192    PPITSTATER3  pThisCC = RT_FROM_MEMBER(pInterface, PITSTATER3, IHpetLegacyNotify);
     
    12541206 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
    12551207 */
    1256 static DECLCALLBACK(void *) pitQueryInterface(PPDMIBASE pInterface, const char *pszIID)
     1208static DECLCALLBACK(void *) pitR3QueryInterface(PPDMIBASE pInterface, const char *pszIID)
    12571209{
    12581210    PPDMDEVINS  pDevIns = RT_FROM_MEMBER(pInterface, PDMDEVINS, IBase);
     
    12691221 * @interface_method_impl{PDMDEVREG,pfnReset}
    12701222 */
    1271 static DECLCALLBACK(void) pitReset(PPDMDEVINS pDevIns)
     1223static DECLCALLBACK(void) pitR3Reset(PPDMDEVINS pDevIns)
    12721224{
    12731225    PPITSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PPITSTATE);
    1274     LogFlow(("pitReset: \n"));
     1226    LogFlow(("pitR3Reset: \n"));
    12751227
    12761228    DEVPIT_R3_LOCK_BOTH(pDevIns, pThis);
     
    12821234        PPITCHANNEL pChan = &pThis->channels[i];
    12831235
    1284 #if 1 /* Set everything back to virgin state. (might not be strictly correct) */
     1236# if 1 /* Set everything back to virgin state. (might not be strictly correct) */
    12851237        pChan->latched_count = 0;
    12861238        pChan->count_latched = 0;
     
    12921244        pChan->rw_mode = 0;
    12931245        pChan->bcd = 0;
    1294 #endif
     1246# endif
    12951247        pChan->u64NextTS = UINT64_MAX;
    12961248        pChan->cRelLogEntries = 0;
    12971249        pChan->mode = 3;
    12981250        pChan->gate = (i != 2);
    1299         pit_load_count(pDevIns, pThis, pChan, 0);
     1251        pitR3LoadCount(pDevIns, pThis, pChan, 0);
    13001252    }
    13011253
     
    13031255}
    13041256
     1257# ifdef RT_OS_LINUX
     1258
     1259static int pitR3TryDeviceOpen(const char *pszPath, int flags)
     1260{
     1261    int fd = open(pszPath, flags);
     1262    if (fd == -1)
     1263        LogRel(("PIT: speaker: cannot open \"%s\", errno=%d\n", pszPath, errno));
     1264    else
     1265        LogRel(("PIT: speaker: opened \"%s\"\n", pszPath));
     1266    return fd;
     1267}
     1268
     1269
     1270static int pitR3TryDeviceOpenSanitizeIoctl(const char *pszPath, int flags)
     1271{
     1272    int fd = open(pszPath, flags);
     1273    if (fd == -1)
     1274        LogRel(("PIT: speaker: cannot open \"%s\", errno=%d\n", pszPath, errno));
     1275    else
     1276    {
     1277        int errno_eviocgsnd0 = 0;
     1278        int errno_kiocsound = 0;
     1279        if (ioctl(fd, EVIOCGSND(0)) == -1)
     1280        {
     1281            errno_eviocgsnd0 = errno;
     1282            if (ioctl(fd, KIOCSOUND, 1) == -1)
     1283                errno_kiocsound = errno;
     1284            else
     1285                ioctl(fd, KIOCSOUND, 0);
     1286        }
     1287        if (errno_eviocgsnd0 && errno_kiocsound)
     1288        {
     1289            LogRel(("PIT: speaker: cannot use \"%s\", ioctl failed errno=%d/errno=%d\n", pszPath, errno_eviocgsnd0, errno_kiocsound));
     1290            close(fd);
     1291            fd = -1;
     1292        }
     1293        else
     1294            LogRel(("PIT: speaker: opened \"%s\"\n", pszPath));
     1295    }
     1296    return fd;
     1297}
     1298
     1299# endif /* RT_OS_LINUX */
    13051300
    13061301/**
    13071302 * @interface_method_impl{PDMDEVREG,pfnConstruct}
    13081303 */
    1309 static DECLCALLBACK(int)  pitConstruct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg)
     1304static DECLCALLBACK(int)  pitR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg)
    13101305{
    13111306    PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
     
    13671362        int fd = -1;
    13681363        if ((uPassthroughSpeaker == 1 || uPassthroughSpeaker == 100) && fd == -1)
    1369             fd = pitTryDeviceOpenSanitizeIoctl("/dev/input/by-path/platform-pcspkr-event-spkr", O_WRONLY);
     1364            fd = pitR3TryDeviceOpenSanitizeIoctl("/dev/input/by-path/platform-pcspkr-event-spkr", O_WRONLY);
    13701365        if ((uPassthroughSpeaker == 2 || uPassthroughSpeaker == 100) && fd == -1)
    1371             fd = pitTryDeviceOpenSanitizeIoctl("/dev/tty", O_WRONLY);
     1366            fd = pitR3TryDeviceOpenSanitizeIoctl("/dev/tty", O_WRONLY);
    13721367        if ((uPassthroughSpeaker == 3 || uPassthroughSpeaker == 100) && fd == -1)
    13731368        {
    1374             fd = pitTryDeviceOpenSanitizeIoctl("/dev/tty0", O_WRONLY);
     1369            fd = pitR3TryDeviceOpenSanitizeIoctl("/dev/tty0", O_WRONLY);
    13751370            if (fd == -1)
    1376                 fd = pitTryDeviceOpenSanitizeIoctl("/dev/vc/0", O_WRONLY);
     1371                fd = pitR3TryDeviceOpenSanitizeIoctl("/dev/vc/0", O_WRONLY);
    13771372        }
    13781373        if ((uPassthroughSpeaker == 9 || uPassthroughSpeaker == 100) && pszPassthroughSpeakerDevice && fd == -1)
    1379             fd = pitTryDeviceOpenSanitizeIoctl(pszPassthroughSpeakerDevice, O_WRONLY);
     1374            fd = pitR3TryDeviceOpenSanitizeIoctl(pszPassthroughSpeakerDevice, O_WRONLY);
    13801375        if (pThis->enmSpeakerEmu == PIT_SPEAKER_EMU_NONE && fd != -1)
    13811376        {
     
    13931388        }
    13941389        if ((uPassthroughSpeaker == 70 || uPassthroughSpeaker == 100) && fd == -1)
    1395             fd = pitTryDeviceOpen("/dev/tty", O_WRONLY);
     1390            fd = pitR3TryDeviceOpen("/dev/tty", O_WRONLY);
    13961391        if ((uPassthroughSpeaker == 79 || uPassthroughSpeaker == 100) && pszPassthroughSpeakerDevice && fd == -1)
    1397             fd = pitTryDeviceOpen(pszPassthroughSpeakerDevice, O_WRONLY);
     1392            fd = pitR3TryDeviceOpen(pszPassthroughSpeakerDevice, O_WRONLY);
    13981393        if (pThis->enmSpeakerEmu == PIT_SPEAKER_EMU_NONE && fd != -1)
    13991394        {
     
    14211416     */
    14221417    /* IBase */
    1423     pDevIns->IBase.pfnQueryInterface          = pitQueryInterface;
     1418    pDevIns->IBase.pfnQueryInterface          = pitR3QueryInterface;
    14241419    /* IHpetLegacyNotify */
    1425     pThisCC->IHpetLegacyNotify.pfnModeChanged = pitNotifyHpetLegacyNotify_ModeChanged;
     1420    pThisCC->IHpetLegacyNotify.pfnModeChanged = pitR3NotifyHpetLegacyNotify_ModeChanged;
    14261421    pThisCC->pDevIns                          = pDevIns;
    14271422
     
    14381433     * Create the timer, make it take our critsect.
    14391434     */
    1440     rc = PDMDevHlpTimerCreate(pDevIns, TMCLOCK_VIRTUAL_SYNC, pitTimer, &pThis->channels[0],
     1435    rc = PDMDevHlpTimerCreate(pDevIns, TMCLOCK_VIRTUAL_SYNC, pitR3Timer, &pThis->channels[0],
    14411436                              TMTIMER_FLAGS_NO_CRIT_SECT, "i8254 Programmable Interval Timer", &pThis->channels[0].hTimer);
    14421437    AssertRCReturn(rc, rc);
     
    14611456     * Saved state.
    14621457     */
    1463     rc = PDMDevHlpSSMRegister3(pDevIns, PIT_SAVED_STATE_VERSION, sizeof(*pThis), pitLiveExec, pitSaveExec, pitLoadExec);
     1458    rc = PDMDevHlpSSMRegister3(pDevIns, PIT_SAVED_STATE_VERSION, sizeof(*pThis), pitR3LiveExec, pitR3SaveExec, pitR3LoadExec);
    14641459    if (RT_FAILURE(rc))
    14651460        return rc;
     
    14681463     * Initialize the device state.
    14691464     */
    1470     pitReset(pDevIns);
     1465    pitR3Reset(pDevIns);
    14711466
    14721467    /*
     
    14761471    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatPITHandler,  STAMTYPE_PROFILE, "/TM/PIT/Handler",  STAMUNIT_TICKS_PER_CALL, "Profiling timer callback handler.");
    14771472
    1478     PDMDevHlpDBGFInfoRegister(pDevIns, "pit", "Display PIT (i8254) status. (no arguments)", pitInfo);
     1473    PDMDevHlpDBGFInfoRegister(pDevIns, "pit", "Display PIT (i8254) status. (no arguments)", pitR3Info);
    14791474
    14801475    return VINF_SUCCESS;
     
    15261521    /* .pszRCMod = */               "VBoxDDRC.rc",
    15271522    /* .pszR0Mod = */               "VBoxDDR0.r0",
    1528     /* .pfnConstruct = */           pitConstruct,
     1523    /* .pfnConstruct = */           pitR3Construct,
    15291524    /* .pfnDestruct = */            NULL,
    15301525    /* .pfnRelocate = */            NULL,
    15311526    /* .pfnMemSetup = */            NULL,
    15321527    /* .pfnPowerOn = */             NULL,
    1533     /* .pfnReset = */               pitReset,
     1528    /* .pfnReset = */               pitR3Reset,
    15341529    /* .pfnSuspend = */             NULL,
    15351530    /* .pfnResume = */              NULL,
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