1998-08-15 07:02:31 +04:00
|
|
|
/* $NetBSD: pci.c,v 1.39 1998/08/15 03:02:46 mycroft Exp $ */
|
1996-02-28 04:44:41 +03:00
|
|
|
|
|
|
|
/*
|
1998-05-31 10:05:28 +04:00
|
|
|
* Copyright (c) 1995, 1996, 1997, 1998
|
1997-04-11 03:12:16 +04:00
|
|
|
* Christopher G. Demetriou. All rights reserved.
|
1998-08-15 07:02:31 +04:00
|
|
|
* Copyright (c) 1994 Charles M. Hannum. All rights reserved.
|
1996-02-28 04:44:41 +03:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
1998-08-15 07:02:31 +04:00
|
|
|
* This product includes software developed by Charles M. Hannum.
|
1996-02-28 04:44:41 +03:00
|
|
|
* 4. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* PCI bus autoconfiguration.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/device.h>
|
|
|
|
|
|
|
|
#include <dev/pci/pcireg.h>
|
|
|
|
#include <dev/pci/pcivar.h>
|
1998-03-28 05:24:04 +03:00
|
|
|
#include <dev/pci/pcidevs.h>
|
1996-02-28 04:44:41 +03:00
|
|
|
|
1996-12-05 04:25:23 +03:00
|
|
|
int pcimatch __P((struct device *, struct cfdata *, void *));
|
1996-02-28 04:44:41 +03:00
|
|
|
void pciattach __P((struct device *, struct device *, void *));
|
|
|
|
|
1998-04-17 22:40:31 +04:00
|
|
|
struct pci_softc {
|
|
|
|
struct device sc_dev;
|
|
|
|
bus_space_tag_t sc_iot, sc_memt;
|
|
|
|
bus_dma_tag_t sc_dmat;
|
|
|
|
pci_chipset_tag_t sc_pc;
|
|
|
|
int sc_bus, sc_maxndevs;
|
|
|
|
u_int sc_intrswiz;
|
|
|
|
pcitag_t sc_intrtag;
|
|
|
|
int sc_flags;
|
|
|
|
};
|
|
|
|
|
1996-03-17 03:53:54 +03:00
|
|
|
struct cfattach pci_ca = {
|
1998-04-17 22:40:31 +04:00
|
|
|
sizeof(struct pci_softc), pcimatch, pciattach
|
1996-03-17 03:53:54 +03:00
|
|
|
};
|
|
|
|
|
1998-04-17 22:40:31 +04:00
|
|
|
void pci_probe_bus __P((struct device *));
|
1996-08-28 01:53:46 +04:00
|
|
|
int pciprint __P((void *, const char *));
|
1996-12-05 04:25:23 +03:00
|
|
|
int pcisubmatch __P((struct device *, struct cfdata *, void *));
|
1996-02-28 04:44:41 +03:00
|
|
|
|
1996-11-24 00:58:16 +03:00
|
|
|
/*
|
1998-06-09 22:48:41 +04:00
|
|
|
* Important note about PCI-ISA bridges:
|
|
|
|
*
|
|
|
|
* Callbacks are used to configure these devices so that ISA/EISA bridges
|
|
|
|
* can attach their child busses after PCI configuration is done.
|
1996-11-24 00:58:16 +03:00
|
|
|
*
|
|
|
|
* This works because:
|
|
|
|
* (1) there can be at most one ISA/EISA bridge per PCI bus, and
|
|
|
|
* (2) any ISA/EISA bridges must be attached to primary PCI
|
|
|
|
* busses (i.e. bus zero).
|
|
|
|
*
|
|
|
|
* That boils down to: there can only be one of these outstanding
|
|
|
|
* at a time, it is cleared when configuring PCI bus 0 before any
|
|
|
|
* subdevices have been found, and it is run after all subdevices
|
|
|
|
* of PCI bus 0 have been found.
|
|
|
|
*
|
|
|
|
* This is needed because there are some (legacy) PCI devices which
|
|
|
|
* can show up as ISA/EISA devices as well (the prime example of which
|
|
|
|
* are VGA controllers). If you attach ISA from a PCI-ISA/EISA bridge,
|
|
|
|
* and the bridge is seen before the video board is, the board can show
|
|
|
|
* up as an ISA device, and that can (bogusly) complicate the PCI device's
|
|
|
|
* attach code, or make the PCI device not be properly attached at all.
|
1998-06-09 22:48:41 +04:00
|
|
|
*
|
|
|
|
* We use the generic config_defer() facility to achieve this.
|
1996-11-24 00:58:16 +03:00
|
|
|
*/
|
|
|
|
|
1996-02-28 04:44:41 +03:00
|
|
|
int
|
1996-12-05 04:25:23 +03:00
|
|
|
pcimatch(parent, cf, aux)
|
1996-02-28 04:44:41 +03:00
|
|
|
struct device *parent;
|
1996-12-05 04:25:23 +03:00
|
|
|
struct cfdata *cf;
|
|
|
|
void *aux;
|
1996-02-28 04:44:41 +03:00
|
|
|
{
|
|
|
|
struct pcibus_attach_args *pba = aux;
|
|
|
|
|
|
|
|
if (strcmp(pba->pba_busname, cf->cf_driver->cd_name))
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
/* Check the locators */
|
1996-03-14 05:35:32 +03:00
|
|
|
if (cf->pcibuscf_bus != PCIBUS_UNK_BUS &&
|
|
|
|
cf->pcibuscf_bus != pba->pba_bus)
|
1996-02-28 04:44:41 +03:00
|
|
|
return (0);
|
|
|
|
|
|
|
|
/* sanity */
|
|
|
|
if (pba->pba_bus < 0 || pba->pba_bus > 255)
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* XXX check other (hardware?) indicators
|
|
|
|
*/
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1998-04-17 22:40:31 +04:00
|
|
|
pci_probe_bus(self)
|
|
|
|
struct device *self;
|
1996-02-28 04:44:41 +03:00
|
|
|
{
|
1998-04-17 22:40:31 +04:00
|
|
|
struct pci_softc *sc = (struct pci_softc *)self;
|
1996-10-22 02:56:24 +04:00
|
|
|
bus_space_tag_t iot, memt;
|
modify these to provide a new, better-specified PCI interface
(soon to be documented on mailing lists; eventually in section 9 manual
pages), most importantly:
(1) support interrupt pin swizzling on non-i386 systems with
PCI-PCI bridges (per PPB spec; done, but meaningless, on i386).
(2) provide pci_{io,mem}_find(), to determine what I/O or memory
space is described by a given PCI configuration space
mapping register.
(3) provide pci_intr_map(), pci_intr_string(), and
pci_intr_{,dis}establish() to manipulate and print info about
PCI interrupts.
(4) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.
1996-03-27 07:08:24 +03:00
|
|
|
pci_chipset_tag_t pc;
|
1998-05-31 10:05:28 +04:00
|
|
|
const struct pci_quirkdata *qd;
|
modify these to provide a new, better-specified PCI interface
(soon to be documented on mailing lists; eventually in section 9 manual
pages), most importantly:
(1) support interrupt pin swizzling on non-i386 systems with
PCI-PCI bridges (per PPB spec; done, but meaningless, on i386).
(2) provide pci_{io,mem}_find(), to determine what I/O or memory
space is described by a given PCI configuration space
mapping register.
(3) provide pci_intr_map(), pci_intr_string(), and
pci_intr_{,dis}establish() to manipulate and print info about
PCI interrupts.
(4) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.
1996-03-27 07:08:24 +03:00
|
|
|
int bus, device, maxndevs, function, nfunctions;
|
1998-01-31 03:37:39 +03:00
|
|
|
|
1998-04-17 22:40:31 +04:00
|
|
|
iot = sc->sc_iot;
|
|
|
|
memt = sc->sc_memt;
|
|
|
|
pc = sc->sc_pc;
|
|
|
|
bus = sc->sc_bus;
|
|
|
|
maxndevs = sc->sc_maxndevs;
|
modify these to provide a new, better-specified PCI interface
(soon to be documented on mailing lists; eventually in section 9 manual
pages), most importantly:
(1) support interrupt pin swizzling on non-i386 systems with
PCI-PCI bridges (per PPB spec; done, but meaningless, on i386).
(2) provide pci_{io,mem}_find(), to determine what I/O or memory
space is described by a given PCI configuration space
mapping register.
(3) provide pci_intr_map(), pci_intr_string(), and
pci_intr_{,dis}establish() to manipulate and print info about
PCI interrupts.
(4) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.
1996-03-27 07:08:24 +03:00
|
|
|
|
|
|
|
for (device = 0; device < maxndevs; device++) {
|
1996-02-28 04:44:41 +03:00
|
|
|
pcitag_t tag;
|
1997-04-11 03:12:16 +04:00
|
|
|
pcireg_t id, class, intr, bhlcr, csr;
|
1996-02-28 04:44:41 +03:00
|
|
|
struct pci_attach_args pa;
|
1996-05-03 21:33:49 +04:00
|
|
|
int pin;
|
1996-02-28 04:44:41 +03:00
|
|
|
|
modify these to provide a new, better-specified PCI interface
(soon to be documented on mailing lists; eventually in section 9 manual
pages), most importantly:
(1) support interrupt pin swizzling on non-i386 systems with
PCI-PCI bridges (per PPB spec; done, but meaningless, on i386).
(2) provide pci_{io,mem}_find(), to determine what I/O or memory
space is described by a given PCI configuration space
mapping register.
(3) provide pci_intr_map(), pci_intr_string(), and
pci_intr_{,dis}establish() to manipulate and print info about
PCI interrupts.
(4) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.
1996-03-27 07:08:24 +03:00
|
|
|
tag = pci_make_tag(pc, bus, device, 0);
|
|
|
|
id = pci_conf_read(pc, tag, PCI_ID_REG);
|
1998-03-20 22:56:19 +03:00
|
|
|
|
|
|
|
/* Invalid vendor ID value? */
|
1998-03-28 05:24:04 +03:00
|
|
|
if (PCI_VENDOR(id) == PCI_VENDOR_INVALID)
|
1998-03-20 22:56:19 +03:00
|
|
|
continue;
|
|
|
|
/* XXX Not invalid, but we've done this ~forever. */
|
|
|
|
if (PCI_VENDOR(id) == 0)
|
1996-02-28 04:44:41 +03:00
|
|
|
continue;
|
|
|
|
|
1998-05-31 10:05:28 +04:00
|
|
|
qd = pci_lookup_quirkdata(PCI_VENDOR(id), PCI_PRODUCT(id));
|
|
|
|
|
modify these to provide a new, better-specified PCI interface
(soon to be documented on mailing lists; eventually in section 9 manual
pages), most importantly:
(1) support interrupt pin swizzling on non-i386 systems with
PCI-PCI bridges (per PPB spec; done, but meaningless, on i386).
(2) provide pci_{io,mem}_find(), to determine what I/O or memory
space is described by a given PCI configuration space
mapping register.
(3) provide pci_intr_map(), pci_intr_string(), and
pci_intr_{,dis}establish() to manipulate and print info about
PCI interrupts.
(4) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.
1996-03-27 07:08:24 +03:00
|
|
|
bhlcr = pci_conf_read(pc, tag, PCI_BHLC_REG);
|
1998-05-31 10:05:28 +04:00
|
|
|
if (PCI_HDRTYPE_MULTIFN(bhlcr) ||
|
|
|
|
(qd != NULL &&
|
|
|
|
(qd->quirks & PCI_QUIRK_MULTIFUNCTION) != 0))
|
|
|
|
nfunctions = 8;
|
|
|
|
else
|
|
|
|
nfunctions = 1;
|
1996-02-28 04:44:41 +03:00
|
|
|
|
|
|
|
for (function = 0; function < nfunctions; function++) {
|
modify these to provide a new, better-specified PCI interface
(soon to be documented on mailing lists; eventually in section 9 manual
pages), most importantly:
(1) support interrupt pin swizzling on non-i386 systems with
PCI-PCI bridges (per PPB spec; done, but meaningless, on i386).
(2) provide pci_{io,mem}_find(), to determine what I/O or memory
space is described by a given PCI configuration space
mapping register.
(3) provide pci_intr_map(), pci_intr_string(), and
pci_intr_{,dis}establish() to manipulate and print info about
PCI interrupts.
(4) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.
1996-03-27 07:08:24 +03:00
|
|
|
tag = pci_make_tag(pc, bus, device, function);
|
|
|
|
id = pci_conf_read(pc, tag, PCI_ID_REG);
|
1997-04-11 03:12:16 +04:00
|
|
|
csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
|
modify these to provide a new, better-specified PCI interface
(soon to be documented on mailing lists; eventually in section 9 manual
pages), most importantly:
(1) support interrupt pin swizzling on non-i386 systems with
PCI-PCI bridges (per PPB spec; done, but meaningless, on i386).
(2) provide pci_{io,mem}_find(), to determine what I/O or memory
space is described by a given PCI configuration space
mapping register.
(3) provide pci_intr_map(), pci_intr_string(), and
pci_intr_{,dis}establish() to manipulate and print info about
PCI interrupts.
(4) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.
1996-03-27 07:08:24 +03:00
|
|
|
class = pci_conf_read(pc, tag, PCI_CLASS_REG);
|
|
|
|
intr = pci_conf_read(pc, tag, PCI_INTERRUPT_REG);
|
1996-02-28 04:44:41 +03:00
|
|
|
|
1998-03-20 22:56:19 +03:00
|
|
|
/* Invalid vendor ID value? */
|
1998-03-28 05:24:04 +03:00
|
|
|
if (PCI_VENDOR(id) == PCI_VENDOR_INVALID)
|
1998-03-20 22:56:19 +03:00
|
|
|
continue;
|
|
|
|
/* XXX Not invalid, but we've done this ~forever. */
|
|
|
|
if (PCI_VENDOR(id) == 0)
|
|
|
|
continue;
|
|
|
|
|
1996-10-22 02:56:24 +04:00
|
|
|
pa.pa_iot = iot;
|
|
|
|
pa.pa_memt = memt;
|
1998-04-17 22:40:31 +04:00
|
|
|
pa.pa_dmat = sc->sc_dmat;
|
modify these to provide a new, better-specified PCI interface
(soon to be documented on mailing lists; eventually in section 9 manual
pages), most importantly:
(1) support interrupt pin swizzling on non-i386 systems with
PCI-PCI bridges (per PPB spec; done, but meaningless, on i386).
(2) provide pci_{io,mem}_find(), to determine what I/O or memory
space is described by a given PCI configuration space
mapping register.
(3) provide pci_intr_map(), pci_intr_string(), and
pci_intr_{,dis}establish() to manipulate and print info about
PCI interrupts.
(4) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.
1996-03-27 07:08:24 +03:00
|
|
|
pa.pa_pc = pc;
|
1996-02-28 04:44:41 +03:00
|
|
|
pa.pa_device = device;
|
|
|
|
pa.pa_function = function;
|
|
|
|
pa.pa_tag = tag;
|
|
|
|
pa.pa_id = id;
|
|
|
|
pa.pa_class = class;
|
|
|
|
|
1997-04-11 03:12:16 +04:00
|
|
|
/* set up memory and I/O enable flags as appropriate */
|
|
|
|
pa.pa_flags = 0;
|
1998-04-17 22:40:31 +04:00
|
|
|
if ((sc->sc_flags & PCI_FLAGS_IO_ENABLED) &&
|
1997-04-11 03:12:16 +04:00
|
|
|
(csr & PCI_COMMAND_IO_ENABLE))
|
|
|
|
pa.pa_flags |= PCI_FLAGS_IO_ENABLED;
|
1998-04-17 22:40:31 +04:00
|
|
|
if ((sc->sc_flags & PCI_FLAGS_MEM_ENABLED) &&
|
1997-04-11 03:12:16 +04:00
|
|
|
(csr & PCI_COMMAND_MEM_ENABLE))
|
|
|
|
pa.pa_flags |= PCI_FLAGS_MEM_ENABLED;
|
|
|
|
|
modify these to provide a new, better-specified PCI interface
(soon to be documented on mailing lists; eventually in section 9 manual
pages), most importantly:
(1) support interrupt pin swizzling on non-i386 systems with
PCI-PCI bridges (per PPB spec; done, but meaningless, on i386).
(2) provide pci_{io,mem}_find(), to determine what I/O or memory
space is described by a given PCI configuration space
mapping register.
(3) provide pci_intr_map(), pci_intr_string(), and
pci_intr_{,dis}establish() to manipulate and print info about
PCI interrupts.
(4) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.
1996-03-27 07:08:24 +03:00
|
|
|
if (bus == 0) {
|
|
|
|
pa.pa_intrswiz = 0;
|
|
|
|
pa.pa_intrtag = tag;
|
|
|
|
} else {
|
1998-04-17 22:40:31 +04:00
|
|
|
pa.pa_intrswiz = sc->sc_intrswiz + device;
|
|
|
|
pa.pa_intrtag = sc->sc_intrtag;
|
modify these to provide a new, better-specified PCI interface
(soon to be documented on mailing lists; eventually in section 9 manual
pages), most importantly:
(1) support interrupt pin swizzling on non-i386 systems with
PCI-PCI bridges (per PPB spec; done, but meaningless, on i386).
(2) provide pci_{io,mem}_find(), to determine what I/O or memory
space is described by a given PCI configuration space
mapping register.
(3) provide pci_intr_map(), pci_intr_string(), and
pci_intr_{,dis}establish() to manipulate and print info about
PCI interrupts.
(4) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.
1996-03-27 07:08:24 +03:00
|
|
|
}
|
|
|
|
pin = PCI_INTERRUPT_PIN(intr);
|
|
|
|
if (pin == PCI_INTERRUPT_PIN_NONE) {
|
|
|
|
/* no interrupt */
|
|
|
|
pa.pa_intrpin = 0;
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* swizzle it based on the number of
|
|
|
|
* busses we're behind and our device
|
|
|
|
* number.
|
|
|
|
*/
|
|
|
|
pa.pa_intrpin = /* XXX */
|
|
|
|
((pin + pa.pa_intrswiz - 1) % 4) + 1;
|
|
|
|
}
|
|
|
|
pa.pa_intrline = PCI_INTERRUPT_LINE(intr);
|
|
|
|
|
1996-02-28 04:44:41 +03:00
|
|
|
config_found_sm(self, &pa, pciprint, pcisubmatch);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-04-17 22:40:31 +04:00
|
|
|
void
|
|
|
|
pciattach(parent, self, aux)
|
|
|
|
struct device *parent, *self;
|
|
|
|
void *aux;
|
|
|
|
{
|
|
|
|
struct pcibus_attach_args *pba = aux;
|
|
|
|
struct pci_softc *sc = (struct pci_softc *)self;
|
|
|
|
int io_enabled, mem_enabled;
|
|
|
|
|
|
|
|
pci_attach_hook(parent, self, pba);
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
io_enabled = (pba->pba_flags & PCI_FLAGS_IO_ENABLED);
|
|
|
|
mem_enabled = (pba->pba_flags & PCI_FLAGS_MEM_ENABLED);
|
|
|
|
|
|
|
|
if (io_enabled == 0 && mem_enabled == 0) {
|
|
|
|
printf("%s: no spaces enabled!\n", self->dv_xname);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("%s: ", self->dv_xname);
|
|
|
|
if (io_enabled)
|
|
|
|
printf("i/o enabled");
|
|
|
|
if (mem_enabled) {
|
|
|
|
if (io_enabled)
|
|
|
|
printf(", ");
|
|
|
|
printf("memory enabled");
|
|
|
|
}
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
sc->sc_iot = pba->pba_iot;
|
|
|
|
sc->sc_memt = pba->pba_memt;
|
|
|
|
sc->sc_dmat = pba->pba_dmat;
|
|
|
|
sc->sc_pc = pba->pba_pc;
|
|
|
|
sc->sc_bus = pba->pba_bus;
|
|
|
|
sc->sc_maxndevs = pci_bus_maxdevs(pba->pba_pc, pba->pba_bus);
|
|
|
|
sc->sc_intrswiz = pba->pba_intrswiz;
|
|
|
|
sc->sc_intrtag = pba->pba_intrtag;
|
|
|
|
sc->sc_flags = pba->pba_flags;
|
|
|
|
|
|
|
|
pci_probe_bus(self);
|
|
|
|
}
|
|
|
|
|
1996-02-28 04:44:41 +03:00
|
|
|
int
|
|
|
|
pciprint(aux, pnp)
|
|
|
|
void *aux;
|
1996-08-28 01:53:46 +04:00
|
|
|
const char *pnp;
|
1996-02-28 04:44:41 +03:00
|
|
|
{
|
|
|
|
register struct pci_attach_args *pa = aux;
|
|
|
|
char devinfo[256];
|
1998-05-31 10:05:28 +04:00
|
|
|
#if 0
|
|
|
|
const struct pci_quirkdata *qd;
|
|
|
|
#endif
|
1996-02-28 04:44:41 +03:00
|
|
|
|
|
|
|
if (pnp) {
|
|
|
|
pci_devinfo(pa->pa_id, pa->pa_class, 1, devinfo);
|
1996-10-13 05:37:04 +04:00
|
|
|
printf("%s at %s", devinfo, pnp);
|
1996-02-28 04:44:41 +03:00
|
|
|
}
|
1996-10-13 05:37:04 +04:00
|
|
|
printf(" dev %d function %d", pa->pa_device, pa->pa_function);
|
1997-04-11 03:12:16 +04:00
|
|
|
#if 0
|
1998-05-18 21:28:07 +04:00
|
|
|
printf(": ");
|
|
|
|
pci_conf_print(pa->pa_pc, pa->pa_tag, NULL);
|
|
|
|
if (!pnp)
|
|
|
|
pci_devinfo(pa->pa_id, pa->pa_class, 1, devinfo);
|
|
|
|
printf("%s at %s", devinfo, pnp ? pnp : "?");
|
1998-05-31 10:05:28 +04:00
|
|
|
printf(" dev %d function %d (", pa->pa_device, pa->pa_function);
|
|
|
|
#ifdef __i386__
|
|
|
|
printf("tag %#lx, intrtag %#lx, intrswiz %#lx, intrpin %#lx",
|
|
|
|
*(long *)&pa->pa_tag, *(long *)&pa->pa_intrtag,
|
|
|
|
(long)pa->pa_intrswiz, (long)pa->pa_intrpin);
|
|
|
|
#else
|
|
|
|
printf("tag %#lx, intrtag %#lx, intrswiz %#lx, intrpin %#lx",
|
|
|
|
(long)pa->pa_tag, (long)pa->pa_intrtag, (long)pa->pa_intrswiz,
|
|
|
|
(long)pa->pa_intrpin);
|
1998-05-18 21:28:07 +04:00
|
|
|
#endif
|
1998-05-31 10:05:28 +04:00
|
|
|
printf(", i/o %s, mem %s,",
|
|
|
|
pa->pa_flags & PCI_FLAGS_IO_ENABLED ? "on" : "off",
|
|
|
|
pa->pa_flags & PCI_FLAGS_MEM_ENABLED ? "on" : "off");
|
|
|
|
qd = pci_lookup_quirkdata(PCI_VENDOR(pa->pa_id),
|
|
|
|
PCI_PRODUCT(pa->pa_id));
|
|
|
|
if (qd == NULL) {
|
|
|
|
printf(" no quirks");
|
|
|
|
} else {
|
|
|
|
bitmask_snprintf(qd->quirks,
|
|
|
|
"\20\1multifn", devinfo, sizeof (devinfo));
|
|
|
|
printf(" quirks %s", devinfo);
|
|
|
|
}
|
|
|
|
printf(")");
|
1997-04-11 03:12:16 +04:00
|
|
|
#endif
|
1996-02-28 04:44:41 +03:00
|
|
|
return (UNCONF);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
1996-12-05 04:25:23 +03:00
|
|
|
pcisubmatch(parent, cf, aux)
|
1996-02-28 04:44:41 +03:00
|
|
|
struct device *parent;
|
1996-12-05 04:25:23 +03:00
|
|
|
struct cfdata *cf;
|
|
|
|
void *aux;
|
1996-02-28 04:44:41 +03:00
|
|
|
{
|
|
|
|
struct pci_attach_args *pa = aux;
|
|
|
|
|
1996-03-14 05:35:32 +03:00
|
|
|
if (cf->pcicf_dev != PCI_UNK_DEV &&
|
|
|
|
cf->pcicf_dev != pa->pa_device)
|
1996-02-28 04:44:41 +03:00
|
|
|
return 0;
|
1996-03-14 05:35:32 +03:00
|
|
|
if (cf->pcicf_function != PCI_UNK_FUNCTION &&
|
|
|
|
cf->pcicf_function != pa->pa_function)
|
1996-02-28 04:44:41 +03:00
|
|
|
return 0;
|
1996-12-05 04:25:23 +03:00
|
|
|
return ((*cf->cf_attach->ca_match)(parent, cf, aux));
|
1996-02-28 04:44:41 +03:00
|
|
|
}
|