Skip to contentSkip to conversation

PCI fixes for 2.6.4-rc1

PATCH New Greg KH 1 participant 8 messages Feb 28, 2004

Subsystems (3)
lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 PCI fixes for 2.6.4-rc1

Hi,

Here are some small PCI and PCI hotplug fixes for 2.6.4-rc1. With these patches, the ARM tree should build properly now as well as the shpc driver will not oops.

I _really_ wanted to get the PCI Express support in with this set of patches, but the patch in the -mm tree breaks any box that is in the ACPI quirks table. Then the patches that tried to fix that problem broke all of my boxes (ones without PCI Express and with PCI Express.) So the PCI Express code is not stable enough yet for mainline, unfortunately :(

Good news is I now have hardware to test on, so PCI Express support has a chance to make it into the tree (thanks a lot to Intel for this...)

Please pull from:

	bk://kernel.bkbits.net/gregkh/linux/pci-2.6

thanks,

greg k-h

p.s. I'll send these as patches in response to this email to lkml for those who want to see them.

 drivers/pci/hotplug/Kconfig       |    4 +--
 drivers/pci/hotplug/Makefile      |   37 ++++++++++------------------
 drivers/pci/hotplug/pciehp_ctrl.c |    2 +
 drivers/pci/hotplug/rpaphp.h      |    2 -
 drivers/pci/hotplug/rpaphp_core.c |    4 ---
 drivers/pci/hotplug/shpchp.h      |    4 +--
 drivers/pci/hotplug/shpchp_ctrl.c |    2 +
 drivers/pci/hotplug/shpchp_hpc.c  |   49 ++++++++++++++++++++++----------------
 drivers/pci/pci.c                 |    5 ---
 drivers/pci/probe.c               |    4 +++
 drivers/pci/setup-bus.c           |   22 +++++++----------
 drivers/pci/setup-res.c           |    5 ++-
 include/linux/pci.h               |    2 +
 13 files changed, 71 insertions(+), 71 deletions(-)

-----

<lxiep:ltcfwd.linux.ibm.com>:
o PCI Hotplug: fix rpaphp bugs

<rmk-pci:arm.linux.org.uk>:
o PCI: Introduce bus->bridge_ctl member
o PCI: Don't report pci_request_regions() failure twice
o PCI: Report meaningful error for failed resource allocation

Dely Sy:
o PCI Hotplug: Patch to get polling mode in SHPC hot-plug driver properly working

Greg Kroah-Hartman:
o PCI Hotplug: clean up the Makefile a bit more
o PCI Hotplug: remove unneeded ACPI Makefile rules

author
#1 lore raw

PATCH 1/1 PCI fixes for 2.6.4-rc1

ChangeSet 1.1613, 2004/02/24 11:07:29-08:00, [email protected]

[PATCH] PCI: Report meaningful error for failed resource allocation

pci_assign_resource reports odd messages when resource allocation fails. This is because res->end and res->start are modified by allocate_resource. For example:

PCI: Failed to allocate resource 1(0-ffffffff) for 0000:00:01.0

The following patch reports whether it's an IO or memory resource, and includes the correct size. For consistency, we report it in a similar way to the failure message in pci_request_region(), even though res->start is unlikely to be useful.

 drivers/pci/setup-res.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/pci/setup-res.c +3 -2
diff -Nru a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
@@ -143,8 +143,9 @@
 	}
 
 	if (ret) {
-		printk(KERN_ERR "PCI: Failed to allocate resource %d(%lx-%lx) for %s\n",
-		       resno, res->start, res->end, pci_name(dev));
+		printk(KERN_ERR "PCI: Failed to allocate %s resource #%d:%lx@%lx for %s\n",
+		       res->flags & IORESOURCE_IO ? "I/O" : "mem",
+		       resno, size, res->start, pci_name(dev));
 	} else if (resno < PCI_BRIDGE_RESOURCES) {
 		pci_update_resource(dev, res, resno);
 	}
author
#2 lore raw

ChangeSet 1.1614, 2004/02/24 11:07:43-08:00, [email protected]

[PATCH] PCI: Don't report pci_request_regions() failure twice

pci_request_regions() reports an error when pci_request_region() fails. However, since pci_request_region() already reports an error on failure, pci_request_regions() has some unwanted duplication.

 drivers/pci/pci.c |    5 -----
 1 files changed, 5 deletions(-)
drivers/pci/pci.c +0 -5
diff -Nru a/drivers/pci/pci.c b/drivers/pci/pci.c
@@ -535,11 +535,6 @@
 	return 0;
 
 err_out:
