xref: /onnv-gate/usr/src/uts/sun4/sys/prom_debug.h (revision 1009:4cfac04f11ec)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
50Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
60Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
70Sstevel@tonic-gate  * with the License.
80Sstevel@tonic-gate  *
90Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
100Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
110Sstevel@tonic-gate  * See the License for the specific language governing permissions
120Sstevel@tonic-gate  * and limitations under the License.
130Sstevel@tonic-gate  *
140Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
150Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
160Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
170Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
180Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
190Sstevel@tonic-gate  *
200Sstevel@tonic-gate  * CDDL HEADER END
210Sstevel@tonic-gate  */
220Sstevel@tonic-gate /*
23*1009Smathue  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*1009Smathue  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate #ifndef	_SYS_PROM_DEBUG_H
280Sstevel@tonic-gate #define	_SYS_PROM_DEBUG_H
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
310Sstevel@tonic-gate 
320Sstevel@tonic-gate #include <sys/promif.h>
330Sstevel@tonic-gate 
340Sstevel@tonic-gate #ifdef	__cplusplus
350Sstevel@tonic-gate extern "C" {
360Sstevel@tonic-gate #endif
370Sstevel@tonic-gate 
380Sstevel@tonic-gate #if defined(DEBUG) && !defined(lint)
390Sstevel@tonic-gate 
400Sstevel@tonic-gate extern int	prom_debug;
410Sstevel@tonic-gate 
420Sstevel@tonic-gate #define	HERE	if (prom_debug)						\
430Sstevel@tonic-gate 	prom_printf("%s:%d: HERE\n", __FILE__, __LINE__)
440Sstevel@tonic-gate 
450Sstevel@tonic-gate #define	PRM_DEBUG(q)	if (prom_debug) {				\
46*1009Smathue 	prom_printf("%s:%d: '%s' is 0x%lx\n", __FILE__, __LINE__, #q,	\
47*1009Smathue 	    (long)q);							\
480Sstevel@tonic-gate }
490Sstevel@tonic-gate 
500Sstevel@tonic-gate #define	PRM_INFO(l)	if (prom_debug)					\
510Sstevel@tonic-gate 	(prom_printf("%s:%d: ", __FILE__, __LINE__), 			\
520Sstevel@tonic-gate 	prom_printf(l), prom_printf("\n"))
530Sstevel@tonic-gate 
540Sstevel@tonic-gate #define	PRM_INFO1(str, a)	if (prom_debug)				\
550Sstevel@tonic-gate 	(prom_printf("%s:%d: ", __FILE__, __LINE__), 			\
560Sstevel@tonic-gate 	prom_printf((str), (a)))
570Sstevel@tonic-gate 
580Sstevel@tonic-gate #define	PRM_INFO2(str, a, b)	if (prom_debug)				\
590Sstevel@tonic-gate 	(prom_printf("%s:%d: ", __FILE__, __LINE__), 			\
600Sstevel@tonic-gate 	prom_printf((str), (a), (b)))
610Sstevel@tonic-gate 
620Sstevel@tonic-gate #define	STUB(n)		if (prom_debug)					\
630Sstevel@tonic-gate 	(prom_printf("%s:%d: ", __FILE__, __LINE__), 			\
640Sstevel@tonic-gate 	prom_printf("STUB: %s", #n))
650Sstevel@tonic-gate 
660Sstevel@tonic-gate #else
670Sstevel@tonic-gate 
680Sstevel@tonic-gate #define	HERE
690Sstevel@tonic-gate 
700Sstevel@tonic-gate #define	PRM_DEBUG(q)
710Sstevel@tonic-gate 
720Sstevel@tonic-gate #define	PRM_INFO(l)
730Sstevel@tonic-gate 
740Sstevel@tonic-gate #define	PRM_INFO1(str, a)
750Sstevel@tonic-gate 
760Sstevel@tonic-gate #define	PRM_INFO2(str, a, b)
770Sstevel@tonic-gate 
780Sstevel@tonic-gate #define	STUB(n)
790Sstevel@tonic-gate 
800Sstevel@tonic-gate #endif /* DEBUG && !lint */
810Sstevel@tonic-gate 
820Sstevel@tonic-gate #ifdef	__cplusplus
830Sstevel@tonic-gate }
840Sstevel@tonic-gate #endif
850Sstevel@tonic-gate 
860Sstevel@tonic-gate #endif	/* _SYS_PROM_DEBUG_H */
87