enable.c revision 1.9 1 1.9 tsutsui /* $NetBSD: enable.c,v 1.9 2013/09/06 17:43:19 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 *
19 1.2 gwr * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 1.2 gwr * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 1.2 gwr * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 1.2 gwr * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 1.2 gwr * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 1.2 gwr * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 1.2 gwr * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 1.2 gwr * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 1.2 gwr * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 1.2 gwr * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 1.2 gwr * POSSIBILITY OF SUCH DAMAGE.
30 1.2 gwr */
31 1.4 lukem
32 1.4 lukem #include <sys/cdefs.h>
33 1.9 tsutsui __KERNEL_RCSID(0, "$NetBSD: enable.c,v 1.9 2013/09/06 17:43:19 tsutsui Exp $");
34 1.2 gwr
35 1.2 gwr #include <sys/param.h>
36 1.7 tsutsui #include <uvm/uvm_extern.h>
37 1.7 tsutsui #include <machine/bus.h>
38 1.3 thorpej #include <dev/sun/fbio.h>
39 1.2 gwr #include <sun3/dev/fbvar.h>
40 1.2 gwr #include <sun3/sun3/machdep.h>
41 1.2 gwr #include <sun3/sun3x/enable.h>
42 1.2 gwr #include <sun3/sun3x/obio.h>
43 1.2 gwr
44 1.2 gwr volatile short *enable_reg;
45 1.2 gwr
46 1.9 tsutsui void
47 1.5 chs enable_init(void)
48 1.2 gwr {
49 1.7 tsutsui vaddr_t va;
50 1.2 gwr
51 1.7 tsutsui find_prom_map(OBIO_ENABLEREG, PMAP_OBIO, 2, &va);
52 1.7 tsutsui enable_reg = (void *)va;
53 1.2 gwr }
54 1.2 gwr
55 1.2 gwr
56 1.2 gwr /*
57 1.2 gwr * External interfaces to the system enable register.
58 1.2 gwr */
59 1.2 gwr
60 1.9 tsutsui void
61 1.5 chs enable_fpu(int on)
62 1.2 gwr {
63 1.2 gwr int s;
64 1.2 gwr short ena;
65 1.2 gwr
66 1.2 gwr s = splhigh();
67 1.2 gwr ena = *enable_reg;
68 1.2 gwr
69 1.2 gwr if (on)
70 1.2 gwr ena |= ENA_FPP;
71 1.2 gwr else
72 1.2 gwr ena &= ~ENA_FPP;
73 1.2 gwr
74 1.2 gwr *enable_reg = ena;
75 1.2 gwr splx(s);
76 1.2 gwr }
77 1.2 gwr
78 1.9 tsutsui void
79 1.5 chs enable_video(int on)
80 1.2 gwr {
81 1.2 gwr int s;
82 1.2 gwr short ena;
83 1.2 gwr
84 1.2 gwr s = splhigh();
85 1.2 gwr ena = *enable_reg;
86 1.2 gwr
87 1.2 gwr if (on)
88 1.2 gwr ena |= ENA_VIDEO;
89 1.2 gwr else
90 1.2 gwr ena &= ~ENA_VIDEO;
91 1.2 gwr
92 1.2 gwr *enable_reg = ena;
93 1.2 gwr splx(s);
94 1.2 gwr }
95 1.2 gwr
96