emlxs_dump.c (bb63f56e) emlxs_dump.c (82527734)
1/*
2 * CDDL HEADER START
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

--- 7 unchanged lines hidden (view full) ---

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/*
23 * Copyright 2009 Emulex. All rights reserved.
1/*
2 * CDDL HEADER START
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

--- 7 unchanged lines hidden (view full) ---

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/*
23 * Copyright 2009 Emulex. All rights reserved.
24 * Use is subject to License terms.
24 * Use is subject to license terms.
25 */
26
25 */
26
27
27#include <emlxs.h>
28
29#ifdef DUMP_SUPPORT
30
31/* Required for EMLXS_CONTEXT in EMLXS_MSGF calls */
32EMLXS_MSG_DEF(EMLXS_DUMP_C);
33
28#include <emlxs.h>
29
30#ifdef DUMP_SUPPORT
31
32/* Required for EMLXS_CONTEXT in EMLXS_MSGF calls */
33EMLXS_MSG_DEF(EMLXS_DUMP_C);
34
34
35/* ************************************************************************* */
36/* Utility functions */
37/* ************************************************************************* */
38
35/* ************************************************************************* */
36/* Utility functions */
37/* ************************************************************************* */
38
39static void
40emlxs_swap32_buffer(
41 uint8_t *buffer,
42 uint32_t size)
43{
44 uint32_t word;
45 uint32_t *wptr;
46 uint32_t i;
47
48 wptr = (uint32_t *)buffer;
49 for (i = 0; i < size / 4; i++) {
50 word = *wptr;
51 *wptr++ =
52 ((((word)&0xFF) << 24) | (((word)&0xFF00) << 8) |
53 (((word)&0xFF0000) >> 8) | (((word)&0xFF000000) >>
54 24));
55 }
56
57 return;
58
59} /* emlxs_swap32_buffer() */
60
61
62static uint32_t
63emlxs_menlo_set_mode(
64 emlxs_hba_t *hba,
65 uint32_t mode)
66{
67 emlxs_port_t *port = &PPORT;
68 uint32_t cmd_size;
69 uint32_t rsp_size;
70 menlo_cmd_t *cmd_buf = NULL;
71 menlo_rsp_t *rsp_buf = NULL;
72 uint32_t rval = 0;
73
39static uint32_t
40emlxs_menlo_set_mode(
41 emlxs_hba_t *hba,
42 uint32_t mode)
43{
44 emlxs_port_t *port = &PPORT;
45 uint32_t cmd_size;
46 uint32_t rsp_size;
47 menlo_cmd_t *cmd_buf = NULL;
48 menlo_rsp_t *rsp_buf = NULL;
49 uint32_t rval = 0;
50
74 cmd_size = sizeof (menlo_set_cmd_t);
75 if ((cmd_buf = (menlo_cmd_t *)kmem_zalloc(cmd_size, KM_SLEEP)) == 0) {
76 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_detail_msg,
77 "emlxs_menlo_set_mode: Unable to allocate command buffer.");
78
79 rval = DFC_SYSRES_ERROR;
80 goto done;
51 if (hba->model_info.device_id != PCI_DEVICE_ID_LP21000_M) {
52 return (DFC_INVALID_ADAPTER);
81 }
82
53 }
54
55 cmd_size = sizeof (menlo_set_cmd_t);
56 cmd_buf = (menlo_cmd_t *)kmem_zalloc(cmd_size, KM_SLEEP);
57
83 rsp_size = 4;
58 rsp_size = 4;
84 if ((rsp_buf = (menlo_rsp_t *)kmem_zalloc(rsp_size, KM_SLEEP)) == 0) {
85 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_detail_msg,
86 "emlxs_menlo_set_mode: "\
87 "Unable to allocate response buffer.");
59 rsp_buf = (menlo_rsp_t *)kmem_zalloc(rsp_size, KM_SLEEP);
88
60
89 rval = DFC_SYSRES_ERROR;
90 goto done;
91 }
92
93 cmd_buf->code = MENLO_CMD_SET_MODE;
94 cmd_buf->set.value1 = mode;
95 cmd_buf->set.value2 = 0;
96
97#ifdef EMLXS_BIG_ENDIAN
98 emlxs_swap32_buffer((uint8_t *)cmd_buf, cmd_size);
99#endif /* EMLXS_BIG_ENDIAN */
100

--- 22 unchanged lines hidden (view full) ---

123 }
124
125 if (rsp_buf) {
126 kmem_free(rsp_buf, 4);
127 }
128
129 return (rval);
130
61 cmd_buf->code = MENLO_CMD_SET_MODE;
62 cmd_buf->set.value1 = mode;
63 cmd_buf->set.value2 = 0;
64
65#ifdef EMLXS_BIG_ENDIAN
66 emlxs_swap32_buffer((uint8_t *)cmd_buf, cmd_size);
67#endif /* EMLXS_BIG_ENDIAN */
68

--- 22 unchanged lines hidden (view full) ---

91 }
92
93 if (rsp_buf) {
94 kmem_free(rsp_buf, 4);
95 }
96
97 return (rval);
98
131} /* emlxs_menlo_set_mode() */
99} /* emlxs_menlo_set_mode() */
132
133
134static uint32_t
135emlxs_menlo_reset(
136 emlxs_hba_t *hba,
137 uint32_t firmware)
138{
139 emlxs_port_t *port = &PPORT;
140 uint32_t cmd_size;
141 uint32_t rsp_size;
142 menlo_cmd_t *cmd_buf = NULL;
143 menlo_rsp_t *rsp_buf = NULL;
144 uint32_t rval = 0;
145
100
101
102static uint32_t
103emlxs_menlo_reset(
104 emlxs_hba_t *hba,
105 uint32_t firmware)
106{
107 emlxs_port_t *port = &PPORT;
108 uint32_t cmd_size;
109 uint32_t rsp_size;
110 menlo_cmd_t *cmd_buf = NULL;
111 menlo_rsp_t *rsp_buf = NULL;
112 uint32_t rval = 0;
113
146 cmd_size = sizeof (menlo_reset_cmd_t);
147 if ((cmd_buf = (menlo_cmd_t *)kmem_zalloc(cmd_size, KM_SLEEP)) == 0) {
148 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_detail_msg,
149 "emlxs_menlo_reset: Unable to allocate command buffer.");
150
151 rval = DFC_SYSRES_ERROR;
152 goto done;
114 if (hba->model_info.device_id != PCI_DEVICE_ID_LP21000_M) {
115 return (DFC_INVALID_ADAPTER);
153 }
154
116 }
117
118 cmd_size = sizeof (menlo_reset_cmd_t);
119 cmd_buf = (menlo_cmd_t *)kmem_zalloc(cmd_size, KM_SLEEP);
120
155 rsp_size = 4;
121 rsp_size = 4;
156 if ((rsp_buf = (menlo_rsp_t *)kmem_zalloc(rsp_size, KM_SLEEP)) == 0) {
157 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_detail_msg,
158 "emlxs_menlo_reset: Unable to allocate response buffer.");
122 rsp_buf = (menlo_rsp_t *)kmem_zalloc(rsp_size, KM_SLEEP);
159
123
160 rval = DFC_SYSRES_ERROR;
161 goto done;
162 }
163
164 cmd_buf->code = MENLO_CMD_RESET;
165 cmd_buf->reset.firmware = firmware;
166
167#ifdef EMLXS_BIG_ENDIAN
168 emlxs_swap32_buffer((uint8_t *)cmd_buf, cmd_size);
169#endif /* EMLXS_BIG_ENDIAN */
170
171 if (rval = emlxs_send_menlo_cmd(hba, (uint8_t *)cmd_buf, cmd_size,

--- 21 unchanged lines hidden (view full) ---

193 }
194
195 if (rsp_buf) {
196 kmem_free(rsp_buf, 4);
197 }
198
199 return (rval);
200
124 cmd_buf->code = MENLO_CMD_RESET;
125 cmd_buf->reset.firmware = firmware;
126
127#ifdef EMLXS_BIG_ENDIAN
128 emlxs_swap32_buffer((uint8_t *)cmd_buf, cmd_size);
129#endif /* EMLXS_BIG_ENDIAN */
130
131 if (rval = emlxs_send_menlo_cmd(hba, (uint8_t *)cmd_buf, cmd_size,

--- 21 unchanged lines hidden (view full) ---

153 }
154
155 if (rsp_buf) {
156 kmem_free(rsp_buf, 4);
157 }
158
159 return (rval);
160
201} /* emlxs_menlo_reset() */
161} /* emlxs_menlo_reset() */
202
203
204static uint32_t
205emlxs_menlo_get_cfg(
206 emlxs_hba_t *hba,
207 menlo_get_config_rsp_t *rsp_buf,
208 uint32_t rsp_size)
209{
210 emlxs_port_t *port = &PPORT;
211 uint32_t cmd_size;
212 menlo_cmd_t *cmd_buf = NULL;
213 uint32_t rval = 0;
214
162
163
164static uint32_t
165emlxs_menlo_get_cfg(
166 emlxs_hba_t *hba,
167 menlo_get_config_rsp_t *rsp_buf,
168 uint32_t rsp_size)
169{
170 emlxs_port_t *port = &PPORT;
171 uint32_t cmd_size;
172 menlo_cmd_t *cmd_buf = NULL;
173 uint32_t rval = 0;
174
215 cmd_size = sizeof (menlo_get_cmd_t);
216 if ((cmd_buf = (menlo_cmd_t *)kmem_zalloc(cmd_size, KM_SLEEP)) == 0) {
217 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_detail_msg,
218 "emlxs_menlo_get_cfg: Unable to allocate command buffer.");
219
220 rval = DFC_SYSRES_ERROR;
221 goto done;
175 if (hba->model_info.device_id != PCI_DEVICE_ID_LP21000_M) {
176 return (DFC_INVALID_ADAPTER);
222 }
223
177 }
178
179 cmd_size = sizeof (menlo_get_cmd_t);
180 cmd_buf = (menlo_cmd_t *)kmem_zalloc(cmd_size, KM_SLEEP);
181
224 rsp_size = sizeof (menlo_get_config_rsp_t);
225
226 cmd_buf->code = MENLO_CMD_GET_CONFIG;
227 cmd_buf->get.context = 0;
228 cmd_buf->get.length = rsp_size;
229
230#ifdef EMLXS_BIG_ENDIAN
231 emlxs_swap32_buffer((uint8_t *)cmd_buf, cmd_size);

--- 20 unchanged lines hidden (view full) ---

252done:
253
254 if (cmd_buf) {
255 kmem_free(cmd_buf, sizeof (menlo_get_cmd_t));
256 }
257
258 return (rval);
259
182 rsp_size = sizeof (menlo_get_config_rsp_t);
183
184 cmd_buf->code = MENLO_CMD_GET_CONFIG;
185 cmd_buf->get.context = 0;
186 cmd_buf->get.length = rsp_size;
187
188#ifdef EMLXS_BIG_ENDIAN
189 emlxs_swap32_buffer((uint8_t *)cmd_buf, cmd_size);

--- 20 unchanged lines hidden (view full) ---

210done:
211
212 if (cmd_buf) {
213 kmem_free(cmd_buf, sizeof (menlo_get_cmd_t));
214 }
215
216 return (rval);
217
260} /* emlxs_menlo_get_cfg() */
218} /* emlxs_menlo_get_cfg() */
261
262
263
264static uint32_t
265emlxs_menlo_get_logcfg(
266 emlxs_hba_t *hba,
267 menlo_rsp_t *rsp_buf,
268 uint32_t rsp_size)
269{
270 emlxs_port_t *port = &PPORT;
271 uint32_t cmd_size;
272 menlo_cmd_t *cmd_buf = NULL;
273 uint32_t rval = 0;
274
219
220
221
222static uint32_t
223emlxs_menlo_get_logcfg(
224 emlxs_hba_t *hba,
225 menlo_rsp_t *rsp_buf,
226 uint32_t rsp_size)
227{
228 emlxs_port_t *port = &PPORT;
229 uint32_t cmd_size;
230 menlo_cmd_t *cmd_buf = NULL;
231 uint32_t rval = 0;
232
275 cmd_size = sizeof (menlo_get_cmd_t);
276 if ((cmd_buf = (menlo_cmd_t *)kmem_zalloc(cmd_size, KM_SLEEP)) == 0) {
277 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_detail_msg,
278 "emlxs_menlo_get_logcfg: "\
279 "Unable to allocate command buffer.");
280
281 rval = DFC_SYSRES_ERROR;
282 goto done;
233 if (hba->model_info.device_id != PCI_DEVICE_ID_LP21000_M) {
234 return (DFC_INVALID_ADAPTER);
283 }
284
235 }
236
237 cmd_size = sizeof (menlo_get_cmd_t);
238 cmd_buf = (menlo_cmd_t *)kmem_zalloc(cmd_size, KM_SLEEP);
239
285 cmd_buf->code = MENLO_CMD_GET_LOG_CONFIG;
286 cmd_buf->get.context = 0;
287 cmd_buf->get.length = rsp_size;
288
289#ifdef EMLXS_BIG_ENDIAN
290 emlxs_swap32_buffer((uint8_t *)cmd_buf, cmd_size);
291#endif /* EMLXS_BIG_ENDIAN */
292

--- 18 unchanged lines hidden (view full) ---

311done:
312
313 if (cmd_buf) {
314 kmem_free(cmd_buf, sizeof (menlo_get_cmd_t));
315 }
316
317 return (rval);
318
240 cmd_buf->code = MENLO_CMD_GET_LOG_CONFIG;
241 cmd_buf->get.context = 0;
242 cmd_buf->get.length = rsp_size;
243
244#ifdef EMLXS_BIG_ENDIAN
245 emlxs_swap32_buffer((uint8_t *)cmd_buf, cmd_size);
246#endif /* EMLXS_BIG_ENDIAN */
247

--- 18 unchanged lines hidden (view full) ---

266done:
267
268 if (cmd_buf) {
269 kmem_free(cmd_buf, sizeof (menlo_get_cmd_t));
270 }
271
272 return (rval);
273
319} /* emlxs_menlo_get_logcfg() */
274} /* emlxs_menlo_get_logcfg() */
320
321
322static uint32_t
323emlxs_menlo_get_log(
324 emlxs_hba_t *hba,
325 uint32_t id,
326 menlo_rsp_t *rsp_buf,
327 uint32_t rsp_size)
328{
329 emlxs_port_t *port = &PPORT;
330 uint32_t cmd_size;
331 menlo_cmd_t *cmd_buf = NULL;
332 uint32_t rval = 0;
333
275
276
277static uint32_t
278emlxs_menlo_get_log(
279 emlxs_hba_t *hba,
280 uint32_t id,
281 menlo_rsp_t *rsp_buf,
282 uint32_t rsp_size)
283{
284 emlxs_port_t *port = &PPORT;
285 uint32_t cmd_size;
286 menlo_cmd_t *cmd_buf = NULL;
287 uint32_t rval = 0;
288
334 cmd_size = sizeof (menlo_get_cmd_t);
335 if ((cmd_buf = (menlo_cmd_t *)kmem_zalloc(cmd_size, KM_SLEEP)) == 0) {
336 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_detail_msg,
337 "emlxs_menlo_get_log: Unable to allocate command buffer.");
338
339 rval = DFC_SYSRES_ERROR;
340 goto done;
289 if (hba->model_info.device_id != PCI_DEVICE_ID_LP21000_M) {
290 return (DFC_INVALID_ADAPTER);
341 }
342
291 }
292
293 cmd_size = sizeof (menlo_get_cmd_t);
294 cmd_buf = (menlo_cmd_t *)kmem_zalloc(cmd_size, KM_SLEEP);
295
343 cmd_buf->code = MENLO_CMD_GET_LOG_DATA;
344 cmd_buf->get.context = id;
345 cmd_buf->get.length = rsp_size;
346
347#ifdef EMLXS_BIG_ENDIAN
348 emlxs_swap32_buffer((uint8_t *)cmd_buf, cmd_size);
349#endif /* EMLXS_BIG_ENDIAN */
350

--- 18 unchanged lines hidden (view full) ---

369done:
370
371 if (cmd_buf) {
372 kmem_free(cmd_buf, sizeof (menlo_get_cmd_t));
373 }
374
375 return (rval);
376
296 cmd_buf->code = MENLO_CMD_GET_LOG_DATA;
297 cmd_buf->get.context = id;
298 cmd_buf->get.length = rsp_size;
299
300#ifdef EMLXS_BIG_ENDIAN
301 emlxs_swap32_buffer((uint8_t *)cmd_buf, cmd_size);
302#endif /* EMLXS_BIG_ENDIAN */
303

--- 18 unchanged lines hidden (view full) ---

322done:
323
324 if (cmd_buf) {
325 kmem_free(cmd_buf, sizeof (menlo_get_cmd_t));
326 }
327
328 return (rval);
329
377} /* emlxs_menlo_get_log() */
330} /* emlxs_menlo_get_log() */
378
379
380static uint32_t
381emlxs_menlo_get_paniclog(
382 emlxs_hba_t *hba,
383 menlo_rsp_t *rsp_buf,
384 uint32_t rsp_size)
385{
386 emlxs_port_t *port = &PPORT;
387 uint32_t cmd_size;
388 menlo_cmd_t *cmd_buf = NULL;
389 uint32_t rval = 0;
390
331
332
333static uint32_t
334emlxs_menlo_get_paniclog(
335 emlxs_hba_t *hba,
336 menlo_rsp_t *rsp_buf,
337 uint32_t rsp_size)
338{
339 emlxs_port_t *port = &PPORT;
340 uint32_t cmd_size;
341 menlo_cmd_t *cmd_buf = NULL;
342 uint32_t rval = 0;
343
391 cmd_size = sizeof (menlo_get_cmd_t);
392 if ((cmd_buf = (menlo_cmd_t *)kmem_zalloc(cmd_size, KM_SLEEP)) == 0) {
393 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_detail_msg,
394 "emlxs_menlo_get_paniclog: Unable to allocate "\
395 "command buffer.");
396
397 rval = DFC_SYSRES_ERROR;
398 goto done;
344 if (hba->model_info.device_id != PCI_DEVICE_ID_LP21000_M) {
345 return (DFC_INVALID_ADAPTER);
399 }
400
346 }
347
348 cmd_size = sizeof (menlo_get_cmd_t);
349 cmd_buf = (menlo_cmd_t *)kmem_zalloc(cmd_size, KM_SLEEP);
350
401 cmd_buf->code = MENLO_CMD_GET_PANIC_LOG;
402 cmd_buf->get.context = 0;
403 cmd_buf->get.length = rsp_size;
404
405#ifdef EMLXS_BIG_ENDIAN
406 emlxs_swap32_buffer((uint8_t *)cmd_buf, cmd_size);
407#endif /* EMLXS_BIG_ENDIAN */
408

--- 18 unchanged lines hidden (view full) ---

427done:
428
429 if (cmd_buf) {
430 kmem_free(cmd_buf, sizeof (menlo_get_cmd_t));
431 }
432
433 return (rval);
434
351 cmd_buf->code = MENLO_CMD_GET_PANIC_LOG;
352 cmd_buf->get.context = 0;
353 cmd_buf->get.length = rsp_size;
354
355#ifdef EMLXS_BIG_ENDIAN
356 emlxs_swap32_buffer((uint8_t *)cmd_buf, cmd_size);
357#endif /* EMLXS_BIG_ENDIAN */
358

--- 18 unchanged lines hidden (view full) ---

377done:
378
379 if (cmd_buf) {
380 kmem_free(cmd_buf, sizeof (menlo_get_cmd_t));
381 }
382
383 return (rval);
384
435} /* emlxs_menlo_get_paniclog() */
385} /* emlxs_menlo_get_paniclog() */
436
437
438static uint32_t
439emlxs_menlo_get_sfp(
440 emlxs_hba_t *hba,
441 menlo_rsp_t *rsp_buf,
442 uint32_t rsp_size)
443{
444 emlxs_port_t *port = &PPORT;
445 uint32_t cmd_size;
446 menlo_cmd_t *cmd_buf = NULL;
447 uint32_t rval = 0;
448
386
387
388static uint32_t
389emlxs_menlo_get_sfp(
390 emlxs_hba_t *hba,
391 menlo_rsp_t *rsp_buf,
392 uint32_t rsp_size)
393{
394 emlxs_port_t *port = &PPORT;
395 uint32_t cmd_size;
396 menlo_cmd_t *cmd_buf = NULL;
397 uint32_t rval = 0;
398
449 cmd_size = sizeof (menlo_get_cmd_t);
450 if ((cmd_buf = (menlo_cmd_t *)kmem_zalloc(cmd_size, KM_SLEEP)) == 0) {
451 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_detail_msg,
452 "emlxs_menlo_get_sfp: Unable to allocate command buffer.");
453
454 rval = DFC_SYSRES_ERROR;
455 goto done;
399 if (hba->model_info.device_id != PCI_DEVICE_ID_LP21000_M) {
400 return (DFC_INVALID_ADAPTER);
456 }
457
401 }
402
403 cmd_size = sizeof (menlo_get_cmd_t);
404 cmd_buf = (menlo_cmd_t *)kmem_zalloc(cmd_size, KM_SLEEP);
405
458 cmd_buf->code = MENLO_CMD_GET_SFP_DATA;
459 cmd_buf->get.context = 0;
460 cmd_buf->get.length = rsp_size;
461
462#ifdef EMLXS_BIG_ENDIAN
463 emlxs_swap32_buffer((uint8_t *)cmd_buf, cmd_size);
464#endif /* EMLXS_BIG_ENDIAN */
465

--- 18 unchanged lines hidden (view full) ---

484done:
485
486 if (cmd_buf) {
487 kmem_free(cmd_buf, sizeof (menlo_get_cmd_t));
488 }
489
490 return (rval);
491
406 cmd_buf->code = MENLO_CMD_GET_SFP_DATA;
407 cmd_buf->get.context = 0;
408 cmd_buf->get.length = rsp_size;
409
410#ifdef EMLXS_BIG_ENDIAN
411 emlxs_swap32_buffer((uint8_t *)cmd_buf, cmd_size);
412#endif /* EMLXS_BIG_ENDIAN */
413

--- 18 unchanged lines hidden (view full) ---

432done:
433
434 if (cmd_buf) {
435 kmem_free(cmd_buf, sizeof (menlo_get_cmd_t));
436 }
437
438 return (rval);
439
492} /* emlxs_menlo_get_sfp() */
440} /* emlxs_menlo_get_sfp() */
493
494
495static uint32_t
441
442
443static uint32_t
496emlxs_ishornet(
497 emlxs_hba_t *hba)
498{
499 return ((hba->model_info.device_id == PCI_DEVICE_ID_LP21000_M) ? 1 : 0);
500
501} /* emlxs_ishornet() */
502
503
504static uint32_t
505emlxs_isgraph(
506 uint8_t c)
507{
508 if ((c >= 33) && (c <= 126)) {
509 return (1);
510 }
511
512 return (0);
513
444emlxs_isgraph(
445 uint8_t c)
446{
447 if ((c >= 33) && (c <= 126)) {
448 return (1);
449 }
450
451 return (0);
452
514} /* emlxs_isgraph() */
453} /* emlxs_isgraph() */
515
516
454
455
517static void
456extern void
518emlxs_fflush(
519 emlxs_file_t *fp)
520{
521 uint32_t offset;
522
523 offset = (uint32_t)((uintptr_t)fp->ptr - (uintptr_t)fp->buffer);
524
525 if (offset > fp->size) {
526 fp->ptr = fp->buffer + fp->size;
527 }
528
529 return;
530
457emlxs_fflush(
458 emlxs_file_t *fp)
459{
460 uint32_t offset;
461
462 offset = (uint32_t)((uintptr_t)fp->ptr - (uintptr_t)fp->buffer);
463
464 if (offset > fp->size) {
465 fp->ptr = fp->buffer + fp->size;
466 }
467
468 return;
469
531} /* emlxs_fflush() */
470} /* emlxs_fflush() */
532
533
534extern uint32_t
535emlxs_ftell(
536 emlxs_file_t *fp)
537{
538 uint32_t offset;
539
540 offset = (uint32_t)((uintptr_t)fp->ptr - (uintptr_t)fp->buffer);
541
542 return (offset);
543
471
472
473extern uint32_t
474emlxs_ftell(
475 emlxs_file_t *fp)
476{
477 uint32_t offset;
478
479 offset = (uint32_t)((uintptr_t)fp->ptr - (uintptr_t)fp->buffer);
480
481 return (offset);
482
544} /* emlxs_ftell() */
483} /* emlxs_ftell() */
545
546
547static void
548emlxs_fputc(
549 uint8_t value,
550 emlxs_file_t *fp)
551{
552 uint32_t offset;
553
554 offset = (uint32_t)((uintptr_t)fp->ptr - (uintptr_t)fp->buffer);
555
556 if ((offset + 1) <= fp->size) {
557 *fp->ptr++ = value;
558 }
559
560 return;
561
484
485
486static void
487emlxs_fputc(
488 uint8_t value,
489 emlxs_file_t *fp)
490{
491 uint32_t offset;
492
493 offset = (uint32_t)((uintptr_t)fp->ptr - (uintptr_t)fp->buffer);
494
495 if ((offset + 1) <= fp->size) {
496 *fp->ptr++ = value;
497 }
498
499 return;
500
562} /* emlxs_fputc() */
501} /* emlxs_fputc() */
563
564
565static uint32_t
566emlxs_fwrite(
567 uint8_t *buffer,
568 uint32_t size,
569 uint32_t nitems,
570 emlxs_file_t *fp)

