Skip to contentSkip to conversation

PCI Hotplug fixes for 2.4.20-pre10

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

lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 PCI Hotplug fixes for 2.4.20-pre10

Hi,

Here are some small bugfixes for the Compaq and IBM PCI Hotplug drivers.

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

Patches will follow.

thanks,

greg k-h

 drivers/hotplug/cpqphp_core.c |    4 ++-
 drivers/hotplug/cpqphp_pci.c  |    4 +--
 drivers/hotplug/ibmphp_core.c |   47 ++++++++++++++++++++++++++----------------
 3 files changed, 35 insertions(+), 20 deletions(-)

-----

[email protected], 2002-10-10 14:42:18-07:00, [email protected]
IBM PCI Hotplug driver: typo fix for previous patch.

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

------

[email protected], 2002-10-10 14:38:55-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(-)

------

[email protected], 2002-10-10 14:36:51-07:00, [email protected]
[PATCH] Compaq PCI Hotplug bug fix 2

Your patch may fix the issue, but I think there is an easier way. 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.

The attached 2 line patch fixes it for me. I am able to add an Intel NIC on an ML370 G2 and receive interrupts from it.

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

------

[email protected], 2002-10-10 14:36:41-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.

Greg, this should apply to 2.4 and 2.5 if you wouldn't mind submitting it.

Thanks,
Dan

 drivers/hotplug/cpqphp_core.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)

------

author
#1 lore raw

PATCH 1/1 PCI Hotplug fixes for 2.4.20-pre10

# 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.737 -> 1.738
# drivers/hotplug/cpqphp_core.c 1.3 -> 1.4
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/10/10 [email protected] 1.738
# [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.
# 
# Greg, this should apply to 2.4 and 2.5 if you wouldn't
# mind submitting it.
# 
# Thanks,
# Dan
# --------------------------------------------
#
diff -Nru a/drivers/hotplug/cpqphp_core.c b/drivers/hotplug/cpqphp_core.c
--- a/drivers/hotplug/cpqphp_core.c	Thu Oct 10 14:44:44 2002
+++ b/drivers/hotplug/cpqphp_core.c	Thu Oct 10 14:44:44 2002
@@ -1101,6 +1101,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) {
@@ -1129,7 +1132,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,

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.738 -> 1.739
# drivers/hotplug/cpqphp_pci.c 1.1 -> 1.2
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/10/10 [email protected] 1.739
# [PATCH] Compaq PCI Hotplug bug fix 2
#
# Your patch may fix the issue, but I think there is an

# easier way.  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.
# 
# The attached 2 line patch fixes it for me.  I am able to
# add an Intel NIC on an ML370 G2 and receive interrupts from
# it.
# --------------------------------------------
#
diff -Nru a/drivers/hotplug/cpqphp_pci.c b/drivers/hotplug/cpqphp_pci.c
--- a/drivers/hotplug/cpqphp_pci.c	Thu Oct 10 14:44:42 2002
+++ b/drivers/hotplug/cpqphp_pci.c	Thu Oct 10 14:44:42 2002
@@ -358,8 +358,8 @@
 	    dev_num, bus_num, int_pin, irq_num);
 	rc = pcibios_set_irq_routing(&fakedev, int_pin - 0x0a, irq_num);
 	dbg(__FUNCTION__":rc %d\n", 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.739 -> 1.740
# drivers/hotplug/ibmphp_core.c 1.7 -> 1.8
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/10/10 [email protected] 1.740
# [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	Thu Oct 10 14:44:40 2002
+++ b/drivers/hotplug/ibmphp_core.c	Thu Oct 10 14:44:40 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;
@@ -1001,7 +1014,7 @@
struct pci_dev dev_t;
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_t.number = busno;
bus_t.ops = ibmphp_pci_root_ops;

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.740 -> 1.741
# drivers/hotplug/ibmphp_core.c 1.8 -> 1.9
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/10/10 [email protected] 1.741
# IBM PCI Hotplug driver: typo fix for 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);