2 * $Id: oldproc.c,v 1.24 1998/10/11 15:13:04 mj Exp $
4 * Backward-compatible procfs interface for PCI.
6 * Copyright 1993, 1994, 1995, 1997 Drew Eckhardt, Frederic Potter,
7 * David Mosberger-Tang, Martin Mares
10 #include <linux/types.h>
11 #include <linux/kernel.h>
12 #include <linux/pci.h>
13 #include <linux/init.h>
15 struct pci_device_info
{
16 unsigned short device
;
21 struct pci_vendor_info
{
22 unsigned short vendor
;
25 struct pci_device_info
*devices
;
29 * This is ridiculous, but we want the strings in
30 * the .init section so that they don't take up
31 * real memory.. Parse the same file multiple times
32 * to get all the info.
34 #define VENDOR( vendor, name ) static const char __vendorstr_##vendor[] __initdata = name;
36 #define DEVICE( vendor, device, name ) static const char __devicestr_##vendor##device[] __initdata = name;
40 #define VENDOR( vendor, name ) static struct pci_device_info __devices_##vendor[] __initdata = {
41 #define ENDVENDOR() };
42 #define DEVICE( vendor, device, name ) { PCI_DEVICE_ID_##device, 0, __devicestr_##vendor##device },
45 static const struct pci_vendor_info __initdata pci_vendor_list
[] = {
46 #define VENDOR( vendor, name ) { PCI_VENDOR_ID_##vendor, sizeof(__devices_##vendor) / sizeof(struct pci_device_info), __vendorstr_##vendor, __devices_##vendor },
48 #define DEVICE( vendor, device, name )
52 #define VENDORS (sizeof(pci_vendor_list)/sizeof(struct pci_vendor_info))
54 void __init
pci_name_device(struct pci_dev
*dev
)
56 const struct pci_vendor_info
*vendor_p
= pci_vendor_list
;
58 char *name
= dev
->name
;
61 if (vendor_p
->vendor
== dev
->vendor
)
66 /* Couldn't find either the vendor nor the device */
67 sprintf(name
, "PCI device %04x:%04x", dev
->vendor
, dev
->device
);
71 struct pci_device_info
*device_p
= vendor_p
->devices
;
75 if (device_p
->device
== dev
->device
)
81 /* Ok, found the vendor, but unknown device */
82 sprintf(name
, "PCI device %04x:%04x (%s)", dev
->vendor
, dev
->device
, vendor_p
->name
);
87 char *n
= name
+ sprintf(name
, "%s %s", vendor_p
->name
, device_p
->name
);
88 int nr
= device_p
->seen
+ 1;
91 sprintf(n
, " (#%d)", nr
);