--- 14 unchanged lines hidden (view full) ---

585 if (length) {
586 bcopy(buffer, fp->ptr, length);
587 fp->ptr += length;
588 }
589 }
590
591 return (length);
592
502
503
504static uint32_t
505emlxs_fwrite(
506 uint8_t *buffer,
507 uint32_t size,
508 uint32_t nitems,
509 emlxs_file_t *fp)

--- 14 unchanged lines hidden (view full) ---

524 if (length) {
525 bcopy(buffer, fp->ptr, length);
526 fp->ptr += length;
527 }
528 }
529
530 return (length);
531
593} /* emlxs_fwrite() */
532} /* emlxs_fwrite() */
594
595
596static uint32_t
597emlxs_fprintf(
598 emlxs_file_t *fp,
599 const char *fmt, ...)
600{
601 va_list valist;
602 char va_str[1024];
603 uint32_t length;
604
605 va_start(valist, fmt);
606 (void) vsprintf(va_str, fmt, valist);
607 va_end(valist);
608
609 length = emlxs_fwrite((uint8_t *)va_str, strlen(va_str), 1, fp);
610
611 return (length);
612
533
534
535static uint32_t
536emlxs_fprintf(
537 emlxs_file_t *fp,
538 const char *fmt, ...)
539{
540 va_list valist;
541 char va_str[1024];
542 uint32_t length;
543
544 va_start(valist, fmt);
545 (void) vsprintf(va_str, fmt, valist);
546 va_end(valist);
547
548 length = emlxs_fwrite((uint8_t *)va_str, strlen(va_str), 1, fp);
549
550 return (length);
551
613} /* emlxs_fprintf() */
552} /* emlxs_fprintf() */
614
615
553
554
616static emlxs_file_t *
555extern emlxs_file_t *
617emlxs_fopen(
618 emlxs_hba_t *hba,
619 uint32_t file_type)
620{
556emlxs_fopen(
557 emlxs_hba_t *hba,
558 uint32_t file_type)
559{
621 emlxs_port_t *port = &PPORT;
622 emlxs_file_t *fp;
623
624 switch (file_type) {
625 case EMLXS_TXT_FILE:
626 fp = &hba->dump_txtfile;
627 fp->size = EMLXS_TXT_FILE_SIZE;
628 break;
629

--- 10 unchanged lines hidden (view full) ---

640 default:
641 return (NULL);
642 }
643
644 /* Make sure it is word aligned */
645 fp->size &= 0xFFFFFFFC;
646
647 if (!fp->buffer) {
560 emlxs_file_t *fp;
561
562 switch (file_type) {
563 case EMLXS_TXT_FILE:
564 fp = &hba->dump_txtfile;
565 fp->size = EMLXS_TXT_FILE_SIZE;
566 break;
567

--- 10 unchanged lines hidden (view full) ---

578 default:
579 return (NULL);
580 }
581
582 /* Make sure it is word aligned */
583 fp->size &= 0xFFFFFFFC;
584
585 if (!fp->buffer) {
648 if (!(fp->buffer =
649 (uint8_t *)kmem_zalloc(fp->size, KM_SLEEP))) {
650 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
651 "emlxs_fopen: Unable to allocate dump file. "\
652 "type=%d",
653 file_type);
586 fp->buffer =
587 (uint8_t *)kmem_zalloc(fp->size, KM_SLEEP);
654
588
655 fp->size = 0;
656 fp->ptr = 0;
657 return (NULL);
658 }
659 } else {
660 bzero(fp->buffer, fp->size);
661 }
662
663 fp->ptr = fp->buffer;
664
665 return (fp);
666
589 } else {
590 bzero(fp->buffer, fp->size);
591 }
592
593 fp->ptr = fp->buffer;
594
595 return (fp);
596
667} /* emlxs_fopen() */
597} /* emlxs_fopen() */
668
669
598
599
670static uint32_t
600extern uint32_t
671emlxs_fclose(
672 emlxs_file_t *fp)
673{
674 uint32_t offset;
675
676 if (fp == NULL) {
677 return (0);
678 }

--- 18 unchanged lines hidden (view full) ---

697
698 case 3:
699 *fp->ptr++ = 0;
700 break;
701 }
702
703 return (0);
704
601emlxs_fclose(
602 emlxs_file_t *fp)
603{
604 uint32_t offset;
605
606 if (fp == NULL) {
607 return (0);
608 }

--- 18 unchanged lines hidden (view full) ---

627
628 case 3:
629 *fp->ptr++ = 0;
630 break;
631 }
632
633 return (0);
634
705} /* emlxs_fclose() */
635} /* emlxs_fclose() */
706
707
708static void
709emlxs_fdelete(
710 emlxs_file_t *fp)
711{
712 if (fp == NULL) {
713 return;

--- 4 unchanged lines hidden (view full) ---

718 }
719
720 fp->buffer = NULL;
721 fp->ptr = NULL;
722 fp->size = 0;
723
724 return;
725
636
637
638static void
639emlxs_fdelete(
640 emlxs_file_t *fp)
641{
642 if (fp == NULL) {
643 return;

--- 4 unchanged lines hidden (view full) ---

648 }
649
650 fp->buffer = NULL;
651 fp->ptr = NULL;
652 fp->size = 0;
653
654 return;
655
726} /* emlxs_fdelete() */
656} /* emlxs_fdelete() */
727
728
729/* This builds a single core buffer for the IOCTL interface */
730extern uint32_t
731emlxs_get_dump(
732 emlxs_hba_t *hba,
733 uint8_t *buffer,
734 uint32_t *buflen)

--- 69 unchanged lines hidden (view full) ---

804 }
805
806 if (size_dmp) {
807 wptr[i++] = EMLXS_DMP_FILE_ID;
808 wptr[i++] = size_dmp;
809 }
810
811 if (size_cee) {
657
658
659/* This builds a single core buffer for the IOCTL interface */
660extern uint32_t
661emlxs_get_dump(
662 emlxs_hba_t *hba,
663 uint8_t *buffer,
664 uint32_t *buflen)

--- 69 unchanged lines hidden (view full) ---

734 }
735
736 if (size_dmp) {
737 wptr[i++] = EMLXS_DMP_FILE_ID;
738 wptr[i++] = size_dmp;
739 }
740
741 if (size_cee) {
812 wptr[i++] = EMLXS_CEE_FILE_ID;
742 if (hba->model_info.chip == EMLXS_TIGERSHARK_CHIP) {
743 wptr[i++] = EMLXS_FAT_FILE_ID;
744 } else {
745 wptr[i++] = EMLXS_CEE_FILE_ID;
746 }
747
813 wptr[i++] = size_cee;
814 }
815
816 bptr = (uint8_t *)&wptr[i];
817
818 if (size_txt) {
819 bcopy(fp_txt->buffer, bptr, size_txt);
820 bptr += size_txt;

--- 12 unchanged lines hidden (view full) ---

833done:
834
835 *buflen = size;
836
837 /* printf("Done. buflen=%d \n", *buflen); */
838
839 return (0);
840
748 wptr[i++] = size_cee;
749 }
750
751 bptr = (uint8_t *)&wptr[i];
752
753 if (size_txt) {
754 bcopy(fp_txt->buffer, bptr, size_txt);
755 bptr += size_txt;

--- 12 unchanged lines hidden (view full) ---

768done:
769
770 *buflen = size;
771
772 /* printf("Done. buflen=%d \n", *buflen); */
773
774 return (0);
775
841} /* emlxs_get_dump() */
776} /* emlxs_get_dump() */
842
843
844static uint32_t
845emlxs_read_cfg_region(
846 emlxs_hba_t *hba,
847 uint32_t Identifier,
848 uint32_t ByteCount,
849 uint32_t *pRetByteCount,
850 uint8_t *pBuffer)
851{
852 emlxs_port_t *port = &PPORT;
853 MAILBOXQ *mbq;
777
778
779static uint32_t
780emlxs_read_cfg_region(
781 emlxs_hba_t *hba,
782 uint32_t Identifier,
783 uint32_t ByteCount,
784 uint32_t *pRetByteCount,
785 uint8_t *pBuffer)
786{
787 emlxs_port_t *port = &PPORT;
788 MAILBOXQ *mbq;
854 MAILBOX *mb;
855 uint32_t ByteCountRem; /* remaining portion of original byte count */
856 uint32_t ByteCountReq; /* requested byte count for a particular dump */
857 uint32_t CopyCount; /* bytes to copy after each successful dump */
858 uint32_t Offset; /* Offset into Config Region, for each dump */
859 uint8_t *pLocalBuf; /* ptr to buffer to receive each dump */
860
789 uint32_t ByteCountRem; /* remaining portion of original byte count */
790 uint32_t ByteCountReq; /* requested byte count for a particular dump */
791 uint32_t CopyCount; /* bytes to copy after each successful dump */
792 uint32_t Offset; /* Offset into Config Region, for each dump */
793 uint8_t *pLocalBuf; /* ptr to buffer to receive each dump */
794
861 if ((mbq =
862 (MAILBOXQ *)kmem_zalloc(sizeof (MAILBOXQ), KM_SLEEP)) == 0) {
863 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_dfc_error_msg,
864 "DUMP: Unable to allocate mailbox buffer.");
795 mbq =
796 (MAILBOXQ *)kmem_zalloc(sizeof (MAILBOXQ), KM_SLEEP);
865
797
866 return (1);
867 }
868 mb = (MAILBOX *) mbq;
869
870 pLocalBuf = pBuffer; /* init local pointer to caller's buffer */
871 Offset = 0; /* start at offset 0 */
872 *pRetByteCount = 0; /* init returned byte count */
873 CopyCount = 0;
874
875 for (ByteCountRem = ByteCount; ByteCountRem > 0;
876 ByteCountRem -= CopyCount) {
798 pLocalBuf = pBuffer; /* init local pointer to caller's buffer */
799 Offset = 0; /* start at offset 0 */
800 *pRetByteCount = 0; /* init returned byte count */
801 CopyCount = 0;
802
803 for (ByteCountRem = ByteCount; ByteCountRem > 0;
804 ByteCountRem -= CopyCount) {
877 ByteCountReq =
878 (ByteCountRem < DUMP_BC_MAX) ? ByteCountRem : DUMP_BC_MAX;
879
805
880 bzero((void *)mb, MAILBOX_CMD_BSIZE);
806 if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) {
807 MAILBOX4 *mb = (MAILBOX4 *)mbq;
881
808
882 mb->mbxCommand = MBX_DUMP_MEMORY;
883 mb->un.varDmp.type = DMP_NV_PARAMS, mb->un.varDmp.cv = 1;
884 mb->un.varDmp.region_id = Identifier;
885 mb->un.varDmp.entry_index = Offset;
886 mb->un.varDmp.word_cnt = ByteCountReq / 4;
887 mb->mbxOwner = OWN_HOST;
809 ByteCountReq =
810 (ByteCountRem < hba->sli.sli4.dump_region.size) ?
811 ByteCountRem : hba->sli.sli4.dump_region.size;
888
812
889 if (emlxs_sli_issue_mbox_cmd(hba, mb, MBX_WAIT, 0) !=
890 MBX_SUCCESS) {
891 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_init_debug_msg,
892 "Unable to read config region. id=%x "\
893 "offset=%x status=%x",
894 Identifier, Offset, mb->mbxStatus);
813 /* Clear the local dump_region */
814 bzero(hba->sli.sli4.dump_region.virt,
815 hba->sli.sli4.dump_region.size);
895
816
896 kmem_free(mbq, sizeof (MAILBOXQ));
897 return (1);
898 }
817 bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE);
899
818
900 /* Note: for Type 2/3 Dumps, varDmp.word_cnt is */
901 /* actually a byte count. */
902 CopyCount = mb->un.varDmp.word_cnt;
819 mb->mbxCommand = MBX_DUMP_MEMORY;
820 mb->un.varDmp4.type = DMP_NV_PARAMS;
821 mb->un.varDmp4.entry_index = Offset;
822 mb->un.varDmp4.region_id = Identifier;
903
823
904 /* if no more data returned */
905 if (CopyCount == 0) {
906 break;
907 }
824 mb->un.varDmp4.available_cnt = ByteCountReq;
825 mb->un.varDmp4.addrHigh =
826 PADDR_HI(hba->sli.sli4.dump_region.phys);
827 mb->un.varDmp4.addrLow =
828 PADDR_LO(hba->sli.sli4.dump_region.phys);
829 mb->un.varDmp4.rsp_cnt = 0;
908
830
909 if (CopyCount > ByteCountReq) {
910 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_init_debug_msg,
911 "emlxs_read_cfg_region: Word count too big. "\
912 "%d > %d\n",
913 CopyCount, ByteCountReq);
831 mb->mbxOwner = OWN_HOST;
832 mbq->mbox_cmpl = NULL;
914
833
915 CopyCount = ByteCountReq;
916 }
834 if (EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_WAIT, 0) !=
835 MBX_SUCCESS) {
836 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_init_debug_msg,
837 "Unable to read config region. id=%x "\
838 "offset=%x status=%x",
839 Identifier, Offset, mb->mbxStatus);
917
840
918 bcopy((uint8_t *)&mb->un.varDmp.resp_offset, pLocalBuf,
919 CopyCount);
841 kmem_free(mbq, sizeof (MAILBOXQ));
842 return (1);
843 }
920
844
845 CopyCount = mb->un.varDmp4.rsp_cnt;
846
847 /* if no more data returned */
848 if (CopyCount == 0) {
849 break;
850 }
851
852 if (CopyCount > ByteCountReq) {
853 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_init_debug_msg,
854 "emlxs_read_cfg_region: " \
855 "Byte count too big. %d > %d\n",
856 CopyCount, ByteCountReq);
857
858 CopyCount = ByteCountReq;
859 }
860
861 bcopy((uint8_t *)hba->sli.sli4.dump_region.virt,
862 pLocalBuf, CopyCount);
863
864 } else {
865 MAILBOX *mb = (MAILBOX *)mbq;
866
867 ByteCountReq =
868 (ByteCountRem < DUMP_BC_MAX) ? ByteCountRem :
869 DUMP_BC_MAX;
870
871 bzero((void *)mb, MAILBOX_CMD_BSIZE);
872
873 mb->mbxCommand = MBX_DUMP_MEMORY;
874 mb->un.varDmp.type = DMP_NV_PARAMS;
875 mb->un.varDmp.cv = 1;
876 mb->un.varDmp.region_id = Identifier;
877 mb->un.varDmp.entry_index = Offset;
878 mb->un.varDmp.word_cnt = ByteCountReq / 4;
879 mb->mbxOwner = OWN_HOST;
880 mbq->mbox_cmpl = NULL;
881
882 if (EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_WAIT, 0) !=
883 MBX_SUCCESS) {
884 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_init_debug_msg,
885 "Unable to read config region. id=%x "\
886 "offset=%x status=%x",
887 Identifier, Offset, mb->mbxStatus);
888
889 kmem_free(mbq, sizeof (MAILBOXQ));
890 return (1);
891 }
892
893 /* Note: for Type 2/3 Dumps, varDmp.word_cnt is */
894 /* actually a byte count. */
895 CopyCount = mb->un.varDmp.word_cnt;
896
897 /* if no more data returned */
898 if (CopyCount == 0) {
899 break;
900 }
901
902 if (CopyCount > ByteCountReq) {
903 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_init_debug_msg,
904 "emlxs_read_cfg_region: " \
905 "Byte count too big. %d > %d\n",
906 CopyCount, ByteCountReq);
907
908 CopyCount = ByteCountReq;
909 }
910
911 bcopy((uint8_t *)&mb->un.varDmp.resp_offset, pLocalBuf,
912 CopyCount);
913 }
914
921 pLocalBuf += CopyCount;
922 Offset += CopyCount;
923 *pRetByteCount += CopyCount;
924 }
925
926 return (0);
927
915 pLocalBuf += CopyCount;
916 Offset += CopyCount;
917 *pRetByteCount += CopyCount;
918 }
919
920 return (0);
921
928} /* emlxs_read_cfg_region() */
922} /* emlxs_read_cfg_region() */
929
930
931
932/* ************************************************************************* */
933/* ************************************************************************* */
934/* Dump Generators, Low-Level */
935/* ************************************************************************* */
936/* ************************************************************************* */

--- 33 unchanged lines hidden (view full) ---

970 (void) emlxs_fwrite((uint8_t *)pString, strlen(pString), 1,
971 fpTxtFile);
972 }
973
974 emlxs_fflush(fpTxtFile);
975
976 return (0);
977
923
924
925
926/* ************************************************************************* */
927/* ************************************************************************* */
928/* Dump Generators, Low-Level */
929/* ************************************************************************* */
930/* ************************************************************************* */

--- 33 unchanged lines hidden (view full) ---

