SOURCES (CRI): kernel-CRI-proc-pci.patch (NEW) - restore /proc/pci (modifie...
hawk
hawk at pld-linux.org
Wed May 7 18:14:53 CEST 2008
Author: hawk Date: Wed May 7 16:14:53 2008 GMT
Module: SOURCES Tag: CRI
---- Log message:
- restore /proc/pci (modified a bit), CRI uses it in hardware detection
---- Files affected:
SOURCES:
kernel-CRI-proc-pci.patch (NONE -> 1.1.2.1) (NEW)
---- Diffs:
================================================================
Index: SOURCES/kernel-CRI-proc-pci.patch
diff -u /dev/null SOURCES/kernel-CRI-proc-pci.patch:1.1.2.1
--- /dev/null Wed May 7 18:14:53 2008
+++ SOURCES/kernel-CRI-proc-pci.patch Wed May 7 18:14:48 2008
@@ -0,0 +1,163 @@
+diff -ur linux-2.6.24.2.orig/drivers/pci/Kconfig linux-2.6.24.2/drivers/pci/Kconfig
+--- linux-2.6.24.2.orig/drivers/pci/Kconfig 2008-02-23 13:10:38.000000000 +0100
++++ linux-2.6.24.2/drivers/pci/Kconfig 2008-02-23 13:13:29.000000000 +0100
+@@ -32,6 +32,15 @@
+ option serves to include/exclude only a few drivers that are
+ still using this API.
+
++config PCI_LEGACY_PROC
++ bool "Legacy /proc/pci interface"
++ depends on PCI
++ help
++ This feature enables a procfs file -- /proc/pci -- that provides a
++ summary of PCI devices in the system.
++
++ When in doubt, say N.
++
+ config PCI_DEBUG
+ bool "PCI Debugging"
+ depends on PCI && DEBUG_KERNEL
+diff -ur linux-2.6.24.2.orig/drivers/pci/proc.c linux-2.6.24.2/drivers/pci/proc.c
+--- linux-2.6.24.2.orig/drivers/pci/proc.c 2008-02-23 13:10:38.000000000 +0100
++++ linux-2.6.24.2/drivers/pci/proc.c 2008-02-23 13:13:29.000000000 +0100
+@@ -452,6 +452,132 @@
+ return 0;
+ }
+
++#ifdef CONFIG_PCI_LEGACY_PROC
++
++/*
++ * Backward compatible /proc/pci interface.
++ */
++
++/*
++ * Convert some of the configuration space registers of the device at
++ * address (bus,devfn) into a string (possibly several lines each).
++ * The configuration string is stored starting at buf[len]. If the
++ * string would exceed the size of the buffer (SIZE), 0 is returned.
++ */
++static int show_dev_config(struct seq_file *m, void *v)
++{
++ struct pci_dev *dev = v;
++ struct pci_dev *first_dev;
++ struct pci_driver *drv;
++ u32 class_rev;
++ unsigned char latency, min_gnt, max_lat, class_prog;
++ int reg;
++
++ first_dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL);
++ if (dev == first_dev)
++ seq_puts(m, "PCI devices found:\n");
++ pci_dev_put(first_dev);
++
++ drv = pci_dev_driver(dev);
++
++ pci_user_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
++ pci_user_read_config_byte (dev, PCI_CLASS_PROG, &class_prog);
++ pci_user_read_config_byte (dev, PCI_LATENCY_TIMER, &latency);
++ pci_user_read_config_byte (dev, PCI_MIN_GNT, &min_gnt);
++ pci_user_read_config_byte (dev, PCI_MAX_LAT, &max_lat);
++ seq_printf(m, " Bus %2d, device %3d, function %2d:\n",
++ dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
++ seq_printf(m, " Class %04x:%02x ", class_rev >> 16, class_prog);
++ seq_printf(m, "PCI device %04x:%04x", dev->vendor, dev->device);
++ seq_printf(m, " (rev %d).\n", class_rev & 0xff);
++
++ if (dev->irq)
++ seq_printf(m, " IRQ %d.\n", dev->irq);
++
++ if (latency || min_gnt || max_lat) {
++ seq_printf(m, " Master Capable. ");
++ if (latency)
++ seq_printf(m, "Latency=%d. ", latency);
++ else
++ seq_puts(m, "No bursts. ");
++ if (min_gnt)
++ seq_printf(m, "Min Gnt=%d.", min_gnt);
++ if (max_lat)
++ seq_printf(m, "Max Lat=%d.", max_lat);
++ seq_putc(m, '\n');
++ }
++
++ for (reg = 0; reg < 6; reg++) {
++ struct resource *res = dev->resource + reg;
++ unsigned long base, end, flags;
++
++ base = res->start;
++ end = res->end;
++ flags = res->flags;
++ if (!end)
++ continue;
++
++ if (flags & PCI_BASE_ADDRESS_SPACE_IO) {
++ seq_printf(m, " I/O at 0x%lx [0x%lx].\n",
++ base, end);
++ } else {
++ const char *pref, *type = "unknown";
++
++ if (flags & PCI_BASE_ADDRESS_MEM_PREFETCH)
++ pref = "P";
++ else
++ pref = "Non-p";
++ switch (flags & PCI_BASE_ADDRESS_MEM_TYPE_MASK) {
++ case PCI_BASE_ADDRESS_MEM_TYPE_32:
++ type = "32 bit"; break;
++ case PCI_BASE_ADDRESS_MEM_TYPE_1M:
++ type = "20 bit"; break;
++ case PCI_BASE_ADDRESS_MEM_TYPE_64:
++ type = "64 bit"; break;
++ }
++ seq_printf(m, " %srefetchable %s memory at "
++ "0x%lx [0x%lx].\n", pref, type,
++ base,
++ end);
++ }
++ }
++ return 0;
++}
++
++static struct seq_operations proc_pci_op = {
++ .start = pci_seq_start,
++ .next = pci_seq_next,
++ .stop = pci_seq_stop,
++ .show = show_dev_config
++};
++
++static int proc_pci_open(struct inode *inode, struct file *file)
++{
++ return seq_open(file, &proc_pci_op);
++}
++static struct file_operations proc_pci_operations = {
++ .open = proc_pci_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = seq_release,
++};
++
++static void legacy_proc_init(void)
++{
++ struct proc_dir_entry * entry = create_proc_entry("pci", 0, NULL);
++ if (entry)
++ entry->proc_fops = &proc_pci_operations;
++}
++
++#else
++
++static void legacy_proc_init(void)
++{
++
++}
++
++#endif /* CONFIG_PCI_LEGACY_PROC */
++
+ static int proc_bus_pci_dev_open(struct inode *inode, struct file *file)
+ {
+ return seq_open(file, &proc_bus_pci_devices_op);
+@@ -475,6 +601,7 @@
+ while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
+ pci_proc_attach_device(dev);
+ }
++ legacy_proc_init();
+ return 0;
+ }
+
================================================================
More information about the pld-cvs-commit
mailing list