-	printk (KERN_WARNING "PCI: Unable to reserve %s region #%d:%lx@%lx for device %s\n",
-		pci_resource_flags(pdev, i) & IORESOURCE_IO ? "I/O" : "mem",
-		i + 1, /* PCI BAR # */
-		pci_resource_len(pdev, i), pci_resource_start(pdev, i),
-		pci_name(pdev));
 	while(--i >= 0)
 		pci_release_region(pdev, i);
 		
author
#3 lore raw

ChangeSet 1.1615, 2004/02/24 11:07:59-08:00, [email protected]

[PATCH] PCI: Introduce bus->bridge_ctl member

GregKH mentioned confirmed that people have been waiting for this patch. Appologies, it had completely evaporated from my mind.

This patch introduces the "bridge_ctl" member of pci_bus, which allows architectures to tweak the bridge control register (eg, for setting fast back to back modes etc) in pcibios_fixup_bus().

Please note, though, that the value is only written back if pci_setup_bridge() is called. This will be called if an architecture is using the generic PCI bus setup functionality in setup-bus.c. If an architecture doesn't, then it is the responsibility of the architecture to write this value to the bridge as appropriate.

(That said, the bridge control register is only ever changed if an architecture is using setup-bus.c anyway, so there should be no overall functional change.)

 drivers/pci/probe.c     |    4 ++++
 drivers/pci/setup-bus.c |   22 ++++++++++------------
 include/linux/pci.h     |    2 ++
 3 files changed, 16 insertions(+), 12 deletions(-)
drivers/pci/probe.c +4 -0
diff -Nru a/drivers/pci/probe.c b/drivers/pci/probe.c
@@ -366,6 +366,8 @@
 		child = pci_alloc_child_bus(bus, dev, busnr);
 		child->primary = buses & 0xFF;
 		child->subordinate = (buses >> 16) & 0xFF;
+		child->bridge_ctl = bctl;
+
 		cmax = pci_scan_child_bus(child);
 		if (cmax > max) max = cmax;
 	} else {
@@ -400,6 +402,8 @@
 		pci_write_config_dword(dev, PCI_PRIMARY_BUS, buses);
 
 		if (!is_cardbus) {
+			child->bridge_ctl = PCI_BRIDGE_CTL_NO_ISA;
+
 			/* Now we can scan all subordinate buses... */
 			max = pci_scan_child_bus(child);
 		} else {
drivers/pci/setup-bus.c +10 -12
diff -Nru a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
@@ -43,13 +43,15 @@
 #define CARDBUS_IO_SIZE		(4096)
 #define CARDBUS_MEM_SIZE	(32*1024*1024)
 
-static int __devinit
+static void __devinit
 pbus_assign_resources_sorted(struct pci_bus *bus)
 {
 	struct pci_dev *dev;
 	struct resource *res;
 	struct resource_list head, *list, *tmp;
-	int idx, found_vga = 0;
+	int idx;
+
+	bus->bridge_ctl &= ~PCI_BRIDGE_CTL_VGA;
 
 	head.next = NULL;
 	list_for_each_entry(dev, &bus->devices, bus_list) {
@@ -57,7 +59,7 @@
 
 		if (class == PCI_CLASS_DISPLAY_VGA
 				|| class == PCI_CLASS_NOT_DEFINED_VGA)
-			found_vga = 1;
+			bus->bridge_ctl |= PCI_BRIDGE_CTL_VGA;
 
 		pdev_sort_resources(dev, &head);
 	}
@@ -70,8 +72,6 @@
 		list = list->next;
 		kfree(tmp);
 	}
-
-	return found_vga;
 }
 
 static void __devinit
@@ -211,10 +211,7 @@
 	/* Clear out the upper 32 bits of PREF base. */
 	pci_write_config_dword(bridge, PCI_PREF_BASE_UPPER32, 0);
 
-	/* Check if we have VGA behind the bridge.
-	   Enable ISA in either case (FIXME!). */
-	l = (bus->resource[0]->flags & IORESOURCE_BUS_HAS_VGA) ? 0x0c : 0x04;
-	pci_write_config_word(bridge, PCI_BRIDGE_CONTROL, l);
+	pci_write_config_word(bridge, PCI_BRIDGE_CONTROL, bus->bridge_ctl);
 }
 
 /* Check whether the bridge supports optional I/O and
@@ -498,13 +495,14 @@
 pci_bus_assign_resources(struct pci_bus *bus)
 {
 	struct pci_bus *b;
-	int found_vga = pbus_assign_resources_sorted(bus);
 	struct pci_dev *dev;
 
-	if (found_vga) {
+	pbus_assign_resources_sorted(bus);
+
+	if (bus->bridge_ctl & PCI_BRIDGE_CTL_VGA) {
 		/* Propagate presence of the VGA to upstream bridges */
 		for (b = bus; b->parent; b = b->parent) {
-			b->resource[0]->flags |= IORESOURCE_BUS_HAS_VGA;
+			b->bridge_ctl |= PCI_BRIDGE_CTL_VGA;
 		}
 	}
 	list_for_each_entry(dev, &bus->devices, bus_list) {
include/linux/pci.h +2 -0
diff -Nru a/include/linux/pci.h b/include/linux/pci.h
@@ -468,6 +468,8 @@
 
 	char		name[48];
 
+	unsigned short  bridge_ctl;	/* manage NO_ISA/FBB/et al behaviors */
+	unsigned short  pad2;
 	struct device		*bridge;
 	struct class_device	class_dev;
 };
