VirtualBox

Changeset 36870 in vbox


Ignore:
Timestamp:
Apr 28, 2011 7:44:09 AM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
71447
Message:

Devices/HPET: cosmetical nitpicking

Location:
trunk/src/VBox/Devices
Files:
2 edited

Legend:

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

    r36837 r36870  
    5858
    5959/*
    60  * 69841279 femtoseconds == 69.84 ns
     60 * 69841279 femtoseconds == 69.84 ns (1 / 14.31818MHz)
    6161 */
    6262#define HPET_CLK_PERIOD_ICH9        69841279UL
     
    259259     * with the same speed.
    260260     */
    261     return  nsToHpetTicks(pThis, TMTimerGet(pThis->aTimers[0].CTX_SUFF(pTimer)) +
    262                           pThis->u64HpetOffset);
     261    return nsToHpetTicks(pThis, TMTimerGet(pThis->aTimers[0].CTX_SUFF(pTimer)) +
     262                                pThis->u64HpetOffset);
    263263}
    264264
     
    297297        u32Diff = ((int32_t)u32Diff > 0) ? u32Diff : (uint32_t)0;
    298298        return (uint64_t)u32Diff;
    299     } else {
     299    }
     300    else
     301    {
    300302        uint64_t u64Diff;
    301303
     
    311313{
    312314  uint64_t u64Period = pTimer->u64Period;
    313   if ((pTimer->u64Config & HPET_TN_PERIODIC) && (u64Period != 0))
     315  if (   (pTimer->u64Config & HPET_TN_PERIODIC)
     316      && (u64Period != 0))
    314317  {
    315318      /* While loop is suboptimal */
     
    348351    if (!pTimer->CTX_SUFF(pHpet)->fIch9)
    349352    {
    350         if ((pTimer->u64Config & HPET_TN_32BIT) && !(pTimer->u64Config & HPET_TN_PERIODIC))
     353        if (    (pTimer->u64Config & HPET_TN_32BIT)
     354            && !(pTimer->u64Config & HPET_TN_PERIODIC))
    351355        {
    352356            u32TillWrap = 0xffffffff - (uint32_t)u64Ticks;
     
    381385     * to the different ICs.
    382386     */
    383     if ((pTimer->u8TimerNumber <= 1) &&
    384         (pTimer->CTX_SUFF(pHpet)->u64HpetConfig & HPET_CFG_LEGACY))
     387    if (   (pTimer->u8TimerNumber <= 1)
     388        && (pTimer->CTX_SUFF(pHpet)->u64HpetConfig & HPET_CFG_LEGACY))
    385389        return (pTimer->u8TimerNumber == 0) ? 0 : 8;
    386     else
    387         return (pTimer->u64Config & HPET_TN_INT_ROUTE_MASK) >> HPET_TN_INT_ROUTE_SHIFT;
    388 }
    389 
    390 static int hpetTimerRegRead32(HpetState* pThis,
     390       
     391    return (pTimer->u64Config & HPET_TN_INT_ROUTE_MASK) >> HPET_TN_INT_ROUTE_SHIFT;
     392}
     393
     394static int hpetTimerRegRead32(HpetState *pThis,
    391395                              uint32_t   iTimerNo,
    392396                              uint32_t   iTimerReg,
    393                               uint32_t * pValue)
     397                              uint32_t  *pValue)
    394398{
    395399    HpetTimer *pTimer;
     
    434438}
    435439
    436 static int hpetConfigRegRead32(HpetState* pThis,
     440static int hpetConfigRegRead32(HpetState *pThis,
    437441                               uint32_t   iIndex,
    438442                               uint32_t  *pValue)
     
    540544                if (pTimer->u64Config & HPET_TN_32BIT)
    541545                    pTimer->u64Config &= ~HPET_TN_SETVAL;
    542             } else if (pTimer->u64Config & HPET_TN_PERIODIC)
     546            }
     547            else if (pTimer->u64Config & HPET_TN_PERIODIC)
    543548            {
    544549                iNewValue &= (pTimer->u64Config & HPET_TN_32BIT ? ~0U : ~0ULL) >> 1;
    545550                pTimer->u64Period = (pTimer->u64Period & 0xffffffff00000000ULL)
    546                         | iNewValue;
     551                                  | iNewValue;
    547552            }
    548553
    549554            pTimer->u64Cmp = (pTimer->u64Cmp & 0xffffffff00000000ULL)
    550                     | iNewValue;
     555                           | iNewValue;
    551556
    552557            Log2(("after HPET_TN_CMP cmp=%llx per=%llx\n", pTimer->u64Cmp, pTimer->u64Period));
     
    566571                /* HPET_TN_SETVAL allows to adjust comparator w/o updating period, and it's cleared on access */
    567572                pTimer->u64Config &= ~HPET_TN_SETVAL;
    568             } else if (pTimer->u64Config & HPET_TN_PERIODIC)
     573            }
     574            else if (pTimer->u64Config & HPET_TN_PERIODIC)
    569575            {
    570576                 pTimer->u64Period = (pTimer->u64Period & 0xffffffffULL)
    571                          | ((uint64_t)iNewValue << 32);
     577                                   | ((uint64_t)iNewValue << 32);
    572578            }
    573579
    574580            pTimer->u64Cmp = (pTimer->u64Cmp & 0xffffffffULL)
    575                     | ((uint64_t)iNewValue << 32);
     581                           | ((uint64_t)iNewValue << 32);
    576582
    577583            Log2(("after HPET_TN_CMP+4 cmp=%llx per=%llx\n", pTimer->u64Cmp, pTimer->u64Period));
     
    741747        case 4:
    742748        {
    743             if ((iIndex >= 0x100) && (iIndex < 0x400))
     749            if (iIndex >= 0x100 && iIndex < 0x400)
    744750                rc = hpetTimerRegRead32(pThis, (iIndex - 0x100) / 0x20, (iIndex - 0x100) % 0x20, (uint32_t*)pv);
    745751            else
     
    749755        case 8:
    750756        {
    751             union {
     757            union
     758            {
    752759                uint32_t u32[2];
    753760                uint64_t u64;
     
    761768                break;
    762769            }
    763             if ((iIndex >= 0x100) && (iIndex < 0x400))
     770            if (iIndex >= 0x100 && iIndex < 0x400)
    764771            {
    765772                uint32_t iTimer = (iIndex - 0x100) / 0x20;
     
    778785                    /* When reading HPET counter we must read it in a single read,
    779786                       to avoid unexpected time jumps on 32-bit overflow. */
    780                     value.u64 =
    781                             (pThis->u64HpetConfig & HPET_CFG_ENABLE) != 0
    782                             ?
    783                             hpetGetTicks(pThis)
    784                             :
    785                             pThis->u64HpetCounter;
     787                    value.u64 = (pThis->u64HpetConfig & HPET_CFG_ENABLE) != 0
     788                              ? hpetGetTicks(pThis)
     789                              : pThis->u64HpetCounter;
    786790                    rc = VINF_SUCCESS;
    787791                }
     
    837841        case 4:
    838842        {
    839             if ((iIndex >= 0x100) && (iIndex < 0x400))
     843            if (iIndex >= 0x100 && iIndex < 0x400)
    840844                rc = hpetTimerRegWrite32(pThis,
    841845                                         (iIndex - 0x100) / 0x20,
     
    848852        case 8:
    849853        {
    850             union {
     854            union
     855            {
    851856                uint32_t u32[2];
    852857                uint64_t u64;
     
    862867            value.u64 = *(uint64_t*)pv;
    863868            // for 8-byte accesses we just split them, happens under lock anyway
    864             if ((iIndex >= 0x100) && (iIndex < 0x400))
     869            if (iIndex >= 0x100 && iIndex < 0x400)
    865870            {
    866871                uint32_t iTimer = (iIndex - 0x100) / 0x20;
     
    10181023
    10191024    /** @todo: is it correct? */
    1020     if (!!(pTimer->u64Config & HPET_TN_ENABLE) &&
    1021         !!(pThis->u64HpetConfig & HPET_CFG_ENABLE))
     1025    if (   !!(pTimer->u64Config & HPET_TN_ENABLE)
     1026        && !!(pThis->u64HpetConfig & HPET_CFG_ENABLE))
    10221027    {
    10231028        Log4(("HPET: raising IRQ %d\n", irq));
     
    10711076        TMTimerSetNano(pTmTimer, hpetTicksToNs(pThis, u64Diff));
    10721077    }
    1073     else if ((pTimer->u64Config & HPET_TN_32BIT) &&
    1074              !(pTimer->u64Config & HPET_TN_PERIODIC))
     1078    else if (    (pTimer->u64Config & HPET_TN_32BIT)
     1079             && !(pTimer->u64Config & HPET_TN_PERIODIC))
    10751080    {
    10761081        if (pTimer->u8Wrap)
  • trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp

    r36273 r36870  
    16751675    GEN_CHECK_OFF(HpetState, u64Isr);
    16761676    GEN_CHECK_OFF(HpetState, u64HpetCounter);
     1677    GEN_CHECK_OFF(HpetState, csLock);
     1678    GEN_CHECK_OFF(HpetState, fIch9);
    16771679
    16781680    GEN_CHECK_SIZE(HpetTimer);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette