Changeset 81955 in vbox
- Timestamp:
- Nov 18, 2019 5:23:13 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/DevHPET.cpp
r81954 r81955 208 208 TMTIMERHANDLE hTimer; 209 209 210 /** Pointer to the instance data - R3 Ptr. */211 R3PTRTYPE(struct HPET *) pHpetR3;212 /** Pointer to the instance data - R0 Ptr. */213 R0PTRTYPE(struct HPET *) pHpetR0;214 /** Pointer to the instance data - RC Ptr. */215 RCPTRTYPE(struct HPET *) pHpetRC;216 217 210 /** Timer index. */ 218 211 uint8_t idxTimer; … … 220 213 uint8_t u8Wrap; 221 214 /** Explicit padding. */ 222 uint8_t abPadding[ 2];215 uint8_t abPadding[6]; 223 216 224 217 /** @name Memory-mapped, software visible timer registers. … … 250 243 typedef struct HPET 251 244 { 252 /** Pointer to the device instance. - R3 ptr. */253 PPDMDEVINSR3 pDevInsR3;254 245 /** The HPET helpers - R3 Ptr. */ 255 246 PCPDMHPETHLPR3 pHpetHlpR3; 256 257 /** Pointer to the device instance. - R0 ptr. */258 PPDMDEVINSR0 pDevInsR0;259 247 /** The HPET helpers - R0 Ptr. */ 260 248 PCPDMHPETHLPR0 pHpetHlpR0; 261 262 /** Pointer to the device instance. - RC ptr. */263 PPDMDEVINSRC pDevInsRC;264 249 /** The HPET helpers - RC Ptr. */ 265 250 PCPDMHPETHLPRC pHpetHlpRC; 251 uint32_t u32Padding; 266 252 267 253 /** Timer structures. */ … … 410 396 pHpetTimer->u8Wrap = 0; 411 397 412 uint64_t u64Ticks = hpetGetTicks(pDevIns, p HpetTimer->CTX_SUFF(pHpet));398 uint64_t u64Ticks = hpetGetTicks(pDevIns, pThis); 413 399 hpetAdjustComparator(pHpetTimer, u64Ticks); 414 400 … … 443 429 if (u64Diff <= u64TickLimit) 444 430 { 445 Log4(("HPET: next IRQ in %lld ticks (%lld ns)\n", u64Diff, hpetTicksToNs(p HpetTimer->CTX_SUFF(pHpet), u64Diff)));446 PDMDevHlpTimerSetNano(pDevIns, pHpetTimer->hTimer, hpetTicksToNs(p HpetTimer->CTX_SUFF(pHpet), u64Diff));431 Log4(("HPET: next IRQ in %lld ticks (%lld ns)\n", u64Diff, hpetTicksToNs(pThis, u64Diff))); 432 PDMDevHlpTimerSetNano(pDevIns, pHpetTimer->hTimer, hpetTicksToNs(pThis, u64Diff)); 447 433 } 448 434 else … … 770 756 { 771 757 #ifdef IN_RING3 772 rc = pThis->pHpetHlpR3->pfnSetLegacyMode(p This->pDevInsR3, RT_BOOL(u32NewValue & HPET_CFG_LEGACY));758 rc = pThis->pHpetHlpR3->pfnSetLegacyMode(pDevIns, RT_BOOL(u32NewValue & HPET_CFG_LEGACY)); 773 759 if (rc != VINF_SUCCESS) 774 760 #else … … 1010 996 * 1011 997 * @returns IRQ number. 998 * @param pThis The shared HPET state. 1012 999 * @param pHpetTimer The HPET timer. 1013 1000 */ 1014 static uint32_t hpetR3TimerGetIrq(P CHPETTIMER pHpetTimer)1001 static uint32_t hpetR3TimerGetIrq(PHPET pThis, PCHPETTIMER pHpetTimer) 1015 1002 { 1016 1003 /* … … 1023 1010 */ 1024 1011 if ( (pHpetTimer->idxTimer <= 1) 1025 && (p HpetTimer->CTX_SUFF(pHpet)->u64HpetConfig & HPET_CFG_LEGACY))1012 && (pThis->u64HpetConfig & HPET_CFG_LEGACY)) 1026 1013 return (pHpetTimer->idxTimer == 0) ? 0 : 8; 1027 1014 … … 1033 1020 * Used by hpetR3Timer to update the IRQ status. 1034 1021 * 1035 * @param pThis The HPET device state. 1022 * @param pDevIns The device instance. 1023 * @param pThis The shared HPET state. 1036 1024 * @param pHpetTimer The HPET timer. 1037 1025 */ 1038 static void hpetR3TimerUpdateIrq(P HPET pThis, PHPETTIMER pHpetTimer)1026 static void hpetR3TimerUpdateIrq(PPDMDEVINS pDevIns, PHPET pThis, PHPETTIMER pHpetTimer) 1039 1027 { 1040 1028 /** @todo is it correct? */ … … 1042 1030 && !!(pThis->u64HpetConfig & HPET_CFG_ENABLE)) 1043 1031 { 1044 uint32_t irq = hpetR3TimerGetIrq(p HpetTimer);1032 uint32_t irq = hpetR3TimerGetIrq(pThis, pHpetTimer); 1045 1033 Log4(("HPET: raising IRQ %d\n", irq)); 1046 1034 … … 1052 1040 level-triggered mode yet. */ 1053 1041 if ((pHpetTimer->u64Config & HPET_TN_INT_TYPE) == HPET_TIMER_TYPE_EDGE) 1054 pThis->pHpetHlpR3->pfnSetIrq(p This->CTX_SUFF(pDevIns), irq, PDM_IRQ_LEVEL_FLIP_FLOP);1042 pThis->pHpetHlpR3->pfnSetIrq(pDevIns, irq, PDM_IRQ_LEVEL_FLIP_FLOP); 1055 1043 else 1056 1044 AssertFailed(); … … 1107 1095 1108 1096 /* Should it really be under lock, does it really matter? */ 1109 hpetR3TimerUpdateIrq(p This, pHpetTimer);1097 hpetR3TimerUpdateIrq(pDevIns, pThis, pHpetTimer); 1110 1098 } 1111 1099 … … 1283 1271 NOREF(offDelta); 1284 1272 1285 pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);1286 1273 pThis->pHpetHlpRC = pThis->pHpetHlpR3->pfnGetRCHelpers(pDevIns); 1287 1288 for (unsigned i = 0; i < RT_ELEMENTS(pThis->aTimers); i++)1289 {1290 PHPETTIMER pTm = &pThis->aTimers[i];1291 pTm->pHpetRC = PDMINS_2_DATA_RCPTR(pDevIns);1292 }1293 1274 } 1294 1275 … … 1373 1354 * Initialize the device state. 1374 1355 */ 1375 pThis->pDevInsR3 = pDevIns;1376 pThis->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);1377 pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);1378 1356 1379 1357 /* Init the HPET timers (init all regardless of how many we expose). */ … … 1381 1359 { 1382 1360 PHPETTIMER pHpetTimer = &pThis->aTimers[i]; 1383 1384 1361 pHpetTimer->idxTimer = i; 1385 pHpetTimer->pHpetR3 = pThis; 1386 pHpetTimer->pHpetR0 = PDMINS_2_DATA_R0PTR(pDevIns); 1387 pHpetTimer->pHpetRC = PDMINS_2_DATA_RCPTR(pDevIns); 1362 pHpetTimer->hTimer = NIL_TMTIMERHANDLE; 1388 1363 } 1389 1364
Note:
See TracChangeset
for help on using the changeset viewer.