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 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote
14 * products derived from this software without specific prior written
15 * permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD$
30 */
31
32 #include "atkbdc.h"
33 #include "opt_kbd.h"
34
35 #if NATKBDC > 0
36
37 #include <sys/param.h>
38 #include <sys/systm.h>
39 #include <sys/kernel.h>
40
41 #include <dev/kbd/atkbdcreg.h>
42
43 #include <i386/isa/isa.h>
44 #include <i386/isa/isa_device.h>
45
46 static int atkbdc_probe(struct isa_device *dev);
47 static int atkbdc_attach(struct isa_device *dev);
48
49 struct isa_driver atkbdcdriver = {
50 atkbdc_probe,
51 atkbdc_attach,
52 ATKBDC_DRIVER_NAME,
53 0,
54 };
55
56 static int
57 atkbdc_probe(struct isa_device *dev)
58 {
59 atkbdc_softc_t *sc;
60 int error;
61
62 sc = atkbdc_get_softc(dev->id_unit);
63 if (sc == NULL)
64 return 0;
65
66 error = atkbdc_probe_unit(sc, dev->id_unit, dev->id_iobase);
67 if (error)
68 return 0;
69 if (dev->id_iobase <= 0)
70 dev->id_iobase = sc->port;
71 return IO_KBDSIZE;
72 }
73
74 static int
75 atkbdc_attach(struct isa_device *dev)
76 {
77 atkbdc_softc_t *sc;
78
79 sc = atkbdc_get_softc(dev->id_unit);
80 return ((sc == NULL) ? 0 : 1);
81 }
82
83 #endif /* NATKBDC > 0 */
Cache object: 352311049358e00685ea3344e9726d0a
|