| @@ -1,38 +1,39 @@ | | | @@ -1,38 +1,39 @@ |
1 | /* $NetBSD: wbsio.c,v 1.5 2012/01/17 16:32:03 jakllsch Exp $ */ | | 1 | /* $NetBSD: wbsio.c,v 1.6 2012/01/17 16:34:52 jakllsch Exp $ */ |
2 | /* $OpenBSD: wbsio.c,v 1.5 2009/03/29 21:53:52 sthen Exp $ */ | | 2 | /* $OpenBSD: wbsio.c,v 1.5 2009/03/29 21:53:52 sthen Exp $ */ |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2008 Mark Kettenis <kettenis@openbsd.org> | | 4 | * Copyright (c) 2008 Mark Kettenis <kettenis@openbsd.org> |
5 | * | | 5 | * |
6 | * Permission to use, copy, modify, and distribute this software for any | | 6 | * Permission to use, copy, modify, and distribute this software for any |
7 | * purpose with or without fee is hereby granted, provided that the above | | 7 | * purpose with or without fee is hereby granted, provided that the above |
8 | * copyright notice and this permission notice appear in all copies. | | 8 | * copyright notice and this permission notice appear in all copies. |
9 | * | | 9 | * |
10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | | 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | | 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | | 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | | 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | | 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | | 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | | 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 | */ | | 17 | */ |
18 | | | 18 | |
19 | /* | | 19 | /* |
20 | * Winbond LPC Super I/O driver. | | 20 | * Winbond LPC Super I/O driver. |
21 | */ | | 21 | */ |
22 | | | 22 | |
23 | #include <sys/param.h> | | 23 | #include <sys/param.h> |
24 | #include <sys/device.h> | | 24 | #include <sys/device.h> |
25 | #include <sys/kernel.h> | | 25 | #include <sys/kernel.h> |
| | | 26 | #include <sys/module.h> |
26 | #include <sys/systm.h> | | 27 | #include <sys/systm.h> |
27 | | | 28 | |
28 | #include <sys/bus.h> | | 29 | #include <sys/bus.h> |
29 | | | 30 | |
30 | #include <dev/isa/isareg.h> | | 31 | #include <dev/isa/isareg.h> |
31 | #include <dev/isa/isavar.h> | | 32 | #include <dev/isa/isavar.h> |
32 | | | 33 | |
33 | /* ISA bus registers */ | | 34 | /* ISA bus registers */ |
34 | #define WBSIO_INDEX 0x00 /* Configuration Index Register */ | | 35 | #define WBSIO_INDEX 0x00 /* Configuration Index Register */ |
35 | #define WBSIO_DATA 0x01 /* Configuration Data Register */ | | 36 | #define WBSIO_DATA 0x01 /* Configuration Data Register */ |
36 | | | 37 | |
37 | #define WBSIO_IOSIZE 0x02 /* ISA I/O space size */ | | 38 | #define WBSIO_IOSIZE 0x02 /* ISA I/O space size */ |
38 | | | 39 | |
| @@ -251,13 +252,42 @@ int | | | @@ -251,13 +252,42 @@ int |
251 | wbsio_print(void *aux, const char *pnp) | | 252 | wbsio_print(void *aux, const char *pnp) |
252 | { | | 253 | { |
253 | struct isa_attach_args *ia = aux; | | 254 | struct isa_attach_args *ia = aux; |
254 | | | 255 | |
255 | if (pnp) | | 256 | if (pnp) |
256 | aprint_normal("%s", pnp); | | 257 | aprint_normal("%s", pnp); |
257 | if (ia->ia_io[0].ir_size) | | 258 | if (ia->ia_io[0].ir_size) |
258 | aprint_normal(" port 0x%x", ia->ia_io[0].ir_addr); | | 259 | aprint_normal(" port 0x%x", ia->ia_io[0].ir_addr); |
259 | if (ia->ia_io[0].ir_size > 1) | | 260 | if (ia->ia_io[0].ir_size > 1) |
260 | aprint_normal("-0x%x", ia->ia_io[0].ir_addr + | | 261 | aprint_normal("-0x%x", ia->ia_io[0].ir_addr + |
261 | ia->ia_io[0].ir_size - 1); | | 262 | ia->ia_io[0].ir_size - 1); |
262 | return (UNCONF); | | 263 | return (UNCONF); |
263 | } | | 264 | } |
| | | 265 | |
| | | 266 | MODULE(MODULE_CLASS_DRIVER, wbsio, ""); |
| | | 267 | |
| | | 268 | #ifdef _MODULE |
| | | 269 | #include "ioconf.c" |
| | | 270 | #endif |
| | | 271 | |
| | | 272 | static int |
| | | 273 | wbsio_modcmd(modcmd_t cmd, void *opaque) |
| | | 274 | { |
| | | 275 | switch (cmd) { |
| | | 276 | case MODULE_CMD_INIT: |
| | | 277 | #ifdef _MODULE |
| | | 278 | return config_init_component(cfdriver_ioconf_wbsio, |
| | | 279 | cfattach_ioconf_wbsio, cfdata_ioconf_wbsio); |
| | | 280 | #else |
| | | 281 | return 0; |
| | | 282 | #endif |
| | | 283 | case MODULE_CMD_FINI: |
| | | 284 | #ifdef _MODULE |
| | | 285 | return config_fini_component(cfdriver_ioconf_wbsio, |
| | | 286 | cfattach_ioconf_wbsio, cfdata_ioconf_wbsio); |
| | | 287 | #else |
| | | 288 | return 0; |
| | | 289 | #endif |
| | | 290 | default: |
| | | 291 | return ENOTTY; |
| | | 292 | } |
| | | 293 | } |