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.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 /* Copyright 2010 QLogic Corporation */
25 * ISP2xxx Solaris Fibre Channel Adapter (FCA) qlc mdb source file.
27 * ***********************************************************************
30 * * COPYRIGHT (C) 1996-2010 QLOGIC CORPORATION **
31 * * ALL RIGHTS RESERVED **
33 * ***********************************************************************
37 #pragma ident "Copyright 2010 QLogic Corporation; ql_mdb.c"
39 #include <sys/mdb_modapi.h>
48 static int32_t ql_doprint(uintptr_t, int8_t *);
49 static void ql_dump_flags(uint64_t, int8_t **);
50 static int qlclinks_dcmd(uintptr_t, uint_t
, int, const mdb_arg_t
*);
51 static int qlcstate_dcmd(uintptr_t, uint_t
, int, const mdb_arg_t
*);
52 static int qlc_osc_dcmd(uintptr_t, uint_t
, int, const mdb_arg_t
*);
53 static int qlc_wdog_dcmd(uintptr_t, uint_t
, int, const mdb_arg_t
*);
54 static int qlc_getdump_dcmd(uintptr_t, uint_t
, int, const mdb_arg_t
*);
55 static int qlc_gettrace_dcmd(uintptr_t, uint_t
, int, const mdb_arg_t
*);
57 static int qlc_triggerdump_dcmd(uintptr_t, uint_t
, int, const mdb_arg_t
*);
59 static int qlcver_dcmd(uintptr_t, uint_t
, int, const mdb_arg_t
*);
60 static int qlstates_walk_init(mdb_walk_state_t
*);
61 static int qlstates_walk_step(mdb_walk_state_t
*);
62 static void qlstates_walk_fini(mdb_walk_state_t
*);
63 static int qlsrb_walk_init(mdb_walk_state_t
*);
64 static int qlsrb_walk_step(mdb_walk_state_t
*);
65 static void qlsrb_walk_fini(mdb_walk_state_t
*);
66 static int get_next_link(ql_link_t
*);
67 static int get_first_link(ql_head_t
*, ql_link_t
*);
69 static int ql_24xx_dump_dcmd(ql_adapter_state_t
*, uint_t
, int,
71 static int ql_23xx_dump_dcmd(ql_adapter_state_t
*, uint_t
, int,
73 static int ql_25xx_dump_dcmd(ql_adapter_state_t
*, uint_t
, int,
75 static int ql_81xx_dump_dcmd(ql_adapter_state_t
*, uint_t
, int,
77 static void ql_elog_common(ql_adapter_state_t
*, boolean_t
);
80 * local adapter state flags strings
82 int8_t *adapter_state_flags
[] = {
87 "ABORT_CMDS_LOOP_DOWN_TMO",
91 "MENLO_LOGIN_OPERATIONAL",
95 "FLASH_ERRLOG_MARKER",
103 int8_t *adapter_config_flags
[] = {
104 "ENABLE_HARD_ADDRESS",
105 "ENABLE_64BIT_ADDRESSING",
107 "ENABLE_FULL_LIP_LOGIN",
108 "ENABLE_TARGET_RESET",
109 "ENABLE_LINK_DOWN_REPORTING",
110 "DISABLE_EXTENDED_LOGGING_TRACE",
111 "ENABLE_FCP_2_SUPPORT",
112 "MULTI_CHIP_ADAPTER",
119 "ENABLE_EXTENDED_LOGGING",
120 "DISABLE_RISC_CODE_LOAD",
121 "SET_CACHE_LINE_SIZE_1",
125 "DUMP_MAILBOX_TIMEOUT",
126 "DUMP_ISP_SYSTEM_ERROR",
127 "DUMP_DRIVER_COMMAND_TIMEOUT",
128 "DUMP_LOOP_OFFLINE_TIMEOUT",
134 "ENABLE_FAST_TIMEOUT",
140 * local task daemon flags strings
142 int8_t *task_daemon_flags
[] = {
143 "TASK_DAEMON_STOP_FLG",
144 "TASK_DAEMON_SLEEPING_FLG",
145 "TASK_DAEMON_ALIVE_FLG",
146 "TASK_DAEMON_IDLE_CHK_FLG",
147 "SUSPENDED_WAKEUP_FLG",
149 "NEED_UNSOLICITED_BUFFERS",
150 "RESET_MARKER_NEEDED",
154 "LOOP_RESYNC_NEEDED",
155 "LOOP_RESYNC_ACTIVE",
158 "COMMAND_WAIT_NEEDED",
159 "COMMAND_WAIT_ACTIVE",
161 "ABORT_QUEUES_NEEDED",
162 "TASK_DAEMON_STALLED_FLG",
163 "TASK_THREAD_CALLED",
167 "RSCN_UPDATE_NEEDED",
168 "HANDLE_PORT_BYPASS_CHANGE",
170 "TASK_DAEMON_POWERING_DOWN",
178 * local interrupt aif flags
180 int8_t *aif_flags
[] = {
188 int8_t *qlsrb_flags
[] = {
193 "SRB_WATCHDOG_ENABLED",
204 "SRB_GENERIC_SERVICES_PKT",
205 "SRB_COMMAND_TIMEOUT",
207 "SRB_IN_DEVICE_QUEUE",
208 "SRB_IN_TOKEN_ARRAY",
209 "SRB_UB_FREE_REQUESTED",
215 int8_t *qllun_flags
[] = {
216 "LQF_UNTAGGED_PENDING",
220 int8_t *qltgt_flags
[] = {
222 "TQF_QUEUE_SUSPENDED",
224 "TQF_INITIATOR_DEVICE",
226 "TQF_NEED_AUTHENTICATION",
232 int8_t *qldump_flags
[] = {
241 * mdb dcmd which prints out the ql_hba pointers
244 * addr = User supplied address -- error if supplied.
246 * argc = Number of user supplied args -- error if non-zero.
250 * DCMD_ERR, DCMD_USAGE, or DCMD_OK
258 qlclinks_dcmd(uintptr_t addr
, uint_t flags
, int argc
, const mdb_arg_t
*argv
)
261 ql_adapter_state_t
*qlstate
;
262 uintptr_t hbaptr
= NULL
;
264 if ((flags
& DCMD_ADDRSPEC
) || argc
!= 0) {
268 if (mdb_readvar(&ql_hba
, "ql_hba") == -1) {
269 mdb_warn("failed to read ql_hba structure");
273 if (&ql_hba
== NULL
) {
274 mdb_warn("failed to read ql_hba structure -- is qlc loaded?");
278 mdb_printf("\nqlc adapter state linkages (f=0x%llx, l=0x%llx)\n\n",
279 ql_hba
.first
, ql_hba
.last
);
281 if ((qlstate
= (ql_adapter_state_t
*)mdb_alloc(
282 sizeof (ql_adapter_state_t
), UM_SLEEP
)) == NULL
) {
283 mdb_warn("Unable to allocate memory for ql_adapter_state\n");
287 (void) mdb_inc_indent((ulong_t
)4);
288 mdb_printf("%<u>%-?s\t%-45s%</u>\n\n", "baseaddr", "instance");
290 hbaptr
= (uintptr_t)ql_hba
.first
;
291 while (hbaptr
!= NULL
) {
293 if (mdb_vread(qlstate
, sizeof (ql_adapter_state_t
),
295 mdb_free(qlstate
, sizeof (ql_adapter_state_t
));
296 mdb_warn("failed to read ql_adapter_state at %p",
301 mdb_printf("%<b>0x%016p%t%d%</b>\n",
302 qlstate
->hba
.base_address
, qlstate
->instance
);
305 * If vp exists, loop through those
308 if ((qlstate
->flags
& VP_ENABLED
) &&
309 (qlstate
->vp_next
!= NULL
)) {
311 ql_adapter_state_t
*vqlstate
;
312 uintptr_t vhbaptr
= NULL
;
314 vhbaptr
= (uintptr_t)qlstate
->vp_next
;
316 if ((vqlstate
= (ql_adapter_state_t
*)mdb_alloc(
317 sizeof (ql_adapter_state_t
), UM_SLEEP
)) == NULL
) {
318 mdb_warn("Unable to allocate memory for "
319 "ql_adapter_state vp\n");
320 mdb_free(qlstate
, sizeof (ql_adapter_state_t
));
324 (void) mdb_inc_indent((ulong_t
)30);
326 mdb_printf("%<u>vp baseaddr\t\tvp index%</u>\n");
328 while (vhbaptr
!= NULL
) {
330 if (mdb_vread(vqlstate
,
331 sizeof (ql_adapter_state_t
), vhbaptr
) ==
334 sizeof (ql_adapter_state_t
));
336 sizeof (ql_adapter_state_t
));
337 mdb_warn("failed to read vp "
338 "ql_adapter_state at %p", vhbaptr
);
342 mdb_printf("%<b>0x%016p%t%d%</b>\n",
343 vqlstate
->hba
.base_address
,
346 vhbaptr
= (uintptr_t)vqlstate
->vp_next
;
349 mdb_free(vqlstate
, sizeof (ql_adapter_state_t
));
351 (void) mdb_dec_indent((ulong_t
)30);
356 hbaptr
= (uintptr_t)qlstate
->hba
.next
;
359 (void) mdb_dec_indent((ulong_t
)4);
361 mdb_free(qlstate
, sizeof (ql_adapter_state_t
));
368 * mdb dcmd which prints out the qlc driver version the mdb
369 * module was compiled with, and the verison of qlc which is
370 * currently loaded on the machine.
373 * addr = User supplied address -- error if supplied.
375 * argc = Number of user supplied args -- error if non-zero.
379 * DCMD_USAGE, or DCMD_OK
387 qlcver_dcmd(uintptr_t addr
, uint_t flags
, int argc
, const mdb_arg_t
*argv
)
389 int8_t qlcversion
[100];
390 struct fw_table fw_table
[10], *fwt
= NULL
;
391 uint8_t *fwverptr
= NULL
;
395 if ((flags
& DCMD_ADDRSPEC
) || argc
!= 0) {
399 if (mdb_readvar(&qlcversion
, "qlc_driver_version") == -1) {
400 mdb_warn("unable to read qlc driver version\n");
402 mdb_printf("\n%s version currently loaded is: %s\n",
403 QL_NAME
, qlcversion
);
406 mdb_printf("qlc mdb library compiled with %s version: %s\n",
407 QL_NAME
, QL_VERSION
);
409 if ((fwverptr
= (uint8_t *)(mdb_alloc(50, UM_SLEEP
))) == NULL
) {
410 mdb_warn("unable to alloc fwverptr\n");
414 if (mdb_readvar(&fw_table
, "fw_table") == -1) {
415 mdb_warn("unable to read firmware table\n");
417 ql_adapter_state_t
*qlstate
;
418 uintptr_t hbaptr
= NULL
;
420 if (mdb_readvar(&ql_hba
, "ql_hba") == -1) {
421 mdb_warn("failed to read ql_hba structure");
425 if ((qlstate
= (ql_adapter_state_t
*)mdb_alloc(
426 sizeof (ql_adapter_state_t
), UM_SLEEP
)) == NULL
) {
427 mdb_warn("Unable to allocate memory for "
428 "ql_adapter_state\n");
432 mdb_printf("\n%-8s%-11s%s\n", "f/w", "compiled", "loaded");
433 mdb_printf("%<u>%-8s%-11s%-13s%s%</u>\n\n", "class", "version",
434 "version", "instance list");
436 for (fwt
= &fw_table
[0]; fwt
->fw_class
; fwt
++) {
438 if (mdb_vread(fwverptr
, sizeof (void *),
439 (uintptr_t)fwt
->fw_version
) == -1) {
440 mdb_warn("unable to read fwverptr\n");
441 mdb_free(fwverptr
, sizeof (void *));
442 mdb_free(qlstate
, sizeof (ql_adapter_state_t
));
446 mdb_printf("%x\t%-11s", fwt
->fw_class
, fwverptr
);
448 if (&ql_hba
== NULL
) {
449 mdb_warn("failed to read ql_hba structure");
452 hbaptr
= (uintptr_t)ql_hba
.first
;
456 while (hbaptr
!= NULL
) {
458 if (mdb_vread(qlstate
,
459 sizeof (ql_adapter_state_t
), hbaptr
) ==
461 mdb_warn("failed to read "
462 "ql_adapter_state at %p", hbaptr
);
466 if (qlstate
->fw_class
== fwt
->fw_class
) {
468 mdb_printf("%x.%02x.%02x\t",
469 qlstate
->fw_major_version
,
470 qlstate
->fw_minor_version
,
472 fw_subminor_version
);
482 hbaptr
= (uintptr_t)qlstate
->hba
.next
;
488 mdb_printf("not loaded\n");
492 mdb_free(qlstate
, sizeof (ql_adapter_state_t
));
493 mdb_free(fwverptr
, sizeof (void *));
501 * mdb dcmd which turns the extended logging bit on or off
502 * for the specificed qlc instance(s).
505 * addr = User supplied address -- error if supplied.
507 * argc = Number of user supplied args -- error if non-zero.
511 * DCMD_USAGE, or DCMD_OK
519 qlc_el_dcmd(uintptr_t addr
, uint_t flags
, int argc
, const mdb_arg_t
*argv
)
521 int8_t qlcversion
[100];
526 uint32_t qlsize
= sizeof (ql_adapter_state_t
);
527 ql_adapter_state_t
*qlstate
;
528 uintptr_t hbaptr
= NULL
;
531 if ((mdbs
= mdb_get_state()) == MDB_STATE_DEAD
) {
532 mdb_warn("Cannot change core file data (state=%xh)\n", mdbs
);
536 if ((flags
& DCMD_ADDRSPEC
) || argc
< 2) {
541 * Check and make sure the driver version and the mdb versions
542 * match so all the structures and flags line up
545 if (mdb_readvar(&qlcversion
, "qlc_driver_version") == -1) {
546 mdb_warn("unable to read qlc driver version\n");
550 if ((strcmp(QL_VERSION
, (const char *)&qlcversion
)) != 0) {
551 mdb_warn("Error: qlc driver/qlc mdb version mismatch\n");
552 mdb_printf("\tqlc mdb library compiled version is: %s\n",
554 mdb_printf("\tqlc driver version is: %s\n", qlcversion
);
559 if ((strcasecmp(argv
[0].a_un
.a_str
, "on")) == 0) {
561 } else if ((strcasecmp(argv
[0].a_un
.a_str
, "off")) == 0) {
567 if (mdb_readvar(&ql_hba
, "ql_hba") == -1) {
568 mdb_warn("failed to read ql_hba structure");
572 if (&ql_hba
== NULL
) {
573 mdb_warn("failed to read ql_hba structure - is qlc loaded?");
577 if ((qlstate
= (ql_adapter_state_t
*)mdb_alloc(qlsize
,
578 UM_SLEEP
)) == NULL
) {
579 mdb_warn("Unable to allocate memory for "
580 "ql_adapter_state\n");
584 if ((strcasecmp(argv
[1].a_un
.a_str
, "all")) == 0) {
587 mdb_free(qlstate
, qlsize
);
591 hbaptr
= (uintptr_t)ql_hba
.first
;
593 while (hbaptr
!= NULL
) {
595 if (mdb_vread(qlstate
, qlsize
, hbaptr
) == -1) {
596 mdb_free(qlstate
, qlsize
);
597 mdb_warn("failed to read ql_adapter_state "
602 ql_elog_common(qlstate
, elswitch
);
604 hbaptr
= (uintptr_t)qlstate
->hba
.next
;
607 for (argcnt
= 1; argcnt
< argc
; argcnt
++) {
609 instance
= (uint32_t)mdb_strtoull(
610 argv
[argcnt
].a_un
.a_str
);
612 /* find the correct instance to change */
613 hbaptr
= (uintptr_t)ql_hba
.first
;
614 while (hbaptr
!= NULL
) {
616 if (mdb_vread(qlstate
, qlsize
, hbaptr
) == -1) {
617 mdb_free(qlstate
, qlsize
);
618 mdb_warn("failed to read "
619 "ql_adapter_state at %p", hbaptr
);
623 if (qlstate
->instance
== instance
) {
627 hbaptr
= (uintptr_t)qlstate
->hba
.next
;
630 if (hbaptr
== NULL
) {
631 mdb_printf("instance %d is not loaded",
636 ql_elog_common(qlstate
, elswitch
);
640 mdb_free(qlstate
, qlsize
);
647 * mdb helper function which set/resets the extended logging bit
650 * qlstate = adapter state structure
651 * elswitch = boolean which specifies to reset (0) or set (1) the
652 * extended logging bit.
661 ql_elog_common(ql_adapter_state_t
*qlstate
, boolean_t elswitch
)
663 uintptr_t hbaptr
= (uintptr_t)qlstate
->hba
.base_address
;
664 size_t qlsize
= sizeof (ql_adapter_state_t
);
667 if ((qlstate
->cfg_flags
& CFG_ENABLE_EXTENDED_LOGGING
) == 0) {
669 qlstate
->cfg_flags
|= CFG_ENABLE_EXTENDED_LOGGING
;
671 if ((mdb_vwrite((const void *)qlstate
, qlsize
,
672 hbaptr
)) != (ssize_t
)qlsize
) {
673 mdb_warn("instance %d - unable to update",
676 mdb_printf("instance %d extended logging is "
677 "now on\n", qlstate
->instance
);
680 mdb_printf("instance %d extended logging is "
681 "already on\n", qlstate
->instance
);
684 if ((qlstate
->cfg_flags
& CFG_ENABLE_EXTENDED_LOGGING
) != 0) {
686 qlstate
->cfg_flags
&= ~CFG_ENABLE_EXTENDED_LOGGING
;
688 if ((mdb_vwrite((const void *)qlstate
, qlsize
,
689 hbaptr
)) != (ssize_t
)qlsize
) {
690 mdb_warn("instance %d - unable to update",
693 mdb_printf("instance %d extended logging is "
694 "now off\n", qlstate
->instance
);
697 mdb_printf("instance %d extended logging is "
698 "already off\n", qlstate
->instance
);
705 * mdb dcmd which prints out the outstanding command array using
706 * caller supplied address (which sb the ha structure).
709 * addr = User supplied ha address.
711 * argc = Number of user supplied args.
715 * DCMD_USAGE, or DCMD_OK
724 qlc_osc_dcmd(uintptr_t addr
, uint_t flags
, int argc
, const mdb_arg_t
*argv
)
726 ql_adapter_state_t
*qlstate
;
727 uintptr_t qlosc
, ptr1
;
728 uint32_t indx
, found
= 0;
731 if (!(flags
& DCMD_ADDRSPEC
)) {
735 if ((qlstate
= (ql_adapter_state_t
*)
736 mdb_alloc(sizeof (ql_adapter_state_t
), UM_SLEEP
)) == NULL
) {
737 mdb_warn("Unable to allocate memory for ql_adapter_state\n");
740 if (mdb_vread(qlstate
, sizeof (ql_adapter_state_t
), addr
) == -1) {
741 mdb_free(qlstate
, sizeof (ql_adapter_state_t
));
742 mdb_warn("failed to read ql_adapter_state at %p", addr
);
746 qlosc
= (uintptr_t)qlstate
->outstanding_cmds
;
747 mdb_printf("qlc instance: %d, base addr = %llx, osc base = %p\n",
748 qlstate
->instance
, qlstate
->hba
.base_address
, qlosc
);
750 if ((qlsrb
= (ql_srb_t
*)mdb_alloc(sizeof (ql_srb_t
), UM_SLEEP
)) ==
752 mdb_free(qlstate
, sizeof (ql_adapter_state_t
));
753 mdb_warn("failed to allocate space for srb_t\n");
756 for (indx
= 0; indx
< MAX_OUTSTANDING_COMMANDS
; indx
++, qlosc
+= 8) {
757 if (mdb_vread(&ptr1
, 8, qlosc
) == -1) {
758 mdb_warn("failed to read ptr1, indx=%d", indx
);
765 mdb_printf("osc ptr = %p, indx = %xh\n", ptr1
, indx
);
767 if (mdb_vread(qlsrb
, sizeof (ql_srb_t
), ptr1
) == -1) {
768 mdb_warn("failed to read ql_srb_t at %p", ptr1
);
771 (void) ql_doprint(ptr1
, "struct ql_srb");
775 mdb_free(qlsrb
, sizeof (ql_srb_t
));
776 mdb_free(qlstate
, sizeof (ql_adapter_state_t
));
778 mdb_printf("number of outstanding command srb's is: %d\n", found
);
785 * mdb dcmd which prints out the commands which are linked
786 * on the watchdog linked list. Caller supplied address (which
787 * sb the ha structure).
790 * addr = User supplied ha address.
792 * argc = Number of user supplied args.
796 * DCMD_USAGE, or DCMD_OK
805 qlc_wdog_dcmd(uintptr_t addr
, uint_t flags
, int argc
, const mdb_arg_t
*argv
)
807 ql_adapter_state_t
*qlstate
;
808 uint16_t index
, count
;
813 ql_link_t
*tqlink
, *srblink
, *lqlink
;
816 if (!(flags
& DCMD_ADDRSPEC
)) {
817 mdb_warn("Address required\n", addr
);
821 if ((qlstate
= (ql_adapter_state_t
*)
822 mdb_alloc(sizeof (ql_adapter_state_t
), UM_SLEEP
)) == NULL
) {
823 mdb_warn("Unable to allocate memory for ql_adapter_state\n");
827 if (mdb_vread(qlstate
, sizeof (ql_adapter_state_t
), addr
) == -1) {
828 mdb_free(qlstate
, sizeof (ql_adapter_state_t
));
829 mdb_warn("failed to read ql_adapter_state at %p", addr
);
834 * Read in the device array
837 mdb_alloc(sizeof (ql_head_t
) * DEVICE_HEAD_LIST_SIZE
, UM_SLEEP
);
839 if (mdb_vread(dev
, sizeof (ql_head_t
) * DEVICE_HEAD_LIST_SIZE
,
840 (uintptr_t)qlstate
->dev
) == -1) {
841 mdb_warn("failed to read ql_head_t (dev) at %p", qlstate
->dev
);
842 mdb_free(qlstate
, sizeof (ql_adapter_state_t
));
843 mdb_free(dev
, sizeof (ql_head_t
) * DEVICE_HEAD_LIST_SIZE
);
847 tqlink
= (ql_link_t
*)mdb_alloc(sizeof (ql_link_t
), UM_SLEEP
);
848 tq
= (ql_tgt_t
*)mdb_alloc(sizeof (ql_tgt_t
), UM_SLEEP
);
849 lqlink
= (ql_link_t
*)mdb_alloc(sizeof (ql_link_t
), UM_SLEEP
);
850 lq
= (ql_lun_t
*)mdb_alloc(sizeof (ql_lun_t
), UM_SLEEP
);
851 srblink
= (ql_link_t
*)mdb_alloc(sizeof (ql_link_t
), UM_SLEEP
);
852 srb
= (ql_srb_t
*)mdb_alloc(sizeof (ql_srb_t
), UM_SLEEP
);
855 * Validate the devices watchdog queue
857 for (index
= 0; index
< DEVICE_HEAD_LIST_SIZE
; index
++) {
859 /* Skip empty ones */
860 if (dev
[index
].first
== NULL
) {
864 mdb_printf("dev array index = %x\n", index
);
866 /* Loop through targets on device linked list */
867 /* get the first link */
869 nextlink
= get_first_link(&dev
[index
], tqlink
);
872 * traverse the targets linked list at this device array index.
874 while (nextlink
== DCMD_OK
) {
876 if (mdb_vread(tq
, sizeof (ql_tgt_t
),
877 (uintptr_t)(tqlink
->base_address
)) == -1) {
878 mdb_warn("failed to read ql_tgt at %p",
879 tqlink
->base_address
);
882 mdb_printf("tgt q base = %llx, ",
883 tqlink
->base_address
);
885 mdb_printf("flags: (%xh)", tq
->flags
);
888 ql_dump_flags((uint64_t)tq
->flags
, qltgt_flags
);
891 mdb_printf("tgt: %02x%02x%02x%02x%02x%02x%02x%02x ",
892 tq
->node_name
[0], tq
->node_name
[1],
893 tq
->node_name
[2], tq
->node_name
[3],
894 tq
->node_name
[4], tq
->node_name
[5],
895 tq
->node_name
[6], tq
->node_name
[7]);
898 * Loop through commands on this targets watchdog queue.
901 /* Get the first link on the targets cmd wdg q. */
902 if (tq
->wdg
.first
== NULL
) {
903 mdb_printf(" watchdog list empty ");
906 if (mdb_vread(srblink
, sizeof (ql_link_t
),
907 (uintptr_t)tq
->wdg
.first
) == -1) {
908 mdb_warn("failed to read ql_link_t"
909 " at %p", tq
->wdg
.first
);
912 /* There is aleast one. */
915 * Count the remaining items in the
918 while (srblink
->next
!= NULL
) {
919 /* Read in the next ql_link_t header */
920 if (mdb_vread(srblink
,
922 (uintptr_t)srblink
->next
) == -1) {
923 mdb_warn("failed to read"
924 " ql_link_t next at %p",
928 count
= (uint16_t)(count
+ 1);
930 mdb_printf(" watchdog list: %d entries\n",
932 /* get the first one again */
933 if (mdb_vread(srblink
, sizeof (ql_link_t
),
934 (uintptr_t)tq
->wdg
.first
) == -1) {
935 mdb_warn("failed to read ql_link_t"
936 " at %p", tq
->wdg
.first
);
941 * Traverse the targets cmd watchdog linked list
942 * verifying srb's from the list are on a lun cmd list.
944 while (nextlink
== DCMD_OK
) {
947 if (mdb_vread(srb
, sizeof (ql_srb_t
),
948 (uintptr_t)srblink
->base_address
) == -1) {
949 mdb_warn("failed to read ql_srb_t"
950 " at %p", srblink
->base_address
);
953 mdb_printf("ql_srb %llx ",
954 srblink
->base_address
);
957 * Get the lun q the srb is on
959 if (mdb_vread(lq
, sizeof (ql_lun_t
),
960 (uintptr_t)srb
->lun_queue
) == -1) {
961 mdb_warn("failed to read ql_srb_t"
962 " at %p", srb
->lun_queue
);
965 nextlink
= get_first_link(&lq
->cmd
, lqlink
);
967 * traverse the lun cmd linked list looking
968 * for the srb from the targets watchdog list
970 while (nextlink
== DCMD_OK
) {
971 if (srblink
->base_address
==
972 lqlink
->base_address
) {
973 mdb_printf("on lun %d cmd q\n",
978 /* get next item on lun cmd list */
979 nextlink
= get_next_link(lqlink
);
982 mdb_printf("not found on lun cmd q\n");
984 /* get next item in the watchdog list */
985 nextlink
= get_next_link(srblink
);
986 } /* End targets command watchdog list */
987 /* get next item in this target list */
988 nextlink
= get_next_link(tqlink
);
989 } /* End traverse the device targets linked list */
991 } /* End device array */
993 mdb_free(tq
, sizeof (ql_tgt_t
));
994 mdb_free(lq
, sizeof (ql_lun_t
));
995 mdb_free(srb
, sizeof (ql_srb_t
));
996 mdb_free(tqlink
, sizeof (ql_link_t
));
997 mdb_free(srblink
, sizeof (ql_link_t
));
998 mdb_free(lqlink
, sizeof (ql_link_t
));
999 mdb_free(qlstate
, sizeof (ql_adapter_state_t
));
1000 mdb_free(dev
, sizeof (ql_head_t
)*DEVICE_HEAD_LIST_SIZE
);
1007 * Gets the first ql_link_t header on ql_head.
1010 * ql_head = pointer to a ql_head_t structure.
1011 * ql_link = pointer to a ql_link_t structure.
1014 * DCMD_ABORT, or DCMD_OK
1021 get_first_link(ql_head_t
*qlhead
, ql_link_t
*qllink
)
1023 int rval
= DCMD_ABORT
;
1025 if (qlhead
!= NULL
) {
1026 if (qlhead
->first
!= NULL
) {
1027 /* Read in the first ql_link_t header */
1028 if (mdb_vread(qllink
, sizeof (ql_link_t
),
1029 (uintptr_t)(qlhead
->first
)) == -1) {
1030 mdb_warn("failed to read ql_link_t "
1031 "next at %p", qlhead
->first
);
1042 * Gets the next ql_link_t structure.
1045 * ql_link = pointer to a ql_link_t structure.
1048 * DCMD_ABORT, or DCMD_OK
1055 get_next_link(ql_link_t
*qllink
)
1057 int rval
= DCMD_ABORT
;
1059 if (qllink
!= NULL
) {
1060 if (qllink
->next
!= NULL
) {
1061 /* Read in the next ql_link_t header */
1062 if (mdb_vread(qllink
, sizeof (ql_link_t
),
1063 (uintptr_t)(qllink
->next
)) == -1) {
1064 mdb_warn("failed to read ql_link_t "
1065 "next at %p", qllink
->next
);
1076 * mdb dcmd which prints out the ql_state info using
1077 * caller supplied address.
1080 * addr = User supplied address.
1081 * flags = mdb flags.
1082 * argc = Number of user supplied args.
1086 * DCMD_USAGE, or DCMD_OK
1093 qlcstate_dcmd(uintptr_t addr
, uint_t flags
, int argc
, const mdb_arg_t
*argv
)
1095 ql_adapter_state_t
*qlstate
;
1098 if (!(flags
& DCMD_ADDRSPEC
)) {
1099 return (DCMD_USAGE
);
1102 if (mdb_getopts(argc
, argv
, 'v', MDB_OPT_SETBITS
, TRUE
, &verbose
) !=
1104 return (DCMD_USAGE
);
1107 if ((qlstate
= (ql_adapter_state_t
*)
1108 mdb_alloc(sizeof (ql_adapter_state_t
), UM_SLEEP
)) == NULL
) {
1109 mdb_warn("failed to allocate memory for ql_adapter_state\n");
1112 if (mdb_vread(qlstate
, sizeof (ql_adapter_state_t
), addr
) == -1) {
1113 mdb_free(qlstate
, sizeof (ql_adapter_state_t
));
1114 mdb_warn("failed to read ql_adapter_state at %p", addr
);
1118 mdb_printf("qlc instance: %d, base addr = %llx\n", qlstate
->instance
,
1121 mdb_printf("\nadapter state flags:\n");
1122 ql_dump_flags((uint64_t)qlstate
->flags
, adapter_state_flags
);
1123 mdb_printf("\nadapter cfg flags:\n");
1124 ql_dump_flags((uint64_t)qlstate
->cfg_flags
, adapter_config_flags
);
1125 mdb_printf("\ntask daemon state flags:\n");
1126 ql_dump_flags((uint64_t)qlstate
->task_daemon_flags
,
1130 (void) ql_doprint(addr
, "struct ql_adapter_state");
1133 mdb_free(qlstate
, sizeof (ql_adapter_state_t
));
1139 * qlcstates_walk_init
1140 * mdb walker init which prints out all qlc states info.
1143 * wsp - Pointer to walker state struct
1146 * WALK_ERR, or WALK_NEXT
1153 qlstates_walk_init(mdb_walk_state_t
*wsp
)
1157 if (wsp
->walk_addr
== NULL
) {
1158 if ((mdb_readvar(&ql_hba
, "ql_hba") == -1) ||
1159 (&ql_hba
== NULL
)) {
1160 mdb_warn("failed to read ql_hba structure");
1164 wsp
->walk_addr
= (uintptr_t)ql_hba
.first
;
1165 wsp
->walk_data
= mdb_alloc(sizeof (ql_adapter_state_t
),
1169 return (ql_doprint(wsp
->walk_addr
, "struct ql_adapter_state"));
1174 * qlstates_walk_step
1175 * mdb walker step which prints out all qlc states info.
1178 * wsp - Pointer to walker state struct
1181 * WALK_DONE, or WALK_NEXT
1188 qlstates_walk_step(mdb_walk_state_t
*wsp
)
1190 ql_adapter_state_t
*qlstate
;
1192 if (wsp
->walk_addr
== NULL
) {
1196 if (mdb_vread(wsp
->walk_data
, sizeof (ql_adapter_state_t
),
1197 wsp
->walk_addr
) == -1) {
1198 mdb_warn("failed to read ql_adapter_state at %p",
1203 qlstate
= (ql_adapter_state_t
*)(wsp
->walk_data
);
1204 mdb_printf("qlc instance: %d, base addr = %llx\n",
1205 qlstate
->instance
, wsp
->walk_addr
);
1207 mdb_printf("\nadapter state flags:\n");
1208 ql_dump_flags((uint64_t)qlstate
->flags
, adapter_state_flags
);
1209 mdb_printf("\nadapter cfg flags:\n");
1210 ql_dump_flags((uint64_t)qlstate
->cfg_flags
, adapter_config_flags
);
1211 mdb_printf("\ntask daemon state flags:\n");
1212 ql_dump_flags((uint64_t)qlstate
->task_daemon_flags
,
1215 mdb_printf("\nadapter state:\n");
1216 (void) ql_doprint(wsp
->walk_addr
, "struct ql_adapter_state");
1220 wsp
->walk_addr
= (uintptr_t)
1221 (((ql_adapter_state_t
*)wsp
->walk_data
)->hba
.next
);
1227 * qlstates_walk_fini
1228 * mdb walker fini which wraps up the walker
1231 * wsp - Pointer to walker state struct
1240 qlstates_walk_fini(mdb_walk_state_t
*wsp
)
1242 mdb_free(wsp
->walk_data
, sizeof (ql_adapter_state_t
));
1247 * mdb walker init which prints out linked srb's
1250 * wsp - Pointer to walker ql_srb struct
1253 * WALK_ERR, or WALK_NEXT
1260 qlsrb_walk_init(mdb_walk_state_t
*wsp
)
1262 if (wsp
->walk_addr
== NULL
) {
1263 mdb_warn("failed to read ql_srb addr at %p",
1268 wsp
->walk_data
= mdb_alloc(sizeof (ql_srb_t
), UM_SLEEP
);
1275 * mdb walker step which prints out linked ql_srb structures
1278 * wsp - Pointer to walker srb struct
1281 * WALK_DONE, or WALK_NEXT
1288 qlsrb_walk_step(mdb_walk_state_t
*wsp
)
1292 if (wsp
->walk_addr
== NULL
)
1295 if (mdb_vread(wsp
->walk_data
, sizeof (ql_srb_t
),
1296 wsp
->walk_addr
) == -1) {
1297 mdb_warn("failed to read ql_srb at %p", wsp
->walk_addr
);
1301 qlsrb
= (ql_srb_t
*)(wsp
->walk_data
);
1302 mdb_printf("ql_srb base addr = %llx\n", wsp
->walk_addr
);
1304 mdb_printf("\nql_srb flags:\n");
1305 ql_dump_flags((uint64_t)qlsrb
->flags
, qlsrb_flags
);
1307 mdb_printf("\nql_srb:\n");
1308 (void) ql_doprint(wsp
->walk_addr
, "struct ql_srb");
1312 wsp
->walk_addr
= (uintptr_t)
1313 (((ql_srb_t
*)wsp
->walk_data
)->cmd
.next
);
1320 * mdb walker fini which wraps up the walker
1323 * wsp - Pointer to walker state struct
1332 qlsrb_walk_fini(mdb_walk_state_t
*wsp
)
1334 mdb_free(wsp
->walk_data
, sizeof (ql_srb_t
));
1339 * mdb walker which prints out lun q's
1342 * wsp - Pointer to walker ql_lun struct
1345 * WALK_ERR, or WALK_NEXT
1352 qllunq_walk_init(mdb_walk_state_t
*wsp
)
1354 if (wsp
->walk_addr
== NULL
) {
1355 mdb_warn("failed to read ql_lun addr at %p",
1360 wsp
->walk_data
= mdb_alloc(sizeof (ql_lun_t
), UM_SLEEP
);
1367 * mdb walker step which prints out linked ql_lun structures
1370 * wsp - Pointer to walker srb struct
1373 * WALK_DONE, or WALK_NEXT
1380 qllunq_walk_step(mdb_walk_state_t
*wsp
)
1386 if (wsp
->walk_addr
== NULL
)
1389 if (mdb_vread(wsp
->walk_data
, sizeof (ql_lun_t
),
1390 wsp
->walk_addr
) == -1) {
1391 mdb_warn("failed to read ql_lun at %p", wsp
->walk_addr
);
1395 qllun
= (ql_lun_t
*)(wsp
->walk_data
);
1396 mdb_printf("ql_lun base addr = %llx\n", wsp
->walk_addr
);
1398 mdb_printf("\nql_lun flags:\n");
1399 ql_dump_flags((uint64_t)qllun
->flags
, qllun_flags
);
1401 mdb_printf("\nql_lun:\n");
1402 (void) ql_doprint(wsp
->walk_addr
, "struct ql_lun");
1406 qllink
= (ql_link_t
*)
1407 (((ql_lun_t
*)wsp
->walk_data
)->link
.next
);
1409 if (qllink
== NULL
) {
1413 * Read in the next link_t header
1415 if (mdb_vread(&ql_link
, sizeof (ql_link_t
),
1416 (uintptr_t)qllink
) == -1) {
1417 mdb_warn("failed to read ql_link_t "
1418 "next at %p", qllink
->next
);
1424 wsp
->walk_addr
= (uintptr_t)qllink
->base_address
;
1431 * mdb walker fini which wraps up the walker
1434 * wsp - Pointer to walker state struct
1443 qllunq_walk_fini(mdb_walk_state_t
*wsp
)
1445 mdb_free(wsp
->walk_data
, sizeof (ql_lun_t
));
1450 * mdb dcmd which prints out an hs's tq struct info.
1453 * addr = User supplied address. (NB: nust be an ha)
1454 * flags = mdb flags.
1455 * argc = Number of user supplied args.
1459 * DCMD_USAGE, or DCMD_OK
1467 qltgtq_dcmd(uintptr_t addr
, uint_t flags
, int argc
, const mdb_arg_t
*argv
)
1469 ql_adapter_state_t
*ha
;
1475 if ((!(flags
& DCMD_ADDRSPEC
)) || addr
== NULL
) {
1476 mdb_warn("ql_hba structure addr is required");
1477 return (DCMD_USAGE
);
1481 * Get the adapter state struct which was passed
1484 ha
= (ql_adapter_state_t
*)mdb_alloc(sizeof (ql_adapter_state_t
),
1487 if (mdb_vread(ha
, sizeof (ql_adapter_state_t
), addr
) == -1) {
1488 mdb_warn("failed to read ql_adapter_state at %p", addr
);
1489 mdb_free(ha
, sizeof (ql_adapter_state_t
));
1493 if (ha
->dev
== NULL
) {
1494 mdb_warn("dev ptr is NULL for ha: %p", addr
);
1495 mdb_free(ha
, sizeof (ql_adapter_state_t
));
1500 * Read in the device array
1503 mdb_alloc(sizeof (ql_head_t
) * DEVICE_HEAD_LIST_SIZE
, UM_SLEEP
);
1505 if (mdb_vread(dev
, sizeof (ql_head_t
) * DEVICE_HEAD_LIST_SIZE
,
1506 (uintptr_t)ha
->dev
) == -1) {
1507 mdb_warn("failed to read ql_head_t (dev) at %p", ha
->dev
);
1508 mdb_free(ha
, sizeof (ql_adapter_state_t
));
1509 mdb_free(dev
, sizeof (ql_head_t
) * DEVICE_HEAD_LIST_SIZE
);
1512 tq
= (ql_tgt_t
*)mdb_alloc(sizeof (ql_tgt_t
), UM_SLEEP
);
1513 link
= (ql_link_t
*)mdb_alloc(sizeof (ql_link_t
), UM_SLEEP
);
1515 for (index
= 0; index
< DEVICE_HEAD_LIST_SIZE
; index
++) {
1517 if (dev
[index
].first
== NULL
) {
1521 if (mdb_vread(link
, sizeof (ql_link_t
),
1522 (uintptr_t)dev
[index
].first
) == -1) {
1523 mdb_warn("failed to read ql_link_t at %p",
1528 while (link
!= NULL
) {
1529 if (mdb_vread(tq
, sizeof (ql_tgt_t
),
1530 (uintptr_t)(link
->base_address
)) == -1) {
1531 mdb_warn("failed to read ql_tgt at %p",
1532 link
->base_address
);
1536 mdb_printf("tgt queue base addr = %llx\n",
1537 link
->base_address
);
1539 mdb_printf("\ntgt queue flags: (%xh)\n", tq
->flags
);
1540 ql_dump_flags((uint64_t)tq
->flags
, qltgt_flags
);
1542 mdb_printf("\ntgt queue:\n");
1544 (void) ql_doprint((uintptr_t)link
->base_address
,
1545 "struct ql_target");
1549 if (get_next_link(link
) != DCMD_OK
) {
1555 mdb_free(ha
, sizeof (ql_adapter_state_t
));
1556 mdb_free(tq
, sizeof (ql_tgt_t
));
1557 mdb_free(link
, sizeof (ql_link_t
));
1558 mdb_free(dev
, sizeof (ql_head_t
)*DEVICE_HEAD_LIST_SIZE
);
1564 * ql_triggerdump_dcmd
1565 * Triggers the driver to take a firmware dump
1568 * addr = User supplied address (optional)
1569 * flags = mdb flags.
1570 * argc = Number of user supplied args.
1571 * argv = Arg array (instance #, optional).
1574 * DCMD_OK or DCMD_ERR
1585 qlc_triggerdump_dcmd(uintptr_t addr
, uint_t flags
, int argc
,
1586 const mdb_arg_t
*argv
)
1588 ql_adapter_state_t
*qlstate
;
1589 uintptr_t hbaptr
= NULL
;
1591 uint32_t qlsize
= sizeof (ql_adapter_state_t
);
1594 if ((mdbs
= mdb_get_state()) == MDB_STATE_DEAD
) {
1595 mdb_warn("Cannot change core file data (state=%xh)\n", mdbs
);
1599 if ((qlstate
= (ql_adapter_state_t
*)mdb_alloc(qlsize
,
1600 UM_SLEEP
)) == NULL
) {
1601 mdb_warn("Unable to allocate memory for ql_adapter_state\n");
1610 mdb_warn("must specify either the ha addr or "
1611 "the instance number\n");
1612 mdb_free(qlstate
, qlsize
);
1617 * find the specified instance in the ha list
1620 instance
= (uint32_t)strtol(argv
[1].a_un
.a_str
, &tptr
, 16);
1621 if (tptr
== argv
[1].a_un
.a_str
) {
1622 mdb_printf("instance # is illegal: '%s'\n",
1623 argv
[1].a_un
.a_str
);
1624 mdb_free(qlstate
, qlsize
);
1628 if (mdb_readvar(&ql_hba
, "ql_hba") == -1) {
1629 mdb_warn("failed to read ql_hba structure");
1630 mdb_free(qlstate
, qlsize
);
1634 if (&ql_hba
== NULL
) {
1635 mdb_warn("failed to read ql_hba structure - "
1637 mdb_free(qlstate
, qlsize
);
1641 hbaptr
= (uintptr_t)ql_hba
.first
;
1642 while (hbaptr
!= NULL
) {
1644 if (mdb_vread(qlstate
, qlsize
, hbaptr
) == -1) {
1645 mdb_free(qlstate
, qlsize
);
1646 mdb_warn("failed to read "
1647 "ql_adapter_state at %p", hbaptr
);
1651 if (qlstate
->instance
== instance
) {
1655 hbaptr
= (uintptr_t)qlstate
->hba
.next
;
1660 * verify the addr specified
1663 if (mdb_readvar(&ql_hba
, "ql_hba") == -1) {
1664 mdb_warn("failed to read ql_hba structure");
1665 mdb_free(qlstate
, qlsize
);
1669 if (&ql_hba
== NULL
) {
1670 mdb_warn("failed to read ql_hba structure - "
1672 mdb_free(qlstate
, qlsize
);
1676 hbaptr
= (uintptr_t)ql_hba
.first
;
1677 while (hbaptr
!= NULL
) {
1679 if (mdb_vread(qlstate
, qlsize
, hbaptr
) == -1) {
1680 mdb_free(qlstate
, qlsize
);
1681 mdb_warn("failed to read "
1682 "ql_adapter_state at %p", hbaptr
);
1686 if (hbaptr
== addr
) {
1690 hbaptr
= (uintptr_t)qlstate
->hba
.next
;
1694 if (hbaptr
== NULL
) {
1695 mdb_free(qlstate
, qlsize
);
1697 mdb_warn("addr specified is not in the hba list\n");
1699 mdb_warn("instance specified does not exist\n");
1704 if (((qlstate
->ql_dump_state
& QL_DUMP_VALID
) != 0) ||
1705 (qlstate
->ql_dump_ptr
!= NULL
)) {
1706 mdb_warn("instance %d already has a valid dump\n",
1708 mdb_free(qlstate
, qlsize
);
1716 * prints out the firmware dump buffer
1719 * addr = User supplied address. (NB: must be an ha)
1720 * flags = mdb flags.
1721 * argc = Number of user supplied args.
1725 * DCMD_OK or DCMD_ERR
1732 qlc_getdump_dcmd(uintptr_t addr
, uint_t flags
, int argc
, const mdb_arg_t
*argv
)
1734 ql_adapter_state_t
*ha
;
1736 uintptr_t hbaptr
= NULL
;
1739 if ((!(flags
& DCMD_ADDRSPEC
)) || addr
== NULL
) {
1740 mdb_warn("ql_adapter_state structure addr is required");
1741 return (DCMD_USAGE
);
1744 if (mdb_getopts(argc
, argv
, 'v', MDB_OPT_SETBITS
, TRUE
, &verbose
) !=
1746 return (DCMD_USAGE
);
1750 * Get the adapter state struct which was passed
1752 if ((ha
= (ql_adapter_state_t
*)mdb_alloc(sizeof (ql_adapter_state_t
),
1753 UM_SLEEP
)) == NULL
) {
1754 mdb_warn("failed to allocate memory for ql_adapter_state\n");
1759 * show user which instances have valid f/w dumps available if
1760 * user has specified verbose option
1762 if (mdb_readvar(&ql_hba
, "ql_hba") == -1) {
1763 mdb_warn("failed to read ql_hba structure");
1764 } else if (&ql_hba
== NULL
) {
1765 mdb_warn("failed to read ql_hba structure -- is qlc loaded?");
1766 } else if (verbose
) {
1767 hbaptr
= (uintptr_t)ql_hba
.first
;
1768 while (hbaptr
!= NULL
) {
1770 if (mdb_vread(ha
, sizeof (ql_adapter_state_t
),
1772 mdb_free(ha
, sizeof (ql_adapter_state_t
));
1773 mdb_warn("failed read ql_adapter_state at %p",
1778 mdb_printf("instance %d:\n", ha
->instance
);
1779 (void) mdb_inc_indent((ulong_t
)4);
1781 if (ha
->ql_dump_state
== 0) {
1782 mdb_printf("no dump flags\n");
1784 ql_dump_flags((uint64_t)ha
->ql_dump_state
,
1788 if (ha
->ql_dump_ptr
== NULL
) {
1789 mdb_printf("no dump address\n");
1791 mdb_printf("dump address is: %p\n",
1795 (void) mdb_dec_indent((ulong_t
)4);
1797 hbaptr
= (uintptr_t)ha
->hba
.next
;
1802 if (mdb_vread(ha
, sizeof (ql_adapter_state_t
), addr
) == -1) {
1803 mdb_warn("failed to read ql_adapter_state at %p", addr
);
1804 mdb_free(ha
, sizeof (ql_adapter_state_t
));
1809 * If its not a valid dump or there's not a f/w dump binary (???)
1812 if (((ha
->ql_dump_state
& QL_DUMP_VALID
) == 0) ||
1813 (ha
->ql_dump_ptr
== NULL
)) {
1814 mdb_warn("dump does not exist for instance %d (%x, %p)\n",
1815 ha
->instance
, ha
->ql_dump_state
, ha
->ql_dump_ptr
);
1816 mdb_free(ha
, sizeof (ql_adapter_state_t
));
1820 if (CFG_IST(ha
, CFG_CTRL_2422
)) {
1821 (void) ql_24xx_dump_dcmd(ha
, flags
, argc
, argv
);
1822 } else if (CFG_IST(ha
, CFG_CTRL_25XX
)) {
1823 (void) ql_25xx_dump_dcmd(ha
, flags
, argc
, argv
);
1824 } else if (CFG_IST(ha
, CFG_CTRL_81XX
)) {
1825 (void) ql_81xx_dump_dcmd(ha
, flags
, argc
, argv
);
1826 } else if (!(CFG_IST(ha
, CFG_CTRL_8021
))) {
1827 (void) ql_23xx_dump_dcmd(ha
, flags
, argc
, argv
);
1830 mdb_free(ha
, sizeof (ql_adapter_state_t
));
1837 * prints out a firmware dump buffer
1840 * addr = User supplied address. (NB: nust be an ha)
1841 * flags = mdb flags.
1842 * argc = Number of user supplied args.
1846 * DCMD_OK or DCMD_ERR
1854 ql_23xx_dump_dcmd(ql_adapter_state_t
*ha
, uint_t flags
, int argc
,
1855 const mdb_arg_t
*argv
)
1861 fw
= (ql_fw_dump_t
*)mdb_alloc(ha
->ql_dump_size
, UM_SLEEP
);
1863 if (mdb_vread(fw
, ha
->ql_dump_size
,
1864 (uintptr_t)ha
->ql_dump_ptr
) == -1) {
1865 mdb_warn("failed to read ql_dump_ptr (no f/w dump active?)");
1866 mdb_free(fw
, ha
->ql_dump_size
);
1870 if (ha
->cfg_flags
& CFG_CTRL_2300
) {
1871 mdb_printf("\nISP 2300IP ");
1872 } else if (ha
->cfg_flags
& CFG_CTRL_6322
) {
1873 mdb_printf("\nISP 6322FLX ");
1875 mdb_printf("\nISP 2200IP ");
1878 mdb_printf("Firmware Version %d.%d.%d\n",
1879 ha
->fw_major_version
, ha
->fw_minor_version
,
1880 ha
->fw_subminor_version
);
1882 mdb_printf("\nPBIU Registers:");
1883 for (cnt
= 0; cnt
< sizeof (fw
->pbiu_reg
) / 2; cnt
++) {
1887 mdb_printf("%04x ", fw
->pbiu_reg
[cnt
]);
1890 if (ha
->cfg_flags
& (CFG_CTRL_2300
| CFG_CTRL_6322
)) {
1891 mdb_printf("\n\nReqQ-RspQ-Risc2Host Status registers:");
1892 for (cnt
= 0; cnt
< sizeof (fw
->risc_host_reg
) / 2; cnt
++) {
1896 mdb_printf("%04x ", fw
->risc_host_reg
[cnt
]);
1900 mdb_printf("\n\nMailbox Registers:");
1901 mbox_cnt
= (ha
->cfg_flags
& (CFG_CTRL_2300
| CFG_CTRL_6322
)) ? 16 : 8;
1902 for (cnt
= 0; cnt
< mbox_cnt
; cnt
++) {
1906 mdb_printf("%04x ", fw
->mailbox_reg
[cnt
]);
1909 if (ha
->cfg_flags
& (CFG_CTRL_2300
| CFG_CTRL_6322
)) {
1910 mdb_printf("\n\nAuto Request Response DMA Registers:");
1911 for (cnt
= 0; cnt
< sizeof (fw
->resp_dma_reg
) / 2; cnt
++) {
1915 mdb_printf("%04x ", fw
->resp_dma_reg
[cnt
]);
1919 mdb_printf("\n\nDMA Registers:");
1920 for (cnt
= 0; cnt
< sizeof (fw
->dma_reg
) / 2; cnt
++) {
1924 mdb_printf("%04x ", fw
->dma_reg
[cnt
]);
1927 mdb_printf("\n\nRISC Hardware Registers:");
1928 for (cnt
= 0; cnt
< sizeof (fw
->risc_hdw_reg
) / 2; cnt
++) {
1932 mdb_printf("%04x ", fw
->risc_hdw_reg
[cnt
]);
1935 mdb_printf("\n\nRISC GP0 Registers:");
1936 for (cnt
= 0; cnt
< sizeof (fw
->risc_gp0_reg
) / 2; cnt
++) {
1940 mdb_printf("%04x ", fw
->risc_gp0_reg
[cnt
]);
1943 mdb_printf("\n\nRISC GP1 Registers:");
1944 for (cnt
= 0; cnt
< sizeof (fw
->risc_gp1_reg
) / 2; cnt
++) {
1948 mdb_printf("%04x ", fw
->risc_gp1_reg
[cnt
]);
1951 mdb_printf("\n\nRISC GP2 Registers:");
1952 for (cnt
= 0; cnt
< sizeof (fw
->risc_gp2_reg
) / 2; cnt
++) {
1956 mdb_printf("%04x ", fw
->risc_gp2_reg
[cnt
]);
1959 mdb_printf("\n\nRISC GP3 Registers:");
1960 for (cnt
= 0; cnt
< sizeof (fw
->risc_gp3_reg
) / 2; cnt
++) {
1964 mdb_printf("%04x ", fw
->risc_gp3_reg
[cnt
]);
1967 mdb_printf("\n\nRISC GP4 Registers:");
1968 for (cnt
= 0; cnt
< sizeof (fw
->risc_gp4_reg
) / 2; cnt
++) {
1972 mdb_printf("%04x ", fw
->risc_gp4_reg
[cnt
]);
1975 mdb_printf("\n\nRISC GP5 Registers:");
1976 for (cnt
= 0; cnt
< sizeof (fw
->risc_gp5_reg
) / 2; cnt
++) {
1980 mdb_printf("%04x ", fw
->risc_gp5_reg
[cnt
]);
1983 mdb_printf("\n\nRISC GP6 Registers:");
1984 for (cnt
= 0; cnt
< sizeof (fw
->risc_gp6_reg
) / 2; cnt
++) {
1988 mdb_printf("%04x ", fw
->risc_gp6_reg
[cnt
]);
1991 mdb_printf("\n\nRISC GP7 Registers:");
1992 for (cnt
= 0; cnt
< sizeof (fw
->risc_gp7_reg
) / 2; cnt
++) {
1996 mdb_printf("%04x ", fw
->risc_gp7_reg
[cnt
]);
1999 mdb_printf("\n\nFrame Buffer Hardware Registers:");
2000 for (cnt
= 0; cnt
< sizeof (fw
->frame_buf_hdw_reg
) / 2; cnt
++) {
2002 ((ha
->cfg_flags
& (CFG_CTRL_2300
| CFG_CTRL_6322
)) == 0)) {
2008 mdb_printf("%04x ", fw
->frame_buf_hdw_reg
[cnt
]);
2011 mdb_printf("\n\nFPM B0 Registers:");
2012 for (cnt
= 0; cnt
< sizeof (fw
->fpm_b0_reg
) / 2; cnt
++) {
2016 mdb_printf("%04x ", fw
->fpm_b0_reg
[cnt
]);
2019 mdb_printf("\n\nFPM B1 Registers:");
2020 for (cnt
= 0; cnt
< sizeof (fw
->fpm_b1_reg
) / 2; cnt
++) {
2024 mdb_printf("%04x ", fw
->fpm_b1_reg
[cnt
]);
2027 if (ha
->cfg_flags
& (CFG_CTRL_2300
| CFG_CTRL_6322
)) {
2028 mdb_printf("\n\nCode RAM Dump:");
2029 for (cnt
= 0; cnt
< sizeof (fw
->risc_ram
) / 2; cnt
++) {
2031 mdb_printf("\n%05x: ", cnt
+ 0x0800);
2033 mdb_printf("%04x ", fw
->risc_ram
[cnt
]);
2036 mdb_printf("\n\nStack RAM Dump:");
2037 for (cnt
= 0; cnt
< sizeof (fw
->stack_ram
) / 2; cnt
++) {
2039 mdb_printf("\n%05x: ", cnt
+ 0x010000);
2041 mdb_printf("%04x ", fw
->stack_ram
[cnt
]);
2044 mdb_printf("\n\nData RAM Dump:");
2045 for (cnt
= 0; cnt
< sizeof (fw
->data_ram
) / 2; cnt
++) {
2047 mdb_printf("\n%05x: ", cnt
+ 0x010800);
2049 mdb_printf("%04x ", fw
->data_ram
[cnt
]);
2052 mdb_printf("\n\n[<==END] ISP Debug Dump.\n");
2054 mdb_printf("\n\nRequest Queue");
2056 for (cnt
= 0; cnt
< REQUEST_QUEUE_SIZE
/ 4; cnt
++) {
2058 mdb_printf("\n%08x: ", cnt
);
2060 mdb_printf("%08x ", fw
->req_q
[cnt
]);
2063 mdb_printf("\n\nResponse Queue");
2065 for (cnt
= 0; cnt
< RESPONSE_QUEUE_SIZE
/ 4; cnt
++) {
2067 mdb_printf("\n%08x: ", cnt
);
2069 mdb_printf("%08x ", fw
->rsp_q
[cnt
]);
2075 mdb_printf("\n\nRISC SRAM:");
2076 for (cnt
= 0; cnt
< 0xf000; cnt
++) {
2078 mdb_printf("\n%04x: ", cnt
+ 0x1000);
2080 mdb_printf("%04x ", fw
->risc_ram
[cnt
]);
2084 mdb_free(fw
, ha
->ql_dump_size
);
2091 * prints out a firmware dump buffer
2094 * addr = User supplied address. (NB: nust be an ha)
2095 * flags = mdb flags.
2096 * argc = Number of user supplied args.
2100 * DCMD_OK or DCMD_ERR
2108 ql_24xx_dump_dcmd(ql_adapter_state_t
*ha
, uint_t flags
, int argc
,
2109 const mdb_arg_t
*argv
)
2111 ql_24xx_fw_dump_t
*fw
;
2114 fw
= (ql_24xx_fw_dump_t
*)mdb_alloc(ha
->ql_dump_size
, UM_SLEEP
);
2116 if (mdb_vread(fw
, ha
->ql_dump_size
,
2117 (uintptr_t)ha
->ql_dump_ptr
) == -1) {
2118 mdb_warn("failed to read ql_dump_ptr (no f/w dump active?)");
2119 mdb_free(fw
, ha
->ql_dump_size
);
2123 mdb_printf("ISP FW Version %d.%02d.%02d Attributes %X\n",
2124 ha
->fw_major_version
, ha
->fw_minor_version
,
2125 ha
->fw_subminor_version
, ha
->fw_attributes
);
2127 mdb_printf("\nHCCR Register\n%08x\n", fw
->hccr
);
2129 mdb_printf("\nHost Interface Registers");
2130 for (cnt
= 0; cnt
< sizeof (fw
->host_reg
) / 4; cnt
++) {
2134 mdb_printf("%08x ", fw
->host_reg
[cnt
]);
2137 mdb_printf("\n\nMailbox Registers");
2138 for (cnt
= 0; cnt
< sizeof (fw
->mailbox_reg
) / 2; cnt
++) {
2139 if (cnt
% 16 == 0) {
2142 mdb_printf("%04x ", fw
->mailbox_reg
[cnt
]);
2145 mdb_printf("\n\nXSEQ GP Registers");
2146 for (cnt
= 0; cnt
< sizeof (fw
->xseq_gp_reg
) / 4; cnt
++) {
2150 mdb_printf("%08x ", fw
->xseq_gp_reg
[cnt
]);
2153 mdb_printf("\n\nXSEQ-0 Registers");
2154 for (cnt
= 0; cnt
< sizeof (fw
->xseq_0_reg
) / 4; cnt
++) {
2158 mdb_printf("%08x ", fw
->xseq_0_reg
[cnt
]);
2161 mdb_printf("\n\nXSEQ-1 Registers");
2162 for (cnt
= 0; cnt
< sizeof (fw
->xseq_1_reg
) / 4; cnt
++) {
2166 mdb_printf("%08x ", fw
->xseq_1_reg
[cnt
]);
2169 mdb_printf("\n\nRSEQ GP Registers");
2170 for (cnt
= 0; cnt
< sizeof (fw
->rseq_gp_reg
) / 4; cnt
++) {
2174 mdb_printf("%08x ", fw
->rseq_gp_reg
[cnt
]);
2177 mdb_printf("\n\nRSEQ-0 Registers");
2178 for (cnt
= 0; cnt
< sizeof (fw
->rseq_0_reg
) / 4; cnt
++) {
2182 mdb_printf("%08x ", fw
->rseq_0_reg
[cnt
]);
2185 mdb_printf("\n\nRSEQ-1 Registers");
2186 for (cnt
= 0; cnt
< sizeof (fw
->rseq_1_reg
) / 4; cnt
++) {
2190 mdb_printf("%08x ", fw
->rseq_1_reg
[cnt
]);
2193 mdb_printf("\n\nRSEQ-2 Registers");
2194 for (cnt
= 0; cnt
< sizeof (fw
->rseq_2_reg
) / 4; cnt
++) {
2198 mdb_printf("%08x ", fw
->rseq_2_reg
[cnt
]);
2201 mdb_printf("\n\nCommand DMA Registers");
2202 for (cnt
= 0; cnt
< sizeof (fw
->cmd_dma_reg
) / 4; cnt
++) {
2206 mdb_printf("%08x ", fw
->cmd_dma_reg
[cnt
]);
2209 mdb_printf("\n\nRequest0 Queue DMA Channel Registers");
2210 for (cnt
= 0; cnt
< sizeof (fw
->req0_dma_reg
) / 4; cnt
++) {
2214 mdb_printf("%08x ", fw
->req0_dma_reg
[cnt
]);
2217 mdb_printf("\n\nResponse0 Queue DMA Channel Registers");
2218 for (cnt
= 0; cnt
< sizeof (fw
->resp0_dma_reg
) / 4; cnt
++) {
2222 mdb_printf("%08x ", fw
->resp0_dma_reg
[cnt
]);
2225 mdb_printf("\n\nRequest1 Queue DMA Channel Registers");
2226 for (cnt
= 0; cnt
< sizeof (fw
->req1_dma_reg
) / 4; cnt
++) {
2230 mdb_printf("%08x ", fw
->req1_dma_reg
[cnt
]);
2233 mdb_printf("\n\nXMT0 Data DMA Registers");
2234 for (cnt
= 0; cnt
< sizeof (fw
->xmt0_dma_reg
) / 4; cnt
++) {
2238 mdb_printf("%08x ", fw
->xmt0_dma_reg
[cnt
]);
2241 mdb_printf("\n\nXMT1 Data DMA Registers");
2242 for (cnt
= 0; cnt
< sizeof (fw
->xmt1_dma_reg
) / 4; cnt
++) {
2246 mdb_printf("%08x ", fw
->xmt1_dma_reg
[cnt
]);
2249 mdb_printf("\n\nXMT2 Data DMA Registers");
2250 for (cnt
= 0; cnt
< sizeof (fw
->xmt2_dma_reg
) / 4; cnt
++) {
2254 mdb_printf("%08x ", fw
->xmt2_dma_reg
[cnt
]);
2257 mdb_printf("\n\nXMT3 Data DMA Registers");
2258 for (cnt
= 0; cnt
< sizeof (fw
->xmt3_dma_reg
) / 4; cnt
++) {
2262 mdb_printf("%08x ", fw
->xmt3_dma_reg
[cnt
]);
2265 mdb_printf("\n\nXMT4 Data DMA Registers");
2266 for (cnt
= 0; cnt
< sizeof (fw
->xmt4_dma_reg
) / 4; cnt
++) {
2270 mdb_printf("%08x ", fw
->xmt4_dma_reg
[cnt
]);
2273 mdb_printf("\n\nXMT Data DMA Common Registers");
2274 for (cnt
= 0; cnt
< sizeof (fw
->xmt_data_dma_reg
) / 4; cnt
++) {
2278 mdb_printf("%08x ", fw
->xmt_data_dma_reg
[cnt
]);
2281 mdb_printf("\n\nRCV Thread 0 Data DMA Registers");
2282 for (cnt
= 0; cnt
< sizeof (fw
->rcvt0_data_dma_reg
) / 4; cnt
++) {
2286 mdb_printf("%08x ", fw
->rcvt0_data_dma_reg
[cnt
]);
2289 mdb_printf("\n\nRCV Thread 1 Data DMA Registers");
2290 for (cnt
= 0; cnt
< sizeof (fw
->rcvt1_data_dma_reg
) / 4; cnt
++) {
2294 mdb_printf("%08x ", fw
->rcvt1_data_dma_reg
[cnt
]);
2297 mdb_printf("\n\nRISC GP Registers");
2298 for (cnt
= 0; cnt
< sizeof (fw
->risc_gp_reg
) / 4; cnt
++) {
2302 mdb_printf("%08x ", fw
->risc_gp_reg
[cnt
]);
2305 mdb_printf("\n\nShadow Registers");
2306 for (cnt
= 0; cnt
< sizeof (fw
->shadow_reg
) / 4; cnt
++) {
2310 mdb_printf("%08x ", fw
->shadow_reg
[cnt
]);
2313 mdb_printf("\n\nLMC Registers");
2314 for (cnt
= 0; cnt
< sizeof (fw
->lmc_reg
) / 4; cnt
++) {
2318 mdb_printf("%08x ", fw
->lmc_reg
[cnt
]);
2321 mdb_printf("\n\nFPM Hardware Registers");
2322 for (cnt
= 0; cnt
< sizeof (fw
->fpm_hdw_reg
) / 4; cnt
++) {
2326 mdb_printf("%08x ", fw
->fpm_hdw_reg
[cnt
]);
2329 mdb_printf("\n\nFB Hardware Registers");
2330 for (cnt
= 0; cnt
< sizeof (fw
->fb_hdw_reg
) / 4; cnt
++) {
2334 mdb_printf("%08x ", fw
->fb_hdw_reg
[cnt
]);
2337 mdb_printf("\n\nCode RAM");
2338 for (cnt
= 0; cnt
< sizeof (fw
->code_ram
) / 4; cnt
++) {
2340 mdb_printf("\n%08x: ", cnt
+ 0x20000);
2342 mdb_printf("%08x ", fw
->code_ram
[cnt
]);
2345 mdb_printf("\n\nExternal Memory");
2346 for (cnt
= 0; cnt
< ha
->fw_ext_memory_size
/ 4; cnt
++) {
2348 mdb_printf("\n%08x: ", cnt
+ 0x100000);
2350 mdb_printf("%08x ", fw
->ext_mem
[cnt
]);
2353 mdb_printf("\n[<==END] ISP Debug Dump");
2355 mdb_printf("\n\nRequest Queue");
2357 for (cnt
= 0; cnt
< REQUEST_QUEUE_SIZE
/ 4; cnt
++) {
2359 mdb_printf("\n%08x: ", cnt
);
2361 mdb_printf("%08x ", fw
->req_q
[cnt
]);
2364 mdb_printf("\n\nResponse Queue");
2366 for (cnt
= 0; cnt
< RESPONSE_QUEUE_SIZE
/ 4; cnt
++) {
2368 mdb_printf("\n%08x: ", cnt
);
2370 mdb_printf("%08x ", fw
->rsp_q
[cnt
]);
2373 if ((ha
->cfg_flags
& CFG_ENABLE_FWEXTTRACE
) &&
2374 (ha
->fwexttracebuf
.bp
!= NULL
)) {
2376 uint32_t *w32
= ha
->fwexttracebuf
.bp
;
2378 mdb_printf("\n\nExtended Trace Buffer Memory");
2379 /* show data address as a byte address, data as long words */
2380 for (cnt
= 0; cnt
< FWEXTSIZE
/ 4; cnt
++) {
2382 if (cnt_b
% 32 == 0) {
2383 mdb_printf("\n%08x: ", w32
+ cnt_b
);
2385 mdb_printf("%08x ", fw
->ext_trace_buf
[cnt
]);
2389 if ((ha
->cfg_flags
& CFG_ENABLE_FWFCETRACE
) &&
2390 (ha
->fwfcetracebuf
.bp
!= NULL
)) {
2392 uint32_t *w32
= ha
->fwfcetracebuf
.bp
;
2394 mdb_printf("\n\nFC Event Trace Buffer Memory");
2395 /* show data address as a byte address, data as long words */
2396 for (cnt
= 0; cnt
< FWFCESIZE
/ 4; cnt
++) {
2398 if (cnt_b
% 32 == 0) {
2399 mdb_printf("\n%08x: ", w32
+ cnt_b
);
2401 mdb_printf("%08x ", fw
->fce_trace_buf
[cnt
]);
2404 mdb_free(fw
, ha
->ql_dump_size
);
2411 * prints out a firmware dump buffer
2414 * addr = User supplied address. (NB: nust be an ha)
2415 * flags = mdb flags.
2416 * argc = Number of user supplied args.
2420 * DCMD_OK or DCMD_ERR
2428 ql_25xx_dump_dcmd(ql_adapter_state_t
*ha
, uint_t flags
, int argc
,
2429 const mdb_arg_t
*argv
)
2431 ql_25xx_fw_dump_t
*fw
;
2434 fw
= (ql_25xx_fw_dump_t
*)mdb_alloc(ha
->ql_dump_size
, UM_SLEEP
);
2436 if (mdb_vread(fw
, ha
->ql_dump_size
,
2437 (uintptr_t)ha
->ql_dump_ptr
) == -1) {
2438 mdb_warn("failed to read ql_dump_ptr (no f/w dump active?)");
2439 mdb_free(fw
, ha
->ql_dump_size
);
2443 mdb_printf("\nISP FW Version %d.%02d.%02d Attributes %X\n",
2444 ha
->fw_major_version
, ha
->fw_minor_version
,
2445 ha
->fw_subminor_version
, ha
->fw_attributes
);
2447 mdb_printf("\nR2H Register\n%08x\n", fw
->r2h_status
);
2449 mdb_printf("\n\nHostRisc Registers");
2450 for (cnt
= 0; cnt
< sizeof (fw
->hostrisc_reg
) / 4; cnt
++) {
2454 mdb_printf("%08x ", fw
->hostrisc_reg
[cnt
]);
2457 mdb_printf("\n\nPCIe Registers");
2458 for (cnt
= 0; cnt
< sizeof (fw
->pcie_reg
) / 4; cnt
++) {
2462 mdb_printf("%08x ", fw
->pcie_reg
[cnt
]);
2465 mdb_printf("\n\nHost Interface Registers");
2466 for (cnt
= 0; cnt
< sizeof (fw
->host_reg
) / 4; cnt
++) {
2470 mdb_printf("%08x ", fw
->host_reg
[cnt
]);
2473 mdb_printf("\n\nShadow Registers");
2474 for (cnt
= 0; cnt
< sizeof (fw
->shadow_reg
) / 4; cnt
++) {
2479 mdb_printf("%08x ", fw
->shadow_reg
[cnt
]);
2482 mdb_printf("\n\nMailbox Registers");
2483 for (cnt
= 0; cnt
< sizeof (fw
->mailbox_reg
) / 2; cnt
++) {
2484 if (cnt
% 16 == 0) {
2487 mdb_printf("%04x ", fw
->mailbox_reg
[cnt
]);
2490 mdb_printf("\n\nXSEQ GP Registers");
2491 for (cnt
= 0; cnt
< sizeof (fw
->xseq_gp_reg
) / 4; cnt
++) {
2495 mdb_printf("%08x ", fw
->xseq_gp_reg
[cnt
]);
2498 mdb_printf("\n\nXSEQ-0 Registers");
2499 for (cnt
= 0; cnt
< sizeof (fw
->xseq_0_reg
) / 4; cnt
++) {
2503 mdb_printf("%08x ", fw
->xseq_0_reg
[cnt
]);
2506 mdb_printf("\n\nXSEQ-1 Registers");
2507 for (cnt
= 0; cnt
< sizeof (fw
->xseq_1_reg
) / 4; cnt
++) {
2511 mdb_printf("%08x ", fw
->xseq_1_reg
[cnt
]);
2514 mdb_printf("\n\nRSEQ GP Registers");
2515 for (cnt
= 0; cnt
< sizeof (fw
->rseq_gp_reg
) / 4; cnt
++) {
2519 mdb_printf("%08x ", fw
->rseq_gp_reg
[cnt
]);
2522 mdb_printf("\n\nRSEQ-0 Registers");
2523 for (cnt
= 0; cnt
< sizeof (fw
->rseq_0_reg
) / 4; cnt
++) {
2527 mdb_printf("%08x ", fw
->rseq_0_reg
[cnt
]);
2530 mdb_printf("\n\nRSEQ-1 Registers");
2531 for (cnt
= 0; cnt
< sizeof (fw
->rseq_1_reg
) / 4; cnt
++) {
2535 mdb_printf("%08x ", fw
->rseq_1_reg
[cnt
]);
2538 mdb_printf("\n\nRSEQ-2 Registers");
2539 for (cnt
= 0; cnt
< sizeof (fw
->rseq_2_reg
) / 4; cnt
++) {
2543 mdb_printf("%08x ", fw
->rseq_2_reg
[cnt
]);
2546 mdb_printf("\n\nASEQ GP Registers");
2547 for (cnt
= 0; cnt
< sizeof (fw
->aseq_gp_reg
) / 4; cnt
++) {
2551 mdb_printf("%08x ", fw
->aseq_gp_reg
[cnt
]);
2554 mdb_printf("\n\nASEQ-0 GP Registers");
2555 for (cnt
= 0; cnt
< sizeof (fw
->aseq_0_reg
) / 4; cnt
++) {
2560 mdb_printf("%08x ", fw
->aseq_0_reg
[cnt
]);
2563 mdb_printf("\n\nASEQ-1 GP Registers");
2564 for (cnt
= 0; cnt
< sizeof (fw
->aseq_1_reg
) / 4; cnt
++) {
2569 mdb_printf("%08x ", fw
->aseq_1_reg
[cnt
]);
2572 mdb_printf("\n\nASEQ-2 GP Registers");
2573 for (cnt
= 0; cnt
< sizeof (fw
->aseq_2_reg
) / 4; cnt
++) {
2577 mdb_printf("%08x ", fw
->aseq_2_reg
[cnt
]);
2580 mdb_printf("\n\nCommand DMA Registers");
2581 for (cnt
= 0; cnt
< sizeof (fw
->cmd_dma_reg
) / 4; cnt
++) {
2585 mdb_printf("%08x ", fw
->cmd_dma_reg
[cnt
]);
2588 mdb_printf("\n\nRequest0 Queue DMA Channel Registers");
2589 for (cnt
= 0; cnt
< sizeof (fw
->req0_dma_reg
) / 4; cnt
++) {
2593 mdb_printf("%08x ", fw
->req0_dma_reg
[cnt
]);
2596 mdb_printf("\n\nResponse0 Queue DMA Channel Registers");
2597 for (cnt
= 0; cnt
< sizeof (fw
->resp0_dma_reg
) / 4; cnt
++) {
2601 mdb_printf("%08x ", fw
->resp0_dma_reg
[cnt
]);
2604 mdb_printf("\n\nRequest1 Queue DMA Channel Registers");
2605 for (cnt
= 0; cnt
< sizeof (fw
->req1_dma_reg
) / 4; cnt
++) {
2609 mdb_printf("%08x ", fw
->req1_dma_reg
[cnt
]);
2612 mdb_printf("\n\nXMT0 Data DMA Registers");
2613 for (cnt
= 0; cnt
< sizeof (fw
->xmt0_dma_reg
) / 4; cnt
++) {
2617 mdb_printf("%08x ", fw
->xmt0_dma_reg
[cnt
]);
2620 mdb_printf("\n\nXMT1 Data DMA Registers");
2621 for (cnt
= 0; cnt
< sizeof (fw
->xmt1_dma_reg
) / 4; cnt
++) {
2625 mdb_printf("%08x ", fw
->xmt1_dma_reg
[cnt
]);
2628 mdb_printf("\n\nXMT2 Data DMA Registers");
2629 for (cnt
= 0; cnt
< sizeof (fw
->xmt2_dma_reg
) / 4; cnt
++) {
2633 mdb_printf("%08x ", fw
->xmt2_dma_reg
[cnt
]);
2636 mdb_printf("\n\nXMT3 Data DMA Registers");
2637 for (cnt
= 0; cnt
< sizeof (fw
->xmt3_dma_reg
) / 4; cnt
++) {
2641 mdb_printf("%08x ", fw
->xmt3_dma_reg
[cnt
]);
2644 mdb_printf("\n\nXMT4 Data DMA Registers");
2645 for (cnt
= 0; cnt
< sizeof (fw
->xmt4_dma_reg
) / 4; cnt
++) {
2649 mdb_printf("%08x ", fw
->xmt4_dma_reg
[cnt
]);
2652 mdb_printf("\n\nXMT Data DMA Common Registers");
2653 for (cnt
= 0; cnt
< sizeof (fw
->xmt_data_dma_reg
) / 4; cnt
++) {
2657 mdb_printf("%08x ", fw
->xmt_data_dma_reg
[cnt
]);
2660 mdb_printf("\n\nRCV Thread 0 Data DMA Registers");
2661 for (cnt
= 0; cnt
< sizeof (fw
->rcvt0_data_dma_reg
) / 4; cnt
++) {
2665 mdb_printf("%08x ", fw
->rcvt0_data_dma_reg
[cnt
]);
2668 mdb_printf("\n\nRCV Thread 1 Data DMA Registers");
2669 for (cnt
= 0; cnt
< sizeof (fw
->rcvt1_data_dma_reg
) / 4; cnt
++) {
2673 mdb_printf("%08x ", fw
->rcvt1_data_dma_reg
[cnt
]);
2676 mdb_printf("\n\nRISC GP Registers");
2677 for (cnt
= 0; cnt
< sizeof (fw
->risc_gp_reg
) / 4; cnt
++) {
2681 mdb_printf("%08x ", fw
->risc_gp_reg
[cnt
]);
2684 mdb_printf("\n\nRISC IO Register\n%08x", fw
->risc_io
);
2686 mdb_printf("\n\nLMC Registers");
2687 for (cnt
= 0; cnt
< sizeof (fw
->lmc_reg
) / 4; cnt
++) {
2691 mdb_printf("%08x ", fw
->lmc_reg
[cnt
]);
2694 mdb_printf("\n\nFPM Hardware Registers");
2695 for (cnt
= 0; cnt
< sizeof (fw
->fpm_hdw_reg
) / 4; cnt
++) {
2699 mdb_printf("%08x ", fw
->fpm_hdw_reg
[cnt
]);
2702 mdb_printf("\n\nFB Hardware Registers");
2703 for (cnt
= 0; cnt
< sizeof (fw
->fb_hdw_reg
) / 4; cnt
++) {
2707 mdb_printf("%08x ", fw
->fb_hdw_reg
[cnt
]);
2710 mdb_printf("\n\nCode RAM");
2711 for (cnt
= 0; cnt
< sizeof (fw
->code_ram
) / 4; cnt
++) {
2713 mdb_printf("\n%08x: ", cnt
+ 0x20000);
2715 mdb_printf("%08x ", fw
->code_ram
[cnt
]);
2718 mdb_printf("\n\nExternal Memory");
2719 for (cnt
= 0; cnt
< ha
->fw_ext_memory_size
/ 4; cnt
++) {
2721 mdb_printf("\n%08x: ", cnt
+ 0x100000);
2723 mdb_printf("%08x ", fw
->ext_mem
[cnt
]);
2726 mdb_printf("\n[<==END] ISP Debug Dump");
2728 mdb_printf("\n\nRequest Queue");
2730 for (cnt
= 0; cnt
< REQUEST_QUEUE_SIZE
/ 4; cnt
++) {
2732 mdb_printf("\n%08x: ", cnt
);
2734 mdb_printf("%08x ", fw
->req_q
[cnt
]);
2737 mdb_printf("\n\nResponse Queue");
2739 for (cnt
= 0; cnt
< RESPONSE_QUEUE_SIZE
/ 4; cnt
++) {
2741 mdb_printf("\n%08x: ", cnt
);
2743 mdb_printf("%08x ", fw
->rsp_q
[cnt
]);
2746 if ((ha
->cfg_flags
& CFG_ENABLE_FWEXTTRACE
) &&
2747 (ha
->fwexttracebuf
.bp
!= NULL
)) {
2749 uint32_t *w32
= ha
->fwexttracebuf
.bp
;
2751 mdb_printf("\n\nExtended Trace Buffer Memory");
2752 /* show data address as a byte address, data as long words */
2753 for (cnt
= 0; cnt
< FWEXTSIZE
/ 4; cnt
++) {
2755 if (cnt_b
% 32 == 0) {
2756 mdb_printf("\n%08x: ", w32
+ cnt_b
);
2758 mdb_printf("%08x ", fw
->ext_trace_buf
[cnt
]);
2762 if ((ha
->cfg_flags
& CFG_ENABLE_FWFCETRACE
) &&
2763 (ha
->fwfcetracebuf
.bp
!= NULL
)) {
2765 uint32_t *w32
= ha
->fwfcetracebuf
.bp
;
2767 mdb_printf("\n\nFC Event Trace Buffer Memory");
2768 /* show data address as a byte address, data as long words */
2769 for (cnt
= 0; cnt
< FWFCESIZE
/ 4; cnt
++) {
2771 if (cnt_b
% 32 == 0) {
2772 mdb_printf("\n%08x: ", w32
+ cnt_b
);
2774 mdb_printf("%08x ", fw
->fce_trace_buf
[cnt
]);
2778 mdb_free(fw
, ha
->ql_dump_size
);
2780 mdb_printf("\n\nreturn exit\n");
2787 * prints out a firmware dump buffer
2790 * addr = User supplied address. (NB: nust be an ha)
2791 * flags = mdb flags.
2792 * argc = Number of user supplied args.
2796 * DCMD_OK or DCMD_ERR
2804 ql_81xx_dump_dcmd(ql_adapter_state_t
*ha
, uint_t flags
, int argc
,
2805 const mdb_arg_t
*argv
)
2807 ql_81xx_fw_dump_t
*fw
;
2810 fw
= (ql_81xx_fw_dump_t
*)mdb_alloc(ha
->ql_dump_size
, UM_SLEEP
);
2812 if (mdb_vread(fw
, ha
->ql_dump_size
,
2813 (uintptr_t)ha
->ql_dump_ptr
) == -1) {
2814 mdb_warn("failed to read ql_dump_ptr (no f/w dump active?)");
2815 mdb_free(fw
, ha
->ql_dump_size
);
2819 mdb_printf("\nISP FW Version %d.%02d.%02d Attributes %X\n",
2820 ha
->fw_major_version
, ha
->fw_minor_version
,
2821 ha
->fw_subminor_version
, ha
->fw_attributes
);
2823 mdb_printf("\nR2H Register\n%08x\n", fw
->r2h_status
);
2825 mdb_printf("\n\nHostRisc Registers");
2826 for (cnt
= 0; cnt
< sizeof (fw
->hostrisc_reg
) / 4; cnt
++) {
2830 mdb_printf("%08x ", fw
->hostrisc_reg
[cnt
]);
2833 mdb_printf("\n\nPCIe Registers");
2834 for (cnt
= 0; cnt
< sizeof (fw
->pcie_reg
) / 4; cnt
++) {
2838 mdb_printf("%08x ", fw
->pcie_reg
[cnt
]);
2841 mdb_printf("\n\nHost Interface Registers");
2842 for (cnt
= 0; cnt
< sizeof (fw
->host_reg
) / 4; cnt
++) {
2846 mdb_printf("%08x ", fw
->host_reg
[cnt
]);
2849 mdb_printf("\n\nShadow Registers");
2850 for (cnt
= 0; cnt
< sizeof (fw
->shadow_reg
) / 4; cnt
++) {
2855 mdb_printf("%08x ", fw
->shadow_reg
[cnt
]);
2858 mdb_printf("\n\nMailbox Registers");
2859 for (cnt
= 0; cnt
< sizeof (fw
->mailbox_reg
) / 2; cnt
++) {
2860 if (cnt
% 16 == 0) {
2863 mdb_printf("%04x ", fw
->mailbox_reg
[cnt
]);
2866 mdb_printf("\n\nXSEQ GP Registers");
2867 for (cnt
= 0; cnt
< sizeof (fw
->xseq_gp_reg
) / 4; cnt
++) {
2871 mdb_printf("%08x ", fw
->xseq_gp_reg
[cnt
]);
2874 mdb_printf("\n\nXSEQ-0 Registers");
2875 for (cnt
= 0; cnt
< sizeof (fw
->xseq_0_reg
) / 4; cnt
++) {
2879 mdb_printf("%08x ", fw
->xseq_0_reg
[cnt
]);
2882 mdb_printf("\n\nXSEQ-1 Registers");
2883 for (cnt
= 0; cnt
< sizeof (fw
->xseq_1_reg
) / 4; cnt
++) {
2887 mdb_printf("%08x ", fw
->xseq_1_reg
[cnt
]);
2890 mdb_printf("\n\nRSEQ GP Registers");
2891 for (cnt
= 0; cnt
< sizeof (fw
->rseq_gp_reg
) / 4; cnt
++) {
2895 mdb_printf("%08x ", fw
->rseq_gp_reg
[cnt
]);
2898 mdb_printf("\n\nRSEQ-0 Registers");
2899 for (cnt
= 0; cnt
< sizeof (fw
->rseq_0_reg
) / 4; cnt
++) {
2903 mdb_printf("%08x ", fw
->rseq_0_reg
[cnt
]);
2906 mdb_printf("\n\nRSEQ-1 Registers");
2907 for (cnt
= 0; cnt
< sizeof (fw
->rseq_1_reg
) / 4; cnt
++) {
2911 mdb_printf("%08x ", fw
->rseq_1_reg
[cnt
]);
2914 mdb_printf("\n\nRSEQ-2 Registers");
2915 for (cnt
= 0; cnt
< sizeof (fw
->rseq_2_reg
) / 4; cnt
++) {
2919 mdb_printf("%08x ", fw
->rseq_2_reg
[cnt
]);
2922 mdb_printf("\n\nASEQ GP Registers");
2923 for (cnt
= 0; cnt
< sizeof (fw
->aseq_gp_reg
) / 4; cnt
++) {
2927 mdb_printf("%08x ", fw
->aseq_gp_reg
[cnt
]);
2930 mdb_printf("\n\nASEQ-0 GP Registers");
2931 for (cnt
= 0; cnt
< sizeof (fw
->aseq_0_reg
) / 4; cnt
++) {
2936 mdb_printf("%08x ", fw
->aseq_0_reg
[cnt
]);
2939 mdb_printf("\n\nASEQ-1 GP Registers");
2940 for (cnt
= 0; cnt
< sizeof (fw
->aseq_1_reg
) / 4; cnt
++) {
2945 mdb_printf("%08x ", fw
->aseq_1_reg
[cnt
]);
2948 mdb_printf("\n\nASEQ-2 GP Registers");
2949 for (cnt
= 0; cnt
< sizeof (fw
->aseq_2_reg
) / 4; cnt
++) {
2953 mdb_printf("%08x ", fw
->aseq_2_reg
[cnt
]);
2956 mdb_printf("\n\nCommand DMA Registers");
2957 for (cnt
= 0; cnt
< sizeof (fw
->cmd_dma_reg
) / 4; cnt
++) {
2961 mdb_printf("%08x ", fw
->cmd_dma_reg
[cnt
]);
2964 mdb_printf("\n\nRequest0 Queue DMA Channel Registers");
2965 for (cnt
= 0; cnt
< sizeof (fw
->req0_dma_reg
) / 4; cnt
++) {
2969 mdb_printf("%08x ", fw
->req0_dma_reg
[cnt
]);
2972 mdb_printf("\n\nResponse0 Queue DMA Channel Registers");
2973 for (cnt
= 0; cnt
< sizeof (fw
->resp0_dma_reg
) / 4; cnt
++) {
2977 mdb_printf("%08x ", fw
->resp0_dma_reg
[cnt
]);
2980 mdb_printf("\n\nRequest1 Queue DMA Channel Registers");
2981 for (cnt
= 0; cnt
< sizeof (fw
->req1_dma_reg
) / 4; cnt
++) {
2985 mdb_printf("%08x ", fw
->req1_dma_reg
[cnt
]);
2988 mdb_printf("\n\nXMT0 Data DMA Registers");
2989 for (cnt
= 0; cnt
< sizeof (fw
->xmt0_dma_reg
) / 4; cnt
++) {
2993 mdb_printf("%08x ", fw
->xmt0_dma_reg
[cnt
]);
2996 mdb_printf("\n\nXMT1 Data DMA Registers");
2997 for (cnt
= 0; cnt
< sizeof (fw
->xmt1_dma_reg
) / 4; cnt
++) {
3001 mdb_printf("%08x ", fw
->xmt1_dma_reg
[cnt
]);
3004 mdb_printf("\n\nXMT2 Data DMA Registers");
3005 for (cnt
= 0; cnt
< sizeof (fw
->xmt2_dma_reg
) / 4; cnt
++) {
3009 mdb_printf("%08x ", fw
->xmt2_dma_reg
[cnt
]);
3012 mdb_printf("\n\nXMT3 Data DMA Registers");
3013 for (cnt
= 0; cnt
< sizeof (fw
->xmt3_dma_reg
) / 4; cnt
++) {
3017 mdb_printf("%08x ", fw
->xmt3_dma_reg
[cnt
]);
3020 mdb_printf("\n\nXMT4 Data DMA Registers");
3021 for (cnt
= 0; cnt
< sizeof (fw
->xmt4_dma_reg
) / 4; cnt
++) {
3025 mdb_printf("%08x ", fw
->xmt4_dma_reg
[cnt
]);
3028 mdb_printf("\n\nXMT Data DMA Common Registers");
3029 for (cnt
= 0; cnt
< sizeof (fw
->xmt_data_dma_reg
) / 4; cnt
++) {
3033 mdb_printf("%08x ", fw
->xmt_data_dma_reg
[cnt
]);
3036 mdb_printf("\n\nRCV Thread 0 Data DMA Registers");
3037 for (cnt
= 0; cnt
< sizeof (fw
->rcvt0_data_dma_reg
) / 4; cnt
++) {
3041 mdb_printf("%08x ", fw
->rcvt0_data_dma_reg
[cnt
]);
3044 mdb_printf("\n\nRCV Thread 1 Data DMA Registers");
3045 for (cnt
= 0; cnt
< sizeof (fw
->rcvt1_data_dma_reg
) / 4; cnt
++) {
3049 mdb_printf("%08x ", fw
->rcvt1_data_dma_reg
[cnt
]);
3052 mdb_printf("\n\nRISC GP Registers");
3053 for (cnt
= 0; cnt
< sizeof (fw
->risc_gp_reg
) / 4; cnt
++) {
3057 mdb_printf("%08x ", fw
->risc_gp_reg
[cnt
]);
3060 mdb_printf("\n\nRISC IO Register\n%08x", fw
->risc_io
);
3062 mdb_printf("\n\nLMC Registers");
3063 for (cnt
= 0; cnt
< sizeof (fw
->lmc_reg
) / 4; cnt
++) {
3067 mdb_printf("%08x ", fw
->lmc_reg
[cnt
]);
3070 mdb_printf("\n\nFPM Hardware Registers");
3071 for (cnt
= 0; cnt
< sizeof (fw
->fpm_hdw_reg
) / 4; cnt
++) {
3075 mdb_printf("%08x ", fw
->fpm_hdw_reg
[cnt
]);
3078 mdb_printf("\n\nFB Hardware Registers");
3079 for (cnt
= 0; cnt
< sizeof (fw
->fb_hdw_reg
) / 4; cnt
++) {
3083 mdb_printf("%08x ", fw
->fb_hdw_reg
[cnt
]);
3086 mdb_printf("\n\nCode RAM");
3087 for (cnt
= 0; cnt
< sizeof (fw
->code_ram
) / 4; cnt
++) {
3089 mdb_printf("\n%08x: ", cnt
+ 0x20000);
3091 mdb_printf("%08x ", fw
->code_ram
[cnt
]);
3094 mdb_printf("\n\nExternal Memory");
3095 for (cnt
= 0; cnt
< ha
->fw_ext_memory_size
/ 4; cnt
++) {
3097 mdb_printf("\n%08x: ", cnt
+ 0x100000);
3099 mdb_printf("%08x ", fw
->ext_mem
[cnt
]);
3102 mdb_printf("\n[<==END] ISP Debug Dump");
3104 mdb_printf("\n\nRequest Queue");
3106 for (cnt
= 0; cnt
< REQUEST_QUEUE_SIZE
/ 4; cnt
++) {
3108 mdb_printf("\n%08x: ", cnt
);
3110 mdb_printf("%08x ", fw
->req_q
[cnt
]);
3113 mdb_printf("\n\nResponse Queue");
3115 for (cnt
= 0; cnt
< RESPONSE_QUEUE_SIZE
/ 4; cnt
++) {
3117 mdb_printf("\n%08x: ", cnt
);
3119 mdb_printf("%08x ", fw
->rsp_q
[cnt
]);
3122 if ((ha
->cfg_flags
& CFG_ENABLE_FWEXTTRACE
) &&
3123 (ha
->fwexttracebuf
.bp
!= NULL
)) {
3125 uint32_t *w32
= ha
->fwexttracebuf
.bp
;
3127 mdb_printf("\n\nExtended Trace Buffer Memory");
3128 /* show data address as a byte address, data as long words */
3129 for (cnt
= 0; cnt
< FWEXTSIZE
/ 4; cnt
++) {
3131 if (cnt_b
% 32 == 0) {
3132 mdb_printf("\n%08x: ", w32
+ cnt_b
);
3134 mdb_printf("%08x ", fw
->ext_trace_buf
[cnt
]);
3138 if ((ha
->cfg_flags
& CFG_ENABLE_FWFCETRACE
) &&
3139 (ha
->fwfcetracebuf
.bp
!= NULL
)) {
3141 uint32_t *w32
= ha
->fwfcetracebuf
.bp
;
3143 mdb_printf("\n\nFC Event Trace Buffer Memory");
3144 /* show data address as a byte address, data as long words */
3145 for (cnt
= 0; cnt
< FWFCESIZE
/ 4; cnt
++) {
3147 if (cnt_b
% 32 == 0) {
3148 mdb_printf("\n%08x: ", w32
+ cnt_b
);
3150 mdb_printf("%08x ", fw
->fce_trace_buf
[cnt
]);
3154 mdb_free(fw
, ha
->ql_dump_size
);
3156 mdb_printf("\n\nreturn exit\n");
3163 * prints out the Extended Logging trace buffer
3166 * addr = User supplied address. (NB: must be an ha)
3167 * flags = mdb flags.
3168 * argc = Number of user supplied args.
3172 * DCMD_OK or DCMD_ERR
3179 qlc_gettrace_dcmd(uintptr_t addr
, uint_t flags
, int argc
, const mdb_arg_t
*argv
)
3181 ql_adapter_state_t
*ha
;
3186 char *dump_start
= 0;
3187 char *trace_next
= 0;
3188 char *dump_current
= 0;
3189 el_trace_desc_t
*trace_desc
;
3191 if ((!(flags
& DCMD_ADDRSPEC
)) || addr
== NULL
) {
3192 mdb_warn("ql_adapter_state structure addr is required");
3193 return (DCMD_USAGE
);
3196 if (mdb_getopts(argc
, argv
, 'v', MDB_OPT_SETBITS
, TRUE
, &verbose
) !=
3198 return (DCMD_USAGE
);
3202 * Get the adapter state struct which was passed
3204 if ((ha
= (ql_adapter_state_t
*)mdb_alloc(sizeof (ql_adapter_state_t
),
3205 UM_SLEEP
)) == NULL
) {
3206 mdb_warn("failed to allocate memory for ql_adapter_state\n");
3210 if (mdb_vread(ha
, sizeof (ql_adapter_state_t
), addr
) == -1) {
3211 mdb_warn("failed to read ql_adapter_state at %p", addr
);
3212 mdb_free(ha
, sizeof (ql_adapter_state_t
));
3217 * If its not a valid trace descriptor then bail out
3219 if (ha
->el_trace_desc
== NULL
) {
3220 mdb_warn("trace descriptor does not exist for instance %d\n",
3222 mdb_free(ha
, sizeof (ql_adapter_state_t
));
3225 trace_desc
= (el_trace_desc_t
*)
3226 mdb_alloc(sizeof (el_trace_desc_t
), UM_SLEEP
);
3227 if (mdb_vread(trace_desc
, sizeof (el_trace_desc_t
),
3228 (uintptr_t)ha
->el_trace_desc
) == -1) {
3229 mdb_warn("failed to read ql_adapter_state at %p",
3231 mdb_free(trace_desc
, sizeof (el_trace_desc_t
));
3232 mdb_free(ha
, sizeof (ql_adapter_state_t
));
3235 if (trace_desc
->trace_buffer
== NULL
) {
3236 mdb_warn("trace buffer does not exist for "
3237 "instance %d\n", ha
->instance
);
3238 mdb_free(trace_desc
, sizeof (el_trace_desc_t
));
3239 mdb_free(ha
, sizeof (ql_adapter_state_t
));
3244 /* Get the trace buffer */
3246 trace_start
= (char *)
3247 mdb_zalloc(trace_desc
->trace_buffer_size
, UM_SLEEP
);
3249 if (mdb_vread(trace_start
, trace_desc
->trace_buffer_size
,
3250 (uintptr_t)trace_desc
->trace_buffer
) == -1) {
3251 mdb_warn("failed to read trace buffer?)");
3252 mdb_free(trace_start
, trace_desc
->trace_buffer_size
);
3253 mdb_free(ha
, sizeof (ql_adapter_state_t
));
3257 /* set the end of the trace buffer. */
3258 trace_end
= trace_start
+ trace_desc
->trace_buffer_size
;
3260 /* Find the start point of trace. */
3261 trace_next
= trace_start
+ trace_desc
->next
;
3264 * If the buffer has not wrapped next will point at a null so
3265 * start is the begining of the buffer. If next points at a char
3266 * then we must traverse the buffer further until a null is detected.
3267 * The location after the null will be the beginning of the oldest
3268 * whole object in the buffer, which we use as the start.
3271 if ((trace_next
+ EL_BUFFER_RESERVE
) >= trace_end
) {
3272 dump_start
= trace_start
;
3273 } else if (*trace_next
!= NULL
) {
3274 dump_start
= trace_next
+ (strlen(trace_next
) + 1);
3276 dump_start
= trace_start
;
3279 dump_current
= dump_start
;
3281 mdb_printf("\nExtended Logging trace buffer @%x, start @%x, "
3282 "size=%d\n\n", trace_start
, dump_current
,
3283 trace_desc
->trace_buffer_size
);
3285 /* Don't run off the end, no matter what. */
3286 while (((uintptr_t)dump_current
- (uintptr_t)trace_start
) <=
3287 (uintptr_t)trace_desc
->trace_buffer_size
) {
3289 mdb_printf("%s", dump_current
);
3290 /* Calculate the next and make it the current */
3291 dump_current
+= (strlen(dump_current
) + 1);
3292 /* check for wrap */
3293 if ((dump_current
+ EL_BUFFER_RESERVE
) >= trace_end
) {
3294 mdb_printf("Wraping %x\n", dump_current
);
3295 dump_current
= trace_start
;
3297 } else if (wrapped
) {
3298 /* Don't go past next. */
3299 if ((trace_start
+ trace_desc
->next
) <= dump_current
) {
3300 mdb_printf("Done %x", dump_current
);
3303 } else if (*dump_current
== NULL
) {
3304 mdb_printf("Done %x(null)", dump_current
);
3309 mdb_free(ha
, sizeof (ql_adapter_state_t
));
3310 mdb_free(trace_start
, trace_desc
->trace_buffer_size
);
3311 mdb_free(trace_desc
, sizeof (el_trace_desc_t
));
3317 * ql generic function to call the print dcmd
3320 * addr - address to struct
3321 * prtsting - address to string
3331 ql_doprint(uintptr_t addr
, int8_t *prtstring
)
3333 struct mdb_arg printarg
;
3335 printarg
.a_un
.a_str
= (int8_t *)(mdb_zalloc(strlen(prtstring
),
3337 printarg
.a_type
= MDB_TYPE_STRING
;
3338 (void) strcpy((int8_t *)(printarg
.a_un
.a_str
), prtstring
);
3340 if ((mdb_call_dcmd("print", addr
, DCMD_ADDRSPEC
, 1,
3341 &printarg
)) == -1) {
3342 mdb_warn("ql_doprint: failed print dcmd: %s"
3343 "at addr: %llxh", prtstring
, addr
);
3346 mdb_free((void *)(printarg
.a_un
.a_str
), strlen(prtstring
));
3352 * mdb utility to print the flag string
3355 * flags - flags to print
3356 * strings - text to print when flag is set
3366 ql_dump_flags(uint64_t flags
, int8_t **strings
)
3368 int i
, linel
, first
= 1;
3373 for (i
= 0; i
< 64; i
++) {
3374 if (strings
[i
] == NULL
)
3382 linel
+= (int32_t)strlen(strings
[i
]) + 3;
3385 linel
= (int32_t)strlen(strings
[i
]) + 1 + 8;
3387 mdb_printf("%s", strings
[i
]);
3395 * MDB module linkage information
3398 * dcmd structures for the _mdb_init function
3400 static const mdb_dcmd_t dcmds
[] = {
3401 { "qlclinks", NULL
, "Prints qlc link information", qlclinks_dcmd
},
3402 { "qlcosc", NULL
, "Prints outstanding cmd info", qlc_osc_dcmd
},
3403 { "qlcver", NULL
, "Prints driver/mdb version", qlcver_dcmd
},
3404 { "qlc_elog", "[on|off] [<inst #>|all]", "Turns qlc extended logging "
3405 "on / off", qlc_el_dcmd
},
3406 { "qlcstate", ":[-v]", "Prints qlc adapter state information",
3408 { "qlctgtq", NULL
, "Prints qlc target queues", qltgtq_dcmd
},
3409 { "qlcwdog", NULL
, "Prints out watchdog linked list", qlc_wdog_dcmd
},
3410 { "qlcgetdump", ":[-v]", "Retrieves the ASCII f/w dump",
3412 { "qlcgettrace", ":[-v]", "Retrieves the ASCII Extended Logging trace",
3413 qlc_gettrace_dcmd
},
3418 * walker structures for the _mdb_init function
3420 static const mdb_walker_t walkers
[] = {
3421 { "qlcstates", "walk list of qlc ql_state_t structures",
3422 qlstates_walk_init
, qlstates_walk_step
, qlstates_walk_fini
},
3423 { "qlcsrbs", "walk list of qlc ql_srb_t strctures",
3424 qlsrb_walk_init
, qlsrb_walk_step
, qlsrb_walk_fini
},
3425 { "qlclunq", "walk list of qlc ql_lun_t strctures",
3426 qllunq_walk_init
, qllunq_walk_step
, qllunq_walk_fini
},
3430 static const mdb_modinfo_t ql_mdb_modinfo
= {
3431 MDB_API_VERSION
, dcmds
, walkers
3435 * Registration function which lists the dcmds and walker structures
3437 const mdb_modinfo_t
*
3440 return (&ql_mdb_modinfo
);