xref: /illumos-gate/usr/src/uts/sun4/io/px/px_debug.h (revision 0114761d)
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
5f94c6026Sjj  * Common Development and Distribution License (the "License").
6f94c6026Sjj  * 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 /*
22*0114761dSAlan Adamson, SD OSSD  * Copyright 2008 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 #ifdef	__cplusplus
307c478bd9Sstevel@tonic-gate extern "C" {
317c478bd9Sstevel@tonic-gate #endif
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #include <sys/varargs.h>	/* va_list */
347c478bd9Sstevel@tonic-gate #include <sys/promif.h>		/* prom_printf */
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate typedef enum {	/* same sequence as px_debug_sym[] */
377c478bd9Sstevel@tonic-gate 	/*  0 */ DBG_ATTACH,
387c478bd9Sstevel@tonic-gate 	/*  1 */ DBG_DETACH,
397c478bd9Sstevel@tonic-gate 	/*  2 */ DBG_MAP,
407c478bd9Sstevel@tonic-gate 	/*  3 */ DBG_CTLOPS,
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate 	/*  4 */ DBG_INTROPS,
437c478bd9Sstevel@tonic-gate 	/*  5 */ DBG_A_INTX,
447c478bd9Sstevel@tonic-gate 	/*  6 */ DBG_R_INTX,
457c478bd9Sstevel@tonic-gate 	/*  7 */ DBG_INTX_INTR,
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate 	/*  8 */ DBG_MSIQ,
487c478bd9Sstevel@tonic-gate 	/*  9 */ DBG_MSIQ_INTR,
497c478bd9Sstevel@tonic-gate 	/* 10 */ DBG_MSG,
507c478bd9Sstevel@tonic-gate 	/* 11 */ DBG_MSG_INTR,
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate 	/* 12 */ DBG_A_MSIX,
537c478bd9Sstevel@tonic-gate 	/* 13 */ DBG_R_MSIX,
547c478bd9Sstevel@tonic-gate 	/* 14 */ DBG_MSIX_INTR,
557c478bd9Sstevel@tonic-gate 	/* 15 */ DBG_ERR_INTR,
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate 	/* 16 */ DBG_DMA_ALLOCH,
587c478bd9Sstevel@tonic-gate 	/* 17 */ DBG_DMA_FREEH,
597c478bd9Sstevel@tonic-gate 	/* 18 */ DBG_DMA_BINDH,
607c478bd9Sstevel@tonic-gate 	/* 19 */ DBG_DMA_UNBINDH,
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate 	/* 20 */ DBG_CHK_MOD,
637c478bd9Sstevel@tonic-gate 	/* 21 */ DBG_BYPASS,
647c478bd9Sstevel@tonic-gate 	/* 22 */ DBG_FAST_DVMA,
657c478bd9Sstevel@tonic-gate 	/* 23 */ DBG_INIT_CLD,
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate 	/* 24 */ DBG_DMA_MAP,
687c478bd9Sstevel@tonic-gate 	/* 25 */ DBG_DMA_WIN,
697c478bd9Sstevel@tonic-gate 	/* 26 */ DBG_MAP_WIN,
707c478bd9Sstevel@tonic-gate 	/* 27 */ DBG_UNMAP_WIN,
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate 	/* 28 */ DBG_DMA_CTL,
737c478bd9Sstevel@tonic-gate 	/* 29 */ DBG_DMA_SYNC,
747c478bd9Sstevel@tonic-gate 	/* 30 */ DBG_RSV1,
757c478bd9Sstevel@tonic-gate 	/* 31 */ DBG_RSV2,
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate 	/* 32 */ DBG_IB,
787c478bd9Sstevel@tonic-gate 	/* 33 */ DBG_CB,
797c478bd9Sstevel@tonic-gate 	/* 34 */ DBG_DMC,
807c478bd9Sstevel@tonic-gate 	/* 35 */ DBG_PEC,
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate 	/* 36 */ DBG_ILU,
837c478bd9Sstevel@tonic-gate 	/* 37 */ DBG_TLU,
847c478bd9Sstevel@tonic-gate 	/* 38 */ DBG_LPU,
85f8d2de6bSjchu 	/* 39 */ DBG_MMU,
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate 	/* 40 */ DBG_OPEN,
887c478bd9Sstevel@tonic-gate 	/* 41 */ DBG_CLOSE,
897c478bd9Sstevel@tonic-gate 	/* 42 */ DBG_IOCTL,
907c478bd9Sstevel@tonic-gate 	/* 43 */ DBG_PWR,
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate 	/* 44 */ DBG_LIB_CFG,
937c478bd9Sstevel@tonic-gate 	/* 45 */ DBG_LIB_INT,
947c478bd9Sstevel@tonic-gate 	/* 46 */ DBG_LIB_DMA,
957c478bd9Sstevel@tonic-gate 	/* 47 */ DBG_LIB_MSIQ,
967c478bd9Sstevel@tonic-gate 
977c478bd9Sstevel@tonic-gate 	/* 48 */ DBG_LIB_MSI,
987c478bd9Sstevel@tonic-gate 	/* 49 */ DBG_LIB_MSG,
997c478bd9Sstevel@tonic-gate 	/* 50 */ DBG_RSV4,
1007c478bd9Sstevel@tonic-gate 	/* 51 */ DBG_RSV5,
1017c478bd9Sstevel@tonic-gate 
1027c478bd9Sstevel@tonic-gate 	/* 52 */ DBG_TOOLS,
103f94c6026Sjj 	/* 53 */ DBG_PHYS_ACC,
104*0114761dSAlan Adamson, SD OSSD 	/* 54 */ DBG_HP,
105*0114761dSAlan Adamson, SD OSSD 	/* 55 */ DBG_MPS
106f94c6026Sjj 
1077c478bd9Sstevel@tonic-gate } px_debug_bit_t;
1087c478bd9Sstevel@tonic-gate 
1097c478bd9Sstevel@tonic-gate #define	DBG_BITS	6
1107c478bd9Sstevel@tonic-gate #define	DBG_CONT	(1 << DBG_BITS)
1117c478bd9Sstevel@tonic-gate #define	DBG_MASK	(DBG_CONT - 1)
112bf8fc234Set #define	DBG_MSG_SIZE	320
113bf8fc234Set 
114bf8fc234Set /* Used only during High PIL printing */
115bf8fc234Set typedef struct px_dbg_msg {
116bf8fc234Set 	boolean_t	active;
117bf8fc234Set 	px_debug_bit_t  bit;
118bf8fc234Set 	dev_info_t	*dip;
119bf8fc234Set 	char		msg[DBG_MSG_SIZE];
120bf8fc234Set } px_dbg_msg_t;
121bf8fc234Set 
122bf8fc234Set extern void px_dbg_attach(dev_info_t *dip, ddi_softint_handle_t *px_dbg_hdl);
123bf8fc234Set extern void px_dbg_detach(dev_info_t *dip, ddi_softint_handle_t *px_dbg_hdl);
1247c478bd9Sstevel@tonic-gate 
1257c478bd9Sstevel@tonic-gate #if defined(DEBUG)
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate #define	DBG px_dbg
1287c478bd9Sstevel@tonic-gate extern void px_dbg(px_debug_bit_t bit, dev_info_t *dip, char *fmt, ...);
1297c478bd9Sstevel@tonic-gate 
1307c478bd9Sstevel@tonic-gate #else	/* DEBUG */
1317c478bd9Sstevel@tonic-gate 
1327c478bd9Sstevel@tonic-gate #define	DBG 0 &&
1337c478bd9Sstevel@tonic-gate 
1347c478bd9Sstevel@tonic-gate #endif	/* DEBUG */
1357c478bd9Sstevel@tonic-gate 
1367c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1377c478bd9Sstevel@tonic-gate }
1387c478bd9Sstevel@tonic-gate #endif
1397c478bd9Sstevel@tonic-gate 
1407c478bd9Sstevel@tonic-gate #endif	/* _SYS_PX_DEBUG_H */
141