Skip to contentSkip to conversation

PCI hotplug changes for 2.5.41

PATCH New Greg KH 1 participant 5 messages Oct 9, 2002

lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 PCI hotplug changes for 2.5.41

Here are some PCI hotplug changes for 2.5.41.

Please pull from: bk://linuxusb.bkbits.net/pci_hp-2.5

thanks,

greg k-h

 drivers/hotplug/Config.help    |   11 
 drivers/hotplug/Config.in      |    1 
 drivers/hotplug/Makefile       |   13 
 drivers/hotplug/acpiphp.h      |  263 +++++++
 drivers/hotplug/acpiphp_core.c |  502 ++++++++++++++
 drivers/hotplug/acpiphp_glue.c | 1463 +++++++++++++++++++++++++++++++++++++++++
 drivers/hotplug/acpiphp_pci.c  |  692 +++++++++++++++++++
 drivers/hotplug/acpiphp_res.c  |  699 +++++++++++++++++++
 drivers/hotplug/cpqphp_core.c  |    4 
 drivers/hotplug/cpqphp_pci.c   |    4 
 drivers/hotplug/ibmphp_core.c  |   47 -
 11 files changed, 3679 insertions(+), 20 deletions(-)

-----

[email protected], 2002-10-09 15:30:59-07:00, [email protected]
IBM PCI Hotplug: fix typos in previous patch

 drivers/hotplug/ibmphp_core.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

------

[email protected], 2002-10-09 15:07:57-07:00, [email protected]
[PATCH] ACPI PCI hotplug driver for 2.5

 drivers/hotplug/Config.help    |   11 
 drivers/hotplug/Config.in      |    1 
 drivers/hotplug/Makefile       |   13 
 drivers/hotplug/acpiphp.h      |  263 +++++++
 drivers/hotplug/acpiphp_core.c |  502 ++++++++++++++
 drivers/hotplug/acpiphp_glue.c | 1463 +++++++++++++++++++++++++++++++++++++++++
 drivers/hotplug/acpiphp_pci.c  |  692 +++++++++++++++++++
 drivers/hotplug/acpiphp_res.c  |  699 +++++++++++++++++++
 8 files changed, 3644 insertions(+)

------

[email protected], 2002-10-09 15:03:36-07:00, [email protected]
[PATCH] Compaq PCI Hotplug bug fix

Found the bug. The following patch fixes the hot plug driver so that it has a fallback when there are no unused IRQs on a system. At some point intialization got re- ordered and this was broken.

I found another bug that was preventing the existing scheme from working. It looks like the function "pcibios_set_irq_routing" is returning 1 for success, but the hot plug driver was interpreting it as failure.

 drivers/hotplug/cpqphp_core.c |    4 +++-
 drivers/hotplug/cpqphp_pci.c  |    4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

------

[email protected], 2002-10-09 15:02:46-07:00, [email protected]
[PATCH] IBM PCI Hotplug: small patch

This is a small patch on top of what you sent out to the kernel already. I basically uncommented out another place, where we call pci_hp_change_info and changed to the new method. And also, when I sent you those (polling, isa, pci...) patches sometime back, I made a mistake when I was translating the code from the way RPM is to the way we want in the kernel (since in RPM we cannot have option to compile kernel).

 drivers/hotplug/ibmphp_core.c |   43 +++++++++++++++++++++++++++---------------
 1 files changed, 28 insertions(+), 15 deletions(-)

------

author
#1 lore raw

PATCH 1/1 PCI hotplug changes for 2.5.41

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.740 -> 1.741
# drivers/hotplug/ibmphp_core.c 1.12 -> 1.13
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/10/09 [email protected] 1.741
# [PATCH] IBM PCI Hotplug: small patch
#
# This is a small patch on top of what you sent out to the kernel

