Home | History | Annotate | Line # | Download | only in isa
      1 /* $NetBSD: isa_machdep.c,v 1.22 2021/05/07 16:58:33 thorpej 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.22 2021/05/07 16:58:33 thorpej 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 <dev/isa/isavar.h>
     46 
     47 #include "vga_isa.h"
     48 #if NVGA_ISA
     49 #include <dev/ic/mc6845reg.h>
     50 #include <dev/ic/pcdisplayvar.h>
     51 #include <dev/isa/vga_isavar.h>
     52 #endif
     53 
     54 #include "pcppi.h"
     55 #if (NPCPPI > 0)
     56 #include <dev/isa/pcppivar.h>
     57 
     58 static int	isabeepmatch(device_t, cfdata_t, void *);
     59 static void	isabeepattach(device_t, device_t, void *);
     60 
     61 CFATTACH_DECL_NEW(isabeep, 0,
     62     isabeepmatch, isabeepattach, NULL, NULL);
     63 
     64 static int ppi_attached;
     65 static pcppi_tag_t ppicookie;
     66 #endif /* PCPPI */
     67 
     68 int
     69 isa_display_console(bus_space_tag_t iot, bus_space_tag_t memt)
     70 {
     71 	int res = ENXIO;
     72 #if NVGA_ISA
     73 	res = vga_isa_cnattach(iot, memt);
     74 	if (!res)
     75 		return(0);
     76 #endif
     77 	return(res);
     78 }
     79 
     80 #if (NPCPPI > 0)
     81 static int
     82 isabeepmatch(device_t parent, cfdata_t match, void *aux)
     83 {
     84 	return (!ppi_attached);
     85 }
     86 
     87 static void
     88 isabeepattach(device_t parent, device_t self, void *aux)
     89 {
     90 	printf("\n");
     91 
     92 	ppicookie = ((struct pcppi_attach_args *)aux)->pa_cookie;
     93 	ppi_attached = 1;
     94 }
     95 #endif
     96 
     97 void
     98 isabeep(int pitch, int period)
     99 {
    100 #if (NPCPPI > 0)
    101 	if (ppi_attached)
    102 		pcppi_bell(ppicookie, pitch, period, 0);
    103 #endif
    104 }
    105