xref: /illumos-gate/usr/src/uts/intel/sys/promimpl.h (revision 2d6eb4a5)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_PROMIMPL_H
28 #define	_SYS_PROMIMPL_H
29 
30 /*
31  * Promif implementation functions and variables.
32  *
33  * These interfaces are not 'exported' in the same sense that
34  * those described in promif.h
35  *
36  * Used so that the kernel and other stand-alones (eg boot)
37  * don't have to directly reference the prom (of which there
38  * are now several completely different variants).
39  */
40 
41 #include <sys/types.h>
42 #include <sys/promif.h>
43 #include <sys/dditypes.h>
44 #include <sys/ddidmareq.h>
45 #include <sys/ddi_impldefs.h>
46 
47 #ifdef	__cplusplus
48 extern "C" {
49 #endif
50 
51 /*
52  * Debugging macros for the promif functions.
53  */
54 
55 #define	PROMIF_DMSG_VERBOSE		2
56 #define	PROMIF_DMSG_NORMAL		1
57 
58 extern int promif_debug;		/* externally patchable */
59 
60 #define	PROMIF_DEBUG			/* define this to enable debugging */
61 
62 #ifdef PROMIF_DEBUG
63 #define	PROMIF_DPRINTF(args)				\
64 	if (promif_debug) { 				\
65 		if (promif_debug == PROMIF_DMSG_VERBOSE)	\
66 			prom_printf("file %s line %d: ", __FILE__, __LINE__); \
67 		prom_printf args;			\
68 	}
69 #else
70 #define	PROMIF_DPRINTF(args)
71 #endif /* PROMIF_DEBUG */
72 
73 /*
74  * minimum alignment required by prom
75  */
76 #define	PROMIF_MIN_ALIGN	1
77 
78 /*
79  * Private utility routines (not exported as part of the interface)
80  */
81 
82 extern	char		*prom_strcpy(char *s1, char *s2);
83 extern	char		*prom_strncpy(char *s1, char *s2, size_t n);
84 extern	int		prom_strcmp(char *s1, char *s2);
85 extern	int		prom_strncmp(char *s1, char *s2, size_t n);
86 extern	int		prom_strlen(char *s);
87 extern	char		*prom_strrchr(char *s1, char c);
88 extern	char		*prom_strcat(char *s1, char *s2);
89 
90 /*
91  * Used to print a common before-reboot message.
92  */
93 extern	void		prom_reboot_prompt(void);
94 
95 /*
96  * Some calls into the prom (those expected to generate output on the console)
97  * are wrappered with these calls so that the caller can ensure that
98  * the console framebuffer will be brought to full power before entering the
99  * firmware.
100  */
101 extern	promif_owrap_t	*promif_preout(void);
102 extern	void		promif_postout(promif_owrap_t *);
103 
104 #ifdef	__cplusplus
105 }
106 #endif
107 
108 #endif /* !_SYS_PROMIMPL_H */
109