964 (void) emlxs_fwrite((uint8_t *)pString, strlen(pString), 1,
965 fpTxtFile);
966 }
967
968 emlxs_fflush(fpTxtFile);
969
970 return (0);
971
978} /* emlxs_dump_string_txtfile() */
972} /* emlxs_dump_string_txtfile() */
979
980
981static uint32_t
982emlxs_dump_word_txtfile(
983 emlxs_file_t *fpTxtFile,
984 uint32_t *pBuffer,
985 uint32_t WordCount,
986 char *pSidLegend,

--- 28 unchanged lines hidden (view full) ---

1015 fpTxtFile);
1016 }
1017
1018 emlxs_fputc('\n', fpTxtFile);
1019 emlxs_fputc('\n', fpTxtFile);
1020 emlxs_fflush(fpTxtFile);
1021 return (0);
1022
973
974
975static uint32_t
976emlxs_dump_word_txtfile(
977 emlxs_file_t *fpTxtFile,
978 uint32_t *pBuffer,
979 uint32_t WordCount,
980 char *pSidLegend,

--- 28 unchanged lines hidden (view full) ---

1009 fpTxtFile);
1010 }
1011
1012 emlxs_fputc('\n', fpTxtFile);
1013 emlxs_fputc('\n', fpTxtFile);
1014 emlxs_fflush(fpTxtFile);
1015 return (0);
1016
1023} /* emlxs_dump_word_txtfile() */
1017} /* emlxs_dump_word_txtfile() */
1024
1025
1026static uint32_t
1027emlxs_dump_byte_txtfile(
1028 emlxs_file_t *fpTxtFile,
1029 uint8_t *pBuffer,
1030 uint32_t ByteCount,
1031 char *pSidLegend,

--- 54 unchanged lines hidden (view full) ---

1086
1087 } /* end for */
1088
1089 emlxs_fputc('\n', fpTxtFile);
1090 emlxs_fputc('\n', fpTxtFile);
1091 emlxs_fflush(fpTxtFile);
1092 return (0);
1093
1018
1019
1020static uint32_t
1021emlxs_dump_byte_txtfile(
1022 emlxs_file_t *fpTxtFile,
1023 uint8_t *pBuffer,
1024 uint32_t ByteCount,
1025 char *pSidLegend,

--- 54 unchanged lines hidden (view full) ---

1080
1081 } /* end for */
1082
1083 emlxs_fputc('\n', fpTxtFile);
1084 emlxs_fputc('\n', fpTxtFile);
1085 emlxs_fflush(fpTxtFile);
1086 return (0);
1087
1094} /* emlxs_dump_byte_txtfile() */
1088} /* emlxs_dump_byte_txtfile() */
1095
1096
1097static uint32_t
1098emlxs_dump_string_dmpfile(
1099 emlxs_file_t *fpDmpFile,
1100 char *pString,
1101 uint8_t sid,
1102 char *pSidLegend,

--- 24 unchanged lines hidden (view full) ---

1127 length = (uint32_t)(strlen(pString) + 1);
1128#ifdef EMLXS_LITTLE_ENDIAN
1129 byte = (uint8_t)(length & 0x0000FF);
1130 emlxs_fputc(byte, fpDmpFile);
1131 byte = (uint8_t)((length & 0x00FF00) >> 8);
1132 emlxs_fputc(byte, fpDmpFile);
1133 byte = (uint8_t)((length & 0xFF0000) >> 16);
1134 emlxs_fputc(byte, fpDmpFile);
1089
1090
1091static uint32_t
1092emlxs_dump_string_dmpfile(
1093 emlxs_file_t *fpDmpFile,
1094 char *pString,
1095 uint8_t sid,
1096 char *pSidLegend,

--- 24 unchanged lines hidden (view full) ---

1121 length = (uint32_t)(strlen(pString) + 1);
1122#ifdef EMLXS_LITTLE_ENDIAN
1123 byte = (uint8_t)(length & 0x0000FF);
1124 emlxs_fputc(byte, fpDmpFile);
1125 byte = (uint8_t)((length & 0x00FF00) >> 8);
1126 emlxs_fputc(byte, fpDmpFile);
1127 byte = (uint8_t)((length & 0xFF0000) >> 16);
1128 emlxs_fputc(byte, fpDmpFile);
1135#else
1129#endif /* EMLXS_LITTLE_ENDIAN */
1130
1131#ifdef EMLXS_BIG_ENDIAN
1136 byte = (uint8_t)((length & 0xFF0000) >> 16);
1137 emlxs_fputc(byte, fpDmpFile);
1138 byte = (uint8_t)((length & 0x00FF00) >> 8);
1139 emlxs_fputc(byte, fpDmpFile);
1140 byte = (uint8_t)(length & 0x0000FF);
1141 emlxs_fputc(byte, fpDmpFile);
1132 byte = (uint8_t)((length & 0xFF0000) >> 16);
1133 emlxs_fputc(byte, fpDmpFile);
1134 byte = (uint8_t)((length & 0x00FF00) >> 8);
1135 emlxs_fputc(byte, fpDmpFile);
1136 byte = (uint8_t)(length & 0x0000FF);
1137 emlxs_fputc(byte, fpDmpFile);
1142#endif /* EMLXS_LITTLE_ENDIAN */
1138#endif /* EMLXS_BIG_ENDIAN */
1143
1144 /* Write Argument String to the DMP File, including a Null Byte */
1145 (void) emlxs_fwrite((uint8_t *)pString, strlen(pString), 1, fpDmpFile);
1146 emlxs_fputc(0, fpDmpFile);
1147
1148 emlxs_fflush(fpDmpFile);
1149
1150#if CC_DUMP_ENABLE_PAD

--- 15 unchanged lines hidden (view full) ---

1166 emlxs_fputc(0, fpDmpFile);
1167 break;
1168 }
1169 emlxs_fflush(fpDmpFile);
1170#endif
1171
1172 return (0);
1173
1139
1140 /* Write Argument String to the DMP File, including a Null Byte */
1141 (void) emlxs_fwrite((uint8_t *)pString, strlen(pString), 1, fpDmpFile);
1142 emlxs_fputc(0, fpDmpFile);
1143
1144 emlxs_fflush(fpDmpFile);
1145
1146#if CC_DUMP_ENABLE_PAD

--- 15 unchanged lines hidden (view full) ---

1162 emlxs_fputc(0, fpDmpFile);
1163 break;
1164 }
1165 emlxs_fflush(fpDmpFile);
1166#endif
1167
1168 return (0);
1169
1174} /* emlxs_dump_string_dmpfile() */
1170} /* emlxs_dump_string_dmpfile() */
1175
1176
1177/* ************************************************************************** */
1178/* emlxs_dump_word_dmpfile */
1179/* If little endian, just write the buffer normally. */
1180/* However, if Big Endian... Consider the following: */
1181/* Automatic Dump, initiated by driver, Port Offline (FW WarmStart Mode), */
1182/* Mailbox in SLIM. */
1183/* On-Demand Dump, initiated by utility, Port Online (FW Normal Mode), */
1184/* Mailbox in Host Memory. */
1185/* We use the same IOCTL to get the DUMP Data, for both cases. */
1186/* However, it normalizes the data before delivering it to us. */
1187/* In the Dump File, we must always write the data in native mode. */
1188/* So, if Big Endian, On-demand Dump, we must swap the words. */
1189/* ************************************************************************* */
1190/*ARGSUSED*/
1171
1172
1173/* ************************************************************************** */
1174/* emlxs_dump_word_dmpfile */
1175/* If little endian, just write the buffer normally. */
1176/* However, if Big Endian... Consider the following: */
1177/* Automatic Dump, initiated by driver, Port Offline (FW WarmStart Mode), */
1178/* Mailbox in SLIM. */
1179/* On-Demand Dump, initiated by utility, Port Online (FW Normal Mode), */
1180/* Mailbox in Host Memory. */
1181/* We use the same IOCTL to get the DUMP Data, for both cases. */
1182/* However, it normalizes the data before delivering it to us. */
1183/* In the Dump File, we must always write the data in native mode. */
1184/* So, if Big Endian, On-demand Dump, we must swap the words. */
1185/* ************************************************************************* */
1186/*ARGSUSED*/
1191static uint32_t
1187extern uint32_t
1192emlxs_dump_word_dmpfile(
1193 emlxs_file_t *fpDmpFile,
1194 uint8_t *pBuffer,
1195 uint32_t bufferLen,
1196 int fSwap)
1197{
1198 uint32_t i;
1199 uint32_t *wptr;
1200
1201 if (!fpDmpFile) {
1202 return (1);
1203 }
1204
1205 wptr = (uint32_t *)pBuffer;
1206 for (i = 0; i < bufferLen / 4; i++, wptr++) {
1188emlxs_dump_word_dmpfile(
1189 emlxs_file_t *fpDmpFile,
1190 uint8_t *pBuffer,
1191 uint32_t bufferLen,
1192 int fSwap)
1193{
1194 uint32_t i;
1195 uint32_t *wptr;
1196
1197 if (!fpDmpFile) {
1198 return (1);
1199 }
1200
1201 wptr = (uint32_t *)pBuffer;
1202 for (i = 0; i < bufferLen / 4; i++, wptr++) {
1207#ifdef EMLXS_BIG_ENDIAN
1208 if (fSwap) {
1209 uint32_t w1;
1210 w1 = *wptr;
1203 if (fSwap) {
1204 uint32_t w1;
1205 w1 = *wptr;
1211 *wptr = SWAP_LONG(w1);
1206 *wptr = BE_SWAP32(w1);
1212 }
1207 }
1213#endif /* EMLXS_BIG_ENDIAN */
1214
1215 (void) emlxs_fwrite((uint8_t *)wptr, 4, 1, fpDmpFile);
1216 }
1217
1218 emlxs_fflush(fpDmpFile);
1219
1220 return (0);
1221
1208
1209 (void) emlxs_fwrite((uint8_t *)wptr, 4, 1, fpDmpFile);
1210 }
1211
1212 emlxs_fflush(fpDmpFile);
1213
1214 return (0);
1215
1222} /* emlxs_dump_word_dmpfile() */
1216} /* emlxs_dump_word_dmpfile() */
1223
1224
1225static uint32_t
1226emlxs_dump_port_block(
1227 emlxs_file_t *fpDmpFile,
1228 uint8_t *pBuffer,
1229 uint32_t bufferLen,
1230 DUMP_TABLE_ENTRY entry,

--- 6 unchanged lines hidden (view full) ---

1237 if (!fpDmpFile) {
1238 return (1);
1239 }
1240
1241 /* Write Argument SID to the DMP File */
1242 b = (uint8_t)entry.un.PortBlock.un.s.sid;
1243 emlxs_fputc(b, fpDmpFile);
1244
1217
1218
1219static uint32_t
1220emlxs_dump_port_block(
1221 emlxs_file_t *fpDmpFile,
1222 uint8_t *pBuffer,
1223 uint32_t bufferLen,
1224 DUMP_TABLE_ENTRY entry,

--- 6 unchanged lines hidden (view full) ---

1231 if (!fpDmpFile) {
1232 return (1);
1233 }
1234
1235 /* Write Argument SID to the DMP File */
1236 b = (uint8_t)entry.un.PortBlock.un.s.sid;
1237 emlxs_fputc(b, fpDmpFile);
1238
1245 w = entry.un.PortBlock.un.s.bc;
1246#ifdef EMLXS_LITTLE_ENDIAN
1247 /* Write Buffer Length to the DMP File */
1239#ifdef EMLXS_LITTLE_ENDIAN
1240 /* Write Buffer Length to the DMP File */
1241 w = entry.un.PortBlock.un.s.bc;
1248 b = (uint8_t)(w & 0x000000FF);
1249 emlxs_fputc(b, fpDmpFile);
1250 b = (uint8_t)((w & 0x0000FF00) >> 8);
1251 emlxs_fputc(b, fpDmpFile);
1252 b = (uint8_t)((w & 0x00FF0000) >> 16);
1253 emlxs_fputc(b, fpDmpFile);
1242 b = (uint8_t)(w & 0x000000FF);
1243 emlxs_fputc(b, fpDmpFile);
1244 b = (uint8_t)((w & 0x0000FF00) >> 8);
1245 emlxs_fputc(b, fpDmpFile);
1246 b = (uint8_t)((w & 0x00FF0000) >> 16);
1247 emlxs_fputc(b, fpDmpFile);
1254#else
1255 b = (uint8_t)((w & 0x00FF0000) >> 16);
1256 emlxs_fputc(b, fpDmpFile);
1257 b = (uint8_t)((w & 0x0000FF00) >> 8);
1258 emlxs_fputc(b, fpDmpFile);
1259 b = (uint8_t)(w & 0x000000FF);
1260 emlxs_fputc(b, fpDmpFile);
1261#endif /* EMLXS_LITTLE_ENDIAN */
1262
1263 /* Write address to the DMP File */
1264 w = entry.un.PortBlock.un.s.addr;
1248
1249 /* Write address to the DMP File */
1250 w = entry.un.PortBlock.un.s.addr;
1265#ifdef EMLXS_LITTLE_ENDIAN
1266 b = (uint8_t)(w & 0x000000FF);
1267 emlxs_fputc(b, fpDmpFile);
1268 b = (uint8_t)((w & 0x0000FF00) >> 8);
1269 emlxs_fputc(b, fpDmpFile);
1270 b = (uint8_t)((w & 0x00FF0000) >> 16);
1271 emlxs_fputc(b, fpDmpFile);
1272 b = (uint8_t)((w & 0xFF000000) >> 24);
1273 emlxs_fputc(b, fpDmpFile);
1251 b = (uint8_t)(w & 0x000000FF);
1252 emlxs_fputc(b, fpDmpFile);
1253 b = (uint8_t)((w & 0x0000FF00) >> 8);
1254 emlxs_fputc(b, fpDmpFile);
1255 b = (uint8_t)((w & 0x00FF0000) >> 16);
1256 emlxs_fputc(b, fpDmpFile);
1257 b = (uint8_t)((w & 0xFF000000) >> 24);
1258 emlxs_fputc(b, fpDmpFile);
1274#else
1259#endif /* EMLXS_LITTLE_ENDIAN */
1260
1261#ifdef EMLXS_BIG_ENDIAN
1262 /* Write Buffer Length to the DMP File */
1263 w = entry.un.PortBlock.un.s.bc;
1264 b = (uint8_t)((w & 0x00FF0000) >> 16);
1265 emlxs_fputc(b, fpDmpFile);
1266 b = (uint8_t)((w & 0x0000FF00) >> 8);
1267 emlxs_fputc(b, fpDmpFile);
1268 b = (uint8_t)(w & 0x000000FF);
1269 emlxs_fputc(b, fpDmpFile);
1270
1271 /* Write address to the DMP File */
1272 w = entry.un.PortBlock.un.s.addr;
1275 b = (uint8_t)((w & 0xFF000000) >> 24);
1276 emlxs_fputc(b, fpDmpFile);
1277 b = (uint8_t)((w & 0x00FF0000) >> 16);
1278 emlxs_fputc(b, fpDmpFile);
1279 b = (uint8_t)((w & 0x0000FF00) >> 8);
1280 emlxs_fputc(b, fpDmpFile);
1281 b = (uint8_t)(w & 0x000000FF);
1282 emlxs_fputc(b, fpDmpFile);
1273 b = (uint8_t)((w & 0xFF000000) >> 24);
1274 emlxs_fputc(b, fpDmpFile);
1275 b = (uint8_t)((w & 0x00FF0000) >> 16);
1276 emlxs_fputc(b, fpDmpFile);
1277 b = (uint8_t)((w & 0x0000FF00) >> 8);
1278 emlxs_fputc(b, fpDmpFile);
1279 b = (uint8_t)(w & 0x000000FF);
1280 emlxs_fputc(b, fpDmpFile);
1283#endif /* EMLXS_LITTLE_ENDIAN */
1281#endif /* EMLXS_BIG_ENDIAN */
1284
1285 status =
1286 emlxs_dump_word_dmpfile(fpDmpFile, pBuffer, bufferLen, fSwap);
1287
1288 emlxs_fflush(fpDmpFile);
1289
1290 return (status);
1291
1282
1283 status =
1284 emlxs_dump_word_dmpfile(fpDmpFile, pBuffer, bufferLen, fSwap);
1285
1286 emlxs_fflush(fpDmpFile);
1287
1288 return (status);
1289
1292} /* emlxs_dump_port_block() */
1290} /* emlxs_dump_port_block() */
1293
1294
1295static uint32_t
1296emlxs_dump_port_struct(
1297 emlxs_file_t *fpDmpFile,
1298 uint8_t *pBuffer,
1299 uint32_t bufferLen,
1300 DUMP_TABLE_ENTRY entry,

--- 10 unchanged lines hidden (view full) ---

1311 /* Write Argument SID to the DMP File */
1312 b = (uint8_t)entry.un.PortStruct.un.s.sid;
1313 emlxs_fputc(b, fpDmpFile);
1314
1315 /* Write Element Length to the DMP File */
1316 b = (uint8_t)entry.un.PortStruct.un.s.length;
1317 emlxs_fputc(b, fpDmpFile);
1318
1291
1292
1293static uint32_t
1294emlxs_dump_port_struct(
1295 emlxs_file_t *fpDmpFile,
1296 uint8_t *pBuffer,
1297 uint32_t bufferLen,
1298 DUMP_TABLE_ENTRY entry,

--- 10 unchanged lines hidden (view full) ---

1309 /* Write Argument SID to the DMP File */
1310 b = (uint8_t)entry.un.PortStruct.un.s.sid;
1311 emlxs_fputc(b, fpDmpFile);
1312
1313 /* Write Element Length to the DMP File */
1314 b = (uint8_t)entry.un.PortStruct.un.s.length;
1315 emlxs_fputc(b, fpDmpFile);
1316
1317#ifdef EMLXS_LITTLE_ENDIAN
1319 /* Write Element Count to the DMP File */
1320 w = entry.un.PortStruct.un.s.count;
1318 /* Write Element Count to the DMP File */
1319 w = entry.un.PortStruct.un.s.count;
1321#ifdef EMLXS_LITTLE_ENDIAN
1322 b = (uint8_t)(w & 0x000000FF);
1323 emlxs_fputc(b, fpDmpFile);
1324 b = (uint8_t)((w & 0x0000FF00) >> 8);
1325 emlxs_fputc(b, fpDmpFile);
1320 b = (uint8_t)(w & 0x000000FF);
1321 emlxs_fputc(b, fpDmpFile);
1322 b = (uint8_t)((w & 0x0000FF00) >> 8);
1323 emlxs_fputc(b, fpDmpFile);
1326#else
1327 b = (uint8_t)((w & 0x0000FF00) >> 8);
1328 emlxs_fputc(b, fpDmpFile);
1329 b = (uint8_t)(w & 0x000000FF);
1330 emlxs_fputc(b, fpDmpFile);
1331#endif /* EMLXS_LITTLE_ENDIAN */
1332
1333 /* Write Address to the DMP File */
1334 w = entry.un.PortStruct.un.s.addr;
1324
1325 /* Write Address to the DMP File */
1326 w = entry.un.PortStruct.un.s.addr;
1335#ifdef EMLXS_LITTLE_ENDIAN
1336 b = (uint8_t)(w & 0x000000FF);
1337 emlxs_fputc(b, fpDmpFile);
1338 b = (uint8_t)((w & 0x0000FF00) >> 8);
1339 emlxs_fputc(b, fpDmpFile);
1340 b = (uint8_t)((w & 0x00FF0000) >> 16);
1341 emlxs_fputc(b, fpDmpFile);
1342 b = (uint8_t)((w & 0xFF000000) >> 24);
1343 emlxs_fputc(b, fpDmpFile);
1327 b = (uint8_t)(w & 0x000000FF);
1328 emlxs_fputc(b, fpDmpFile);
1329 b = (uint8_t)((w & 0x0000FF00) >> 8);
1330 emlxs_fputc(b, fpDmpFile);
1331 b = (uint8_t)((w & 0x00FF0000) >> 16);
1332 emlxs_fputc(b, fpDmpFile);
1333 b = (uint8_t)((w & 0xFF000000) >> 24);
1334 emlxs_fputc(b, fpDmpFile);
1344#else
1335#endif /* EMLXS_LITTLE_ENDIAN */
1336
1337#ifdef EMLXS_BIG_ENDIAN
1338 /* Write Element Count to the DMP File */
1339 w = entry.un.PortStruct.un.s.count;
1340 b = (uint8_t)((w & 0x0000FF00) >> 8);
1341 emlxs_fputc(b, fpDmpFile);
1342 b = (uint8_t)(w & 0x000000FF);
1343 emlxs_fputc(b, fpDmpFile);
1344
1345 /* Write Address to the DMP File */
1346 w = entry.un.PortStruct.un.s.addr;
1345 b = (uint8_t)((w & 0xFF000000) >> 24);
1346 emlxs_fputc(b, fpDmpFile);
1347 b = (uint8_t)((w & 0x00FF0000) >> 16);
1348 emlxs_fputc(b, fpDmpFile);
1349 b = (uint8_t)((w & 0x0000FF00) >> 8);
1350 emlxs_fputc(b, fpDmpFile);
1351 b = (uint8_t)(w & 0x000000FF);
1352 emlxs_fputc(b, fpDmpFile);
1347 b = (uint8_t)((w & 0xFF000000) >> 24);
1348 emlxs_fputc(b, fpDmpFile);
1349 b = (uint8_t)((w & 0x00FF0000) >> 16);
1350 emlxs_fputc(b, fpDmpFile);
1351 b = (uint8_t)((w & 0x0000FF00) >> 8);
1352 emlxs_fputc(b, fpDmpFile);
1353 b = (uint8_t)(w & 0x000000FF);
1354 emlxs_fputc(b, fpDmpFile);
1353#endif /* EMLXS_LITTLE_ENDIAN */
1355#endif /* EMLXS_BIG_ENDIAN */
1354
1355 status =
1356 emlxs_dump_word_dmpfile(fpDmpFile, pBuffer, bufferLen, fSwap);
1357
1358 emlxs_fflush(fpDmpFile);
1359
1360 return (status);
1361
1356
1357 status =
1358 emlxs_dump_word_dmpfile(fpDmpFile, pBuffer, bufferLen, fSwap);
1359
1360 emlxs_fflush(fpDmpFile);
1361
1362 return (status);
1363
1362} /* emlxs_dump_port_struct() */
1364} /* emlxs_dump_port_struct() */
1363
1364
1365static uint32_t
1366emlxs_dump_host_block(
1367 emlxs_file_t *fpDmpFile,
1368 uint8_t *pBuffer,
1369 uint32_t bufferLen,
1370 uint8_t sid,

--- 26 unchanged lines hidden (view full) ---

1397 length = bufferLen;
1398#ifdef EMLXS_LITTLE_ENDIAN
1399 byte = (uint8_t)(length & 0x0000FF);
1400 emlxs_fputc(byte, fpDmpFile);
1401 byte = (uint8_t)((length & 0x00FF00) >> 8);
1402 emlxs_fputc(byte, fpDmpFile);
1403 byte = (uint8_t)((length & 0xFF0000) >> 16);
1404 emlxs_fputc(byte, fpDmpFile);
1365
1366
1367static uint32_t
1368emlxs_dump_host_block(
1369 emlxs_file_t *fpDmpFile,
1370 uint8_t *pBuffer,
1371 uint32_t bufferLen,
1372 uint8_t sid,

--- 26 unchanged lines hidden (view full) ---

1399 length = bufferLen;
1400#ifdef EMLXS_LITTLE_ENDIAN
1401 byte = (uint8_t)(length & 0x0000FF);
1402 emlxs_fputc(byte, fpDmpFile);
1403 byte = (uint8_t)((length & 0x00FF00) >> 8);
1404 emlxs_fputc(byte, fpDmpFile);
1405 byte = (uint8_t)((length & 0xFF0000) >> 16);
1406 emlxs_fputc(byte, fpDmpFile);
1405#else
1407#endif /* EMLXS_LITTLE_ENDIAN */
1408
1409#ifdef EMLXS_BIG_ENDIAN
1406 byte = (uint8_t)((length & 0xFF0000) >> 16);
1407 emlxs_fputc(byte, fpDmpFile);
1408 byte = (uint8_t)((length & 0x00FF00) >> 8);
1409 emlxs_fputc(byte, fpDmpFile);
1410 byte = (uint8_t)(length & 0x0000FF);
1411 emlxs_fputc(byte, fpDmpFile);
1410 byte = (uint8_t)((length & 0xFF0000) >> 16);
1411 emlxs_fputc(byte, fpDmpFile);
1412 byte = (uint8_t)((length & 0x00FF00) >> 8);
1413 emlxs_fputc(byte, fpDmpFile);
1414 byte = (uint8_t)(length & 0x0000FF);
1415 emlxs_fputc(byte, fpDmpFile);
1412#endif /* EMLXS_LITTLE_ENDIAN */
1416#endif /* EMLXS_BIG_ENDIAN */
1413
1414 status =
1415 emlxs_dump_word_dmpfile(fpDmpFile, pBuffer, bufferLen, fSwap);
1416
1417 emlxs_fflush(fpDmpFile);
1418
1419 return (status);
1420
1417
1418 status =
1419 emlxs_dump_word_dmpfile(fpDmpFile, pBuffer, bufferLen, fSwap);
1420
1421 emlxs_fflush(fpDmpFile);
1422
1423 return (status);
1424
1421} /* emlxs_dump_host_block() */
1425} /* emlxs_dump_host_block() */
1422
1423
1424static uint32_t
1425emlxs_dump_host_struct(
1426 emlxs_file_t *fpDmpFile,
1427 uint8_t *pBuffer,
1428 uint32_t bufferLen,
1429 uint32_t elementLength,

--- 30 unchanged lines hidden (view full) ---

1460
1461 /* Write Element Count to the DMP File */
1462 w = elementCount;
1463#ifdef EMLXS_LITTLE_ENDIAN
1464 b = (uint8_t)(w & 0x000000FF);
1465 emlxs_fputc(b, fpDmpFile);
1466 b = (uint8_t)((w & 0x0000FF00) >> 8);
1467 emlxs_fputc(b, fpDmpFile);
1426
1427
1428static uint32_t
1429emlxs_dump_host_struct(
1430 emlxs_file_t *fpDmpFile,
1431 uint8_t *pBuffer,
1432 uint32_t bufferLen,
1433 uint32_t elementLength,

--- 30 unchanged lines hidden (view full) ---

1464
1465 /* Write Element Count to the DMP File */
1466 w = elementCount;
1467#ifdef EMLXS_LITTLE_ENDIAN
1468 b = (uint8_t)(w & 0x000000FF);
1469 emlxs_fputc(b, fpDmpFile);
1470 b = (uint8_t)((w & 0x0000FF00) >> 8);
1471 emlxs_fputc(b, fpDmpFile);
1468#else
1472#endif /* EMLXS_LITTLE_ENDIAN */
1473
1474#ifdef EMLXS_BIG_ENDIAN
1469 b = (uint8_t)((w & 0x0000FF00) >> 8);
1470 emlxs_fputc(b, fpDmpFile);
1471 b = (uint8_t)(w & 0x000000FF);
1472 emlxs_fputc(b, fpDmpFile);
1475 b = (uint8_t)((w & 0x0000FF00) >> 8);
1476 emlxs_fputc(b, fpDmpFile);
1477 b = (uint8_t)(w & 0x000000FF);
1478 emlxs_fputc(b, fpDmpFile);
1473#endif /* EMLXS_LITTLE_ENDIAN */
1479#endif /* EMLXS_BIG_ENDIAN */
1474
1475 status =
1476 emlxs_dump_word_dmpfile(fpDmpFile, pBuffer, bufferLen, fSwap);
1477
1478 emlxs_fflush(fpDmpFile);
1479
1480 return (status);
1481
1480
1481 status =
1482 emlxs_dump_word_dmpfile(fpDmpFile, pBuffer, bufferLen, fSwap);
1483
1484 emlxs_fflush(fpDmpFile);
1485
1486 return (status);
1487
1482} /* emlxs_dump_host_struct() */
1488} /* emlxs_dump_host_struct() */
1483
1484
1485/* ************************************************************************* */
1486/* ************************************************************************* */
1487/* Dump Generators, Mid-Level */
1488/* ************************************************************************* */
1489/* ************************************************************************* */
1490
1491static uint32_t
1492emlxs_dump_parm_table(
1493 emlxs_hba_t *hba,
1494 emlxs_file_t *fpTxtFile,
1495 emlxs_file_t *fpDmpFile)
1496{
1489
1490
1491/* ************************************************************************* */
1492/* ************************************************************************* */
1493/* Dump Generators, Mid-Level */
1494/* ************************************************************************* */
1495/* ************************************************************************* */
1496
1497static uint32_t
1498emlxs_dump_parm_table(
1499 emlxs_hba_t *hba,
1500 emlxs_file_t *fpTxtFile,
1501 emlxs_file_t *fpDmpFile)
1502{
1497 emlxs_port_t *port = &PPORT;
1498 emlxs_config_t *cfg = &CFG;
1499 uint32_t status;
1500 uint32_t i;
1501
1502 /* vars used to build the Dump String */
1503 char *buf1;
1504 char *buf2;
1505
1506 buf1 = (char *)kmem_zalloc(8192, KM_SLEEP);
1503 emlxs_config_t *cfg = &CFG;
1504 uint32_t status;
1505 uint32_t i;
1506
1507 /* vars used to build the Dump String */
1508 char *buf1;
1509 char *buf2;
1510
1511 buf1 = (char *)kmem_zalloc(8192, KM_SLEEP);
1507 if (buf1 == 0) {
1508 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
1509 "emlxs_dump_parm_table: Unable to allocate buf1.");
1510
1511 return (1);
1512 }
1513
1514 buf2 = (char *)kmem_zalloc(8192, KM_SLEEP);
1512 buf2 = (char *)kmem_zalloc(8192, KM_SLEEP);
1515 if (buf1 == 0) {
1516 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
1517 "emlxs_dump_parm_table: Unable to allocate buf2.");
1518
1513
1519 kmem_free(buf1, 8192);
1520 return (1);
1521 }
1522
1523 /* Driver Parameters Heading */
1524 (void) sprintf(buf1,
1525 "IDX string Low "\
1526 "High Def Cur Exp Dyn");
1527
1528 /* Build the buffer containing all the Driver Params */
1529 for (i = 0; i < NUM_CFG_PARAM; i++) {
1530 (void) sprintf(buf2,

--- 13 unchanged lines hidden (view full) ---

1544 emlxs_dump_string_dmpfile(fpDmpFile, buf1, SID_DP_TABLE,
1545 LEGEND_DP_TABLE, LEGEND_NULL);
1546
1547 kmem_free(buf1, 8192);
1548 kmem_free(buf2, 8192);
1549
1550 return (status);
1551
1514 /* Driver Parameters Heading */
1515 (void) sprintf(buf1,
1516 "IDX string Low "\
1517 "High Def Cur Exp Dyn");
1518
1519 /* Build the buffer containing all the Driver Params */
1520 for (i = 0; i < NUM_CFG_PARAM; i++) {
1521 (void) sprintf(buf2,

--- 13 unchanged lines hidden (view full) ---

1535 emlxs_dump_string_dmpfile(fpDmpFile, buf1, SID_DP_TABLE,
1536 LEGEND_DP_TABLE, LEGEND_NULL);
1537
1538 kmem_free(buf1, 8192);
1539 kmem_free(buf2, 8192);
1540
1541 return (status);
1542
1552} /* emlxs_dump_parm_table() */
1543} /* emlxs_dump_parm_table() */
1553
1554
1555static uint32_t
1556emlxs_dump_model(
1557 emlxs_hba_t *hba,
1558 emlxs_file_t *fpTxtFile,
1559 emlxs_file_t *fpDmpFile)
1560{

--- 19 unchanged lines hidden (view full) ---

1580 LEGEND_HBA_MODEL, 0);
1581
1582 status =
1583 emlxs_dump_string_dmpfile(fpDmpFile, buf1, SID_HBA_INFO,
1584 LEGEND_HBA_INFO, LEGEND_HBA_MODEL);
1585
1586 return (status);
1587
1544
1545
1546static uint32_t
1547emlxs_dump_model(
1548 emlxs_hba_t *hba,
1549 emlxs_file_t *fpTxtFile,
1550 emlxs_file_t *fpDmpFile)
1551{

--- 19 unchanged lines hidden (view full) ---

1571 LEGEND_HBA_MODEL, 0);
1572
1573 status =
1574 emlxs_dump_string_dmpfile(fpDmpFile, buf1, SID_HBA_INFO,
1575 LEGEND_HBA_INFO, LEGEND_HBA_MODEL);
1576
1577 return (status);
1578
1588} /* emlxs_dump_model() */
1579} /* emlxs_dump_model() */
1589
1590
1591static uint32_t
1592emlxs_dump_wwn(
1593 emlxs_hba_t *hba,
1594 emlxs_file_t *fpTxtFile,
1595 emlxs_file_t *fpDmpFile)
1596{

--- 30 unchanged lines hidden (view full) ---

1627 LEGEND_HBA_WWN, 0);
1628
1629 status =
1630 emlxs_dump_string_dmpfile(fpDmpFile, buf1, SID_HBA_INFO,
1631 LEGEND_HBA_INFO, LEGEND_HBA_WWN);
1632
1633 return (status);
1634
1580
1581
1582static uint32_t
1583emlxs_dump_wwn(
1584 emlxs_hba_t *hba,
1585 emlxs_file_t *fpTxtFile,
1586 emlxs_file_t *fpDmpFile)
1587{

--- 30 unchanged lines hidden (view full) ---

1618 LEGEND_HBA_WWN, 0);
1619
1620 status =
1621 emlxs_dump_string_dmpfile(fpDmpFile, buf1, SID_HBA_INFO,
1622 LEGEND_HBA_INFO, LEGEND_HBA_WWN);
1623
1624 return (status);
1625
1635} /* emlxs_dump_wwn() */
1626} /* emlxs_dump_wwn() */
1636
1637
1638static uint32_t
1639emlxs_dump_serial_number(
1640 emlxs_hba_t *hba,
1641 emlxs_file_t *fpTxtFile,
1642 emlxs_file_t *fpDmpFile)
1643{

--- 15 unchanged lines hidden (view full) ---

1659 LEGEND_HBA_SN, 0);
1660
1661 status =
1662 emlxs_dump_string_dmpfile(fpDmpFile, buf1, SID_HBA_INFO,
1663 LEGEND_HBA_INFO, LEGEND_HBA_SN);
1664
1665 return (status);
1666
1627
1628
1629static uint32_t
1630emlxs_dump_serial_number(
1631 emlxs_hba_t *hba,
1632 emlxs_file_t *fpTxtFile,
1633 emlxs_file_t *fpDmpFile)
1634{

--- 15 unchanged lines hidden (view full) ---

1650 LEGEND_HBA_SN, 0);
1651
1652 status =
1653 emlxs_dump_string_dmpfile(fpDmpFile, buf1, SID_HBA_INFO,
1654 LEGEND_HBA_INFO, LEGEND_HBA_SN);
1655
1656 return (status);
1657
1667} /* emlxs_dump_serial_number() */
1658} /* emlxs_dump_serial_number() */
1668
1669
1670static uint32_t
1671emlxs_dump_fw_version(
1672 emlxs_hba_t *hba,
1673 emlxs_file_t *fpTxtFile,
1674 emlxs_file_t *fpDmpFile)
1675{
1659
1660
1661static uint32_t
1662emlxs_dump_fw_version(
1663 emlxs_hba_t *hba,
1664 emlxs_file_t *fpTxtFile,
1665 emlxs_file_t *fpDmpFile)
1666{
1676 emlxs_port_t *port = &PPORT;
1677 emlxs_vpd_t *vpd = &VPD;
1678 uint32_t status;
1679
1680 char *buf1;
1681 char *buf2;
1682 uint32_t buf1_size;
1683 uint32_t buf2_size;
1684
1685 buf1_size = 1024;
1686 buf2_size = 1024;
1687
1688 buf1 = (char *)kmem_zalloc(buf1_size, KM_SLEEP);
1667 emlxs_vpd_t *vpd = &VPD;
1668 uint32_t status;
1669
1670 char *buf1;
1671 char *buf2;
1672 uint32_t buf1_size;
1673 uint32_t buf2_size;
1674
1675 buf1_size = 1024;
1676 buf2_size = 1024;
1677
1678 buf1 = (char *)kmem_zalloc(buf1_size, KM_SLEEP);
1689 if (buf1 == 0) {
1690 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
1691 "emlxs_dump_fw_version: Unable to allocate buf1.");
1692
1693 return (1);
1694 }
1695
1696 buf2 = (char *)kmem_zalloc(buf2_size, KM_SLEEP);
1679 buf2 = (char *)kmem_zalloc(buf2_size, KM_SLEEP);
1697 if (buf2 == 0) {
1698 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
1699 "emlxs_dump_fw_version: Unable to allocate buf2.");
1700
1680
1701 kmem_free(buf1, buf1_size);
1702 return (1);
1703 }
1704
1705 /* Write the Firmware Version into the buffer */
1706 (void) sprintf(buf2, "%s", vpd->fw_version);
1707 (void) strcpy(buf1, LEGEND_HBA_FW_VERSION);
1708 (void) strcat(buf1, ": ");
1709 (void) strcat(buf1, buf2);
1710
1711 /* Write the Operational FW Version into the buffer */
1712 (void) sprintf(buf2, "%s", vpd->opFwName);

