VirtualBox

Changeset 37537 in vbox for trunk


Ignore:
Timestamp:
Jun 17, 2011 12:50:25 PM (13 years ago)
Author:
vboxsync
Message:

DevHPET: Report the correct number of timers (off by one), making ICH9 report 4 and PIIX3/4 3. Should not affect the saved state.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/DevHPET.cpp

    r37536 r37537  
    4040 *   - level-triggered mode not implemented
    4141 */
    42 /*
    43  * Base address for MMIO
    44  */
     42
     43/** Base address for MMIO. */
    4544#define HPET_BASE                   0xfed00000
    4645
    47 /*
    48  * Number of available timers, cannot be changed without
    49  * breaking saved states.
    50  */
    51 #define HPET_NUM_TIMERS             3
     46/** The number of timers for PIIX4 / PIIX3. */
     47#define HPET_NUM_TIMERS_PIIX        3
     48/** The number of timers for ICH9. */
    5249#define HPET_NUM_TIMERS_ICH9        4
    5350
     
    226223
    227224    /** Timer structures. */
    228     HpetTimer            aTimers[HPET_NUM_TIMERS];
     225    HpetTimer            aTimers[RT_MAX(HPET_NUM_TIMERS_PIIX, HPET_NUM_TIMERS_ICH9)];
    229226
    230227    /** Offset realtive to the virtual sync clock. */
     
    13311328    uint32_t u32Caps = (1 << 15)              /* LEG_RT_CAP       - LegacyReplacementRoute capable. */
    13321329                     | (1 << 13)              /* COUNTER_SIZE_CAP - Main counter is 64-bit capable. */
    1333                      | (HPET_NUM_TIMERS << 8) /* NUM_TIM_CAP      - Number of timers -1.
    1334                                                  Actually ICH9 has 4 timers, but to avoid breaking
    1335                                                  saved state we'll stick with 3 so far. */ /** @todo fix this ICH9 timer count bug. */
    1336                                               /** @todo what about the '-1' bit?? Linux thinks it has 4 timers. */
    1337                      | 1                      /* REV_ID           - Revision, must not be 0 */
    1338                      ;
     1330                     | 1;                     /* REV_ID           - Revision, must not be 0 */
     1331    if (pThis->fIch9)                         /* NUM_TIM_CAP      - Number of timers -1. */
     1332        u32Caps |= (HPET_NUM_TIMERS_ICH9 - 1) << 8;
     1333    else
     1334        u32Caps |= (HPET_NUM_TIMERS_PIIX - 1) << 8;
     1335    AssertCompile(HPET_NUM_TIMERS_ICH9 <= RT_ELEMENTS(pThis->aTimers));
     1336    AssertCompile(HPET_NUM_TIMERS_PIIX <= RT_ELEMENTS(pThis->aTimers));
     1337
    13391338    pThis->u64Capabilities = (u32Vendor << 16) | u32Caps;
    13401339    pThis->u64Capabilities |= ((uint64_t)(pThis->fIch9 ? HPET_CLK_PERIOD_ICH9 : HPET_CLK_PERIOD) << 32);
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