author
#4 lore raw

ChangeSet 1.1616, 2004/02/24 11:08:13-08:00, [email protected]

[PATCH] PCI Hotplug: fix rpaphp bugs

The attached patch has a fix for the conflict between fakephp and rpaphp so that fakephp and rpaphp can't be built into the kernel at the same time and a couple of problems I missed in my previous patch. (Sorry about that).

 drivers/pci/hotplug/Kconfig       |    2 +-
 drivers/pci/hotplug/rpaphp.h      |    2 +-
 drivers/pci/hotplug/rpaphp_core.c |    4 +---
 3 files changed, 3 insertions(+), 5 deletions(-)
drivers/pci/hotplug/Kconfig +1 -1
diff -Nru a/drivers/pci/hotplug/Kconfig b/drivers/pci/hotplug/Kconfig
@@ -191,7 +191,7 @@
 
 config HOTPLUG_PCI_RPA
 	tristate "RPA PCI Hotplug driver"
-	depends on HOTPLUG_PCI && PPC_PSERIES && PPC64
+	depends on HOTPLUG_PCI && PPC_PSERIES && PPC64 && !HOTPLUG_PCI_FAKE
 	help
 	  Say Y here if you have a a RPA system that supports PCI Hotplug.
 
drivers/pci/hotplug/rpaphp.h +1 -1
diff -Nru a/drivers/pci/hotplug/rpaphp.h b/drivers/pci/hotplug/rpaphp.h
@@ -54,7 +54,7 @@
 
 #define dbg(format, arg...)					\
 	do {							\
-		if (rpaphp_debug)				\
+		if (debug)					\
 			printk(KERN_DEBUG "%s: " format,	\
 				MY_NAME , ## arg); 		\
 	} while (0)
drivers/pci/hotplug/rpaphp_core.c +1 -3
diff -Nru a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
@@ -39,7 +39,7 @@
 #include "pci_hotplug.h"
 
 
-static int debug = 1;
+static int debug;
 static struct semaphore rpaphp_sem;
 static LIST_HEAD (rpaphp_slot_head);
 static int num_slots;
@@ -837,8 +837,6 @@
 	int retval = 0;
 
 	info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
-
-	rpaphp_debug = debug;
 
 	/* read all the PRA info from the system */
 	retval = init_rpa();
author
#5 lore raw

ChangeSet 1.1617, 2004/02/24 11:08:29-08:00, [email protected]

[PATCH] PCI Hotplug: Patch to get polling mode in SHPC hot-plug driver properly working

Here is the patch to get polling mode in SHPC hot-plug properly working.

 drivers/pci/hotplug/pciehp_ctrl.c |    2 +
 drivers/pci/hotplug/shpchp.h      |    4 +--
 drivers/pci/hotplug/shpchp_ctrl.c |    2 +
 drivers/pci/hotplug/shpchp_hpc.c  |   49 ++++++++++++++++++++++----------------
 4 files changed, 35 insertions(+), 22 deletions(-)
drivers/pci/hotplug/pciehp_ctrl.c +2 -0
diff -Nru a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
@@ -188,11 +188,13 @@
 		/*
 		 * Card Present
 		 */
+		info("Card present on Slot(%d)\n", ctrl->first_slot + hp_slot);
 		taskInfo->event_type = INT_PRESENCE_ON;
 	} else {
 		/*
 		 * Not Present
 		 */
+		info("Card not present on Slot(%d)\n", ctrl->first_slot + hp_slot);
 		taskInfo->event_type = INT_PRESENCE_OFF;
 	}
 
drivers/pci/hotplug/shpchp.h +2 -2
diff -Nru a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h
@@ -390,8 +390,8 @@
 		/* Sleep for up to 1 second */
 		schedule_timeout(1*HZ);
 	} else {
-		/* Sleep for up to 1.5 second */
-		schedule_timeout(1.5*HZ);
+		/* Sleep for up to 2 seconds */
+		schedule_timeout(2*HZ);
 	}
 	set_current_state(TASK_RUNNING);
 	remove_wait_queue(&ctrl->queue, &wait);
