* 4. Modifications may be freely made to this file if the above conditions
* are met.
*
- * $Id: aic7870.c,v 1.1.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>
#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,
{
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
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;
ahcattach(ahc);
ahc->sc_ih = pci_map_int(pa->pa_tag, PCI_IPL_BIO, ahcintr, ahc);
-}
+}