Print this page
4804 apix & pcplusmp are nearly warning free already
Tentatively Reviewed by: Robert Mustacchi <rm@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/i86pc/io/hpet_acpi.c
          +++ new/usr/src/uts/i86pc/io/hpet_acpi.c
↓ open down ↓ 46 lines elided ↑ open up ↑
  47   47  static void *hpet_memory_map(ACPI_TABLE_HPET *hpet_table);
  48   48  static int hpet_start_main_counter(hpet_info_t *hip);
  49   49  static int hpet_stop_main_counter(hpet_info_t *hip);
  50   50  static uint64_t hpet_read_main_counter_value(hpet_info_t *hip);
  51   51  static uint64_t hpet_set_leg_rt_cnf(hpet_info_t *hip, uint32_t new_value);
  52   52  static uint64_t hpet_read_gen_cap(hpet_info_t *hip);
  53   53  static uint64_t hpet_read_gen_config(hpet_info_t *hip);
  54   54  static uint64_t hpet_read_gen_intrpt_stat(hpet_info_t *hip);
  55   55  static uint64_t hpet_read_timer_N_config(hpet_info_t *hip, uint_t n);
  56   56  static hpet_TN_conf_cap_t hpet_convert_timer_N_config(uint64_t conf);
  57      -/* LINTED E_STATIC_UNUSED */
  58      -static uint64_t hpet_read_timer_N_comp(hpet_info_t *hip, uint_t n);
  59      -/* LINTED E_STATIC_UNUSED */
  60      -static void hpet_write_gen_cap(hpet_info_t *hip, uint64_t l);
  61   57  static void hpet_write_gen_config(hpet_info_t *hip, uint64_t l);
  62   58  static void hpet_write_gen_intrpt_stat(hpet_info_t *hip, uint64_t l);
  63   59  static void hpet_write_timer_N_config(hpet_info_t *hip, uint_t n, uint64_t l);
  64   60  static void hpet_write_timer_N_comp(hpet_info_t *hip, uint_t n, uint64_t l);
  65   61  static void hpet_disable_timer(hpet_info_t *hip, uint32_t timer_n);
  66   62  static void hpet_enable_timer(hpet_info_t *hip, uint32_t timer_n);
  67      -/* LINTED E_STATIC_UNUSED */
  68      -static void hpet_write_main_counter_value(hpet_info_t *hip, uint64_t l);
  69   63  static int hpet_get_IOAPIC_intr_capable_timer(hpet_info_t *hip);
  70   64  static int hpet_timer_available(uint32_t allocated_timers, uint32_t n);
  71   65  static void hpet_timer_alloc(uint32_t *allocated_timers, uint32_t n);
  72   66  static void hpet_timer_set_up(hpet_info_t *hip, uint32_t timer_n,
  73   67      uint32_t interrupt);
  74   68  static uint_t hpet_isr(char *arg);
  75   69  static uint32_t hpet_install_interrupt_handler(uint_t (*func)(char *),
  76   70      int vector);
  77   71  static void hpet_uninstall_interrupt_handler(void);
  78   72  static void hpet_expire_all(void);
