Print this page
XXXX introduce drv_sectohz

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/iwp/iwp.c
          +++ new/usr/src/uts/common/io/iwp/iwp.c
↓ open down ↓ 2062 lines elided ↑ open up ↑
2063 2063           * load init_text section of uCode to hardware
2064 2064           */
2065 2065          err = iwp_put_seg_fw(sc, sc->sc_dma_fw_init_text.cookie.dmac_address,
2066 2066              RTC_INST_LOWER_BOUND, sc->sc_dma_fw_init_text.cookie.dmac_size);
2067 2067          if (err != IWP_SUCCESS) {
2068 2068                  cmn_err(CE_WARN, "iwp_load_init_firmware(): "
2069 2069                      "failed to write init uCode.\n");
2070 2070                  return (err);
2071 2071          }
2072 2072  
2073      -        clk = ddi_get_lbolt() + drv_usectohz(1000000);
     2073 +        clk = ddi_get_lbolt() + drv_sectohz(1);
2074 2074  
2075 2075          /* wait loading init_text until completed or timeout */
2076 2076          while (!(sc->sc_flags & IWP_F_PUT_SEG)) {
2077 2077                  if (cv_timedwait(&sc->sc_put_seg_cv, &sc->sc_glock, clk) < 0) {
2078 2078                          break;
2079 2079                  }
2080 2080          }
2081 2081  
2082 2082          if (!(sc->sc_flags & IWP_F_PUT_SEG)) {
2083 2083                  cmn_err(CE_WARN, "iwp_load_init_firmware(): "
↓ open down ↓ 7 lines elided ↑ open up ↑
2091 2091           * load init_data section of uCode to hardware
2092 2092           */
2093 2093          err = iwp_put_seg_fw(sc, sc->sc_dma_fw_init_data.cookie.dmac_address,
2094 2094              RTC_DATA_LOWER_BOUND, sc->sc_dma_fw_init_data.cookie.dmac_size);
2095 2095          if (err != IWP_SUCCESS) {
2096 2096                  cmn_err(CE_WARN, "iwp_load_init_firmware(): "
2097 2097                      "failed to write init_data uCode.\n");
2098 2098                  return (err);
2099 2099          }
2100 2100  
2101      -        clk = ddi_get_lbolt() + drv_usectohz(1000000);
     2101 +        clk = ddi_get_lbolt() + drv_sectohz(1);
2102 2102  
2103 2103          /*
2104 2104           * wait loading init_data until completed or timeout
2105 2105           */
2106 2106          while (!(sc->sc_flags & IWP_F_PUT_SEG)) {
2107 2107                  if (cv_timedwait(&sc->sc_put_seg_cv, &sc->sc_glock, clk) < 0) {
2108 2108                          break;
2109 2109                  }
2110 2110          }
2111 2111  
↓ open down ↓ 20 lines elided ↑ open up ↑
2132 2132           * load init_text section of uCode to hardware
2133 2133           */
2134 2134          err = iwp_put_seg_fw(sc, sc->sc_dma_fw_text.cookie.dmac_address,
2135 2135              RTC_INST_LOWER_BOUND, sc->sc_dma_fw_text.cookie.dmac_size);
2136 2136          if (err != IWP_SUCCESS) {
2137 2137                  cmn_err(CE_WARN, "iwp_load_run_firmware(): "
2138 2138                      "failed to write run uCode.\n");
2139 2139                  return (err);
2140 2140          }
2141 2141  
2142      -        clk = ddi_get_lbolt() + drv_usectohz(1000000);
     2142 +        clk = ddi_get_lbolt() + drv_sectohz(1);
2143 2143  
2144 2144          /* wait loading run_text until completed or timeout */
2145 2145          while (!(sc->sc_flags & IWP_F_PUT_SEG)) {
2146 2146                  if (cv_timedwait(&sc->sc_put_seg_cv, &sc->sc_glock, clk) < 0) {
2147 2147                          break;
2148 2148                  }
2149 2149          }
2150 2150  
2151 2151          if (!(sc->sc_flags & IWP_F_PUT_SEG)) {
2152 2152                  cmn_err(CE_WARN, "iwp_load_run_firmware(): "
↓ open down ↓ 7 lines elided ↑ open up ↑
2160 2160           * load run_data section of uCode to hardware
2161 2161           */
2162 2162          err = iwp_put_seg_fw(sc, sc->sc_dma_fw_data_bak.cookie.dmac_address,
2163 2163              RTC_DATA_LOWER_BOUND, sc->sc_dma_fw_data.cookie.dmac_size);
2164 2164          if (err != IWP_SUCCESS) {
2165 2165                  cmn_err(CE_WARN, "iwp_load_run_firmware(): "
2166 2166                      "failed to write run_data uCode.\n");
2167 2167                  return (err);
2168 2168          }
2169 2169  
2170      -        clk = ddi_get_lbolt() + drv_usectohz(1000000);
     2170 +        clk = ddi_get_lbolt() + drv_sectohz(1);
2171 2171  
2172 2172          /*
2173 2173           * wait loading run_data until completed or timeout
2174 2174           */
2175 2175          while (!(sc->sc_flags & IWP_F_PUT_SEG)) {
2176 2176                  if (cv_timedwait(&sc->sc_put_seg_cv, &sc->sc_glock, clk) < 0) {
2177 2177                          break;
2178 2178                  }
2179 2179          }
2180 2180  
↓ open down ↓ 1509 lines elided ↑ open up ↑
3690 3690                          delay(drv_usectohz(200000));
3691 3691                          ieee80211_next_scan(ic);
3692 3692                  }
3693 3693  
3694 3694                  /*
3695 3695                   * rate ctl
3696 3696                   */
3697 3697                  if (ic->ic_mach &&
3698 3698                      (sc->sc_flags & IWP_F_RATE_AUTO_CTL)) {
3699 3699                          clk = ddi_get_lbolt();
3700      -                        if (clk > sc->sc_clk + drv_usectohz(1000000)) {
     3700 +                        if (clk > sc->sc_clk + drv_sectohz(1)) {
3701 3701                                  iwp_amrr_timeout(sc);
3702 3702                          }
3703 3703                  }
3704 3704  
3705 3705                  delay(drv_usectohz(100000));
3706 3706  
3707 3707                  mutex_enter(&sc->sc_mt_lock);
3708 3708                  if (sc->sc_tx_timer) {
3709 3709                          timeout++;
3710 3710                          if (10 == timeout) {
↓ open down ↓ 847 lines elided ↑ open up ↑
4558 4558                      "failed to setup init firmware\n");
4559 4559                  mutex_exit(&sc->sc_glock);
4560 4560                  return (IWP_FAIL);
4561 4561          }
4562 4562  
4563 4563          /*
4564 4564           * now press "execute" start running
4565 4565           */
4566 4566          IWP_WRITE(sc, CSR_RESET, 0);
4567 4567  
4568      -        clk = ddi_get_lbolt() + drv_usectohz(1000000);
     4568 +        clk = ddi_get_lbolt() + drv_sectohz(1);
4569 4569          while (!(sc->sc_flags & IWP_F_FW_INIT)) {
4570 4570                  if (cv_timedwait(&sc->sc_ucode_cv,
4571 4571                      &sc->sc_glock, clk) < 0) {
4572 4572                          break;
4573 4573                  }
4574 4574          }
4575 4575  
4576 4576          if (!(sc->sc_flags & IWP_F_FW_INIT)) {
4577 4577                  cmn_err(CE_WARN, "iwp_init(): "
4578 4578                      "failed to process init alive.\n");
↓ open down ↓ 26 lines elided ↑ open up ↑
4605 4605                      "failed to setup run firmware\n");
4606 4606                  mutex_exit(&sc->sc_glock);
4607 4607                  return (IWP_FAIL);
4608 4608          }
4609 4609  
4610 4610          /*
4611 4611           * now press "execute" start running
4612 4612           */
4613 4613          IWP_WRITE(sc, CSR_RESET, 0);
4614 4614  
4615      -        clk = ddi_get_lbolt() + drv_usectohz(1000000);
     4615 +        clk = ddi_get_lbolt() + drv_sectohz(1);
4616 4616          while (!(sc->sc_flags & IWP_F_FW_INIT)) {
4617 4617                  if (cv_timedwait(&sc->sc_ucode_cv,
4618 4618                      &sc->sc_glock, clk) < 0) {
4619 4619                          break;
4620 4620                  }
4621 4621          }
4622 4622  
4623 4623          if (!(sc->sc_flags & IWP_F_FW_INIT)) {
4624 4624                  cmn_err(CE_WARN, "iwp_init(): "
4625 4625                      "failed to process runtime alive.\n");
↓ open down ↓ 798 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX