1 /* $NetBSD: pcib.c,v 1.12 2009/03/14 15:36:11 dsl Exp $ */
4 * Copyright (c) 1996, 1998 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
31 * from: i386/pci/pcib.c,v 1.12
34 #include <sys/cdefs.h>
35 __KERNEL_RCSID(0, "$NetBSD: pcib.c,v 1.12 2009/03/14 15:36:11 dsl Exp $");
37 #include <sys/param.h>
38 #include <sys/systm.h>
39 #include <sys/device.h>
41 #include <machine/bus.h>
43 #include <dev/isa/isavar.h>
45 #include <dev/pci/pcivar.h>
46 #include <dev/pci/pcireg.h>
48 #include <dev/pci/pcidevs.h>
52 int pcibmatch(struct device
*, struct cfdata
*, void *);
53 void pcibattach(struct device
*, struct device
*, void *);
55 CFATTACH_DECL(pcib
, sizeof(struct device
),
56 pcibmatch
, pcibattach
, NULL
, NULL
);
58 void pcib_callback(struct device
*);
61 pcibmatch(struct device
*parent
, struct cfdata
*match
, void *aux
)
63 struct pci_attach_args
*pa
= aux
;
66 * Match tested PCI-ISA bridges.
68 switch (PCI_VENDOR(pa
->pa_id
)) {
69 case PCI_VENDOR_WINBOND
:
70 switch (PCI_PRODUCT(pa
->pa_id
)) {
71 case PCI_PRODUCT_WINBOND_W83C553F_0
:
76 case PCI_VENDOR_SYMPHONY
:
77 switch (PCI_PRODUCT(pa
->pa_id
)) {
78 case PCI_PRODUCT_SYMPHONY_83C553
:
88 pcibattach(struct device
*parent
, struct device
*self
, void *aux
)
90 struct pci_attach_args
*pa
= aux
;
96 * Just print out a description and set the ISA bus
99 pci_devinfo(pa
->pa_id
, pa
->pa_class
, 0, devinfo
, sizeof(devinfo
));
100 printf("%s: %s (rev. 0x%02x)\n", self
->dv_xname
, devinfo
,
101 PCI_REVISION(pa
->pa_class
));
103 /* Set the ISA bus callback */
104 config_defer(self
, pcib_callback
);
108 pcib_callback(struct device
*self
)
110 struct isabus_attach_args iba
;
113 * Attach the ISA bus behind this bridge.
115 memset(&iba
, 0, sizeof(iba
));
116 iba
.iba_iot
= &isa_io_bs_tag
;
117 iba
.iba_memt
= &isa_mem_bs_tag
;
119 iba
.iba_dmat
= &isa_bus_dma_tag
;
121 config_found_ia(self
, "isabus", &iba
, isabusprint
);