drivers/pci/hotplug/shpchp_ctrl.c +2 -0
diff -Nru a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
@@ -192,11 +192,13 @@
 		/*
 		 * Card Present
 		 */
+		info("Card present on Slot(%d)\n", ctrl->first_slot + hp_slot);
 		taskInfo->event_type = INT_PRESENCE_ON;
 	} else {
 		/*
 		 * Not Present
 		 */
+		info("Card not present on Slot(%d)\n", ctrl->first_slot + hp_slot);
 		taskInfo->event_type = INT_PRESENCE_OFF;
 	}
 
drivers/pci/hotplug/shpchp_hpc.c +29 -20

70 lines not on this page · raw message

author
#6 lore raw

ChangeSet 1.1618, 2004/02/24 14:02:08-08:00, [email protected]

PCI Hotplug: remove unneeded ACPI Makefile rules.

 drivers/pci/hotplug/Makefile |   19 +++++--------------
 1 files changed, 5 insertions(+), 14 deletions(-)
drivers/pci/hotplug/Makefile +5 -14
diff -Nru a/drivers/pci/hotplug/Makefile b/drivers/pci/hotplug/Makefile
@@ -55,13 +55,6 @@
 				shpchp_sysfs.o	\
 				shpchp_hpc.o
 
-ifdef CONFIG_HOTPLUG_PCI_ACPI
-  EXTRA_CFLAGS  += -D_LINUX -I$(TOPDIR)/drivers/acpi
-  ifdef CONFIG_ACPI_DEBUG
-    EXTRA_CFLAGS += -DACPI_DEBUG_OUTPUT
-  endif
-endif
-
 ifeq ($(CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM),y)
 	cpqphp-objs += cpqphp_nvram.o
 endif
@@ -70,16 +63,14 @@
   pciehp-objs += pciehprm_nonacpi.o
 else
   pciehp-objs += pciehprm_acpi.o
-  EXTRA_CFLAGS  += -D_LINUX -I$(TOPDIR)/drivers/acpi -I$(TOPDIR)/drivers/acpi/include 
 endif
 
 ifeq ($(CONFIG_HOTPLUG_PCI_SHPC_PHPRM_LEGACY),y)
   shpchp-objs += shpchprm_legacy.o
 else
-   ifeq ($(CONFIG_HOTPLUG_PCI_SHPC_PHPRM_NONACPI),y)
-     shpchp-objs += shpchprm_nonacpi.o
-   else
-      shpchp-objs += shpchprm_acpi.o
-      EXTRA_CFLAGS  += -D_LINUX -I$(TOPDIR)/drivers/acpi 
-   endif
+  ifeq ($(CONFIG_HOTPLUG_PCI_SHPC_PHPRM_NONACPI),y)
+    shpchp-objs += shpchprm_nonacpi.o
+  else
+    shpchp-objs += shpchprm_acpi.o
+  endif
 endif
author
#7 lore raw

ChangeSet 1.1619, 2004/02/24 14:04:40-08:00, [email protected]

PCI Hotplug: clean up the Makefile a bit more.

Still need to fix up the pcie and shpc options to be saner for distros to use.

 drivers/pci/hotplug/Makefile |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)
drivers/pci/hotplug/Makefile +8 -10
diff -Nru a/drivers/pci/hotplug/Makefile b/drivers/pci/hotplug/Makefile
@@ -25,6 +25,8 @@
 				cpqphp_ctrl.o	\
 				cpqphp_sysfs.o	\
 				cpqphp_pci.o
+cpqphp-$(CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM) += cpqphp_nvram.o
+cpqphp-objs += $(cpqphp-y)
 
 ibmphp-objs		:=	ibmphp_core.o	\
 				ibmphp_ebda.o	\
@@ -49,21 +51,17 @@
 				pciehp_sysfs.o	\
 				pciehp_hpc.o
 
-shpchp-objs		:=	shpchp_core.o	\
-				shpchp_ctrl.o	\
-				shpchp_pci.o	\
-				shpchp_sysfs.o	\
-				shpchp_hpc.o
-
-ifeq ($(CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM),y)
-	cpqphp-objs += cpqphp_nvram.o
-endif
-
 ifeq ($(CONFIG_HOTPLUG_PCI_PCIE_PHPRM_NONACPI),y)
   pciehp-objs += pciehprm_nonacpi.o
 else
   pciehp-objs += pciehprm_acpi.o
 endif
+
+shpchp-objs		:=	shpchp_core.o	\
+				shpchp_ctrl.o	\
+				shpchp_pci.o	\
+				shpchp_sysfs.o	\
+				shpchp_hpc.o
 
 ifeq ($(CONFIG_HOTPLUG_PCI_SHPC_PHPRM_LEGACY),y)
   shpchp-objs += shpchprm_legacy.o