-/* $OpenBSD: puc.c,v 1.16 2010/07/07 21:32:50 sthen Exp $ */
+/* $OpenBSD: puc.c,v 1.17 2010/07/22 17:16:10 pirofti Exp $ */
/* $NetBSD: puc.c,v 1.3 1999/02/06 06:29:54 cgd Exp $ */
/*
{
int i;
-#define checkreg(val, index) \
- (((val) & puc_devices[i].rmask[(index)]) == puc_devices[i].rval[(index)])
-#define pucdevdone(idx) \
- (puc_devices[idx].rval[0] == 0 && puc_devices[idx].rval[1] == 0 \
- && puc_devices[idx].rval[2] == 0 && puc_devices[idx].rval[3] == 0)
-
- for (i = 0; !pucdevdone(i); i++) {
- if (checkreg(vend, PUC_REG_VEND) &&
- checkreg(prod, PUC_REG_PROD) &&
- checkreg(svend, PUC_REG_SVEND) &&
- checkreg(sprod, PUC_REG_SPROD))
- return (&puc_devices[i]);
- }
-
-#undef devdone
-#undef checkreg
+ for (i = 0; !(puc_devs[i].rval[0] == 0 && puc_devs[i].rval[1] == 0 &&
+ puc_devs[i].rval[2] == 0 && puc_devs[i].rval[3] == 0); i++)
+ if ((vend & puc_devs[i].rmask[0]) == puc_devs[i].rval[0] &&
+ (prod & puc_devs[i].rmask[1]) == puc_devs[i].rval[1] &&
+ (svend & puc_devs[i].rmask[2]) == puc_devs[i].rval[2] &&
+ (sprod & puc_devs[i].rmask[3]) == puc_devs[i].rval[3])
+ return (&puc_devs[i]);
return (NULL);
}
-/* $OpenBSD: pucdata.c,v 1.71 2010/07/07 21:32:50 sthen Exp $ */
+/* $OpenBSD: pucdata.c,v 1.72 2010/07/22 17:16:10 pirofti Exp $ */
/* $NetBSD: pucdata.c,v 1.6 1999/07/03 05:55:23 cgd Exp $ */
/*
#include <dev/pci/pcidevs.h>
#include <dev/ic/comreg.h>
-const struct puc_device_description puc_devices[] = {
+const struct puc_device_description puc_devs[] = {
/*
* XXX no entry because I have no data:
* XXX Dolphin Peripherals 4006 (single parallel)
-/* $OpenBSD: pucvar.h,v 1.9 2010/07/07 21:32:50 sthen Exp $ */
+/* $OpenBSD: pucvar.h,v 1.10 2010/07/22 17:16:10 pirofti Exp $ */
/* $NetBSD: pucvar.h,v 1.2 1999/02/06 06:29:54 cgd Exp $ */
/*
} ports[PUC_MAX_PORTS];
};
-#define PUC_REG_VEND 0
-#define PUC_REG_PROD 1
-#define PUC_REG_SVEND 2
-#define PUC_REG_SPROD 3
-
#define PUC_PORT_TYPE_NONE 0
#define PUC_PORT_TYPE_COM 1
#define PUC_PORT_TYPE_LPT 2
void (*intr_disestablish)(struct puc_attach_args *, void *);
};
-extern const struct puc_device_description puc_devices[];
+extern const struct puc_device_description puc_devs[];
#define PUC_NBARS 6
struct puc_softc {