VirtualBox

Ignore:
Timestamp:
Oct 29, 2015 4:30:44 AM (9 years ago)
Author:
vboxsync
Message:

EFI/Firmware: Merged in the svn:eol-style, svn:mime-type and trailing whitespace cleanup that was done after the initial UDK2014.SP1 import: svn merge /vendor/edk2/UDK2014.SP1 /vendor/edk2/current .

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/Firmware

  • trunk/src/VBox/Devices/EFI/Firmware/PcAtChipsetPkg/HpetTimerDxe/HpetTimer.c

    r58459 r58466  
    5353
    5454  @param  This            The EFI_TIMER_ARCH_PROTOCOL instance.
    55   @param  NotifyFunction  The function to call when a timer interrupt fires. 
    56                           This function executes at TPL_HIGH_LEVEL.  The DXE 
    57                           Core will register a handler for the timer interrupt, 
    58                           so it can know how much time has passed.  This 
    59                           information is used to signal timer based events. 
     55  @param  NotifyFunction  The function to call when a timer interrupt fires.
     56                          This function executes at TPL_HIGH_LEVEL.  The DXE
     57                          Core will register a handler for the timer interrupt,
     58                          so it can know how much time has passed.  This
     59                          information is used to signal timer based events.
    6060                          NULL will unregister the handler.
    6161
     
    9191  @param  This         The EFI_TIMER_ARCH_PROTOCOL instance.
    9292  @param  TimerPeriod  The rate to program the timer interrupt in 100 nS units.
    93                        If the timer hardware is not programmable, then 
    94                        EFI_UNSUPPORTED is returned.  If the timer is programmable, 
    95                        then the timer period will be rounded up to the nearest 
    96                        timer period that is supported by the timer hardware. 
    97                        If TimerPeriod is set to 0, then the timer interrupts 
     93                       If the timer hardware is not programmable, then
     94                       EFI_UNSUPPORTED is returned.  If the timer is programmable,
     95                       then the timer period will be rounded up to the nearest
     96                       timer period that is supported by the timer hardware.
     97                       If TimerPeriod is set to 0, then the timer interrupts
    9898                       will be disabled.
    9999
     
    143143
    144144  @retval  EFI_SUCCESS       The soft timer interrupt was generated.
    145   @retval  EFI_UNSUPPORTEDT  The platform does not support the generation of soft 
     145  @retval  EFI_UNSUPPORTEDT  The platform does not support the generation of soft
    146146                             timer interrupts.
    147147
     
    152152  IN EFI_TIMER_ARCH_PROTOCOL  *This
    153153  );
    154  
     154
    155155///
    156156/// The handle onto which the Timer Architectural Protocol will be installed.
     
    223223
    224224///
    225 /// Cached state of the Configuration register for the HPET Timer managed by 
     225/// Cached state of the Configuration register for the HPET Timer managed by
    226226/// this driver.  Caching the state reduces the number of times the configuration
    227227/// register is read.
     
    278278  )
    279279{
    280   mHpetGeneralConfiguration.Bits.MainCounterEnable = Enable ? 1 : 0; 
     280  mHpetGeneralConfiguration.Bits.MainCounterEnable = Enable ? 1 : 0;
    281281  HpetWrite (HPET_GENERAL_CONFIGURATION_OFFSET, mHpetGeneralConfiguration.Uint64);
    282282}
     
    287287  If a notification function is registered, then the amount of time since the last
    288288  HPET interrupt is passed to that notification function in 100 ns units.  The HPET
    289   time is updated to generate another interrupt in the required time period. 
     289  time is updated to generate another interrupt in the required time period.
    290290
    291291  @param  InterruptType  The type of interrupt that occured.
     
    323323  //
    324324  HpetEnable (FALSE);
    325  
     325
    326326  //
    327327  // Capture main counter value
     
    364364  //
    365365  HpetEnable (TRUE);
    366  
     366
    367367  //
    368368  // Check to see if there is a registered notification function
     
    370370  if (mTimerNotifyFunction != NULL) {
    371371    //
    372     // Compute time since last notification in 100 ns units (10 ^ -7) 
     372    // Compute time since last notification in 100 ns units (10 ^ -7)
    373373    //
    374374    if (MainCounter > mPreviousMainCounter) {
     
    387387                      Delta & mCounterMask,
    388388                      mHpetGeneralCapabilities.Bits.CounterClockPeriod
    389                       ), 
     389                      ),
    390390                    100000000
    391391                    );
    392                    
     392
    393393    //
    394394    // Call registered notification function passing in the time since the last
    395395    // interrupt in 100 ns units.
    396     //   
     396    //
    397397    mTimerNotifyFunction (TimerPeriod);
    398398  }
    399  
     399
    400400  //
    401401  // Save main counter value
     
    418418
    419419  @param  This            The EFI_TIMER_ARCH_PROTOCOL instance.
    420   @param  NotifyFunction  The function to call when a timer interrupt fires. 
    421                           This function executes at TPL_HIGH_LEVEL.  The DXE 
    422                           Core will register a handler for the timer interrupt, 
    423                           so it can know how much time has passed.  This 
    424                           information is used to signal timer based events. 
     420  @param  NotifyFunction  The function to call when a timer interrupt fires.
     421                          This function executes at TPL_HIGH_LEVEL.  The DXE
     422                          Core will register a handler for the timer interrupt,
     423                          so it can know how much time has passed.  This
     424                          information is used to signal timer based events.
    425425                          NULL will unregister the handler.
    426426
     
    474474  @param  This         The EFI_TIMER_ARCH_PROTOCOL instance.
    475475  @param  TimerPeriod  The rate to program the timer interrupt in 100 nS units.
    476                        If the timer hardware is not programmable, then 
    477                        EFI_UNSUPPORTED is returned.  If the timer is programmable, 
    478                        then the timer period will be rounded up to the nearest 
    479                        timer period that is supported by the timer hardware. 
    480                        If TimerPeriod is set to 0, then the timer interrupts 
     476                       If the timer hardware is not programmable, then
     477                       EFI_UNSUPPORTED is returned.  If the timer is programmable,
     478                       then the timer period will be rounded up to the nearest
     479                       timer period that is supported by the timer hardware.
     480                       If TimerPeriod is set to 0, then the timer interrupts
    481481                       will be disabled.
    482482
     
    497497  UINT64                         CurrentComparator;
    498498  HPET_TIMER_MSI_ROUTE_REGISTER  HpetTimerMsiRoute;
    499  
     499
    500500  //
    501501  // Disable HPET timer when adjusting the timer period
    502502  //
    503503  HpetEnable (FALSE);
    504  
     504
    505505  if (TimerPeriod == 0) {
    506506    if (mTimerPeriod != 0) {
     
    511511      if (MainCounter < mPreviousMainCounter) {
    512512        Delta = (mCounterMask - mPreviousMainCounter) + MainCounter;
    513       } else { 
     513      } else {
    514514        Delta = MainCounter - mPreviousMainCounter;
    515515      }
     
    530530    // If TimerPeriod is 0, then mask HPET Timer interrupts
    531531    //
    532    
     532
    533533    if (mTimerConfiguration.Bits.MsiInterruptCapablity != 0 && FeaturePcdGet (PcdHpetMsiEnable)) {
    534534      //
     
    542542      IoApicEnableInterrupt (mTimerIrq, FALSE);
    543543    }
    544    
    545     //
    546     // Disable HPET timer interrupt 
     544
     545    //
     546    // Disable HPET timer interrupt
    547547    //
    548548    mTimerConfiguration.Bits.InterruptEnable = 0;
     
    550550  } else {
    551551    //
    552     // Convert TimerPeriod to femtoseconds and divide by the number if femtoseconds 
     552    // Convert TimerPeriod to femtoseconds and divide by the number if femtoseconds
    553553    // per tick of the HPET counter to determine the number of HPET counter ticks
    554554    // in TimerPeriod 100 ns units.
    555     // 
     555    //
    556556    mTimerCount = DivU64x32 (
    557557                    MultU64x32 (TimerPeriod, 100000000),
     
    565565    if (MainCounter > mPreviousMainCounter) {
    566566      Delta = MainCounter - mPreviousMainCounter;
    567     } else { 
     567    } else {
    568568      Delta = (mCounterMask - mPreviousMainCounter) + MainCounter;
    569569    }
    570570    if ((Delta & mCounterMask) >= mTimerCount) {
    571571      HpetWrite (HPET_TIMER_COMPARATOR_OFFSET + mTimerIndex * HPET_TIMER_STRIDE, (MainCounter + 1) & mCounterMask);
    572     } else { 
     572    } else {
    573573      HpetWrite (HPET_TIMER_COMPARATOR_OFFSET + mTimerIndex * HPET_TIMER_STRIDE, (mPreviousMainCounter + mTimerCount) & mCounterMask);
    574574    }
    575    
     575
    576576    //
    577577    // Enable HPET Timer interrupt generation
     
    604604    HpetWrite (HPET_TIMER_CONFIGURATION_OFFSET + mTimerIndex * HPET_TIMER_STRIDE, mTimerConfiguration.Uint64);
    605605  }
    606    
     606
    607607  //
    608608  // Save the new timer period
     
    617617  //
    618618  HpetEnable (TRUE);
    619  
     619
    620620  return EFI_SUCCESS;
    621621}
     
    663663
    664664  @retval  EFI_SUCCESS       The soft timer interrupt was generated.
    665   @retval  EFI_UNSUPPORTEDT  The platform does not support the generation of soft 
     665  @retval  EFI_UNSUPPORTEDT  The platform does not support the generation of soft
    666666                             timer interrupts.
    667667
     
    680680  //
    681681  // Disable interrupts
    682   // 
     682  //
    683683  Tpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
    684  
     684
    685685  //
    686686  // Capture main counter value
     
    693693  if (mTimerNotifyFunction != NULL) {
    694694    //
    695     // Compute time since last interrupt in 100 ns units (10 ^ -7) 
     695    // Compute time since last interrupt in 100 ns units (10 ^ -7)
    696696    //
    697697    if (MainCounter > mPreviousMainCounter) {
     
    711711                      Delta & mCounterMask,
    712712                      mHpetGeneralCapabilities.Bits.CounterClockPeriod
    713                       ), 
     713                      ),
    714714                    100000000
    715715                    );
    716                    
     716
    717717    //
    718718    // Call registered notification function passing in the time since the last
    719719    // interrupt in 100 ns units.
    720     //   
     720    //
    721721    mTimerNotifyFunction (TimerPeriod);
    722722  }
     
    726726  //
    727727  mPreviousMainCounter = MainCounter;
    728  
     728
    729729  //
    730730  // Restore interrupts
    731   // 
     731  //
    732732  gBS->RestoreTPL (Tpl);
    733  
     733
    734734  return EFI_SUCCESS;
    735735}
     
    773773  //
    774774  // Retrieve HPET Capabilities and Configuration Information
    775   // 
     775  //
    776776  mHpetGeneralCapabilities.Uint64  = HpetRead (HPET_GENERAL_CAPABILITIES_ID_OFFSET);
    777777  mHpetGeneralConfiguration.Uint64 = HpetRead (HPET_GENERAL_CONFIGURATION_OFFSET);
    778  
    779   //
    780   // If Revision is not valid, then ASSERT() and unload the driver because the HPET 
     778
     779  //
     780  // If Revision is not valid, then ASSERT() and unload the driver because the HPET
    781781  // device is not present.
    782   // 
     782  //
    783783  ASSERT (mHpetGeneralCapabilities.Uint64 != 0);
    784784  ASSERT (mHpetGeneralCapabilities.Uint64 != 0xFFFFFFFFFFFFFFFFULL);
     
    795795  //
    796796  // Dump HPET Configuration Information
    797   // 
     797  //
    798798  DEBUG_CODE (
    799799    DEBUG ((DEBUG_INFO, "HPET Base Address = 0x%08x\n", PcdGet32 (PcdHpetBaseAddress)));
     
    809809    }
    810810  );
    811  
     811
    812812  //
    813813  // Capture the current HPET main counter value.
    814814  //
    815815  mPreviousMainCounter = HpetRead (HPET_MAIN_COUNTER_OFFSET);
    816  
    817   //
    818   // Determine the interrupt mode to use for the HPET Timer. 
     816
     817  //
     818  // Determine the interrupt mode to use for the HPET Timer.
    819819  // Look for MSI first, then unused PIC mode interrupt, then I/O APIC mode interrupt
    820   // 
     820  //
    821821  MsiTimerIndex = HPET_INVALID_TIMER_INDEX;
    822822  mTimerIndex   = HPET_INVALID_TIMER_INDEX;
     
    826826    //
    827827    mTimerConfiguration.Uint64 = HpetRead (HPET_TIMER_CONFIGURATION_OFFSET + TimerIndex * HPET_TIMER_STRIDE);
    828    
    829     //
    830     // Check to see if this HPET Timer supports MSI 
     828
     829    //
     830    // Check to see if this HPET Timer supports MSI
    831831    //
    832832    if (mTimerConfiguration.Bits.MsiInterruptCapablity != 0) {
     
    838838      }
    839839    }
    840    
     840
    841841    //
    842842    // Check to see if this HPET Timer supports I/O APIC interrupts
     
    881881      return EFI_DEVICE_ERROR;
    882882    }
    883    
     883
    884884    //
    885885    // Initialize I/O APIC entry for HPET Timer Interrupt
     
    901901  //
    902902  // Configure the selected HPET Timer with settings common to both MSI mode and I/O APIC mode
    903   //   Clear InterruptEnable to keep interrupts disabled until full init is complete 
    904   //   Clear PeriodicInterruptEnable to use one-shot mode 
    905   //   Configure as a 32-bit counter 
     903  //   Clear InterruptEnable to keep interrupts disabled until full init is complete
     904  //   Clear PeriodicInterruptEnable to use one-shot mode
     905  //   Configure as a 32-bit counter
    906906  //
    907907  mTimerConfiguration.Bits.InterruptEnable         = 0;
     
    909909  mTimerConfiguration.Bits.CounterSizeEnable       = 1;
    910910  HpetWrite (HPET_TIMER_CONFIGURATION_OFFSET + mTimerIndex * HPET_TIMER_STRIDE, mTimerConfiguration.Uint64);
    911  
     911
    912912  //
    913913  // Read the HPET Timer Capabilities and Configuration register back again.
     
    960960      DEBUG ((DEBUG_INFO, "HPET Interrupt Mode I/O APIC\n"));
    961961      DEBUG ((DEBUG_INFO, "HPET I/O APIC IRQ         = 0x%02x\n",  mTimerIrq));
    962     } 
     962    }
    963963    DEBUG ((DEBUG_INFO, "HPET Interrupt Vector     = 0x%02x\n",    PcdGet8 (PcdHpetLocalApicVector)));
    964964    DEBUG ((DEBUG_INFO, "HPET Counter Mask         = 0x%016lx\n",  mCounterMask));
     
    971971    //
    972972    // Wait for a few timer interrupts to fire before continuing
    973     // 
     973    //
    974974    while (mNumTicks < 10);
    975975  );
    976  
     976
    977977  //
    978978  // Install the Timer Architectural Protocol onto a new handle
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