1 /* $NetBSD: maccons.c,v 1.6.38.1 2007/10/03 19:24:06 garbled Exp $ */
4 * Copyright (C) 1999 Scott Reynolds. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #include <sys/cdefs.h>
30 __KERNEL_RCSID(0, "$NetBSD: maccons.c,v 1.6.38.1 2007/10/03 19:24:06 garbled Exp $");
32 #include "wsdisplay.h"
36 #include <sys/param.h>
37 #include <sys/systm.h>
40 #include <machine/autoconf.h>
41 #include <machine/cpu.h>
43 #include <machine/video.h>
45 #include <dev/wscons/wskbdvar.h>
46 #include <dev/wscons/wsdisplayvar.h>
47 #include <mac68k/dev/macfbvar.h>
48 #include <mac68k/dev/akbdvar.h>
50 void maccnprobe(struct consdev
*);
51 void maccninit(struct consdev
*);
53 void maccnputc(dev_t
, int);
54 void maccnpollc(dev_t
, int);
56 static int maccons_initted
= (-1);
59 maccnprobe(struct consdev
*cp
)
62 extern const struct cdevsw wsdisplay_cdevsw
;
67 cp
->cn_pri
= CN_NORMAL
;
71 maj
= cdevsw_lookup_major(&wsdisplay_cdevsw
);
73 cp
->cn_pri
= CN_INTERNAL
;
74 cp
->cn_dev
= makedev(maj
, unit
);
80 maccninit(struct consdev
*cp
)
83 * XXX evil hack; see consinit() for an explanation.
84 * note: maccons_initted is initialized to (-1).
86 if (++maccons_initted
> 0) {
87 macfb_cnattach(mac68k_video
.mv_phys
);
96 if (maccons_initted
> 0)
97 return wskbd_cngetc(dev
);
103 maccnputc(dev_t dev
, int c
)
106 extern dev_t mac68k_zsdev
;
107 extern int zscnputc(dev_t
, int);
111 if (maccons_initted
> 0)
112 wsdisplay_cnputc(dev
,c
);
115 if (mac68k_machine
.serial_boot_echo
)
116 zscnputc(mac68k_zsdev
, c
);
121 maccnpollc(dev_t dev
, int on
)
124 if (maccons_initted
> 0)
125 wskbd_cnpollc(dev
,on
);