enable.c revision 1.7 1 1.7 tsutsui /* $NetBSD: enable.c,v 1.7 2006/10/03 13:02:32 tsutsui Exp $ */
2 1.2 gwr
3 1.2 gwr /*-
4 1.2 gwr * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 1.2 gwr * All rights reserved.
6 1.2 gwr *
7 1.2 gwr * This code is derived from software contributed to The NetBSD Foundation
8 1.2 gwr * by Gordon W. Ross.
9 1.2 gwr *
10 1.2 gwr * Redistribution and use in source and binary forms, with or without
11 1.2 gwr * modification, are permitted provided that the following conditions
12 1.2 gwr * are met:
13 1.2 gwr * 1. Redistributions of source code must retain the above copyright
14 1.2 gwr * notice, this list of conditions and the following disclaimer.
15 1.2 gwr * 2. Redistributions in binary form must reproduce the above copyright
16 1.2 gwr * notice, this list of conditions and the following disclaimer in the
17 1.2 gwr * documentation and/or other materials provided with the distribution.
18 1.2 gwr * 3. All advertising materials mentioning features or use of this software
19 1.2 gwr * must display the following acknowledgement:
20 1.2 gwr * This product includes software developed by the NetBSD
21 1.2 gwr * Foundation, Inc. and its contributors.
22 1.2 gwr * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.2 gwr * contributors may be used to endorse or promote products derived
24 1.2 gwr * from this software without specific prior written permission.
25 1.2 gwr *
26 1.2 gwr * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.2 gwr * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.2 gwr * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.2 gwr * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.2 gwr * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.2 gwr * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.2 gwr * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.2 gwr * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.2 gwr * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.2 gwr * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.2 gwr * POSSIBILITY OF SUCH DAMAGE.
37 1.2 gwr */
38 1.4 lukem
39 1.4 lukem #include <sys/cdefs.h>
40 1.7 tsutsui __KERNEL_RCSID(0, "$NetBSD: enable.c,v 1.7 2006/10/03 13:02:32 tsutsui Exp $");
41 1.2 gwr
42 1.2 gwr #include <sys/param.h>
43 1.7 tsutsui #include <uvm/uvm_extern.h>
44 1.7 tsutsui #include <machine/bus.h>
45 1.3 thorpej #include <dev/sun/fbio.h>
46 1.2 gwr #include <sun3/dev/fbvar.h>
47 1.2 gwr #include <sun3/sun3/machdep.h>
48 1.2 gwr #include <sun3/sun3x/enable.h>
49 1.2 gwr #include <sun3/sun3x/obio.h>
50 1.2 gwr
51 1.2 gwr volatile short *enable_reg;
52 1.2 gwr
53 1.5 chs void
54 1.5 chs enable_init(void)
55 1.2 gwr {
56 1.7 tsutsui vaddr_t va;
57 1.2 gwr
58 1.7 tsutsui find_prom_map(OBIO_ENABLEREG, PMAP_OBIO, 2, &va);
59 1.7 tsutsui enable_reg = (void *)va;
60 1.2 gwr }
61 1.2 gwr
62 1.2 gwr
63 1.2 gwr /*
64 1.2 gwr * External interfaces to the system enable register.
65 1.2 gwr */
66 1.2 gwr
67 1.5 chs void
68 1.5 chs enable_fpu(int on)
69 1.2 gwr {
70 1.2 gwr int s;
71 1.2 gwr short ena;
72 1.2 gwr
73 1.2 gwr s = splhigh();
74 1.2 gwr ena = *enable_reg;
75 1.2 gwr
76 1.2 gwr if (on)
77 1.2 gwr ena |= ENA_FPP;
78 1.2 gwr else
79 1.2 gwr ena &= ~ENA_FPP;
80 1.2 gwr
81 1.2 gwr *enable_reg = ena;
82 1.2 gwr splx(s);
83 1.2 gwr }
84 1.2 gwr
85 1.5 chs void
86 1.5 chs enable_video(int on)
87 1.2 gwr {
88 1.2 gwr int s;
89 1.2 gwr short ena;
90 1.2 gwr
91 1.2 gwr s = splhigh();
92 1.2 gwr ena = *enable_reg;
93 1.2 gwr
94 1.2 gwr if (on)
95 1.2 gwr ena |= ENA_VIDEO;
96 1.2 gwr else
97 1.2 gwr ena &= ~ENA_VIDEO;
98 1.2 gwr
99 1.2 gwr *enable_reg = ena;
100 1.2 gwr splx(s);
101 1.2 gwr }
102 1.2 gwr
103