xref: /titanic_41/usr/src/uts/intel/promif/prom_env.c (revision c138f478d2bc94e73ab8f6a084e323bec25e62f5)
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 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 #include <sys/promif.h>
30 #include <sys/promimpl.h>
31 
32 /*
33  * This function is installed for both pre and post output during cpr to keep
34  * the early stages of the resuming kernel from accessing outside the nucleus
35  * mapping; we assert that the console is all powered up before it is installed
36  */
37 static void
38 null_outfunc(void)
39 {
40 }
41 
42 static promif_owrap_t nullwrapper =
43 {
44 	null_outfunc,
45 	null_outfunc
46 };
47 
48 static promif_owrap_t *wrapper = &nullwrapper;
49 static promif_owrap_t pmwrapper;
50 
51 promif_owrap_t
52 *promif_preout(void)
53 {
54 	promif_owrap_t *ow = wrapper;
55 	(ow->preout)();
56 	return (ow);
57 }
58 
59 void
60 promif_postout(promif_owrap_t *ow)
61 {
62 	(ow->postout)();
63 }
64 
65 void
66 prom_set_outfuncs(void (*pref)(void), void (*postf)(void))
67 {
68 	pmwrapper.preout = pref;
69 	pmwrapper.postout = postf;
70 	wrapper = &pmwrapper;
71 }
72