aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2005-03-28 06:29:40 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2005-03-28 06:29:40 -0800
commit738684161f014713fee74436447f4836664ff933 (patch)
tree9e033c04ede982b38bde0f013db9215e1a2ab9b6
parent780f0ab02c33589a35cf3d9647202104c6801202 (diff)
downloadhistory-738684161f014713fee74436447f4836664ff933.tar.gz
[PATCH] PCI: create PCI_DEBUG config option to make it easier for users to enable pci debugging
Now you don't have to dig through a file to change a #define, it's a real config option. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/pci/Kconfig10
-rw-r--r--drivers/pci/Makefile4
-rw-r--r--drivers/pci/hotplug.c15
-rw-r--r--drivers/pci/pci.c12
-rw-r--r--drivers/pci/probe.c25
-rw-r--r--drivers/pci/quirks.c2
-rw-r--r--drivers/pci/remove.c8
-rw-r--r--drivers/pci/setup-irq.c10
-rw-r--r--drivers/pci/setup-res.c16
9 files changed, 35 insertions, 67 deletions
diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
index 812c4274d7cdd..7f31991772ea4 100644
--- a/drivers/pci/Kconfig
+++ b/drivers/pci/Kconfig
@@ -47,3 +47,13 @@ config PCI_NAMES
When in doubt, say Y.
+config PCI_DEBUG
+ bool "PCI Debugging"
+ depends on PCI && DEBUG_KERNEL
+ help
+ Say Y here if you want the PCI core to produce a bunch of debug
+ messages to the system log. Select this if you are having a
+ problem with PCI support and want to see more of what is going on.
+
+ When in doubt, say N.
+
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
index 92b11de780e38..7dea494c0d7bb 100644
--- a/drivers/pci/Makefile
+++ b/drivers/pci/Makefile
@@ -41,6 +41,10 @@ ifndef CONFIG_X86
obj-y += syscall.o
endif
+ifeq ($(CONFIG_PCI_DEBUG),y)
+EXTRA_CFLAGS += -DDEBUG
+endif
+
hostprogs-y := gen-devlist
# Dependencies on generated files need to be listed explicitly
diff --git a/drivers/pci/hotplug.c b/drivers/pci/hotplug.c
index 46f3b4ebb501a..d471b3ea5d12f 100644
--- a/drivers/pci/hotplug.c
+++ b/drivers/pci/hotplug.c
@@ -1,15 +1,8 @@
+#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/module.h>
#include "pci.h"
-#undef DEBUG
-
-#ifdef DEBUG
-#define DBG(x...) printk(x)
-#else
-#define DBG(x...)
-#endif
-
int pci_hotplug (struct device *dev, char **envp, int num_envp,
char *buffer, int buffer_size)
{
@@ -71,7 +64,7 @@ static int pci_visit_bus (struct pci_visit * fn, struct pci_bus_wrapped *wrapped
struct pci_dev_wrapped wrapped_dev;
int result = 0;
- DBG("PCI: Scanning bus %04x:%02x\n", pci_domain_nr(wrapped_bus->bus),
+ pr_debug("PCI: Scanning bus %04x:%02x\n", pci_domain_nr(wrapped_bus->bus),
wrapped_bus->bus->number);
if (fn->pre_visit_pci_bus) {
@@ -107,7 +100,7 @@ static int pci_visit_bridge (struct pci_visit * fn,
struct pci_bus_wrapped wrapped_bus;
int result = 0;
- DBG("PCI: Scanning bridge %s\n", pci_name(wrapped_dev->dev));
+ pr_debug("PCI: Scanning bridge %s\n", pci_name(wrapped_dev->dev));
if (fn->visit_pci_dev) {
result = fn->visit_pci_dev(wrapped_dev, wrapped_parent);
@@ -153,7 +146,7 @@ int pci_visit_dev(struct pci_visit *fn, struct pci_dev_wrapped *wrapped_dev,
return result;
break;
default:
- DBG("PCI: Scanning device %s\n", pci_name(dev));
+ pr_debug("PCI: Scanning device %s\n", pci_name(dev));
if (fn->visit_pci_dev) {
result = fn->visit_pci_dev (wrapped_dev,
wrapped_parent);
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 5ce156382652e..9f0bfd452f9b6 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -9,6 +9,7 @@
* Copyright 1997 -- 2000 Martin Mares <mj@ucw.cz>
*/
+#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/pci.h>
@@ -16,13 +17,6 @@
#include <linux/spinlock.h>
#include <asm/dma.h> /* isa_dma_bridge_buggy */
-#undef DEBUG
-
-#ifdef DEBUG
-#define DBG(x...) printk(x)
-#else
-#define DBG(x...)
-#endif
/**
* pci_bus_max_busnr - returns maximum PCI bus number of given bus' children
@@ -633,7 +627,7 @@ pci_set_master(struct pci_dev *dev)
pci_read_config_word(dev, PCI_COMMAND, &cmd);
if (! (cmd & PCI_COMMAND_MASTER)) {
- DBG("PCI: Enabling bus mastering for device %s\n", pci_name(dev));
+ pr_debug("PCI: Enabling bus mastering for device %s\n", pci_name(dev));
cmd |= PCI_COMMAND_MASTER;
pci_write_config_word(dev, PCI_COMMAND, cmd);
}
@@ -711,7 +705,7 @@ pci_set_mwi(struct pci_dev *dev)
pci_read_config_word(dev, PCI_COMMAND, &cmd);
if (! (cmd & PCI_COMMAND_INVALIDATE)) {
- DBG("PCI: Enabling Mem-Wr-Inval for device %s\n", pci_name(dev));
+ pr_debug("PCI: Enabling Mem-Wr-Inval for device %s\n", pci_name(dev));
cmd |= PCI_COMMAND_INVALIDATE;
pci_write_config_word(dev, PCI_COMMAND, cmd);
}
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 51c7a3f9cc019..6f0edadd132cf 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2,6 +2,7 @@
* probe.c - PCI detection and setup code
*/
+#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/pci.h>
@@ -9,14 +10,6 @@
#include <linux/module.h>
#include <linux/cpumask.h>
-#undef DEBUG
-
-#ifdef DEBUG
-#define DBG(x...) printk(x)
-#else
-#define DBG(x...)
-#endif
-
#define CARDBUS_LATENCY_TIMER 176 /* secondary latency timer */
#define CARDBUS_RESERVE_BUSNR 3
#define PCI_CFG_SPACE_SIZE 256
@@ -422,8 +415,8 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max
pci_read_config_dword(dev, PCI_PRIMARY_BUS, &buses);
- DBG("PCI: Scanning behind PCI bridge %s, config %06x, pass %d\n",
- pci_name(dev), buses & 0xffffff, pass);
+ pr_debug("PCI: Scanning behind PCI bridge %s, config %06x, pass %d\n",
+ pci_name(dev), buses & 0xffffff, pass);
/* Disable MasterAbortMode during probing to avoid reporting
of bus errors (in some architectures) */
@@ -559,8 +552,8 @@ static int pci_setup_device(struct pci_dev * dev)
dev->class = class;
class >>= 8;
- DBG("PCI: Found %s [%04x/%04x] %06x %02x\n", pci_name(dev),
- dev->vendor, dev->device, class, dev->hdr_type);
+ pr_debug("PCI: Found %s [%04x/%04x] %06x %02x\n", pci_name(dev),
+ dev->vendor, dev->device, class, dev->hdr_type);
/* "Unknown power state" */
dev->current_state = 4;
@@ -815,7 +808,7 @@ unsigned int __devinit pci_scan_child_bus(struct pci_bus *bus)
unsigned int devfn, pass, max = bus->secondary;
struct pci_dev *dev;
- DBG("PCI: Scanning bus %04x:%02x\n", pci_domain_nr(bus), bus->number);
+ pr_debug("PCI: Scanning bus %04x:%02x\n", pci_domain_nr(bus), bus->number);
/* Go find them, Rover! */
for (devfn = 0; devfn < 0x100; devfn += 8)
@@ -825,7 +818,7 @@ unsigned int __devinit pci_scan_child_bus(struct pci_bus *bus)
* After performing arch-dependent fixup of the bus, look behind
* all PCI-to-PCI bridges on this bus.
*/
- DBG("PCI: Fixups for bus %04x:%02x\n", pci_domain_nr(bus), bus->number);
+ pr_debug("PCI: Fixups for bus %04x:%02x\n", pci_domain_nr(bus), bus->number);
pcibios_fixup_bus(bus);
for (pass=0; pass < 2; pass++)
list_for_each_entry(dev, &bus->devices, bus_list) {
@@ -841,7 +834,7 @@ unsigned int __devinit pci_scan_child_bus(struct pci_bus *bus)
*
* Return how far we've got finding sub-buses.
*/
- DBG("PCI: Bus scan for %04x:%02x returning with max=%02x\n",
+ pr_debug("PCI: Bus scan for %04x:%02x returning with max=%02x\n",
pci_domain_nr(bus), bus->number, max);
return max;
}
@@ -881,7 +874,7 @@ struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, int bus,
if (pci_find_bus(pci_domain_nr(b), bus)) {
/* If we already got to this bus through a different bridge, ignore it */
- DBG("PCI: Bus %04x:%02x already known\n", pci_domain_nr(b), bus);
+ pr_debug("PCI: Bus %04x:%02x already known\n", pci_domain_nr(b), bus);
goto err_out;
}
list_add_tail(&b->node, &pci_root_buses);
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index e4ae6977d1ed0..cb74fc3f5d2dc 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -19,8 +19,6 @@
#include <linux/init.h>
#include <linux/delay.h>
-#undef DEBUG
-
/* Deal with broken BIOS'es that neglect to enable passive release,
which can cause problems in combination with the 82441FX/PPro MTRRs */
static void __devinit quirk_passive_release(struct pci_dev *dev)
diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c
index 3bbccbd8f2163..8162960e6f175 100644
--- a/drivers/pci/remove.c
+++ b/drivers/pci/remove.c
@@ -2,14 +2,6 @@
#include <linux/module.h>
#include "pci.h"
-#undef DEBUG
-
-#ifdef DEBUG
-#define DBG(x...) printk(x)
-#else
-#define DBG(x...)
-#endif
-
static void pci_free_resources(struct pci_dev *dev)
{
int i;
diff --git a/drivers/pci/setup-irq.c b/drivers/pci/setup-irq.c
index 845682ba6116a..a251289c9958e 100644
--- a/drivers/pci/setup-irq.c
+++ b/drivers/pci/setup-irq.c
@@ -18,14 +18,6 @@
#include <linux/cache.h>
-#define DEBUG_CONFIG 0
-#if DEBUG_CONFIG
-#define DBG(x...) printk(x)
-#else
-#define DBG(x...)
-#endif
-
-
static void __init
pdev_fixup_irq(struct pci_dev *dev,
u8 (*swizzle)(struct pci_dev *, u8 *),
@@ -53,7 +45,7 @@ pdev_fixup_irq(struct pci_dev *dev,
irq = 0;
dev->irq = irq;
- DBG(KERN_ERR "PCI: fixup irq: (%s) got %d\n",
+ pr_debug("PCI: fixup irq: (%s) got %d\n",
dev->dev.kobj.name, dev->irq);
/* Always tell the device, so the driver knows what is
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index eb08971dadc11..1ca21d2ba11c6 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -25,13 +25,6 @@
#include <linux/slab.h>
#include "pci.h"
-#define DEBUG_CONFIG 0
-#if DEBUG_CONFIG
-#define DBG(x...) printk(x)
-#else
-#define DBG(x...)
-#endif
-
static void
pci_update_resource(struct pci_dev *dev, struct resource *res, int resno)
@@ -42,10 +35,9 @@ pci_update_resource(struct pci_dev *dev, struct resource *res, int resno)
pcibios_resource_to_bus(dev, &region, res);
- DBG(KERN_ERR " got res [%lx:%lx] bus [%lx:%lx] flags %lx for "
- "BAR %d of %s\n", res->start, res->end,
- region.start, region.end, res->flags,
- resno, pci_name(dev));
+ pr_debug(" got res [%lx:%lx] bus [%lx:%lx] flags %lx for "
+ "BAR %d of %s\n", res->start, res->end,
+ region.start, region.end, res->flags, resno, pci_name(dev));
new = region.start | (res->flags & PCI_REGION_FLAG_MASK);
if (res->flags & IORESOURCE_IO)
@@ -85,7 +77,7 @@ pci_update_resource(struct pci_dev *dev, struct resource *res, int resno)
}
}
res->flags &= ~IORESOURCE_UNSET;
- DBG(KERN_INFO "PCI: moved device %s resource %d (%lx) to %x\n",
+ pr_debug("PCI: moved device %s resource %d (%lx) to %x\n",
pci_name(dev), resno, res->flags,
new & ~PCI_REGION_FLAG_MASK);
}