--- 38 unchanged lines hidden (view full) ---

1751 emlxs_dump_string_dmpfile(fpDmpFile, buf1, SID_HBA_INFO,
1752 LEGEND_HBA_INFO, LEGEND_HBA_FW_VERSION);
1753
1754 kmem_free(buf1, buf1_size);
1755 kmem_free(buf2, buf2_size);
1756
1757 return (status);
1758
1681 /* Write the Firmware Version into the buffer */
1682 (void) sprintf(buf2, "%s", vpd->fw_version);
1683 (void) strcpy(buf1, LEGEND_HBA_FW_VERSION);
1684 (void) strcat(buf1, ": ");
1685 (void) strcat(buf1, buf2);
1686
1687 /* Write the Operational FW Version into the buffer */
1688 (void) sprintf(buf2, "%s", vpd->opFwName);

--- 38 unchanged lines hidden (view full) ---

1727 emlxs_dump_string_dmpfile(fpDmpFile, buf1, SID_HBA_INFO,
1728 LEGEND_HBA_INFO, LEGEND_HBA_FW_VERSION);
1729
1730 kmem_free(buf1, buf1_size);
1731 kmem_free(buf2, buf2_size);
1732
1733 return (status);
1734
1759} /* emlxs_dump_fw_version() */
1735} /* emlxs_dump_fw_version() */
1760
1761
1762static uint32_t
1763emlxs_dump_boot_version(
1764 emlxs_hba_t *hba,
1765 emlxs_file_t *fpTxtFile,
1766 emlxs_file_t *fpDmpFile)
1767{
1736
1737
1738static uint32_t
1739emlxs_dump_boot_version(
1740 emlxs_hba_t *hba,
1741 emlxs_file_t *fpTxtFile,
1742 emlxs_file_t *fpDmpFile)
1743{
1768 emlxs_port_t *port = &PPORT;
1769 emlxs_vpd_t *vpd = &VPD;
1770 uint32_t status;
1771 uint32_t state;
1772
1773 char *buf1;
1774 char *buf2;
1775 uint32_t buf1_size;
1776 uint32_t buf2_size;
1777
1778 buf1_size = 1024;
1779 buf2_size = 1024;
1780
1781 buf1 = (char *)kmem_zalloc(buf1_size, KM_SLEEP);
1744 emlxs_vpd_t *vpd = &VPD;
1745 uint32_t status;
1746 uint32_t state;
1747
1748 char *buf1;
1749 char *buf2;
1750 uint32_t buf1_size;
1751 uint32_t buf2_size;
1752
1753 buf1_size = 1024;
1754 buf2_size = 1024;
1755
1756 buf1 = (char *)kmem_zalloc(buf1_size, KM_SLEEP);
1782 if (buf1 == 0) {
1783 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
1784 "emlxs_dump_boot_version: Unable to allocate buf1.");
1785
1786 return (1);
1787 }
1788
1789 buf2 = (char *)kmem_zalloc(buf2_size, KM_SLEEP);
1757 buf2 = (char *)kmem_zalloc(buf2_size, KM_SLEEP);
1790 if (buf2 == 0) {
1791 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
1792 "emlxs_dump_boot_version: Unable to allocate buf2.");
1793
1758
1794 kmem_free(buf1, buf1_size);
1795 return (1);
1796 }
1797
1798#ifdef EMLXS_SPARC
1799 if (strcmp(vpd->fcode_version, "none") == 0)
1800#else
1801 if (strcmp(vpd->boot_version, "none") == 0)
1802#endif /* EMLXS_SPARC */
1803 {
1804 state = 2; /* BOOT_BIOS_NOT_PRESENT */
1805 } else {

--- 30 unchanged lines hidden (view full) ---

1836 emlxs_dump_string_dmpfile(fpDmpFile, buf1, SID_HBA_INFO,
1837 LEGEND_HBA_INFO, LEGEND_HBA_BB_VERSION);
1838
1839 kmem_free(buf1, buf1_size);
1840 kmem_free(buf2, buf2_size);
1841
1842 return (status);
1843
1759#ifdef EMLXS_SPARC
1760 if (strcmp(vpd->fcode_version, "none") == 0)
1761#else
1762 if (strcmp(vpd->boot_version, "none") == 0)
1763#endif /* EMLXS_SPARC */
1764 {
1765 state = 2; /* BOOT_BIOS_NOT_PRESENT */
1766 } else {

--- 30 unchanged lines hidden (view full) ---

1797 emlxs_dump_string_dmpfile(fpDmpFile, buf1, SID_HBA_INFO,
1798 LEGEND_HBA_INFO, LEGEND_HBA_BB_VERSION);
1799
1800 kmem_free(buf1, buf1_size);
1801 kmem_free(buf2, buf2_size);
1802
1803 return (status);
1804
1844} /* emlxs_dump_boot_version() */
1805} /* emlxs_dump_boot_version() */
1845
1846
1847/* ARGSUSED */
1848static uint32_t
1849emlxs_dump_cfg_region4_decoded(
1850 emlxs_hba_t *hba,
1851 emlxs_file_t *fpTxtFile,
1852 char *pLidLegend,
1853 DUMP_WAKE_UP_PARAMS *pBuffer,
1854 uint32_t ByteCount)
1855{
1806
1807
1808/* ARGSUSED */
1809static uint32_t
1810emlxs_dump_cfg_region4_decoded(
1811 emlxs_hba_t *hba,
1812 emlxs_file_t *fpTxtFile,
1813 char *pLidLegend,
1814 DUMP_WAKE_UP_PARAMS *pBuffer,
1815 uint32_t ByteCount)
1816{
1856 emlxs_port_t *port = &PPORT;
1857 uint32_t status;
1858 char *buf1; /* text buffer */
1859 char *buf2; /* text buffer */
1860 uint32_t buf1_size;
1861 uint32_t buf2_size;
1862
1863 buf1_size = 1024;
1864 buf2_size = 1024;
1865
1866 buf1 = (char *)kmem_zalloc(buf1_size, KM_SLEEP);
1817 uint32_t status;
1818 char *buf1; /* text buffer */
1819 char *buf2; /* text buffer */
1820 uint32_t buf1_size;
1821 uint32_t buf2_size;
1822
1823 buf1_size = 1024;
1824 buf2_size = 1024;
1825
1826 buf1 = (char *)kmem_zalloc(buf1_size, KM_SLEEP);
1867 if (buf1 == 0) {
1868 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
1869 "emlxs_dump_cfg_region4_decoded: Unable to allocate buf1.");
1870
1871 return (1);
1872 }
1873
1874 buf2 = (char *)kmem_zalloc(buf2_size, KM_SLEEP);
1827 buf2 = (char *)kmem_zalloc(buf2_size, KM_SLEEP);
1875 if (buf2 == 0) {
1876 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
1877 "emlxs_dump_cfg_region4_decoded: Unable to allocate buf2.");
1878
1828
1879 kmem_free(buf1, buf1_size);
1880 return (1);
1881 }
1882
1883 /* Write the Initial ID into the buffer */
1884 (void) sprintf(buf2, "%s: %08x %08x", LEGEND_CR4_INITIAL_LOAD,
1885 pBuffer->InitialId[0], pBuffer->InitialId[1]);
1886 (void) strcat(buf1, buf2);
1887
1888 /* Write the Flags Word into the buffer */
1889 (void) sprintf(buf2, "\n %s: %08x", LEGEND_CR4_FLAGS, pBuffer->Flags);
1890 (void) strcat(buf1, buf2);

--- 32 unchanged lines hidden (view full) ---

1923 emlxs_dump_string_txtfile(fpTxtFile, buf1, LEGEND_CONFIG_REGION,
1924 LEGEND_CONFIG_REGION_4, 0);
1925
1926 kmem_free(buf1, buf1_size);
1927 kmem_free(buf2, buf2_size);
1928
1929 return (status);
1930
1829 /* Write the Initial ID into the buffer */
1830 (void) sprintf(buf2, "%s: %08x %08x", LEGEND_CR4_INITIAL_LOAD,
1831 pBuffer->InitialId[0], pBuffer->InitialId[1]);
1832 (void) strcat(buf1, buf2);
1833
1834 /* Write the Flags Word into the buffer */
1835 (void) sprintf(buf2, "\n %s: %08x", LEGEND_CR4_FLAGS, pBuffer->Flags);
1836 (void) strcat(buf1, buf2);

--- 32 unchanged lines hidden (view full) ---

1869 emlxs_dump_string_txtfile(fpTxtFile, buf1, LEGEND_CONFIG_REGION,
1870 LEGEND_CONFIG_REGION_4, 0);
1871
1872 kmem_free(buf1, buf1_size);
1873 kmem_free(buf2, buf2_size);
1874
1875 return (status);
1876
1931} /* emlxs_dump_cfg_region4_decoded() */
1877} /* emlxs_dump_cfg_region4_decoded() */
1932
1933
1934/* ARGSUSED */
1935uint32_t
1936emlxs_dump_cfg_region14_decoded(
1937 emlxs_hba_t *hba,
1938 emlxs_file_t *fpTxtFile,
1939 char *pLidLegend,
1940 char *pBuffer,
1941 uint32_t ByteCount)
1942{
1878
1879
1880/* ARGSUSED */
1881uint32_t
1882emlxs_dump_cfg_region14_decoded(
1883 emlxs_hba_t *hba,
1884 emlxs_file_t *fpTxtFile,
1885 char *pLidLegend,
1886 char *pBuffer,
1887 uint32_t ByteCount)
1888{
1943 emlxs_port_t *port = &PPORT;
1944 uint32_t status;
1945 char *buf1; /* text buffer */
1946 char *buf2; /* text buffer */
1947 uint32_t buf1_size;
1948 uint32_t buf2_size;
1949 int i;
1950 uint8_t tag;
1951 uint16_t length;

--- 5 unchanged lines hidden (view full) ---

1957 uint32_t *wptr;
1958 uint32_t w1;
1959#endif
1960
1961 buf1_size = 1024;
1962 buf2_size = 1024;
1963
1964 buf1 = (char *)kmem_zalloc(buf1_size, KM_SLEEP);
1889 uint32_t status;
1890 char *buf1; /* text buffer */
1891 char *buf2; /* text buffer */
1892 uint32_t buf1_size;
1893 uint32_t buf2_size;
1894 int i;
1895 uint8_t tag;
1896 uint16_t length;

--- 5 unchanged lines hidden (view full) ---

1902 uint32_t *wptr;
1903 uint32_t w1;
1904#endif
1905
1906 buf1_size = 1024;
1907 buf2_size = 1024;
1908
1909 buf1 = (char *)kmem_zalloc(buf1_size, KM_SLEEP);
1965 if (buf1 == 0) {
1966 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
1967 "emlxs_dump_cfg_region14_decoded: "\
1968 "Unable to allocate buf1.");
1969
1970 return (1);
1971 }
1972
1973 buf2 = (char *)kmem_zalloc(buf2_size, KM_SLEEP);
1910 buf2 = (char *)kmem_zalloc(buf2_size, KM_SLEEP);
1974 if (buf2 == 0) {
1975 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
1976 "emlxs_dump_cfg_region14_decoded: "\
1977 "Unable to allocate buf2.");
1978
1911
1979 kmem_free(buf1, buf1_size);
1980 return (1);
1981 }
1982
1983/* If Big Endian, swap the data in place, */
1984/* because it's PCI Data (Little Endian) */
1985#ifdef EMLXS_BIG_ENDIAN
1986 wptr = (uint32_t *)pBuffer;
1987 for (i = 0; i < (int)ByteCount / 4; i++, wptr++) {
1988 w1 = *wptr;
1912/* If Big Endian, swap the data in place, */
1913/* because it's PCI Data (Little Endian) */
1914#ifdef EMLXS_BIG_ENDIAN
1915 wptr = (uint32_t *)pBuffer;
1916 for (i = 0; i < (int)ByteCount / 4; i++, wptr++) {
1917 w1 = *wptr;
1989 *wptr = SWAP_LONG(w1);
1918 *wptr = BE_SWAP32(w1);
1990 }
1991#endif /* EMLXS_BIG_ENDIAN */
1992
1993 /* Decode the VPD Data and write it into the buffer */
1994
1995 /* CR 26941 */
1996 /* NOTE: The following code is correct, */
1997 /* should work, and used to work. */

--- 71 unchanged lines hidden (view full) ---

2069 emlxs_dump_string_txtfile(fpTxtFile, buf1, LEGEND_CONFIG_REGION,
2070 LEGEND_CONFIG_REGION_14, 0);
2071
2072 kmem_free(buf1, buf1_size);
2073 kmem_free(buf2, buf2_size);
2074
2075 return (status);
2076
1919 }
1920#endif /* EMLXS_BIG_ENDIAN */
1921
1922 /* Decode the VPD Data and write it into the buffer */
1923
1924 /* CR 26941 */
1925 /* NOTE: The following code is correct, */
1926 /* should work, and used to work. */

--- 71 unchanged lines hidden (view full) ---

1998 emlxs_dump_string_txtfile(fpTxtFile, buf1, LEGEND_CONFIG_REGION,
1999 LEGEND_CONFIG_REGION_14, 0);
2000
2001 kmem_free(buf1, buf1_size);
2002 kmem_free(buf2, buf2_size);
2003
2004 return (status);
2005
2077} /* emlxs_dump_cfg_region14_decoded() */
2006} /* emlxs_dump_cfg_region14_decoded() */
2078
2079
2080static uint32_t
2081emlxs_dump_cfg_region(
2082 emlxs_hba_t *hba,
2083 emlxs_file_t *fpTxtFile,
2084 emlxs_file_t *fpDmpFile,
2085 uint8_t Region,
2086 char *pLidLegend,
2087 int fSwap)
2088{
2007
2008
2009static uint32_t
2010emlxs_dump_cfg_region(
2011 emlxs_hba_t *hba,
2012 emlxs_file_t *fpTxtFile,
2013 emlxs_file_t *fpDmpFile,
2014 uint8_t Region,
2015 char *pLidLegend,
2016 int fSwap)
2017{
2089 emlxs_port_t *port = &PPORT;
2090 uint32_t status;
2091 uint32_t RetByteCount = 0; /* returned byte count */
2092 char *buf1; /* string ops buffer */
2093 char *buf2; /* string ops buffer */
2094 uint32_t buf1_size;
2095 uint32_t buf2_size;
2096 uint32_t *buffer;
2097 int i;
2098
2099#ifdef EMLXS_LITTLE_ENDIAN
2100 fSwap = FALSE;
2101#endif /* EMLXS_LITTLE_ENDIAN */
2102
2103 buf1_size = 4096;
2104 buf2_size = 1024;
2105
2106 buf1 = (char *)kmem_zalloc(buf1_size, KM_SLEEP);
2018 uint32_t status;
2019 uint32_t RetByteCount = 0; /* returned byte count */
2020 char *buf1; /* string ops buffer */
2021 char *buf2; /* string ops buffer */
2022 uint32_t buf1_size;
2023 uint32_t buf2_size;
2024 uint32_t *buffer;
2025 int i;
2026
2027#ifdef EMLXS_LITTLE_ENDIAN
2028 fSwap = FALSE;
2029#endif /* EMLXS_LITTLE_ENDIAN */
2030
2031 buf1_size = 4096;
2032 buf2_size = 1024;
2033
2034 buf1 = (char *)kmem_zalloc(buf1_size, KM_SLEEP);
2107 if (buf1 == 0) {
2108 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
2109 "emlxs_dump_cfg_region: Unable to allocate buf1.");
2110
2111 return (1);
2112 }
2113
2114 buf2 = (char *)kmem_zalloc(buf2_size, KM_SLEEP);
2035 buf2 = (char *)kmem_zalloc(buf2_size, KM_SLEEP);
2115 if (buf2 == 0) {
2116 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
2117 "emlxs_dump_cfg_region: Unable to allocate buf2.");
2118
2036
2119 kmem_free(buf1, buf1_size);
2120 return (1);
2121 }
2122
2123 buffer =
2124 (uint32_t *)kmem_zalloc(DUMP_MAX_CONFIG_REGION_LENGTH, KM_SLEEP);
2037 buffer =
2038 (uint32_t *)kmem_zalloc(DUMP_MAX_CONFIG_REGION_LENGTH, KM_SLEEP);
2125 if (buffer == 0) {
2126 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
2127 "emlxs_dump_cfg_region: Unable to allocate buffer.");
2128
2039
2129 kmem_free(buf1, buf1_size);
2130 kmem_free(buf2, buf2_size);
2131 return (1);
2132 }
2133
2134 status =
2135 emlxs_read_cfg_region(hba, Region, DUMP_MAX_CONFIG_REGION_LENGTH,
2136 &RetByteCount, (uint8_t *)buffer);
2137
2138 if (status != 0) {
2139 kmem_free(buffer, DUMP_MAX_CONFIG_REGION_LENGTH);
2140 kmem_free(buf1, buf1_size);
2141 kmem_free(buf2, buf2_size);

--- 32 unchanged lines hidden (view full) ---

2174 }
2175
2176 kmem_free(buffer, DUMP_MAX_CONFIG_REGION_LENGTH);
2177 kmem_free(buf1, buf1_size);
2178 kmem_free(buf2, buf2_size);
2179
2180 return (status);
2181
2040 status =
2041 emlxs_read_cfg_region(hba, Region, DUMP_MAX_CONFIG_REGION_LENGTH,
2042 &RetByteCount, (uint8_t *)buffer);
2043
2044 if (status != 0) {
2045 kmem_free(buffer, DUMP_MAX_CONFIG_REGION_LENGTH);
2046 kmem_free(buf1, buf1_size);
2047 kmem_free(buf2, buf2_size);

--- 32 unchanged lines hidden (view full) ---

2080 }
2081
2082 kmem_free(buffer, DUMP_MAX_CONFIG_REGION_LENGTH);
2083 kmem_free(buf1, buf1_size);
2084 kmem_free(buf2, buf2_size);
2085
2086 return (status);
2087
2182} /* emlxs_dump_cfg_region() */
2088} /* emlxs_dump_cfg_region() */
2183
2184
2185static uint32_t
2186emlxs_dump_cfg_regions(
2187 emlxs_hba_t *hba,
2188 emlxs_file_t *fpTxtFile,
2189 emlxs_file_t *fpDmpFile)
2190{

--- 128 unchanged lines hidden (view full) ---

2319 LEGEND_CONFIG_REGION_31, FALSE);
2320
2321 status =
2322 emlxs_dump_cfg_region(hba, fpTxtFile, fpDmpFile, 32,
2323 LEGEND_CONFIG_REGION_32, FALSE);
2324
2325 return (status);
2326
2089
2090
2091static uint32_t
2092emlxs_dump_cfg_regions(
2093 emlxs_hba_t *hba,
2094 emlxs_file_t *fpTxtFile,
2095 emlxs_file_t *fpDmpFile)
2096{

--- 128 unchanged lines hidden (view full) ---

2225 LEGEND_CONFIG_REGION_31, FALSE);
2226
2227 status =
2228 emlxs_dump_cfg_region(hba, fpTxtFile, fpDmpFile, 32,
2229 LEGEND_CONFIG_REGION_32, FALSE);
2230
2231 return (status);
2232
2327} /* emlxs_dump_cfg_regions() */
2233} /* emlxs_dump_cfg_regions() */
2328
2329
2234
2235
2236/*ARGSUSED*/
2330static uint32_t
2331emlxs_dump_os_version(
2332 emlxs_hba_t *hba,
2333 emlxs_file_t *fpTxtFile,
2334 emlxs_file_t *fpDmpFile)
2335{
2237static uint32_t
2238emlxs_dump_os_version(
2239 emlxs_hba_t *hba,
2240 emlxs_file_t *fpTxtFile,
2241 emlxs_file_t *fpDmpFile)
2242{
2336 emlxs_port_t *port = &PPORT;
2337 uint32_t status;
2338 char *buf1;
2339 char *buf2;
2340 uint32_t buf1_size;
2341 uint32_t buf2_size;
2342
2343 buf1_size = 1024;
2344 buf2_size = 1024;
2345
2346 buf1 = (char *)kmem_zalloc(buf1_size, KM_SLEEP);
2243 uint32_t status;
2244 char *buf1;
2245 char *buf2;
2246 uint32_t buf1_size;
2247 uint32_t buf2_size;
2248
2249 buf1_size = 1024;
2250 buf2_size = 1024;
2251
2252 buf1 = (char *)kmem_zalloc(buf1_size, KM_SLEEP);
2347 if (buf1 == 0) {
2348 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
2349 "emlxs_dump_os_version: Unable to allocate buf1.");
2350
2351 return (1);
2352 }
2353
2354 buf2 = (char *)kmem_zalloc(buf2_size, KM_SLEEP);
2253 buf2 = (char *)kmem_zalloc(buf2_size, KM_SLEEP);
2355 if (buf2 == 0) {
2356 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
2357 "emlxs_dump_os_version: Unable to allocate buf2.");
2358
2254
2359 kmem_free(buf1, buf1_size);
2360 return (1);
2361 }
2362
2363
2364 /* First, write the OS Name string into the buffer */
2365 (void) strcpy(buf1, utsname.sysname);
2366
2367 /* Second, write the Version Info into the buffer */
2368 (void) sprintf(buf2, ", %s", utsname.release);
2369 (void) strcat(buf1, buf2);
2370
2371 status =

