VirtualBox

Changeset 35853 in vbox for trunk/src/VBox/Devices/PC


Ignore:
Timestamp:
Feb 4, 2011 2:38:31 PM (14 years ago)
Author:
vboxsync
Message:

PIT: Use the mode 2 optimization also for modes 4 and 5.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/DevPit-i8254.cpp

    r35848 r35853  
    254254    case 4:
    255255    case 5:
    256         out = (d == s->count);
     256        out = (d != s->count);
    257257        break;
    258258    }
     
    395395            next_time = base + s->count;
    396396        break;
     397    /* Modes 4 and 5 generate a short pulse at the end of the time delay. This
     398     * is similar to mode 2, except modes 4/5 aren't periodic. We use the same
     399     * optimization - only use one timer callback and pulse the IRQ.
     400     * Note: Tickless Linux kernels use PIT mode 4 with 'nolapic'.
     401     */
    397402    case 4:
    398403    case 5:
     404#ifdef VBOX
     405        if (d <= s->count)
     406            next_time = s->count;
     407#else
    399408        if (d < s->count)
    400409            next_time = s->count;
    401410        else if (d == s->count)
    402411            next_time = s->count + 1;
     412#endif
    403413        else
    404414            return -1;
     
    438448        pDevIns = s->CTX_SUFF(pPit)->pDevIns;
    439449
    440         if (EFFECTIVE_MODE(s->mode) == 2 && in_timer)
     450        switch (EFFECTIVE_MODE(s->mode))
    441451        {
    442             /* We just flip-flop the irq level to save that extra timer call, which
    443              * isn't generally required (we haven't served it for years). However,
    444              * the pulse is only generated when running on the timer callback (and
    445              * thus on the trailing edge of the output signal pulse).
    446              */
    447             PDMDevHlpISASetIrq(pDevIns, s->irq, PDM_IRQ_LEVEL_FLIP_FLOP);
    448 
    449         } else
    450             PDMDevHlpISASetIrq(pDevIns, s->irq, irq_level);
     452            case 2:
     453            case 4:
     454            case 5:
     455                /* We just flip-flop the IRQ line to save an extra timer call,
     456                 * which isn't generally required. However, the pulse is only
     457                 * generated when running on the timer callback (and thus on
     458                 * the trailing edge of the output signal pulse).
     459                 */
     460                if (in_timer)
     461                {
     462                    PDMDevHlpISASetIrq(pDevIns, s->irq, PDM_IRQ_LEVEL_FLIP_FLOP);
     463                    break;
     464                }
     465                /* Else fall through! */
     466            default:
     467                PDMDevHlpISASetIrq(pDevIns, s->irq, irq_level);
     468                break;
     469        }
    451470    }
    452471
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