VirtualBox

Changeset 26888 in vbox for trunk


Ignore:
Timestamp:
Feb 28, 2010 5:26:07 AM (15 years ago)
Author:
vboxsync
Message:

HPET: minor tweaks

File:
1 edited

Legend:

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

    r26766 r26888  
    408408    {
    409409        case HPET_TN_CFG:
    410             Log(("HPET_TN_CFG on %d\n", pTimer->u8TimerNumber));
     410            Log(("read HPET_TN_CFG on %d\n", pTimer->u8TimerNumber));
    411411            *pValue = (uint32_t)(pTimer->u64Config);
    412412            break;
    413413        case HPET_TN_CFG + 4:
    414             Log(("HPET_TN_CFG+4 on %d\n", pTimer->u8TimerNumber));
     414            Log(("read HPET_TN_CFG+4 on %d\n", pTimer->u8TimerNumber));
    415415            *pValue = (uint32_t)(pTimer->u64Config >> 32);
    416416            break;
    417417        case HPET_TN_CMP:
    418             Log(("HPET_TN_CMP on %d\n", pTimer->u8TimerNumber));
     418            Log(("read HPET_TN_CMP on %d, cmp=%llx\n", pTimer->u8TimerNumber, pTimer->u64Cmp));
    419419            *pValue = (uint32_t)(pTimer->u64Cmp);
    420420            break;
    421421        case HPET_TN_CMP + 4:
    422             Log(("HPET_TN_CMP+4 on %d\n", pTimer->u8TimerNumber));
     422            Log(("read HPET_TN_CMP+4 on %d, cmp=%llx\n", pTimer->u8TimerNumber, pTimer->u64Cmp));
    423423            *pValue = (uint32_t)(pTimer->u64Cmp >> 32);
    424424            break;
    425425        case HPET_TN_ROUTE:
    426             Log(("HPET_TN_ROUTE on %d\n", pTimer->u8TimerNumber));
     426            Log(("read HPET_TN_ROUTE on %d\n", pTimer->u8TimerNumber));
    427427            *pValue = (uint32_t)(pTimer->u64Fsb >> 32);
    428428            break;
    429429        default:
    430             LogRel(("invalid HPET register %d on %d\n", iTimerReg, pTimer->u8TimerNumber));
     430            LogRel(("invalid HPET register read %d on %d\n", iTimerReg, pTimer->u8TimerNumber));
    431431            break;
    432432        }
     
    507507        case HPET_TN_CFG:
    508508        {
    509             Log(("write HPET_TN_CFG\n"));
     509            Log(("write HPET_TN_CFG: %d\n", iTimerNo));
    510510            /** We only care about lower 32-bits so far */
    511511            pTimer->u64Config =
     
    530530        case HPET_TN_CMP: /* lower bits of comparator register */
    531531        {
    532             Log(("write HPET_TN_CMP\n"));
     532            Log(("write HPET_TN_CMP on %d: %x\n", iTimerNo, iNewValue));
    533533            if (pTimer->u64Config & HPET_TN_32BIT)
    534534                iNewValue = (uint32_t)iNewValue;
    535535
    536             if (!(pTimer->u64Config & HPET_TN_PERIODIC) ||
    537                 (pTimer->u64Config & HPET_TN_SETVAL))
    538             {
    539                 pTimer->u64Cmp = (pTimer->u64Cmp & 0xffffffff00000000ULL)
    540                         | iNewValue;
    541             }
    542             else
    543             {
    544                 iNewValue &= (pTimer->u64Config & HPET_TN_32BIT ? ~0u : ~0ull) >> 1;
     536            if (pTimer->u64Config & HPET_TN_SETVAL)
     537            {
     538                /* HPET_TN_SETVAL allows to adjust comparator w/o updating period, and it's cleared on access */
     539                if (pTimer->u64Config & HPET_TN_32BIT)
     540                    pTimer->u64Config &= ~HPET_TN_SETVAL;
     541            } else if (pTimer->u64Config & HPET_TN_PERIODIC)
     542            {
     543                iNewValue &= (pTimer->u64Config & HPET_TN_32BIT ? ~0U : ~0ULL) >> 1;
    545544                pTimer->u64Period = (pTimer->u64Period & 0xffffffff00000000ULL)
    546545                        | iNewValue;
    547546            }
    548             pTimer->u64Config &= ~HPET_TN_SETVAL;
     547
     548            pTimer->u64Cmp = (pTimer->u64Cmp & 0xffffffff00000000ULL)
     549                    | iNewValue;
     550
     551            Log2(("after HPET_TN_CMP cmp=%llx per=%llx\n", pTimer->u64Cmp, pTimer->u64Period));
    549552
    550553            if (pThis->u64Config & HPET_CFG_ENABLE)
     
    552555            break;
    553556        }
    554         case HPET_TN_CMP + 4: /* upper bits of comparator */
    555         {
    556             Log(("write HPET_TN_CMP + 4\n"));
    557             if (!(pTimer->u64Config & HPET_TN_PERIODIC) ||
    558                 (pTimer->u64Config & HPET_TN_SETVAL))
    559             {
    560                 pTimer->u64Cmp = (pTimer->u64Cmp & 0xffffffffULL)
    561                         | ((uint64_t)iNewValue << 32);
     557        case HPET_TN_CMP + 4: /* upper bits of comparator register */
     558        {
     559            Log(("write HPET_TN_CMP + 4 on %d: %x\n", iTimerNo, iNewValue));
     560            if (pTimer->u64Config & HPET_TN_32BIT)
     561                break;
     562
     563            if (pTimer->u64Config & HPET_TN_SETVAL)
     564            {
     565                /* HPET_TN_SETVAL allows to adjust comparator w/o updating period, and it's cleared on access */
     566                pTimer->u64Config &= ~HPET_TN_SETVAL;
     567            } else if (pTimer->u64Config & HPET_TN_PERIODIC)
     568            {
     569                 pTimer->u64Period = (pTimer->u64Period & 0xffffffffULL)
     570                         | ((uint64_t)iNewValue << 32);
    562571            }
    563             else
    564             {
    565                 iNewValue &= (pTimer->u64Config & HPET_TN_32BIT ? ~0u : ~0ull) >> 1;
    566                 pTimer->u64Period = (pTimer->u64Period & 0xffffffffULL)
    567                         | ((uint64_t)iNewValue << 32);
    568             }
    569 
    570             pTimer->u64Config &= ~HPET_TN_SETVAL;
     572
     573            pTimer->u64Cmp = (pTimer->u64Cmp & 0xffffffffULL)
     574                    | ((uint64_t)iNewValue << 32);
     575
     576            Log2(("after HPET_TN_CMP+4 cmp=%llx per=%llx\n", pTimer->u64Cmp, pTimer->u64Period));
    571577
    572578            if (pThis->u64Config & HPET_CFG_ENABLE)
     
    726732        case 1:
    727733        case 2:
    728             /** @todo: error? */
    729734            Log(("Narrow read: %d\n", cb));
     735            rc = VERR_INTERNAL_ERROR;
    730736            break;
    731737        case 4:
     
    805811        case 1:
    806812        case 2:
    807              /** @todo: error? */
    808813            Log(("Narrow write: %d\n", cb));
     814            rc = VERR_INTERNAL_ERROR;
    809815            break;
    810816        case 4:
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