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