↓ open down ↓ 440 lines elided ↑ open up ↑
 519  513          cc.size_cap = HPET_TIMER_N_SIZE_CAP(conf);
 520  514          cc.per_int_cap = HPET_TIMER_N_PER_INT_CAP(conf);
 521  515          cc.type_cnf = HPET_TIMER_N_TYPE_CNF(conf);
 522  516          cc.int_enb_cnf = HPET_TIMER_N_INT_ENB_CNF(conf);
 523  517          cc.int_type_cnf = HPET_TIMER_N_INT_TYPE_CNF(conf);
 524  518  
 525  519          return (cc);
 526  520  }
 527  521  
 528  522  static uint64_t
 529      -hpet_read_timer_N_comp(hpet_info_t *hip, uint_t n)
 530      -{
 531      -        if (hip->timer_n_config[n].size_cap == 1)
 532      -                return (*(uint64_t *)
 533      -                    HPET_TIMER_N_COMP_ADDRESS(hip->logical_address, n));
 534      -        else
 535      -                return (*(uint32_t *)
 536      -                    HPET_TIMER_N_COMP_ADDRESS(hip->logical_address, n));
 537      -}
 538      -
 539      -static uint64_t
 540  523  hpet_read_main_counter_value(hpet_info_t *hip)
 541  524  {
 542  525          uint64_t        value;
 543  526          uint32_t        *counter;
 544  527          uint32_t        high1, high2, low;
 545  528  
 546  529          counter = (uint32_t *)HPET_MAIN_COUNTER_ADDRESS(hip->logical_address);
 547  530  
 548  531          /*
 549  532           * 32-bit main counters
↓ open down ↓ 14 lines elided ↑ open up ↑
 564  547                  low = counter[0];
 565  548                  high2 = counter[1];
 566  549          } while (high2 != high1);
 567  550  
 568  551          value = ((uint64_t)high1 << 32) | low;
 569  552          hip->main_counter_value = value;
 570  553          return (value);
 571  554  }
 572  555  
 573  556  static void
 574      -hpet_write_gen_cap(hpet_info_t *hip, uint64_t l)
 575      -{
 576      -        *(uint64_t *)HPET_GEN_CAP_ADDRESS(hip->logical_address) = l;
 577      -}
 578      -
 579      -static void
 580  557  hpet_write_gen_config(hpet_info_t *hip, uint64_t l)
 581  558  {
 582  559          *(uint64_t *)HPET_GEN_CONFIG_ADDRESS(hip->logical_address) = l;
 583  560  }
 584  561  
 585  562  static void
 586  563  hpet_write_gen_intrpt_stat(hpet_info_t *hip, uint64_t l)
 587  564  {
 588  565          *(uint64_t *)HPET_GEN_INTR_STAT_ADDRESS(hip->logical_address) = l;
 589  566  }
↓ open down ↓ 28 lines elided ↑ open up ↑
 618  595  static void
 619  596  hpet_enable_timer(hpet_info_t *hip, uint32_t timer_n)
 620  597  {
 621  598          uint64_t l;
 622  599  
 623  600          l = hpet_read_timer_N_config(hip, timer_n);
 624  601          l |= HPET_TIMER_N_INT_ENB_CNF_BIT;
 625  602          hpet_write_timer_N_config(hip, timer_n, l);
 626  603  }
 627  604  
 628      -static void
 629      -hpet_write_main_counter_value(hpet_info_t *hip, uint64_t l)
 630      -{
 631      -        uint32_t        *address;
 632      -
 633      -        /*
 634      -         * HPET spec 1.0a states main counter register should be halted before
 635      -         * it is written to.
 636      -         */
 637      -        ASSERT(!(hpet_read_gen_config(hip) & HPET_GCFR_ENABLE_CNF));
 638      -
 639      -        if (hip->gen_cap.count_size_cap == 1) {
 640      -                *(uint64_t *)HPET_MAIN_COUNTER_ADDRESS(hip->logical_address)
 641      -                    = l;
 642      -        } else {
 643      -                address = (uint32_t *)HPET_MAIN_COUNTER_ADDRESS(
 644      -                    hip->logical_address);
 645      -
 646      -                address[0] = (uint32_t)(l & 0xFFFFFFFF);
 647      -        }
 648      -}
 649      -
 650  605  /*
 651  606   * Add the interrupt handler for I/O APIC interrupt number (interrupt line).
 652  607   *
 653  608   * The I/O APIC line (vector) is programmed in ioapic_init_intr() called
 654  609   * from apic_picinit() psm_ops apic_ops entry point after we return from
 655  610   * apic_init() psm_ops entry point.
 656  611   */
 657  612  static uint32_t
 658  613  hpet_install_interrupt_handler(uint_t (*func)(char *), int vector)
 659  614  {
↓ open down ↓ 769 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX