Print this page
3500 Support LSI SAS2008 (Falcon) Skinny FW for mr_sas(7D)
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/cmd/mdb/common/modules/mr_sas/mr_sas.c
+++ new/usr/src/cmd/mdb/common/modules/mr_sas/mr_sas.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
|
↓ open down ↓ |
15 lines elided |
↑ open up ↑ |
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 */
25 25
26 +/*
27 + * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
28 + */
29 +
26 30 #include <limits.h>
27 31 #include <sys/mdb_modapi.h>
28 32 #include <sys/sysinfo.h>
29 33 #include <sys/sunmdi.h>
30 34 #include <sys/scsi/scsi.h>
31 35 #include "mr_sas.h"
32 36
33 37 int
34 38 construct_path(uintptr_t addr, char *result)
35 39 {
36 40 struct dev_info d;
37 41 char devi_node[PATH_MAX];
38 42 char devi_addr[PATH_MAX];
39 43
40 44 if (mdb_vread(&d, sizeof (d), addr) == -1) {
41 45 mdb_warn("couldn't read dev_info");
42 46 return (DCMD_ERR);
43 47 }
44 48
45 49 if (d.devi_parent) {
46 50 construct_path((uintptr_t)d.devi_parent, result);
47 51 mdb_readstr(devi_node, sizeof (devi_node),
48 52 (uintptr_t)d.devi_node_name);
49 53 mdb_readstr(devi_addr, sizeof (devi_addr),
|
↓ open down ↓ |
14 lines elided |
↑ open up ↑ |
50 54 (uintptr_t)d.devi_addr);
51 55 mdb_snprintf(result+strlen(result),
52 56 PATH_MAX-strlen(result),
53 57 "/%s%s%s", devi_node, (*devi_addr ? "@" : ""),
54 58 devi_addr);
55 59 }
56 60 return (DCMD_OK);
57 61 }
58 62
59 63 void
60 -display_targets(struct mrsas_instance m, int verbose)
64 +display_targets(struct mrsas_instance *m, int verbose)
61 65 {
62 66 int tgt;
63 - struct mrsas_ld *mr_ldp;
67 + struct mrsas_ld mr_ldp[MRDRV_MAX_LD];
68 + struct mrsas_tbolt_pd mr_pdp[MRSAS_TBOLT_PD_TGT_MAX];
64 69 char device_path[PATH_MAX];
65 70
66 71 if (verbose) {
67 72 *device_path = 0;
68 - if (construct_path((uintptr_t)m.dip, device_path) != DCMD_OK) {
73 + if (construct_path((uintptr_t)m->dip, device_path) != DCMD_OK) {
69 74 strcpy(device_path, "couldn't determine device path");
70 75 }
71 76 }
72 77
73 78 mdb_printf("\n");
74 79 if (verbose)
75 80 mdb_printf("%s\n", device_path);
76 - mdb_printf("dev_type target\n");
77 - mdb_printf("----------");
78 - mdb_printf("\n");
81 + mdb_printf("Physical/Logical Target\n");
82 + mdb_printf("-----------------------\n");
83 +
84 + if (mdb_vread(&mr_ldp, sizeof (mr_ldp), (uintptr_t)m->mr_ld_list)
85 + == -1 ||
86 + mdb_vread(&mr_pdp, sizeof (mr_pdp), (uintptr_t)m->mr_tbolt_pd_list)
87 + == -1) {
88 + mdb_warn("can't read list of disks");
89 + return;
90 + }
91 +
79 92 for (tgt = 0; tgt < MRDRV_MAX_LD; tgt++) {
80 - mr_ldp = (struct mrsas_ld *)&m.mr_ld_list[tgt];
81 - if ((mr_ldp != NULL) && (mr_ldp->dip != NULL) &&
82 - (mr_ldp->lun_type == MRSAS_LD_LUN)) {
83 - mdb_printf("sd %d", tgt);
84 - mdb_printf("\n");
93 + if (mr_ldp[tgt].dip != NULL &&
94 + mr_ldp[tgt].lun_type == MRSAS_LD_LUN) {
95 + mdb_printf("Logical sd %d\n", tgt);
85 96 }
86 97 }
98 + for (tgt = 0; tgt < MRSAS_TBOLT_PD_TGT_MAX; tgt++) {
99 + if (mr_pdp[tgt].dip != NULL &&
100 + mr_pdp[tgt].lun_type == MRSAS_TBOLT_PD_LUN) {
101 + mdb_printf("Physical sd %d\n", tgt);
102 + }
103 + }
87 104 mdb_printf("\n");
88 105 }
89 106
90 107 void
91 -display_deviceinfo(struct mrsas_instance m)
108 +display_deviceinfo(struct mrsas_instance *m)
92 109 {
93 110 uint16_t vid, did, svid, sid;
94 111
95 - vid = m.vendor_id;
96 - did = m.device_id;
97 - svid = m.subsysvid;
98 - sid = m.subsysid;
112 + vid = m->vendor_id;
113 + did = m->device_id;
114 + svid = m->subsysvid;
115 + sid = m->subsysid;
99 116
100 117 mdb_printf("\n");
101 118 mdb_printf("vendor_id device_id subsysvid subsysid");
102 119 mdb_printf("\n");
103 120 mdb_printf("--------------------------------------");
104 121 mdb_printf("\n");
105 122 mdb_printf(" 0x%x 0x%x 0x%x 0x%x",
106 123 vid, did, svid, sid);
107 124 mdb_printf("\n");
108 125 }
109 126
110 127 static int
111 128 mr_sas_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
112 129 {
113 130 struct mrsas_instance m;
114 131
115 132 int instance;
116 133 uint16_t ncmds;
117 134 uint_t verbose = FALSE;
118 135 uint_t device_info = FALSE;
119 136 uint_t target_info = FALSE;
120 137 int rv = DCMD_OK;
121 138 void *mrsas_state;
122 139
123 140 if (!(flags & DCMD_ADDRSPEC)) {
124 141 mrsas_state = NULL;
125 142 if (mdb_readvar(&mrsas_state, "mrsas_state") == -1) {
126 143 mdb_warn("can't read mrsas_state");
127 144 return (DCMD_ERR);
128 145 }
129 146 if (mdb_pwalk_dcmd("genunix`softstate", "mr_sas`mr_sas",
130 147 argc, argv, (uintptr_t)mrsas_state) == -1) {
131 148 mdb_warn("mdb_pwalk_dcmd failed");
132 149 return (DCMD_ERR);
133 150 }
134 151 return (DCMD_OK);
135 152 }
136 153
137 154 if (mdb_getopts(argc, argv,
138 155 'd', MDB_OPT_SETBITS, TRUE, &device_info,
139 156 't', MDB_OPT_SETBITS, TRUE, &target_info,
140 157 'v', MDB_OPT_SETBITS, TRUE, &verbose,
141 158 NULL) != argc)
142 159 return (DCMD_USAGE);
143 160
144 161 if (mdb_vread(&m, sizeof (m), addr) == -1) {
145 162 mdb_warn("couldn't read mrsas_instance struct at 0x%p", addr);
146 163 return (DCMD_ERR);
147 164 }
148 165 instance = m.instance;
149 166
150 167 /* cmd slot info */
151 168 ncmds = m.max_fw_cmds;
152 169
153 170 /* processing completed */
154 171 if (((flags & DCMD_ADDRSPEC) && !(flags & DCMD_LOOP)) ||
155 172 (flags & DCMD_LOOPFIRST)) {
156 173 if ((flags & DCMD_LOOP) && !(flags & DCMD_LOOPFIRST))
157 174 mdb_printf("\n");
158 175 mdb_printf(" mrsas_t inst max_fw_cmds intr_type");
159 176 mdb_printf("\n");
160 177 mdb_printf("===========================================");
161 178 mdb_printf("\n");
162 179 }
163 180
164 181 mdb_printf("%16p %4d %4d ", addr, instance, ncmds);
165 182 switch (m.intr_type) {
166 183 case DDI_INTR_TYPE_MSIX:
167 184 mdb_printf("MSI-X");
168 185 break;
169 186 case DDI_INTR_TYPE_MSI:
170 187 mdb_printf("MSI");
|
↓ open down ↓ |
62 lines elided |
↑ open up ↑ |
171 188 break;
172 189 case DDI_INTR_TYPE_FIXED:
173 190 mdb_printf("FIXED");
174 191 break;
175 192 default:
176 193 mdb_printf("INVALD");
177 194 }
178 195 mdb_printf("\n");
179 196
180 197 if (target_info)
181 - display_targets(m, verbose);
198 + display_targets(&m, verbose);
182 199
183 200 if (device_info)
184 - display_deviceinfo(m);
201 + display_deviceinfo(&m);
185 202
186 203 return (rv);
187 204 }
188 205
189 206 void
190 207 mr_sas_help(void)
191 208 {
192 209 mdb_printf("Prints summary information about each mr_sas instance, "
193 210 "Without the address of a \"struct mrsas_instance\", prints every "
194 211 "instance.\n\n"
195 212 "Switches:\n"
196 213 " -t includes information about targets\n"
197 214 " -d includes information about the hardware\n"
198 215 " -v displays extra information for some options\n");
199 216 }
200 217
201 218 static const mdb_dcmd_t dcmds[] = {
202 219 { "mr_sas", "?[-tdv]", "print mr_sas information", mr_sas_dcmd,
203 220 mr_sas_help },
204 221 { NULL }
205 222 };
206 223
207 224 static const mdb_modinfo_t modinfo = {
208 225 MDB_API_VERSION, dcmds, NULL
209 226 };
210 227
211 228 const mdb_modinfo_t *
212 229 _mdb_init(void)
213 230 {
214 231 return (&modinfo);
215 232 }
|
↓ open down ↓ |
21 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX