Home | History | Annotate | Line # | Download | only in sun3x
enable.c revision 1.3.20.2
      1  1.3.20.1    skrll /*	$NetBSD: enable.c,v 1.3.20.2 2004/09/18 14:41:56 skrll 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.2      gwr 
     39  1.3.20.1    skrll #include <sys/cdefs.h>
     40  1.3.20.1    skrll __KERNEL_RCSID(0, "$NetBSD: enable.c,v 1.3.20.2 2004/09/18 14:41:56 skrll Exp $");
     41  1.3.20.1    skrll 
     42       1.2      gwr #include <sys/param.h>
     43       1.3  thorpej #include <dev/sun/fbio.h>
     44       1.2      gwr #include <sun3/dev/fbvar.h>
     45       1.2      gwr #include <sun3/sun3/machdep.h>
     46       1.2      gwr #include <sun3/sun3x/enable.h>
     47       1.2      gwr #include <sun3/sun3x/obio.h>
     48       1.2      gwr 
     49       1.2      gwr volatile short *enable_reg;
     50       1.2      gwr 
     51       1.2      gwr void
     52       1.2      gwr enable_init()
     53       1.2      gwr {
     54       1.2      gwr 
     55       1.2      gwr 	enable_reg = (short*) obio_find_mapping(OBIO_ENABLEREG, 2);
     56       1.2      gwr }
     57       1.2      gwr 
     58       1.2      gwr 
     59       1.2      gwr /*
     60       1.2      gwr  * External interfaces to the system enable register.
     61       1.2      gwr  */
     62       1.2      gwr 
     63       1.2      gwr void
     64       1.2      gwr enable_fpu(on)
     65       1.2      gwr 	int on;
     66       1.2      gwr {
     67       1.2      gwr 	int s;
     68       1.2      gwr 	short ena;
     69       1.2      gwr 
     70       1.2      gwr 	s = splhigh();
     71       1.2      gwr 	ena = *enable_reg;
     72       1.2      gwr 
     73       1.2      gwr 	if (on)
     74       1.2      gwr 		ena |= ENA_FPP;
     75       1.2      gwr 	else
     76       1.2      gwr 		ena &= ~ENA_FPP;
     77       1.2      gwr 
     78       1.2      gwr 	*enable_reg = ena;
     79       1.2      gwr 	splx(s);
     80       1.2      gwr }
     81       1.2      gwr 
     82       1.2      gwr void
     83       1.2      gwr enable_video(on)
     84       1.2      gwr 	int on;
     85       1.2      gwr {
     86       1.2      gwr 	int s;
     87       1.2      gwr 	short ena;
     88       1.2      gwr 
     89       1.2      gwr 	s = splhigh();
     90       1.2      gwr 	ena = *enable_reg;
     91       1.2      gwr 
     92       1.2      gwr 	if (on)
     93       1.2      gwr 		ena |= ENA_VIDEO;
     94       1.2      gwr 	else
     95       1.2      gwr 		ena &= ~ENA_VIDEO;
     96       1.2      gwr 
     97       1.2      gwr 	*enable_reg = ena;
     98       1.2      gwr 	splx(s);
     99       1.2      gwr }
    100       1.2      gwr 
    101