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