--- 4 unchanged lines hidden (view full) ---

2376 emlxs_dump_string_dmpfile(fpDmpFile, buf1, SID_REV_INFO,
2377 LEGEND_REV_INFO, LEGEND_REV_OS_VERSION);
2378
2379 kmem_free(buf1, buf1_size);
2380 kmem_free(buf2, buf2_size);
2381
2382 return (status);
2383
2255 /* First, write the OS Name string into the buffer */
2256 (void) strcpy(buf1, utsname.sysname);
2257
2258 /* Second, write the Version Info into the buffer */
2259 (void) sprintf(buf2, ", %s", utsname.release);
2260 (void) strcat(buf1, buf2);
2261
2262 status =

--- 4 unchanged lines hidden (view full) ---

2267 emlxs_dump_string_dmpfile(fpDmpFile, buf1, SID_REV_INFO,
2268 LEGEND_REV_INFO, LEGEND_REV_OS_VERSION);
2269
2270 kmem_free(buf1, buf1_size);
2271 kmem_free(buf2, buf2_size);
2272
2273 return (status);
2274
2384} /* emlxs_dump_os_version() */
2275} /* emlxs_dump_os_version() */
2385
2386
2276
2277
2278/*ARGSUSED*/
2387static uint32_t
2388emlxs_dump_drv_version(
2389 emlxs_hba_t *hba,
2390 emlxs_file_t *fpTxtFile,
2391 emlxs_file_t *fpDmpFile)
2392{
2279static uint32_t
2280emlxs_dump_drv_version(
2281 emlxs_hba_t *hba,
2282 emlxs_file_t *fpTxtFile,
2283 emlxs_file_t *fpDmpFile)
2284{
2393 emlxs_port_t *port = &PPORT;
2394
2395 uint32_t status;
2396 char *buf1;
2397 char *buf2;
2398 uint32_t buf1_size;
2399 uint32_t buf2_size;
2400
2401 buf1_size = 1024;
2402 buf2_size = 1024;
2403
2404 buf1 = (char *)kmem_zalloc(buf1_size, KM_SLEEP);
2285 uint32_t status;
2286 char *buf1;
2287 char *buf2;
2288 uint32_t buf1_size;
2289 uint32_t buf2_size;
2290
2291 buf1_size = 1024;
2292 buf2_size = 1024;
2293
2294 buf1 = (char *)kmem_zalloc(buf1_size, KM_SLEEP);
2405 if (buf1 == 0) {
2406 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
2407 "emlxs_dump_os_version: Unable to allocate buf1.");
2408
2409 return (1);
2410 }
2411
2412 buf2 = (char *)kmem_zalloc(buf2_size, KM_SLEEP);
2295 buf2 = (char *)kmem_zalloc(buf2_size, KM_SLEEP);
2413 if (buf2 == 0) {
2414 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
2415 "emlxs_dump_os_version: Unable to allocate buf2.");
2416
2296
2417 kmem_free(buf1, buf1_size);
2418 return (1);
2419 }
2420
2421 /* Write the Driver Type into the buffer */
2422 (void) strcpy(buf1, "Driver Type: ");
2423 (void) strcat(buf1, DUMP_DRV_LEADVILLE);
2424
2425 /* Write the Driver Name into the buffer */
2426 (void) sprintf(buf2, "%s", DRIVER_NAME);
2427 (void) strcat(buf1, "\n Driver Name: ");
2428 (void) strcat(buf1, buf2);

--- 11 unchanged lines hidden (view full) ---

2440 emlxs_dump_string_dmpfile(fpDmpFile, buf1, SID_REV_INFO,
2441 LEGEND_REV_INFO, LEGEND_REV_DRV_VERSION);
2442
2443 kmem_free(buf1, buf1_size);
2444 kmem_free(buf2, buf2_size);
2445
2446 return (status);
2447
2297 /* Write the Driver Type into the buffer */
2298 (void) strcpy(buf1, "Driver Type: ");
2299 (void) strcat(buf1, DUMP_DRV_LEADVILLE);
2300
2301 /* Write the Driver Name into the buffer */
2302 (void) sprintf(buf2, "%s", DRIVER_NAME);
2303 (void) strcat(buf1, "\n Driver Name: ");
2304 (void) strcat(buf1, buf2);

--- 11 unchanged lines hidden (view full) ---

2316 emlxs_dump_string_dmpfile(fpDmpFile, buf1, SID_REV_INFO,
2317 LEGEND_REV_INFO, LEGEND_REV_DRV_VERSION);
2318
2319 kmem_free(buf1, buf1_size);
2320 kmem_free(buf2, buf2_size);
2321
2322 return (status);
2323
2448} /* emlxs_dump_drv_version() */
2324} /* emlxs_dump_drv_version() */
2449
2450
2451static uint32_t
2452emlxs_dump_file_create(
2453 emlxs_hba_t *hba,
2454 emlxs_file_t ** fpTxtFile,
2455 emlxs_file_t ** fpDmpFile,
2456 emlxs_file_t ** fpCeeFile)
2457{
2458 if (fpTxtFile) {
2459 /* Create the Dump Files */
2460 if ((*fpTxtFile = emlxs_fopen(hba, EMLXS_TXT_FILE)) == NULL) {
2461 return (1);
2462 }
2463 }
2464
2465 if (fpCeeFile) {
2466 *fpCeeFile = NULL;
2467
2325
2326
2327static uint32_t
2328emlxs_dump_file_create(
2329 emlxs_hba_t *hba,
2330 emlxs_file_t ** fpTxtFile,
2331 emlxs_file_t ** fpDmpFile,
2332 emlxs_file_t ** fpCeeFile)
2333{
2334 if (fpTxtFile) {
2335 /* Create the Dump Files */
2336 if ((*fpTxtFile = emlxs_fopen(hba, EMLXS_TXT_FILE)) == NULL) {
2337 return (1);
2338 }
2339 }
2340
2341 if (fpCeeFile) {
2342 *fpCeeFile = NULL;
2343
2468 if (emlxs_ishornet(hba)) {
2344 if ((hba->model_info.device_id == PCI_DEVICE_ID_LP21000_M) ||
2345 (hba->model_info.chip == EMLXS_TIGERSHARK_CHIP)) {
2469 if ((*fpCeeFile =
2470 emlxs_fopen(hba, EMLXS_CEE_FILE)) == NULL) {
2471 emlxs_fdelete(*fpTxtFile);
2472 return (1);
2473 }
2474 }
2475 }
2476

--- 4 unchanged lines hidden (view full) ---

2481 return (1);
2482 }
2483
2484 /* Initialize the DMP File */
2485 /* Write the single-byte Dump Identification */
2486 /* SID to the DMP File */
2487#ifdef EMLXS_LITTLE_ENDIAN
2488 emlxs_fputc(SID_DUMP_ID_LE, *fpDmpFile);
2346 if ((*fpCeeFile =
2347 emlxs_fopen(hba, EMLXS_CEE_FILE)) == NULL) {
2348 emlxs_fdelete(*fpTxtFile);
2349 return (1);
2350 }
2351 }
2352 }
2353

--- 4 unchanged lines hidden (view full) ---

2358 return (1);
2359 }
2360
2361 /* Initialize the DMP File */
2362 /* Write the single-byte Dump Identification */
2363 /* SID to the DMP File */
2364#ifdef EMLXS_LITTLE_ENDIAN
2365 emlxs_fputc(SID_DUMP_ID_LE, *fpDmpFile);
2489#else
2490 emlxs_fputc(SID_DUMP_ID_BE, *fpDmpFile);
2491#endif /* EMLXS_LITTLE_ENDIAN */
2366#endif /* EMLXS_LITTLE_ENDIAN */
2367
2368#ifdef EMLXS_BIG_ENDIAN
2369 emlxs_fputc(SID_DUMP_ID_BE, *fpDmpFile);
2370#endif /* EMLXS_BIG_ENDIAN */
2371
2492 emlxs_fputc(SID_NULL, *fpDmpFile);
2493 emlxs_fputc(SID_NULL, *fpDmpFile);
2494 emlxs_fputc(SID_NULL, *fpDmpFile);
2495 emlxs_fflush(*fpDmpFile);
2496 }
2497
2498 return (0);
2499
2372 emlxs_fputc(SID_NULL, *fpDmpFile);
2373 emlxs_fputc(SID_NULL, *fpDmpFile);
2374 emlxs_fputc(SID_NULL, *fpDmpFile);
2375 emlxs_fflush(*fpDmpFile);
2376 }
2377
2378 return (0);
2379
2500} /* emlxs_dump_file_create() */
2380} /* emlxs_dump_file_create() */
2501
2502
2503static uint32_t
2504emlxs_dump_file_terminate(
2381
2382
2383static uint32_t
2384emlxs_dump_file_terminate(
2385 emlxs_hba_t *hba,
2505 emlxs_file_t *fpTxtFile,
2506 emlxs_file_t *fpDmpFile,
2507 emlxs_file_t *fpCeeFile)
2508{
2509
2510 if (fpTxtFile) {
2511 /* Write a suitable string to the Dump TXT File */
2512 (void) emlxs_fprintf(fpTxtFile, "Dump File End\n");
2513 emlxs_fflush(fpTxtFile);
2514 }
2515
2516 if (fpCeeFile) {
2386 emlxs_file_t *fpTxtFile,
2387 emlxs_file_t *fpDmpFile,
2388 emlxs_file_t *fpCeeFile)
2389{
2390
2391 if (fpTxtFile) {
2392 /* Write a suitable string to the Dump TXT File */
2393 (void) emlxs_fprintf(fpTxtFile, "Dump File End\n");
2394 emlxs_fflush(fpTxtFile);
2395 }
2396
2397 if (fpCeeFile) {
2517 (void) emlxs_fprintf(fpCeeFile, "Dump File End\n");
2398 if (hba->model_info.device_id == PCI_DEVICE_ID_LP21000_M) {
2399 (void) emlxs_fprintf(fpCeeFile, "Dump File End\n");
2400 }
2401
2518 emlxs_fflush(fpCeeFile);
2519 }
2520
2521 /* Write the single-byte Dump Termination SID to the DMP File */
2522 if (fpDmpFile) {
2523 emlxs_fputc(SID_DUMP_TERM, fpDmpFile);
2524 emlxs_fflush(fpDmpFile);
2525 }
2526
2527
2528 return (0);
2529
2402 emlxs_fflush(fpCeeFile);
2403 }
2404
2405 /* Write the single-byte Dump Termination SID to the DMP File */
2406 if (fpDmpFile) {
2407 emlxs_fputc(SID_DUMP_TERM, fpDmpFile);
2408 emlxs_fflush(fpDmpFile);
2409 }
2410
2411
2412 return (0);
2413
2530} /* emlxs_dump_file_terminate() */
2414} /* emlxs_dump_file_terminate() */
2531
2532
2533static uint32_t
2534emlxs_dump_file_close(
2535 emlxs_file_t *fpTxtFile,
2536 emlxs_file_t *fpDmpFile,
2537 emlxs_file_t *fpCeeFile)
2538{

--- 7 unchanged lines hidden (view full) ---

2546 }
2547
2548 if (fpDmpFile) {
2549 (void) emlxs_fclose(fpDmpFile);
2550 }
2551
2552 return (0);
2553
2415
2416
2417static uint32_t
2418emlxs_dump_file_close(
2419 emlxs_file_t *fpTxtFile,
2420 emlxs_file_t *fpDmpFile,
2421 emlxs_file_t *fpCeeFile)
2422{

--- 7 unchanged lines hidden (view full) ---

2430 }
2431
2432 if (fpDmpFile) {
2433 (void) emlxs_fclose(fpDmpFile);
2434 }
2435
2436 return (0);
2437
2554} /* emlxs_dump_file_close() */
2438} /* emlxs_dump_file_close() */
2555
2556
2557/* ************************************************************************* */
2558/* ************************************************************************* */
2559/* Dump Generators, High Level */
2560/* ************************************************************************* */
2561/* ************************************************************************* */
2562
2563
2564static uint32_t
2565emlxs_dump_rev_info(
2566 emlxs_hba_t *hba,
2567 emlxs_file_t *fpTxtFile,
2568 emlxs_file_t *fpDmpFile)
2569{
2570 (void) emlxs_dump_os_version(hba, fpTxtFile, fpDmpFile);
2571 (void) emlxs_dump_drv_version(hba, fpTxtFile, fpDmpFile);
2572 return (0);
2573
2439
2440
2441/* ************************************************************************* */
2442/* ************************************************************************* */
2443/* Dump Generators, High Level */
2444/* ************************************************************************* */
2445/* ************************************************************************* */
2446
2447
2448static uint32_t
2449emlxs_dump_rev_info(
2450 emlxs_hba_t *hba,
2451 emlxs_file_t *fpTxtFile,
2452 emlxs_file_t *fpDmpFile)
2453{
2454 (void) emlxs_dump_os_version(hba, fpTxtFile, fpDmpFile);
2455 (void) emlxs_dump_drv_version(hba, fpTxtFile, fpDmpFile);
2456 return (0);
2457
2574} /* emlxs_dump_rev_info() */
2458} /* emlxs_dump_rev_info() */
2575
2576
2577/* ARGSUSED */
2578static uint32_t
2579emlxs_dump_hba_info(
2580 emlxs_hba_t *hba,
2581 emlxs_file_t *fpTxtFile,
2582 emlxs_file_t *fpDmpFile,
2583 uint32_t dump_type)
2584{
2585 (void) emlxs_dump_model(hba, fpTxtFile, fpDmpFile);
2586 (void) emlxs_dump_wwn(hba, fpTxtFile, fpDmpFile);
2587 (void) emlxs_dump_serial_number(hba, fpTxtFile, fpDmpFile);
2588 (void) emlxs_dump_fw_version(hba, fpTxtFile, fpDmpFile);
2589 (void) emlxs_dump_boot_version(hba, fpTxtFile, fpDmpFile);
2590
2591
2592 return (0);
2593
2459
2460
2461/* ARGSUSED */
2462static uint32_t
2463emlxs_dump_hba_info(
2464 emlxs_hba_t *hba,
2465 emlxs_file_t *fpTxtFile,
2466 emlxs_file_t *fpDmpFile,
2467 uint32_t dump_type)
2468{
2469 (void) emlxs_dump_model(hba, fpTxtFile, fpDmpFile);
2470 (void) emlxs_dump_wwn(hba, fpTxtFile, fpDmpFile);
2471 (void) emlxs_dump_serial_number(hba, fpTxtFile, fpDmpFile);
2472 (void) emlxs_dump_fw_version(hba, fpTxtFile, fpDmpFile);
2473 (void) emlxs_dump_boot_version(hba, fpTxtFile, fpDmpFile);
2474
2475
2476 return (0);
2477
2594} /* emlxs_dump_hba_info() */
2478} /* emlxs_dump_hba_info() */
2595
2596
2597/* ************************************************************************* */
2598/* emlxs_dump_table_check */
2599/* Examine Dump Table, and determine its size. */
2600/* Count and include ID SIDs, and the TERM SID, */
2601/* but not the Pointer at Addr 654. */
2602/* See comments for CC_DUMP_USE_ALL_TABLES for additional description. */

--- 11 unchanged lines hidden (view full) ---

2614 uint32_t DumpTableAddr;
2615 DUMP_TABLE_ENTRY entry;
2616
2617 *pSize = 0;
2618
2619 /* Read 1 word from low memory at address 654; */
2620 /* save the returned Dump Table Base Address */
2621
2479
2480
2481/* ************************************************************************* */
2482/* emlxs_dump_table_check */
2483/* Examine Dump Table, and determine its size. */
2484/* Count and include ID SIDs, and the TERM SID, */
2485/* but not the Pointer at Addr 654. */
2486/* See comments for CC_DUMP_USE_ALL_TABLES for additional description. */

--- 11 unchanged lines hidden (view full) ---

2498 uint32_t DumpTableAddr;
2499 DUMP_TABLE_ENTRY entry;
2500
2501 *pSize = 0;
2502
2503 /* Read 1 word from low memory at address 654; */
2504 /* save the returned Dump Table Base Address */
2505
2622 if ((mbq =
2623 (MAILBOXQ *)kmem_zalloc(sizeof (MAILBOXQ), KM_SLEEP)) == 0) {
2624 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_dfc_error_msg,
2625 "DUMP: Unable to allocate mailbox buffer.");
2626
2627 return (1);
2628 }
2506 mbq =
2507 (MAILBOXQ *)kmem_zalloc(sizeof (MAILBOXQ), KM_SLEEP);
2629 mb = (MAILBOX *) mbq;
2630
2631 /* Read the dump table address */
2508 mb = (MAILBOX *) mbq;
2509
2510 /* Read the dump table address */
2632 emlxs_mb_dump(hba, mb, 0x654, 1);
2633 if (emlxs_sli_issue_mbox_cmd(hba, mb, MBX_WAIT, 0) != MBX_SUCCESS) {
2511 emlxs_mb_dump(hba, mbq, 0x654, 1);
2512 if (EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_WAIT, 0) != MBX_SUCCESS) {
2634 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_init_debug_msg,
2635 "Unable to read dump table address. "\
2636 "offset=0x654 status=%x",
2637 mb->mbxStatus);
2638
2639 kmem_free(mbq, sizeof (MAILBOXQ));
2640 return (1);
2641 }
2642
2643 DumpTableAddr = mb->un.varDmp.resp_offset;
2644
2645 if (DumpTableAddr == 0) {
2646 kmem_free(mbq, sizeof (MAILBOXQ));
2647 return (1);
2648 }
2649
2650 /* Now loop reading Dump Table Entries.. */
2651 /* break out when we see a Terminator SID */
2652 while (!fDone) {
2513 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_init_debug_msg,
2514 "Unable to read dump table address. "\
2515 "offset=0x654 status=%x",
2516 mb->mbxStatus);
2517
2518 kmem_free(mbq, sizeof (MAILBOXQ));
2519 return (1);
2520 }
2521
2522 DumpTableAddr = mb->un.varDmp.resp_offset;
2523
2524 if (DumpTableAddr == 0) {
2525 kmem_free(mbq, sizeof (MAILBOXQ));
2526 return (1);
2527 }
2528
2529 /* Now loop reading Dump Table Entries.. */
2530 /* break out when we see a Terminator SID */
2531 while (!fDone) {
2653 emlxs_mb_dump(hba, mb, DumpTableAddr, 2);
2654 if (emlxs_sli_issue_mbox_cmd(hba, mb, MBX_WAIT, 0) !=
2532 emlxs_mb_dump(hba, mbq, DumpTableAddr, 2);
2533 if (EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_WAIT, 0) !=
2655 MBX_SUCCESS) {
2656 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_init_debug_msg,
2657 "Unable to read dump table entry. "\
2658 "offset=%x status=%x",
2659 DumpTableAddr, mb->mbxStatus);
2660
2661 kmem_free(mbq, sizeof (MAILBOXQ));
2662 return (1);

--- 39 unchanged lines hidden (view full) ---

2702
2703 } /* end while */
2704
2705 *pSize = (tableSize * 4); /* return the total Dump Table size */
2706
2707 kmem_free(mbq, sizeof (MAILBOXQ));
2708 return (0);
2709
2534 MBX_SUCCESS) {
2535 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_init_debug_msg,
2536 "Unable to read dump table entry. "\
2537 "offset=%x status=%x",
2538 DumpTableAddr, mb->mbxStatus);
2539
2540 kmem_free(mbq, sizeof (MAILBOXQ));
2541 return (1);

--- 39 unchanged lines hidden (view full) ---

2581
2582 } /* end while */
2583
2584 *pSize = (tableSize * 4); /* return the total Dump Table size */
2585
2586 kmem_free(mbq, sizeof (MAILBOXQ));
2587 return (0);
2588
2710} /* emlxs_dump_table_check() */
2589} /* emlxs_dump_table_check() */
2711
2712
2713/* ************************************************************************ */
2714/* emlxs_dump_table_read */
2715/* Read the Dump Table and store it, for use */
2716/* subsequently in emlxs_dump_hba_memory. */
2717/* See comments for CC_DUMP_USE_ALL_TABLES for additional description. */
2718/* ************************************************************************ */

--- 19 unchanged lines hidden (view full) ---

2738
2739 /* First, check the dump table and if valid, get its size */
2740 status = emlxs_dump_table_check(hba, pDumpTableSize);
2741 if (status != 0) {
2742 return (status);
2743 }
2744
2745 buf1 = (char *)kmem_zalloc(size, KM_SLEEP);
2590
2591
2592/* ************************************************************************ */
2593/* emlxs_dump_table_read */
2594/* Read the Dump Table and store it, for use */
2595/* subsequently in emlxs_dump_hba_memory. */
2596/* See comments for CC_DUMP_USE_ALL_TABLES for additional description. */
2597/* ************************************************************************ */

--- 19 unchanged lines hidden (view full) ---

2617
2618 /* First, check the dump table and if valid, get its size */
2619 status = emlxs_dump_table_check(hba, pDumpTableSize);
2620 if (status != 0) {
2621 return (status);
2622 }
2623
2624 buf1 = (char *)kmem_zalloc(size, KM_SLEEP);
2746 if (buf1 == 0) {
2747 return (1);
2748 }
2749
2750 /* Allocate a buffer to hold the Dump Table */
2751 *ppDumpTable = (uint32_t *)kmem_zalloc(*pDumpTableSize, KM_SLEEP);
2625
2626 /* Allocate a buffer to hold the Dump Table */
2627 *ppDumpTable = (uint32_t *)kmem_zalloc(*pDumpTableSize, KM_SLEEP);
2752 if (*ppDumpTable == 0) {
2753 kmem_free(buf1, size);
2754
2628
2755 *pDumpTableSize = 0;
2756 return (1);
2757 }
2758
2759 pDumpTableEntry = *ppDumpTable;
2760
2761 /* Read 1 word from low memory at address 654; */
2762 /* save the returned Dump Table Base Address */
2629 pDumpTableEntry = *ppDumpTable;
2630
2631 /* Read 1 word from low memory at address 654; */
2632 /* save the returned Dump Table Base Address */
2763 if ((mbq =
2764 (MAILBOXQ *)kmem_zalloc(sizeof (MAILBOXQ), KM_SLEEP)) == 0) {
2765 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_dfc_error_msg,
2766 "DUMP: Unable to allocate mailbox buffer.");
2633 mbq =
2634 (MAILBOXQ *)kmem_zalloc(sizeof (MAILBOXQ), KM_SLEEP);
2767
2635
2768 kmem_free(buf1, size);
2769 kmem_free(*ppDumpTable, *pDumpTableSize);
2770 *pDumpTableSize = 0;
2771 *ppDumpTable = NULL;
2772
2773 return (1);
2774 }
2775 mb = (MAILBOX *) mbq;
2776
2777 /* Read the dump table address */
2636 mb = (MAILBOX *) mbq;
2637
2638 /* Read the dump table address */
2778 emlxs_mb_dump(hba, mb, 0x654, 1);
2779 if (emlxs_sli_issue_mbox_cmd(hba, mb, MBX_WAIT, 0) != MBX_SUCCESS) {
2639 emlxs_mb_dump(hba, mbq, 0x654, 1);
2640 if (EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_WAIT, 0) != MBX_SUCCESS) {
2780 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_init_debug_msg,
2781 "Unable to read dump table address. "\
2782 "offset=0x654 status=%x",
2783 mb->mbxStatus);
2784
2785 kmem_free(buf1, size);
2786 kmem_free(mbq, sizeof (MAILBOXQ));
2787

