- Timestamp:
- Nov 17, 2019 3:12:57 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/DevPit-i8254.cpp
r81907 r81908 273 273 274 274 275 /*********************************************************************************************************************************276 * Internal Functions *277 *********************************************************************************************************************************/278 #ifdef IN_RING3279 static void pit_irq_timer_update(PPDMDEVINS pDevIns, PPITSTATE pThis, PPITCHANNEL pChan,280 uint64_t current_time, uint64_t now, bool in_timer);281 #endif282 283 284 #ifdef IN_RING3285 # ifdef RT_OS_LINUX286 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 else292 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 else302 {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 else311 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 else320 LogRel(("PIT: speaker: opened \"%s\"\n", pszPath));321 }322 return fd;323 }324 # endif /* RT_OS_LINUX */325 #endif /* IN_RING3 */326 275 327 276 static int pit_get_count(PPDMDEVINS pDevIns, PPITSTATE pThis, PPITCHANNEL pChan) … … 371 320 return counter; 372 321 } 322 373 323 374 324 /* get pit output bit */ … … 437 387 #ifdef IN_RING3 438 388 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 else501 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 else506 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 511 389 /* 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)390 static int64_t pitR3GetNextTransitionTime(PPDMDEVINS pDevIns, PPITSTATE pThis, PPITCHANNEL pChan, uint64_t current_time) 513 391 { 514 392 TMTIMERHANDLE hTimer = pThis->channels[0].hTimer; … … 540 418 case 2: 541 419 base = (d / pChan->count) * pChan->count; 542 # ifndef VBOX /* see above */420 # ifndef VBOX /* see above */ 543 421 if ((d - base) == 0 && d != 0) 544 422 next_time = base + pChan->count - 1; 545 423 else 546 # endif424 # endif 547 425 next_time = base + pChan->count; 548 426 break; … … 563 441 case 4: 564 442 case 5: 565 # ifdef VBOX443 # ifdef VBOX 566 444 if (d <= pChan->count) 567 445 next_time = pChan->count; 568 # else446 # else 569 447 if (d < pChan->count) 570 448 next_time = pChan->count; 571 449 else if (d == pChan->count) 572 450 next_time = pChan->count + 1; 573 # endif451 # endif 574 452 else 575 453 return -1; … … 593 471 } 594 472 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 474 static void pitR3IrqTimerUpdate(PPDMDEVINS pDevIns, PPITSTATE pThis, PPITCHANNEL pChan, 475 uint64_t current_time, uint64_t now, bool in_timer) 597 476 { 598 477 int64_t expire_time; … … 602 481 if (pChan->hTimer == NIL_TMTIMERHANDLE) 603 482 return; 604 expire_time = pit _get_next_transition_time(pDevIns, pThis, pChan, current_time);483 expire_time = pitR3GetNextTransitionTime(pDevIns, pThis, pChan, current_time); 605 484 irq_level = pit_get_out1(pDevIns, pThis, pChan, current_time) ? PDM_IRQ_LEVEL_HIGH : PDM_IRQ_LEVEL_LOW; 606 485 … … 640 519 if (expire_time != -1) 641 520 { 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)); 643 522 pChan->u64NextTS = expire_time; 644 523 PDMDevHlpTimerSet(pDevIns, pChan->hTimer, pChan->u64NextTS); … … 653 532 } 654 533 534 535 /* val must be 0 or 1 */ 536 static 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 577 static 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 655 608 #endif /* IN_RING3 */ 656 657 609 658 610 /** … … 841 793 default: 842 794 case RW_STATE_LSB: 843 pit _load_count(pDevIns, pThis, pChan, u32);795 pitR3LoadCount(pDevIns, pThis, pChan, u32); 844 796 break; 845 797 case RW_STATE_MSB: 846 pit _load_count(pDevIns, pThis, pChan, u32 << 8);798 pitR3LoadCount(pDevIns, pThis, pChan, u32 << 8); 847 799 break; 848 800 case RW_STATE_WORD0: … … 851 803 break; 852 804 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)); 854 806 pChan->write_state = RW_STATE_WORD0; 855 807 break; … … 922 874 923 875 pThis->speaker_data_on = (u32 >> 1) & 1; 924 pit _set_gate(pDevIns, pThis, 2, u32 & 1);876 pitR3SetGate(pDevIns, pThis, 2, u32 & 1); 925 877 926 878 /** @todo r=klaus move this to a (system-specific) driver, which can … … 1019 971 * @callback_method_impl{FNSSMDEVLIVEEXEC} 1020 972 */ 1021 static DECLCALLBACK(int) pit LiveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass)973 static DECLCALLBACK(int) pitR3LiveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass) 1022 974 { 1023 975 PPITSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PPITSTATE); … … 1034 986 * @callback_method_impl{FNSSMDEVSAVEEXEC} 1035 987 */ 1036 static DECLCALLBACK(int) pit SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)988 static DECLCALLBACK(int) pitR3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 1037 989 { 1038 990 PPITSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PPITSTATE); … … 1041 993 1042 994 /* The config. */ 1043 pit LiveExec(pDevIns, pSSM, SSM_PASS_FINAL);995 pitR3LiveExec(pDevIns, pSSM, SSM_PASS_FINAL); 1044 996 1045 997 /* The state. */ … … 1068 1020 1069 1021 pHlp->pfnSSMPutS32(pSSM, pThis->speaker_data_on); 1070 # ifdef FAKE_REFRESH_CLOCK1022 # ifdef FAKE_REFRESH_CLOCK 1071 1023 pHlp->pfnSSMPutS32(pSSM, pThis->dummy_refresh_clock); 1072 # else1024 # else 1073 1025 pHlp->pfnSSMPutS32(pSSM, 0); 1074 # endif1026 # endif 1075 1027 1076 1028 pHlp->pfnSSMPutBool(pSSM, pThis->fDisabledByHpet); … … 1084 1036 * @callback_method_impl{FNSSMDEVLOADEXEC} 1085 1037 */ 1086 static DECLCALLBACK(int) pit LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)1038 static DECLCALLBACK(int) pitR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass) 1087 1039 { 1088 1040 PPITSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PPITSTATE); … … 1153 1105 1154 1106 pHlp->pfnSSMGetS32(pSSM, &pThis->speaker_data_on); 1155 # ifdef FAKE_REFRESH_CLOCK1107 # ifdef FAKE_REFRESH_CLOCK 1156 1108 pHlp->pfnSSMGetS32(pSSM, &pThis->dummy_refresh_clock); 1157 # else1109 # else 1158 1110 int32_t u32Dummy; 1159 1111 pHlp->pfnSSMGetS32(pSSM, &u32Dummy); 1160 # endif1112 # endif 1161 1113 if (uVersion > PIT_SAVED_STATE_VERSION_VBOX_31) 1162 1114 pHlp->pfnSSMGetBool(pSSM, &pThis->fDisabledByHpet); … … 1172 1124 * @param pvUser Pointer to the PIT channel state. 1173 1125 */ 1174 static DECLCALLBACK(void) pit Timer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)1126 static DECLCALLBACK(void) pitR3Timer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser) 1175 1127 { 1176 1128 PPITSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PPITSTATE); … … 1179 1131 STAM_PROFILE_ADV_START(&pThis->StatPITHandler, a); 1180 1132 1181 Log(("pit Timer\n"));1133 Log(("pitR3Timer\n")); 1182 1134 Assert(PDMDevHlpCritSectIsOwner(pDevIns, &pThis->CritSect)); 1183 1135 Assert(PDMDevHlpTimerIsLockOwner(pDevIns, pChan->hTimer)); 1184 1136 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); 1186 1138 1187 1139 STAM_PROFILE_ADV_STOP(&pThis->StatPITHandler, a); … … 1194 1146 * @callback_method_impl{FNDBGFHANDLERDEV} 1195 1147 */ 1196 static DECLCALLBACK(void) pit Info(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)1148 static DECLCALLBACK(void) pitR3Info(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 1197 1149 { 1198 1150 RT_NOREF(pszArgs); … … 1220 1172 pChan->u64ReloadTS, pChan->u64NextTS); 1221 1173 } 1222 # ifdef FAKE_REFRESH_CLOCK1174 # ifdef FAKE_REFRESH_CLOCK 1223 1175 pHlp->pfnPrintf(pHlp, "speaker_data_on=%#x dummy_refresh_clock=%#x\n", 1224 1176 pThis->speaker_data_on, pThis->dummy_refresh_clock); 1225 # else1177 # else 1226 1178 pHlp->pfnPrintf(pHlp, "speaker_data_on=%#x\n", pThis->speaker_data_on); 1227 # endif1179 # endif 1228 1180 if (pThis->fDisabledByHpet) 1229 1181 pHlp->pfnPrintf(pHlp, "Disabled by HPET\n"); … … 1236 1188 * @interface_method_impl{PDMIHPETLEGACYNOTIFY,pfnModeChanged} 1237 1189 */ 1238 static DECLCALLBACK(void) pit NotifyHpetLegacyNotify_ModeChanged(PPDMIHPETLEGACYNOTIFY pInterface, bool fActivated)1190 static DECLCALLBACK(void) pitR3NotifyHpetLegacyNotify_ModeChanged(PPDMIHPETLEGACYNOTIFY pInterface, bool fActivated) 1239 1191 { 1240 1192 PPITSTATER3 pThisCC = RT_FROM_MEMBER(pInterface, PITSTATER3, IHpetLegacyNotify); … … 1254 1206 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 1255 1207 */ 1256 static DECLCALLBACK(void *) pit QueryInterface(PPDMIBASE pInterface, const char *pszIID)1208 static DECLCALLBACK(void *) pitR3QueryInterface(PPDMIBASE pInterface, const char *pszIID) 1257 1209 { 1258 1210 PPDMDEVINS pDevIns = RT_FROM_MEMBER(pInterface, PDMDEVINS, IBase); … … 1269 1221 * @interface_method_impl{PDMDEVREG,pfnReset} 1270 1222 */ 1271 static DECLCALLBACK(void) pitR eset(PPDMDEVINS pDevIns)1223 static DECLCALLBACK(void) pitR3Reset(PPDMDEVINS pDevIns) 1272 1224 { 1273 1225 PPITSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PPITSTATE); 1274 LogFlow(("pitR eset: \n"));1226 LogFlow(("pitR3Reset: \n")); 1275 1227 1276 1228 DEVPIT_R3_LOCK_BOTH(pDevIns, pThis); … … 1282 1234 PPITCHANNEL pChan = &pThis->channels[i]; 1283 1235 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) */ 1285 1237 pChan->latched_count = 0; 1286 1238 pChan->count_latched = 0; … … 1292 1244 pChan->rw_mode = 0; 1293 1245 pChan->bcd = 0; 1294 # endif1246 # endif 1295 1247 pChan->u64NextTS = UINT64_MAX; 1296 1248 pChan->cRelLogEntries = 0; 1297 1249 pChan->mode = 3; 1298 1250 pChan->gate = (i != 2); 1299 pit _load_count(pDevIns, pThis, pChan, 0);1251 pitR3LoadCount(pDevIns, pThis, pChan, 0); 1300 1252 } 1301 1253 … … 1303 1255 } 1304 1256 1257 # ifdef RT_OS_LINUX 1258 1259 static 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 1270 static 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 */ 1305 1300 1306 1301 /** 1307 1302 * @interface_method_impl{PDMDEVREG,pfnConstruct} 1308 1303 */ 1309 static DECLCALLBACK(int) pit Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg)1304 static DECLCALLBACK(int) pitR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg) 1310 1305 { 1311 1306 PDMDEV_CHECK_VERSIONS_RETURN(pDevIns); … … 1367 1362 int fd = -1; 1368 1363 if ((uPassthroughSpeaker == 1 || uPassthroughSpeaker == 100) && fd == -1) 1369 fd = pit TryDeviceOpenSanitizeIoctl("/dev/input/by-path/platform-pcspkr-event-spkr", O_WRONLY);1364 fd = pitR3TryDeviceOpenSanitizeIoctl("/dev/input/by-path/platform-pcspkr-event-spkr", O_WRONLY); 1370 1365 if ((uPassthroughSpeaker == 2 || uPassthroughSpeaker == 100) && fd == -1) 1371 fd = pit TryDeviceOpenSanitizeIoctl("/dev/tty", O_WRONLY);1366 fd = pitR3TryDeviceOpenSanitizeIoctl("/dev/tty", O_WRONLY); 1372 1367 if ((uPassthroughSpeaker == 3 || uPassthroughSpeaker == 100) && fd == -1) 1373 1368 { 1374 fd = pit TryDeviceOpenSanitizeIoctl("/dev/tty0", O_WRONLY);1369 fd = pitR3TryDeviceOpenSanitizeIoctl("/dev/tty0", O_WRONLY); 1375 1370 if (fd == -1) 1376 fd = pit TryDeviceOpenSanitizeIoctl("/dev/vc/0", O_WRONLY);1371 fd = pitR3TryDeviceOpenSanitizeIoctl("/dev/vc/0", O_WRONLY); 1377 1372 } 1378 1373 if ((uPassthroughSpeaker == 9 || uPassthroughSpeaker == 100) && pszPassthroughSpeakerDevice && fd == -1) 1379 fd = pit TryDeviceOpenSanitizeIoctl(pszPassthroughSpeakerDevice, O_WRONLY);1374 fd = pitR3TryDeviceOpenSanitizeIoctl(pszPassthroughSpeakerDevice, O_WRONLY); 1380 1375 if (pThis->enmSpeakerEmu == PIT_SPEAKER_EMU_NONE && fd != -1) 1381 1376 { … … 1393 1388 } 1394 1389 if ((uPassthroughSpeaker == 70 || uPassthroughSpeaker == 100) && fd == -1) 1395 fd = pit TryDeviceOpen("/dev/tty", O_WRONLY);1390 fd = pitR3TryDeviceOpen("/dev/tty", O_WRONLY); 1396 1391 if ((uPassthroughSpeaker == 79 || uPassthroughSpeaker == 100) && pszPassthroughSpeakerDevice && fd == -1) 1397 fd = pit TryDeviceOpen(pszPassthroughSpeakerDevice, O_WRONLY);1392 fd = pitR3TryDeviceOpen(pszPassthroughSpeakerDevice, O_WRONLY); 1398 1393 if (pThis->enmSpeakerEmu == PIT_SPEAKER_EMU_NONE && fd != -1) 1399 1394 { … … 1421 1416 */ 1422 1417 /* IBase */ 1423 pDevIns->IBase.pfnQueryInterface = pit QueryInterface;1418 pDevIns->IBase.pfnQueryInterface = pitR3QueryInterface; 1424 1419 /* IHpetLegacyNotify */ 1425 pThisCC->IHpetLegacyNotify.pfnModeChanged = pit NotifyHpetLegacyNotify_ModeChanged;1420 pThisCC->IHpetLegacyNotify.pfnModeChanged = pitR3NotifyHpetLegacyNotify_ModeChanged; 1426 1421 pThisCC->pDevIns = pDevIns; 1427 1422 … … 1438 1433 * Create the timer, make it take our critsect. 1439 1434 */ 1440 rc = PDMDevHlpTimerCreate(pDevIns, TMCLOCK_VIRTUAL_SYNC, pit Timer, &pThis->channels[0],1435 rc = PDMDevHlpTimerCreate(pDevIns, TMCLOCK_VIRTUAL_SYNC, pitR3Timer, &pThis->channels[0], 1441 1436 TMTIMER_FLAGS_NO_CRIT_SECT, "i8254 Programmable Interval Timer", &pThis->channels[0].hTimer); 1442 1437 AssertRCReturn(rc, rc); … … 1461 1456 * Saved state. 1462 1457 */ 1463 rc = PDMDevHlpSSMRegister3(pDevIns, PIT_SAVED_STATE_VERSION, sizeof(*pThis), pit LiveExec, pitSaveExec, pitLoadExec);1458 rc = PDMDevHlpSSMRegister3(pDevIns, PIT_SAVED_STATE_VERSION, sizeof(*pThis), pitR3LiveExec, pitR3SaveExec, pitR3LoadExec); 1464 1459 if (RT_FAILURE(rc)) 1465 1460 return rc; … … 1468 1463 * Initialize the device state. 1469 1464 */ 1470 pitR eset(pDevIns);1465 pitR3Reset(pDevIns); 1471 1466 1472 1467 /* … … 1476 1471 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatPITHandler, STAMTYPE_PROFILE, "/TM/PIT/Handler", STAMUNIT_TICKS_PER_CALL, "Profiling timer callback handler."); 1477 1472 1478 PDMDevHlpDBGFInfoRegister(pDevIns, "pit", "Display PIT (i8254) status. (no arguments)", pit Info);1473 PDMDevHlpDBGFInfoRegister(pDevIns, "pit", "Display PIT (i8254) status. (no arguments)", pitR3Info); 1479 1474 1480 1475 return VINF_SUCCESS; … … 1526 1521 /* .pszRCMod = */ "VBoxDDRC.rc", 1527 1522 /* .pszR0Mod = */ "VBoxDDR0.r0", 1528 /* .pfnConstruct = */ pit Construct,1523 /* .pfnConstruct = */ pitR3Construct, 1529 1524 /* .pfnDestruct = */ NULL, 1530 1525 /* .pfnRelocate = */ NULL, 1531 1526 /* .pfnMemSetup = */ NULL, 1532 1527 /* .pfnPowerOn = */ NULL, 1533 /* .pfnReset = */ pitR eset,1528 /* .pfnReset = */ pitR3Reset, 1534 1529 /* .pfnSuspend = */ NULL, 1535 1530 /* .pfnResume = */ NULL,
Note:
See TracChangeset
for help on using the changeset viewer.