2 * Copyright (c) 1999 Doug Rabson
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
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
27 * Modifications for Intel architecture by Garrett A. Wollman.
28 * Copyright 1998 Massachusetts Institute of Technology
30 * Permission to use, copy, modify, and distribute this software and
31 * its documentation for any purpose and without fee is hereby
32 * granted, provided that both the above copyright notice and this
33 * permission notice appear in all copies, that both the above
34 * copyright notice and this permission notice appear in all
35 * supporting documentation, and that the name of M.I.T. not be used
36 * in advertising or publicity pertaining to distribution of the
37 * software without specific, written prior permission. M.I.T. makes
38 * no representations about the suitability of this software for any
39 * purpose. It is provided "as is" without express or implied
42 * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
43 * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
44 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
45 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
46 * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
48 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
49 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
50 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
51 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
52 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
57 * Parts of the ISA bus implementation common to all architectures.
60 #include <sys/cdefs.h>
61 __FBSDID("$FreeBSD$");
65 #include <sys/param.h>
66 #include <sys/systm.h>
67 #include <sys/kernel.h>
69 #include <sys/malloc.h>
70 #include <sys/module.h>
71 #include <machine/bus.h>
74 #include <machine/resource.h>
76 #include <isa/isavar.h>
77 #include <isa/isa_common.h>
79 static int isa_print_child(device_t bus, device_t dev);
81 static MALLOC_DEFINE(M_ISADEV, "isadev", "ISA device");
83 static int isa_running;
86 * At 'probe' time, we add all the devices which we know about to the
87 * bus. The generic attach routine will probe and attach them if they
91 isa_probe(device_t dev)
93 device_set_desc(dev, "ISA bus");
94 isa_init(dev); /* Allow machdep code to initialise */
98 extern device_t isa_bus_device;
101 isa_attach(device_t dev)
104 * Arrange for isa_probe_children(dev) to be called later. XXX
106 isa_bus_device = dev;
111 * Find a working set of memory regions for a child using the ranges
112 * in *config and return the regions in *result. Returns non-zero if
113 * a set of ranges was found.
116 isa_find_memory(device_t child, struct isa_config *config,
117 struct isa_config *result)
120 struct resource *res[ISA_NMEM];
123 * First clear out any existing resource definitions.
125 for (i = 0; i < ISA_NMEM; i++) {
126 bus_delete_resource(child, SYS_RES_MEMORY, i);
131 result->ic_nmem = config->ic_nmem;
132 for (i = 0; i < config->ic_nmem; i++) {
133 uint32_t start, end, size, align;
135 size = config->ic_mem[i].ir_size;
137 /* the PnP device may have a null resource as filler */
139 result->ic_mem[i].ir_start = 0;
140 result->ic_mem[i].ir_end = 0;
141 result->ic_mem[i].ir_size = 0;
142 result->ic_mem[i].ir_align = 0;
146 for (start = config->ic_mem[i].ir_start,
147 end = config->ic_mem[i].ir_end,
148 align = config->ic_mem[i].ir_align;
149 start + size - 1 <= end && start + size > start;
150 start += MAX(align, 1)) {
151 bus_set_resource(child, SYS_RES_MEMORY, i,
153 res[i] = bus_alloc_resource(child,
154 SYS_RES_MEMORY, &i, 0, ~0, 1,
155 rman_make_alignment_flags(align) /* !RF_ACTIVE */);
157 result->ic_mem[i].ir_start = start;
158 result->ic_mem[i].ir_end = start + size - 1;
159 result->ic_mem[i].ir_size = size;
160 result->ic_mem[i].ir_align = align;
166 * If we didn't find a place for memory range i, then
175 for (i = 0; i < ISA_NMEM; i++) {
177 bus_release_resource(child, SYS_RES_MEMORY,
185 * Find a working set of port regions for a child using the ranges
186 * in *config and return the regions in *result. Returns non-zero if
187 * a set of ranges was found.
190 isa_find_port(device_t child, struct isa_config *config,
191 struct isa_config *result)
194 struct resource *res[ISA_NPORT];
197 * First clear out any existing resource definitions.
199 for (i = 0; i < ISA_NPORT; i++) {
200 bus_delete_resource(child, SYS_RES_IOPORT, i);
205 result->ic_nport = config->ic_nport;
206 for (i = 0; i < config->ic_nport; i++) {
207 uint32_t start, end, size, align;
209 size = config->ic_port[i].ir_size;
211 /* the PnP device may have a null resource as filler */
213 result->ic_port[i].ir_start = 0;
214 result->ic_port[i].ir_end = 0;
215 result->ic_port[i].ir_size = 0;
216 result->ic_port[i].ir_align = 0;
220 for (start = config->ic_port[i].ir_start,
221 end = config->ic_port[i].ir_end,
222 align = config->ic_port[i].ir_align;
223 start + size - 1 <= end;
225 bus_set_resource(child, SYS_RES_IOPORT, i,
227 res[i] = bus_alloc_resource(child,
228 SYS_RES_IOPORT, &i, 0, ~0, 1,
229 rman_make_alignment_flags(align) /* !RF_ACTIVE */);
231 result->ic_port[i].ir_start = start;
232 result->ic_port[i].ir_end = start + size - 1;
233 result->ic_port[i].ir_size = size;
234 result->ic_port[i].ir_align = align;
240 * If we didn't find a place for port range i, then
249 for (i = 0; i < ISA_NPORT; i++) {
251 bus_release_resource(child, SYS_RES_IOPORT,
259 * Return the index of the first bit in the mask (or -1 if mask is empty.
262 find_first_bit(uint32_t mask)
264 return (ffs(mask) - 1);
268 * Return the index of the next bit in the mask, or -1 if there are no more.
271 find_next_bit(uint32_t mask, int bit)
274 while (bit < 32 && !(mask & (1 << bit)))
282 * Find a working set of irqs for a child using the masks in *config
283 * and return the regions in *result. Returns non-zero if a set of
287 isa_find_irq(device_t child, struct isa_config *config,
288 struct isa_config *result)
291 struct resource *res[ISA_NIRQ];
294 * First clear out any existing resource definitions.
296 for (i = 0; i < ISA_NIRQ; i++) {
297 bus_delete_resource(child, SYS_RES_IRQ, i);
302 result->ic_nirq = config->ic_nirq;
303 for (i = 0; i < config->ic_nirq; i++) {
304 uint32_t mask = config->ic_irqmask[i];
307 /* the PnP device may have a null resource as filler */
309 result->ic_irqmask[i] = 0;
313 for (irq = find_first_bit(mask);
315 irq = find_next_bit(mask, irq)) {
316 bus_set_resource(child, SYS_RES_IRQ, i,
318 res[i] = bus_alloc_resource_any(child,
320 0 /* !RF_ACTIVE */ );
322 result->ic_irqmask[i] = (1 << irq);
328 * If we didn't find a place for irq range i, then
337 for (i = 0; i < ISA_NIRQ; i++) {
339 bus_release_resource(child, SYS_RES_IRQ,
347 * Find a working set of drqs for a child using the masks in *config
348 * and return the regions in *result. Returns non-zero if a set of
352 isa_find_drq(device_t child, struct isa_config *config,
353 struct isa_config *result)
356 struct resource *res[ISA_NDRQ];
359 * First clear out any existing resource definitions.
361 for (i = 0; i < ISA_NDRQ; i++) {
362 bus_delete_resource(child, SYS_RES_DRQ, i);
367 result->ic_ndrq = config->ic_ndrq;
368 for (i = 0; i < config->ic_ndrq; i++) {
369 uint32_t mask = config->ic_drqmask[i];
372 /* the PnP device may have a null resource as filler */
374 result->ic_drqmask[i] = 0;
378 for (drq = find_first_bit(mask);
380 drq = find_next_bit(mask, drq)) {
381 bus_set_resource(child, SYS_RES_DRQ, i,
383 res[i] = bus_alloc_resource_any(child,
387 result->ic_drqmask[i] = (1 << drq);
393 * If we didn't find a place for drq range i, then
402 for (i = 0; i < ISA_NDRQ; i++) {
404 bus_release_resource(child, SYS_RES_DRQ,
412 * Attempt to find a working set of resources for a device. Return
413 * non-zero if a working configuration is found.
416 isa_assign_resources(device_t child)
418 struct isa_device *idev = DEVTOISA(child);
419 struct isa_config_entry *ice;
420 struct isa_config *cfg;
423 reason = "Empty ISA id_configs";
424 cfg = malloc(sizeof(struct isa_config), M_TEMP, M_NOWAIT|M_ZERO);
427 TAILQ_FOREACH(ice, &idev->id_configs, ice_link) {
429 if (!isa_find_memory(child, &ice->ice_config, cfg))
432 if (!isa_find_port(child, &ice->ice_config, cfg))
435 if (!isa_find_irq(child, &ice->ice_config, cfg))
438 if (!isa_find_drq(child, &ice->ice_config, cfg))
442 * A working configuration was found enable the device
443 * with this configuration.
445 reason = "no callback";
446 if (idev->id_config_cb) {
447 idev->id_config_cb(idev->id_config_arg,
455 * Disable the device.
457 bus_print_child_header(device_get_parent(child), child);
458 printf(" can't assign resources (%s)\n", reason);
460 isa_print_child(device_get_parent(child), child);
461 bzero(cfg, sizeof (*cfg));
462 if (idev->id_config_cb)
463 idev->id_config_cb(idev->id_config_arg, cfg, 0);
464 device_disable(child);
471 * Return non-zero if the device has a single configuration, that is,
472 * a fixed set of resoruces.
475 isa_has_single_config(device_t dev)
477 struct isa_device *idev = DEVTOISA(dev);
478 struct isa_config_entry *ice;
482 ice = TAILQ_FIRST(&idev->id_configs);
483 if (TAILQ_NEXT(ice, ice_link))
486 for (i = 0; i < ice->ice_config.ic_nmem; ++i) {
487 if (ice->ice_config.ic_mem[i].ir_size == 0)
489 if (ice->ice_config.ic_mem[i].ir_end !=
490 ice->ice_config.ic_mem[i].ir_start +
491 ice->ice_config.ic_mem[i].ir_size - 1)
494 for (i = 0; i < ice->ice_config.ic_nport; ++i) {
495 if (ice->ice_config.ic_port[i].ir_size == 0)
497 if (ice->ice_config.ic_port[i].ir_end !=
498 ice->ice_config.ic_port[i].ir_start +
499 ice->ice_config.ic_port[i].ir_size - 1)
502 for (i = 0; i < ice->ice_config.ic_nirq; ++i) {
503 mask = ice->ice_config.ic_irqmask[i];
506 if (find_next_bit(mask, find_first_bit(mask)) != -1)
509 for (i = 0; i < ice->ice_config.ic_ndrq; ++i) {
510 mask = ice->ice_config.ic_drqmask[i];
513 if (find_next_bit(mask, find_first_bit(mask)) != -1)
520 * Called after other devices have initialised to probe for isa devices.
523 isa_probe_children(device_t dev)
526 struct isa_config *cfg;
530 * Create all the children by calling driver's identify methods.
532 bus_generic_probe(dev);
534 if (device_get_children(dev, &children, &nchildren))
538 * First disable all pnp devices so that they don't get
539 * matched by legacy probes.
542 printf("isa_probe_children: disabling PnP devices\n");
544 cfg = malloc(sizeof(*cfg), M_TEMP, M_NOWAIT|M_ZERO);
546 free(children, M_TEMP);
550 for (i = 0; i < nchildren; i++) {
551 device_t child = children[i];
552 struct isa_device *idev = DEVTOISA(child);
554 bzero(cfg, sizeof(*cfg));
555 if (idev->id_config_cb)
556 idev->id_config_cb(idev->id_config_arg, cfg, 0);
562 * Next probe all non-pnp devices so that they claim their
566 printf("isa_probe_children: probing non-PnP devices\n");
567 for (i = 0; i < nchildren; i++) {
568 device_t child = children[i];
569 struct isa_device *idev = DEVTOISA(child);
571 if (TAILQ_FIRST(&idev->id_configs))
574 device_probe_and_attach(child);
578 * Finally assign resource to pnp devices and probe them.
581 printf("isa_probe_children: probing PnP devices\n");
582 for (i = 0; i < nchildren; i++) {
583 device_t child = children[i];
584 struct isa_device* idev = DEVTOISA(child);
586 if (!TAILQ_FIRST(&idev->id_configs))
589 if (isa_assign_resources(child)) {
590 struct resource_list *rl = &idev->id_resources;
591 struct resource_list_entry *rle;
593 device_probe_and_attach(child);
596 * Claim any unallocated resources to keep other
597 * devices from using them.
599 STAILQ_FOREACH(rle, rl, link) {
602 resource_list_alloc(rl, dev, child,
611 free(children, M_TEMP);
617 * Add a new child with default ivars.
620 isa_add_child(device_t dev, int order, const char *name, int unit)
623 struct isa_device *idev;
625 child = device_add_child_ordered(dev, order, name, unit);
629 idev = malloc(sizeof(struct isa_device), M_ISADEV, M_NOWAIT | M_ZERO);
633 resource_list_init(&idev->id_resources);
634 TAILQ_INIT(&idev->id_configs);
636 device_set_ivars(child, idev);
642 isa_print_all_resources(device_t dev)
644 struct isa_device *idev = DEVTOISA(dev);
645 struct resource_list *rl = &idev->id_resources;
648 if (STAILQ_FIRST(rl) || device_get_flags(dev))
649 retval += printf(" at");
651 retval += resource_list_print_type(rl, "port", SYS_RES_IOPORT, "%#lx");
652 retval += resource_list_print_type(rl, "iomem", SYS_RES_MEMORY, "%#lx");
653 retval += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%ld");
654 retval += resource_list_print_type(rl, "drq", SYS_RES_DRQ, "%ld");
655 if (device_get_flags(dev))
656 retval += printf(" flags %#x", device_get_flags(dev));
658 if (idev->id_vendorid)
659 retval += printf(" pnpid %s", pnp_eisaformat(idev->id_vendorid));
666 isa_print_child(device_t bus, device_t dev)
670 retval += bus_print_child_header(bus, dev);
671 retval += isa_print_all_resources(dev);
672 retval += bus_print_child_footer(bus, dev);
678 isa_probe_nomatch(device_t dev, device_t child)
681 bus_print_child_header(dev, child);
682 printf(" failed to probe");
683 isa_print_all_resources(child);
684 bus_print_child_footer(dev, child);
691 isa_read_ivar(device_t bus, device_t dev, int index, uintptr_t * result)
693 struct isa_device* idev = DEVTOISA(dev);
694 struct resource_list *rl = &idev->id_resources;
695 struct resource_list_entry *rle;
698 case ISA_IVAR_PORT_0:
699 rle = resource_list_find(rl, SYS_RES_IOPORT, 0);
701 *result = rle->start;
706 case ISA_IVAR_PORT_1:
707 rle = resource_list_find(rl, SYS_RES_IOPORT, 1);
709 *result = rle->start;
714 case ISA_IVAR_PORTSIZE_0:
715 rle = resource_list_find(rl, SYS_RES_IOPORT, 0);
717 *result = rle->count;
722 case ISA_IVAR_PORTSIZE_1:
723 rle = resource_list_find(rl, SYS_RES_IOPORT, 1);
725 *result = rle->count;
730 case ISA_IVAR_MADDR_0:
731 rle = resource_list_find(rl, SYS_RES_MEMORY, 0);
733 *result = rle->start;
738 case ISA_IVAR_MADDR_1:
739 rle = resource_list_find(rl, SYS_RES_MEMORY, 1);
741 *result = rle->start;
746 case ISA_IVAR_MEMSIZE_0:
747 rle = resource_list_find(rl, SYS_RES_MEMORY, 0);
749 *result = rle->count;
754 case ISA_IVAR_MEMSIZE_1:
755 rle = resource_list_find(rl, SYS_RES_MEMORY, 1);
757 *result = rle->count;
763 rle = resource_list_find(rl, SYS_RES_IRQ, 0);
765 *result = rle->start;
771 rle = resource_list_find(rl, SYS_RES_IRQ, 1);
773 *result = rle->start;
779 rle = resource_list_find(rl, SYS_RES_DRQ, 0);
781 *result = rle->start;
787 rle = resource_list_find(rl, SYS_RES_DRQ, 1);
789 *result = rle->start;
794 case ISA_IVAR_VENDORID:
795 *result = idev->id_vendorid;
798 case ISA_IVAR_SERIAL:
799 *result = idev->id_serial;
802 case ISA_IVAR_LOGICALID:
803 *result = idev->id_logicalid;
806 case ISA_IVAR_COMPATID:
807 *result = idev->id_compatid;
810 case ISA_IVAR_CONFIGATTR:
811 *result = idev->id_config_attr;
822 isa_write_ivar(device_t bus, device_t dev, int index, uintptr_t value)
824 struct isa_device* idev = DEVTOISA(dev);
827 case ISA_IVAR_PORT_0:
828 case ISA_IVAR_PORT_1:
829 case ISA_IVAR_PORTSIZE_0:
830 case ISA_IVAR_PORTSIZE_1:
831 case ISA_IVAR_MADDR_0:
832 case ISA_IVAR_MADDR_1:
833 case ISA_IVAR_MEMSIZE_0:
834 case ISA_IVAR_MEMSIZE_1:
841 case ISA_IVAR_VENDORID:
842 idev->id_vendorid = value;
845 case ISA_IVAR_SERIAL:
846 idev->id_serial = value;
849 case ISA_IVAR_LOGICALID:
850 idev->id_logicalid = value;
853 case ISA_IVAR_COMPATID:
854 idev->id_compatid = value;
857 case ISA_IVAR_CONFIGATTR:
858 idev->id_config_attr = value;
869 * Free any resources which the driver missed or which we were holding for
870 * it (see isa_probe_children).
873 isa_child_detached(device_t dev, device_t child)
875 struct isa_device* idev = DEVTOISA(child);
876 struct resource_list *rl = &idev->id_resources;
877 struct resource_list_entry *rle;
879 if (TAILQ_FIRST(&idev->id_configs)) {
881 * Claim any unallocated resources to keep other
882 * devices from using them.
884 STAILQ_FOREACH(rle, rl, link) {
887 resource_list_alloc(rl, dev, child,
896 isa_driver_added(device_t dev, driver_t *driver)
902 * Don't do anything if drivers are dynamically
903 * added during autoconfiguration (cf. ymf724).
904 * since that would end up calling identify
910 DEVICE_IDENTIFY(driver, dev);
911 if (device_get_children(dev, &children, &nchildren))
914 for (i = 0; i < nchildren; i++) {
915 device_t child = children[i];
916 struct isa_device *idev = DEVTOISA(child);
917 struct resource_list *rl = &idev->id_resources;
918 struct resource_list_entry *rle;
920 if (device_get_state(child) != DS_NOTPRESENT)
922 if (!device_is_enabled(child))
926 * Free resources which we were holding on behalf of
929 STAILQ_FOREACH(rle, &idev->id_resources, link) {
931 resource_list_release(rl, dev, child,
937 if (TAILQ_FIRST(&idev->id_configs))
938 if (!isa_assign_resources(child))
941 device_probe_and_attach(child);
943 if (TAILQ_FIRST(&idev->id_configs)) {
945 * Claim any unallocated resources to keep other
946 * devices from using them.
948 STAILQ_FOREACH(rle, rl, link) {
951 resource_list_alloc(rl, dev, child,
959 free(children, M_TEMP);
963 isa_set_resource(device_t dev, device_t child, int type, int rid,
964 u_long start, u_long count)
966 struct isa_device* idev = DEVTOISA(child);
967 struct resource_list *rl = &idev->id_resources;
969 if (type != SYS_RES_IOPORT && type != SYS_RES_MEMORY
970 && type != SYS_RES_IRQ && type != SYS_RES_DRQ)
974 if (type == SYS_RES_IOPORT && rid >= ISA_NPORT)
976 if (type == SYS_RES_MEMORY && rid >= ISA_NMEM)
978 if (type == SYS_RES_IRQ && rid >= ISA_NIRQ)
980 if (type == SYS_RES_DRQ && rid >= ISA_NDRQ)
983 resource_list_add(rl, type, rid, start, start + count - 1, count);
988 static struct resource_list *
989 isa_get_resource_list (device_t dev, device_t child)
991 struct isa_device* idev = DEVTOISA(child);
992 struct resource_list *rl = &idev->id_resources;
1001 isa_add_config(device_t dev, device_t child, int priority,
1002 struct isa_config *config)
1004 struct isa_device* idev = DEVTOISA(child);
1005 struct isa_config_entry *newice, *ice;
1007 newice = malloc(sizeof *ice, M_DEVBUF, M_NOWAIT);
1011 newice->ice_priority = priority;
1012 newice->ice_config = *config;
1014 TAILQ_FOREACH(ice, &idev->id_configs, ice_link) {
1015 if (ice->ice_priority > priority)
1019 TAILQ_INSERT_BEFORE(ice, newice, ice_link);
1021 TAILQ_INSERT_TAIL(&idev->id_configs, newice, ice_link);
1023 if (isa_has_single_config(child))
1024 idev->id_config_attr &= ~ISACFGATTR_MULTI;
1026 idev->id_config_attr |= ISACFGATTR_MULTI;
1032 isa_set_config_callback(device_t dev, device_t child, isa_config_cb *fn,
1035 struct isa_device* idev = DEVTOISA(child);
1037 idev->id_config_cb = fn;
1038 idev->id_config_arg = arg;
1042 isa_pnp_probe(device_t dev, device_t child, struct isa_pnp_id *ids)
1044 struct isa_device* idev = DEVTOISA(child);
1046 if (!idev->id_vendorid)
1049 while (ids && ids->ip_id) {
1051 * Really ought to support >1 compat id per device.
1053 if (idev->id_logicalid == ids->ip_id
1054 || idev->id_compatid == ids->ip_id) {
1056 device_set_desc(child, ids->ip_desc);
1066 isa_child_pnpinfo_str(device_t bus, device_t child, char *buf,
1070 struct isa_device *idev = DEVTOISA(child);
1072 if (idev->id_vendorid)
1073 snprintf(buf, buflen, "pnpid=%s",
1074 pnp_eisaformat(idev->id_vendorid));
1080 isa_child_location_str(device_t bus, device_t child, char *buf,
1083 /* Nothing here yet */
1088 static device_method_t isa_methods[] = {
1089 /* Device interface */
1090 DEVMETHOD(device_probe, isa_probe),
1091 DEVMETHOD(device_attach, isa_attach),
1092 DEVMETHOD(device_detach, bus_generic_detach),
1093 DEVMETHOD(device_shutdown, bus_generic_shutdown),
1094 DEVMETHOD(device_suspend, bus_generic_suspend),
1095 DEVMETHOD(device_resume, bus_generic_resume),
1098 DEVMETHOD(bus_add_child, isa_add_child),
1099 DEVMETHOD(bus_print_child, isa_print_child),
1100 DEVMETHOD(bus_probe_nomatch, isa_probe_nomatch),
1101 DEVMETHOD(bus_read_ivar, isa_read_ivar),
1102 DEVMETHOD(bus_write_ivar, isa_write_ivar),
1103 DEVMETHOD(bus_child_detached, isa_child_detached),
1104 DEVMETHOD(bus_driver_added, isa_driver_added),
1105 DEVMETHOD(bus_setup_intr, isa_setup_intr),
1106 DEVMETHOD(bus_teardown_intr, isa_teardown_intr),
1108 DEVMETHOD(bus_get_resource_list,isa_get_resource_list),
1109 DEVMETHOD(bus_alloc_resource, isa_alloc_resource),
1110 DEVMETHOD(bus_release_resource, isa_release_resource),
1111 DEVMETHOD(bus_set_resource, isa_set_resource),
1112 DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource),
1113 DEVMETHOD(bus_delete_resource, bus_generic_rl_delete_resource),
1114 DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
1115 DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
1116 DEVMETHOD(bus_child_pnpinfo_str, isa_child_pnpinfo_str),
1117 DEVMETHOD(bus_child_location_str, isa_child_location_str),
1120 DEVMETHOD(isa_add_config, isa_add_config),
1121 DEVMETHOD(isa_set_config_callback, isa_set_config_callback),
1122 DEVMETHOD(isa_pnp_probe, isa_pnp_probe),
1127 driver_t isa_driver = {
1133 devclass_t isa_devclass;
1136 * ISA can be attached to a PCI-ISA bridge, or other locations on some
1139 DRIVER_MODULE(isa, isab, isa_driver, isa_devclass, 0, 0);
1140 DRIVER_MODULE(isa, eisab, isa_driver, isa_devclass, 0, 0);
1141 MODULE_VERSION(isa, 1);
1144 * Code common to ISA bridges.
1147 devclass_t isab_devclass;
1150 isab_attach(device_t dev)
1154 child = device_add_child(dev, "isa", 0);
1156 return (bus_generic_attach(dev));