# already.  I basically uncommented out another place, where we call
# pci_hp_change_info and changed to the new method.  And also, when I sent
# you those (polling, isa, pci...) patches sometime back, I made a mistake
# when I was translating the code from the way RPM is to the way we want in
# the kernel (since in RPM we cannot have option to compile kernel).
# --------------------------------------------
#
diff -Nru a/drivers/hotplug/ibmphp_core.c b/drivers/hotplug/ibmphp_core.c
--- a/drivers/hotplug/ibmphp_core.c	Wed Oct  9 15:37:50 2002
+++ b/drivers/hotplug/ibmphp_core.c	Wed Oct  9 15:37:50 2002
@@ -686,9 +686,10 @@
 int ibmphp_update_slot_info (struct slot *slot_cur)
 {
 	struct hotplug_slot_info *info;
-	char buffer[10];
+	char buffer[30];
 	int rc;
-//	u8 bus_speed;
+	u8 bus_speed;
+	u8 mode;

info = kmalloc (sizeof (struct hotplug_slot_info), GFP_KERNEL); if (!info) {
@@ -696,7 +697,7 @@
return -ENOMEM;
}

- snprintf (buffer, 10, "%d", slot_cur->number);
+ strncpy (buffer, slot_cur->hotplug_slot->name, 30);
info->power_status = SLOT_PWRGD (slot_cur->status); info->attention_status = SLOT_ATTN (slot_cur->status, slot_cur->ext_status); info->latch_status = SLOT_LATCH (slot_cur->status);
@@ -707,21 +708,33 @@

                 info->adapter_status = 1;

// get_max_adapter_speed_1 (slot_cur->hotplug_slot, &info->max_adapter_speed_status, 0);
}
- /* !!!!!!!!!TO DO: THIS NEEDS TO CHANGE!!!!!!!!!!!!! */
-/* bus_speed = slot_cur->bus_on->current_speed;
- bus_speed &= 0x0f;
-
- if (slot_cur->bus_on->current_bus_mode == BUS_MODE_PCIX)
- bus_speed |= 0x80;
- else if (slot_cur->bus_on->current_bus_mode == BUS_MODE_PCI)
- bus_speed |= 0x40;
- else
- bus_speed |= 0x20;
+
+ bus_speed = slot_cur->bus_on->current_speed;
+ mode = slot_cur->bus_on->current_bus_mode;
+
+ switch (bus_speed) {
+ case BUS_SPEED_33:
+ break;
+ case BUS_SPEED_66:
+ if (mode == BUS_MODE_PCIX)
+ bus_speed += 0x01;
+ else if (mode == BUS_MODE_PCI)
+ ;
+ else
+ bus_speed = PCI_SPEED_UNKNOWN;
+ break;
+ case BUS_SPEED_100:
+ case BUS_SPEED_133:
+ bus_speed += 0x01;
+ break;
+ default:
+ bus_speed = PCI_SPEED_UNKNOWN;
+ }

info->cur_bus_speed_status = bus_speed;
info->max_bus_speed_status = slot_cur->hotplug_slot->info->max_bus_speed_status; // To do: bus_names
-*/
+
rc = pci_hp_change_slot_info (buffer, info);
kfree (info);
return rc;
@@ -989,7 +1002,7 @@
struct pci_dev *dev;
u16 l;

- if (!find_bus (busno) || !(ibmphp_find_same_bus_num (busno)))
+ if (find_bus (busno) || !(ibmphp_find_same_bus_num (busno)))
return 1;

bus = kmalloc (sizeof (*bus), GFP_KERNEL);

author
#2 lore raw

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.741 -> 1.742
# drivers/hotplug/cpqphp_core.c 1.10 -> 1.11
# drivers/hotplug/cpqphp_pci.c 1.8 -> 1.9
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/10/09 [email protected] 1.742
# [PATCH] Compaq PCI Hotplug bug fix
#
# Found the bug. The following patch fixes the hot plug

# driver so that it has a fallback when there are no unused
# IRQs on a system.  At some point intialization got re-
# ordered and this was broken.
# 
# I found another bug that was preventing the existing scheme from
# working.  It looks like the function "pcibios_set_irq_routing" is
# returning 1 for success, but the hot plug driver was interpreting it as
# failure.
# --------------------------------------------
#
diff -Nru a/drivers/hotplug/cpqphp_core.c b/drivers/hotplug/cpqphp_core.c
--- a/drivers/hotplug/cpqphp_core.c	Wed Oct  9 15:37:40 2002
+++ b/drivers/hotplug/cpqphp_core.c	Wed Oct  9 15:37:40 2002
@@ -1110,6 +1110,9 @@
 	/*
 	 * Get IO, memory, and IRQ resources for new devices
 	 */
