diff options
author | Stuart Henderson <sthen@cvs.openbsd.org> | 2010-07-07 21:32:51 +0000 |
---|---|---|
committer | Stuart Henderson <sthen@cvs.openbsd.org> | 2010-07-07 21:32:51 +0000 |
commit | eef9afdc10c04076c69ce4f0568bd29d67da9c78 (patch) | |
tree | 85c6578dffed4d4f906f715d784930ca3c8bdc39 /sys | |
parent | d88a04b088947adfdb18f0970e79ff60e4a74145 (diff) |
revert last commit, it made my puc(4) disappear. ok pirofti@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/puc.c | 25 | ||||
-rw-r--r-- | sys/dev/pci/pucdata.c | 4 | ||||
-rw-r--r-- | sys/dev/pci/pucvar.h | 9 |
3 files changed, 26 insertions, 12 deletions
diff --git a/sys/dev/pci/puc.c b/sys/dev/pci/puc.c index b117a4e4f50..09da445c1b8 100644 --- a/sys/dev/pci/puc.c +++ b/sys/dev/pci/puc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: puc.c,v 1.15 2010/07/02 01:07:20 pirofti Exp $ */ +/* $OpenBSD: puc.c,v 1.16 2010/07/07 21:32:50 sthen Exp $ */ /* $NetBSD: puc.c,v 1.3 1999/02/06 06:29:54 cgd Exp $ */ /* @@ -349,13 +349,22 @@ puc_find_description(u_int16_t vend, u_int16_t prod, { int i; - for (i = 0; puc_devs[i].rval[0] && puc_devs[i].rval[1] && - puc_devs[i].rval[2] && puc_devs[i].rval[3]; 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]); +#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 return (NULL); } diff --git a/sys/dev/pci/pucdata.c b/sys/dev/pci/pucdata.c index 69779395d8a..0d9a2b470c2 100644 --- a/sys/dev/pci/pucdata.c +++ b/sys/dev/pci/pucdata.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pucdata.c,v 1.70 2010/07/02 01:07:20 pirofti Exp $ */ +/* $OpenBSD: pucdata.c,v 1.71 2010/07/07 21:32:50 sthen Exp $ */ /* $NetBSD: pucdata.c,v 1.6 1999/07/03 05:55:23 cgd Exp $ */ /* @@ -46,7 +46,7 @@ #include <dev/pci/pcidevs.h> #include <dev/ic/comreg.h> -const struct puc_device_description puc_devs[] = { +const struct puc_device_description puc_devices[] = { /* * XXX no entry because I have no data: * XXX Dolphin Peripherals 4006 (single parallel) diff --git a/sys/dev/pci/pucvar.h b/sys/dev/pci/pucvar.h index 4254d060aef..857e1eaa897 100644 --- a/sys/dev/pci/pucvar.h +++ b/sys/dev/pci/pucvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pucvar.h,v 1.8 2010/07/02 01:07:20 pirofti Exp $ */ +/* $OpenBSD: pucvar.h,v 1.9 2010/07/07 21:32:50 sthen Exp $ */ /* $NetBSD: pucvar.h,v 1.2 1999/02/06 06:29:54 cgd Exp $ */ /* @@ -51,6 +51,11 @@ struct puc_device_description { } 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 @@ -80,7 +85,7 @@ struct puc_attach_args { void (*intr_disestablish)(struct puc_attach_args *, void *); }; -extern const struct puc_device_description puc_devs[]; +extern const struct puc_device_description puc_devices[]; #define PUC_NBARS 6 struct puc_softc { |