Changeset 37506 in vbox
- Timestamp:
- Jun 16, 2011 4:39:53 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/DevHPET.cpp
r37505 r37506 379 379 380 380 381 /* -=-=-=-=-=- Register accesses -=-=-=-=-=- */ 382 383 381 384 /** 382 385 * Reads a HPET timer register. … … 439 442 } 440 443 } 441 *pu32Value = u32Value;442 return VINF_SUCCESS;443 }444 445 446 /**447 * Read a 32-bit HPET register.448 *449 * @returns Strict VBox status code.450 * @param pThis The HPET state.451 * @param idxReg The register to read.452 * @param pu32Value Where to return the register value.453 */454 static int hpetConfigRegRead32(HpetState const *pThis, uint32_t idxReg, uint32_t *pu32Value)455 {456 uint32_t u32Value;457 switch (idxReg)458 {459 case HPET_ID:460 u32Value = (uint32_t)pThis->u64Capabilities;461 Log(("read HPET_ID: %#x\n", u32Value));462 break;463 464 case HPET_PERIOD:465 u32Value = (uint32_t)(pThis->u64Capabilities >> 32);466 Log(("read HPET_PERIOD: %#x\n", u32Value));467 break;468 469 case HPET_CFG:470 u32Value = (uint32_t)pThis->u64HpetConfig;471 Log(("read HPET_CFG: %#x\n", u32Value));472 break;473 474 case HPET_CFG + 4:475 u32Value = (uint32_t)(pThis->u64HpetConfig >> 32);476 Log(("read of HPET_CFG + 4: %#x\n", u32Value));477 break;478 479 case HPET_COUNTER:480 case HPET_COUNTER + 4:481 {482 uint64_t u64Ticks;483 if (pThis->u64HpetConfig & HPET_CFG_ENABLE)484 u64Ticks = hpetGetTicks(pThis);485 else486 u64Ticks = pThis->u64HpetCounter;487 /** @todo is it correct? */488 u32Value = (idxReg == HPET_COUNTER) ? (uint32_t)u64Ticks : (uint32_t)(u64Ticks >> 32);489 Log(("read HPET_COUNTER: %s part value %x (%#llx)\n",490 (idxReg == HPET_COUNTER) ? "low" : "high", u32Value, u64Ticks));491 break;492 }493 494 case HPET_STATUS:495 Log(("read HPET_STATUS\n"));496 u32Value = (uint32_t)pThis->u64Isr;497 break;498 499 default:500 Log(("invalid HPET register read: %x\n", idxReg));501 u32Value = 0;502 break;503 }504 505 444 *pu32Value = u32Value; 506 445 return VINF_SUCCESS; … … 625 564 } 626 565 566 return VINF_SUCCESS; 567 } 568 569 570 571 572 573 /** 574 * Read a 32-bit HPET register. 575 * 576 * @returns Strict VBox status code. 577 * @param pThis The HPET state. 578 * @param idxReg The register to read. 579 * @param pu32Value Where to return the register value. 580 */ 581 static int hpetConfigRegRead32(HpetState const *pThis, uint32_t idxReg, uint32_t *pu32Value) 582 { 583 uint32_t u32Value; 584 switch (idxReg) 585 { 586 case HPET_ID: 587 u32Value = (uint32_t)pThis->u64Capabilities; 588 Log(("read HPET_ID: %#x\n", u32Value)); 589 break; 590 591 case HPET_PERIOD: 592 u32Value = (uint32_t)(pThis->u64Capabilities >> 32); 593 Log(("read HPET_PERIOD: %#x\n", u32Value)); 594 break; 595 596 case HPET_CFG: 597 u32Value = (uint32_t)pThis->u64HpetConfig; 598 Log(("read HPET_CFG: %#x\n", u32Value)); 599 break; 600 601 case HPET_CFG + 4: 602 u32Value = (uint32_t)(pThis->u64HpetConfig >> 32); 603 Log(("read of HPET_CFG + 4: %#x\n", u32Value)); 604 break; 605 606 case HPET_COUNTER: 607 case HPET_COUNTER + 4: 608 { 609 uint64_t u64Ticks; 610 if (pThis->u64HpetConfig & HPET_CFG_ENABLE) 611 u64Ticks = hpetGetTicks(pThis); 612 else 613 u64Ticks = pThis->u64HpetCounter; 614 /** @todo is it correct? */ 615 u32Value = (idxReg == HPET_COUNTER) ? (uint32_t)u64Ticks : (uint32_t)(u64Ticks >> 32); 616 Log(("read HPET_COUNTER: %s part value %x (%#llx)\n", 617 (idxReg == HPET_COUNTER) ? "low" : "high", u32Value, u64Ticks)); 618 break; 619 } 620 621 case HPET_STATUS: 622 Log(("read HPET_STATUS\n")); 623 u32Value = (uint32_t)pThis->u64Isr; 624 break; 625 626 default: 627 Log(("invalid HPET register read: %x\n", idxReg)); 628 u32Value = 0; 629 break; 630 } 631 632 *pu32Value = u32Value; 627 633 return VINF_SUCCESS; 628 634 }
Note:
See TracChangeset
for help on using the changeset viewer.