aboutsummaryrefslogtreecommitdiffstats
path: root/pci
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2005-11-17 15:50:35 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2005-11-17 15:50:35 -0800
commita660c1509ae85d386ab886c2627c8bc05933e0f3 (patch)
treea3e76f3f4e58e3d0a0fc5d3d137e522fe3a35feb /pci
parent9472c47f6199ce19729ce72ea447d5c78f3a961a (diff)
downloadpatches-a660c1509ae85d386ab886c2627c8bc05933e0f3.tar.gz
pci usb and driver core fixes
Diffstat (limited to 'pci')
-rw-r--r--pci/pci-error-recovery-header-file-patch.patch123
-rw-r--r--pci/pci-remove-bogus-resource-collision-error.patch49
-rw-r--r--pci/pcie-make-bus_id-for-pci-express-devices-unique.patch33
3 files changed, 205 insertions, 0 deletions
diff --git a/pci/pci-error-recovery-header-file-patch.patch b/pci/pci-error-recovery-header-file-patch.patch
new file mode 100644
index 0000000000000..78b1cde35db70
--- /dev/null
+++ b/pci/pci-error-recovery-header-file-patch.patch
@@ -0,0 +1,123 @@
+From linas@austin.ibm.com Wed Nov 16 15:00:59 2005
+Date: Wed, 16 Nov 2005 17:10:41 -0600
+To: Greg KH <greg@kroah.com>
+Cc: Paul Mackerras <paulus@samba.org>
+Subject: [PATCH 1/7] PCI Error Recovery: header file patch
+Message-ID: <20051116231041.GA16057@austin.ibm.com>
+Content-Disposition: inline
+From: linas <linas@austin.ibm.com>
+
+
+Various PCI bus errors can be signaled by newer PCI controllers.
+Recovering from those errors requires an infrastructure to notify
+affected device drivers of the error, and a way of walking through a
+reset sequence. This patch adds a set of callbacks to be used by error
+recovery routines to notify device drivers of the various stages of
+recovery.
+
+Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+--
+
+---
+ include/linux/pci.h | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 67 insertions(+)
+
+--- gregkh-2.6.orig/include/linux/pci.h
++++ gregkh-2.6/include/linux/pci.h
+@@ -78,6 +78,23 @@ typedef int __bitwise pci_power_t;
+ #define PCI_UNKNOWN ((pci_power_t __force) 5)
+ #define PCI_POWER_ERROR ((pci_power_t __force) -1)
+
++/** The pci_channel state describes connectivity between the CPU and
++ * the pci device. If some PCI bus between here and the pci device
++ * has crashed or locked up, this info is reflected here.
++ */
++typedef unsigned int __bitwise pci_channel_state_t;
++
++enum pci_channel_state {
++ /* I/O channel is in normal state */
++ pci_channel_io_normal = (__force pci_channel_state_t) 1,
++
++ /* I/O to channel is blocked */
++ pci_channel_io_frozen = (__force pci_channel_state_t) 2,
++
++ /* PCI card is dead */
++ pci_channel_io_perm_failure = (__force pci_channel_state_t) 3,
++};
++
+ /*
+ * The pci_dev structure is used to describe PCI devices.
+ */
+@@ -111,6 +128,7 @@ struct pci_dev {
+ this is D0-D3, D0 being fully functional,
+ and D3 being off. */
+
++ pci_channel_state_t error_state; /* current connectivity state */
+ struct device dev; /* Generic device interface */
+
+ /* device is compatible with these IDs */
+@@ -233,6 +251,54 @@ struct pci_dynids {
+ unsigned int use_driver_data:1; /* pci_driver->driver_data is used */
+ };
+
++/* ---------------------------------------------------------------- */
++/** PCI Error Recovery System (PCI-ERS). If a PCI device driver provides
++ * a set fof callbacks in struct pci_error_handlers, then that device driver
++ * will be notified of PCI bus errors, and will be driven to recovery
++ * when an error occurs.
++ */
++
++typedef unsigned int __bitwise pci_ers_result_t;
++
++enum pci_ers_result {
++ /* no result/none/not supported in device driver */
++ PCI_ERS_RESULT_NONE = (__force pci_ers_result_t) 1,
++
++ /* Device driver can recover without slot reset */
++ PCI_ERS_RESULT_CAN_RECOVER = (__force pci_ers_result_t) 2,
++
++ /* Device driver wants slot to be reset. */
++ PCI_ERS_RESULT_NEED_RESET = (__force pci_ers_result_t) 3,
++
++ /* Device has completely failed, is unrecoverable */
++ PCI_ERS_RESULT_DISCONNECT = (__force pci_ers_result_t) 4,
++
++ /* Device driver is fully recovered and operational */
++ PCI_ERS_RESULT_RECOVERED = (__force pci_ers_result_t) 5,
++};
++
++/* PCI bus error event callbacks */
++struct pci_error_handlers
++{
++ /* PCI bus error detected on this device */
++ pci_ers_result_t (*error_detected)(struct pci_dev *dev,
++ enum pci_channel_state error);
++
++ /* MMIO has been re-enabled, but not DMA */
++ pci_ers_result_t (*mmio_enabled)(struct pci_dev *dev);
++
++ /* PCI Express link has been reset */
++ pci_ers_result_t (*link_reset)(struct pci_dev *dev);
++
++ /* PCI slot has been reset */
++ pci_ers_result_t (*slot_reset)(struct pci_dev *dev);
++
++ /* Device driver may resume normal operations */
++ void (*resume)(struct pci_dev *dev);
++};
++
++/* ---------------------------------------------------------------- */
++
+ struct module;
+ struct pci_driver {
+ struct list_head node;
+@@ -245,6 +311,7 @@ struct pci_driver {
+ int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable); /* Enable wake event */
+ void (*shutdown) (struct pci_dev *dev);
+
++ struct pci_error_handlers *err_handler;
+ struct device_driver driver;
+ struct pci_dynids dynids;
+ };
diff --git a/pci/pci-remove-bogus-resource-collision-error.patch b/pci/pci-remove-bogus-resource-collision-error.patch
new file mode 100644
index 0000000000000..64c33faf10b28
--- /dev/null
+++ b/pci/pci-remove-bogus-resource-collision-error.patch
@@ -0,0 +1,49 @@
+From rshah1@unix-os.sc.intel.com Thu Nov 17 09:49:25 2005
+Date: Thu, 17 Nov 2005 09:51:28 -0800
+From: Rajesh Shah <rajesh.shah@intel.com>
+To: Greg KH <gregkh@suse.de>
+Cc: Rajesh Shah <rajesh.shah@intel.com>, akpm@osdl.org
+Subject: PCI: remove bogus resource collision error
+Message-ID: <20051117095128.A21488@unix-os.sc.intel.com>
+Content-Disposition: inline
+
+When attempting to hotadd a PCI card with a bridge on it, I saw
+the kernel reporting resource collision errors even when there were
+really no collisions. The problem is that the code doesn't skip
+over "invalid" resources with their resource type flag not set.
+Others have reported similar problems at boot time and for
+non-bridge PCI card hotplug too, where the code flags a
+resource collision for disabled ROMs. This patch fixes both
+problems.
+
+Signed-off-by: Rajesh Shah <rajesh.shah@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+
+---
+ arch/i386/pci/i386.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+--- gregkh-2.6.orig/arch/i386/pci/i386.c
++++ gregkh-2.6/arch/i386/pci/i386.c
+@@ -221,6 +221,11 @@ int pcibios_enable_resources(struct pci_
+ continue;
+
+ r = &dev->resource[idx];
++ if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM)))
++ continue;
++ if ((idx == PCI_ROM_RESOURCE) &&
++ (!(r->flags & IORESOURCE_ROM_ENABLE)))
++ continue;
+ if (!r->start && r->end) {
+ printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev));
+ return -EINVAL;
+@@ -230,8 +235,6 @@ int pcibios_enable_resources(struct pci_
+ if (r->flags & IORESOURCE_MEM)
+ cmd |= PCI_COMMAND_MEMORY;
+ }
+- if (dev->resource[PCI_ROM_RESOURCE].start)
+- cmd |= PCI_COMMAND_MEMORY;
+ if (cmd != old_cmd) {
+ printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, cmd);
+ pci_write_config_word(dev, PCI_COMMAND, cmd);
diff --git a/pci/pcie-make-bus_id-for-pci-express-devices-unique.patch b/pci/pcie-make-bus_id-for-pci-express-devices-unique.patch
new file mode 100644
index 0000000000000..fd69bd42817b5
--- /dev/null
+++ b/pci/pcie-make-bus_id-for-pci-express-devices-unique.patch
@@ -0,0 +1,33 @@
+From owner-linux-pci@atrey.karlin.mff.cuni.cz Mon Nov 14 09:20:35 2005
+Date: Mon, 14 Nov 2005 20:30:50 +0300
+From: Sergey Vlasov <vsu@altlinux.ru>
+To: linux-pci@atrey.karlin.mff.cuni.cz
+Subject: [PATCH] PCIE: make bus_id for PCI Express devices unique
+Message-ID: <20051114173050.GB24496@master.mivlgu.local>
+Content-Disposition: inline
+
+The bus_id string must be unique for all devices of that bus in the
+system, not just for devices with the same parent - otherwise multiple
+symlinks with identical names appear in /sys/bus/pci_express/devices.
+
+Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+
+---
+ drivers/pci/pcie/portdrv_core.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- gregkh-2.6.orig/drivers/pci/pcie/portdrv_core.c
++++ gregkh-2.6/drivers/pci/pcie/portdrv_core.c
+@@ -238,8 +238,8 @@ static void pcie_device_init(struct pci_
+ device->driver = NULL;
+ device->driver_data = NULL;
+ device->release = release_pcie_device; /* callback to free pcie dev */
+- sprintf(&device->bus_id[0], "pcie%02x",
+- get_descriptor_id(port_type, service_type));
++ snprintf(device->bus_id, sizeof(device->bus_id), "%s:pcie%02x",
++ pci_name(parent), get_descriptor_id(port_type, service_type));
+ device->parent = &parent->dev;
+ }
+