diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2005-05-09 00:38:58 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2005-05-09 00:38:58 +0000 |
commit | c52e299dad8bf0576ad0e7eb4f0dac753626c698 (patch) | |
tree | 379e70a858cdf6d30bb792ea531d510d2f352cde /sys/dev/cardbus | |
parent | 2865e342ad3ac344313e0034630a37623fb3b156 (diff) |
add cardbus_matchbyid(), mimics the PCI layers pci_matchbyid().
Diffstat (limited to 'sys/dev/cardbus')
-rw-r--r-- | sys/dev/cardbus/cardbus.c | 15 | ||||
-rw-r--r-- | sys/dev/cardbus/cardbusvar.h | 9 |
2 files changed, 22 insertions, 2 deletions
diff --git a/sys/dev/cardbus/cardbus.c b/sys/dev/cardbus/cardbus.c index f9f477e7752..89c60f454ce 100644 --- a/sys/dev/cardbus/cardbus.c +++ b/sys/dev/cardbus/cardbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cardbus.c,v 1.15 2004/10/07 21:16:59 brad Exp $ */ +/* $OpenBSD: cardbus.c,v 1.16 2005/05/09 00:38:57 brad Exp $ */ /* $NetBSD: cardbus.c,v 1.24 2000/04/02 19:11:37 mycroft Exp $ */ /* @@ -846,6 +846,19 @@ cardbus_get_capability(cc, cf, tag, capid, offset, value) return (0); } +int +cardbus_matchbyid(struct cardbus_attach_args *ca, const struct cardbus_matchid *ids, + int nent) +{ + const struct cardbus_matchid *cm; + int i; + + for (i = 0, cm = ids; i < nent; i++, cm++) + if (PCI_VENDOR(ca->ca_id) == cm->cm_vid && + PCI_PRODUCT(ca->ca_id) == cm->cm_pid) + return (1); + return (0); +} /* * below this line, there are some functions for decoding tuples. diff --git a/sys/dev/cardbus/cardbusvar.h b/sys/dev/cardbus/cardbusvar.h index b2362ccbe59..831268b2ddb 100644 --- a/sys/dev/cardbus/cardbusvar.h +++ b/sys/dev/cardbus/cardbusvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cardbusvar.h,v 1.6 2002/03/14 03:16:04 millert Exp $ */ +/* $OpenBSD: cardbusvar.h,v 1.7 2005/05/09 00:38:57 brad Exp $ */ /* $NetBSD: cardbusvar.h,v 1.17 2000/04/02 19:11:37 mycroft Exp $ */ /* @@ -430,6 +430,13 @@ int cardbus_function_disable(struct cardbus_softc *, int function); int cardbus_get_capability(cardbus_chipset_tag_t, cardbus_function_tag_t, cardbustag_t, int, int *, cardbusreg_t *); +struct cardbus_matchid { + cardbus_vendor_id_t cm_vid; + cardbus_product_id_t cm_pid; +}; + +int cardbus_matchbyid(struct cardbus_attach_args *, const struct cardbus_matchid *, int); + #define Cardbus_function_enable(ct) cardbus_function_enable((ct)->ct_sc, (ct)->ct_func) #define Cardbus_function_disable(ct) cardbus_function_disable((ct)->ct_sc, (ct)->ct_func) |