xref: /titanic_44/usr/src/uts/intel/sys/promimpl.h (revision c2e7b48d563d0e56b74d853118918af352e75cbb)
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
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
23*c2e7b48dSkalai  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef	_SYS_PROMIMPL_H
287c478bd9Sstevel@tonic-gate #define	_SYS_PROMIMPL_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate /*
337c478bd9Sstevel@tonic-gate  * Promif implementation functions and variables.
347c478bd9Sstevel@tonic-gate  *
357c478bd9Sstevel@tonic-gate  * These interfaces are not 'exported' in the same sense that
367c478bd9Sstevel@tonic-gate  * those described in promif.h
377c478bd9Sstevel@tonic-gate  *
387c478bd9Sstevel@tonic-gate  * Used so that the kernel and other stand-alones (eg boot)
397c478bd9Sstevel@tonic-gate  * don't have to directly reference the prom (of which there
407c478bd9Sstevel@tonic-gate  * are now several completely different variants).
417c478bd9Sstevel@tonic-gate  */
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate #include <sys/types.h>
447c478bd9Sstevel@tonic-gate #include <sys/promif.h>
457c478bd9Sstevel@tonic-gate #include <sys/dditypes.h>
467c478bd9Sstevel@tonic-gate #include <sys/ddidmareq.h>
477c478bd9Sstevel@tonic-gate #include <sys/ddi_impldefs.h>
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
507c478bd9Sstevel@tonic-gate extern "C" {
517c478bd9Sstevel@tonic-gate #endif
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate /*
547c478bd9Sstevel@tonic-gate  * Debugging macros for the promif functions.
557c478bd9Sstevel@tonic-gate  */
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate #define	PROMIF_DMSG_VERBOSE		2
587c478bd9Sstevel@tonic-gate #define	PROMIF_DMSG_NORMAL		1
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate extern int promif_debug;		/* externally patchable */
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate #define	PROMIF_DEBUG			/* define this to enable debugging */
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate #ifdef PROMIF_DEBUG
657c478bd9Sstevel@tonic-gate #define	PROMIF_DPRINTF(args)				\
667c478bd9Sstevel@tonic-gate 	if (promif_debug) { 				\
677c478bd9Sstevel@tonic-gate 		if (promif_debug == PROMIF_DMSG_VERBOSE)	\
687c478bd9Sstevel@tonic-gate 			prom_printf("file %s line %d: ", __FILE__, __LINE__); \
697c478bd9Sstevel@tonic-gate 		prom_printf args;			\
707c478bd9Sstevel@tonic-gate 	}
717c478bd9Sstevel@tonic-gate #else
727c478bd9Sstevel@tonic-gate #define	PROMIF_DPRINTF(args)
737c478bd9Sstevel@tonic-gate #endif /* PROMIF_DEBUG */
747c478bd9Sstevel@tonic-gate 
757c478bd9Sstevel@tonic-gate /*
767c478bd9Sstevel@tonic-gate  * minimum alignment required by prom
777c478bd9Sstevel@tonic-gate  */
787c478bd9Sstevel@tonic-gate #define	PROMIF_MIN_ALIGN	1
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate /*
817c478bd9Sstevel@tonic-gate  * Private utility routines (not exported as part of the interface)
827c478bd9Sstevel@tonic-gate  */
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate extern	char		*prom_strcpy(char *s1, char *s2);
857c478bd9Sstevel@tonic-gate extern	char		*prom_strncpy(char *s1, char *s2, size_t n);
867c478bd9Sstevel@tonic-gate extern	int		prom_strcmp(char *s1, char *s2);
877c478bd9Sstevel@tonic-gate extern	int		prom_strncmp(char *s1, char *s2, size_t n);
887c478bd9Sstevel@tonic-gate extern	int		prom_strlen(char *s);
897c478bd9Sstevel@tonic-gate extern	char		*prom_strrchr(char *s1, char c);
907c478bd9Sstevel@tonic-gate extern	char		*prom_strcat(char *s1, char *s2);
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate /*
937c478bd9Sstevel@tonic-gate  * Used to print a common before-reboot message.
947c478bd9Sstevel@tonic-gate  */
957c478bd9Sstevel@tonic-gate extern	void		prom_reboot_prompt(void);
967c478bd9Sstevel@tonic-gate 
977c478bd9Sstevel@tonic-gate /*
987c478bd9Sstevel@tonic-gate  * Some calls into the prom (those expected to generate output on the console)
997c478bd9Sstevel@tonic-gate  * are wrappered with these calls so that the caller can ensure that
1007c478bd9Sstevel@tonic-gate  * the console framebuffer will be brought to full power before entering the
1017c478bd9Sstevel@tonic-gate  * firmware.
1027c478bd9Sstevel@tonic-gate  */
1037c478bd9Sstevel@tonic-gate extern	promif_owrap_t	*promif_preout(void);
1047c478bd9Sstevel@tonic-gate extern	void		promif_postout(promif_owrap_t *);
1057c478bd9Sstevel@tonic-gate 
1067c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1077c478bd9Sstevel@tonic-gate }
1087c478bd9Sstevel@tonic-gate #endif
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate #endif /* !_SYS_PROMIMPL_H */
111