Print this page
update to acpica-unix2-20130927
acpica-unix2-20130823
PANKOVs restructure

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/io/acpica/hardware/hwtimer.c
          +++ new/usr/src/common/acpica/components/hardware/hwtimer.c
   1      -
   2    1  /******************************************************************************
   3    2   *
   4    3   * Name: hwtimer.c - ACPI Power Management Timer Interface
   5    4   *
   6    5   *****************************************************************************/
   7    6  
   8    7  /*
   9      - * Copyright (C) 2000 - 2011, Intel Corp.
        8 + * Copyright (C) 2000 - 2013, Intel Corp.
  10    9   * All rights reserved.
  11   10   *
  12   11   * Redistribution and use in source and binary forms, with or without
  13   12   * modification, are permitted provided that the following conditions
  14   13   * are met:
  15   14   * 1. Redistributions of source code must retain the above copyright
  16   15   *    notice, this list of conditions, and the following disclaimer,
  17   16   *    without modification.
  18   17   * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  19   18   *    substantially similar to the "NO WARRANTY" disclaimer below
↓ open down ↓ 15 lines elided ↑ open up ↑
  35   34   * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  36   35   * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  37   36   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  38   37   * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  39   38   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  40   39   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  41   40   * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  42   41   * POSSIBILITY OF SUCH DAMAGES.
  43   42   */
  44   43  
       44 +#define EXPORT_ACPI_INTERFACES
       45 +
  45   46  #include "acpi.h"
  46   47  #include "accommon.h"
  47   48  
  48   49  #define _COMPONENT          ACPI_HARDWARE
  49   50          ACPI_MODULE_NAME    ("hwtimer")
  50   51  
  51   52  
       53 +#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
  52   54  /******************************************************************************
  53   55   *
  54   56   * FUNCTION:    AcpiGetTimerResolution
  55   57   *
  56   58   * PARAMETERS:  Resolution          - Where the resolution is returned
  57   59   *
  58   60   * RETURN:      Status and timer resolution
  59   61   *
  60   62   * DESCRIPTION: Obtains resolution of the ACPI PM Timer (24 or 32 bits).
  61   63   *
↓ open down ↓ 46 lines elided ↑ open up ↑
 108  110  
 109  111  
 110  112      ACPI_FUNCTION_TRACE (AcpiGetTimer);
 111  113  
 112  114  
 113  115      if (!Ticks)
 114  116      {
 115  117          return_ACPI_STATUS (AE_BAD_PARAMETER);
 116  118      }
 117  119  
 118      -    Status = AcpiHwRead (Ticks, &AcpiGbl_FADT.XPmTimerBlock);
      120 +    /* ACPI 5.0A: PM Timer is optional */
 119  121  
      122 +    if (!AcpiGbl_FADT.XPmTimerBlock.Address)
      123 +    {
      124 +        return_ACPI_STATUS (AE_SUPPORT);
      125 +    }
      126 +
      127 +    Status = AcpiHwRead (Ticks, &AcpiGbl_FADT.XPmTimerBlock);
 120  128      return_ACPI_STATUS (Status);
 121  129  }
 122  130  
 123  131  ACPI_EXPORT_SYMBOL (AcpiGetTimer)
 124  132  
 125  133  
 126  134  /******************************************************************************
 127  135   *
 128  136   * FUNCTION:    AcpiGetTimerDuration
 129  137   *
↓ open down ↓ 6 lines elided ↑ open up ↑
 136  144   * DESCRIPTION: Computes the time elapsed (in microseconds) between two
 137  145   *              PM Timer time stamps, taking into account the possibility of
 138  146   *              rollovers, the timer resolution, and timer frequency.
 139  147   *
 140  148   *              The PM Timer's clock ticks at roughly 3.6 times per
 141  149   *              _microsecond_, and its clock continues through Cx state
 142  150   *              transitions (unlike many CPU timestamp counters) -- making it
 143  151   *              a versatile and accurate timer.
 144  152   *
 145  153   *              Note that this function accommodates only a single timer
 146      - *              rollover.  Thus for 24-bit timers, this function should only
      154 + *              rollover. Thus for 24-bit timers, this function should only
 147  155   *              be used for calculating durations less than ~4.6 seconds
 148  156   *              (~20 minutes for 32-bit timers) -- calculations below:
 149  157   *
 150  158   *              2**24 Ticks / 3,600,000 Ticks/Sec = 4.66 sec
 151  159   *              2**32 Ticks / 3,600,000 Ticks/Sec = 1193 sec or 19.88 minutes
 152  160   *
 153  161   ******************************************************************************/
 154  162  
 155  163  ACPI_STATUS
 156  164  AcpiGetTimerDuration (
↓ open down ↓ 7 lines elided ↑ open up ↑
 164  172  
 165  173  
 166  174      ACPI_FUNCTION_TRACE (AcpiGetTimerDuration);
 167  175  
 168  176  
 169  177      if (!TimeElapsed)
 170  178      {
 171  179          return_ACPI_STATUS (AE_BAD_PARAMETER);
 172  180      }
 173  181  
      182 +    /* ACPI 5.0A: PM Timer is optional */
      183 +
      184 +    if (!AcpiGbl_FADT.XPmTimerBlock.Address)
      185 +    {
      186 +        return_ACPI_STATUS (AE_SUPPORT);
      187 +    }
      188 +
 174  189      /*
 175  190       * Compute Tick Delta:
 176  191       * Handle (max one) timer rollovers on 24-bit versus 32-bit timers.
 177  192       */
 178  193      if (StartTicks < EndTicks)
 179  194      {
 180  195          DeltaTicks = EndTicks - StartTicks;
 181  196      }
 182  197      else if (StartTicks > EndTicks)
 183  198      {
↓ open down ↓ 12 lines elided ↑ open up ↑
 196  211      }
 197  212      else /* StartTicks == EndTicks */
 198  213      {
 199  214          *TimeElapsed = 0;
 200  215          return_ACPI_STATUS (AE_OK);
 201  216      }
 202  217  
 203  218      /*
 204  219       * Compute Duration (Requires a 64-bit multiply and divide):
 205  220       *
 206      -     * TimeElapsed = (DeltaTicks * 1000000) / PM_TIMER_FREQUENCY;
      221 +     * TimeElapsed (microseconds) =
      222 +     *  (DeltaTicks * ACPI_USEC_PER_SEC) / ACPI_PM_TIMER_FREQUENCY;
 207  223       */
 208      -    Status = AcpiUtShortDivide (((UINT64) DeltaTicks) * 1000000,
 209      -                PM_TIMER_FREQUENCY, &Quotient, NULL);
      224 +    Status = AcpiUtShortDivide (((UINT64) DeltaTicks) * ACPI_USEC_PER_SEC,
      225 +                ACPI_PM_TIMER_FREQUENCY, &Quotient, NULL);
 210  226  
 211  227      *TimeElapsed = (UINT32) Quotient;
 212  228      return_ACPI_STATUS (Status);
 213  229  }
 214  230  
 215  231  ACPI_EXPORT_SYMBOL (AcpiGetTimerDuration)
 216  232  
      233 +#endif /* !ACPI_REDUCED_HARDWARE */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX