diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2007-11-04 10:13:06 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2007-11-04 10:13:06 +0000 |
commit | 5a2d8c91cc0db761c5f86eab8fd77ab51d9f1717 (patch) | |
tree | ac1d3dbd9cab0825d2d0b71fbd7fea40a1263b28 /sys/dev | |
parent | e45e73d49870eec3056ba9ec0b63b14890415ba6 (diff) |
very initial foundation for splitting things up to support both the
traditional intel iop and the new marvell one used on the ARC-1200 rev B.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/arc.c | 87 |
1 files changed, 64 insertions, 23 deletions
diff --git a/sys/dev/pci/arc.c b/sys/dev/pci/arc.c index b06b78b07be..2a8b45e99e9 100644 --- a/sys/dev/pci/arc.c +++ b/sys/dev/pci/arc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arc.c,v 1.72 2007/11/04 08:16:17 dlg Exp $ */ +/* $OpenBSD: arc.c,v 1.73 2007/11/04 10:13:05 dlg Exp $ */ /* * Copyright (c) 2006 David Gwynne <dlg@openbsd.org> @@ -57,26 +57,6 @@ int arcdebug = 0; #define DNPRINTF(n, p...) /* n, p */ #endif -static const struct pci_matchid arc_devices[] = { - { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1110 }, - { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1120 }, - { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1130 }, - { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1160 }, - { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1170 }, - { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1200 }, - { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1202 }, - { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1210 }, - { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1220 }, - { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1230 }, - { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1260 }, - { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1270 }, - { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1280 }, - { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1380 }, - { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1381 }, - { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1680 }, - { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1681 } -}; - /* Areca boards using the Intel IOP are Revision A (RA) */ #define ARC_RA_PCI_BAR PCI_MAPREG_START @@ -505,11 +485,67 @@ void arc_refresh_sensors(void *); #endif /* SMALL_KERNEL */ #endif +struct arc_iop { + void *a; +}; + +static const struct arc_iop arc_intel = { + NULL +}; + +static const struct arc_iop arc_marvell = { + NULL +}; + +struct arc_board { + pcireg_t ab_vendor; + pcireg_t ab_product; + const struct arc_iop *ab_iop; +}; +const struct arc_board *arc_match_board(struct pci_attach_args *); + +static const struct arc_board arc_devices[] = { + { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1110, &arc_intel }, + { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1120, &arc_intel }, + { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1130, &arc_intel }, + { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1160, &arc_intel }, + { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1170, &arc_intel }, + { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1200, &arc_intel }, + { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1200_B, &arc_marvell }, + { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1202, &arc_intel }, + { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1210, &arc_intel }, + { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1220, &arc_intel }, + { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1230, &arc_intel }, + { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1260, &arc_intel }, + { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1270, &arc_intel }, + { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1280, &arc_intel }, + { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1380, &arc_intel }, + { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1381, &arc_intel }, + { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1680, &arc_intel }, + { PCI_VENDOR_ARECA, PCI_PRODUCT_ARECA_ARC1681, &arc_intel } +}; + +const struct arc_board * +arc_match_board(struct pci_attach_args *pa) +{ + const struct arc_board *ab; + int i; + + for (i = 0; i < sizeof(arc_devices) / sizeof(arc_devices[0]); i++) { + ab = &arc_devices[i]; + + if (PCI_VENDOR(pa->pa_id) == ab->ab_vendor && + PCI_PRODUCT(pa->pa_id) == ab->ab_product) + return (ab); + } + + return (NULL); +} + int arc_match(struct device *parent, void *match, void *aux) { - return (pci_matchbyid((struct pci_attach_args *)aux, arc_devices, - sizeof(arc_devices) / sizeof(arc_devices[0]))); + return ((arc_match_board(aux) == NULL) ? 0 : 1); } void @@ -523,6 +559,11 @@ arc_attach(struct device *parent, struct device *self, void *aux) sc->sc_talking = 0; rw_init(&sc->sc_lock, "arcmsg"); + if (arc_match_board(pa)->ab_iop == &arc_marvell) { + printf(": unsupported IOP\n"); + return; + } + if (arc_map_pci_resources(sc, pa) != 0) { /* error message printed by arc_map_pci_resources */ return; |