--- 16 unchanged lines hidden (view full) ---

2804
2805 return (1);
2806 }
2807
2808
2809 /* Now loop reading Dump Table Entries.. */
2810 /* break out when we see a Terminator SID */
2811 while (!fDone) {
2641 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_init_debug_msg,
2642 "Unable to read dump table address. "\
2643 "offset=0x654 status=%x",
2644 mb->mbxStatus);
2645
2646 kmem_free(buf1, size);
2647 kmem_free(mbq, sizeof (MAILBOXQ));
2648

--- 16 unchanged lines hidden (view full) ---

2665
2666 return (1);
2667 }
2668
2669
2670 /* Now loop reading Dump Table Entries.. */
2671 /* break out when we see a Terminator SID */
2672 while (!fDone) {
2812 emlxs_mb_dump(hba, mb, DumpTableAddr, 2);
2813 if (emlxs_sli_issue_mbox_cmd(hba, mb, MBX_WAIT, 0) !=
2673 emlxs_mb_dump(hba, mbq, DumpTableAddr, 2);
2674 if (EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_WAIT, 0) !=
2814 MBX_SUCCESS) {
2815 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_init_debug_msg,
2816 "Unable to read dump table entry. "\
2817 "offset=%x status=%x",
2818 DumpTableAddr, mb->mbxStatus);
2819
2820 kmem_free(buf1, size);
2821 kmem_free(mbq, sizeof (MAILBOXQ));

--- 75 unchanged lines hidden (view full) ---

2897 *pDumpTableSize = 0;
2898 *ppDumpTable = NULL;
2899
2900 return (status);
2901 }
2902
2903 return (0);
2904
2675 MBX_SUCCESS) {
2676 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_init_debug_msg,
2677 "Unable to read dump table entry. "\
2678 "offset=%x status=%x",
2679 DumpTableAddr, mb->mbxStatus);
2680
2681 kmem_free(buf1, size);
2682 kmem_free(mbq, sizeof (MAILBOXQ));

--- 75 unchanged lines hidden (view full) ---

2758 *pDumpTableSize = 0;
2759 *ppDumpTable = NULL;
2760
2761 return (status);
2762 }
2763
2764 return (0);
2765
2905} /* emlxs_dump_table_read() */
2766} /* emlxs_dump_table_read() */
2906
2907
2908/* ************************************************************************* */
2909/* emlxs_dump_hba_memory */
2910/* Guided by the Dump Table previously read in, */
2911/* generate the Port Memory Dump. */
2912/* See comments for CC_DUMP_USE_ALL_TABLES for additional description. */
2913/* ************************************************************************* */

--- 22 unchanged lines hidden (view full) ---

2936#ifdef EMLXS_BIG_ENDIAN
2937 fSwap = TRUE;
2938#endif /* EMLXS_BIG_ENDIAN */
2939
2940 if (!fpDmpFile) {
2941 return (1);
2942 }
2943
2767
2768
2769/* ************************************************************************* */
2770/* emlxs_dump_hba_memory */
2771/* Guided by the Dump Table previously read in, */
2772/* generate the Port Memory Dump. */
2773/* See comments for CC_DUMP_USE_ALL_TABLES for additional description. */
2774/* ************************************************************************* */

--- 22 unchanged lines hidden (view full) ---

2797#ifdef EMLXS_BIG_ENDIAN
2798 fSwap = TRUE;
2799#endif /* EMLXS_BIG_ENDIAN */
2800
2801 if (!fpDmpFile) {
2802 return (1);
2803 }
2804
2944 if ((mbq =
2945 (MAILBOXQ *)kmem_zalloc(sizeof (MAILBOXQ), KM_SLEEP)) == 0) {
2946 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_dfc_error_msg,
2947 "DUMP: Unable to allocate mailbox buffer.");
2805 mbq =
2806 (MAILBOXQ *)kmem_zalloc(sizeof (MAILBOXQ), KM_SLEEP);
2948
2807
2949 return (1);
2950 }
2951 mb = (MAILBOX *) mbq;
2952
2953 /* loop reading Dump Table Entries.. break out when */
2954 /* we see a Terminator SID */
2955 while (!fDone) {
2956 entry.un.PortBlock.un.w[0] = *pDumpTable++;
2957
2958 switch (entry.un.PortBlock.un.s.sid) {

--- 31 unchanged lines hidden (view full) ---

2990#endif /* CC_DUMP_FW_BUG_1 */
2991
2992 /* Check if indirect address, and */
2993 /* obtain the new address if so */
2994 if ((entry.un.PortBlock.un.s.addr & 0x80000000) != 0) {
2995 offset =
2996 (entry.un.PortBlock.un.s.
2997 addr & 0x01FFFFFF);
2808 mb = (MAILBOX *) mbq;
2809
2810 /* loop reading Dump Table Entries.. break out when */
2811 /* we see a Terminator SID */
2812 while (!fDone) {
2813 entry.un.PortBlock.un.w[0] = *pDumpTable++;
2814
2815 switch (entry.un.PortBlock.un.s.sid) {

--- 31 unchanged lines hidden (view full) ---

2847#endif /* CC_DUMP_FW_BUG_1 */
2848
2849 /* Check if indirect address, and */
2850 /* obtain the new address if so */
2851 if ((entry.un.PortBlock.un.s.addr & 0x80000000) != 0) {
2852 offset =
2853 (entry.un.PortBlock.un.s.
2854 addr & 0x01FFFFFF);
2998 emlxs_mb_dump(hba, mb, offset, 1);
2999 if (emlxs_sli_issue_mbox_cmd(hba, mb, MBX_WAIT,
2855 emlxs_mb_dump(hba, mbq, offset, 1);
2856 if (EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_WAIT,
3000 0) != MBX_SUCCESS) {
3001 EMLXS_MSGF(EMLXS_CONTEXT,
3002 &emlxs_init_debug_msg,
3003 "Unable to read dump table entry. "\
3004 "offset=%x status=%x",
3005 offset, mb->mbxStatus);
3006
3007 kmem_free(mbq, sizeof (MAILBOXQ));

--- 22 unchanged lines hidden (view full) ---

3030
3031 total += byteCount;
3032 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_init_debug_msg,
3033 "Dump: addr=%x count=%d total=%d", offset,
3034 byteCount, total);
3035
3036 /* allocate a buffer to receive the dump data */
3037 pBuf = (uint8_t *)kmem_zalloc(byteCount, KM_SLEEP);
2857 0) != MBX_SUCCESS) {
2858 EMLXS_MSGF(EMLXS_CONTEXT,
2859 &emlxs_init_debug_msg,
2860 "Unable to read dump table entry. "\
2861 "offset=%x status=%x",
2862 offset, mb->mbxStatus);
2863
2864 kmem_free(mbq, sizeof (MAILBOXQ));

--- 22 unchanged lines hidden (view full) ---

2887
2888 total += byteCount;
2889 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_init_debug_msg,
2890 "Dump: addr=%x count=%d total=%d", offset,
2891 byteCount, total);
2892
2893 /* allocate a buffer to receive the dump data */
2894 pBuf = (uint8_t *)kmem_zalloc(byteCount, KM_SLEEP);
3038 if (pBuf == 0) {
3039 kmem_free(mbq, sizeof (MAILBOXQ));
3040 return (1);
3041 }
3042
3043 /* loop issuing MBX commands, 18x measly words at */
3044 /* a time */
3045
3046 /* init vars */
3047 byteCountRem = byteCount;
3048 p1 = pBuf;
3049 portAddr = entry.un.PortBlock.un.s.addr;
3050
3051 for (;;) {
3052 if (byteCountRem == 0) {
3053 break;
3054 }
3055
3056 wcount =
3057 (byteCountRem / 4 >=
3058 0x18) ? 0x18 : (byteCountRem / 4);
2895
2896 /* loop issuing MBX commands, 18x measly words at */
2897 /* a time */
2898
2899 /* init vars */
2900 byteCountRem = byteCount;
2901 p1 = pBuf;
2902 portAddr = entry.un.PortBlock.un.s.addr;
2903
2904 for (;;) {
2905 if (byteCountRem == 0) {
2906 break;
2907 }
2908
2909 wcount =
2910 (byteCountRem / 4 >=
2911 0x18) ? 0x18 : (byteCountRem / 4);
3059 emlxs_mb_dump(hba, mb, portAddr, wcount);
3060 if (emlxs_sli_issue_mbox_cmd(hba, mb, MBX_WAIT,
2912 emlxs_mb_dump(hba, mbq, portAddr, wcount);
2913 if (EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_WAIT,
3061 0) != MBX_SUCCESS) {
3062 EMLXS_MSGF(EMLXS_CONTEXT,
3063 &emlxs_init_debug_msg,
3064 "Unable to read dump table entry."\
3065 " offset=%x wc=%d status=%x",
3066 portAddr, wcount, mb->mbxStatus);
3067 break;
3068 }

--- 29 unchanged lines hidden (view full) ---

3098 } /* end switch */
3099
3100 } /* end while */
3101
3102 kmem_free(mbq, sizeof (MAILBOXQ));
3103
3104 return (status);
3105
2914 0) != MBX_SUCCESS) {
2915 EMLXS_MSGF(EMLXS_CONTEXT,
2916 &emlxs_init_debug_msg,
2917 "Unable to read dump table entry."\
2918 " offset=%x wc=%d status=%x",
2919 portAddr, wcount, mb->mbxStatus);
2920 break;
2921 }

--- 29 unchanged lines hidden (view full) ---

2951 } /* end switch */
2952
2953 } /* end while */
2954
2955 kmem_free(mbq, sizeof (MAILBOXQ));
2956
2957 return (status);
2958
3106} /* emlxs_dump_hba_memory() */
2959} /* emlxs_dump_hba_memory() */
3107
3108
3109static uint32_t
3110emlxs_dump_hba(
3111 emlxs_hba_t *hba,
3112 emlxs_file_t *fpTxtFile,
3113 emlxs_file_t *fpDmpFile)
3114{
3115 uint32_t status = 0;
3116 uint32_t *pDumpTable = 0;
3117 uint32_t DumpTableSize = 0;
3118
2960
2961
2962static uint32_t
2963emlxs_dump_hba(
2964 emlxs_hba_t *hba,
2965 emlxs_file_t *fpTxtFile,
2966 emlxs_file_t *fpDmpFile)
2967{
2968 uint32_t status = 0;
2969 uint32_t *pDumpTable = 0;
2970 uint32_t DumpTableSize = 0;
2971
2972 if (hba->sli_mode >= EMLXS_HBA_SLI4_MODE) {
2973 return (1);
2974 }
2975
2976 /* HBA should be in WARM state here */
3119 status =
3120 emlxs_dump_table_read(hba, fpTxtFile, &pDumpTable,
3121 &DumpTableSize);
3122 if (status) {
3123 return (status);
3124 }
3125
3126 status = emlxs_dump_hba_memory(hba, fpDmpFile, pDumpTable);
3127
3128 if (pDumpTable != 0) {
3129 kmem_free(pDumpTable, DumpTableSize);
3130 }
3131
3132 return (status);
3133
2977 status =
2978 emlxs_dump_table_read(hba, fpTxtFile, &pDumpTable,
2979 &DumpTableSize);
2980 if (status) {
2981 return (status);
2982 }
2983
2984 status = emlxs_dump_hba_memory(hba, fpDmpFile, pDumpTable);
2985
2986 if (pDumpTable != 0) {
2987 kmem_free(pDumpTable, DumpTableSize);
2988 }
2989
2990 return (status);
2991
3134} /* emlxs_dump_hba() */
2992} /* emlxs_dump_hba() */
3135
3136
3137/* ************************************************************************* */
3138/* emlxs_dump_drv_region */
3139/* Common subroutine for all the Dump_Sli"Structures" Routines */
3140/* NOTE: This routine does not free pBuf. This is by design. */
3141/* The caller does it. */
3142/* ************************************************************************* */

--- 15 unchanged lines hidden (view full) ---

3158
3159 if (status != 0) {
3160 return (1);
3161 }
3162
3163 /* Now that we know the required length, request the actual data */
3164 *pBuf = (uint8_t *)kmem_zalloc(size, KM_SLEEP);
3165
2993
2994
2995/* ************************************************************************* */
2996/* emlxs_dump_drv_region */
2997/* Common subroutine for all the Dump_Sli"Structures" Routines */
2998/* NOTE: This routine does not free pBuf. This is by design. */
2999/* The caller does it. */
3000/* ************************************************************************* */

--- 15 unchanged lines hidden (view full) ---

3016
3017 if (status != 0) {
3018 return (1);
3019 }
3020
3021 /* Now that we know the required length, request the actual data */
3022 *pBuf = (uint8_t *)kmem_zalloc(size, KM_SLEEP);
3023
3166 if (*pBuf == 0) {
3167 return (1);
3168 }
3169
3170 status = emlxs_get_dump_region(hba, regionId, *pBuf, &size);
3171
3172 if (status != 0) {
3173 kmem_free(pBuf, size);
3174 *pBuf = NULL;
3175
3176 return (1);
3177 }
3178
3179 *pBufLen = size;
3180
3181 return (status);
3182
3024 status = emlxs_get_dump_region(hba, regionId, *pBuf, &size);
3025
3026 if (status != 0) {
3027 kmem_free(pBuf, size);
3028 *pBuf = NULL;
3029
3030 return (1);
3031 }
3032
3033 *pBufLen = size;
3034
3035 return (status);
3036
3183} /* emlxs_dump_drv_region() */
3037} /* emlxs_dump_drv_region() */
3184
3185
3186static uint32_t
3187emlxs_dump_sli_regs(
3188 emlxs_hba_t *hba,
3189 emlxs_file_t *fpDmpFile)
3190{
3191 uint32_t status;

--- 18 unchanged lines hidden (view full) ---

3210 status =
3211 emlxs_dump_host_block(fpDmpFile, pBuf, bufLen, SID_SLI_REGS,
3212 LEGEND_SLI_STRUCTURES, LEGEND_SLI_REGS, fSwap);
3213
3214 kmem_free(pBuf, bufLen);
3215
3216 return (status);
3217
3038
3039
3040static uint32_t
3041emlxs_dump_sli_regs(
3042 emlxs_hba_t *hba,
3043 emlxs_file_t *fpDmpFile)
3044{
3045 uint32_t status;

--- 18 unchanged lines hidden (view full) ---

3064 status =
3065 emlxs_dump_host_block(fpDmpFile, pBuf, bufLen, SID_SLI_REGS,
3066 LEGEND_SLI_STRUCTURES, LEGEND_SLI_REGS, fSwap);
3067
3068 kmem_free(pBuf, bufLen);
3069
3070 return (status);
3071
3218} /* emlxs_dump_sli_regs() */
3072} /* emlxs_dump_sli_regs() */
3219
3220
3221static uint32_t
3222emlxs_dump_slim(
3223 emlxs_hba_t *hba,
3224 emlxs_file_t *fpTxtFile,
3225 emlxs_file_t *fpDmpFile,
3226 uint32_t dump_type)

--- 24 unchanged lines hidden (view full) ---

3251 status =
3252 emlxs_dump_host_block(fpDmpFile, pBuf, bufLen, SID_SLIM,
3253 LEGEND_SLI_STRUCTURES, LEGEND_SLIM, fSwap);
3254
3255 kmem_free(pBuf, bufLen);
3256
3257 return (status);
3258
3073
3074
3075static uint32_t
3076emlxs_dump_slim(
3077 emlxs_hba_t *hba,
3078 emlxs_file_t *fpTxtFile,
3079 emlxs_file_t *fpDmpFile,
3080 uint32_t dump_type)

--- 24 unchanged lines hidden (view full) ---

