xref: /onnv-gate/usr/src/uts/intel/io/dktp/hba/ghd/ghd_debug.c (revision 5295:a21f2449e5f9)
11709Smlf /*
21709Smlf  * CDDL HEADER START
31709Smlf  *
41709Smlf  * The contents of this file are subject to the terms of the
51709Smlf  * Common Development and Distribution License (the "License").
61709Smlf  * You may not use this file except in compliance with the License.
71709Smlf  *
81709Smlf  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
91709Smlf  * or http://www.opensolaris.org/os/licensing.
101709Smlf  * See the License for the specific language governing permissions
111709Smlf  * and limitations under the License.
121709Smlf  *
131709Smlf  * When distributing Covered Code, include this CDDL HEADER in each
141709Smlf  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
151709Smlf  * If applicable, add the following below this CDDL HEADER, with the
161709Smlf  * fields enclosed by brackets "[]" replaced with your own identifying
171709Smlf  * information: Portions Copyright [yyyy] [name of copyright owner]
181709Smlf  *
191709Smlf  * CDDL HEADER END
201709Smlf  */
211709Smlf 
221709Smlf /*
23*5295Srandyf  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
241709Smlf  * Use is subject to license terms.
251709Smlf  */
261709Smlf 
271709Smlf #pragma ident	"%Z%%M%	%I%	%E% SMI"
281709Smlf 
291709Smlf #include "ghd.h"
301709Smlf #include "ghd_debug.h"
311709Smlf 
321709Smlf #if !(defined(GHD_DEBUG) || defined(__lint))
331709Smlf ulong_t	ghd_debug_flags = 0;
341709Smlf #else
351709Smlf ulong_t	ghd_debug_flags = GDBG_FLAG_ERROR
361709Smlf 		/*	| GDBG_FLAG_WAITQ	*/
371709Smlf 		/*	| GDBG_FLAG_INTR	*/
381709Smlf 		/*	| GDBG_FLAG_START	*/
391709Smlf 		/*	| GDBG_FLAG_WARN	*/
401709Smlf 		/*	| GDBG_FLAG_DMA		*/
411709Smlf 		/*	| GDBG_FLAG_PEND_INTR	*/
421709Smlf 		/*	| GDBG_FLAG_START	*/
431709Smlf 		/*	| GDBG_FLAG_PKT		*/
441709Smlf 		/*	| GDBG_FLAG_INIT	*/
451709Smlf 			;
461709Smlf #endif
471709Smlf 
481709Smlf void
ghd_err(const char * fmt,...)491709Smlf ghd_err(const char *fmt, ...)
501709Smlf {
511709Smlf 	va_list	ap;
521709Smlf 
531709Smlf 	va_start(ap, fmt);
541709Smlf 	vcmn_err(CE_CONT, fmt, ap);
551709Smlf 	va_end(ap);
561709Smlf }
571709Smlf 
581709Smlf #if defined(GHD_DEBUG)
59*5295Srandyf #include <sys/promif.h>
601709Smlf #define	PRF	prom_printf
611709Smlf 
621709Smlf static void
ghd_dump_ccc(ccc_t * P)631709Smlf ghd_dump_ccc(ccc_t *P)
641709Smlf {
651709Smlf 	PRF("nextp 0x%p tmrp 0x%p label 0x%p &mutex 0x%p\n",
66*5295Srandyf 	    P->ccc_nextp, P->ccc_tmrp, P->ccc_label, &P->ccc_activel_mutex);
671709Smlf 	PRF("&activel 0x%p dip 0x%p iblock 0x%p\n",
68*5295Srandyf 	    &P->ccc_activel, P->ccc_hba_dip, P->ccc_iblock);
691709Smlf 	PRF("softid 0x%p &hba_mutext 0x%p\n poll 0x%p\n",
70*5295Srandyf 	    P->ccc_soft_id, &P->ccc_hba_mutex, &P->ccc_hba_pollmode);
711709Smlf 	PRF("&devs 0x%p &waitq_mutex 0x%p &waitq 0x%p\n",
72*5295Srandyf 	    &P->ccc_devs, &P->ccc_waitq_mutex, &P->ccc_waitq);
731709Smlf 	PRF("waitq_freezetime 0x%p waitq_freezedelay %p\n",
74*5295Srandyf 	    &P->ccc_waitq_freezetime, &P->ccc_waitq_freezedelay);
751709Smlf 	PRF("dq softid 0x%p &dq_mutex 0x%p &doneq 0x%p\n",
76*5295Srandyf 	    P->ccc_doneq_softid, &P->ccc_doneq_mutex, &P->ccc_doneq);
771709Smlf 	PRF("handle 0x%p &ccballoc 0x%p\n",
78*5295Srandyf 	    P->ccc_hba_handle, &P->ccc_ccballoc);
791709Smlf 	PRF("hba_reset_notify_callback 0x%p notify_list 0x%p mutex 0x%p\n",
80*5295Srandyf 	    P->ccc_hba_reset_notify_callback, &P->ccc_reset_notify_list,
81*5295Srandyf 	    &P->ccc_reset_notify_mutex);
821709Smlf }
831709Smlf 
841709Smlf 
851709Smlf static void
ghd_dump_gcmd(gcmd_t * P)861709Smlf ghd_dump_gcmd(gcmd_t *P)
871709Smlf {
881709Smlf 	PRF("cmd_q nextp 0x%p prevp 0x%p private 0x%p\n",
891709Smlf 	    P->cmd_q.l2_nextp, P->cmd_q.l2_prevp, P->cmd_q.l2_private);
901709Smlf 	PRF("state %ul wq lev %ld flags 0x%x\n",
911709Smlf 	    P->cmd_state, P->cmd_waitq_level, P->cmd_flags);
921709Smlf 	PRF("timer Q nextp 0x%p prevp 0x%p private 0x%p\n",
931709Smlf 	    P->cmd_timer_link.l2_nextp, P->cmd_timer_link.l2_prevp,
941709Smlf 	    P->cmd_timer_link.l2_private);
951709Smlf 
961709Smlf 	PRF("start time 0x%lx timeout 0x%lx hba private 0x%p pktp 0x%p\n",
971709Smlf 	    P->cmd_start_time, P->cmd_timeout, P->cmd_private, P->cmd_pktp);
981709Smlf 	PRF("gtgtp 0x%p dma_flags 0x%x dma_handle 0x%p dmawin 0x%p "
991709Smlf 	    "dmaseg 0x%p\n", P->cmd_gtgtp, P->cmd_dma_flags,
1001709Smlf 	    P->cmd_dma_handle, P->cmd_dmawin, P->cmd_dmaseg);
1011709Smlf 	PRF("wcount %d windex %d ccount %d cindex %d\n",
1021709Smlf 	    P->cmd_wcount, P->cmd_windex, P->cmd_ccount, P->cmd_cindex);
1031709Smlf 	PRF("totxfer %ld\n", P->cmd_totxfer);
1041709Smlf }
1051709Smlf #endif
106