3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #include <sys/dditypes.h>
27 #include <sys/mdb_modapi.h>
28 #include <sys/modctl.h>
29 #include <sys/sunddi.h>
30 #include <sys/lpif.h>
31 #include <sys/stmf.h>
32 #include <sys/portif.h>
33 #include <stmf_impl.h>
34 #include <lun_map.h>
35 #include <stmf_state.h>
36
37 #include <sys/fct.h>
38 #include <fct_impl.h>
39
40 #include "cmd_options.h"
41
42 static int
43 stmf_ilport_walk_i(mdb_walk_state_t *wsp)
44 {
45 if (wsp->walk_addr == NULL) {
46 struct stmf_state state;
47
48 if (mdb_readsym(&state, sizeof (struct stmf_state),
49 "stmf_state") == -1) {
50 mdb_warn("failed to read stmf_state");
51 return (WALK_ERR);
52 }
1088 if (ptr[0] == '-')
1089 ptr++;
1090 while (*ptr) {
1091 if (*ptr == 'v')
1092 verbose = 1;
1093 ptr++;
1094 }
1095 }
1096
1097 if (!(flags & DCMD_ADDRSPEC)) {
1098 mdb_warn("fct_i_local_port_t address should be specified");
1099 return (DCMD_ERR);
1100 }
1101
1102 if (mdb_vread(&iport, sizeof (struct fct_i_local_port), addr)
1103 != sizeof (struct fct_i_local_port)) {
1104 mdb_warn("Unable to read in fct_i_local_port at %p\n", addr);
1105 return (DCMD_ERR);
1106 }
1107
1108 icmdp = iport.iport_cached_cmdlist;
1109 while (icmdp) {
1110 if (mdb_vread(&icmd, sizeof (struct fct_i_cmd),
1111 (uintptr_t)icmdp) == -1) {
1112 mdb_warn("failed to read fct_i_cmd at %p", icmdp);
1113 return (DCMD_ERR);
1114 }
1115
1116 mdb_printf("%p\n", icmdp);
1117 if (verbose) {
1118 mdb_printf(" fct cmd: %p\n", icmd.icmd_cmd);
1119 }
1120
1121 icmdp = icmd.icmd_next;
1122 }
1123
1124 return (DCMD_OK);
1125 }
1126
1127 /*
1128 * Walker to list the addresses of all the active STMF scsi tasks (scsi_task_t),
1129 * given a stmf_worker address
1130 *
1131 * To list all the active STMF scsi tasks, use
1132 * "::walk stmf_worker |::walk stmf_scsi_task"
1133 * To list the active tasks of a particular worker, use
1134 * <stmf_worker addr>::walk stmf_scsi_task
1135 */
1136 static int
1137 stmf_scsi_task_walk_init(mdb_walk_state_t *wsp)
1138 {
1139 stmf_worker_t worker;
1140
1141 /*
|
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #include <sys/dditypes.h>
28 #include <sys/mdb_modapi.h>
29 #include <sys/modctl.h>
30 #include <sys/sunddi.h>
31 #include <sys/lpif.h>
32 #include <sys/stmf.h>
33 #include <sys/portif.h>
34 #include <sys/list.h>
35 #include <stmf_impl.h>
36 #include <lun_map.h>
37 #include <stmf_state.h>
38
39 #include <sys/fct.h>
40 #include <fct_impl.h>
41
42 #include "cmd_options.h"
43
44 static int
45 stmf_ilport_walk_i(mdb_walk_state_t *wsp)
46 {
47 if (wsp->walk_addr == NULL) {
48 struct stmf_state state;
49
50 if (mdb_readsym(&state, sizeof (struct stmf_state),
51 "stmf_state") == -1) {
52 mdb_warn("failed to read stmf_state");
53 return (WALK_ERR);
54 }
1090 if (ptr[0] == '-')
1091 ptr++;
1092 while (*ptr) {
1093 if (*ptr == 'v')
1094 verbose = 1;
1095 ptr++;
1096 }
1097 }
1098
1099 if (!(flags & DCMD_ADDRSPEC)) {
1100 mdb_warn("fct_i_local_port_t address should be specified");
1101 return (DCMD_ERR);
1102 }
1103
1104 if (mdb_vread(&iport, sizeof (struct fct_i_local_port), addr)
1105 != sizeof (struct fct_i_local_port)) {
1106 mdb_warn("Unable to read in fct_i_local_port at %p\n", addr);
1107 return (DCMD_ERR);
1108 }
1109
1110 icmdp = list_head(&iport.iport_cached_cmdlist);
1111 while (icmdp) {
1112
1113 if (mdb_vread(&icmd, sizeof (struct fct_i_cmd),
1114 (uintptr_t)icmdp) == -1) {
1115 mdb_warn("failed to read fct_i_cmd at %p", icmdp);
1116 return (DCMD_ERR);
1117 }
1118
1119 mdb_printf("%p\n", icmdp);
1120 if (verbose) {
1121 mdb_printf(" fct cmd: %p\n", icmd.icmd_cmd);
1122 }
1123
1124 icmdp = list_next(&iport.iport_cached_cmdlist, icmdp);
1125 }
1126
1127 return (DCMD_OK);
1128 }
1129
1130 /*
1131 * Walker to list the addresses of all the active STMF scsi tasks (scsi_task_t),
1132 * given a stmf_worker address
1133 *
1134 * To list all the active STMF scsi tasks, use
1135 * "::walk stmf_worker |::walk stmf_scsi_task"
1136 * To list the active tasks of a particular worker, use
1137 * <stmf_worker addr>::walk stmf_scsi_task
1138 */
1139 static int
1140 stmf_scsi_task_walk_init(mdb_walk_state_t *wsp)
1141 {
1142 stmf_worker_t worker;
1143
1144 /*
|