diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-12-14 06:35:35 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-12-14 06:35:35 +0000 |
commit | 4054e31c915f4f0dccb683136ebe06cb16297e52 (patch) | |
tree | 06229ca8011afd513f1348eaf1ba7f9894cc5d93 | |
parent | c09501e3eeee6de4d62b516c7eb26287e4978ebc (diff) |
from netbsd:
Don't use the softc at probe time on pci devices because it has not been
allocated yet
-rw-r--r-- | sys/dev/pci/aic7870.c | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/sys/dev/pci/aic7870.c b/sys/dev/pci/aic7870.c index 17f8e551eea..e07e00a3a33 100644 --- a/sys/dev/pci/aic7870.c +++ b/sys/dev/pci/aic7870.c @@ -19,7 +19,7 @@ * 4. Modifications may be freely made to this file if the above conditions * are met. * - * $Id: aic7870.c,v 1.1 1995/10/18 08:52:39 deraadt Exp $ + * $Id: aic7870.c,v 1.2 1995/12/14 06:35:34 deraadt Exp $ */ #include <sys/param.h> @@ -33,16 +33,17 @@ #include <dev/pci/pcireg.h> #include <dev/pci/pcivar.h> -#include <dev/ic/aic7xxxvar.h> +#include <dev/pci/pcidevs.h> +#include <dev/ic/aic7xxxvar.h> -#define PCI_BASEADR0 PCI_MAP_REG_START -#define PCI_DEVICE_ID_ADAPTEC_2940 0x71789004ul -#define PCI_DEVICE_ID_ADAPTEC_AIC7870 0x70789004ul +#define PCI_BASEADR0 PCI_MAP_REG_START +#define PCI_VENDORID(x) ((x) & 0xFFFF) +#define PCI_CHIPID(x) (((x) >> 16) & 0xFFFF) -static int aic7870_probe(); -static void aic7870_attach(); +static int aic7870_probe __P((struct device *, void *, void *)); +static void aic7870_attach __P((struct device *, struct device *, void *)); struct cfdriver ahccd = { NULL, "ahc", aic7870_probe, aic7870_attach, DV_DULL, @@ -59,11 +60,17 @@ aic7870_probe(parent, match, aux) { struct pci_attach_args *pa = aux; - if (pa->pa_id != PCI_DEVICE_ID_ADAPTEC_2940 && - pa->pa_id != PCI_DEVICE_ID_ADAPTEC_AIC7870) - return (0); - - return (1); + if (PCI_VENDORID(pa->pa_id) != PCI_VENDOR_ADP) + return 0; + + switch (PCI_CHIPID(pa->pa_id)) { + case PCI_PRODUCT_ADP_AIC7870: + case PCI_PRODUCT_ADP_AIC2940: + case PCI_PRODUCT_ADP_AIC2940U: + return 1; + default: + return 0; + } } void @@ -75,14 +82,16 @@ aic7870_attach(parent, self, aux) struct ahc_softc *ahc = (void *)self; int iobase; - switch (pa->pa_id) { - case PCI_DEVICE_ID_ADAPTEC_2940: - ahc->type = AHC_294; - break; - case PCI_DEVICE_ID_ADAPTEC_AIC7870: + switch (PCI_CHIPID(pa->pa_id)) { + case PCI_PRODUCT_ADP_AIC7870: ahc->type = AHC_AIC7870; - break; - } + break; + + case PCI_PRODUCT_ADP_AIC2940: + case PCI_PRODUCT_ADP_AIC2940U: + ahc->type = AHC_294; + break; + } if (pci_map_io(pa->pa_tag, PCI_BASEADR0, &iobase)) return; @@ -98,4 +107,4 @@ aic7870_attach(parent, self, aux) ahcattach(ahc); ahc->sc_ih = pci_map_int(pa->pa_tag, PCI_IPL_BIO, ahcintr, ahc); -} +} |