2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD AND MIT
4 * Copyright (c) 1999 Doug Rabson
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * Modifications for Intel architecture by Garrett A. Wollman.
30 * Copyright 1998 Massachusetts Institute of Technology
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
35 * permission notice appear in all copies, that both the above
36 * copyright notice and this permission notice appear in all
37 * supporting documentation, and that the name of M.I.T. not be used
38 * in advertising or publicity pertaining to distribution of the
39 * software without specific, written prior permission. M.I.T. makes
40 * no representations about the suitability of this software for any
41 * purpose. It is provided "as is" without express or implied
44 * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
45 * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
46 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
47 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
48 * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
49 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
50 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
51 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
52 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
53 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
54 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * Parts of the ISA bus implementation common to all architectures.
62 #include <sys/cdefs.h>
63 __FBSDID("$FreeBSD$");
67 #include <sys/param.h>
68 #include <sys/systm.h>
69 #include <sys/kernel.h>
71 #include <sys/endian.h>
72 #include <sys/malloc.h>
73 #include <sys/module.h>
74 #include <machine/bus.h>
77 #include <sys/sysctl.h>
79 #include <machine/resource.h>
81 #include <isa/isavar.h>
82 #include <isa/isa_common.h>
84 static int isa_print_child(device_t bus, device_t dev);
86 static MALLOC_DEFINE(M_ISADEV, "isadev", "ISA device");
88 static int isa_running;
91 * At 'probe' time, we add all the devices which we know about to the
92 * bus. The generic attach routine will probe and attach them if they
96 isa_probe(device_t dev)
98 device_set_desc(dev, "ISA bus");
99 isa_init(dev); /* Allow machdep code to initialise */
103 extern device_t isa_bus_device;
106 isa_attach(device_t dev)
109 * Arrange for isa_probe_children(dev) to be called later. XXX
111 isa_bus_device = dev;
116 * Find a working set of memory regions for a child using the ranges
117 * in *config and return the regions in *result. Returns non-zero if
118 * a set of ranges was found.
121 isa_find_memory(device_t child, struct isa_config *config,
122 struct isa_config *result)
125 struct resource *res[ISA_NMEM];
128 * First clear out any existing resource definitions.
130 for (i = 0; i < ISA_NMEM; i++) {
131 bus_delete_resource(child, SYS_RES_MEMORY, i);
136 result->ic_nmem = config->ic_nmem;
137 for (i = 0; i < config->ic_nmem; i++) {
138 uint32_t start, end, size, align;
140 size = config->ic_mem[i].ir_size;
142 /* the PnP device may have a null resource as filler */
144 result->ic_mem[i].ir_start = 0;
145 result->ic_mem[i].ir_end = 0;
146 result->ic_mem[i].ir_size = 0;
147 result->ic_mem[i].ir_align = 0;
151 for (start = config->ic_mem[i].ir_start,
152 end = config->ic_mem[i].ir_end,
153 align = config->ic_mem[i].ir_align;
154 start + size - 1 <= end && start + size > start;
155 start += MAX(align, 1)) {
156 bus_set_resource(child, SYS_RES_MEMORY, i,
158 res[i] = bus_alloc_resource_any(child,
160 rman_make_alignment_flags(align) /* !RF_ACTIVE */);
162 result->ic_mem[i].ir_start = start;
163 result->ic_mem[i].ir_end = start + size - 1;
164 result->ic_mem[i].ir_size = size;
165 result->ic_mem[i].ir_align = align;
171 * If we didn't find a place for memory range i, then
180 for (i = 0; i < ISA_NMEM; i++) {
182 bus_release_resource(child, SYS_RES_MEMORY,
190 * Find a working set of port regions for a child using the ranges
191 * in *config and return the regions in *result. Returns non-zero if
192 * a set of ranges was found.
195 isa_find_port(device_t child, struct isa_config *config,
196 struct isa_config *result)
199 struct resource *res[ISA_NPORT];
202 * First clear out any existing resource definitions.
204 for (i = 0; i < ISA_NPORT; i++) {
205 bus_delete_resource(child, SYS_RES_IOPORT, i);
210 result->ic_nport = config->ic_nport;
211 for (i = 0; i < config->ic_nport; i++) {
212 uint32_t start, end, size, align;
214 size = config->ic_port[i].ir_size;
216 /* the PnP device may have a null resource as filler */
218 result->ic_port[i].ir_start = 0;
219 result->ic_port[i].ir_end = 0;
220 result->ic_port[i].ir_size = 0;
221 result->ic_port[i].ir_align = 0;
225 for (start = config->ic_port[i].ir_start,
226 end = config->ic_port[i].ir_end,
227 align = config->ic_port[i].ir_align;
228 start + size - 1 <= end;
230 bus_set_resource(child, SYS_RES_IOPORT, i,
232 res[i] = bus_alloc_resource_any(child,
234 rman_make_alignment_flags(align) /* !RF_ACTIVE */);
236 result->ic_port[i].ir_start = start;
237 result->ic_port[i].ir_end = start + size - 1;
238 result->ic_port[i].ir_size = size;
239 result->ic_port[i].ir_align = align;
245 * If we didn't find a place for port range i, then
254 for (i = 0; i < ISA_NPORT; i++) {
256 bus_release_resource(child, SYS_RES_IOPORT,
264 * Return the index of the first bit in the mask (or -1 if mask is empty.
267 find_first_bit(uint32_t mask)
269 return (ffs(mask) - 1);
273 * Return the index of the next bit in the mask, or -1 if there are no more.
276 find_next_bit(uint32_t mask, int bit)
279 while (bit < 32 && !(mask & (1 << bit)))
287 * Find a working set of irqs for a child using the masks in *config
288 * and return the regions in *result. Returns non-zero if a set of
292 isa_find_irq(device_t child, struct isa_config *config,
293 struct isa_config *result)
296 struct resource *res[ISA_NIRQ];
299 * First clear out any existing resource definitions.
301 for (i = 0; i < ISA_NIRQ; i++) {
302 bus_delete_resource(child, SYS_RES_IRQ, i);
307 result->ic_nirq = config->ic_nirq;
308 for (i = 0; i < config->ic_nirq; i++) {
309 uint32_t mask = config->ic_irqmask[i];
312 /* the PnP device may have a null resource as filler */
314 result->ic_irqmask[i] = 0;
318 for (irq = find_first_bit(mask);
320 irq = find_next_bit(mask, irq)) {
321 bus_set_resource(child, SYS_RES_IRQ, i,
323 res[i] = bus_alloc_resource_any(child,
325 0 /* !RF_ACTIVE */ );
327 result->ic_irqmask[i] = (1 << irq);
333 * If we didn't find a place for irq range i, then
342 for (i = 0; i < ISA_NIRQ; i++) {
344 bus_release_resource(child, SYS_RES_IRQ,
352 * Find a working set of drqs for a child using the masks in *config
353 * and return the regions in *result. Returns non-zero if a set of
357 isa_find_drq(device_t child, struct isa_config *config,
358 struct isa_config *result)
361 struct resource *res[ISA_NDRQ];
364 * First clear out any existing resource definitions.
366 for (i = 0; i < ISA_NDRQ; i++) {
367 bus_delete_resource(child, SYS_RES_DRQ, i);
372 result->ic_ndrq = config->ic_ndrq;
373 for (i = 0; i < config->ic_ndrq; i++) {
374 uint32_t mask = config->ic_drqmask[i];
377 /* the PnP device may have a null resource as filler */
379 result->ic_drqmask[i] = 0;
383 for (drq = find_first_bit(mask);
385 drq = find_next_bit(mask, drq)) {
386 bus_set_resource(child, SYS_RES_DRQ, i,
388 res[i] = bus_alloc_resource_any(child,
392 result->ic_drqmask[i] = (1 << drq);
398 * If we didn't find a place for drq range i, then
407 for (i = 0; i < ISA_NDRQ; i++) {
409 bus_release_resource(child, SYS_RES_DRQ,
417 * Attempt to find a working set of resources for a device. Return
418 * non-zero if a working configuration is found.
421 isa_assign_resources(device_t child)
423 struct isa_device *idev = DEVTOISA(child);
424 struct isa_config_entry *ice;
425 struct isa_config *cfg;
428 reason = "Empty ISA id_configs";
429 cfg = malloc(sizeof(struct isa_config), M_TEMP, M_NOWAIT|M_ZERO);
432 TAILQ_FOREACH(ice, &idev->id_configs, ice_link) {
434 if (!isa_find_memory(child, &ice->ice_config, cfg))
437 if (!isa_find_port(child, &ice->ice_config, cfg))
440 if (!isa_find_irq(child, &ice->ice_config, cfg))
443 if (!isa_find_drq(child, &ice->ice_config, cfg))
447 * A working configuration was found enable the device
448 * with this configuration.
450 reason = "no callback";
451 if (idev->id_config_cb) {
452 idev->id_config_cb(idev->id_config_arg,
460 * Disable the device.
462 bus_print_child_header(device_get_parent(child), child);
463 printf(" can't assign resources (%s)\n", reason);
465 isa_print_child(device_get_parent(child), child);
466 bzero(cfg, sizeof (*cfg));
467 if (idev->id_config_cb)
468 idev->id_config_cb(idev->id_config_arg, cfg, 0);
469 device_disable(child);
476 * Claim any unallocated resources to keep other devices from using
480 isa_claim_resources(device_t dev, device_t child)
482 struct isa_device *idev = DEVTOISA(child);
483 struct resource_list *rl = &idev->id_resources;
484 struct resource_list_entry *rle;
487 STAILQ_FOREACH(rle, rl, link) {
490 resource_list_alloc(rl, dev, child, rle->type, &rid,
497 * Called after other devices have initialised to probe for isa devices.
500 isa_probe_children(device_t dev)
502 struct isa_device *idev;
503 device_t *children, child;
504 struct isa_config *cfg;
505 int nchildren, i, err;
508 * Create all the non-hinted children by calling drivers'
511 bus_generic_probe(dev);
513 if (device_get_children(dev, &children, &nchildren))
517 * First disable all pnp devices so that they don't get
518 * matched by legacy probes.
521 printf("isa_probe_children: disabling PnP devices\n");
523 cfg = malloc(sizeof(*cfg), M_TEMP, M_NOWAIT|M_ZERO);
525 free(children, M_TEMP);
529 for (i = 0; i < nchildren; i++) {
530 idev = DEVTOISA(children[i]);
532 bzero(cfg, sizeof(*cfg));
533 if (idev->id_config_cb)
534 idev->id_config_cb(idev->id_config_arg, cfg, 0);
540 * Next, probe all the PnP BIOS devices so they can subsume any
543 for (i = 0; i < nchildren; i++) {
545 idev = DEVTOISA(child);
547 if (idev->id_order > ISA_ORDER_PNPBIOS)
549 if (!TAILQ_EMPTY(&idev->id_configs) &&
550 !isa_assign_resources(child))
553 if (device_probe_and_attach(child) == 0)
554 isa_claim_resources(dev, child);
556 free(children, M_TEMP);
559 * Next, enumerate hinted devices and probe all non-pnp devices so
560 * that they claim their resources first.
562 bus_enumerate_hinted_children(dev);
563 if (device_get_children(dev, &children, &nchildren))
566 printf("isa_probe_children: probing non-PnP devices\n");
567 for (i = 0; i < nchildren; i++) {
569 idev = DEVTOISA(child);
571 if (device_is_attached(child) ||
572 !TAILQ_EMPTY(&idev->id_configs))
575 err = device_probe_and_attach(child);
576 if (err == 0 && idev->id_vendorid == 0 &&
577 strcmp(kern_ident, "GENERIC") == 0 &&
578 device_is_attached(child))
580 "non-PNP ISA device will be removed from GENERIC in FreeBSD 14.\n");
584 * Finally assign resource to pnp devices and probe them.
587 printf("isa_probe_children: probing PnP devices\n");
588 for (i = 0; i < nchildren; i++) {
590 idev = DEVTOISA(child);
592 if (device_is_attached(child) || TAILQ_EMPTY(&idev->id_configs))
595 if (isa_assign_resources(child)) {
596 device_probe_and_attach(child);
597 isa_claim_resources(dev, child);
601 free(children, M_TEMP);
607 * Add a new child with default ivars.
610 isa_add_child(device_t dev, u_int order, const char *name, int unit)
613 struct isa_device *idev;
615 child = device_add_child_ordered(dev, order, name, unit);
619 idev = malloc(sizeof(struct isa_device), M_ISADEV, M_NOWAIT | M_ZERO);
623 resource_list_init(&idev->id_resources);
624 TAILQ_INIT(&idev->id_configs);
625 idev->id_order = order;
627 device_set_ivars(child, idev);
633 isa_print_all_resources(device_t dev)
635 struct isa_device *idev = DEVTOISA(dev);
636 struct resource_list *rl = &idev->id_resources;
639 if (STAILQ_FIRST(rl) || device_get_flags(dev))
640 retval += printf(" at");
642 retval += resource_list_print_type(rl, "port", SYS_RES_IOPORT, "%#jx");
643 retval += resource_list_print_type(rl, "iomem", SYS_RES_MEMORY, "%#jx");
644 retval += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%jd");
645 retval += resource_list_print_type(rl, "drq", SYS_RES_DRQ, "%jd");
646 if (device_get_flags(dev))
647 retval += printf(" flags %#x", device_get_flags(dev));
648 if (idev->id_vendorid)
649 retval += printf(" pnpid %s", pnp_eisaformat(idev->id_vendorid));
655 isa_print_child(device_t bus, device_t dev)
659 retval += bus_print_child_header(bus, dev);
660 retval += isa_print_all_resources(dev);
661 retval += bus_print_child_footer(bus, dev);
667 isa_probe_nomatch(device_t dev, device_t child)
670 bus_print_child_header(dev, child);
671 printf(" failed to probe");
672 isa_print_all_resources(child);
673 bus_print_child_footer(dev, child);
680 isa_read_ivar(device_t bus, device_t dev, int index, uintptr_t * result)
682 struct isa_device* idev = DEVTOISA(dev);
683 struct resource_list *rl = &idev->id_resources;
684 struct resource_list_entry *rle;
687 case ISA_IVAR_PORT_0:
688 rle = resource_list_find(rl, SYS_RES_IOPORT, 0);
690 *result = rle->start;
695 case ISA_IVAR_PORT_1:
696 rle = resource_list_find(rl, SYS_RES_IOPORT, 1);
698 *result = rle->start;
703 case ISA_IVAR_PORTSIZE_0:
704 rle = resource_list_find(rl, SYS_RES_IOPORT, 0);
706 *result = rle->count;
711 case ISA_IVAR_PORTSIZE_1:
712 rle = resource_list_find(rl, SYS_RES_IOPORT, 1);
714 *result = rle->count;
719 case ISA_IVAR_MADDR_0:
720 rle = resource_list_find(rl, SYS_RES_MEMORY, 0);
722 *result = rle->start;
727 case ISA_IVAR_MADDR_1:
728 rle = resource_list_find(rl, SYS_RES_MEMORY, 1);
730 *result = rle->start;
735 case ISA_IVAR_MEMSIZE_0:
736 rle = resource_list_find(rl, SYS_RES_MEMORY, 0);
738 *result = rle->count;
743 case ISA_IVAR_MEMSIZE_1:
744 rle = resource_list_find(rl, SYS_RES_MEMORY, 1);
746 *result = rle->count;
752 rle = resource_list_find(rl, SYS_RES_IRQ, 0);
754 *result = rle->start;
760 rle = resource_list_find(rl, SYS_RES_IRQ, 1);
762 *result = rle->start;
768 rle = resource_list_find(rl, SYS_RES_DRQ, 0);
770 *result = rle->start;
776 rle = resource_list_find(rl, SYS_RES_DRQ, 1);
778 *result = rle->start;
783 case ISA_IVAR_VENDORID:
784 *result = idev->id_vendorid;
787 case ISA_IVAR_SERIAL:
788 *result = idev->id_serial;
791 case ISA_IVAR_LOGICALID:
792 *result = idev->id_logicalid;
795 case ISA_IVAR_COMPATID:
796 *result = idev->id_compatid;
799 case ISA_IVAR_CONFIGATTR:
800 *result = idev->id_config_attr;
803 case ISA_IVAR_PNP_CSN:
804 *result = idev->id_pnp_csn;
807 case ISA_IVAR_PNP_LDN:
808 *result = idev->id_pnp_ldn;
811 case ISA_IVAR_PNPBIOS_HANDLE:
812 *result = idev->id_pnpbios_handle;
823 isa_write_ivar(device_t bus, device_t dev, int index, uintptr_t value)
825 struct isa_device* idev = DEVTOISA(dev);
828 case ISA_IVAR_PORT_0:
829 case ISA_IVAR_PORT_1:
830 case ISA_IVAR_PORTSIZE_0:
831 case ISA_IVAR_PORTSIZE_1:
832 case ISA_IVAR_MADDR_0:
833 case ISA_IVAR_MADDR_1:
834 case ISA_IVAR_MEMSIZE_0:
835 case ISA_IVAR_MEMSIZE_1:
842 case ISA_IVAR_VENDORID:
843 idev->id_vendorid = value;
846 case ISA_IVAR_SERIAL:
847 idev->id_serial = value;
850 case ISA_IVAR_LOGICALID:
851 idev->id_logicalid = value;
854 case ISA_IVAR_COMPATID:
855 idev->id_compatid = value;
858 case ISA_IVAR_CONFIGATTR:
859 idev->id_config_attr = value;
870 * Free any resources which the driver missed or which we were holding for
871 * it (see isa_probe_children).
874 isa_child_detached(device_t dev, device_t child)
876 struct isa_device* idev = DEVTOISA(child);
878 if (TAILQ_FIRST(&idev->id_configs))
879 isa_claim_resources(dev, child);
883 isa_driver_added(device_t dev, driver_t *driver)
889 * Don't do anything if drivers are dynamically
890 * added during autoconfiguration (cf. ymf724).
891 * since that would end up calling identify
897 DEVICE_IDENTIFY(driver, dev);
898 if (device_get_children(dev, &children, &nchildren))
901 for (i = 0; i < nchildren; i++) {
902 device_t child = children[i];
903 struct isa_device *idev = DEVTOISA(child);
904 struct resource_list *rl = &idev->id_resources;
905 struct resource_list_entry *rle;
907 if (device_get_state(child) != DS_NOTPRESENT)
909 if (!device_is_enabled(child))
913 * Free resources which we were holding on behalf of
916 STAILQ_FOREACH(rle, &idev->id_resources, link) {
918 resource_list_release(rl, dev, child,
924 if (TAILQ_FIRST(&idev->id_configs))
925 if (!isa_assign_resources(child))
928 device_probe_and_attach(child);
930 if (TAILQ_FIRST(&idev->id_configs))
931 isa_claim_resources(dev, child);
934 free(children, M_TEMP);
938 isa_set_resource(device_t dev, device_t child, int type, int rid,
939 rman_res_t start, rman_res_t count)
941 struct isa_device* idev = DEVTOISA(child);
942 struct resource_list *rl = &idev->id_resources;
944 if (type != SYS_RES_IOPORT && type != SYS_RES_MEMORY
945 && type != SYS_RES_IRQ && type != SYS_RES_DRQ)
949 if (type == SYS_RES_IOPORT && rid >= ISA_NPORT)
951 if (type == SYS_RES_MEMORY && rid >= ISA_NMEM)
953 if (type == SYS_RES_IRQ && rid >= ISA_NIRQ)
955 if (type == SYS_RES_DRQ && rid >= ISA_NDRQ)
958 resource_list_add(rl, type, rid, start, start + count - 1, count);
963 static struct resource_list *
964 isa_get_resource_list (device_t dev, device_t child)
966 struct isa_device* idev = DEVTOISA(child);
967 struct resource_list *rl = &idev->id_resources;
976 isa_add_config(device_t dev, device_t child, int priority,
977 struct isa_config *config)
979 struct isa_device* idev = DEVTOISA(child);
980 struct isa_config_entry *newice, *ice;
982 newice = malloc(sizeof *ice, M_DEVBUF, M_NOWAIT);
986 newice->ice_priority = priority;
987 newice->ice_config = *config;
989 TAILQ_FOREACH(ice, &idev->id_configs, ice_link) {
990 if (ice->ice_priority > priority)
994 TAILQ_INSERT_BEFORE(ice, newice, ice_link);
996 TAILQ_INSERT_TAIL(&idev->id_configs, newice, ice_link);
1002 isa_set_config_callback(device_t dev, device_t child, isa_config_cb *fn,
1005 struct isa_device* idev = DEVTOISA(child);
1007 idev->id_config_cb = fn;
1008 idev->id_config_arg = arg;
1012 isa_pnp_probe(device_t dev, device_t child, struct isa_pnp_id *ids)
1014 struct isa_device* idev = DEVTOISA(child);
1016 if (!idev->id_vendorid)
1019 while (ids && ids->ip_id) {
1021 * Really ought to support >1 compat id per device.
1023 if (idev->id_logicalid == ids->ip_id
1024 || idev->id_compatid == ids->ip_id) {
1026 device_set_desc(child, ids->ip_desc);
1036 isa_child_pnpinfo(device_t bus, device_t child, struct sbuf *sb)
1038 struct isa_device *idev = DEVTOISA(child);
1040 if (idev->id_vendorid)
1041 sbuf_printf(sb, "pnpid=%s",
1042 pnp_eisaformat(idev->id_vendorid));
1047 isa_child_location(device_t bus, device_t child, struct sbuf *sb)
1050 /* id_pnphandle isn't there yet */
1051 struct isa_device *idev = DEVTOISA(child);
1053 if (idev->id_vendorid)
1054 sbuf_printf(sbuf, "pnphandle=%d", idev->id_pnphandle);
1059 static device_method_t isa_methods[] = {
1060 /* Device interface */
1061 DEVMETHOD(device_probe, isa_probe),
1062 DEVMETHOD(device_attach, isa_attach),
1063 DEVMETHOD(device_detach, bus_generic_detach),
1064 DEVMETHOD(device_shutdown, bus_generic_shutdown),
1065 DEVMETHOD(device_suspend, bus_generic_suspend),
1066 DEVMETHOD(device_resume, bus_generic_resume),
1069 DEVMETHOD(bus_add_child, isa_add_child),
1070 DEVMETHOD(bus_print_child, isa_print_child),
1071 DEVMETHOD(bus_probe_nomatch, isa_probe_nomatch),
1072 DEVMETHOD(bus_read_ivar, isa_read_ivar),
1073 DEVMETHOD(bus_write_ivar, isa_write_ivar),
1074 DEVMETHOD(bus_child_detached, isa_child_detached),
1075 DEVMETHOD(bus_driver_added, isa_driver_added),
1076 DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
1077 DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
1079 DEVMETHOD(bus_get_resource_list,isa_get_resource_list),
1080 DEVMETHOD(bus_alloc_resource, isa_alloc_resource),
1081 DEVMETHOD(bus_release_resource, isa_release_resource),
1082 DEVMETHOD(bus_set_resource, isa_set_resource),
1083 DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource),
1084 DEVMETHOD(bus_delete_resource, bus_generic_rl_delete_resource),
1085 DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
1086 DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
1087 DEVMETHOD(bus_child_pnpinfo, isa_child_pnpinfo),
1088 DEVMETHOD(bus_child_location, isa_child_location),
1089 DEVMETHOD(bus_hinted_child, isa_hinted_child),
1090 DEVMETHOD(bus_hint_device_unit, isa_hint_device_unit),
1093 DEVMETHOD(isa_add_config, isa_add_config),
1094 DEVMETHOD(isa_set_config_callback, isa_set_config_callback),
1095 DEVMETHOD(isa_pnp_probe, isa_pnp_probe),
1100 DEFINE_CLASS_0(isa, isa_driver, isa_methods, 0);
1103 * ISA can be attached to a PCI-ISA bridge, or other locations on some
1106 DRIVER_MODULE(isa, isab, isa_driver, 0, 0);
1107 DRIVER_MODULE(isa, eisab, isa_driver, 0, 0);
1108 MODULE_VERSION(isa, 1);
1111 * Code common to ISA bridges.
1115 isab_attach(device_t dev)
1119 child = device_add_child(dev, "isa", 0);
1121 return (bus_generic_attach(dev));
1126 pnp_eisaformat(uint32_t id)
1129 static char idbuf[8];
1130 const char hextoascii[] = "0123456789abcdef";
1133 data = (uint8_t *)&id;
1134 idbuf[0] = '@' + ((data[0] & 0x7c) >> 2);
1135 idbuf[1] = '@' + (((data[0] & 0x3) << 3) + ((data[1] & 0xe0) >> 5));
1136 idbuf[2] = '@' + (data[1] & 0x1f);
1137 idbuf[3] = hextoascii[(data[2] >> 4)];
1138 idbuf[4] = hextoascii[(data[2] & 0xf)];
1139 idbuf[5] = hextoascii[(data[3] >> 4)];
1140 idbuf[6] = hextoascii[(data[3] & 0xf)];