Deleted Added
full compact
isa_pci.c (69783) isa_pci.c (69792)
1/*-
2 * Copyright (c) 1994,1995 Stefan Esser, Wolfgang StanglMeier
3 * Copyright (c) 2000 Michael Smith <msmith@freebsd.org>
4 * Copyright (c) 2000 BSDi
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
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.
15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 *
1/*-
2 * Copyright (c) 1994,1995 Stefan Esser, Wolfgang StanglMeier
3 * Copyright (c) 2000 Michael Smith <msmith@freebsd.org>
4 * Copyright (c) 2000 BSDi
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
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.
15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 *
30 * $FreeBSD: head/sys/dev/pci/isa_pci.c 69783 2000-12-08 22:11:23Z msmith $
30 * $FreeBSD: head/sys/dev/pci/isa_pci.c 69792 2000-12-09 09:15:38Z msmith $
31 */
32
33/*
34 * PCI:ISA bridge support
35 */
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/kernel.h>
40#include <sys/bus.h>
41
42#include <pci/pcivar.h>
43#include <pci/pcireg.h>
44
45static int isab_probe(device_t dev);
46static int isab_attach(device_t dev);
47
48static device_method_t isab_methods[] = {
49 /* Device interface */
50 DEVMETHOD(device_probe, isab_probe),
51 DEVMETHOD(device_attach, isab_attach),
52 DEVMETHOD(device_shutdown, bus_generic_shutdown),
53 DEVMETHOD(device_suspend, bus_generic_suspend),
54 DEVMETHOD(device_resume, bus_generic_resume),
55
56 /* Bus interface */
57 DEVMETHOD(bus_print_child, bus_generic_print_child),
58 DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
59 DEVMETHOD(bus_release_resource, bus_generic_release_resource),
60 DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
61 DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
62 DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
63 DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
64
65 { 0, 0 }
66};
67
68static driver_t isab_driver = {
69 "isab",
70 isab_methods,
71 0,
72};
73
74static devclass_t isab_devclass;
75
76DRIVER_MODULE(isab, pci, isab_driver, isab_devclass, 0, 0);
77
78/*
79 * XXX we need to add a quirk list here for bridges that don't correctly
80 * report themselves.
81 */
82static int
83isab_probe(device_t dev)
84{
85 int matched = 0;
86
87 /*
88 * Try for a generic match based on class/subclass.
89 */
90 if ((pci_get_class(dev) == PCIC_BRIDGE) &&
91 (pci_get_subclass(dev) == PCIS_BRIDGE_ISA))
92 matched = 1;
93 /*
94 * Some bridges don't report the ISA bus correctly.
95 * (Note that some of the devices listed here probably do, we will
96 * kvetch about this below and request updates.)
97 */
98 switch (pci_get_devid(dev)) {
99 case 0x04848086: /* Intel 82378ZB/82378IB */
100 case 0x122e8086: /* Intel 82371FB */
101 case 0x70008086: /* Intel 82371SB */
31 */
32
33/*
34 * PCI:ISA bridge support
35 */
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/kernel.h>
40#include <sys/bus.h>
41
42#include <pci/pcivar.h>
43#include <pci/pcireg.h>
44
45static int isab_probe(device_t dev);
46static int isab_attach(device_t dev);
47
48static device_method_t isab_methods[] = {
49 /* Device interface */
50 DEVMETHOD(device_probe, isab_probe),
51 DEVMETHOD(device_attach, isab_attach),
52 DEVMETHOD(device_shutdown, bus_generic_shutdown),
53 DEVMETHOD(device_suspend, bus_generic_suspend),
54 DEVMETHOD(device_resume, bus_generic_resume),
55
56 /* Bus interface */
57 DEVMETHOD(bus_print_child, bus_generic_print_child),
58 DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
59 DEVMETHOD(bus_release_resource, bus_generic_release_resource),
60 DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
61 DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
62 DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
63 DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
64
65 { 0, 0 }
66};
67
68static driver_t isab_driver = {
69 "isab",
70 isab_methods,
71 0,
72};
73
74static devclass_t isab_devclass;
75
76DRIVER_MODULE(isab, pci, isab_driver, isab_devclass, 0, 0);
77
78/*
79 * XXX we need to add a quirk list here for bridges that don't correctly
80 * report themselves.
81 */
82static int
83isab_probe(device_t dev)
84{
85 int matched = 0;
86
87 /*
88 * Try for a generic match based on class/subclass.
89 */
90 if ((pci_get_class(dev) == PCIC_BRIDGE) &&
91 (pci_get_subclass(dev) == PCIS_BRIDGE_ISA))
92 matched = 1;
93 /*
94 * Some bridges don't report the ISA bus correctly.
95 * (Note that some of the devices listed here probably do, we will
96 * kvetch about this below and request updates.)
97 */
98 switch (pci_get_devid(dev)) {
99 case 0x04848086: /* Intel 82378ZB/82378IB */
100 case 0x122e8086: /* Intel 82371FB */
101 case 0x70008086: /* Intel 82371SB */
102 case 0x71108086: /* Intel 82371AB */
103 case 0x71988086: /* Intel 82443MX */
104 case 0x24108086: /* Intel 82801AA (ICH) */
105 case 0x24208086: /* Intel 82801AB (ICH0) */
106 case 0x24408086: /* Intel 82801BA (ICH2) */
107 case 0x00061004: /* VLSI 82C593 */
108 case 0x05861106: /* VIA 82C586 */
109 case 0x05961106: /* VIA 82C596 PCI-ISA */
102 case 0x71988086: /* Intel 82443MX */
103 case 0x24108086: /* Intel 82801AA (ICH) */
104 case 0x24208086: /* Intel 82801AB (ICH0) */
105 case 0x24408086: /* Intel 82801BA (ICH2) */
106 case 0x00061004: /* VLSI 82C593 */
107 case 0x05861106: /* VIA 82C586 */
108 case 0x05961106: /* VIA 82C596 PCI-ISA */
110 case 0x06861106: /* VIA 82C686 PCI-ISA */
111 /* AcerLabs -- vendor 0x10b9 */
112 /* Funny : The datasheet told me vendor id is "10b8",sub-vendor */
113 /* id is '10b9" but the register always shows "10b9". -Foxfair */
114 case 0x153310b9: /* AcerLabs M1533 */
115 case 0x154310b9: /* AcerLabs M1543 */
116 case 0x00081039: /* SiS 85c503 */
117 case 0x00001078: /* Cyrix Cx5510 */
118 case 0x01001078: /* Cyrix Cx5530 */
119 case 0xc7001045: /* OPTi 82C700 (FireStar) */
120 case 0x00011033: /* NEC 0001 (C-bus) */
121 case 0x002c1033: /* NEC 002C (C-bus) */
122 case 0x003b1033: /* NEC 003B (C-bus) */
123 case 0x886a1060: /* UMC UM8886 ISA */
124 case 0x02001166: /* ServerWorks IB6566 PCI */
125 matched = 1;
126 /*
127 * Report redundant matches (debugging)
128 */
129 if ((pci_get_class(dev) == PCIC_BRIDGE) &&
130 (pci_get_subclass(dev) == PCIS_BRIDGE_ISA)) {
131 printf("** REDUNDANT ISA BRIDGE MATCH FOR DEVICE 0x%08x\n", pci_get_devid(dev));
132 printf("** Please report to msmith@freebsd.org\n");
133 }
134 break;
135
136 default:
137 break;
138 }
139
140 if (matched) {
141 device_set_desc(dev, "PCI-ISA bridge");
142 return(-10000);
143 }
144 return(ENXIO);
145}
146
147static int
148isab_attach(device_t dev)
149{
150 device_t child;
151
152 /*
153 * Attach an ISA bus. Note that we can only have one ISA bus.
154 */
155 child = device_add_child(dev, "isa", 0);
156 if (child != NULL)
157 return(bus_generic_attach(dev));
158
159 return(0);
160}
161
109 /* AcerLabs -- vendor 0x10b9 */
110 /* Funny : The datasheet told me vendor id is "10b8",sub-vendor */
111 /* id is '10b9" but the register always shows "10b9". -Foxfair */
112 case 0x153310b9: /* AcerLabs M1533 */
113 case 0x154310b9: /* AcerLabs M1543 */
114 case 0x00081039: /* SiS 85c503 */
115 case 0x00001078: /* Cyrix Cx5510 */
116 case 0x01001078: /* Cyrix Cx5530 */
117 case 0xc7001045: /* OPTi 82C700 (FireStar) */
118 case 0x00011033: /* NEC 0001 (C-bus) */
119 case 0x002c1033: /* NEC 002C (C-bus) */
120 case 0x003b1033: /* NEC 003B (C-bus) */
121 case 0x886a1060: /* UMC UM8886 ISA */
122 case 0x02001166: /* ServerWorks IB6566 PCI */
123 matched = 1;
124 /*
125 * Report redundant matches (debugging)
126 */
127 if ((pci_get_class(dev) == PCIC_BRIDGE) &&
128 (pci_get_subclass(dev) == PCIS_BRIDGE_ISA)) {
129 printf("** REDUNDANT ISA BRIDGE MATCH FOR DEVICE 0x%08x\n", pci_get_devid(dev));
130 printf("** Please report to msmith@freebsd.org\n");
131 }
132 break;
133
134 default:
135 break;
136 }
137
138 if (matched) {
139 device_set_desc(dev, "PCI-ISA bridge");
140 return(-10000);
141 }
142 return(ENXIO);
143}
144
145static int
146isab_attach(device_t dev)
147{
148 device_t child;
149
150 /*
151 * Attach an ISA bus. Note that we can only have one ISA bus.
152 */
153 child = device_add_child(dev, "isa", 0);
154 if (child != NULL)
155 return(bus_generic_attach(dev));
156
157 return(0);
158}
159