3105 status =
3106 emlxs_dump_host_block(fpDmpFile, pBuf, bufLen, SID_SLIM,
3107 LEGEND_SLI_STRUCTURES, LEGEND_SLIM, fSwap);
3108
3109 kmem_free(pBuf, bufLen);
3110
3111 return (status);
3112
3259} /* emlxs_dump_slim() */
3113} /* emlxs_dump_slim() */
3260
3261
3262static uint32_t
3263emlxs_dump_pcb(
3264 emlxs_hba_t *hba,
3265 emlxs_file_t *fpDmpFile)
3266{
3267 uint32_t status;

--- 17 unchanged lines hidden (view full) ---

3285 status =
3286 emlxs_dump_host_block(fpDmpFile, pBuf, bufLen, SID_PCB,
3287 LEGEND_SLI_STRUCTURES, LEGEND_PCB, fSwap);
3288
3289 kmem_free(pBuf, bufLen);
3290
3291 return (status);
3292
3114
3115
3116static uint32_t
3117emlxs_dump_pcb(
3118 emlxs_hba_t *hba,
3119 emlxs_file_t *fpDmpFile)
3120{
3121 uint32_t status;

--- 17 unchanged lines hidden (view full) ---

3139 status =
3140 emlxs_dump_host_block(fpDmpFile, pBuf, bufLen, SID_PCB,
3141 LEGEND_SLI_STRUCTURES, LEGEND_PCB, fSwap);
3142
3143 kmem_free(pBuf, bufLen);
3144
3145 return (status);
3146
3293} /* emlxs_dump_pcb() */
3147} /* emlxs_dump_pcb() */
3294
3295
3296static uint32_t
3297emlxs_dump_mbox(
3298 emlxs_hba_t *hba,
3299 emlxs_file_t *fpDmpFile)
3300{
3301 uint32_t status;

--- 17 unchanged lines hidden (view full) ---

3319 status =
3320 emlxs_dump_host_block(fpDmpFile, pBuf, bufLen, SID_MBX,
3321 LEGEND_SLI_STRUCTURES, LEGEND_MBX, fSwap);
3322
3323 kmem_free(pBuf, bufLen);
3324
3325 return (status);
3326
3148
3149
3150static uint32_t
3151emlxs_dump_mbox(
3152 emlxs_hba_t *hba,
3153 emlxs_file_t *fpDmpFile)
3154{
3155 uint32_t status;

--- 17 unchanged lines hidden (view full) ---

3173 status =
3174 emlxs_dump_host_block(fpDmpFile, pBuf, bufLen, SID_MBX,
3175 LEGEND_SLI_STRUCTURES, LEGEND_MBX, fSwap);
3176
3177 kmem_free(pBuf, bufLen);
3178
3179 return (status);
3180
3327} /* emlxs_dump_mbox() */
3181} /* emlxs_dump_mbox() */
3328
3329
3330static uint32_t
3331emlxs_dump_host_pointers(
3332 emlxs_hba_t *hba,
3333 emlxs_file_t *fpDmpFile)
3334{
3335 uint32_t status;

--- 17 unchanged lines hidden (view full) ---

3353 status =
3354 emlxs_dump_host_block(fpDmpFile, pBuf, bufLen, SID_HOST_PTRS,
3355 LEGEND_SLI_STRUCTURES, LEGEND_HOST_PTRS, fSwap);
3356
3357 kmem_free(pBuf, bufLen);
3358
3359 return (status);
3360
3182
3183
3184static uint32_t
3185emlxs_dump_host_pointers(
3186 emlxs_hba_t *hba,
3187 emlxs_file_t *fpDmpFile)
3188{
3189 uint32_t status;

--- 17 unchanged lines hidden (view full) ---

3207 status =
3208 emlxs_dump_host_block(fpDmpFile, pBuf, bufLen, SID_HOST_PTRS,
3209 LEGEND_SLI_STRUCTURES, LEGEND_HOST_PTRS, fSwap);
3210
3211 kmem_free(pBuf, bufLen);
3212
3213 return (status);
3214
3361} /* emlxs_dump_host_pointers() */
3215} /* emlxs_dump_host_pointers() */
3362
3363
3364static uint32_t
3365emlxs_dump_port_pointers(
3366 emlxs_hba_t *hba,
3367 emlxs_file_t *fpDmpFile)
3368{
3369 uint32_t status;

--- 17 unchanged lines hidden (view full) ---

3387 status =
3388 emlxs_dump_host_block(fpDmpFile, pBuf, bufLen, SID_PORT_PTRS,
3389 LEGEND_SLI_STRUCTURES, LEGEND_PORT_PTRS, fSwap);
3390
3391 kmem_free(pBuf, bufLen);
3392
3393 return (status);
3394
3216
3217
3218static uint32_t
3219emlxs_dump_port_pointers(
3220 emlxs_hba_t *hba,
3221 emlxs_file_t *fpDmpFile)
3222{
3223 uint32_t status;

--- 17 unchanged lines hidden (view full) ---

3241 status =
3242 emlxs_dump_host_block(fpDmpFile, pBuf, bufLen, SID_PORT_PTRS,
3243 LEGEND_SLI_STRUCTURES, LEGEND_PORT_PTRS, fSwap);
3244
3245 kmem_free(pBuf, bufLen);
3246
3247 return (status);
3248
3395} /* emlxs_dump_port_pointers() */
3249} /* emlxs_dump_port_pointers() */
3396
3397
3398static uint32_t
3399emlxs_dump_rings(
3400 emlxs_hba_t *hba,
3401 emlxs_file_t *fpDmpFile)
3402{
3403 uint32_t status;

--- 18 unchanged lines hidden (view full) ---

3422 emlxs_dump_host_struct(fpDmpFile, pBuf, bufLen, sizeof (IOCB),
3423 bufLen / sizeof (IOCB), SID_RINGS, LEGEND_SLI_STRUCTURES,
3424 LEGEND_RINGS, fSwap);
3425
3426 kmem_free(pBuf, bufLen);
3427
3428 return (status);
3429
3250
3251
3252static uint32_t
3253emlxs_dump_rings(
3254 emlxs_hba_t *hba,
3255 emlxs_file_t *fpDmpFile)
3256{
3257 uint32_t status;

--- 18 unchanged lines hidden (view full) ---

3276 emlxs_dump_host_struct(fpDmpFile, pBuf, bufLen, sizeof (IOCB),
3277 bufLen / sizeof (IOCB), SID_RINGS, LEGEND_SLI_STRUCTURES,
3278 LEGEND_RINGS, fSwap);
3279
3280 kmem_free(pBuf, bufLen);
3281
3282 return (status);
3283
3430} /* emlxs_dump_rings() */
3284} /* emlxs_dump_rings() */
3431
3432
3433static uint32_t
3434emlxs_dump_drv_internals(
3435 emlxs_hba_t *hba,
3436 emlxs_file_t *fpDmpFile)
3437{
3438 uint32_t status;

--- 17 unchanged lines hidden (view full) ---

3456 status =
3457 emlxs_dump_host_block(fpDmpFile, pBuf, bufLen, SID_INTERNAL_SOL,
3458 LEGEND_SLI_STRUCTURES, LEGEND_DRIVER_SPEC, fSwap);
3459
3460 kmem_free(pBuf, bufLen);
3461
3462 return (status);
3463
3285
3286
3287static uint32_t
3288emlxs_dump_drv_internals(
3289 emlxs_hba_t *hba,
3290 emlxs_file_t *fpDmpFile)
3291{
3292 uint32_t status;

--- 17 unchanged lines hidden (view full) ---

3310 status =
3311 emlxs_dump_host_block(fpDmpFile, pBuf, bufLen, SID_INTERNAL_SOL,
3312 LEGEND_SLI_STRUCTURES, LEGEND_DRIVER_SPEC, fSwap);
3313
3314 kmem_free(pBuf, bufLen);
3315
3316 return (status);
3317
3464} /* emlxs_dump_drv_internals() */
3318} /* emlxs_dump_drv_internals() */
3465
3466
3467static uint32_t
3468emlxs_dump_sli_interface(
3469 emlxs_hba_t *hba,
3470 emlxs_file_t *fpTxtFile,
3471 emlxs_file_t *fpDmpFile,
3472 uint32_t dump_type)
3473{
3319
3320
3321static uint32_t
3322emlxs_dump_sli_interface(
3323 emlxs_hba_t *hba,
3324 emlxs_file_t *fpTxtFile,
3325 emlxs_file_t *fpDmpFile,
3326 uint32_t dump_type)
3327{
3474 (void) emlxs_dump_sli_regs(hba, fpDmpFile);
3475 (void) emlxs_dump_slim(hba, fpTxtFile, fpDmpFile, dump_type);
3476 (void) emlxs_dump_pcb(hba, fpDmpFile);
3477 (void) emlxs_dump_mbox(hba, fpDmpFile);
3478 (void) emlxs_dump_host_pointers(hba, fpDmpFile);
3479 (void) emlxs_dump_port_pointers(hba, fpDmpFile);
3480 (void) emlxs_dump_rings(hba, fpDmpFile);
3328
3329 if (hba->sli_mode <= EMLXS_HBA_SLI3_MODE) {
3330 /* HBA should be in OFFLINE state here */
3331
3332 (void) emlxs_dump_sli_regs(hba, fpDmpFile);
3333 (void) emlxs_dump_slim(hba, fpTxtFile, fpDmpFile, dump_type);
3334 (void) emlxs_dump_pcb(hba, fpDmpFile);
3335 (void) emlxs_dump_mbox(hba, fpDmpFile);
3336 (void) emlxs_dump_host_pointers(hba, fpDmpFile);
3337 (void) emlxs_dump_port_pointers(hba, fpDmpFile);
3338 (void) emlxs_dump_rings(hba, fpDmpFile);
3339 }
3340
3481 (void) emlxs_dump_drv_internals(hba, fpDmpFile);
3482
3483 return (0);
3484
3341 (void) emlxs_dump_drv_internals(hba, fpDmpFile);
3342
3343 return (0);
3344
3485} /* emlxs_dump_sli_interface() */
3345} /* emlxs_dump_sli_interface() */
3486
3487
3488static uint32_t
3346
3347
3348static uint32_t
3489emlxs_dump_hornet_logs(
3349emlxs_dump_menlo_log(
3490 emlxs_hba_t *hba,
3491 emlxs_file_t *fpCeeFile)
3492{
3350 emlxs_hba_t *hba,
3351 emlxs_file_t *fpCeeFile)
3352{
3493 emlxs_port_t *port = &PPORT;
3494 uint32_t RmStatus;
3495 int i, j;
3496 int isWrapped = FALSE;
3497 char buf1[2048] = { 0 };
3498 char buf2[2048] = { 0 };
3499
3500 /* Get Config Command vars */
3501 menlo_get_config_rsp_t GcBuf;

--- 13 unchanged lines hidden (view full) ---

3515 char *pLogString;
3516
3517 /* Get Panic Log Command vars */
3518 uint32_t PlBufSize;
3519 menlo_rsp_t *pPlBuf = NULL;
3520 uint32_t PanicLogEntryCount;
3521 uint32_t PanicLogEntrySize;
3522
3353 uint32_t RmStatus;
3354 int i, j;
3355 int isWrapped = FALSE;
3356 char buf1[2048] = { 0 };
3357 char buf2[2048] = { 0 };
3358
3359 /* Get Config Command vars */
3360 menlo_get_config_rsp_t GcBuf;

--- 13 unchanged lines hidden (view full) ---

3374 char *pLogString;
3375
3376 /* Get Panic Log Command vars */
3377 uint32_t PlBufSize;
3378 menlo_rsp_t *pPlBuf = NULL;
3379 uint32_t PanicLogEntryCount;
3380 uint32_t PanicLogEntrySize;
3381
3382 if (hba->model_info.device_id != PCI_DEVICE_ID_LP21000_M) {
3383 return (DFC_INVALID_ADAPTER);
3384 }
3385
3523 /* First, issue a GetConfig command, which gives us */
3524 /* the Log Config and Panic Log sizes */
3525
3526 RmStatus =
3527 emlxs_menlo_get_cfg(hba, pGcBuf, sizeof (menlo_get_config_rsp_t));
3528
3529 if (RmStatus != 0) {
3530 goto done;
3531 }
3532
3533 LcBufSize = GcBuf.log_cfg_size + 8;
3534 PlBufSize = GcBuf.panic_log_size;
3535
3536 pLcBuf = (menlo_rsp_t *)kmem_zalloc(LcBufSize, KM_SLEEP);
3386 /* First, issue a GetConfig command, which gives us */
3387 /* the Log Config and Panic Log sizes */
3388
3389 RmStatus =
3390 emlxs_menlo_get_cfg(hba, pGcBuf, sizeof (menlo_get_config_rsp_t));
3391
3392 if (RmStatus != 0) {
3393 goto done;
3394 }
3395
3396 LcBufSize = GcBuf.log_cfg_size + 8;
3397 PlBufSize = GcBuf.panic_log_size;
3398
3399 pLcBuf = (menlo_rsp_t *)kmem_zalloc(LcBufSize, KM_SLEEP);
3537 if (pLcBuf == 0) {
3538 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
3539 "emlxs_dump_hornet_logs: Unable to allocate LcBuf.");
3540 RmStatus = 1;
3541 goto done;
3542 }
3543
3544 RmStatus = emlxs_menlo_get_logcfg(hba, pLcBuf, LcBufSize);
3545
3546 if (RmStatus != 0) {
3547 goto done;
3548 }
3549
3550 buf1[0] = 0;

--- 26 unchanged lines hidden (view full) ---

3577 /* Now issue a series of GetLogData commands, */
3578 /* which gives us the actual Logs */
3579
3580 for (i = 0; i < (int)NumLogs; i++) {
3581 LdBufSize =
3582 (pLcEntry[i].num_entries *pLcEntry[i].entry_size) + 8;
3583
3584 pLdBuf = (menlo_rsp_t *)kmem_zalloc(LdBufSize, KM_SLEEP);
3400
3401 RmStatus = emlxs_menlo_get_logcfg(hba, pLcBuf, LcBufSize);
3402
3403 if (RmStatus != 0) {
3404 goto done;
3405 }
3406
3407 buf1[0] = 0;

--- 26 unchanged lines hidden (view full) ---

3434 /* Now issue a series of GetLogData commands, */
3435 /* which gives us the actual Logs */
3436
3437 for (i = 0; i < (int)NumLogs; i++) {
3438 LdBufSize =
3439 (pLcEntry[i].num_entries *pLcEntry[i].entry_size) + 8;
3440
3441 pLdBuf = (menlo_rsp_t *)kmem_zalloc(LdBufSize, KM_SLEEP);
3585 if (pLdBuf == 0) {
3586 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
3587 "emlxs_dump_hornet_logs: "\
3588 "Unable to allocate LdBuf.");
3589 RmStatus = 1;
3590 goto done;
3591 }
3592
3593 RmStatus = emlxs_menlo_get_log(hba, i, pLdBuf, LdBufSize);
3594
3595 if (RmStatus != 0) {
3596 goto done;
3597 }
3598
3599 /* print a caption for the current log */

--- 62 unchanged lines hidden (view full) ---

3662 buf2[0] = 0;
3663 for (j = 0; j < 75; j++) {
3664 (void) strcat(buf2, "-");
3665 }
3666 (void) strcat(buf1, buf2);
3667 RmStatus = emlxs_dump_string_txtfile(fpCeeFile, buf1, 0, 0, 1);
3668
3669 pPlBuf = (menlo_rsp_t *)kmem_zalloc(PlBufSize, KM_SLEEP);
3442
3443 RmStatus = emlxs_menlo_get_log(hba, i, pLdBuf, LdBufSize);
3444
3445 if (RmStatus != 0) {
3446 goto done;
3447 }
3448
3449 /* print a caption for the current log */

--- 62 unchanged lines hidden (view full) ---

3512 buf2[0] = 0;
3513 for (j = 0; j < 75; j++) {
3514 (void) strcat(buf2, "-");
3515 }
3516 (void) strcat(buf1, buf2);
3517 RmStatus = emlxs_dump_string_txtfile(fpCeeFile, buf1, 0, 0, 1);
3518
3519 pPlBuf = (menlo_rsp_t *)kmem_zalloc(PlBufSize, KM_SLEEP);
3670 if (pPlBuf == 0) {
3671 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
3672 "emlxs_dump_hornet_logs: Unable to allocate PlBuf.");
3673 RmStatus = 1;
3674 goto done;
3675 }
3676
3677 RmStatus = emlxs_menlo_get_paniclog(hba, pPlBuf, PlBufSize);
3678
3679 if (RmStatus == 0) {
3680 buf1[0] = 0;
3681 (void) sprintf(buf2, "\nType = %x",
3682 pPlBuf->panic_log.type);
3683 (void) strcat(buf1, buf2);

--- 99 unchanged lines hidden (view full) ---

3783 }
3784
3785 if (pPlBuf != 0) {
3786 kmem_free(pPlBuf, PlBufSize);
3787 }
3788
3789 return (RmStatus);
3790
3520
3521 RmStatus = emlxs_menlo_get_paniclog(hba, pPlBuf, PlBufSize);
3522
3523 if (RmStatus == 0) {
3524 buf1[0] = 0;
3525 (void) sprintf(buf2, "\nType = %x",
3526 pPlBuf->panic_log.type);
3527 (void) strcat(buf1, buf2);

--- 99 unchanged lines hidden (view full) ---

3627 }
3628
3629 if (pPlBuf != 0) {
3630 kmem_free(pPlBuf, PlBufSize);
3631 }
3632
3633 return (RmStatus);
3634
3791} /* emlxs_dump_hornet_logs() */
3635} /* emlxs_dump_menlo_log() */
3792
3793
3794static uint32_t
3636
3637
3638static uint32_t
3795emlxs_dump_saturn_logs(
3639emlxs_dump_saturn_log(
3796 emlxs_hba_t *hba,
3797 emlxs_file_t *fpTxtFile,
3798 emlxs_file_t *fpDmpFile)
3799{
3800 emlxs_port_t *port = &PPORT;
3801 MAILBOXQ *mbq;
3802 MAILBOX *mb;
3640 emlxs_hba_t *hba,
3641 emlxs_file_t *fpTxtFile,
3642 emlxs_file_t *fpDmpFile)
3643{
3644 emlxs_port_t *port = &PPORT;
3645 MAILBOXQ *mbq;
3646 MAILBOX *mb;
3647 MATCHMAP *mp = NULL;
3803 uint32_t status;
3804 uint32_t logSize = 0;
3648 uint32_t status;
3649 uint32_t logSize = 0;
3805 uint8_t *pDataBuf = NULL;
3806 uintptr_t tempAddress;
3650 uintptr_t tempAddress;
3807 char *NV_LOG_NOT_INCLUDED_IN_DMP =
3808 "Non-Volatile Log Dump is not included in the DMP file";
3809 char *NV_LOG_INCLUDED_IN_DMP =
3810 "Non-Volatile Log Dump is included in the DMP file";
3811 int fSwap = FALSE;
3812 uint32_t i;
3813 uint32_t block_size;
3814 uint32_t offset;
3815
3816#ifdef EMLXS_BIG_ENDIAN
3817 fSwap = TRUE;
3818#endif /* EMLXS_BIG_ENDIAN */
3819
3651 int fSwap = FALSE;
3652 uint32_t i;
3653 uint32_t block_size;
3654 uint32_t offset;
3655
3656#ifdef EMLXS_BIG_ENDIAN
3657 fSwap = TRUE;
3658#endif /* EMLXS_BIG_ENDIAN */
3659
3820 if ((mbq =
3821 (MAILBOXQ *)kmem_zalloc(sizeof (MAILBOXQ), KM_SLEEP)) == 0) {
3822 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_dfc_error_msg,
3823 "Unable to allocate mailbox buffer.");
3824
3660 if (hba->model_info.chip != EMLXS_SATURN_CHIP) {
3825 return (1);
3826 }
3661 return (1);
3662 }
3663
3664 mbq =
3665 (MAILBOXQ *)kmem_zalloc(sizeof (MAILBOXQ), KM_SLEEP);
3666
3827 mb = (MAILBOX *) mbq;
3828
3829 /* Step 1: Call MBX_READ_EVENT_LOG_STATUS to get the log size. */
3830 for (i = 0; i < 10; i++) {
3831 bzero((void *)mb, MAILBOX_CMD_BSIZE);
3832 mb->mbxCommand = MBX_READ_EVENT_LOG_STATUS;
3667 mb = (MAILBOX *) mbq;
3668
3669 /* Step 1: Call MBX_READ_EVENT_LOG_STATUS to get the log size. */
3670 for (i = 0; i < 10; i++) {
3671 bzero((void *)mb, MAILBOX_CMD_BSIZE);
3672 mb->mbxCommand = MBX_READ_EVENT_LOG_STATUS;
3673 mbq->mbox_cmpl = NULL;
3833
3674
3834 if (emlxs_sli_issue_mbox_cmd(hba, mb, MBX_WAIT, 0) ==
3675 if (EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_WAIT, 0) ==
3835 MBX_SUCCESS) {
3836 break;
3837 }
3838
3839 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_init_debug_msg,
3840 "Unable to read event log status. status=%x",
3841 mb->mbxStatus);
3842

--- 29 unchanged lines hidden (view full) ---

3872 LEGEND_NV_LOG_STATUS_ERROR, 0);
3873
3874 kmem_free(mbq, sizeof (MAILBOXQ));
3875 return (1);
3876 }
3877
3878 /* Step 2: Use the log size from step 1 to call MBX_READ_EVENT_LOG */
3879 logSize = mb->un.varLogStat.size;
3676 MBX_SUCCESS) {
3677 break;
3678 }
3679
3680 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_init_debug_msg,
3681 "Unable to read event log status. status=%x",
3682 mb->mbxStatus);
3683

--- 29 unchanged lines hidden (view full) ---

