Print this page
XXXX introduce drv_sectohz

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/pshot.c
          +++ new/usr/src/uts/common/io/pshot.c
↓ open down ↓ 3069 lines elided ↑ open up ↑
3070 3070  
3071 3071          if (strncmp(caddr, "delay,", 6) == 0) {
3072 3072                  p = caddr+6;
3073 3073                  n = stoi(&p);
3074 3074                  if (*p != 0)
3075 3075                          n = 1;
3076 3076                  if (pshot_debug)
3077 3077                          cmn_err(CE_CONT,
3078 3078                              "pshot%d: %s delay %d second\n",
3079 3079                              ddi_get_instance(parent), devname, n);
3080      -                delay(n * drv_usectohz(1000000));
     3080 +                delay(drv_sectohz(n));
3081 3081          } else if (strncmp(caddr, "delay", 5) == 0) {
3082 3082                  if (pshot_debug)
3083 3083                          cmn_err(CE_CONT,
3084 3084                              "pshot%d: %s delay 1 second\n",
3085 3085                              ddi_get_instance(parent), devname);
3086      -                delay(drv_usectohz(1000000));
     3086 +                delay(drv_sectohz(1));
3087 3087          } else if (strncmp(caddr, "wait,", 5) == 0) {
3088 3088                  p = caddr+5;
3089 3089                  n = stoi(&p);
3090 3090                  if (*p != 0)
3091 3091                          n = 1;
3092 3092                  if (pshot_debug)
3093 3093                          cmn_err(CE_CONT,
3094 3094                              "pshot%d: %s wait %d second\n",
3095 3095                              ddi_get_instance(parent), devname, n);
3096      -                delay(n * drv_usectohz(1000000));
     3096 +                delay(drv_sectohz(n));
3097 3097          } else if (strncmp(caddr, "wait", 4) == 0) {
3098 3098                  if (pshot_debug)
3099 3099                          cmn_err(CE_CONT,
3100 3100                              "pshot%d: %s wait 1 second\n",
3101 3101                              ddi_get_instance(parent), devname);
3102      -                delay(drv_usectohz(1000000));
     3102 +                delay(drv_sectohz(1));
3103 3103          }
3104 3104  
3105 3105          return (NDI_SUCCESS);
3106 3106  }
3107 3107  
3108 3108  /*
3109 3109   * translate nodetype name to actual value
3110 3110   */
3111 3111  static char *
3112 3112  pshot_str2nt(char *str)
↓ open down ↓ 360 lines elided ↑ open up ↑
3473 3473          static void pshot_timeout(void *arg);
3474 3474          static kthread_id_t pwt;
3475 3475  
3476 3476          pwt = curthread;
3477 3477          mutex_init(&pwl, NULL, MUTEX_DRIVER, NULL);
3478 3478          cv_init(&pwcv, NULL, CV_DRIVER, NULL);
3479 3479  
3480 3480          while (1) {
3481 3481                  pshot_walk_tree();
3482 3482                  mutex_enter(&pwl);
3483      -                (void) timeout(pshot_timeout, NULL, 5 * drv_usectohz(1000000));
     3483 +                (void) timeout(pshot_timeout, NULL, drv_sectohz(5));
3484 3484                  cv_wait(&pwcv, &pwl);
3485 3485                  mutex_exit(&pwl);
3486 3486          }
3487 3487  }
3488 3488  
3489 3489  static void
3490 3490  pshot_timeout(void *arg)
3491 3491  {
3492 3492          mutex_enter(&pwl);
3493 3493          cv_signal(&pwcv);
↓ open down ↓ 48 lines elided ↑ open up ↑
3542 3542          ndi_event_set_t events;
3543 3543          int i, rval;
3544 3544  
3545 3545          (void) ndi_event_alloc_hdl(pshot->dip, NULL, &hdl, NDI_SLEEP);
3546 3546  
3547 3547          events.ndi_events_version = NDI_EVENTS_REV1;
3548 3548          events.ndi_n_events = PSHOT_N_TEST_EVENTS;
3549 3549          events.ndi_event_defs = pshot_test_events;
3550 3550  
3551 3551          cmn_err(CE_CONT, "pshot: binding set of 8 events\n");
3552      -        delay(drv_usectohz(1000000));
     3552 +        delay(drv_sectohz(1));
3553 3553          rval = ndi_event_bind_set(hdl, &events, NDI_SLEEP);
3554 3554          cmn_err(CE_CONT, "pshot: ndi_event_bind_set rval = %d\n", rval);
3555 3555  
3556 3556          cmn_err(CE_CONT, "pshot: binding the same set of 8 events\n");
3557      -        delay(drv_usectohz(1000000));
     3557 +        delay(drv_sectohz(1));
3558 3558          rval = ndi_event_bind_set(hdl, &events, NDI_SLEEP);
3559 3559          cmn_err(CE_CONT, "pshot: ndi_event_bind_set rval = %d\n", rval);
3560 3560  
3561 3561          cmn_err(CE_CONT, "pshot: unbinding  all events\n");
3562      -        delay(drv_usectohz(1000000));
     3562 +        delay(drv_sectohz(1));
3563 3563          rval = ndi_event_unbind_set(hdl, &events, NDI_SLEEP);
3564 3564          cmn_err(CE_CONT, "pshot: ndi_event_unbind_set rval = %d\n", rval);
3565 3565  
3566 3566  
3567 3567          cmn_err(CE_CONT, "pshot: binding one highlevel event\n");
3568      -        delay(drv_usectohz(1000000));
     3568 +        delay(drv_sectohz(1));
3569 3569          events.ndi_n_events = 1;
3570 3570          events.ndi_event_defs = pshot_test_events_high;
3571 3571          rval = ndi_event_bind_set(hdl, &events, NDI_SLEEP);
3572 3572          cmn_err(CE_CONT, "pshot: ndi_event_bind_set rval = %d\n", rval);
3573 3573  
3574 3574          cmn_err(CE_CONT, "pshot: binding the same set of 8 events\n");
3575      -        delay(drv_usectohz(1000000));
     3575 +        delay(drv_sectohz(1));
3576 3576          events.ndi_n_events = PSHOT_N_TEST_EVENTS;
3577 3577          events.ndi_event_defs = pshot_test_events;
3578 3578          rval = ndi_event_bind_set(hdl, &events, NDI_SLEEP);
3579 3579          cmn_err(CE_CONT, "pshot: ndi_event_bind_set rval = %d\n", rval);
3580 3580  
3581 3581          cmn_err(CE_CONT, "pshot: unbinding one highlevel event\n");
3582      -        delay(drv_usectohz(1000000));
     3582 +        delay(drv_sectohz(1));
3583 3583          events.ndi_n_events = 1;
3584 3584          events.ndi_event_defs = pshot_test_events_high;
3585 3585          rval = ndi_event_unbind_set(hdl, &events, NDI_SLEEP);
3586 3586          cmn_err(CE_CONT, "pshot: ndi_event_bind_set rval = %d\n", rval);
3587 3587  
3588 3588          cmn_err(CE_CONT, "pshot: binding one highlevel event\n");
3589      -        delay(drv_usectohz(1000000));
     3589 +        delay(drv_sectohz(1));
3590 3590          events.ndi_n_events = 1;
3591 3591          events.ndi_event_defs = pshot_test_events_high;
3592 3592          rval = ndi_event_bind_set(hdl, &events, NDI_SLEEP);
3593 3593          cmn_err(CE_CONT, "pshot: ndi_event_bind_set rval = %d\n", rval);
3594 3594  
3595 3595          cmn_err(CE_CONT, "pshot: unbinding one highlevel event\n");
3596      -        delay(drv_usectohz(1000000));
     3596 +        delay(drv_sectohz(1));
3597 3597          events.ndi_n_events = 1;
3598 3598          events.ndi_event_defs = pshot_test_events_high;
3599 3599          rval = ndi_event_unbind_set(hdl, &events, NDI_SLEEP);
3600 3600          cmn_err(CE_CONT, "pshot: ndi_event_bind_set rval = %d\n", rval);
3601 3601  
3602 3602          cmn_err(CE_CONT, "pshot: binding the same set of 8 events\n");
3603      -        delay(drv_usectohz(1000000));
     3603 +        delay(drv_sectohz(1));
3604 3604          events.ndi_n_events = PSHOT_N_TEST_EVENTS;
3605 3605          events.ndi_event_defs = pshot_test_events;
3606 3606          rval = ndi_event_bind_set(hdl, &events, NDI_SLEEP);
3607 3607          cmn_err(CE_CONT, "pshot: ndi_event_bind_set rval = %d\n", rval);
3608 3608  
3609 3609          cmn_err(CE_CONT, "pshot: unbinding first 2 events\n");
3610      -        delay(drv_usectohz(1000000));
     3610 +        delay(drv_sectohz(1));
3611 3611          events.ndi_n_events = 2;
3612 3612          events.ndi_event_defs = pshot_test_events;
3613 3613          rval = ndi_event_unbind_set(hdl, &events, NDI_SLEEP);
3614 3614          cmn_err(CE_CONT, "pshot: ndi_event_unbind_set rval = %d\n", rval);
3615 3615  
3616 3616          cmn_err(CE_CONT, "pshot: unbinding first 2 events again\n");
3617      -        delay(drv_usectohz(1000000));
     3617 +        delay(drv_sectohz(1));
3618 3618          events.ndi_n_events = 2;
3619 3619          events.ndi_event_defs = pshot_test_events;
3620 3620          rval = ndi_event_unbind_set(hdl, &events, NDI_SLEEP);
3621 3621          cmn_err(CE_CONT, "pshot: ndi_event_unbind_set rval = %d\n", rval);
3622 3622  
3623 3623          cmn_err(CE_CONT, "pshot: unbinding  middle 2 events\n");
3624      -        delay(drv_usectohz(1000000));
     3624 +        delay(drv_sectohz(1));
3625 3625          events.ndi_n_events = 2;
3626 3626          events.ndi_event_defs = &pshot_test_events[4];
3627 3627          rval = ndi_event_unbind_set(hdl, &events, NDI_SLEEP);
3628 3628          cmn_err(CE_CONT, "pshot: ndi_event_unbind_set rval = %d\n", rval);
3629 3629  
3630 3630          cmn_err(CE_CONT, "pshot: binding those 2 events back\n");
3631      -        delay(drv_usectohz(1000000));
     3631 +        delay(drv_sectohz(1));
3632 3632          events.ndi_n_events = 2;
3633 3633          events.ndi_event_defs = &pshot_test_events[4];
3634 3634          rval = ndi_event_bind_set(hdl, &events, NDI_SLEEP);
3635 3635          cmn_err(CE_CONT, "pshot: ndi_event_bind_set rval = %d\n", rval);
3636 3636  
3637 3637          cmn_err(CE_CONT, "pshot: unbinding  2 events\n");
3638      -        delay(drv_usectohz(1000000));
     3638 +        delay(drv_sectohz(1));
3639 3639          events.ndi_n_events = 2;
3640 3640          events.ndi_event_defs = &pshot_test_events[4];
3641 3641          rval = ndi_event_unbind_set(hdl, &events, NDI_SLEEP);
3642 3642          cmn_err(CE_CONT, "pshot: ndi_event_unbind_set rval = %d\n", rval);
3643 3643  
3644 3644          cmn_err(CE_CONT, "pshot: unbinding  all events\n");
3645      -        delay(drv_usectohz(1000000));
     3645 +        delay(drv_sectohz(1));
3646 3646          events.ndi_n_events = PSHOT_N_TEST_EVENTS;
3647 3647          events.ndi_event_defs = pshot_test_events;
3648 3648          rval = ndi_event_unbind_set(hdl, &events, NDI_SLEEP);
3649 3649          cmn_err(CE_CONT, "pshot: ndi_event_unbind_set rval = %d\n", rval);
3650 3650  
3651 3651          cmn_err(CE_CONT, "pshot: unbinding  1 event\n");
3652      -        delay(drv_usectohz(1000000));
     3652 +        delay(drv_sectohz(1));
3653 3653          events.ndi_n_events = 1;
3654 3654          events.ndi_event_defs = &pshot_test_events[2];
3655 3655          rval = ndi_event_unbind_set(hdl, &events, NDI_SLEEP);
3656 3656          cmn_err(CE_CONT, "pshot: ndi_event_unbind_set rval = %d\n", rval);
3657 3657  
3658 3658          cmn_err(CE_CONT, "pshot: unbinding  1 event\n");
3659      -        delay(drv_usectohz(1000000));
     3659 +        delay(drv_sectohz(1));
3660 3660          events.ndi_n_events = 1;
3661 3661          events.ndi_event_defs = &pshot_test_events[3];
3662 3662          rval = ndi_event_unbind_set(hdl, &events, NDI_SLEEP);
3663 3663          cmn_err(CE_CONT, "pshot: ndi_event_unbind_set rval = %d\n", rval);
3664 3664  
3665 3665          cmn_err(CE_CONT, "pshot: unbinding  1 event\n");
3666      -        delay(drv_usectohz(1000000));
     3666 +        delay(drv_sectohz(1));
3667 3667          events.ndi_n_events = 1;
3668 3668          events.ndi_event_defs = &pshot_test_events[6];
3669 3669          rval = ndi_event_unbind_set(hdl, &events, NDI_SLEEP);
3670 3670          cmn_err(CE_CONT, "pshot: ndi_event_unbind_set rval = %d\n", rval);
3671 3671  
3672 3672          cmn_err(CE_CONT, "pshot: unbinding  1 event\n");
3673      -        delay(drv_usectohz(1000000));
     3673 +        delay(drv_sectohz(1));
3674 3674          events.ndi_n_events = 1;
3675 3675          events.ndi_event_defs = &pshot_test_events[7];
3676 3676          rval = ndi_event_unbind_set(hdl, &events, NDI_SLEEP);
3677 3677          cmn_err(CE_CONT, "pshot: ndi_event_unbind_set rval = %d\n", rval);
3678 3678  
3679 3679          events.ndi_n_events = PSHOT_N_TEST_EVENTS;
3680 3680          events.ndi_event_defs = pshot_test_events;
3681 3681  
3682 3682          cmn_err(CE_CONT, "pshot: binding set of 8 events\n");
3683      -        delay(drv_usectohz(1000000));
     3683 +        delay(drv_sectohz(1));
3684 3684          rval = ndi_event_bind_set(hdl, &events, NDI_SLEEP);
3685 3685          cmn_err(CE_CONT, "pshot: ndi_event_bind_set rval = %d\n", rval);
3686 3686  
3687 3687          cmn_err(CE_CONT, "pshot: adding 8 callbacks\n");
3688      -        delay(drv_usectohz(1000000));
     3688 +        delay(drv_sectohz(1));
3689 3689          for (i = 0; i < 8; i++) {
3690 3690                  rval = ndi_event_add_callback(hdl, pshot->dip,
3691 3691                      ndi_event_tag_to_cookie(hdl,
3692 3692                      pshot_test_events[i].ndi_event_tag),
3693 3693                      pshot_event_cb_test,
3694 3694                      (void *)(uintptr_t)pshot_test_events[i].ndi_event_tag,
3695 3695                      NDI_SLEEP, &pshot->test_callback_cache[i]);
3696 3696                  ASSERT(rval == NDI_SUCCESS);
3697 3697          }
3698 3698  
3699 3699          cmn_err(CE_CONT, "pshot: event callbacks\n");
3700 3700  
3701 3701          for (i = 10; i < 18; i++) {
3702 3702                  ddi_eventcookie_t cookie = ndi_event_tag_to_cookie(hdl, i);
3703 3703  
3704 3704                  rval = ndi_event_run_callbacks(hdl, pshot->dip, cookie,
3705 3705                      (void *)hdl);
3706 3706  
3707 3707                  cmn_err(CE_CONT, "pshot: callback, tag=%d rval=%d\n",
3708 3708                      i, rval);
3709      -                delay(drv_usectohz(1000000));
     3709 +                delay(drv_sectohz(1));
3710 3710          }
3711 3711  
3712 3712          cmn_err(CE_CONT, "pshot: redo event callbacks\n");
3713 3713  
3714 3714          for (i = 10; i < 18; i++) {
3715 3715                  ddi_eventcookie_t cookie = ndi_event_tag_to_cookie(hdl, i);
3716 3716  
3717 3717                  rval = ndi_event_run_callbacks(hdl,
3718 3718                      pshot->dip, cookie, (void *)hdl);
3719 3719  
3720 3720                  cmn_err(CE_CONT, "pshot: callback, tag=%d rval=%d\n",
3721 3721                      i, rval);
3722      -                delay(drv_usectohz(1000000));
     3722 +                delay(drv_sectohz(1));
3723 3723          }
3724 3724  
3725 3725          cmn_err(CE_CONT, "pshot: removing 8 callbacks\n");
3726      -        delay(drv_usectohz(1000000));
     3726 +        delay(drv_sectohz(1));
3727 3727  
3728 3728          for (i = 0; i < 8; i++) {
3729 3729                  (void) ndi_event_remove_callback(hdl,
3730 3730                      pshot->test_callback_cache[i]);
3731 3731  
3732 3732                  pshot->test_callback_cache[i] = 0;
3733 3733          }
3734 3734  
3735 3735          cmn_err(CE_CONT, "pshot: freeing handle with bound set\n");
3736      -        delay(drv_usectohz(1000000));
     3736 +        delay(drv_sectohz(1));
3737 3737  
3738 3738          rval =  ndi_event_free_hdl(hdl);
3739 3739  
3740 3740          ASSERT(rval == NDI_SUCCESS);
3741 3741  
3742 3742  }
3743 3743  
3744 3744  void
3745 3745  pshot_event_test_post_one(void *arg)
3746 3746  {
↓ open down ↓ 23 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX