Home | History | Annotate | Line # | Download | only in isa
isa_machdep.c revision 1.13
      1 /* $NetBSD: isa_machdep.c,v 1.13 2000/06/29 09:02:57 mrg Exp $ */
      2 
      3 /*
      4  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
      5  * All rights reserved.
      6  *
      7  * Author: Chris G. Demetriou
      8  *
      9  * Permission to use, copy, modify and distribute this software and
     10  * its documentation is hereby granted, provided that both the copyright
     11  * notice and this permission notice appear in all copies of the
     12  * software, derivative works or modified versions, and any portions
     13  * thereof, and that both notices appear in supporting documentation.
     14  *
     15  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     16  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     17  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     18  *
     19  * Carnegie Mellon requests users of this software to return to
     20  *
     21  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     22  *  School of Computer Science
     23  *  Carnegie Mellon University
     24  *  Pittsburgh PA 15213-3890
     25  *
     26  * any improvements or extensions that they make and grant Carnegie the
     27  * rights to redistribute these changes.
     28  */
     29 
     30 /*
     31  * Machine-specific functions for ISA autoconfiguration.
     32  */
     33 
     34 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
     35 
     36 __KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.13 2000/06/29 09:02:57 mrg Exp $");
     37 
     38 #include <sys/types.h>
     39 #include <sys/param.h>
     40 #include <sys/time.h>
     41 #include <sys/systm.h>
     42 #include <sys/errno.h>
     43 #include <sys/device.h>
     44 
     45 #include <uvm/uvm_extern.h>
     46 
     47 #include <dev/isa/isavar.h>
     48 
     49 #include "vga_isa.h"
     50 #if NVGA_ISA
     51 #include <dev/ic/mc6845reg.h>
     52 #include <dev/ic/pcdisplayvar.h>
     53 #include <dev/isa/vga_isavar.h>
     54 #endif
     55 
     56 #include "pcppi.h"
     57 #if (NPCPPI > 0)
     58 #include <dev/isa/pcppivar.h>
     59 
     60 int isabeepmatch __P((struct device *, struct cfdata *, void *));
     61 void isabeepattach __P((struct device *, struct device *, void *));
     62 
     63 struct cfattach isabeep_ca = {
     64 	sizeof(struct device), isabeepmatch, isabeepattach
     65 };
     66 
     67 static int ppi_attached;
     68 static pcppi_tag_t ppicookie;
     69 #endif /* PCPPI */
     70 
     71 int
     72 isa_display_console(iot, memt)
     73 	bus_space_tag_t iot, memt;
     74 {
     75 	int res = ENXIO;
     76 #if NVGA_ISA
     77 	res = vga_isa_cnattach(iot, memt);
     78 	if (!res)
     79 		return(0);
     80 #endif
     81 	return(res);
     82 }
     83 
     84 #if (NPCPPI > 0)
     85 int
     86 isabeepmatch(parent, match, aux)
     87 	struct device *parent;
     88 	struct cfdata *match;
     89 	void *aux;
     90 {
     91 	return (!ppi_attached);
     92 }
     93 
     94 void
     95 isabeepattach(parent, self, aux)
     96 	struct device *parent, *self;
     97 	void *aux;
     98 {
     99 	printf("\n");
    100 
    101 	ppicookie = ((struct pcppi_attach_args *)aux)->pa_cookie;
    102 	ppi_attached = 1;
    103 }
    104 #endif
    105 
    106 void
    107 isabeep(pitch, period)
    108 	int pitch, period;
    109 {
    110 #if (NPCPPI > 0)
    111 	if (ppi_attached)
    112 		pcppi_bell(ppicookie, pitch, period, 0);
    113 #endif
    114 }
    115