aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/proc.c')
-rw-r--r--drivers/pci/proc.c126
1 files changed, 0 insertions, 126 deletions
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c
index 92a885760832..54b2ebc9c91a 100644
--- a/drivers/pci/proc.c
+++ b/drivers/pci/proc.c
@@ -458,131 +458,6 @@ int pci_proc_detach_bus(struct pci_bus* bus)
458 return 0; 458 return 0;
459} 459}
460 460
461#ifdef CONFIG_PCI_LEGACY_PROC
462
463/*
464 * Backward compatible /proc/pci interface.
465 */
466
467/*
468 * Convert some of the configuration space registers of the device at
469 * address (bus,devfn) into a string (possibly several lines each).
470 * The configuration string is stored starting at buf[len]. If the
471 * string would exceed the size of the buffer (SIZE), 0 is returned.
472 */
473static int show_dev_config(struct seq_file *m, void *v)
474{
475 struct pci_dev *dev = v;
476 struct pci_dev *first_dev;
477 struct pci_driver *drv;
478 u32 class_rev;
479 unsigned char latency, min_gnt, max_lat;
480 int reg;
481
482 first_dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL);
483 if (dev == first_dev)
484 seq_puts(m, "PCI devices found:\n");
485 pci_dev_put(first_dev);
486
487 drv = pci_dev_driver(dev);
488
489 pci_user_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
490 pci_user_read_config_byte (dev, PCI_LATENCY_TIMER, &latency);
491 pci_user_read_config_byte (dev, PCI_MIN_GNT, &min_gnt);
492 pci_user_read_config_byte (dev, PCI_MAX_LAT, &max_lat);
493 seq_printf(m, " Bus %2d, device %3d, function %2d:\n",
494 dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
495 seq_printf(m, " Class %04x", class_rev >> 16);
496 seq_printf(m, ": PCI device %04x:%04x", dev->vendor, dev->device);
497 seq_printf(m, " (rev %d).\n", class_rev & 0xff);
498
499 if (dev->irq)
500 seq_printf(m, " IRQ %d.\n", dev->irq);
501
502 if (latency || min_gnt || max_lat) {
503 seq_printf(m, " Master Capable. ");
504 if (latency)
505 seq_printf(m, "Latency=%d. ", latency);
506 else
507 seq_puts(m, "No bursts. ");
508 if (min_gnt)
509 seq_printf(m, "Min Gnt=%d.", min_gnt);
510 if (max_lat)
511 seq_printf(m, "Max Lat=%d.", max_lat);
512 seq_putc(m, '\n');
513 }
514
515 for (reg = 0; reg < 6; reg++) {
516 struct resource *res = dev->resource + reg;
517 unsigned long base, end, flags;
518
519 base = res->start;
520 end = res->end;
521 flags = res->flags;
522 if (!end)
523 continue;
524
525 if (flags & PCI_BASE_ADDRESS_SPACE_IO) {
526 seq_printf(m, " I/O at 0x%lx [0x%lx].\n",
527 base, end);
528 } else {
529 const char *pref, *type = "unknown";
530
531 if (flags & PCI_BASE_ADDRESS_MEM_PREFETCH)
532 pref = "P";
533 else
534 pref = "Non-p";
535 switch (flags & PCI_BASE_ADDRESS_MEM_TYPE_MASK) {
536 case PCI_BASE_ADDRESS_MEM_TYPE_32:
537 type = "32 bit"; break;
538 case PCI_BASE_ADDRESS_MEM_TYPE_1M:
539 type = "20 bit"; break;
540 case PCI_BASE_ADDRESS_MEM_TYPE_64:
541 type = "64 bit"; break;
542 }
543 seq_printf(m, " %srefetchable %s memory at "
544 "0x%lx [0x%lx].\n", pref, type,
545 base,
546 end);
547 }
548 }
549 return 0;
550}
551
552static struct seq_operations proc_pci_op = {
553 .start = pci_seq_start,
554 .next = pci_seq_next,
555 .stop = pci_seq_stop,
556 .show = show_dev_config
557};
558
559static int proc_pci_open(struct inode *inode, struct file *file)
560{
561 return seq_open(file, &proc_pci_op);
562}
563static struct file_operations proc_pci_operations = {
564 .open = proc_pci_open,
565 .read = seq_read,
566 .llseek = seq_lseek,
567 .release = seq_release,
568};
569
570static void legacy_proc_init(void)
571{
572 struct proc_dir_entry * entry = create_proc_entry("pci", 0, NULL);
573 if (entry)
574 entry->proc_fops = &proc_pci_operations;
575}
576
577#else
578
579static void legacy_proc_init(void)
580{
581
582}
583
584#endif /* CONFIG_PCI_LEGACY_PROC */
585
586static int proc_bus_pci_dev_open(struct inode *inode, struct file *file) 461static int proc_bus_pci_dev_open(struct inode *inode, struct file *file)
587{ 462{
588 return seq_open(file, &proc_bus_pci_devices_op); 463 return seq_open(file, &proc_bus_pci_devices_op);
@@ -606,7 +481,6 @@ static int __init pci_proc_init(void)
606 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { 481 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
607 pci_proc_attach_device(dev); 482 pci_proc_attach_device(dev);
608 } 483 }
609 legacy_proc_init();
610 return 0; 484 return 0;
611} 485}
612 486