aboutsummaryrefslogtreecommitdiffstats
path: root/pci
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2006-05-01 22:15:01 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2006-05-01 22:15:01 -0700
commit2cdd2bd9854b9b39cc785426f77e7e71622a9a16 (patch)
tree1a109591c0edbb5ec4171d75f0e623c3f674b6b7 /pci
parentd657a97eecfd1352a8550a8b3194a06b293610a7 (diff)
downloadpatches-2cdd2bd9854b9b39cc785426f77e7e71622a9a16.tar.gz
pci patches
Diffstat (limited to 'pci')
-rw-r--r--pci/pci-acpi-rename-the-functions-to-avoid-multiple-instances.patch68
-rw-r--r--pci/pci-add-a-enable-sysfs-attribute-to-the-pci-devices-to-allow-userspace-to-enable-devices-without-doing-foul-direct-access.patch71
-rw-r--r--pci/pci-add-pci_assign_resource_fixed-allow-fixed-address-assignments.patch40
-rw-r--r--pci/pci-don-t-enable-device-if-already-enabled.patch36
4 files changed, 193 insertions, 22 deletions
diff --git a/pci/pci-acpi-rename-the-functions-to-avoid-multiple-instances.patch b/pci/pci-acpi-rename-the-functions-to-avoid-multiple-instances.patch
new file mode 100644
index 0000000000000..7c5fe1411650e
--- /dev/null
+++ b/pci/pci-acpi-rename-the-functions-to-avoid-multiple-instances.patch
@@ -0,0 +1,68 @@
+From muthu.lkml@gmail.com Fri Apr 28 00:42:24 2006
+Message-ID: <7da560840604280042q33450573p9b21751c9046500c@mail.gmail.com>
+Date: Fri, 28 Apr 2006 00:42:21 -0700
+From: "Muthu Kumar" <muthu.lkml@gmail.com>
+To: "Greg KH" <greg@kroah.com>
+Subject: PCI ACPI: Rename the functions to avoid multiple instances.
+Content-Disposition: inline
+
+There were two instances of pci_acpi_init(), one in
+drivers/pci/pci-acpi.c and another in arch/i386/pci/acpi.c.
+Rename the one in pci-acpi.c and make it consistent with
+other names in the same file.
+
+Signed-off-by: Muthukumar R <muthur@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/pci/pci-acpi.c | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+--- gregkh-2.6.orig/drivers/pci/pci-acpi.c
++++ gregkh-2.6/drivers/pci/pci-acpi.c
+@@ -257,7 +257,7 @@ static int acpi_pci_set_power_state(stru
+
+
+ /* ACPI bus type */
+-static int pci_acpi_find_device(struct device *dev, acpi_handle *handle)
++static int acpi_pci_find_device(struct device *dev, acpi_handle *handle)
+ {
+ struct pci_dev * pci_dev;
+ acpi_integer addr;
+@@ -271,7 +271,7 @@ static int pci_acpi_find_device(struct d
+ return 0;
+ }
+
+-static int pci_acpi_find_root_bridge(struct device *dev, acpi_handle *handle)
++static int acpi_pci_find_root_bridge(struct device *dev, acpi_handle *handle)
+ {
+ int num;
+ unsigned int seg, bus;
+@@ -289,21 +289,21 @@ static int pci_acpi_find_root_bridge(str
+ return 0;
+ }
+
+-static struct acpi_bus_type pci_acpi_bus = {
++static struct acpi_bus_type acpi_pci_bus = {
+ .bus = &pci_bus_type,
+- .find_device = pci_acpi_find_device,
+- .find_bridge = pci_acpi_find_root_bridge,
++ .find_device = acpi_pci_find_device,
++ .find_bridge = acpi_pci_find_root_bridge,
+ };
+
+-static int __init pci_acpi_init(void)
++static int __init acpi_pci_init(void)
+ {
+ int ret;
+
+- ret = register_acpi_bus_type(&pci_acpi_bus);
++ ret = register_acpi_bus_type(&acpi_pci_bus);
+ if (ret)
+ return 0;
+ platform_pci_choose_state = acpi_pci_choose_state;
+ platform_pci_set_power_state = acpi_pci_set_power_state;
+ return 0;
+ }
+-arch_initcall(pci_acpi_init);
++arch_initcall(acpi_pci_init);
diff --git a/pci/pci-add-a-enable-sysfs-attribute-to-the-pci-devices-to-allow-userspace-to-enable-devices-without-doing-foul-direct-access.patch b/pci/pci-add-a-enable-sysfs-attribute-to-the-pci-devices-to-allow-userspace-to-enable-devices-without-doing-foul-direct-access.patch
new file mode 100644
index 0000000000000..e9dd33f0e744e
--- /dev/null
+++ b/pci/pci-add-a-enable-sysfs-attribute-to-the-pci-devices-to-allow-userspace-to-enable-devices-without-doing-foul-direct-access.patch
@@ -0,0 +1,71 @@
+From arjan@linux.intel.com Sat Apr 29 01:59:16 2006
+From: Arjan van de Ven <arjan@linux.intel.com>
+Subject: PCI: Add a "enable" sysfs attribute to the pci devices to allow userspace (Xorg) to enable devices without doing foul direct access
+To: Andrew Morton <akpm@osdl.org>
+Cc: greg@kroah.com, airlied@linux.ie, pjones@redhat.com
+Date: Sat, 29 Apr 2006 10:59:08 +0200
+Message-Id: <1146301148.3125.7.camel@laptopd505.fenrus.org>
+
+
+This patch adds an "enable" sysfs attribute to each PCI device. When read it
+shows the "enabled-ness" of the device, but you can write a "0" into it to
+disable a device, and a "1" to enable it.
+
+This later is needed for X and other cases where userspace wants to enable
+the BARs on a device (typical example: to run the video bios on a secundary
+head). Right now X does all this "by hand" via bitbanging, that's just evil.
+This allows X to no longer do that but to just let the kernel do this.
+
+Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
+CC: Peter Jones <pjones@redhat.com>
+Acked-by: Dave Airlie <airlied@linux.ie>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/pci/pci-sysfs.c | 21 +++++++++++++++++++++
+ 1 file changed, 21 insertions(+)
+
+--- gregkh-2.6.orig/drivers/pci/pci-sysfs.c
++++ gregkh-2.6/drivers/pci/pci-sysfs.c
+@@ -43,6 +43,7 @@ pci_config_attr(subsystem_vendor, "0x%04
+ pci_config_attr(subsystem_device, "0x%04x\n");
+ pci_config_attr(class, "0x%06x\n");
+ pci_config_attr(irq, "%u\n");
++pci_config_attr(is_enabled, "%u\n");
+
+ static ssize_t local_cpus_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+@@ -90,6 +91,25 @@ static ssize_t modalias_show(struct devi
+ (u8)(pci_dev->class >> 16), (u8)(pci_dev->class >> 8),
+ (u8)(pci_dev->class));
+ }
++static ssize_t
++is_enabled_store(struct device *dev, struct device_attribute *attr,
++ const char *buf, size_t count)
++{
++ struct pci_dev *pdev = to_pci_dev(dev);
++
++ /* this can crash the machine when done on the "wrong" device */
++ if (!capable(CAP_SYS_ADMIN))
++ return count;
++
++ if (*buf == '0')
++ pci_disable_device(pdev);
++
++ if (*buf == '1')
++ pci_enable_device(pdev);
++
++ return count;
++}
++
+
+ struct device_attribute pci_dev_attrs[] = {
+ __ATTR_RO(resource),
+@@ -101,6 +121,7 @@ struct device_attribute pci_dev_attrs[]
+ __ATTR_RO(irq),
+ __ATTR_RO(local_cpus),
+ __ATTR_RO(modalias),
++ __ATTR(enable, 0600, is_enabled_show, is_enabled_store),
+ __ATTR_NULL,
+ };
+
diff --git a/pci/pci-add-pci_assign_resource_fixed-allow-fixed-address-assignments.patch b/pci/pci-add-pci_assign_resource_fixed-allow-fixed-address-assignments.patch
index dee90be0b29d1..f1e00c3d9a06d 100644
--- a/pci/pci-add-pci_assign_resource_fixed-allow-fixed-address-assignments.patch
+++ b/pci/pci-add-pci_assign_resource_fixed-allow-fixed-address-assignments.patch
@@ -1,9 +1,12 @@
-From galak@kernel.crashing.org Thu Apr 27 10:46:44 2006
-Date: Thu, 27 Apr 2006 12:43:31 -0500 (CDT)
+From owner-linux-pci@atrey.karlin.mff.cuni.cz Mon May 1 08:47:15 2006
+Date: Mon, 1 May 2006 10:43:46 -0500 (CDT)
From: Kumar Gala <galak@kernel.crashing.org>
-To: Greg KH <greg@kroah.com>, Andrew Morton <akpm@osdl.org>
+To: Andrew Morton <akpm@osdl.org>
+Cc: greg@kroah.com
Subject: PCI: Add pci_assign_resource_fixed -- allow fixed address assignments
-Message-ID: <Pine.LNX.4.44.0604271242410.25641-100000@gate.crashing.org>
+Message-ID: <Pine.LNX.4.44.0605011043270.11156-100000@gate.crashing.org>
+
+PCI: Add pci_assign_resource_fixed -- allow fixed address assignments
On some embedded systems the PCI address for hotplug devices are not only
known a priori but are required to be at a given PCI address for other
@@ -20,28 +23,17 @@ Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
----
- drivers/pci/pci.c | 1 +
- drivers/pci/setup-res.c | 35 +++++++++++++++++++++++++++++++++++
+ drivers/pci/setup-res.c | 40 ++++++++++++++++++++++++++++++++++++++++
include/linux/pci.h | 1 +
- 3 files changed, 37 insertions(+)
+ 2 files changed, 41 insertions(+)
---- gregkh-2.6.orig/drivers/pci/pci.c
-+++ gregkh-2.6/drivers/pci/pci.c
-@@ -995,6 +995,7 @@ EXPORT_SYMBOL_GPL(pci_intx);
- EXPORT_SYMBOL(pci_set_dma_mask);
- EXPORT_SYMBOL(pci_set_consistent_dma_mask);
- EXPORT_SYMBOL(pci_assign_resource);
-+EXPORT_SYMBOL(pci_assign_resource_fixed);
- EXPORT_SYMBOL(pci_find_parent_resource);
- EXPORT_SYMBOL(pci_select_bars);
-
--- gregkh-2.6.orig/drivers/pci/setup-res.c
+++ gregkh-2.6/drivers/pci/setup-res.c
-@@ -160,6 +160,41 @@ int pci_assign_resource(struct pci_dev *
+@@ -160,6 +160,46 @@ int pci_assign_resource(struct pci_dev *
return ret;
}
++#ifdef CONFIG_EMBEDDED
+int pci_assign_resource_fixed(struct pci_dev *dev, int resno)
+{
+ struct pci_bus *bus = dev->bus;
@@ -67,15 +59,19 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+ }
+
+ if (ret) {
-+ printk(KERN_ERR "PCI: Failed to allocate %s resource #%d:%lx@%lx for %s\n",
-+ res->flags & IORESOURCE_IO ? "I/O" : "mem",
-+ resno, res->end - res->start + 1, res->start, pci_name(dev));
++ printk(KERN_ERR "PCI: Failed to allocate %s resource "
++ "#%d:%llx@%llx for %s\n",
++ res->flags & IORESOURCE_IO ? "I/O" : "mem",
++ resno, (unsigned long long)(res->end - res->start + 1),
++ (unsigned long long)res->start, pci_name(dev));
+ } else if (resno < PCI_BRIDGE_RESOURCES) {
+ pci_update_resource(dev, res, resno);
+ }
+
+ return ret;
+}
++EXPORT_SYMBOL_GPL(pci_assign_resource_fixed);
++#endif
+
/* Sort resources by alignment */
void __devinit
diff --git a/pci/pci-don-t-enable-device-if-already-enabled.patch b/pci/pci-don-t-enable-device-if-already-enabled.patch
new file mode 100644
index 0000000000000..acd105be6ea7f
--- /dev/null
+++ b/pci/pci-don-t-enable-device-if-already-enabled.patch
@@ -0,0 +1,36 @@
+From owner-linux-pci@atrey.karlin.mff.cuni.cz Fri Apr 28 11:28:26 2006
+From: Kristen Accardi <kristen.c.accardi@intel.com>
+Subject: PCI: don't enable device if already enabled
+Cc: arjan@linux.intel.com, greg@kroah.com
+Date: Fri, 28 Apr 2006 11:37:38 -0700
+Message-Id: <1146249458.25490.12.camel@whizzy>
+
+If a device is already enabled, don't bother reenabling it.
+
+Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
+Acked-By: Arjan van de Ven <arjan@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+
+---
+ drivers/pci/pci.c | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+--- gregkh-2.6.orig/drivers/pci/pci.c
++++ gregkh-2.6/drivers/pci/pci.c
+@@ -521,10 +521,11 @@ pci_enable_device_bars(struct pci_dev *d
+ int
+ pci_enable_device(struct pci_dev *dev)
+ {
+- int err = pci_enable_device_bars(dev, (1 << PCI_NUM_RESOURCES) - 1);
+- if (err)
+- return err;
+- return 0;
++ int err = 0;
++
++ if (!dev->is_enabled)
++ err = pci_enable_device_bars(dev, (1 << PCI_NUM_RESOURCES) - 1);
++ return err;
+ }
+
+ /**