summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2001-05-25 19:22:36 +0000
committerimp <imp@FreeBSD.org>2001-05-25 19:22:36 +0000
commit644f5a620b035c33f44f08210d6b31571fc5ecd4 (patch)
tree99af0eb1f1c6ed78738d8fc10fbd2ad115e78980
parentc90359c1eb8c18ff75d443bca00bcd6f0fc506d0 (diff)
downloadFreeBSD-src-644f5a620b035c33f44f08210d6b31571fc5ecd4.zip
FreeBSD-src-644f5a620b035c33f44f08210d6b31571fc5ecd4.tar.gz
Move to using the common device list.
Move to table driven probing of these devices since we have such a long list.
-rw-r--r--sys/pccard/pcic_pci.c182
-rw-r--r--sys/pccard/pcic_pci.h36
2 files changed, 99 insertions, 119 deletions
diff --git a/sys/pccard/pcic_pci.c b/sys/pccard/pcic_pci.c
index 475a4f0..9f3d1b0 100644
--- a/sys/pccard/pcic_pci.c
+++ b/sys/pccard/pcic_pci.c
@@ -42,6 +42,93 @@
#define PRVERB(x) if (bootverbose) device_printf x
+struct pcic_pci_table
+{
+ u_int32_t devid;
+ const char *descr;
+ int type;
+ u_int32_t flags;
+ int revision;
+} pcic_pci_devs[] = {
+ { PCI_DEVICE_ID_PCIC_CLPD6729,
+ "Cirrus Logic PD6729/6730 PC-Card Controller" },
+ { PCI_DEVICE_ID_PCIC_CLPD6832,
+ "Cirrus Logic PD6832 PCI-CardBus Bridge" },
+ { PCI_DEVICE_ID_PCIC_CLPD6833,
+ "Cirrus Logic PD6833 PCI-CardBus Bridge" },
+ { PCI_DEVICE_ID_PCIC_OZ6729,
+ "O2micro OZ6729 PC-Card Bridge" },
+ { PCI_DEVICE_ID_PCIC_OZ6730,
+ "O2micro OZ6730 PC-Card Bridge" },
+ { PCI_DEVICE_ID_PCIC_OZ6832,
+ "O2micro 6832/6833 PCI-Cardbus Bridge" },
+ { PCI_DEVICE_ID_PCIC_OZ6860,
+ "O2micro 6860/6836 PCI-Cardbus Bridge" },
+ { PCI_DEVICE_ID_PCIC_OZ6872,
+ "O2micro 6812/6872 PCI-Cardbus Bridge" },
+ { PCI_DEVICE_ID_RICOH_RL5C465,
+ "Ricoh RL5C465 PCI-CardBus Bridge" },
+ { PCI_DEVICE_ID_RICOH_RL5C475,
+ "Ricoh RL5C475 PCI-CardBus Bridge" },
+ { PCI_DEVICE_ID_RICOH_RL5C476,
+ "Ricoh RL5C476 PCI-CardBus Bridge" },
+ { PCI_DEVICE_ID_RICOH_RL5C477,
+ "Ricoh RL5C477 PCI-CardBus Bridge" },
+ { PCI_DEVICE_ID_RICOH_RL5C478,
+ "Ricoh RL5C478 PCI-CardBus Bridge" },
+ { PCI_DEVICE_ID_PCIC_TI1031,
+ "TI PCI-1031 PCI-PCMCIA Bridge" },
+ { PCI_DEVICE_ID_PCIC_TI1130,
+ "TI PCI-1130 PCI-CardBus Bridge" },
+ { PCI_DEVICE_ID_PCIC_TI1131,
+ "TI PCI-1131 PCI-CardBus Bridge" },
+ { PCI_DEVICE_ID_PCIC_TI1211,
+ "TI PCI-1211 PCI-CardBus Bridge" },
+ { PCI_DEVICE_ID_PCIC_TI1220,
+ "TI PCI-1220 PCI-CardBus Bridge" },
+ { PCI_DEVICE_ID_PCIC_TI1221,
+ "TI PCI-1221 PCI-CardBus Bridge" },
+ { PCI_DEVICE_ID_PCIC_TI1225,
+ "TI PCI-1225 PCI-CardBus Bridge" },
+ { PCI_DEVICE_ID_PCIC_TI1250,
+ "TI PCI-1250 PCI-CardBus Bridge" },
+ { PCI_DEVICE_ID_PCIC_TI1251,
+ "TI PCI-1251 PCI-CardBus Bridge" },
+ { PCI_DEVICE_ID_PCIC_TI1251B,
+ "TI PCI-1251B PCI-CardBus Bridge" },
+ { PCI_DEVICE_ID_PCIC_TI1410,
+ "TI PCI-1410 PCI-CardBus Bridge" },
+ { PCI_DEVICE_ID_PCIC_TI1420,
+ "TI PCI-1420 PCI-CardBus Bridge" },
+ { PCI_DEVICE_ID_PCIC_TI1450,
+ "TI PCI-1450 PCI-CardBus Bridge" },
+ { PCI_DEVICE_ID_PCIC_TI1451,
+ "TI PCI-1451 PCI-CardBus Bridge" },
+ { PCI_DEVICE_ID_PCIC_TI4451,
+ "TI PCI-4451 PCI-CardBus Bridge" },
+ { PCI_DEVICE_ID_TOSHIBA_TOPIC95,
+ "Toshiba ToPIC95 PCI-CardBus Bridge" },
+ { PCI_DEVICE_ID_TOSHIBA_TOPIC97,
+ "Toshiba ToPIC97 PCI-CardBus Bridge" },
+ { PCI_DEVICE_ID_TOSHIBA_TOPIC100,
+ "Toshiba ToPIC100 PCI-CardBus Bridge" },
+ { 0, NULL, 0, 0 }
+};
+
+/*
+ * lookup inside the table
+ */
+static struct pcic_pci_table *
+pcic_pci_lookup(u_int32_t devid, struct pcic_pci_table *tbl)
+{
+while (tbl->devid) {
+ if (tbl->devid == devid)
+ return (tbl);
+ tbl++;
+ }
+ return (NULL);
+}
+
/*
* Set up the CL-PD6832 to look like a ISA based PCMCIA chip (a
* PD672X). This routine is called once per PCMCIA socket.
@@ -221,94 +308,16 @@ pcic_pci_probe(device_t dev)
u_int32_t device_id;
u_int8_t subclass;
u_int8_t progif;
- char *desc;
+ struct pcic_pci_table *itm;
+ const char *desc;
device_id = pci_get_devid(dev);
desc = NULL;
- switch (device_id) {
- case PCI_DEVICE_ID_PCIC_CLPD6832:
- desc = "Cirrus Logic PD6832 PCI-CardBus Bridge";
- break;
- case PCI_DEVICE_ID_PCIC_TI1130:
- desc = "TI PCI-1130 PCI-CardBus Bridge";
- break;
- case PCI_DEVICE_ID_PCIC_TI1131:
- desc = "TI PCI-1131 PCI-CardBus Bridge";
- break;
- case PCI_DEVICE_ID_PCIC_TI1211:
- desc = "TI PCI-1211 PCI-CardBus Bridge";
- break;
- case PCI_DEVICE_ID_PCIC_TI1220:
- desc = "TI PCI-1220 PCI-CardBus Bridge";
- break;
- case PCI_DEVICE_ID_PCIC_TI1221:
- desc = "TI PCI-1221 PCI-CardBus Bridge";
- break;
- case PCI_DEVICE_ID_PCIC_TI1225:
- desc = "TI PCI-1225 PCI-CardBus Bridge";
- break;
- case PCI_DEVICE_ID_PCIC_TI1250:
- desc = "TI PCI-1250 PCI-CardBus Bridge";
- break;
- case PCI_DEVICE_ID_PCIC_TI1251:
- desc = "TI PCI-1251 PCI-CardBus Bridge";
- break;
- case PCI_DEVICE_ID_PCIC_TI1251B:
- desc = "TI PCI-1251B PCI-CardBus Bridge";
- break;
- case PCI_DEVICE_ID_PCIC_TI1410:
- desc = "TI PCI-1410 PCI-CardBus Bridge";
- break;
- case PCI_DEVICE_ID_PCIC_TI1420:
- desc = "TI PCI-1420 PCI-CardBus Bridge";
- break;
- case PCI_DEVICE_ID_PCIC_TI1450:
- desc = "TI PCI-1450 PCI-CardBus Bridge";
- break;
- case PCI_DEVICE_ID_PCIC_TI1451:
- desc = "TI PCI-1451 PCI-CardBus Bridge";
- break;
- case PCI_DEVICE_ID_TOSHIBA_TOPIC95:
- desc = "Toshiba ToPIC95 PCI-CardBus Bridge";
- break;
- case PCI_DEVICE_ID_TOSHIBA_TOPIC97:
- desc = "Toshiba ToPIC97 PCI-CardBus Bridge";
- break;
- case PCI_DEVICE_ID_TOSHIBA_TOPIC100:
- desc = "Toshiba ToPIC100 PCI-CardBus Bridge";
- break;
- case PCI_DEVICE_ID_RICOH_RL5C465:
- desc = "Ricoh RL5C465 PCI-CardBus Bridge";
- break;
- case PCI_DEVICE_ID_RICOH_RL5C475:
- desc = "Ricoh RL5C475 PCI-CardBus Bridge";
- break;
- case PCI_DEVICE_ID_RICOH_RL5C476:
- desc = "Ricoh RL5C476 PCI-CardBus Bridge";
- break;
- case PCI_DEVICE_ID_RICOH_RL5C478:
- desc = "Ricoh RL5C478 PCI-CardBus Bridge";
- break;
- case PCI_DEVICE_ID_PCIC_OZ6832:
- desc = "O2micro 6832 PCI-Cardbus Bridge";
- break;
-
- /* 16bit PC-card bridges */
- case PCI_DEVICE_ID_PCIC_CLPD6729:
- desc = "Cirrus Logic PD6729/6730 PC-Card Controller";
- break;
- case PCI_DEVICE_ID_PCIC_OZ6729:
- desc = "O2micro OZ6729 PC-Card Bridge";
- break;
- case PCI_DEVICE_ID_PCIC_OZ6730:
- desc = "O2micro OZ6730 PC-Card Bridge";
- break;
- case PCI_DEVICE_ID_PCIC_TI1031:
- desc = "TI PCI-1031 PCI-PCMCIA Bridge";
- break;
-
- default:
+ itm = pcic_pci_lookup(device_id, &pcic_pci_devs[0]);
+ if (itm != NULL)
+ desc = itm->descr;
+ if (desc == NULL) {
if (pci_get_class(dev) == PCIC_BRIDGE) {
subclass = pci_get_subclass(dev);
progif = pci_get_progif(dev);
@@ -317,14 +326,11 @@ pcic_pci_probe(device_t dev)
if (subclass == PCIS_BRIDGE_CARDBUS && progif == 0)
desc = "YENTA PCI-CARDBUS Bridge";
}
- break;
}
-
if (desc == NULL)
return (ENXIO);
-
device_set_desc(dev, desc);
- return (0); /* exact match */
+ return (0);
}
static void
diff --git a/sys/pccard/pcic_pci.h b/sys/pccard/pcic_pci.h
index 587267c..d587def 100644
--- a/sys/pccard/pcic_pci.h
+++ b/sys/pccard/pcic_pci.h
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 1997 Ted Faber
- * All rights reserved.
+ * Copyright (c) 2001 M. Warner Losh. All rights reserved.
+ * Copyright (c) 1997 Ted Faber. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,35 +29,9 @@
* $FreeBSD$
*/
-/* PCI/CardBus Device IDs */
-#define PCI_DEVICE_ID_PCIC_OZ6729 0x67291217ul
-#define PCI_DEVICE_ID_PCIC_OZ6730 0x673A1217ul
-#define PCI_DEVICE_ID_PCIC_OZ6832 0x68321217ul
-#define PCI_DEVICE_ID_PCIC_CLPD6729 0x11001013ul
-#define PCI_DEVICE_ID_PCIC_CLPD6832 0x11101013ul
-#define PCI_DEVICE_ID_PCIC_TI1031 0xac13104cul
-#define PCI_DEVICE_ID_PCIC_TI1130 0xac12104cul
-#define PCI_DEVICE_ID_PCIC_TI1131 0xac15104cul
-#define PCI_DEVICE_ID_PCIC_TI1211 0xac1e104cul
-#define PCI_DEVICE_ID_PCIC_TI1220 0xac17104cul
-#define PCI_DEVICE_ID_PCIC_TI1221 0xac19104cul
-#define PCI_DEVICE_ID_PCIC_TI1225 0xac1c104cul
-#define PCI_DEVICE_ID_PCIC_TI1250 0xac16104cul
-#define PCI_DEVICE_ID_PCIC_TI1251 0xac1d104cul
-#define PCI_DEVICE_ID_PCIC_TI1251B 0xac1f104cul
-#define PCI_DEVICE_ID_PCIC_TI1410 0xac50104cul
-#define PCI_DEVICE_ID_PCIC_TI1420 0xac51104cul
-#define PCI_DEVICE_ID_PCIC_TI1450 0xac1b104cul
-#define PCI_DEVICE_ID_PCIC_TI1451 0xac52104cul
-#define PCI_DEVICE_ID_TOSHIBA_TOPIC95 0x060a1179ul
-#define PCI_DEVICE_ID_TOSHIBA_TOPIC97 0x060f1179ul
-#define PCI_DEVICE_ID_TOSHIBA_TOPIC100 0x06171179ul
-#define PCI_DEVICE_ID_RICOH_RL5C465 0x04651180ul
-#define PCI_DEVICE_ID_RICOH_RL5C466 0x04661180ul
-#define PCI_DEVICE_ID_RICOH_RL5C475 0x04751180ul
-#define PCI_DEVICE_ID_RICOH_RL5C476 0x04761180ul
-#define PCI_DEVICE_ID_RICOH_RL5C478 0x04781180ul
-
+/* Share the devid database with NEWCARD */
+#include <dev/pccbb/pccbbdevid.h>
+
/* CL-PD6832 CardBus defines */
#define CLPD6832_IO_BASE0 0x002c
#define CLPD6832_IO_LIMIT0 0x0030
OpenPOWER on IntegriCloud