Print this page
XXXX introduce drv_sectohz

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/aac/aac.c
          +++ new/usr/src/uts/common/io/aac/aac.c
↓ open down ↓ 917 lines elided ↑ open up ↑
 918  918              softs, 0, &p0, TS_RUN, minclsyspri)) == NULL) {
 919  919                  AACDB_PRINT(softs, CE_WARN, "aif thread create failed");
 920  920                  softs->state &= ~AAC_STATE_RUN;
 921  921                  goto error;
 922  922          }
 923  923  
 924  924          aac_unhold_bus(softs, AAC_IOCMD_SYNC | AAC_IOCMD_ASYNC);
 925  925  
 926  926          /* Create a thread for command timeout */
 927  927          softs->timeout_id = timeout(aac_timer, (void *)softs,
 928      -            (aac_tick * drv_usectohz(1000000)));
      928 +            drv_sectohz(aac_tick));
 929  929  
 930  930          /* Common attach is OK, so we are attached! */
 931  931          ddi_report_dev(dip);
 932  932          AACDB_PRINT(softs, CE_NOTE, "aac attached ok");
 933  933          return (DDI_SUCCESS);
 934  934  
 935  935  error:
 936  936          if (attach_state & AAC_ATTACH_CREATE_SCSI)
 937  937                  ddi_remove_minor_node(dip, "scsi");
 938  938          if (attach_state & AAC_ATTACH_CREATE_DEVCTL)
↓ open down ↓ 3434 lines elided ↑ open up ↑
4373 4373                   * If both ASYNC and SYNC bus throttle are held,
4374 4374                   * wake up threads only when both are drained out.
4375 4375                   */
4376 4376                  if ((softs->bus_throttle[AAC_CMDQ_ASYNC] > 0 ||
4377 4377                      softs->bus_ncmds[AAC_CMDQ_ASYNC] == 0) &&
4378 4378                      (softs->bus_throttle[AAC_CMDQ_SYNC] > 0 ||
4379 4379                      softs->bus_ncmds[AAC_CMDQ_SYNC] == 0))
4380 4380                          cv_broadcast(&softs->drain_cv);
4381 4381                  else
4382 4382                          softs->drain_timeid = timeout(aac_check_drain, softs,
4383      -                            AAC_QUIESCE_TICK * drv_usectohz(1000000));
     4383 +                            drv_sectohz(AAC_QUIESCE_TICK));
4384 4384          }
4385 4385          mutex_exit(&softs->io_lock);
4386 4386  }
4387 4387  
4388 4388  /*
4389 4389   * If not draining the outstanding cmds, drain them. Otherwise,
4390 4390   * only update ndrains.
4391 4391   */
4392 4392  static void
4393 4393  aac_start_drain(struct aac_softstate *softs)
4394 4394  {
4395 4395          if (softs->ndrains == 0) {
4396 4396                  ASSERT(softs->drain_timeid == 0);
4397 4397                  softs->drain_timeid = timeout(aac_check_drain, softs,
4398      -                    AAC_QUIESCE_TICK * drv_usectohz(1000000));
     4398 +                    drv_sectohz(AAC_QUIESCE_TICK));
4399 4399          }
4400 4400          softs->ndrains++;
4401 4401  }
4402 4402  
4403 4403  /*
4404 4404   * Stop the draining thread when no other threads use it any longer.
4405 4405   * Side effect: io_lock may be released in the middle.
4406 4406   */
4407 4407  static void
4408 4408  aac_stop_drain(struct aac_softstate *softs)
↓ open down ↓ 2269 lines elided ↑ open up ↑
6678 6678                           * to be checked later again.
6679 6679                           */
6680 6680                          if (time_adjust) {
6681 6681                                  acp->timeout += time_adjust;
6682 6682                                  continue;
6683 6683                          }
6684 6684  
6685 6685                          if (acp->timeout <= softs_timebase) {
6686 6686                                  aac_cmd_timeout(softs, acp);
6687 6687                                  time_out = 1;
6688      -                                time_adjust = aac_tick * drv_usectohz(1000000);
     6688 +                                time_adjust = drv_sectohz(aac_tick);
6689 6689                                  break; /* timeout happened */
6690 6690                          } else {
6691 6691                                  break; /* no timeout */
6692 6692                          }
6693 6693                  }
6694 6694          } while (time_out);
6695 6695  
6696 6696          mutex_enter(&softs->time_mutex);
6697 6697          softs->time_out = softs->timebase + aac_tick;
6698 6698          mutex_exit(&softs->time_mutex);
↓ open down ↓ 51 lines elided ↑ open up ↑
6750 6750  aac_timer(void *arg)
6751 6751  {
6752 6752          struct aac_softstate *softs = arg;
6753 6753          int events = 0;
6754 6754  
6755 6755          mutex_enter(&softs->time_mutex);
6756 6756  
6757 6757          /* If timer is being stopped, exit */
6758 6758          if (softs->timeout_id) {
6759 6759                  softs->timeout_id = timeout(aac_timer, (void *)softs,
6760      -                    (aac_tick * drv_usectohz(1000000)));
     6760 +                    drv_sectohz(aac_tick));
6761 6761          } else {
6762 6762                  mutex_exit(&softs->time_mutex);
6763 6763                  return;
6764 6764          }
6765 6765  
6766 6766          /* Time counting */
6767 6767          softs->timebase += aac_tick;
6768 6768  
6769 6769          /* Check time related events */
6770 6770          if (softs->time_out && softs->time_out <= softs->timebase)
↓ open down ↓ 1731 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX