Deleted Added
full compact
isa_common.c (50477) isa_common.c (50769)
1/*-
2 * Copyright (c) 1999 Doug Rabson
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 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1999 Doug Rabson
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 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/isa/isa_common.c 50477 1999-08-28 01:08:13Z peter $
26 * $FreeBSD: head/sys/isa/isa_common.c 50769 1999-09-01 20:53:43Z dfr $
27 */
28/*
29 * Modifications for Intel architecture by Garrett A. Wollman.
30 * Copyright 1998 Massachusetts Institute of Technology
31 *
32 * Permission to use, copy, modify, and distribute this software and
33 * its documentation for any purpose and without fee is hereby
34 * granted, provided that both the above copyright notice and this

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

94}
95
96extern device_t isa_bus_device;
97
98static int
99isa_attach(device_t dev)
100{
101 /*
27 */
28/*
29 * Modifications for Intel architecture by Garrett A. Wollman.
30 * Copyright 1998 Massachusetts Institute of Technology
31 *
32 * Permission to use, copy, modify, and distribute this software and
33 * its documentation for any purpose and without fee is hereby
34 * granted, provided that both the above copyright notice and this

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

94}
95
96extern device_t isa_bus_device;
97
98static int
99isa_attach(device_t dev)
100{
101 /*
102 * Arrange for bus_generic_attach(dev) to be called later.
102 * Arrange for isa_probe_children(dev) to be called later. XXX
103 */
104 isa_bus_device = dev;
105 return 0;
106}
107
108/*
103 */
104 isa_bus_device = dev;
105 return 0;
106}
107
108/*
109 * Find a working set of memory regions for a child using the ranges
110 * in *config and return the regions in *result. Returns non-zero if
111 * a set of ranges was found.
112 */
113static int
114isa_find_memory(device_t child,
115 struct isa_config *config,
116 struct isa_config *result)
117{
118 device_t dev = device_get_parent(child);
119 int success, i;
120 struct resource *res[ISA_NMEM];
121
122 /*
123 * First clear out any existing resource definitions.
124 */
125 for (i = 0; i < ISA_NMEM; i++) {
126 ISA_DELETE_RESOURCE(dev, child, SYS_RES_MEMORY, i);
127 res[i] = NULL;
128 }
129
130 success = 1;
131 result->ic_nmem = config->ic_nmem;
132 for (i = 0; i < config->ic_nmem; i++) {
133 u_int32_t start, end, size, align;
134 for (start = config->ic_mem[i].ir_start,
135 end = config->ic_mem[i].ir_end,
136 size = config->ic_mem[i].ir_size,
137 align = config->ic_mem[i].ir_align;
138 start + size - 1 <= end;
139 start += align) {
140 ISA_SET_RESOURCE(dev, child, SYS_RES_MEMORY, i,
141 start, size);
142 res[i] = bus_alloc_resource(child,
143 SYS_RES_MEMORY, &i,
144 0, ~0, 1, RF_ACTIVE);
145 if (res[i]) {
146 result->ic_mem[i].ir_start = start;
147 result->ic_mem[i].ir_end = start + size - 1;
148 result->ic_mem[i].ir_size = size;
149 result->ic_mem[i].ir_align = align;
150 break;
151 }
152 }
153
154 /*
155 * If we didn't find a place for memory range i, then
156 * give up now.
157 */
158 if (!res[i]) {
159 success = 0;
160 break;
161 }
162 }
163
164 for (i = 0; i < ISA_NMEM; i++) {
165 if (res[i])
166 bus_release_resource(child, SYS_RES_MEMORY,
167 i, res[i]);
168 }
169
170 return success;
171}
172
173/*
174 * Find a working set of port regions for a child using the ranges
175 * in *config and return the regions in *result. Returns non-zero if
176 * a set of ranges was found.
177 */
178static int
179isa_find_port(device_t child,
180 struct isa_config *config,
181 struct isa_config *result)
182{
183 device_t dev = device_get_parent(child);
184 int success, i;
185 struct resource *res[ISA_NPORT];
186
187 /*
188 * First clear out any existing resource definitions.
189 */
190 for (i = 0; i < ISA_NPORT; i++) {
191 ISA_DELETE_RESOURCE(dev, child, SYS_RES_IOPORT, i);
192 res[i] = NULL;
193 }
194
195 success = 1;
196 result->ic_nport = config->ic_nport;
197 for (i = 0; i < config->ic_nport; i++) {
198 u_int32_t start, end, size, align;
199 for (start = config->ic_port[i].ir_start,
200 end = config->ic_port[i].ir_end,
201 size = config->ic_port[i].ir_size,
202 align = config->ic_port[i].ir_align;
203 start + size - 1 <= end;
204 start += align) {
205 ISA_SET_RESOURCE(dev, child, SYS_RES_IOPORT, i,
206 start, size);
207 res[i] = bus_alloc_resource(child,
208 SYS_RES_IOPORT, &i,
209 0, ~0, 1, RF_ACTIVE);
210 if (res[i]) {
211 result->ic_port[i].ir_start = start;
212 result->ic_port[i].ir_end = start + size - 1;
213 result->ic_port[i].ir_size = size;
214 result->ic_port[i].ir_align = align;
215 break;
216 }
217 }
218
219 /*
220 * If we didn't find a place for port range i, then
221 * give up now.
222 */
223 if (!res[i]) {
224 success = 0;
225 break;
226 }
227 }
228
229 for (i = 0; i < ISA_NPORT; i++) {
230 if (res[i])
231 bus_release_resource(child, SYS_RES_IOPORT,
232 i, res[i]);
233 }
234
235 return success;
236}
237
238/*
239 * Return the index of the first bit in the mask (or -1 if mask is empty.
240 */
241static int
242find_first_bit(u_int32_t mask)
243{
244 return ffs(mask) - 1;
245}
246
247/*
248 * Return the index of the next bit in the mask, or -1 if there are no more.
249 */
250static int
251find_next_bit(u_int32_t mask, int bit)
252{
253 bit++;
254 while (bit < 32 && !(mask & (1 << bit)))
255 bit++;
256 if (bit != 32)
257 return bit;
258 return -1;
259}
260
261/*
262 * Find a working set of irqs for a child using the masks in *config
263 * and return the regions in *result. Returns non-zero if a set of
264 * irqs was found.
265 */
266static int
267isa_find_irq(device_t child,
268 struct isa_config *config,
269 struct isa_config *result)
270{
271 device_t dev = device_get_parent(child);
272 int success, i;
273 struct resource *res[ISA_NIRQ];
274
275 /*
276 * First clear out any existing resource definitions.
277 */
278 for (i = 0; i < ISA_NIRQ; i++) {
279 ISA_DELETE_RESOURCE(dev, child, SYS_RES_IRQ, i);
280 res[i] = NULL;
281 }
282
283 success = 1;
284 result->ic_nirq = config->ic_nirq;
285 for (i = 0; i < config->ic_nirq; i++) {
286 u_int32_t mask = config->ic_irqmask[i];
287 int irq;
288 for (irq = find_first_bit(mask);
289 irq != -1;
290 irq = find_next_bit(mask, irq)) {
291 ISA_SET_RESOURCE(dev, child, SYS_RES_IRQ, i,
292 irq, 1);
293 res[i] = bus_alloc_resource(child,
294 SYS_RES_IRQ, &i,
295 0, ~0, 1, RF_ACTIVE);
296 if (res[i]) {
297 result->ic_irqmask[i] = (1 << irq);
298 break;
299 }
300 }
301
302 /*
303 * If we didn't find a place for irq range i, then
304 * give up now.
305 */
306 if (!res[i]) {
307 success = 0;
308 break;
309 }
310 }
311
312 for (i = 0; i < ISA_NIRQ; i++) {
313 if (res[i])
314 bus_release_resource(child, SYS_RES_IRQ,
315 i, res[i]);
316 }
317
318 return success;
319}
320
321/*
322 * Find a working set of drqs for a child using the masks in *config
323 * and return the regions in *result. Returns non-zero if a set of
324 * drqs was found.
325 */
326static int
327isa_find_drq(device_t child,
328 struct isa_config *config,
329 struct isa_config *result)
330{
331 device_t dev = device_get_parent(child);
332 int success, i;
333 struct resource *res[ISA_NDRQ];
334
335 /*
336 * First clear out any existing resource definitions.
337 */
338 for (i = 0; i < ISA_NDRQ; i++) {
339 ISA_DELETE_RESOURCE(dev, child, SYS_RES_DRQ, i);
340 res[i] = NULL;
341 }
342
343 success = 1;
344 result->ic_ndrq = config->ic_ndrq;
345 for (i = 0; i < config->ic_ndrq; i++) {
346 u_int32_t mask = config->ic_drqmask[i];
347 int drq;
348 for (drq = find_first_bit(mask);
349 drq != -1;
350 drq = find_next_bit(mask, drq)) {
351 ISA_SET_RESOURCE(dev, child, SYS_RES_DRQ, i,
352 drq, 1);
353 res[i] = bus_alloc_resource(child,
354 SYS_RES_DRQ, &i,
355 0, ~0, 1, RF_ACTIVE);
356 if (res[i]) {
357 result->ic_drqmask[i] = (1 << drq);
358 break;
359 }
360 }
361
362 /*
363 * If we didn't find a place for drq range i, then
364 * give up now.
365 */
366 if (!res[i]) {
367 success = 0;
368 break;
369 }
370 }
371
372 for (i = 0; i < ISA_NDRQ; i++) {
373 if (res[i])
374 bus_release_resource(child, SYS_RES_DRQ,
375 i, res[i]);
376 }
377
378 return success;
379}
380
381/*
382 * Attempt to find a working set of resources for a device. Return
383 * non-zero if a working configuration is found.
384 */
385static int
386isa_assign_resources(device_t child)
387{
388 struct isa_device *idev = DEVTOISA(child);
389 struct isa_config_entry *ice;
390 struct isa_config config;
391
392 bzero(&config, sizeof config);
393 TAILQ_FOREACH(ice, &idev->id_configs, ice_link) {
394 if (!isa_find_memory(child, &ice->ice_config, &config))
395 continue;
396 if (!isa_find_port(child, &ice->ice_config, &config))
397 continue;
398 if (!isa_find_irq(child, &ice->ice_config, &config))
399 continue;
400 if (!isa_find_drq(child, &ice->ice_config, &config))
401 continue;
402
403 /*
404 * A working configuration was found enable the device
405 * with this configuration.
406 */
407 if (idev->id_config_cb) {
408 idev->id_config_cb(idev->id_config_arg,
409 &config, 1);
410 return 1;
411 }
412 }
413
414 /*
415 * Disable the device.
416 */
417 bzero(&config, sizeof config);
418 if (idev->id_config_cb)
419 idev->id_config_cb(idev->id_config_arg, &config, 0);
420 device_disable(child);
421
422 return 0;
423}
424
425/*
426 * Called after other devices have initialised to probe for isa devices.
427 */
428void
429isa_probe_children(device_t dev)
430{
431 device_t *children;
432 int nchildren, i;
433
434 if (device_get_children(dev, &children, &nchildren))
435 return;
436
437 /*
438 * First probe all non-pnp devices so that they claim their
439 * resources first.
440 */
441 for (i = 0; i < nchildren; i++) {
442 device_t child = children[i];
443 struct isa_device *idev = DEVTOISA(child);
444
445 if (TAILQ_FIRST(&idev->id_configs))
446 continue;
447
448 device_probe_and_attach(child);
449 }
450
451 /*
452 * Next assign resource to pnp devices and probe them.
453 */
454 for (i = 0; i < nchildren; i++) {
455 device_t child = children[i];
456 struct isa_device* idev = DEVTOISA(child);
457
458 if (!TAILQ_FIRST(&idev->id_configs))
459 continue;
460
461 if (isa_assign_resources(child)) {
462 struct resource_list_entry *rle;
463
464 device_probe_and_attach(child);
465
466 /*
467 * Claim any unallocated resources to keep other
468 * devices from using them.
469 */
470 SLIST_FOREACH(rle, &idev->id_resources, link) {
471 if (!rle->res) {
472 int rid = rle->rid;
473 resource_list_alloc(dev, child,
474 rle->type,
475 &rid,
476 0, ~0, 1,
477 RF_ACTIVE);
478 }
479 }
480 }
481 }
482
483 free(children, M_TEMP);
484}
485
486/*
109 * Add a new child with default ivars.
110 */
111static device_t
112isa_add_child(device_t dev, int order, const char *name, int unit)
113{
114 struct isa_device *idev;
115
116 idev = malloc(sizeof(struct isa_device), M_ISADEV, M_NOWAIT);
117 if (!idev)
118 return 0;
119 bzero(idev, sizeof *idev);
120
121 resource_list_init(&idev->id_resources);
122 idev->id_flags = 0;
487 * Add a new child with default ivars.
488 */
489static device_t
490isa_add_child(device_t dev, int order, const char *name, int unit)
491{
492 struct isa_device *idev;
493
494 idev = malloc(sizeof(struct isa_device), M_ISADEV, M_NOWAIT);
495 if (!idev)
496 return 0;
497 bzero(idev, sizeof *idev);
498
499 resource_list_init(&idev->id_resources);
500 idev->id_flags = 0;
501 TAILQ_INIT(&idev->id_configs);
123
124 return device_add_child_ordered(dev, order, name, unit, idev);
125}
126
127static void
128isa_print_resources(struct resource_list *rl, const char *name, int type,
129 const char *format)
130{
502
503 return device_add_child_ordered(dev, order, name, unit, idev);
504}
505
506static void
507isa_print_resources(struct resource_list *rl, const char *name, int type,
508 const char *format)
509{
131 struct resource_list_entry *rle0 = resource_list_find(rl, type, 0);
132 struct resource_list_entry *rle1 = resource_list_find(rl, type, 1);
510 struct resource_list_entry *rle;
511 int printed;
512 int i;
133
513
134 if (rle0 || rle1) {
135 printf(" %s ", name);
136 if (rle0) {
137 printf(format, rle0->start);
138 if (rle0->count > 1) {
139 printf("-");
140 printf(format, rle0->start + rle0->count - 1);
141 }
142 }
143 if (rle1) {
144 if (rle0)
514 printed = 0;
515 for (i = 0; i < 16; i++) {
516 rle = resource_list_find(rl, type, i);
517 if (rle) {
518 if (printed == 0)
519 printf(" %s ", name);
520 else if (printed > 0)
145 printf(",");
521 printf(",");
146 printf(format, rle1->start);
147 if (rle1->count > 1) {
522 printed++;
523 printf(format, rle->start);
524 if (rle->count > 1) {
148 printf("-");
525 printf("-");
149 printf(format, rle1->start + rle1->count - 1);
526 printf(format, rle->start + rle->count - 1);
150 }
527 }
528 } else if (i > 3) {
529 /* check the first few regardless */
530 break;
151 }
152 }
153}
154
155static int
156isa_print_child(device_t bus, device_t dev)
157{
158 struct isa_device *idev = DEVTOISA(dev);

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

350
351 default:
352 return (ENOENT);
353 }
354
355 return (0);
356}
357
531 }
532 }
533}
534
535static int
536isa_print_child(device_t bus, device_t dev)
537{
538 struct isa_device *idev = DEVTOISA(dev);

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

730
731 default:
732 return (ENOENT);
733 }
734
735 return (0);
736}
737
738/*
739 * Free any resources which the driver missed or which we were holding for
740 * it (see isa_probe_children).
741 */
742static void
743isa_child_detached(device_t dev, device_t child)
744{
745 struct isa_device* idev = DEVTOISA(child);
746 struct resource_list_entry *rle;
747
748 SLIST_FOREACH(rle, &idev->id_resources, link) {
749 if (rle->res)
750 resource_list_release(dev, child,
751 rle->type,
752 rle->rid,
753 rle->res);
754 }
755}
756
358static int
359isa_set_resource(device_t dev, device_t child, int type, int rid,
360 u_long start, u_long count)
361{
362 struct isa_device* idev = DEVTOISA(child);
363 struct resource_list *rl = &idev->id_resources;
364
365 if (type != SYS_RES_IOPORT && type != SYS_RES_MEMORY
366 && type != SYS_RES_IRQ && type != SYS_RES_DRQ)
367 return EINVAL;
757static int
758isa_set_resource(device_t dev, device_t child, int type, int rid,
759 u_long start, u_long count)
760{
761 struct isa_device* idev = DEVTOISA(child);
762 struct resource_list *rl = &idev->id_resources;
763
764 if (type != SYS_RES_IOPORT && type != SYS_RES_MEMORY
765 && type != SYS_RES_IRQ && type != SYS_RES_DRQ)
766 return EINVAL;
368 if (rid < 0 || rid > 1)
767 if (rid < 0)
369 return EINVAL;
768 return EINVAL;
769 if (type == SYS_RES_IOPORT && rid >= ISA_NPORT)
770 return EINVAL;
771 if (type == SYS_RES_MEMORY && rid >= ISA_NMEM)
772 return EINVAL;
773 if (type == SYS_RES_IRQ && rid >= ISA_NIRQ)
774 return EINVAL;
775 if (type == SYS_RES_DRQ && rid >= ISA_NDRQ)
776 return EINVAL;
370
371 resource_list_add(rl, type, rid, start, start + count - 1, count);
372
373 return 0;
374}
375
376static int
377isa_get_resource(device_t dev, device_t child, int type, int rid,

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

394static void
395isa_delete_resource(device_t dev, device_t child, int type, int rid)
396{
397 struct isa_device* idev = DEVTOISA(child);
398 struct resource_list *rl = &idev->id_resources;
399 resource_list_delete(rl, type, rid);
400}
401
777
778 resource_list_add(rl, type, rid, start, start + count - 1, count);
779
780 return 0;
781}
782
783static int
784isa_get_resource(device_t dev, device_t child, int type, int rid,

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

801static void
802isa_delete_resource(device_t dev, device_t child, int type, int rid)
803{
804 struct isa_device* idev = DEVTOISA(child);
805 struct resource_list *rl = &idev->id_resources;
806 resource_list_delete(rl, type, rid);
807}
808
809static int
810isa_add_config(device_t dev, device_t child,
811 int priority, struct isa_config *config)
812{
813 struct isa_device* idev = DEVTOISA(child);
814 struct isa_config_entry *newice, *ice;
815
816 newice = malloc(sizeof *ice, M_DEVBUF, M_NOWAIT);
817 if (!newice)
818 return ENOMEM;
819
820 newice->ice_priority = priority;
821 newice->ice_config = *config;
822
823 TAILQ_FOREACH(ice, &idev->id_configs, ice_link) {
824 if (ice->ice_priority > priority)
825 break;
826 }
827 if (ice)
828 TAILQ_INSERT_BEFORE(ice, newice, ice_link);
829 else
830 TAILQ_INSERT_TAIL(&idev->id_configs, newice, ice_link);
831
832 return 0;
833}
834
835static void
836isa_set_config_callback(device_t dev, device_t child,
837 isa_config_cb *fn, void *arg)
838{
839 struct isa_device* idev = DEVTOISA(child);
840
841 idev->id_config_cb = fn;
842 idev->id_config_arg = arg;
843}
844
845static int
846isa_pnp_probe(device_t dev, device_t child, struct isa_pnp_id *ids)
847{
848 struct isa_device* idev = DEVTOISA(child);
849
850 if (!idev->id_vendorid)
851 return ENOENT;
852
853 while (ids->ip_id) {
854 /*
855 * Really ought to support >1 compat id per device.
856 */
857 if (idev->id_logicalid == ids->ip_id
858 || idev->id_compatid == ids->ip_id) {
859 device_set_desc(child, ids->ip_desc);
860 return 0;
861 }
862 ids++;
863 }
864
865 return ENXIO;
866}
867
402static device_method_t isa_methods[] = {
403 /* Device interface */
404 DEVMETHOD(device_probe, isa_probe),
405 DEVMETHOD(device_attach, isa_attach),
406 DEVMETHOD(device_detach, bus_generic_detach),
407 DEVMETHOD(device_shutdown, bus_generic_shutdown),
408 DEVMETHOD(device_suspend, bus_generic_suspend),
409 DEVMETHOD(device_resume, bus_generic_resume),
410
411 /* Bus interface */
412 DEVMETHOD(bus_add_child, isa_add_child),
413 DEVMETHOD(bus_print_child, isa_print_child),
414 DEVMETHOD(bus_read_ivar, isa_read_ivar),
415 DEVMETHOD(bus_write_ivar, isa_write_ivar),
868static device_method_t isa_methods[] = {
869 /* Device interface */
870 DEVMETHOD(device_probe, isa_probe),
871 DEVMETHOD(device_attach, isa_attach),
872 DEVMETHOD(device_detach, bus_generic_detach),
873 DEVMETHOD(device_shutdown, bus_generic_shutdown),
874 DEVMETHOD(device_suspend, bus_generic_suspend),
875 DEVMETHOD(device_resume, bus_generic_resume),
876
877 /* Bus interface */
878 DEVMETHOD(bus_add_child, isa_add_child),
879 DEVMETHOD(bus_print_child, isa_print_child),
880 DEVMETHOD(bus_read_ivar, isa_read_ivar),
881 DEVMETHOD(bus_write_ivar, isa_write_ivar),
882 DEVMETHOD(bus_child_detached, isa_child_detached),
416 DEVMETHOD(bus_alloc_resource, isa_alloc_resource),
417 DEVMETHOD(bus_release_resource, isa_release_resource),
418 DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
419 DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
420 DEVMETHOD(bus_setup_intr, isa_setup_intr),
421 DEVMETHOD(bus_teardown_intr, isa_teardown_intr),
422
423 /* ISA interface */
424 DEVMETHOD(isa_set_resource, isa_set_resource),
425 DEVMETHOD(isa_get_resource, isa_get_resource),
426 DEVMETHOD(isa_delete_resource, isa_delete_resource),
883 DEVMETHOD(bus_alloc_resource, isa_alloc_resource),
884 DEVMETHOD(bus_release_resource, isa_release_resource),
885 DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
886 DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
887 DEVMETHOD(bus_setup_intr, isa_setup_intr),
888 DEVMETHOD(bus_teardown_intr, isa_teardown_intr),
889
890 /* ISA interface */
891 DEVMETHOD(isa_set_resource, isa_set_resource),
892 DEVMETHOD(isa_get_resource, isa_get_resource),
893 DEVMETHOD(isa_delete_resource, isa_delete_resource),
894 DEVMETHOD(isa_add_config, isa_add_config),
895 DEVMETHOD(isa_set_config_callback, isa_set_config_callback),
896 DEVMETHOD(isa_pnp_probe, isa_pnp_probe),
427
428 { 0, 0 }
429};
430
431static driver_t isa_driver = {
432 "isa",
433 isa_methods,
434 1, /* no softc */
435};
436
437/*
438 * ISA can be attached to a PCI-ISA bridge or directly to the nexus.
439 */
440DRIVER_MODULE(isa, isab, isa_driver, isa_devclass, 0, 0);
441#ifdef __i386__
442DRIVER_MODULE(isa, nexus, isa_driver, isa_devclass, 0, 0);
443#endif
897
898 { 0, 0 }
899};
900
901static driver_t isa_driver = {
902 "isa",
903 isa_methods,
904 1, /* no softc */
905};
906
907/*
908 * ISA can be attached to a PCI-ISA bridge or directly to the nexus.
909 */
910DRIVER_MODULE(isa, isab, isa_driver, isa_devclass, 0, 0);
911#ifdef __i386__
912DRIVER_MODULE(isa, nexus, isa_driver, isa_devclass, 0, 0);
913#endif
914
915/*
916 * A fallback driver for reporting un-matched pnp devices.
917 */
918
919static int
920unknown_probe(device_t dev)
921{
922 /*
923 * Only match pnp devices.
924 */
925 if (isa_get_vendorid(dev) != 0)
926 return -100;
927 return ENXIO;
928}
929
930static int
931unknown_attach(device_t dev)
932{
933 return 0;
934}
935
936static int
937unknown_detach(device_t dev)
938{
939 return 0;
940}
941
942static device_method_t unknown_methods[] = {
943 /* Device interface */
944 DEVMETHOD(device_probe, unknown_probe),
945 DEVMETHOD(device_attach, unknown_attach),
946 DEVMETHOD(device_detach, unknown_detach),
947
948 { 0, 0 }
949};
950
951static driver_t unknown_driver = {
952 "unknown",
953 unknown_methods,
954 1, /* no softc */
955};
956
957static devclass_t unknown_devclass;
958
959DRIVER_MODULE(unknown, isa, unknown_driver, unknown_devclass, 0, 0);