3713 LEGEND_NV_LOG_STATUS_ERROR, 0);
3714
3715 kmem_free(mbq, sizeof (MAILBOXQ));
3716 return (1);
3717 }
3718
3719 /* Step 2: Use the log size from step 1 to call MBX_READ_EVENT_LOG */
3720 logSize = mb->un.varLogStat.size;
3880 if ((pDataBuf = (uint8_t *)kmem_zalloc(logSize, KM_SLEEP)) == NULL) {
3721
3722 if ((mp = emlxs_mem_buf_alloc(hba, logSize)) == 0) {
3881 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_init_debug_msg,
3723 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_init_debug_msg,
3882 "Unable to allocate log buffer. size=%d", logSize);
3724 "Unable to allocate receive buffer. "
3725 "size=%d",
3726 logSize);
3883
3884 kmem_free(mbq, sizeof (MAILBOXQ));
3885 return (1);
3886 }
3887
3888 for (offset = 0; offset < logSize; offset = offset + 1024) {
3889 if (logSize - offset < 1024) {
3890 block_size = logSize - offset;
3891 } else {
3892 block_size = 1024;
3893 }
3894
3727
3728 kmem_free(mbq, sizeof (MAILBOXQ));
3729 return (1);
3730 }
3731
3732 for (offset = 0; offset < logSize; offset = offset + 1024) {
3733 if (logSize - offset < 1024) {
3734 block_size = logSize - offset;
3735 } else {
3736 block_size = 1024;
3737 }
3738
3895 tempAddress = (uintptr_t)(pDataBuf + offset);
3739 tempAddress = (uintptr_t)(mp->phys + offset);
3896
3897 bzero((void *)mb, MAILBOX_CMD_BSIZE);
3898 mb->mbxCommand = MBX_READ_EVENT_LOG; /* 0x38 */
3899 mb->un.varRdEvtLog.read_log = 1; /* read log */
3900 mb->un.varRdEvtLog.mbox_rsp = 0; /* not using Mailbox */
3901 mb->un.varRdEvtLog.offset = offset;
3902 mb->un.varRdEvtLog.un.sp64.tus.f.bdeFlags = 0x0;
3903 mb->un.varRdEvtLog.un.sp64.tus.f.bdeSize = block_size;
3740
3741 bzero((void *)mb, MAILBOX_CMD_BSIZE);
3742 mb->mbxCommand = MBX_READ_EVENT_LOG; /* 0x38 */
3743 mb->un.varRdEvtLog.read_log = 1; /* read log */
3744 mb->un.varRdEvtLog.mbox_rsp = 0; /* not using Mailbox */
3745 mb->un.varRdEvtLog.offset = offset;
3746 mb->un.varRdEvtLog.un.sp64.tus.f.bdeFlags = 0x0;
3747 mb->un.varRdEvtLog.un.sp64.tus.f.bdeSize = block_size;
3904 mb->un.varRdEvtLog.un.sp64.addrLow = putPaddrLow(tempAddress);
3905 mb->un.varRdEvtLog.un.sp64.addrHigh = putPaddrHigh(tempAddress);
3748 mb->un.varRdEvtLog.un.sp64.addrLow = PADDR_LO(tempAddress);
3749 mb->un.varRdEvtLog.un.sp64.addrHigh = PADDR_HI(tempAddress);
3750 mbq->mbox_cmpl = NULL;
3906
3751
3907 if (emlxs_sli_issue_mbox_cmd(hba, mb, MBX_WAIT, 0) !=
3752 if (EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_WAIT, 0) !=
3908 MBX_SUCCESS) {
3909 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_init_debug_msg,
3910 "Unable to read event log. status=%x",
3911 mb->mbxStatus);
3912
3753 MBX_SUCCESS) {
3754 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_init_debug_msg,
3755 "Unable to read event log. status=%x",
3756 mb->mbxStatus);
3757
3913 kmem_free(pDataBuf, logSize);
3758 (void) emlxs_mem_buf_free(hba, mp);
3914 kmem_free(mbq, sizeof (MAILBOXQ));
3915 return (1);
3916 }
3917 }
3918
3919 /* Step 3: Dump the log to the DMP file as raw data. */
3920
3921 /* Write a string to text file to direct the user to the DMP */
3922 /* file for the actual log. */
3923 status =
3924 emlxs_dump_string_txtfile(fpTxtFile, NV_LOG_INCLUDED_IN_DMP,
3925 LEGEND_NON_VOLATILE_LOG, LEGEND_NULL, 0);
3926
3927 /* Write the real log to the DMP file. */
3759 kmem_free(mbq, sizeof (MAILBOXQ));
3760 return (1);
3761 }
3762 }
3763
3764 /* Step 3: Dump the log to the DMP file as raw data. */
3765
3766 /* Write a string to text file to direct the user to the DMP */
3767 /* file for the actual log. */
3768 status =
3769 emlxs_dump_string_txtfile(fpTxtFile, NV_LOG_INCLUDED_IN_DMP,
3770 LEGEND_NON_VOLATILE_LOG, LEGEND_NULL, 0);
3771
3772 /* Write the real log to the DMP file. */
3773 EMLXS_MPDATA_SYNC(mp->dma_handle, 0, logSize, DDI_DMA_SYNC_FORKERNEL);
3774
3928 status =
3775 status =
3929 emlxs_dump_host_block(fpDmpFile, pDataBuf, logSize,
3776 emlxs_dump_host_block(fpDmpFile, mp->virt, logSize,
3930 SID_NON_VOLATILE_LOG, LEGEND_NON_VOLATILE_LOG, LEGEND_NULL,
3931 fSwap);
3932
3777 SID_NON_VOLATILE_LOG, LEGEND_NON_VOLATILE_LOG, LEGEND_NULL,
3778 fSwap);
3779
3933 kmem_free(pDataBuf, logSize);
3780 (void) emlxs_mem_buf_free(hba, mp);
3934 kmem_free(mbq, sizeof (MAILBOXQ));
3935 return (status);
3936
3781 kmem_free(mbq, sizeof (MAILBOXQ));
3782 return (status);
3783
3937} /* emlxs_dump_saturn_logs() */
3784} /* emlxs_dump_saturn_log() */
3938
3939
3785
3786
3787static uint32_t
3788emlxs_dump_tigershark_log(
3789 emlxs_hba_t *hba,
3790 emlxs_file_t *fpTxtFile,
3791 emlxs_file_t *fpCeeFile)
3792{
3793 emlxs_port_t *port = &PPORT;
3794 uint32_t rval = 0;
3795 uint32_t offset;
3796 uint32_t log_size;
3797 uint32_t xfer_size;
3798 uint32_t buffer_size;
3799 uint8_t *buffer = NULL;
3800 uint8_t *bptr;
3801 uint8_t *payload;
3802 MAILBOXQ *mbq = NULL;
3803 MAILBOX4 *mb = NULL;
3804 MATCHMAP *mp = NULL;
3805 IOCTL_COMMON_MANAGE_FAT *fat;
3806 mbox_req_hdr_t *hdr_req;
3807
3808 if (hba->model_info.chip != EMLXS_TIGERSHARK_CHIP) {
3809 return (1);
3810 }
3811
3812 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
3813 "Querying FAT...");
3814
3815 mbq = (MAILBOXQ *)kmem_zalloc(sizeof (MAILBOXQ),
3816 KM_SLEEP);
3817
3818 mb = (MAILBOX4*)mbq;
3819
3820 if ((mp = emlxs_mem_buf_alloc(hba, (sizeof (mbox_req_hdr_t) +
3821 sizeof (IOCTL_COMMON_MANAGE_FAT) + BE_MAX_XFER_SIZE))) == NULL) {
3822 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
3823 "Unable to allocate FAT buffer.");
3824
3825 rval = 1;
3826 goto done;
3827 }
3828
3829 /* Query FAT */
3830 mb->un.varSLIConfig.be.embedded = 0;
3831 mbq->nonembed = (uint8_t *)mp;
3832 mbq->mbox_cmpl = NULL;
3833
3834 mb->mbxCommand = MBX_SLI_CONFIG;
3835 mb->mbxOwner = OWN_HOST;
3836
3837 hdr_req = (mbox_req_hdr_t *)mp->virt;
3838 hdr_req->subsystem = IOCTL_SUBSYSTEM_COMMON;
3839 hdr_req->opcode = COMMON_OPCODE_MANAGE_FAT;
3840 hdr_req->timeout = 0;
3841 hdr_req->req_length = sizeof (IOCTL_COMMON_MANAGE_FAT);
3842
3843 fat = (IOCTL_COMMON_MANAGE_FAT *)(hdr_req + 1);
3844 fat->params.request.fat_operation = QUERY_FAT;
3845 fat->params.request.read_log_offset = 0;
3846 fat->params.request.read_log_length = 0;
3847 fat->params.request.data_buffer_size = BE_MAX_XFER_SIZE;
3848
3849 if (EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_WAIT, 0) !=
3850 MBX_SUCCESS) {
3851 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
3852 "FAT Query failed. status=%x",
3853 mb->mbxStatus);
3854
3855 rval = 1;
3856 goto done;
3857 }
3858
3859 log_size = fat->params.response.log_size;
3860 buffer_size = fat->params.response.log_size;
3861
3862 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
3863 "FAT: log_size=%d", log_size);
3864
3865 if (log_size) {
3866 if ((buffer = (uint8_t *)kmem_alloc(
3867 buffer_size, KM_NOSLEEP)) == NULL) {
3868 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
3869 "Unable to allocate log buffer.");
3870
3871 rval = 1;
3872 goto done;
3873 }
3874 bzero(buffer, buffer_size);
3875 }
3876
3877 /* Upload Log */
3878 bptr = buffer;
3879 offset = 0;
3880
3881 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
3882 "Uploading log... (%d bytes)", log_size);
3883
3884 while (log_size) {
3885 bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE);
3886 bzero((void *) mp->virt, mp->size);
3887
3888 xfer_size = min(BE_MAX_XFER_SIZE, log_size);
3889
3890 mb->un.varSLIConfig.be.embedded = 0;
3891 mbq->nonembed = (uint8_t *)mp;
3892 mbq->mbox_cmpl = NULL;
3893
3894 mb->mbxCommand = MBX_SLI_CONFIG;
3895 mb->mbxOwner = OWN_HOST;
3896
3897 hdr_req = (mbox_req_hdr_t *)mp->virt;
3898 hdr_req->subsystem = IOCTL_SUBSYSTEM_COMMON;
3899 hdr_req->opcode = COMMON_OPCODE_MANAGE_FAT;
3900 hdr_req->timeout = 0;
3901 hdr_req->req_length =
3902 sizeof (IOCTL_COMMON_MANAGE_FAT) + xfer_size;
3903
3904 fat = (IOCTL_COMMON_MANAGE_FAT *)(hdr_req + 1);
3905 fat->params.request.fat_operation = RETRIEVE_FAT;
3906 fat->params.request.read_log_offset = offset;
3907 fat->params.request.read_log_length = xfer_size;
3908 fat->params.request.data_buffer_size = BE_MAX_XFER_SIZE;
3909
3910 if (EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_WAIT, 0) !=
3911 MBX_SUCCESS) {
3912 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
3913 "Failed to upload log. status=%x",
3914 mb->mbxStatus);
3915
3916 (void) emlxs_dump_string_txtfile(fpTxtFile,
3917 NV_LOG_NOT_INCLUDED_IN_FAT,
3918 LEGEND_NON_VOLATILE_LOG,
3919 LEGEND_NV_LOG_STATUS_ERROR, 0);
3920
3921 rval = 1;
3922 goto done;
3923 }
3924
3925 payload = (uint8_t *)(&fat->params.response.data_buffer);
3926
3927 BE_SWAP32_BCOPY(payload, bptr, xfer_size);
3928
3929 log_size -= xfer_size;
3930 offset += xfer_size;
3931 bptr += xfer_size;
3932 }
3933
3934 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
3935 "Log upload complete.");
3936
3937 /* Write a string to text file to direct the user to the CEE */
3938 /* file for the actual log. */
3939 rval =
3940 emlxs_dump_string_txtfile(fpTxtFile, NV_LOG_INCLUDED_IN_FAT,
3941 LEGEND_NON_VOLATILE_LOG, LEGEND_NULL, 0);
3942
3943
3944 /* Write the log to the CEE file. */
3945 /* First word is the log size */
3946 bptr = buffer + sizeof (uint32_t);
3947 log_size = buffer_size - sizeof (uint32_t);
3948 rval = emlxs_dump_word_dmpfile(fpCeeFile, (uint8_t *)bptr,
3949 log_size, 0);
3950
3951done:
3952
3953 if (mbq) {
3954 (void) emlxs_mem_put(hba, MEM_MBOX, (uint8_t *)mbq);
3955 }
3956
3957 if (mp) {
3958 (void) emlxs_mem_buf_free(hba, mp);
3959 }
3960
3961 if (buffer) {
3962 kmem_free(buffer, buffer_size);
3963 }
3964
3965 if (rval == 0) {
3966 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
3967 "Dump complete.");
3968 }
3969
3970 return (rval);
3971
3972} /* emlxs_dump_tigershark_log() */
3973
3974
3940extern uint32_t
3941emlxs_dump_user_event(
3942 emlxs_hba_t *hba)
3943{
3944 emlxs_port_t *port = &PPORT;
3945 uint32_t status;
3975extern uint32_t
3976emlxs_dump_user_event(
3977 emlxs_hba_t *hba)
3978{
3979 emlxs_port_t *port = &PPORT;
3980 uint32_t status;
3946
3947 /* Dump File Pointers */
3948 emlxs_file_t *fpTxtFile;
3949 emlxs_file_t *fpDmpFile;
3950 emlxs_file_t *fpCeeFile;
3951
3981 emlxs_file_t *fpTxtFile;
3982 emlxs_file_t *fpDmpFile;
3983 emlxs_file_t *fpCeeFile;
3984
3952 /* flag indicating Hornet board */
3953 uint32_t bHornet;
3954
3955 mutex_enter(&EMLXS_DUMP_LOCK);
3956
3957 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
3958 "User Event: Firmware core dump initiated...");
3959
3985 mutex_enter(&EMLXS_DUMP_LOCK);
3986
3987 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
3988 "User Event: Firmware core dump initiated...");
3989
3960 bHornet = emlxs_ishornet(hba);
3961
3962 status =
3963 emlxs_dump_file_create(hba, &fpTxtFile, &fpDmpFile, &fpCeeFile);
3964 if (status != 0) {
3965 mutex_exit(&EMLXS_DUMP_LOCK);
3966 return (1);
3967 }
3968
3969 (void) emlxs_dump_rev_info(hba, fpTxtFile, fpDmpFile);
3970 (void) emlxs_dump_hba_info(hba, fpTxtFile, fpDmpFile, DUMP_TYPE_USER);
3971 (void) emlxs_dump_parm_table(hba, fpTxtFile, fpDmpFile);
3972 (void) emlxs_dump_cfg_regions(hba, fpTxtFile, fpDmpFile);
3973
3990 status =
3991 emlxs_dump_file_create(hba, &fpTxtFile, &fpDmpFile, &fpCeeFile);
3992 if (status != 0) {
3993 mutex_exit(&EMLXS_DUMP_LOCK);
3994 return (1);
3995 }
3996
3997 (void) emlxs_dump_rev_info(hba, fpTxtFile, fpDmpFile);
3998 (void) emlxs_dump_hba_info(hba, fpTxtFile, fpDmpFile, DUMP_TYPE_USER);
3999 (void) emlxs_dump_parm_table(hba, fpTxtFile, fpDmpFile);
4000 (void) emlxs_dump_cfg_regions(hba, fpTxtFile, fpDmpFile);
4001
3974 /* Check for Saturn Enterprise. If yes, trigger the NV Log. */
3975 if (hba->model_info.chip == EMLXS_SATURN_CHIP) {
4002 if (hba->model_info.chip == EMLXS_SATURN_CHIP) {
3976 (void) emlxs_dump_saturn_logs(hba, fpTxtFile, fpDmpFile);
4003 (void) emlxs_set_hba_mode(hba, DDI_ONDI);
4004 (void) emlxs_dump_saturn_log(hba, fpTxtFile, fpDmpFile);
3977 }
3978
4005 }
4006
3979 /* Take HBA (port) offline before we proceed */
3980 status = emlxs_set_hba_mode(hba, DDI_SHOW);
3981 if (status != DDI_OFFDI) {
3982 (void) emlxs_set_hba_mode(hba, DDI_OFFDI);
4007 if (hba->model_info.chip == EMLXS_TIGERSHARK_CHIP) {
4008 (void) emlxs_dump_tigershark_log(hba, fpTxtFile, fpCeeFile);
3983 }
3984
4009 }
4010
4011 if (hba->sli_mode <= EMLXS_HBA_SLI3_MODE) {
4012 (void) emlxs_set_hba_mode(hba, DDI_DIAGDI);
4013 }
4014
3985 (void) emlxs_dump_sli_interface(hba, fpTxtFile, fpDmpFile,
3986 DUMP_TYPE_USER);
3987
4015 (void) emlxs_dump_sli_interface(hba, fpTxtFile, fpDmpFile,
4016 DUMP_TYPE_USER);
4017
3988 /* Take HBA (port) to Warm-start Noram Mode before we proceed */
3989 status = emlxs_set_hba_mode(hba, DDI_SHOW);
3990 if (status != DDI_WARMDI) {
4018 if (hba->sli_mode <= EMLXS_HBA_SLI3_MODE) {
3991 (void) emlxs_set_hba_mode(hba, DDI_WARMDI);
3992 }
3993
3994 (void) emlxs_dump_hba(hba, fpTxtFile, fpDmpFile);
3995
4019 (void) emlxs_set_hba_mode(hba, DDI_WARMDI);
4020 }
4021
4022 (void) emlxs_dump_hba(hba, fpTxtFile, fpDmpFile);
4023
3996 /* Set HBA (port) back online */
3997 status = emlxs_set_hba_mode(hba, DDI_SHOW);
3998 if (status != DDI_ONDI) {
3999 (void) emlxs_set_hba_mode(hba, DDI_ONDI);
4000 }
4024 (void) emlxs_set_hba_mode(hba, DDI_ONDI);
4001
4025
4002 if (bHornet) {
4003 status =
4004 emlxs_menlo_set_mode(hba, MENLO_MAINTENANCE_MODE_ENABLE);
4005 if (status == 0) {
4006 (void) emlxs_dump_hornet_logs(hba, fpCeeFile);
4007 (void) emlxs_menlo_set_mode(hba,
4008 MENLO_MAINTENANCE_MODE_DISABLE);
4009 }
4026 status = emlxs_menlo_set_mode(hba, MENLO_MAINTENANCE_MODE_ENABLE);
4027 if (status == 0) {
4028 (void) emlxs_dump_menlo_log(hba, fpCeeFile);
4029 (void) emlxs_menlo_set_mode(hba,
4030 MENLO_MAINTENANCE_MODE_DISABLE);
4010 }
4011
4031 }
4032
4012 (void) emlxs_dump_file_terminate(fpTxtFile, fpDmpFile, fpCeeFile);
4033 (void) emlxs_dump_file_terminate(hba, fpTxtFile, fpDmpFile, fpCeeFile);
4013 (void) emlxs_dump_file_close(fpTxtFile, fpDmpFile, fpCeeFile);
4014
4015 mutex_exit(&EMLXS_DUMP_LOCK);
4016 return (0);
4017
4034 (void) emlxs_dump_file_close(fpTxtFile, fpDmpFile, fpCeeFile);
4035
4036 mutex_exit(&EMLXS_DUMP_LOCK);
4037 return (0);
4038
4018} /* emlxs_dump_user_event() */
4039} /* emlxs_dump_user_event() */
4019
4020
4021extern uint32_t
4022emlxs_dump_temp_event(
4023 emlxs_hba_t *hba,
4024 uint32_t tempType,
4025 uint32_t temp)
4026{
4027 emlxs_port_t *port = &PPORT;
4028 uint32_t status;
4040
4041
4042extern uint32_t
4043emlxs_dump_temp_event(
4044 emlxs_hba_t *hba,
4045 uint32_t tempType,
4046 uint32_t temp)
4047{
4048 emlxs_port_t *port = &PPORT;
4049 uint32_t status;
4029
4030 /* Dump File Pointers */
4031 emlxs_file_t *fpTxtFile;
4032
4033 /* misc vars */
4034 char sBuf1[512]; /* general purpose string buffer */
4035 char sBuf2[256]; /* general purpose string buffer */
4036 char sBuf3[256]; /* general purpose string buffer */
4037
4050 emlxs_file_t *fpTxtFile;
4051
4052 /* misc vars */
4053 char sBuf1[512]; /* general purpose string buffer */
4054 char sBuf2[256]; /* general purpose string buffer */
4055 char sBuf3[256]; /* general purpose string buffer */
4056
4057 if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) {
4058 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
4059 "Temperature Event: type=%d temp=%d. "\
4060 "Invalid SLI4 event.",
4061 tempType, temp);
4062
4063 return (1);
4064 }
4065
4038 mutex_enter(&EMLXS_DUMP_LOCK);
4039
4040 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
4041 "Temperature Event: type=%d temp=%d. "\
4042 "Firmware core dump initiated...",
4043 tempType, temp);
4044
4045 status = emlxs_dump_file_create(hba, &fpTxtFile, 0, 0);
4046 if (status != 0) {
4047 mutex_exit(&EMLXS_DUMP_LOCK);
4048 return (1);
4049 }
4050
4051 /* Now generate the Dump */
4066 mutex_enter(&EMLXS_DUMP_LOCK);
4067
4068 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
4069 "Temperature Event: type=%d temp=%d. "\
4070 "Firmware core dump initiated...",
4071 tempType, temp);
4072
4073 status = emlxs_dump_file_create(hba, &fpTxtFile, 0, 0);
4074 if (status != 0) {
4075 mutex_exit(&EMLXS_DUMP_LOCK);
4076 return (1);
4077 }
4078
4079 /* Now generate the Dump */
4052 /* Note: ignore return(status); if one part fails, */
4080 /* Note: ignore return (status); if one part fails, */
4053 /* keep trying to dump more stuff. */
4054
4055 /* Write a warning at the top of the file */
4056 (void) strcpy(sBuf1, "WARNING: HBA Temperature Event:\n");
4057 switch (tempType) {
4058 case TEMP_TYPE_CRITICAL:
4059 (void) sprintf(sBuf2, " Event Type = %d (Critical)\n",
4060 tempType);

--- 14 unchanged lines hidden (view full) ---

4075 (void) strcat(sBuf1, sBuf2);
4076 (void) strcat(sBuf1, sBuf3);
4077
4078 (void) emlxs_dump_string_txtfile(fpTxtFile, sBuf1, 0, 0, 0);
4079
4080 (void) emlxs_dump_rev_info(hba, fpTxtFile, NULL);
4081 (void) emlxs_dump_hba_info(hba, fpTxtFile, NULL, DUMP_TYPE_TEMP);
4082
4081 /* keep trying to dump more stuff. */
4082
4083 /* Write a warning at the top of the file */
4084 (void) strcpy(sBuf1, "WARNING: HBA Temperature Event:\n");
4085 switch (tempType) {
4086 case TEMP_TYPE_CRITICAL:
4087 (void) sprintf(sBuf2, " Event Type = %d (Critical)\n",
4088 tempType);

--- 14 unchanged lines hidden (view full) ---

4103 (void) strcat(sBuf1, sBuf2);
4104 (void) strcat(sBuf1, sBuf3);
4105
4106 (void) emlxs_dump_string_txtfile(fpTxtFile, sBuf1, 0, 0, 0);
4107
4108 (void) emlxs_dump_rev_info(hba, fpTxtFile, NULL);
4109 (void) emlxs_dump_hba_info(hba, fpTxtFile, NULL, DUMP_TYPE_TEMP);
4110
4083 (void) emlxs_dump_file_terminate(fpTxtFile, NULL, NULL);
4111 (void) emlxs_dump_file_terminate(hba, fpTxtFile, NULL, NULL);
4084 (void) emlxs_dump_file_close(fpTxtFile, NULL, NULL);
4085
4086 mutex_exit(&EMLXS_DUMP_LOCK);
4087 return (0);
4088
4112 (void) emlxs_dump_file_close(fpTxtFile, NULL, NULL);
4113
4114 mutex_exit(&EMLXS_DUMP_LOCK);
4115 return (0);
4116
4089} /* emlxs_dump_temp_event() */
4117} /* emlxs_dump_temp_event() */
4090
4091
4092extern uint32_t
4093emlxs_dump_drv_event(
4094 emlxs_hba_t *hba)
4095{
4096 emlxs_port_t *port = &PPORT;
4097 uint32_t status;
4118
4119
4120extern uint32_t
4121emlxs_dump_drv_event(
4122 emlxs_hba_t *hba)
4123{
4124 emlxs_port_t *port = &PPORT;
4125 uint32_t status;
4098
4099 /* Dump File Pointers */
4100 emlxs_file_t *fpTxtFile;
4101 emlxs_file_t *fpDmpFile;
4102 emlxs_file_t *fpCeeFile;
4103
4126 emlxs_file_t *fpTxtFile;
4127 emlxs_file_t *fpDmpFile;
4128 emlxs_file_t *fpCeeFile;
4129
4104 /* Flag for Hornet Converged Enhanced Ethernet dump */
4105 uint32_t bHornet;
4106
4107 mutex_enter(&EMLXS_DUMP_LOCK);
4108
4109 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
4110 "Dump Event: Firmware core dump initiated...");
4111
4130 mutex_enter(&EMLXS_DUMP_LOCK);
4131
4132 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_dump_msg,
4133 "Dump Event: Firmware core dump initiated...");
4134
4112 bHornet = emlxs_ishornet(hba);
4113
4114 status =
4115 emlxs_dump_file_create(hba, &fpTxtFile, &fpDmpFile, &fpCeeFile);
4116 if (status != 0) {
4117 mutex_exit(&EMLXS_DUMP_LOCK);
4118 return (1);
4119 }
4120
4121 if (hba->model_info.chip == EMLXS_SATURN_CHIP) {
4135 status =
4136 emlxs_dump_file_create(hba, &fpTxtFile, &fpDmpFile, &fpCeeFile);
4137 if (status != 0) {
4138 mutex_exit(&EMLXS_DUMP_LOCK);
4139 return (1);
4140 }
4141
4142 if (hba->model_info.chip == EMLXS_SATURN_CHIP) {
4122 /* Make sure the port is online before asking for NV log. */
4123 status = emlxs_set_hba_mode(hba, DDI_SHOW);
4124 if (status != DDI_ONDI) {
4125 (void) emlxs_set_hba_mode(hba, DDI_ONDI);
4126 }
4143 (void) emlxs_set_hba_mode(hba, DDI_ONDI);
4144 (void) emlxs_dump_saturn_log(hba, fpTxtFile, fpDmpFile);
4145 }
4127
4146
4128 (void) emlxs_dump_saturn_logs(hba, fpTxtFile, fpDmpFile);
4147 if (hba->model_info.chip == EMLXS_TIGERSHARK_CHIP) {
4148 (void) emlxs_dump_tigershark_log(hba, fpTxtFile, fpCeeFile);
4129 }
4130
4149 }
4150
4131 /* Take HBA (port) offline before we proceed */
4132 status = emlxs_set_hba_mode(hba, DDI_SHOW);
4133 if (status != DDI_OFFDI) {
4134 (void) emlxs_set_hba_mode(hba, DDI_OFFDI);
4151 if (hba->sli_mode <= EMLXS_HBA_SLI3_MODE) {
4152 (void) emlxs_set_hba_mode(hba, DDI_DIAGDI);
4135 }
4136
4137 (void) emlxs_dump_sli_interface(hba, fpTxtFile, fpDmpFile,
4138 DUMP_TYPE_DRIVER);
4139
4153 }
4154
4155 (void) emlxs_dump_sli_interface(hba, fpTxtFile, fpDmpFile,
4156 DUMP_TYPE_DRIVER);
4157
4140 status = emlxs_set_hba_mode(hba, DDI_SHOW);
4141 if (status != DDI_WARMDI) {
4158 if (hba->sli_mode <= EMLXS_HBA_SLI3_MODE) {
4142 (void) emlxs_set_hba_mode(hba, DDI_WARMDI);
4143 }
4144
4145 (void) emlxs_dump_hba(hba, fpTxtFile, fpDmpFile);
4146
4159 (void) emlxs_set_hba_mode(hba, DDI_WARMDI);
4160 }
4161
4162 (void) emlxs_dump_hba(hba, fpTxtFile, fpDmpFile);
4163
4147 status = emlxs_set_hba_mode(hba, DDI_SHOW);
4148 if (status != DDI_ONDI) {
4149 (void) emlxs_set_hba_mode(hba, DDI_ONDI);
4150 }
4164 (void) emlxs_set_hba_mode(hba, DDI_ONDI);
4151
4165
4152 if (bHornet) {
4153 status =
4154 emlxs_menlo_set_mode(hba, MENLO_MAINTENANCE_MODE_ENABLE);
4155 if (status == 0) {
4156 (void) emlxs_dump_hornet_logs(hba, fpCeeFile);
4157 }
4166 status = emlxs_menlo_set_mode(hba, MENLO_MAINTENANCE_MODE_ENABLE);
4167 if (status == 0) {
4168 (void) emlxs_dump_menlo_log(hba, fpCeeFile);
4158 }
4159
4169 }
4170
4160
4161 /* end if bHornet */
4162 /* Now generate the rest of the Dump */
4163 (void) emlxs_dump_rev_info(hba, fpTxtFile, fpDmpFile);
4164 (void) emlxs_dump_hba_info(hba, fpTxtFile, fpDmpFile, DUMP_TYPE_DRIVER);
4165 (void) emlxs_dump_parm_table(hba, fpTxtFile, fpDmpFile);
4166 (void) emlxs_dump_cfg_regions(hba, fpTxtFile, fpDmpFile);
4167
4171 /* Now generate the rest of the Dump */
4172 (void) emlxs_dump_rev_info(hba, fpTxtFile, fpDmpFile);
4173 (void) emlxs_dump_hba_info(hba, fpTxtFile, fpDmpFile, DUMP_TYPE_DRIVER);
4174 (void) emlxs_dump_parm_table(hba, fpTxtFile, fpDmpFile);
4175 (void) emlxs_dump_cfg_regions(hba, fpTxtFile, fpDmpFile);
4176
4168 /* The last step of the Menlo Dump. */
4169 if (bHornet) {
4170 (void) emlxs_menlo_reset(hba, MENLO_FW_OPERATIONAL);
4171 }
4172 /* end if bHornet */
4173 (void) emlxs_dump_file_terminate(fpTxtFile, fpDmpFile, fpCeeFile);
4177 (void) emlxs_dump_file_terminate(hba, fpTxtFile, fpDmpFile, fpCeeFile);
4174 (void) emlxs_dump_file_close(fpTxtFile, fpDmpFile, fpCeeFile);
4175
4178 (void) emlxs_dump_file_close(fpTxtFile, fpDmpFile, fpCeeFile);
4179
4176 status = emlxs_set_hba_mode(hba, DDI_SHOW);
4177 if (status != DDI_WARMDI) {
4178 (void) emlxs_set_hba_mode(hba, DDI_WARMDI);
4179 }
4180 /* The last step of the Menlo Dump. */
4181 (void) emlxs_menlo_reset(hba, MENLO_FW_OPERATIONAL);
4180
4182
4183 (void) emlxs_set_hba_mode(hba, DDI_WARMDI);
4184
4181 mutex_exit(&EMLXS_DUMP_LOCK);
4182
4185 mutex_exit(&EMLXS_DUMP_LOCK);
4186
4187
4183 return (0);
4184
4188 return (0);
4189
4185} /* emlxs_dump_drv_event() */
4190} /* emlxs_dump_drv_event() */
4186
4187
4188/* ARGSUSED */
4189extern void
4190emlxs_dump_drv_thread(emlxs_hba_t *hba,
4191 void *arg1, void *arg2)
4192{
4193 (void) emlxs_dump_drv_event(hba);
4194
4195 /* Clear the Dump flag */
4196 mutex_enter(&EMLXS_PORT_LOCK);
4197 hba->flag &= ~FC_DUMP_ACTIVE;
4198 mutex_exit(&EMLXS_PORT_LOCK);
4199
4200 return;
4201
4191
4192
4193/* ARGSUSED */
4194extern void
4195emlxs_dump_drv_thread(emlxs_hba_t *hba,
4196 void *arg1, void *arg2)
4197{
4198 (void) emlxs_dump_drv_event(hba);
4199
4200 /* Clear the Dump flag */
4201 mutex_enter(&EMLXS_PORT_LOCK);
4202 hba->flag &= ~FC_DUMP_ACTIVE;
4203 mutex_exit(&EMLXS_PORT_LOCK);
4204
4205 return;
4206
4202} /* emlxs_dump_drv_thread() */
4207} /* emlxs_dump_drv_thread() */
4203
4204
4205/* ARGSUSED */
4206extern void
4207emlxs_dump_user_thread(emlxs_hba_t *hba,
4208 void *arg1, void *arg2)
4209{
4210 (void) emlxs_dump_user_event(hba);
4211
4212 /* Clear the Dump flag */
4213 mutex_enter(&EMLXS_PORT_LOCK);
4214 hba->flag &= ~FC_DUMP_ACTIVE;
4215 mutex_exit(&EMLXS_PORT_LOCK);
4216
4217 return;
4218
4208
4209
4210/* ARGSUSED */
4211extern void
4212emlxs_dump_user_thread(emlxs_hba_t *hba,
4213 void *arg1, void *arg2)
4214{
4215 (void) emlxs_dump_user_event(hba);
4216
4217 /* Clear the Dump flag */
4218 mutex_enter(&EMLXS_PORT_LOCK);
4219 hba->flag &= ~FC_DUMP_ACTIVE;
4220 mutex_exit(&EMLXS_PORT_LOCK);
4221
4222 return;
4223
4219} /* emlxs_dump_user_thread() */
4224} /* emlxs_dump_user_thread() */
4220
4221
4222/* ARGSUSED */
4223extern void
4224emlxs_dump_temp_thread(emlxs_hba_t *hba,
4225 void *arg1, void *arg2)
4226{
4227 dump_temp_event_t *temp_event = (dump_temp_event_t *)arg1;

--- 6 unchanged lines hidden (view full) ---

4234
4235 /* Clear the Dump flag */
4236 mutex_enter(&EMLXS_PORT_LOCK);
4237 hba->flag &= ~FC_DUMP_ACTIVE;
4238 mutex_exit(&EMLXS_PORT_LOCK);
4239
4240 return;
4241
4225
4226
4227/* ARGSUSED */
4228extern void
4229emlxs_dump_temp_thread(emlxs_hba_t *hba,
4230 void *arg1, void *arg2)
4231{
4232 dump_temp_event_t *temp_event = (dump_temp_event_t *)arg1;

--- 6 unchanged lines hidden (view full) ---

4239
4240 /* Clear the Dump flag */
4241 mutex_enter(&EMLXS_PORT_LOCK);
4242 hba->flag &= ~FC_DUMP_ACTIVE;
4243 mutex_exit(&EMLXS_PORT_LOCK);
4244
4245 return;
4246
4242} /* emlxs_dump_temp_thread() */
4247} /* emlxs_dump_temp_thread() */
4243
4244
4245/* Schedules a dump thread */
4246/* temp_type and temp are only valid for type=EMLXS_TEMP_DUMP */
4247extern void
4248emlxs_dump(emlxs_hba_t *hba, uint32_t type, uint32_t temp_type, uint32_t temp)
4249{
4250 emlxs_port_t *port = &PPORT;

--- 94 unchanged lines hidden ---
4248
4249
4250/* Schedules a dump thread */
4251/* temp_type and temp are only valid for type=EMLXS_TEMP_DUMP */
4252extern void
4253emlxs_dump(emlxs_hba_t *hba, uint32_t type, uint32_t temp_type, uint32_t temp)
4254{
4255 emlxs_port_t *port = &PPORT;

--- 94 unchanged lines hidden ---