Lines Matching refs:hp
362 static int dr_copyin_iocmd(dr_handle_t *hp);
363 static int dr_copyout_iocmd(dr_handle_t *hp);
364 static int dr_copyout_errs(dr_handle_t *hp);
365 static int dr_pre_op(dr_handle_t *hp);
366 static int dr_post_op(dr_handle_t *hp, int rv);
367 static int dr_exec_op(dr_handle_t *hp);
368 static void dr_assign_board(dr_handle_t *hp);
369 static void dr_unassign_board(dr_handle_t *hp);
370 static void dr_connect(dr_handle_t *hp);
371 static int dr_disconnect(dr_handle_t *hp);
372 static void dr_dev_configure(dr_handle_t *hp);
373 static void dr_dev_release(dr_handle_t *hp);
374 static int dr_dev_unconfigure(dr_handle_t *hp);
375 static void dr_dev_cancel(dr_handle_t *hp);
376 static int dr_dev_status(dr_handle_t *hp);
377 static int dr_get_ncm(dr_handle_t *hp);
378 static int dr_pt_ioctl(dr_handle_t *hp);
379 static void dr_poweron_board(dr_handle_t *hp);
380 static void dr_poweroff_board(dr_handle_t *hp);
381 static void dr_test_board(dr_handle_t *hp);
562 dr_handle_t *hp; in dr_ioctl() local
591 hp = GETSTRUCT(dr_handle_t, 1); in dr_ioctl()
592 hp->h_bd = &softsp->boards[bd]; in dr_ioctl()
593 hp->h_err = NULL; in dr_ioctl()
594 hp->h_dev = getminor(dev); in dr_ioctl()
595 hp->h_cmd = cmd; in dr_ioctl()
596 hp->h_mode = mode; in dr_ioctl()
597 hp->h_iap = (sbd_ioctl_arg_t *)arg; in dr_ioctl()
600 rv = dr_copyin_iocmd(hp); in dr_ioctl()
602 FREESTRUCT(hp, dr_handle_t, 1); in dr_ioctl()
607 if (hp->h_sbdcmd.cmd_cm.c_id.c_name[0] != '\0') { in dr_ioctl()
608 hp->h_sbdcmd.cmd_cm.c_id.c_type = in dr_ioctl()
609 dr_dev_type_to_nt(hp->h_sbdcmd.cmd_cm.c_id.c_name); in dr_ioctl()
613 hp->h_sbdcmd.cmd_cm.c_id.c_name, in dr_ioctl()
614 hp->h_sbdcmd.cmd_cm.c_id.c_type); in dr_ioctl()
621 hp->h_devset = dr_dev2devset(&hp->h_sbdcmd.cmd_cm.c_id); in dr_ioctl()
623 switch (hp->h_cmd) { in dr_ioctl()
631 mutex_enter(&hp->h_bd->b_lock); in dr_ioctl()
641 rv = DEVSET_IN_SET(hp->h_devset, SBD_COMP_MEM, DEVSET_ANYUNIT); in dr_ioctl()
649 rv = dr_pre_op(hp); in dr_ioctl()
651 rv = dr_exec_op(hp); in dr_ioctl()
652 rv = dr_post_op(hp, rv); in dr_ioctl()
658 if (hp->h_err != NULL) in dr_ioctl()
659 if (!(rv = dr_copyout_errs(hp))) in dr_ioctl()
663 switch (hp->h_cmd) { in dr_ioctl()
678 (void) drmach_log_sysevent(hp->h_bd->b_num, "", in dr_ioctl()
683 mutex_exit(&hp->h_bd->b_lock); in dr_ioctl()
687 if (hp->h_opts.size != 0) in dr_ioctl()
688 FREESTRUCT(hp->h_opts.copts, char, hp->h_opts.size); in dr_ioctl()
690 FREESTRUCT(hp, dr_handle_t, 1); in dr_ioctl()
882 dr_copyin_iocmd(dr_handle_t *hp) in dr_copyin_iocmd() argument
885 sbd_cmd_t *scp = &hp->h_sbdcmd; in dr_copyin_iocmd()
887 if (hp->h_iap == NULL) in dr_copyin_iocmd()
893 if (ddi_model_convert_from(hp->h_mode & FMODELS) == DDI_MODEL_ILP32) { in dr_copyin_iocmd()
898 if (ddi_copyin((void *)hp->h_iap, (void *)&scmd32, in dr_copyin_iocmd()
899 sizeof (sbd_cmd32_t), hp->h_mode)) { in dr_copyin_iocmd()
913 switch (hp->h_cmd) { in dr_copyin_iocmd()
925 if (ddi_copyin((void *)hp->h_iap, (void *)scp, in dr_copyin_iocmd()
926 sizeof (sbd_cmd_t), hp->h_mode) != 0) { in dr_copyin_iocmd()
932 if ((hp->h_opts.size = scp->cmd_cm.c_len) != 0) { in dr_copyin_iocmd()
933 hp->h_opts.copts = GETSTRUCT(char, scp->cmd_cm.c_len + 1); in dr_copyin_iocmd()
934 ++hp->h_opts.size; in dr_copyin_iocmd()
936 (void *)hp->h_opts.copts, in dr_copyin_iocmd()
937 scp->cmd_cm.c_len, hp->h_mode) != 0) { in dr_copyin_iocmd()
947 dr_copyout_iocmd(dr_handle_t *hp) in dr_copyout_iocmd() argument
950 sbd_cmd_t *scp = &hp->h_sbdcmd; in dr_copyout_iocmd()
952 if (hp->h_iap == NULL) in dr_copyout_iocmd()
956 if (ddi_model_convert_from(hp->h_mode & FMODELS) == DDI_MODEL_ILP32) { in dr_copyout_iocmd()
968 switch (hp->h_cmd) { in dr_copyout_iocmd()
976 if (ddi_copyout((void *)&scmd32, (void *)hp->h_iap, in dr_copyout_iocmd()
977 sizeof (sbd_cmd32_t), hp->h_mode)) { in dr_copyout_iocmd()
985 if (ddi_copyout((void *)scp, (void *)hp->h_iap, in dr_copyout_iocmd()
986 sizeof (sbd_cmd_t), hp->h_mode) != 0) { in dr_copyout_iocmd()
996 dr_copyout_errs(dr_handle_t *hp) in dr_copyout_errs() argument
1000 if (hp->h_err == NULL) in dr_copyout_errs()
1003 if (hp->h_err->e_code) { in dr_copyout_errs()
1005 f, hp->h_err->e_code, hp->h_err->e_rsc); in dr_copyout_errs()
1009 if (ddi_model_convert_from(hp->h_mode & FMODELS) == DDI_MODEL_ILP32) { in dr_copyout_errs()
1014 serr32p->e_code = hp->h_err->e_code; in dr_copyout_errs()
1015 bcopy(&hp->h_err->e_rsc[0], &serr32p->e_rsc[0], in dr_copyout_errs()
1018 (void *)&((sbd_ioctl_arg32_t *)hp->h_iap)->i_err, in dr_copyout_errs()
1019 sizeof (sbd_error32_t), hp->h_mode)) { in dr_copyout_errs()
1027 if (ddi_copyout((void *)hp->h_err, in dr_copyout_errs()
1028 (void *)&hp->h_iap->i_err, in dr_copyout_errs()
1029 sizeof (sbd_error_t), hp->h_mode)) { in dr_copyout_errs()
1035 sbd_err_clear(&hp->h_err); in dr_copyout_errs()
1046 dr_pre_op(dr_handle_t *hp) in dr_pre_op() argument
1051 dr_board_t *bp = hp->h_bd; in dr_pre_op()
1052 dr_handle_t *shp = hp; in dr_pre_op()
1055 cmd = hp->h_cmd; in dr_pre_op()
1061 hp->h_err = drmach_pre_op(cmd, bp->b_id, &hp->h_opts, &devset); in dr_pre_op()
1062 if (hp->h_err != NULL) { in dr_pre_op()
1084 dr_op_err(CE_IGNORE, hp, ESBD_INVAL, NULL); in dr_pre_op()
1092 dr_op_err(CE_IGNORE, hp, in dr_pre_op()
1113 dr_post_op(dr_handle_t *hp, int rv) in dr_post_op() argument
1117 dr_board_t *bp = hp->h_bd; in dr_post_op()
1120 cmd = hp->h_cmd; in dr_post_op()
1124 err = drmach_post_op(cmd, bp->b_id, &hp->h_opts, rv); in dr_post_op()
1129 ASSERT(hp->h_err == NULL); in dr_post_op()
1130 hp->h_err = err; in dr_post_op()
1132 } else if (hp->h_err == NULL) { in dr_post_op()
1133 hp->h_err = err; in dr_post_op()
1143 dr_exec_op(dr_handle_t *hp) in dr_exec_op() argument
1149 ASSERT(hp->h_err == NULL); in dr_exec_op()
1151 switch (hp->h_cmd) { in dr_exec_op()
1153 dr_assign_board(hp); in dr_exec_op()
1157 dr_unassign_board(hp); in dr_exec_op()
1161 dr_poweroff_board(hp); in dr_exec_op()
1165 dr_poweron_board(hp); in dr_exec_op()
1169 dr_test_board(hp); in dr_exec_op()
1173 dr_connect(hp); in dr_exec_op()
1177 dr_dev_configure(hp); in dr_exec_op()
1181 dr_dev_release(hp); in dr_exec_op()
1182 if (hp->h_err == NULL) in dr_exec_op()
1183 rv = dr_dev_unconfigure(hp); in dr_exec_op()
1185 dr_dev_cancel(hp); in dr_exec_op()
1189 rv = dr_disconnect(hp); in dr_exec_op()
1193 rv = dr_dev_status(hp); in dr_exec_op()
1197 hp->h_sbdcmd.cmd_getncm.g_ncm = dr_get_ncm(hp); in dr_exec_op()
1198 rv = dr_copyout_iocmd(hp); in dr_exec_op()
1202 rv = dr_pt_ioctl(hp); in dr_exec_op()
1208 f, hp->h_cmd); in dr_exec_op()
1212 if (hp->h_err != NULL) { in dr_exec_op()
1220 dr_assign_board(dr_handle_t *hp) in dr_assign_board() argument
1222 dr_board_t *bp = hp->h_bd; in dr_assign_board()
1224 hp->h_err = drmach_board_assign(bp->b_num, &bp->b_id); in dr_assign_board()
1225 if (hp->h_err == NULL) { in dr_assign_board()
1231 dr_unassign_board(dr_handle_t *hp) in dr_unassign_board() argument
1233 dr_board_t *bp = hp->h_bd; in dr_unassign_board()
1245 hp->h_err = drmach_board_unassign(bp->b_id); in dr_unassign_board()
1246 if (hp->h_err == NULL) { in dr_unassign_board()
1258 dr_poweron_board(dr_handle_t *hp) in dr_poweron_board() argument
1260 dr_board_t *bp = hp->h_bd; in dr_poweron_board()
1262 hp->h_err = drmach_board_poweron(bp->b_id); in dr_poweron_board()
1266 dr_poweroff_board(dr_handle_t *hp) in dr_poweroff_board() argument
1268 dr_board_t *bp = hp->h_bd; in dr_poweroff_board()
1270 hp->h_err = drmach_board_poweroff(bp->b_id); in dr_poweroff_board()
1274 dr_test_board(dr_handle_t *hp) in dr_test_board() argument
1276 dr_board_t *bp = hp->h_bd; in dr_test_board()
1277 hp->h_err = drmach_board_test(bp->b_id, &hp->h_opts, in dr_test_board()
1278 dr_cmd_flags(hp) & SBD_FLAG_FORCE); in dr_test_board()
1336 dr_connect(dr_handle_t *hp) in dr_connect() argument
1338 dr_board_t *bp = hp->h_bd; in dr_connect()
1352 hp->h_err = drmach_board_connect(bp->b_id, &hp->h_opts); in dr_connect()
1353 if (hp->h_err) in dr_connect()
1356 hp->h_err = dr_init_devlists(bp); in dr_connect()
1357 if (hp->h_err) in dr_connect()
1360 dr_op_err(CE_WARN, hp, ESBD_EMPTY_BD, bp->b_path); in dr_connect()
1370 dr_disconnect(dr_handle_t *hp) in dr_disconnect() argument
1374 dr_board_t *bp = hp->h_bd; in dr_disconnect()
1383 devset = hp->h_devset & DR_DEVS_PRESENT(bp) & in dr_disconnect()
1387 dr_op_err(CE_IGNORE, hp, ESBD_EMPTY_BD, bp->b_path); in dr_disconnect()
1404 hp->h_err = drmach_board_disconnect(bp->b_id, &hp->h_opts); in dr_disconnect()
1405 if (hp->h_err && hp->h_err->e_code == EX86_WALK_DEPENDENCY) { in dr_disconnect()
1430 DRERR_SET_C(&hp->h_err, &cp->sbc_cm.sbdev_error); in dr_disconnect()
1445 DRERR_SET_C(&hp->h_err, &mp->sbm_cm.sbdev_error); in dr_disconnect()
1460 DRERR_SET_C(&hp->h_err, &ip->sbi_cm.sbdev_error); in dr_disconnect()
1465 if (hp->h_err) { in dr_disconnect()
1475 if (hp->h_err->e_code == EX86_DEPROBE) { in dr_disconnect()
1492 if (hp->h_err == NULL && DR_DEVS_PRESENT(bp) == 0) { in dr_disconnect()
1499 hp->h_err = drmach_board_deprobe(bp->b_id); in dr_disconnect()
1501 if (hp->h_err == NULL) { in dr_disconnect()
1552 dr_dev_make_list(dr_handle_t *hp, sbd_comp_type_t type, int present_only, in dr_dev_make_list() argument
1555 dr_board_t *bp = hp->h_bd; in dr_dev_make_list()
1586 uset = DEVSET_GET_UNITSET(hp->h_devset, type); in dr_dev_make_list()
1635 dr_dev_clean_up(dr_handle_t *hp, dr_common_unit_t **list, int devnum) in dr_dev_clean_up() argument
1645 if (hp->h_err == NULL) { in dr_dev_clean_up()
1649 hp->h_err = cp->sbdev_error; in dr_dev_clean_up()
1672 dr_dev_walk(dr_handle_t *hp, sbd_comp_type_t type, int present_only, in dr_dev_walk() argument
1681 dr_dev_make_list(hp, type, present_only, &devlist, &devnum); in dr_dev_walk()
1685 rv = (*pre_op)(hp, devlist, devnum); in dr_dev_walk()
1690 (*op)(hp, devlist[n]); in dr_dev_walk()
1692 rv = (*post_op)(hp, devlist, devnum); in dr_dev_walk()
1694 (*board_op)(hp, devlist, devnum); in dr_dev_walk()
1698 dr_dev_clean_up(hp, devlist, devnum); in dr_dev_walk()
1704 dr_dev_noop(dr_handle_t *hp, dr_common_unit_t **devlist, int devnum) in dr_dev_noop() argument
1710 dr_attach_update_state(dr_handle_t *hp, in dr_attach_update_state() argument
1713 dr_board_t *bp = hp->h_bd; in dr_attach_update_state()
1746 hp->h_bd->b_ostate = SBD_STAT_CONFIGURED; in dr_attach_update_state()
1747 hp->h_bd->b_rstate = SBD_STAT_CONNECTED; in dr_attach_update_state()
1748 hp->h_bd->b_cond = SBD_COND_OK; in dr_attach_update_state()
1749 hp->h_bd->b_busy = 0; in dr_attach_update_state()
1750 (void) drv_getparm(TIME, (void *)&hp->h_bd->b_time); in dr_attach_update_state()
1756 hp->h_bd->b_rstate = SBD_STAT_CONNECTED; in dr_attach_update_state()
1757 hp->h_bd->b_ostate = SBD_STAT_CONFIGURED; in dr_attach_update_state()
1758 (void) drv_getparm(TIME, (void *)&hp->h_bd->b_time); in dr_attach_update_state()
1769 hp->h_bd->b_rstate = SBD_STAT_CONNECTED; in dr_attach_update_state()
1770 hp->h_bd->b_ostate = SBD_STAT_CONFIGURED; in dr_attach_update_state()
1771 hp->h_bd->b_cond = SBD_COND_OK; in dr_attach_update_state()
1772 hp->h_bd->b_busy = 0; in dr_attach_update_state()
1773 (void) drv_getparm(TIME, (void *)&hp->h_bd->b_time); in dr_attach_update_state()
1783 dr_dev_configure(dr_handle_t *hp) in dr_dev_configure() argument
1787 rv = dr_dev_walk(hp, SBD_COMP_CPU, 1, in dr_dev_configure()
1794 rv = dr_dev_walk(hp, SBD_COMP_MEM, 1, in dr_dev_configure()
1802 (void) dr_dev_walk(hp, SBD_COMP_IO, 1, in dr_dev_configure()
1811 dr_release_update_state(dr_handle_t *hp, in dr_release_update_state() argument
1817 dr_board_t *bp = hp->h_bd; in dr_release_update_state()
1826 hp->h_bd->b_busy = 1; in dr_release_update_state()
1848 dr_release_done(dr_handle_t *hp, dr_common_unit_t *cp) in dr_release_done() argument
1850 _NOTE(ARGUNUSED(hp)) in dr_release_done()
1859 ASSERT(bp == hp->h_bd); in dr_release_done()
1893 dr_dev_release_mem(dr_handle_t *hp, dr_common_unit_t *dv) in dr_dev_release_mem() argument
1896 dr_release_done(hp, dv); in dr_dev_release_mem()
1900 dr_dev_release(dr_handle_t *hp) in dr_dev_release() argument
1904 hp->h_bd->b_busy = 1; in dr_dev_release()
1906 rv = dr_dev_walk(hp, SBD_COMP_CPU, 0, in dr_dev_release()
1913 rv = dr_dev_walk(hp, SBD_COMP_MEM, 0, in dr_dev_release()
1921 rv = dr_dev_walk(hp, SBD_COMP_IO, 0, in dr_dev_release()
1930 hp->h_bd->b_busy = 0; in dr_dev_release()
1935 dr_detach_update_state(dr_handle_t *hp, in dr_detach_update_state() argument
1938 dr_board_t *bp = hp->h_bd; in dr_detach_update_state()
1970 hp->h_bd->b_ostate = SBD_STAT_UNCONFIGURED; in dr_detach_update_state()
1971 (void) drv_getparm(TIME, (void *)&hp->h_bd->b_time); in dr_detach_update_state()
1979 (void) drv_getparm(TIME, (void *)&hp->h_bd->b_time); in dr_detach_update_state()
1982 if ((hp->h_devset & DR_DEVS_UNATTACHED(bp)) == hp->h_devset) in dr_detach_update_state()
1983 hp->h_bd->b_busy = 0; in dr_detach_update_state()
1988 dr_dev_unconfigure(dr_handle_t *hp) in dr_dev_unconfigure() argument
1990 dr_board_t *bp = hp->h_bd; in dr_dev_unconfigure()
2005 (void) dr_dev_walk(hp, SBD_COMP_IO, 0, in dr_dev_unconfigure()
2013 (void) dr_dev_walk(hp, SBD_COMP_CPU, 0, in dr_dev_unconfigure()
2019 (void) dr_dev_walk(hp, SBD_COMP_MEM, 0, in dr_dev_unconfigure()
2029 dr_dev_cancel(dr_handle_t *hp) in dr_dev_cancel() argument
2033 dr_board_t *bp = hp->h_bd; in dr_dev_cancel()
2042 devset = hp->h_devset & DR_DEVS_RELEASED(bp); in dr_dev_cancel()
2105 hp->h_bd->b_ostate = SBD_STAT_CONFIGURED; in dr_dev_cancel()
2106 hp->h_bd->b_busy = 0; in dr_dev_cancel()
2107 (void) drv_getparm(TIME, (void *)&hp->h_bd->b_time); in dr_dev_cancel()
2112 dr_dev_status(dr_handle_t *hp) in dr_dev_status() argument
2131 mode = hp->h_mode; in dr_dev_status()
2132 shp = hp; in dr_dev_status()
2134 bp = hp->h_bd; in dr_dev_status()
2151 if (hp->h_sbdcmd.cmd_cm.c_id.c_type == SBD_COMP_NONE) { in dr_dev_status()
2152 if (dr_cmd_flags(hp) & SBD_FLAG_ALLCMP) { in dr_dev_status()
2184 pbsz = (int)hp->h_sbdcmd.cmd_stat.s_nbytes; in dr_dev_status()
2222 DRERR_SET_C(&hp->h_err, &err); in dr_dev_status()
2262 if ((nstat = dr_cpu_status(hp, devset, devstatp)) > 0) { in dr_dev_status()
2268 if ((nstat = dr_mem_status(hp, devset, devstatp)) > 0) { in dr_dev_status()
2274 if ((nstat = dr_io_status(hp, devset, devstatp)) > 0) { in dr_dev_status()
2299 DR_OP_INTERNAL_ERROR(hp); in dr_dev_status()
2307 DR_OP_INTERNAL_ERROR(hp); in dr_dev_status()
2406 hp->h_sbdcmd.cmd_stat.s_statp, pbsz, mode) != 0) { in dr_dev_status()
2416 if (ddi_copyout((void *)dstatp, hp->h_sbdcmd.cmd_stat.s_statp, in dr_dev_status()
2435 dr_get_ncm(dr_handle_t *hp) in dr_get_ncm() argument
2441 devset = DR_DEVS_PRESENT(hp->h_bd); in dr_get_ncm()
2442 if (hp->h_sbdcmd.cmd_cm.c_id.c_type != SBD_COMP_NONE) in dr_get_ncm()
2443 devset &= DEVSET(hp->h_sbdcmd.cmd_cm.c_id.c_type, in dr_get_ncm()
2775 dr_op_err(int ce, dr_handle_t *hp, int code, char *fmt, ...) in dr_op_err() argument
2787 DRERR_SET_C(&hp->h_err, &err); in dr_op_err()
2994 dr_pt_try_drmach(dr_handle_t *hp) in dr_pt_try_drmach() argument
2996 dr_board_t *bp = hp->h_bd; in dr_pt_try_drmach()
2997 sbd_comp_id_t *comp_id = &hp->h_sbdcmd.cmd_cm.c_id; in dr_pt_try_drmach()
3007 dr_op_err(CE_IGNORE, hp, ESBD_INVAL, comp_id->c_name); in dr_pt_try_drmach()
3017 if (hp->h_err == NULL) in dr_pt_try_drmach()
3018 hp->h_err = drmach_passthru(id, &hp->h_opts); in dr_pt_try_drmach()
3020 return (hp->h_err == NULL ? 0 : -1); in dr_pt_try_drmach()
3024 dr_pt_ioctl(dr_handle_t *hp) in dr_pt_ioctl() argument
3034 sz = hp->h_opts.size; in dr_pt_ioctl()
3035 copts = hp->h_opts.copts; in dr_pt_ioctl()
3051 rv = (*pt_arr[cmd].pt_func)(hp); in dr_pt_ioctl()
3053 rv = dr_pt_try_drmach(hp); in dr_pt_ioctl()
3326 dr_cmd_flags(dr_handle_t *hp) in dr_cmd_flags() argument
3328 return (hp->h_sbdcmd.cmd_cm.c_flags); in dr_cmd_flags()