xref: /illumos-gate/usr/src/uts/sun4/io/px/px_debug.h (revision bf8fc234)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5f94c6026Sjj156685  * Common Development and Distribution License (the "License").
6f94c6026Sjj156685  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22f94c6026Sjj156685  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_SYS_PX_DEBUG_H
277c478bd9Sstevel@tonic-gate #define	_SYS_PX_DEBUG_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #include <sys/varargs.h>	/* va_list */
367c478bd9Sstevel@tonic-gate #include <sys/promif.h>		/* prom_printf */
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate typedef enum {	/* same sequence as px_debug_sym[] */
397c478bd9Sstevel@tonic-gate 	/*  0 */ DBG_ATTACH,
407c478bd9Sstevel@tonic-gate 	/*  1 */ DBG_DETACH,
417c478bd9Sstevel@tonic-gate 	/*  2 */ DBG_MAP,
427c478bd9Sstevel@tonic-gate 	/*  3 */ DBG_CTLOPS,
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate 	/*  4 */ DBG_INTROPS,
457c478bd9Sstevel@tonic-gate 	/*  5 */ DBG_A_INTX,
467c478bd9Sstevel@tonic-gate 	/*  6 */ DBG_R_INTX,
477c478bd9Sstevel@tonic-gate 	/*  7 */ DBG_INTX_INTR,
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate 	/*  8 */ DBG_MSIQ,
507c478bd9Sstevel@tonic-gate 	/*  9 */ DBG_MSIQ_INTR,
517c478bd9Sstevel@tonic-gate 	/* 10 */ DBG_MSG,
527c478bd9Sstevel@tonic-gate 	/* 11 */ DBG_MSG_INTR,
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate 	/* 12 */ DBG_A_MSIX,
557c478bd9Sstevel@tonic-gate 	/* 13 */ DBG_R_MSIX,
567c478bd9Sstevel@tonic-gate 	/* 14 */ DBG_MSIX_INTR,
577c478bd9Sstevel@tonic-gate 	/* 15 */ DBG_ERR_INTR,
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate 	/* 16 */ DBG_DMA_ALLOCH,
607c478bd9Sstevel@tonic-gate 	/* 17 */ DBG_DMA_FREEH,
617c478bd9Sstevel@tonic-gate 	/* 18 */ DBG_DMA_BINDH,
627c478bd9Sstevel@tonic-gate 	/* 19 */ DBG_DMA_UNBINDH,
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate 	/* 20 */ DBG_CHK_MOD,
657c478bd9Sstevel@tonic-gate 	/* 21 */ DBG_BYPASS,
667c478bd9Sstevel@tonic-gate 	/* 22 */ DBG_FAST_DVMA,
677c478bd9Sstevel@tonic-gate 	/* 23 */ DBG_INIT_CLD,
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate 	/* 24 */ DBG_DMA_MAP,
707c478bd9Sstevel@tonic-gate 	/* 25 */ DBG_DMA_WIN,
717c478bd9Sstevel@tonic-gate 	/* 26 */ DBG_MAP_WIN,
727c478bd9Sstevel@tonic-gate 	/* 27 */ DBG_UNMAP_WIN,
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate 	/* 28 */ DBG_DMA_CTL,
757c478bd9Sstevel@tonic-gate 	/* 29 */ DBG_DMA_SYNC,
767c478bd9Sstevel@tonic-gate 	/* 30 */ DBG_RSV1,
777c478bd9Sstevel@tonic-gate 	/* 31 */ DBG_RSV2,
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate 	/* 32 */ DBG_IB,
807c478bd9Sstevel@tonic-gate 	/* 33 */ DBG_CB,
817c478bd9Sstevel@tonic-gate 	/* 34 */ DBG_DMC,
827c478bd9Sstevel@tonic-gate 	/* 35 */ DBG_PEC,
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate 	/* 36 */ DBG_ILU,
857c478bd9Sstevel@tonic-gate 	/* 37 */ DBG_TLU,
867c478bd9Sstevel@tonic-gate 	/* 38 */ DBG_LPU,
87f8d2de6bSjchu 	/* 39 */ DBG_MMU,
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate 	/* 40 */ DBG_OPEN,
907c478bd9Sstevel@tonic-gate 	/* 41 */ DBG_CLOSE,
917c478bd9Sstevel@tonic-gate 	/* 42 */ DBG_IOCTL,
927c478bd9Sstevel@tonic-gate 	/* 43 */ DBG_PWR,
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate 	/* 44 */ DBG_LIB_CFG,
957c478bd9Sstevel@tonic-gate 	/* 45 */ DBG_LIB_INT,
967c478bd9Sstevel@tonic-gate 	/* 46 */ DBG_LIB_DMA,
977c478bd9Sstevel@tonic-gate 	/* 47 */ DBG_LIB_MSIQ,
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate 	/* 48 */ DBG_LIB_MSI,
1007c478bd9Sstevel@tonic-gate 	/* 49 */ DBG_LIB_MSG,
1017c478bd9Sstevel@tonic-gate 	/* 50 */ DBG_RSV4,
1027c478bd9Sstevel@tonic-gate 	/* 51 */ DBG_RSV5,
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate 	/* 52 */ DBG_TOOLS,
105f94c6026Sjj156685 	/* 53 */ DBG_PHYS_ACC,
106f94c6026Sjj156685 
107f94c6026Sjj156685 	/* 54 */ DBG_HP
1087c478bd9Sstevel@tonic-gate } px_debug_bit_t;
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate #define	DBG_BITS	6
1117c478bd9Sstevel@tonic-gate #define	DBG_CONT	(1 << DBG_BITS)
1127c478bd9Sstevel@tonic-gate #define	DBG_MASK	(DBG_CONT - 1)
113*bf8fc234Set142600 #define	DBG_MSG_SIZE	320
114*bf8fc234Set142600 
115*bf8fc234Set142600 /* Used only during High PIL printing */
116*bf8fc234Set142600 typedef struct px_dbg_msg {
117*bf8fc234Set142600 	boolean_t	active;
118*bf8fc234Set142600 	px_debug_bit_t  bit;
119*bf8fc234Set142600 	dev_info_t	*dip;
120*bf8fc234Set142600 	char		msg[DBG_MSG_SIZE];
121*bf8fc234Set142600 } px_dbg_msg_t;
122*bf8fc234Set142600 
123*bf8fc234Set142600 extern void px_dbg_attach(dev_info_t *dip, ddi_softint_handle_t *px_dbg_hdl);
124*bf8fc234Set142600 extern void px_dbg_detach(dev_info_t *dip, ddi_softint_handle_t *px_dbg_hdl);
1257c478bd9Sstevel@tonic-gate 
1267c478bd9Sstevel@tonic-gate #if defined(DEBUG)
1277c478bd9Sstevel@tonic-gate 
1287c478bd9Sstevel@tonic-gate #define	DBG px_dbg
1297c478bd9Sstevel@tonic-gate extern void px_dbg(px_debug_bit_t bit, dev_info_t *dip, char *fmt, ...);
1307c478bd9Sstevel@tonic-gate 
1317c478bd9Sstevel@tonic-gate #else	/* DEBUG */
1327c478bd9Sstevel@tonic-gate 
1337c478bd9Sstevel@tonic-gate #define	DBG 0 &&
1347c478bd9Sstevel@tonic-gate 
1357c478bd9Sstevel@tonic-gate #endif	/* DEBUG */
1367c478bd9Sstevel@tonic-gate 
1377c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1387c478bd9Sstevel@tonic-gate }
1397c478bd9Sstevel@tonic-gate #endif
1407c478bd9Sstevel@tonic-gate 
1417c478bd9Sstevel@tonic-gate #endif	/* _SYS_PX_DEBUG_H */
142