summaryrefslogtreecommitdiffstats
path: root/drivers/pci/names.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-02-04 07:40:19 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-02-04 07:40:19 +0000
commit33263fc5f9ac8e8cb2b22d06af3ce5ac1dd815e4 (patch)
tree2d1b86a40bef0958a68cf1a2eafbeb0667a70543 /drivers/pci/names.c
parent216f5f51aa02f8b113aa620ebc14a9631a217a00 (diff)
Merge with Linux 2.3.32.
Diffstat (limited to 'drivers/pci/names.c')
-rw-r--r--drivers/pci/names.c49
1 files changed, 45 insertions, 4 deletions
diff --git a/drivers/pci/names.c b/drivers/pci/names.c
index 81dafad61..9018e8976 100644
--- a/drivers/pci/names.c
+++ b/drivers/pci/names.c
@@ -1,17 +1,18 @@
/*
- * $Id: oldproc.c,v 1.24 1998/10/11 15:13:04 mj Exp $
+ * PCI Class and Device Name Tables
*
- * Backward-compatible procfs interface for PCI.
- *
- * Copyright 1993, 1994, 1995, 1997 Drew Eckhardt, Frederic Potter,
+ * Copyright 1993--1999 Drew Eckhardt, Frederic Potter,
* David Mosberger-Tang, Martin Mares
*/
+#include <linux/config.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/init.h>
+#ifdef CONFIG_PCI_NAMES
+
struct pci_device_info {
unsigned short device;
unsigned short seen;
@@ -92,3 +93,43 @@ void __init pci_name_device(struct pci_dev *dev)
}
}
}
+
+/*
+ * Class names. Not in .init section as they are needed in runtime.
+ */
+
+static u16 pci_class_numbers[] = {
+#define CLASS(x,y) 0x##x,
+#include "classlist.h"
+};
+
+static char *pci_class_names[] = {
+#define CLASS(x,y) y,
+#include "classlist.h"
+};
+
+char *
+pci_class_name(u32 class)
+{
+ int i;
+
+ for(i=0; i<sizeof(pci_class_numbers)/sizeof(pci_class_numbers[0]); i++)
+ if (pci_class_numbers[i] == class)
+ return pci_class_names[i];
+ return NULL;
+}
+
+#else
+
+void __init pci_name_device(struct pci_dev *dev)
+{
+ sprintf(dev->name, "PCI device %04x:%04x", dev->vendor, dev->device);
+}
+
+char *
+pci_class_name(u32 class)
+{
+ return NULL;
+}
+
+#endif