xref: /illumos-gate/usr/src/uts/intel/sys/promimpl.h (revision 1a578a15d3f76161f037cd99883a1f54a9eda785)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * Promif implementation functions and variables.
34  *
35  * These interfaces are not 'exported' in the same sense that
36  * those described in promif.h
37  *
38  * Used so that the kernel and other stand-alones (eg boot)
39  * don't have to directly reference the prom (of which there
40  * are now several completely different variants).
41  */
42 
43 #include <sys/types.h>
44 #include <sys/promif.h>
45 #include <sys/dditypes.h>
46 #include <sys/ddidmareq.h>
47 #include <sys/ddi_impldefs.h>
48 
49 #ifdef	__cplusplus
50 extern "C" {
51 #endif
52 
53 /*
54  * Debugging macros for the promif functions.
55  */
56 
57 #define	PROMIF_DMSG_VERBOSE		2
58 #define	PROMIF_DMSG_NORMAL		1
59 
60 extern int promif_debug;		/* externally patchable */
61 
62 #define	PROMIF_DEBUG			/* define this to enable debugging */
63 
64 #ifdef PROMIF_DEBUG
65 #define	PROMIF_DPRINTF(args)				\
66 	if (promif_debug) { 				\
67 		if (promif_debug == PROMIF_DMSG_VERBOSE)	\
68 			prom_printf("file %s line %d: ", __FILE__, __LINE__); \
69 		prom_printf args;			\
70 	}
71 #else
72 #define	PROMIF_DPRINTF(args)
73 #endif /* PROMIF_DEBUG */
74 
75 /*
76  * minimum alignment required by prom
77  */
78 #define	PROMIF_MIN_ALIGN	1
79 
80 /*
81  * Private utility routines (not exported as part of the interface)
82  */
83 
84 extern	char		*prom_strcpy(char *s1, char *s2);
85 extern	char		*prom_strncpy(char *s1, char *s2, size_t n);
86 extern	int		prom_strcmp(char *s1, char *s2);
87 extern	int		prom_strncmp(char *s1, char *s2, size_t n);
88 extern	int		prom_strlen(char *s);
89 extern	char		*prom_strrchr(char *s1, char c);
90 extern	char		*prom_strcat(char *s1, char *s2);
91 
92 /*
93  * Used to print a common before-reboot message.
94  */
95 extern	void		prom_reboot_prompt(void);
96 
97 /*
98  * Some calls into the prom (those expected to generate output on the console)
99  * are wrappered with these calls so that the caller can ensure that
100  * the console framebuffer will be brought to full power before entering the
101  * firmware.
102  */
103 extern	promif_owrap_t	*promif_preout(void);
104 extern	void		promif_postout(promif_owrap_t *);
105 
106 #ifdef	__cplusplus
107 }
108 #endif
109 
110 #endif /* !_SYS_PROMIMPL_H */
111