aboutsummaryrefslogtreecommitdiff
path: root/sys/pccard
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2001-05-25 19:22:36 +0000
committerWarner Losh <imp@FreeBSD.org>2001-05-25 19:22:36 +0000
commitee327e92e1e9f00d9a80b9a8eb37a3b520f5a0b1 (patch)
tree3b5b76a88a10eee0d6f5e7732499611a25a272fb /sys/pccard
parentdb0d08ca8fe8080ced110d616c7f0a6e9927de62 (diff)
downloadsrc-ee327e92e1e9f00d9a80b9a8eb37a3b520f5a0b1.tar.gz
src-ee327e92e1e9f00d9a80b9a8eb37a3b520f5a0b1.zip
Move to using the common device list.
Move to table driven probing of these devices since we have such a long list.
Notes
Notes: svn path=/head/; revision=77196
Diffstat (limited to 'sys/pccard')
-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 475a4f0d8cf7..9f3d1b0a5ebb 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 587267c6db2c..d587def9093c 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