Deleted Added
full compact
atkbdc_isa.c (47296) atkbdc_isa.c (47400)
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: atkbdc_isa.c,v 1.5 1999/05/09 20:45:53 peter Exp $
26 * $Id: atkbdc_isa.c,v 1.6 1999/05/18 11:33:14 yokota Exp $
27 */
28
29#include "atkbdc.h"
30#include "opt_kbd.h"
31
32#if NATKBDC > 0
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/kernel.h>
37#include <sys/bus.h>
38#include <sys/malloc.h>
27 */
28
29#include "atkbdc.h"
30#include "opt_kbd.h"
31
32#if NATKBDC > 0
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/kernel.h>
37#include <sys/bus.h>
38#include <sys/malloc.h>
39#include <machine/bus.h>
40#include <machine/resource.h>
41#include <sys/rman.h>
39
40#include <dev/kbd/atkbdcreg.h>
41
42#include <isa/isareg.h>
43#include <isa/isavar.h>
44
45MALLOC_DEFINE(M_ATKBDDEV, "atkbddev", "AT Keyboard device");
46

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

86 atkbdc_methods,
87 sizeof(atkbdc_softc_t *),
88};
89
90static int
91atkbdc_probe(device_t dev)
92{
93 int error;
42
43#include <dev/kbd/atkbdcreg.h>
44
45#include <isa/isareg.h>
46#include <isa/isavar.h>
47
48MALLOC_DEFINE(M_ATKBDDEV, "atkbddev", "AT Keyboard device");
49

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

89 atkbdc_methods,
90 sizeof(atkbdc_softc_t *),
91};
92
93static int
94atkbdc_probe(device_t dev)
95{
96 int error;
97 int rid;
98 struct resource *port;
94
95 device_set_desc(dev, "keyboard controller (i8042)");
99
100 device_set_desc(dev, "keyboard controller (i8042)");
96 error = atkbdc_probe_unit(device_get_unit(dev), isa_get_port(dev));
97 if (error == 0)
98 isa_set_portsize(dev, IO_KBDSIZE);
101 rid = 0;
102 port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
103 0, ~0, IO_KBDSIZE, RF_ACTIVE);
104 if (!port)
105 return ENXIO;
106 error = atkbdc_probe_unit(device_get_unit(dev), rman_get_start(port));
107 bus_release_resource(dev, SYS_RES_IOPORT, rid, port);
99 return error;
100}
101
102static void
103atkbdc_add_device(device_t dev, const char *name, int unit)
104{
105 atkbdc_softc_t *sc = *(atkbdc_softc_t **)device_get_softc(dev);
106 atkbdc_device_t *kdev;
107 device_t child;
108 int t;
108 return error;
109}
110
111static void
112atkbdc_add_device(device_t dev, const char *name, int unit)
113{
114 atkbdc_softc_t *sc = *(atkbdc_softc_t **)device_get_softc(dev);
115 atkbdc_device_t *kdev;
116 device_t child;
117 int t;
118 int rid;
119 struct resource *port;
109
110 kdev = malloc(sizeof(struct atkbdc_device), M_ATKBDDEV, M_NOWAIT);
111 if (!kdev)
112 return;
113 bzero(kdev, sizeof *kdev);
114
120
121 kdev = malloc(sizeof(struct atkbdc_device), M_ATKBDDEV, M_NOWAIT);
122 if (!kdev)
123 return;
124 bzero(kdev, sizeof *kdev);
125
126 /* XXX should track resource in softc */
127 port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
128 0, ~0, IO_KBDSIZE, RF_ACTIVE);
115 kdev->port = sc->port;
116
117 if (resource_int_value(name, unit, "irq", &t) == 0)
118 kdev->irq = t;
119 else
120 kdev->irq = -1;
121
122 if (resource_int_value(name, unit, "flags", &t) == 0)

--- 122 unchanged lines hidden ---
129 kdev->port = sc->port;
130
131 if (resource_int_value(name, unit, "irq", &t) == 0)
132 kdev->irq = t;
133 else
134 kdev->irq = -1;
135
136 if (resource_int_value(name, unit, "flags", &t) == 0)

--- 122 unchanged lines hidden ---