Deleted Added
full compact
atkbd.c (44628) atkbd.c (45720)
1/*-
2 * Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * $Id: atkbd.c,v 1.4 1999/01/28 10:55:55 yokota Exp $
26 * $Id: atkbd.c,v 1.5 1999/03/10 10:36:52 yokota Exp $
27 */
28
29#include "atkbd.h"
30#include "opt_kbd.h"
31#include "opt_atkbd.h"
32#include "opt_devfs.h"
33
34#if NATKBD > 0

--- 6 unchanged lines hidden (view full) ---

41#include <sys/tty.h>
42#include <sys/fcntl.h>
43#include <sys/malloc.h>
44
45#include <dev/kbd/kbdreg.h>
46#include <dev/kbd/atkbdreg.h>
47#include <dev/kbd/atkbdcreg.h>
48
27 */
28
29#include "atkbd.h"
30#include "opt_kbd.h"
31#include "opt_atkbd.h"
32#include "opt_devfs.h"
33
34#if NATKBD > 0

--- 6 unchanged lines hidden (view full) ---

41#include <sys/tty.h>
42#include <sys/fcntl.h>
43#include <sys/malloc.h>
44
45#include <dev/kbd/kbdreg.h>
46#include <dev/kbd/atkbdreg.h>
47#include <dev/kbd/atkbdcreg.h>
48
49#ifndef __i386__
49#if 1
50
51#include <sys/bus.h>
52#include <isa/isareg.h>
53
54extern devclass_t atkbd_devclass;
55
56#define ATKBD_SOFTC(unit) \
57 ((atkbd_softc_t *)devclass_get_softc(atkbd_devclass, unit))

--- 26 unchanged lines hidden (view full) ---

84 atkbdopen, atkbdclose, atkbdread, nowrite,
85 atkbdioctl, nostop, nullreset, nodevtotty,
86 atkbdpoll, nommap, NULL, ATKBD_DRIVER_NAME,
87 NULL, -1,
88};
89
90#endif /* KBD_INSTALL_CDEV */
91
50
51#include <sys/bus.h>
52#include <isa/isareg.h>
53
54extern devclass_t atkbd_devclass;
55
56#define ATKBD_SOFTC(unit) \
57 ((atkbd_softc_t *)devclass_get_softc(atkbd_devclass, unit))

--- 26 unchanged lines hidden (view full) ---

84 atkbdopen, atkbdclose, atkbdread, nowrite,
85 atkbdioctl, nostop, nullreset, nodevtotty,
86 atkbdpoll, nommap, NULL, ATKBD_DRIVER_NAME,
87 NULL, -1,
88};
89
90#endif /* KBD_INSTALL_CDEV */
91
92#if 0
92#ifdef __i386__
93
94atkbd_softc_t
95*atkbd_get_softc(int unit)
96{
97 atkbd_softc_t *sc;
98
99 if (unit >= sizeof(atkbd_softc)/sizeof(atkbd_softc[0]))

--- 5 unchanged lines hidden (view full) ---

105 if (sc == NULL)
106 return NULL;
107 bzero(sc, sizeof(*sc));
108 }
109 return sc;
110}
111
112#endif /* __i386__ */
93#ifdef __i386__
94
95atkbd_softc_t
96*atkbd_get_softc(int unit)
97{
98 atkbd_softc_t *sc;
99
100 if (unit >= sizeof(atkbd_softc)/sizeof(atkbd_softc[0]))

--- 5 unchanged lines hidden (view full) ---

106 if (sc == NULL)
107 return NULL;
108 bzero(sc, sizeof(*sc));
109 }
110 return sc;
111}
112
113#endif /* __i386__ */
114#endif
113
114int
115atkbd_probe_unit(int unit, int port, int irq, int flags)
116{
117 keyboard_switch_t *sw;
118 int args[2];
119 int error;
120

--- 250 unchanged lines hidden (view full) ---

371 * NOTE: because of the way the low-level conole is initialized, this routine
372 * may be called more than once!!
373 */
374static int
375atkbd_configure(int flags)
376{
377 keyboard_t *kbd;
378 int arg[2];
115
116int
117atkbd_probe_unit(int unit, int port, int irq, int flags)
118{
119 keyboard_switch_t *sw;
120 int args[2];
121 int error;
122

--- 250 unchanged lines hidden (view full) ---

373 * NOTE: because of the way the low-level conole is initialized, this routine
374 * may be called more than once!!
375 */
376static int
377atkbd_configure(int flags)
378{
379 keyboard_t *kbd;
380 int arg[2];
379#ifdef __i386__
380 struct isa_device *dev;
381 int i;
382
383 /* XXX: a kludge to obtain the device configuration flags */
381 int i;
382
383 /* XXX: a kludge to obtain the device configuration flags */
384 dev = find_isadev(isa_devtab_tty, &atkbddriver, 0);
385 if (dev != NULL) {
386 flags |= dev->id_flags;
384 if (resource_int_value("atkbd", 0, "flags", &i) == 0) {
385 flags |= i;
387 /* if the driver is disabled, unregister the keyboard if any */
386 /* if the driver is disabled, unregister the keyboard if any */
388 if (!dev->id_enabled) {
387 if (resource_int_value("atkbd", 0, "disabled", &i) == 0
388 && i != 0) {
389 i = kbd_find_keyboard(ATKBD_DRIVER_NAME, ATKBD_DEFAULT);
390 if (i >= 0) {
391 kbd = kbd_get_keyboard(i);
392 kbd_unregister(kbd);
393 kbd->kb_flags &= ~KB_REGISTERED;
394 return 0;
395 }
396 }
397 }
389 i = kbd_find_keyboard(ATKBD_DRIVER_NAME, ATKBD_DEFAULT);
390 if (i >= 0) {
391 kbd = kbd_get_keyboard(i);
392 kbd_unregister(kbd);
393 kbd->kb_flags &= ~KB_REGISTERED;
394 return 0;
395 }
396 }
397 }
398#endif
399
398
400 /* probe the keyboard controller */
401 atkbdc_configure();
402
403 /* probe the default keyboard */
404 arg[0] = -1;
405 arg[1] = -1;
406 kbd = NULL;
407 if (atkbd_probe(ATKBD_DEFAULT, arg, flags))

--- 1015 unchanged lines hidden ---
399 /* probe the keyboard controller */
400 atkbdc_configure();
401
402 /* probe the default keyboard */
403 arg[0] = -1;
404 arg[1] = -1;
405 kbd = NULL;
406 if (atkbd_probe(ATKBD_DEFAULT, arg, flags))

--- 1015 unchanged lines hidden ---