VirtualBox

Changeset 27226 in vbox


Ignore:
Timestamp:
Mar 9, 2010 5:33:16 PM (15 years ago)
Author:
vboxsync
Message:

HPET: minor issues related to egde vs. level triggered interrupts

File:
1 edited

Legend:

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

    r27126 r27226  
    3737 *     schedule interrupt earlier than in 1ms
    3838 *   - statistics not implemented
     39 *   - level-triggered mode not implemented
    3940 */
    4041/*
     
    8788#define HPET_CFG_WRITE_MASK      0x3
    8889
    89 #define HPET_TN_ENABLE           0x004
    90 #define HPET_TN_PERIODIC         0x008
    91 #define HPET_TN_PERIODIC_CAP     0x010
    92 #define HPET_TN_SIZE_CAP         0x020
    93 #define HPET_TN_SETVAL           0x040
    94 #define HPET_TN_32BIT            0x100
    95 #define HPET_TN_INT_ROUTE_MASK   0x3e00
    96 #define HPET_TN_CFG_WRITE_MASK   0x3f4e
    97 #define HPET_TN_INT_ROUTE_SHIFT      9
    98 #define HPET_TN_INT_ROUTE_CAP_SHIFT 32
     90#define HPET_TN_INT_TYPE                      (1 << 1)
     91#define HPET_TN_ENABLE                        (1 << 2)
     92#define HPET_TN_PERIODIC                      (1 << 3)
     93#define HPET_TN_PERIODIC_CAP                  (1 << 4)
     94#define HPET_TN_SIZE_CAP                      (1 << 5)
     95#define HPET_TN_SETVAL                        (1 << 6)
     96#define HPET_TN_32BIT                         (1 << 8)
     97#define HPET_TN_INT_ROUTE_MASK                0x3e00
     98#define HPET_TN_CFG_WRITE_MASK                0x3f4e
     99#define HPET_TN_INT_ROUTE_SHIFT               9
     100#define HPET_TN_INT_ROUTE_CAP_SHIFT           32
    99101#define HPET_TN_CFG_BITS_READONLY_OR_RESERVED 0xffff80b1U
    100102
     
    359361     *        PIT and RTC
    360362     */
    361     /*
    362      * nike: Linux refuses to boot with HPET, claiming that 8259 timer not
    363      * connected to IO-APIC, if we use IRQ2, so let's use IRQ0 for now.
    364      */
    365363    if ((pTimer->u8TimerNumber <= 1) &&
    366364        (pTimer->CTX_SUFF(pHpet)->u64Config & HPET_CFG_LEGACY))
     
    488486        {
    489487            Log(("write HPET_TN_CFG: %d\n", iTimerNo));
     488            if (iNewValue & HPET_TN_32BIT)
     489            {
     490                pTimer->u64Cmp = (uint32_t)pTimer->u64Cmp;
     491                pTimer->u64Period = (uint32_t)pTimer->u64Period;
     492            }
     493            if ((iNewValue & HPET_TN_INT_TYPE) == HPET_TIMER_TYPE_LEVEL)
     494            {
     495                LogRel(("level-triggered config not yet supported\n"));
     496                Assert(false);
     497            }
    490498            /** We only care about lower 32-bits so far */
    491499            pTimer->u64Config =
    492500                    updateMasked(iNewValue, iOldValue, HPET_TN_CFG_WRITE_MASK);
    493             if (iNewValue & HPET_TN_32BIT)
    494             {
    495                 pTimer->u64Cmp = (uint32_t)pTimer->u64Cmp;
    496                 pTimer->u64Period = (uint32_t)pTimer->u64Period;
    497             }
    498             if (iNewValue & HPET_TIMER_TYPE_LEVEL)
    499             {
    500                 LogRel(("level-triggered config not yet supported\n"));
    501                 Assert(false);
    502             }
    503501            break;
    504502        }
     
    984982    {
    985983        Log4(("HPET: raising IRQ %d\n", irq));
    986         if ((pTimer->u64Config & HPET_TIMER_TYPE_LEVEL) == 0)
    987         {
     984
     985        /* ISR bits are only set in level-triggered mode */
     986        if ((pTimer->u64Config & HPET_TN_INT_TYPE) == HPET_TIMER_TYPE_LEVEL)
    988987            pThis->u64Isr |= (uint64_t)(1 << pTimer->u8TimerNumber);
     988
     989        /* We trigger flip/flop in edge-triggered mode and do nothing in level-triggered mode yet */
     990        if ((pTimer->u64Config & HPET_TN_INT_TYPE) == HPET_TIMER_TYPE_EDGE)
    989991            pThis->pHpetHlpR3->pfnSetIrq(pThis->CTX_SUFF(pDevIns), irq, PDM_IRQ_LEVEL_FLIP_FLOP);
    990         }
     992        /* @todo: implement IRQs in level-triggered mode */
    991993    }
    992994}
     
    12031205
    12041206    /* Query configuration. */
    1205 #if 1
     1207#if 0
    12061208    rc = CFGMR3QueryBoolDef(pCfg, "GCEnabled", &fRCEnabled, true);
    12071209    if (RT_FAILURE(rc))
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