+	// The next line is required for cpqhp_find_available_resources
+	ctrl->interrupt = pdev->irq;
+
 	rc = cpqhp_find_available_resources(ctrl, cpqhp_rom_start);
 	ctrl->add_support = !rc;
 	if (rc) {
@@ -1138,7 +1141,6 @@
 	writel(0xFFFFFFFFL, ctrl->hpc_reg + INT_MASK);

/* set up the interrupt */
- ctrl->interrupt = pdev->irq;
dbg("HPC interrupt = %d \n", ctrl->interrupt);
if (request_irq(ctrl->interrupt,
(void (*)(int, void *, struct pt_regs *)) &cpqhp_ctrl_intr,

drivers/hotplug/cpqphp_pci.c +2 -2
diff -Nru a/drivers/hotplug/cpqphp_pci.c b/drivers/hotplug/cpqphp_pci.c
@@ -360,8 +360,8 @@
 	    __FUNCTION__, dev_num, bus_num, int_pin, irq_num);
 	rc = pcibios_set_irq_routing(&fakedev, int_pin - 0x0a, irq_num);
 	dbg("%s: rc %d\n", __FUNCTION__, rc);
-	if (rc)
-		return rc;
+	if (!rc)
+		return !rc;
 
 	// set the Edge Level Control Register (ELCR)
 	temp_word = inb(0x4d0);
author
#3 lore raw

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.742 -> 1.743
# drivers/hotplug/Makefile 1.5 -> 1.6
# drivers/hotplug/Config.in 1.3 -> 1.4
# drivers/hotplug/Config.help 1.2 -> 1.3

#	               (new)	        -> 1.1     drivers/hotplug/acpiphp_pci.c
#	               (new)	        -> 1.1     drivers/hotplug/acpiphp_glue.c
#	               (new)	        -> 1.1     drivers/hotplug/acpiphp_res.c
#	               (new)	        -> 1.1     drivers/hotplug/acpiphp_core.c
#	               (new)	        -> 1.1     drivers/hotplug/acpiphp.h

#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/10/09 [email protected] 1.743
# [PATCH] ACPI PCI hotplug driver for 2.5
#
# --------------------------------------------
#

drivers/hotplug/Config.help +11 -0
diff -Nru a/drivers/hotplug/Config.help b/drivers/hotplug/Config.help
@@ -40,3 +40,14 @@
 
   When in doubt, say N.
 
+CONFIG_HOTPLUG_PCI_ACPI
+  Say Y here if you have a system that supports PCI Hotplug using
+  ACPI.
+
+  This code is also available as a module ( = code which can be
+  inserted in and removed from the running kernel whenever you want).
+  The module will be called acpiphp.o. If you want to compile it
+  as a module, say M here and read <file:Documentation/modules.txt>.
+
+  When in doubt, say N.
+
drivers/hotplug/Config.in +1 -0
diff -Nru a/drivers/hotplug/Config.in b/drivers/hotplug/Config.in
@@ -11,5 +11,6 @@
 if [ "$CONFIG_X86_IO_APIC" = "y" ]; then
    dep_tristate '  IBM PCI Hotplug driver' CONFIG_HOTPLUG_PCI_IBM $CONFIG_HOTPLUG_PCI $CONFIG_X86_IO_APIC $CONFIG_X86
 fi
+dep_tristate '  ACPI PCI Hotplug driver' CONFIG_HOTPLUG_PCI_ACPI $CONFIG_APCI $CONFIG_HOTPLUG_PCI
 
 endmenu
drivers/hotplug/Makefile +13 -0
diff -Nru a/drivers/hotplug/Makefile b/drivers/hotplug/Makefile
@@ -7,6 +7,7 @@
 obj-$(CONFIG_HOTPLUG_PCI)		+= pci_hotplug.o
 obj-$(CONFIG_HOTPLUG_PCI_COMPAQ)	+= cpqphp.o
 obj-$(CONFIG_HOTPLUG_PCI_IBM)		+= ibmphp.o
+obj-$(CONFIG_HOTPLUG_PCI_ACPI)		+= acpiphp.o
 
 pci_hotplug-objs	:=	pci_hotplug_core.o	\
 				pci_hotplug_util.o
@@ -21,6 +22,18 @@
 				ibmphp_pci.o	\
 				ibmphp_res.o	\
 				ibmphp_hpc.o
+
+acpiphp-objs		:=	acpiphp_core.o	\
+				acpiphp_glue.o	\
+				acpiphp_pci.o	\
+				acpiphp_res.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
drivers/hotplug/acpiphp.h new file +263 -0

263 lines not on this page · raw message

drivers/hotplug/acpiphp_core.c new file +502 -0

502 lines not on this page · raw message

drivers/hotplug/acpiphp_glue.c new file +1463 -0

1,463 lines not on this page · raw message

drivers/hotplug/acpiphp_pci.c new file +692 -0

692 lines not on this page · raw message

drivers/hotplug/acpiphp_res.c new file +699 -0

35 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

author
#4 lore raw

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.743 -> 1.744
# drivers/hotplug/ibmphp_core.c 1.13 -> 1.14
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/10/09 [email protected] 1.744
# IBM PCI Hotplug: fix typos in previous patch
# --------------------------------------------
#

drivers/hotplug/ibmphp_core.c +2 -2
diff -Nru a/drivers/hotplug/ibmphp_core.c b/drivers/hotplug/ibmphp_core.c
@@ -731,8 +731,8 @@
 		bus_speed = PCI_SPEED_UNKNOWN;
 	}
 
-	info->cur_bus_speed_status = bus_speed;
-	info->max_bus_speed_status = slot_cur->hotplug_slot->info->max_bus_speed_status;
+	info->cur_bus_speed = bus_speed;
+	info->max_bus_speed = slot_cur->hotplug_slot->info->max_bus_speed;
 	// To do: bus_names 
 	
 	rc = pci_hp_change_slot_info (buffer, info);