xref: /titanic_51/usr/src/cmd/fm/fmd/common/fmd_subr.h (revision 356f72340a69936724c69f2f87fffa6f5887f885)
1 /*
2  * CDDL HEADER START
3  *
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.
7  *
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.
12  *
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]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_FMD_SUBR_H
28 #define	_FMD_SUBR_H
29 
30 #include <pthread.h>
31 #include <synch.h>
32 #include <stdarg.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 #ifdef DEBUG
39 extern int fmd_assert(const char *, const char *, int);
40 #define	ASSERT(x)	((void)((x) || fmd_assert(#x, __FILE__, __LINE__)))
41 #else
42 #define	ASSERT(x)
43 #endif
44 
45 extern void fmd_vpanic(const char *, va_list);
46 extern void fmd_panic(const char *, ...);
47 
48 extern void fmd_verror(int, const char *, va_list);
49 extern void fmd_error(int, const char *, ...);
50 
51 #define	FMD_DBG_HELP	0x0001	/* display list of debugging modes and exit */
52 #define	FMD_DBG_ERR	0x0002	/* enable error handling debug messages */
53 #define	FMD_DBG_MOD	0x0004	/* enable module subsystem debug messages */
54 #define	FMD_DBG_DISP	0x0008	/* enable dispq subsystem debug messages */
55 #define	FMD_DBG_XPRT	0x0010	/* enable transport subsystem debug messages */
56 #define	FMD_DBG_EVT	0x0020	/* enable event subsystem debug messages */
57 #define	FMD_DBG_LOG	0x0040	/* enable log subsystem debug messages */
58 #define	FMD_DBG_TMR	0x0080	/* enable timer subsystem debug messages */
59 #define	FMD_DBG_FMRI	0x0100	/* enable fmri subsystem debug messages */
60 #define	FMD_DBG_ASRU	0x0200	/* enable asru subsystem debug messages */
61 #define	FMD_DBG_CASE	0x0400	/* enable case subsystem debug messages */
62 #define	FMD_DBG_CKPT	0x0800	/* enable checkpoint debug messages */
63 #define	FMD_DBG_RPC	0x1000	/* enable rpc service debug messages */
64 #define	FMD_DBG_TRACE	0x2000	/* display matching TRACE() calls */
65 #define	FMD_DBG_ALL	0x1ffe	/* enable all modes except for HELP, TRACE */
66 
67 extern void fmd_vdprintf(int, const char *, va_list);
68 extern void fmd_dprintf(int, const char *, ...);
69 
70 extern void fmd_trace_cpp(void *, const char *, int);
71 extern void *fmd_trace(uint_t, const char *, ...);
72 
73 #ifdef DEBUG
74 #define	TRACE(args)	{ fmd_trace_cpp(fmd_trace args, __FILE__, __LINE__); }
75 #else
76 #define	TRACE(args)
77 #endif
78 
79 extern const char *fmd_ea_strerror(int);
80 extern uint64_t fmd_ena(void);
81 extern uint32_t fmd_ntz32(uint32_t);
82 
83 #ifdef	__cplusplus
84 }
85 #endif
86 
87 #endif	/* _FMD_SUBR_H */
88