Skip to contentSkip to conversation

PCI hotplug changes for 2.5.34

PATCH In review Greg KH 1 participant 10 messages Sep 9, 2002 PCI

lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 PCI hotplug changes for 2.5.34

This series contains the following things:
- fixes the __FUNCTION__ mess in the Compaq PCI hotplug driver
- changes the pci core to always call /sbin/hotplug when new devices are found
- lots of updates to the IBM PCI hotplug driver from Irene Zubarev to work on older IBM machines (and work better on the current machines)
- fixes to get the drivers working again due to the pci_ops changes.

Pull from: bk://linuxusb.bkbits.net/pci_hp-2.5

thanks,

greg k-h

 drivers/hotplug/cpqphp.h       |   13 
 drivers/hotplug/cpqphp_core.c  |   72 ++--
 drivers/hotplug/cpqphp_ctrl.c  |  181 ++++++-----
 drivers/hotplug/cpqphp_nvram.c |   11 
 drivers/hotplug/cpqphp_pci.c   |  185 ++++++-----
 drivers/hotplug/cpqphp_proc.c  |   10 
 drivers/hotplug/ibmphp.h       |   41 ++
 drivers/hotplug/ibmphp_core.c  |  294 ++++++++++++------
 drivers/hotplug/ibmphp_ebda.c  |  646 +++++++++++++++++++++++++++++++++--------
 drivers/hotplug/ibmphp_hpc.c   |  260 +++++++++++-----
 drivers/hotplug/ibmphp_pci.c   |  268 +++++++++--------
 drivers/hotplug/ibmphp_res.c   |  333 +++++++++++++--------
 drivers/hotplug/pci_hotplug.h  |   15 
 drivers/pci/Makefile           |    4 
 drivers/pci/hotplug.c          |   22 -
 drivers/pci/probe.c            |    7 
 drivers/pci/proc.c             |    9 
 include/linux/pci.h            |    1 
 18 files changed, 1595 insertions(+), 777 deletions(-)

-----

[email protected], 2002-09-09 15:00:49-07:00, [email protected]
IBM PCI Hotplug driver: changed calls to pci_*_nodev() to pci_bus_*()

 drivers/hotplug/ibmphp.h      |    3 
 drivers/hotplug/ibmphp_core.c |   67 +++++++------
 drivers/hotplug/ibmphp_pci.c  |  215 ++++++++++++++++++++++--------------------
 drivers/hotplug/ibmphp_res.c  |   33 +++---
 4 files changed, 175 insertions(+), 143 deletions(-)

------

[email protected], 2002-09-09 14:59:11-07:00, [email protected]
Compaq PCI Hotplug driver: changed calls to pci_*_nodev() to pci_bus_*()

 drivers/hotplug/cpqphp.h       |    6 -
 drivers/hotplug/cpqphp_core.c  |   40 ++++++---
 drivers/hotplug/cpqphp_ctrl.c  |  113 +++++++++++++++-----------
 drivers/hotplug/cpqphp_nvram.c |    9 +-
 drivers/hotplug/cpqphp_pci.c   |  173 ++++++++++++++++++++++-------------------
 drivers/hotplug/cpqphp_proc.c  |   10 +-
 6 files changed, 198 insertions(+), 153 deletions(-)

------

[email protected], 2002-09-09 14:45:40-07:00, [email protected]
PCI Hotplug: remove pci_*_nodev() prototypes as the functions are gone.

The pci_bus_* functions should be used instead.

 drivers/hotplug/pci_hotplug.h |   15 ---------------
 1 files changed, 15 deletions(-)

------

[email protected], 2002-09-09 14:41:48-07:00, [email protected]
PCI: export pci_scan_bus() as the IBM PCI Hotplug driver needs it.

 drivers/pci/probe.c |    1 +
 1 files changed, 1 insertion(+)

------

[email protected], 2002-09-09 14:40:30-07:00, [email protected]
[PATCH] IBM PCI Hotplug driver update for PCI based controllers

 drivers/hotplug/ibmphp.h      |    1 
 drivers/hotplug/ibmphp_core.c |    5 ++
 drivers/hotplug/ibmphp_ebda.c |   71 ++++++++++++++++++++++++++++++++++++++----
 drivers/hotplug/ibmphp_hpc.c  |   26 +++++++++++++++
 4 files changed, 97 insertions(+), 6 deletions(-)

------

[email protected], 2002-09-09 14:39:59-07:00, [email protected]
[PATCH] IBM PCI Hotplug driver update for ISA based controllers

 drivers/hotplug/ibmphp_ebda.c |   13 ++++++++++---
 drivers/hotplug/ibmphp_hpc.c  |   34 ++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 3 deletions(-)

------

[email protected], 2002-09-09 14:38:14-07:00, [email protected]
[PATCH] IBM PCI Hotplug driver update

- fix polling logic
- add ability to write [chassis/rxe]#slot# instead of just slot#

 drivers/hotplug/ibmphp.h      |   37 ++
 drivers/hotplug/ibmphp_core.c |  222 +++++++++++-----
 drivers/hotplug/ibmphp_ebda.c |  562 ++++++++++++++++++++++++++++++++++--------
 drivers/hotplug/ibmphp_hpc.c  |  200 +++++++++-----
 drivers/hotplug/ibmphp_pci.c  |   53 ++-
 drivers/hotplug/ibmphp_res.c  |  300 ++++++++++++++--------
 6 files changed, 992 insertions(+), 382 deletions(-)

------

[email protected], 2002-09-09 14:34:37-07:00, [email protected]
PCI: hotplug core cleanup to get pci hotplug working again

- removed pci_announce_device_to_drivers() prototype as the function is long gone
- always call /sbin/hotplug when pci devices are added to the system if so configured (this includes during the system bring up.)

 drivers/pci/Makefile  |    4 +---
 drivers/pci/hotplug.c |   22 ++++++++++++++--------
 drivers/pci/probe.c   |    6 +++---
 drivers/pci/proc.c    |    9 +++++++++
 include/linux/pci.h   |    1 -
 5 files changed, 27 insertions(+), 15 deletions(-)

------

[email protected], 2002-09-09 14:10:00-07:00, [email protected]
Compaq PCI Hotplug driver: fixed __FUNCTION__ usages

 drivers/hotplug/cpqphp.h       |    7 ++--
 drivers/hotplug/cpqphp_core.c  |   32 +++++++++----------
 drivers/hotplug/cpqphp_ctrl.c  |   68 ++++++++++++++++++++---------------------
 drivers/hotplug/cpqphp_nvram.c |    2 -
 drivers/hotplug/cpqphp_pci.c   |   12 +++----
 5 files changed, 61 insertions(+), 60 deletions(-)

------

author
#1 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.624 -> 1.625
# drivers/hotplug/cpqphp_core.c 1.6 -> 1.7
# drivers/hotplug/cpqphp.h 1.1 -> 1.2
# drivers/hotplug/cpqphp_ctrl.c 1.2 -> 1.3
# drivers/hotplug/cpqphp_nvram.c 1.2 -> 1.3
# drivers/hotplug/cpqphp_pci.c 1.5 -> 1.6
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/09 [email protected] 1.625
# Compaq PCI Hotplug driver: fixed __FUNCTION__ usages
# --------------------------------------------
#

drivers/hotplug/cpqphp.h +4 -3
diff -Nru a/drivers/hotplug/cpqphp.h b/drivers/hotplug/cpqphp.h
@@ -695,7 +695,8 @@
 		return 1;
 
 	hp_slot = slot->device - ctrl->slot_device_offset;
-	dbg(__FUNCTION__": slot->device = %d, ctrl->slot_device_offset = %d \n", slot->device, ctrl->slot_device_offset);
+	dbg("%s: slot->device = %d, ctrl->slot_device_offset = %d \n",
+	    __FUNCTION__, slot->device, ctrl->slot_device_offset);
 
 	status = (readl(ctrl->hpc_reg + INT_INPUT_CLEAR) & (0x01L << hp_slot));
 
@@ -733,7 +734,7 @@
         DECLARE_WAITQUEUE(wait, current);
 	int retval = 0;
 
-	dbg(__FUNCTION__" - start\n");
+	dbg("%s - start\n", __FUNCTION__);
 	add_wait_queue(&ctrl->queue, &wait);
 	set_current_state(TASK_INTERRUPTIBLE);
 	/* Sleep for up to 1 second to wait for the LED to change. */
@@ -743,7 +744,7 @@
 	if (signal_pending(current))
 		retval =  -EINTR;
 
-	dbg(__FUNCTION__" - end\n");
+	dbg("%s - end\n", __FUNCTION__);
 	return retval;
 }
 
drivers/hotplug/cpqphp_core.c +16 -16
diff -Nru a/drivers/hotplug/cpqphp_core.c b/drivers/hotplug/cpqphp_core.c
@@ -314,7 +314,7 @@
 	void *slot_entry= NULL;
 	int result;
 
-	dbg(__FUNCTION__"\n");
+	dbg("%s\n", __FUNCTION__);
 
 	tempdword = readl(ctrl->hpc_reg + INT_INPUT_CLEAR);
 
@@ -476,7 +476,7 @@
 
 	u8 tbus, tdevice, tslot, bridgeSlot;
 
-	dbg(__FUNCTION__" %p, %d, %d, %p\n", ops, bus_num, dev_num, slot);
+	dbg("%s: %p, %d, %d, %p\n", __FUNCTION__, ops, bus_num, dev_num, slot);
 
 	bridgeSlot = 0xFF;
 
@@ -592,7 +592,7 @@
 	if (slot == NULL)
 		return -ENODEV;
 	
-	dbg(__FUNCTION__" - physical_slot = %s\n", hotplug_slot->name);
+	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	ctrl = slot->ctrl;
 	if (ctrl == NULL)
@@ -627,7 +627,7 @@
 	if (slot == NULL)
 		return -ENODEV;
 	
-	dbg(__FUNCTION__" - physical_slot = %s\n", hotplug_slot->name);
+	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	ctrl = slot->ctrl;
 	if (ctrl == NULL)
@@ -667,7 +667,7 @@
 	if (slot == NULL)
 		return -ENODEV;
 	
-	dbg(__FUNCTION__" - physical_slot = %s\n", hotplug_slot->name);
+	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	ctrl = slot->ctrl;
 	if (ctrl == NULL)
@@ -695,7 +695,7 @@
 	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
 	struct controller *ctrl;
 
-	dbg(__FUNCTION__"\n");
+	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	if (slot == NULL)
 		return -ENODEV;
@@ -716,7 +716,7 @@
 	if (slot == NULL)
 		return -ENODEV;
 	
-	dbg(__FUNCTION__" - physical_slot = %s\n", hotplug_slot->name);
+	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	ctrl = slot->ctrl;
 	if (ctrl == NULL)
@@ -734,7 +734,7 @@
 	if (slot == NULL)
 		return -ENODEV;
 	
-	dbg(__FUNCTION__" - physical_slot = %s\n", hotplug_slot->name);
+	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	ctrl = slot->ctrl;
 	if (ctrl == NULL)
@@ -752,7 +752,7 @@
 	if (slot == NULL)
 		return -ENODEV;
 	
-	dbg(__FUNCTION__" - physical_slot = %s\n", hotplug_slot->name);
+	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	ctrl = slot->ctrl;
 	if (ctrl == NULL)
@@ -770,8 +770,8 @@
 	
 	if (slot == NULL)
 		return -ENODEV;
-	
-	dbg(__FUNCTION__" - physical_slot = %s\n", hotplug_slot->name);
+
+	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	ctrl = slot->ctrl;
 	if (ctrl == NULL)
@@ -820,7 +820,7 @@
 		// TODO: This code can be made to support non-Compaq or Intel subsystem IDs
 		rc = pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, &subsystem_vid);
 		if (rc) {
-			err(__FUNCTION__" : pci_read_config_word failed\n");
+			err("%s : pci_read_config_word failed\n", __FUNCTION__);
 			return rc;
 		}
 		dbg("Subsystem Vendor ID: %x\n", subsystem_vid);
@@ -831,14 +831,14 @@
 
 		ctrl = (struct controller *) kmalloc(sizeof(struct controller), GFP_KERNEL);
 		if (!ctrl) {
-			err(__FUNCTION__" : out of memory\n");
+			err("%s : out of memory\n", __FUNCTION__);
 			return -ENOMEM;
 		}
 		memset(ctrl, 0, sizeof(struct controller));
 
 		rc = pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &subsystem_deviceid);
 		if (rc) {
-			err(__FUNCTION__" : pci_read_config_word failed\n");
+			err("%s : pci_read_config_word failed\n", __FUNCTION__);
 			goto err_free_ctrl;
 		}
 
@@ -1053,7 +1053,7 @@
 	// Store PCI Config Space for all devices on this bus
 	rc = cpqhp_save_config(ctrl, ctrl->bus, readb(ctrl->hpc_reg + SLOT_MASK));
 	if (rc) {
-		err(__FUNCTION__": unable to save PCI configuration data, error %d\n", rc);
+		err("%s: unable to save PCI configuration data, error %d\n", __FUNCTION__, rc);
 		goto err_iounmap;
 	}
 
@@ -1080,7 +1080,7 @@
 	rc = ctrl_slot_setup(ctrl, smbios_start, smbios_table);
 	if (rc) {
 		err(msg_initialization_err, 6);
-		err(__FUNCTION__": unable to save PCI configuration data, error %d\n", rc);
+		err("%s: unable to save PCI configuration data, error %d\n", __FUNCTION__, rc);
 		goto err_iounmap;
 	}
 	
drivers/hotplug/cpqphp_ctrl.c +34 -34

191 lines not on this page · raw message

drivers/hotplug/cpqphp_nvram.c +1 -1
diff -Nru a/drivers/hotplug/cpqphp_nvram.c b/drivers/hotplug/cpqphp_nvram.c
@@ -161,7 +161,7 @@
 	    (temp6 == 'Q')) {
 		result = 1;
 	}
-	dbg (__FUNCTION__" - returned %d\n", result);
+	dbg ("%s - returned %d\n", __FUNCTION__, result);
 	return result;
 }
 
drivers/hotplug/cpqphp_pci.c +6 -6
diff -Nru a/drivers/hotplug/cpqphp_pci.c b/drivers/hotplug/cpqphp_pci.c
@@ -140,7 +140,7 @@
 		//We did not even find a hotplug rep of the function, create it
 		//This code might be taken out if we can guarantee the creation of functions
 		//in parallel (hotplug and Linux at the same time).
-		dbg("@@@@@@@@@@@ cpqhp_slot_create in "__FUNCTION__"\n");
+		dbg("@@@@@@@@@@@ cpqhp_slot_create in %s\n", __FUNCTION__);
 		temp_func = cpqhp_slot_create(bus->number);
 		if (temp_func == NULL)
 			return -ENOMEM;
@@ -307,7 +307,7 @@
 	memset(&wrapped_dev, 0, sizeof(struct pci_dev_wrapped));
 	memset(&wrapped_bus, 0, sizeof(struct pci_bus_wrapped));
 
-	dbg(__FUNCTION__": bus/dev/func = %x/%x/%x\n",func->bus, func->device, func->function);
+	dbg("%s: bus/dev/func = %x/%x/%x\n", __FUNCTION__, func->bus, func->device, func->function);
 
 	for (j=0; j<8 ; j++) {
 		struct pci_dev* temp = pci_find_slot(func->bus, (func->device << 3) | j);
@@ -355,10 +355,10 @@
 	fakedev.devfn = dev_num << 3;
 	fakedev.bus = &fakebus;
 	fakebus.number = bus_num;
-	dbg(__FUNCTION__": dev %d, bus %d, pin %d, num %d\n",
-	    dev_num, bus_num, int_pin, irq_num);
+	dbg("%s: dev %d, bus %d, pin %d, num %d\n",
+	    __FUNCTION__, 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);
+	dbg("%s: rc %d\n", __FUNCTION__, rc);
 	if (rc)
 		return rc;
 
@@ -1586,7 +1586,7 @@
 	int rc = 0;
 	struct pci_resource *node;
 	struct pci_resource *t_node;
-	dbg(__FUNCTION__"\n");
+	dbg("%s\n", __FUNCTION__);
 
 	if (!func)
 		return(1);
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.625   -> 1.626  
#	 drivers/pci/probe.c	1.10    -> 1.11   
#	 include/linux/pci.h	1.40    -> 1.41   
#	  drivers/pci/proc.c	1.17    -> 1.18   
#	drivers/pci/Makefile	1.13    -> 1.14   

# drivers/pci/hotplug.c 1.4 -> 1.5
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/09 [email protected] 1.626
# PCI: hotplug core cleanup to get pci hotplug working again
#
# - removed pci_announce_device_to_drivers() prototype as the function is long gone # - always call /sbin/hotplug when pci devices are added to the system if
# so configured (this includes during the system bring up.)
# --------------------------------------------
#

drivers/pci/Makefile +1 -3
diff -Nru a/drivers/pci/Makefile b/drivers/pci/Makefile
@@ -6,10 +6,8 @@
 			probe.o proc.o search.o compat.o
 
 obj-y		+= access.o probe.o pci.o pool.o quirks.o \
-			compat.o names.o pci-driver.o search.o
+			compat.o names.o pci-driver.o search.o hotplug.o
 obj-$(CONFIG_PM)  += power.o
-obj-$(CONFIG_HOTPLUG)  += hotplug.o
-
 obj-$(CONFIG_PROC_FS) += proc.o
 
 ifndef CONFIG_SPARC64
drivers/pci/hotplug.c +14 -8
diff -Nru a/drivers/pci/hotplug.c b/drivers/pci/hotplug.c
@@ -7,8 +7,8 @@
 #define TRUE	(!FALSE)
 #endif
 
-static void
-run_sbin_hotplug(struct pci_dev *pdev, int insert)
+#ifdef CONFIG_HOTPLUG
+static void run_sbin_hotplug(struct pci_dev *pdev, int insert)
 {
 	int i;
 	char *argv[3], *envp[8];
@@ -45,13 +45,18 @@
 
 	call_usermodehelper (argv [0], argv, envp);
 }
+#else
+static void run_sbin_hotplug(struct pci_dev *pdev, int insert) { }
+#endif
 
 /**
- * pci_insert_device - insert a hotplug device
+ * pci_insert_device - insert a pci device
  * @dev: the device to insert
  * @bus: where to insert it
  *
- * Add a new device to the device lists and notify userspace (/sbin/hotplug).
+ * Link the device to both the global PCI device chain and the 
+ * per-bus list of devices, add the /proc entry, and notify
+ * userspace (/sbin/hotplug).
  */
 void
 pci_insert_device(struct pci_dev *dev, struct pci_bus *bus)
@@ -78,11 +83,11 @@
 }
 
 /**
- * pci_remove_device - remove a hotplug device
+ * pci_remove_device - remove a pci device
  * @dev: the device to remove
  *
- * Delete the device structure from the device lists and 
- * notify userspace (/sbin/hotplug).
+ * Delete the device structure from the device lists,
+ * remove the /proc entry, and notify userspace (/sbin/hotplug).
  */
 void
 pci_remove_device(struct pci_dev *dev)
@@ -94,10 +99,11 @@
 #ifdef CONFIG_PROC_FS
 	pci_proc_detach_device(dev);
 #endif
-
 	/* notify userspace of hotplug device removal */
 	run_sbin_hotplug(dev, FALSE);
 }
 
+#ifdef CONFIG_HOTPLUG
 EXPORT_SYMBOL(pci_insert_device);
 EXPORT_SYMBOL(pci_remove_device);
+#endif
drivers/pci/probe.c +3 -3
diff -Nru a/drivers/pci/probe.c b/drivers/pci/probe.c
@@ -479,10 +479,10 @@
 
 		/*
 		 * Link the device to both the global PCI device chain and
-		 * the per-bus list of devices.
+		 * the per-bus list of devices and call /sbin/hotplug if we
+		 * should.
 		 */
-		list_add_tail(&dev->global_list, &pci_devices);
-		list_add_tail(&dev->bus_list, &bus->devices);
+		pci_insert_device (dev, bus);
 
 		/* Fix up broken headers */
 		pci_fixup_device(PCI_FIXUP_HEADER, dev);
drivers/pci/proc.c +9 -0
diff -Nru a/drivers/pci/proc.c b/drivers/pci/proc.c
@@ -18,6 +18,8 @@
 
 #define PCI_CFG_SPACE_SIZE 256
 
+static int proc_initialized;	/* = 0 */
+
 static loff_t
 proc_bus_pci_lseek(struct file *file, loff_t off, int whence)
 {
@@ -410,6 +412,9 @@
 	struct proc_dir_entry *de, *e;
 	char name[16];
 
+	if (!proc_initialized)
+		return -EACCES;
+
 	if (!(de = bus->procdir)) {
 		sprintf(name, "%02x", bus->number);
 		de = bus->procdir = proc_mkdir(name, proc_bus_pci_dir);
@@ -446,6 +451,9 @@
 {
 	struct proc_dir_entry *de = bus->procdir;
 
+	if (!proc_initialized)
+		return -EACCES;
+
 	if (!de) {
 		char name[16];
 		sprintf(name, "%02x", bus->number);
@@ -595,6 +603,7 @@
 		entry = create_proc_entry("devices", 0, proc_bus_pci_dir);
 		if (entry)
 			entry->proc_fops = &proc_bus_pci_dev_operations;
+		proc_initialized = 1;
 		pci_for_each_dev(dev) {
 			pci_proc_attach_device(dev);
 		}
include/linux/pci.h +0 -1
diff -Nru a/include/linux/pci.h b/include/linux/pci.h
@@ -634,7 +634,6 @@
 void pci_remove_device(struct pci_dev *);
 struct pci_driver *pci_dev_driver(const struct pci_dev *);
 const struct pci_device_id *pci_match_device(const struct pci_device_id *ids, const struct pci_dev *dev);
-void pci_announce_device_to_drivers(struct pci_dev *);
 unsigned int pci_do_scan_bus(struct pci_bus *bus);
 struct pci_bus * pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr);
 
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.626 -> 1.627
# drivers/hotplug/ibmphp_pci.c 1.1 -> 1.2
# drivers/hotplug/ibmphp.h 1.2 -> 1.3
# drivers/hotplug/ibmphp_ebda.c 1.3 -> 1.4
# drivers/hotplug/ibmphp_hpc.c 1.5 -> 1.6
# drivers/hotplug/ibmphp_core.c 1.8 -> 1.9
# drivers/hotplug/ibmphp_res.c 1.2 -> 1.3
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/09 [email protected] 1.627
# [PATCH] IBM PCI Hotplug driver update
#
# - fix polling logic
# - add ability to write [chassis/rxe]#slot# instead of just slot# # --------------------------------------------
#

drivers/hotplug/ibmphp.h +31 -6
diff -Nru a/drivers/hotplug/ibmphp.h b/drivers/hotplug/ibmphp.h
@@ -39,7 +39,8 @@
 #else
 	#define MY_NAME THIS_MODULE->name
 #endif
-#define debug(fmt, arg...) do { if (ibmphp_debug) printk(KERN_DEBUG "%s: " fmt , MY_NAME , ## arg); } while (0)
+#define debug(fmt, arg...) do { if (ibmphp_debug == 1) printk(KERN_DEBUG "%s: " fmt , MY_NAME , ## arg); } while (0)
+#define debug_pci(fmt, arg...) do { if (ibmphp_debug) printk(KERN_DEBUG "%s: " fmt , MY_NAME , ## arg); } while (0)
 #define err(format, arg...) printk(KERN_ERR "%s: " format , MY_NAME , ## arg)
 #define info(format, arg...) printk(KERN_INFO "%s: " format , MY_NAME , ## arg)
 #define warn(format, arg...) printk(KERN_WARNING "%s: " format , MY_NAME , ## arg)
@@ -121,6 +122,7 @@
 	u8 port1_port_connect;
 	u8 port2_node_connect;
 	u8 port2_port_connect;
+	u8 chassis_num;
 //	struct list_head scal_detail_list;
 };
 
@@ -139,9 +141,27 @@
 	u8 port1_port_connect;
 	u8 first_slot_num;
 	u8 status;
-//	struct list_head rio_detail_list;
+	u8 wpindex;
+	u8 chassis_num;
+	struct list_head rio_detail_list;
 };
 
+struct opt_rio {
+	u8 rio_type;
+	u8 chassis_num;
+	u8 first_slot_num;
+	u8 middle_num;
+	struct list_head opt_rio_list;
+};	
+
+struct opt_rio_lo {
+	u8 rio_type;
+	u8 chassis_num;
+	u8 first_slot_num;
+	u8 middle_num;
+	u8 pack_count;
+	struct list_head opt_rio_lo_list;
+};	
 
 /****************************************************************
 *  HPC DESCRIPTOR NODE                                          *
@@ -153,7 +173,6 @@
 	short phys_addr;
 //      struct list_head ebda_hpc_list;
 };
-
 /*****************************************************************
 *   IN HPC DATA STRUCTURE, THE ASSOCIATED SLOT AND BUS           *
 *   STRUCTURE                                                    *
@@ -195,6 +214,9 @@
 	u8 i2c_addr;
 };
 
+#define HPC_DEVICE_ID		0x0246
+#define HPC_SUBSYSTEM_ID	0x0247
+#define HPC_PCI_OFFSET		0x40
 /*************************************************************************
 *   RSTC DESCRIPTOR NODE                                                 *
 *************************************************************************/
@@ -215,8 +237,9 @@
 	u8 rsrc_type;
 	u8 bus_num;
 	u8 dev_fun;
-	ulong start_addr;
-	ulong end_addr;
+	u32 start_addr;
+	u32 end_addr;
+	u8 marked;	/* for NVRAM */
 	struct list_head ebda_pci_rsrc_list;
 };
 
@@ -248,7 +271,7 @@
 ***********************************************************/
 extern struct list_head ibmphp_ebda_pci_rsrc_head;
 extern struct list_head ibmphp_slot_head;
-
+extern struct list_head ibmphp_res_head;
 /***********************************************************
 * FUNCTION PROTOTYPES                                      *
 ***********************************************************/
@@ -263,6 +286,7 @@
 extern struct bus_info *ibmphp_find_same_bus_num (u32);
 extern int ibmphp_get_bus_index (u8);
 extern u16 ibmphp_get_total_controllers (void);
+extern int ibmphp_register_pci (void);
 
 /* passed parameters */
 #define MEM		0
@@ -739,6 +763,7 @@
 extern int ibmphp_update_slot_info (struct slot *);	/* This function is called from HPC, so we need it to not be be static */
 extern int ibmphp_configure_card (struct pci_func *, u8);
 extern int ibmphp_unconfigure_card (struct slot **, int);
+extern void ibmphp_increase_count (void);
 extern struct hotplug_slot_ops ibmphp_hotplug_slot_ops;
 
 static inline void long_delay (int delay)
drivers/hotplug/ibmphp_core.c +148 -74

467 lines not on this page · raw message

drivers/hotplug/ibmphp_ebda.c +458 -104

700 lines not on this page · raw message

drivers/hotplug/ibmphp_hpc.c +125 -75

320 lines not on this page · raw message

drivers/hotplug/ibmphp_pci.c +37 -16

93 lines not on this page · raw message

drivers/hotplug/ibmphp_res.c +193 -107

550 lines not on this page · 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.627 -> 1.628
# drivers/hotplug/ibmphp_ebda.c 1.4 -> 1.5
# drivers/hotplug/ibmphp_hpc.c 1.6 -> 1.7
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/09 [email protected] 1.628
# [PATCH] IBM PCI Hotplug driver update for ISA based controllers #
# --------------------------------------------
#

drivers/hotplug/ibmphp_ebda.c +10 -3
diff -Nru a/drivers/hotplug/ibmphp_ebda.c b/drivers/hotplug/ibmphp_ebda.c
@@ -815,6 +815,7 @@
 	struct ebda_hpc_slot *slot_ptr;
 	struct bus_info *bus_info_ptr1, *bus_info_ptr2;
 	int rc;
+	int retval;
 	struct slot *slot_cur;
 	struct list_head *list;
 
@@ -933,6 +934,10 @@
 			case 0:
 				hpc_ptr->u.isa_ctlr.io_start = readw (io_mem + addr);
 				hpc_ptr->u.isa_ctlr.io_end = readw (io_mem + addr + 2);
+				retval = check_region (hpc_ptr->u.isa_ctlr.io_start, (hpc_ptr->u.isa_ctlr.io_end - hpc_ptr->u.isa_ctlr.io_start + 1));
+				if (retval)
+					return -ENODEV;
+				request_region (hpc_ptr->u.isa_ctlr.io_start, (hpc_ptr->u.isa_ctlr.io_end - hpc_ptr->u.isa_ctlr.io_start + 1), "ibmphp");
 				hpc_ptr->irq = readb (io_mem + addr + 4);
 				addr += 5;
 				break;
@@ -949,9 +954,9 @@
 				return -ENODEV;
 		}
 
-		/* following 3 line: Now our driver only supports I2c ctlrType */
-		if ((hpc_ptr->ctlr_type != 2) && (hpc_ptr->ctlr_type != 4)) {
-			err ("Please run this driver on ibm xseries440\n ");
+		/* following 3 line: Now our driver only supports I2c/ISA ctlrType */
+		if ((hpc_ptr->ctlr_type != 2) && (hpc_ptr->ctlr_type != 4) && (hpc_ptr->ctlr_type != 0)) {
+			err ("Please run this driver on IBM xSeries440 or xSeries 235\n ");
 			return -ENODEV;
 		}
 
@@ -1211,6 +1216,8 @@
 
 	list_for_each_safe (list, next, &ebda_hpc_head) {
 		controller = list_entry (list, struct controller, ebda_hpc_list);
+		if (controller->ctlr_type == 0)
+			release_region (controller->u.isa_ctlr.io_start, (controller->u.isa_ctlr.io_end - controller->u.isa_ctlr.io_start + 1));
 		free_ebda_hpc (controller);
 	}
 }
drivers/hotplug/ibmphp_hpc.c +34 -0
diff -Nru a/drivers/hotplug/ibmphp_hpc.c b/drivers/hotplug/ibmphp_hpc.c
@@ -351,10 +351,41 @@
 	return (rc);
 }
 
+//------------------------------------------------------------
+//  Read from ISA type HPC 
+//------------------------------------------------------------
+static u8 isa_ctrl_read (struct controller *ctlr_ptr, u8 offset)
+{
+	u16 start_address;
+	u16 end_address;
+	u8 data;
+
+	start_address = ctlr_ptr->u.isa_ctlr.io_start;
+	end_address = ctlr_ptr->u.isa_ctlr.io_end;
+	data = inb (start_address + offset);
+	return data;
+}
+
+//--------------------------------------------------------------
+// Write to ISA type HPC
+//--------------------------------------------------------------
+static void isa_ctrl_write (struct controller *ctlr_ptr, u8 offset, u8 data)
+{
+	u16 start_address;
+	u16 port_address;
+	
+	start_address = ctlr_ptr->u.isa_ctlr.io_start;
+	port_address = start_address + (u16) offset;
+	outb (data, port_address);
+}
+
 static u8 ctrl_read (struct controller *ctlr, void *base, u8 offset)
 {
 	u8 rc;
 	switch (ctlr->ctlr_type) {
+	case 0:
+		rc = isa_ctrl_read (ctlr, offset);
+		break;
 	case 2:
 	case 4:
 		rc = i2c_ctrl_read (ctlr, base, offset);
@@ -369,6 +400,9 @@
 {
 	u8 rc = 0;
 	switch (ctlr->ctlr_type) {
+	case 0:
+		isa_ctrl_write(ctlr, offset, data);
+		break;
 	case 2:
 	case 4:
 		rc = i2c_ctrl_write(ctlr, base, offset, data);
author
#5 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.628 -> 1.629
# drivers/hotplug/ibmphp.h 1.3 -> 1.4
# drivers/hotplug/ibmphp_ebda.c 1.5 -> 1.6
# drivers/hotplug/ibmphp_hpc.c 1.7 -> 1.8
# drivers/hotplug/ibmphp_core.c 1.9 -> 1.10
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/09 [email protected] 1.629
# [PATCH] IBM PCI Hotplug driver update for PCI based controllers #
# --------------------------------------------
#

drivers/hotplug/ibmphp.h +1 -0
diff -Nru a/drivers/hotplug/ibmphp.h b/drivers/hotplug/ibmphp.h
@@ -737,6 +737,7 @@
 struct controller {
 	struct ebda_hpc_slot *slots;
 	struct ebda_hpc_bus *buses;
+	struct pci_dev *ctrl_dev; /* in case where controller is PCI */
 	u8 starting_slot_num;	/* starting and ending slot #'s this ctrl controls*/
 	u8 ending_slot_num;
 	u8 revision;
drivers/hotplug/ibmphp_core.c +5 -0
diff -Nru a/drivers/hotplug/ibmphp_core.c b/drivers/hotplug/ibmphp_core.c
@@ -1636,6 +1636,11 @@
 
 	max_slots = get_max_slots ();
 	
+	if ((rc = ibmphp_register_pci ())) {
+		ibmphp_unload ();
+		return rc;
+	}
+
 	if (init_ops ()) {
 		ibmphp_unload ();
 		return -ENODEV;
drivers/hotplug/ibmphp_ebda.c +65 -6

109 lines not on this page · raw message

drivers/hotplug/ibmphp_hpc.c +26 -0
diff -Nru a/drivers/hotplug/ibmphp_hpc.c b/drivers/hotplug/ibmphp_hpc.c
@@ -379,6 +379,26 @@
 	outb (data, port_address);
 }
 
+static u8 pci_ctrl_read (struct controller *ctrl, u8 offset)
+{
+	u8 data = 0x00;
+	debug ("inside pci_ctrl_read\n");
+	if (ctrl->ctrl_dev)
+		pci_read_config_byte (ctrl->ctrl_dev, HPC_PCI_OFFSET + offset, &data);
+	return data;
+}
+
+static u8 pci_ctrl_write (struct controller *ctrl, u8 offset, u8 data)
+{
+	u8 rc = -ENODEV;
+	debug ("inside pci_ctrl_write\n");
+	if (ctrl->ctrl_dev) {
+		pci_write_config_byte (ctrl->ctrl_dev, HPC_PCI_OFFSET + offset, data);
+		rc = 0;
+	}
+	return rc;
+}
+
 static u8 ctrl_read (struct controller *ctlr, void *base, u8 offset)
 {
 	u8 rc;
@@ -386,6 +406,9 @@
 	case 0:
 		rc = isa_ctrl_read (ctlr, offset);
 		break;
+	case 1:
+		rc = pci_ctrl_read (ctlr, offset);
+		break;
 	case 2:
 	case 4:
 		rc = i2c_ctrl_read (ctlr, base, offset);
@@ -402,6 +425,9 @@
 	switch (ctlr->ctlr_type) {
 	case 0:
 		isa_ctrl_write(ctlr, offset, data);
+		break;
+	case 1:
+		rc = pci_ctrl_write (ctlr, offset, data);
 		break;
 	case 2:
 	case 4:
author
#6 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.629 -> 1.630
# drivers/pci/probe.c 1.11 -> 1.12
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/09 [email protected] 1.630
# PCI: export pci_scan_bus() as the IBM PCI Hotplug driver needs it. # --------------------------------------------
#

drivers/pci/probe.c +1 -0
diff -Nru a/drivers/pci/probe.c b/drivers/pci/probe.c
@@ -594,4 +594,5 @@
 EXPORT_SYMBOL(pci_add_new_bus);
 EXPORT_SYMBOL(pci_do_scan_bus);
 EXPORT_SYMBOL(pci_scan_slot);
+EXPORT_SYMBOL(pci_scan_bus);
 #endif
author
#7 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.630 -> 1.631
# drivers/hotplug/pci_hotplug.h 1.1 -> 1.2
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/09 [email protected] 1.631
# PCI Hotplug: remove pci_*_nodev() prototypes as the functions are gone. #
# The pci_bus_* functions should be used instead.
# --------------------------------------------
#

drivers/hotplug/pci_hotplug.h +0 -15
diff -Nru a/drivers/hotplug/pci_hotplug.h b/drivers/hotplug/pci_hotplug.h
@@ -141,20 +141,5 @@
 				 struct pci_dev_wrapped *wrapped_dev,
 				 struct pci_bus_wrapped *wrapped_parent);
 
-extern int pci_read_config_byte_nodev	(struct pci_ops *ops, u8 bus, u8 device,
-					 u8 function, int where, u8 *val);
-extern int pci_read_config_word_nodev	(struct pci_ops *ops, u8 bus, u8 device,
-					 u8 function, int where, u16 *val);
-extern int pci_read_config_dword_nodev	(struct pci_ops *ops, u8 bus, u8 device,
-					 u8 function, int where, u32 *val);
-
-extern int pci_write_config_byte_nodev	(struct pci_ops *ops, u8 bus, u8 device,
-					 u8 function, int where, u8 val);
-extern int pci_write_config_word_nodev	(struct pci_ops *ops, u8 bus, u8 device,
-					 u8 function, int where, u16 val);
-extern int pci_write_config_dword_nodev	(struct pci_ops *ops, u8 bus, u8 device,
-					 u8 function, int where, u32 val);
-
-
 #endif
 
author
#8 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.631 -> 1.632
# drivers/hotplug/cpqphp_core.c 1.7 -> 1.8
# drivers/hotplug/cpqphp.h 1.2 -> 1.3
# drivers/hotplug/cpqphp_ctrl.c 1.3 -> 1.4
# drivers/hotplug/cpqphp_nvram.c 1.3 -> 1.4
# drivers/hotplug/cpqphp_pci.c 1.6 -> 1.7
# drivers/hotplug/cpqphp_proc.c 1.3 -> 1.4
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/09 [email protected] 1.632
# Compaq PCI Hotplug driver: changed calls to pci_*_nodev() to pci_bus_*() # --------------------------------------------
#

drivers/hotplug/cpqphp.h +2 -4
diff -Nru a/drivers/hotplug/cpqphp.h b/drivers/hotplug/cpqphp.h
@@ -292,16 +292,14 @@
 	struct pci_resource *io_head;
 	struct pci_resource *bus_head;
 	struct pci_dev *pci_dev;
-	struct pci_ops *pci_ops;
+	struct pci_bus *pci_bus;
 	struct proc_dir_entry* proc_entry;
 	struct proc_dir_entry* proc_entry2;
 	struct event_info event_queue[10];
 	struct slot *slot;
 	u8 next_event;
 	u8 interrupt;
-	u8 bus;
-	u8 device;
-	u8 function;
+	u8 bus;				/* bus number for the pci hotplug controller */
 	u8 rev;
 	u8 slot_device_offset;
 	u8 first_slot;
drivers/hotplug/cpqphp_core.c +26 -14
diff -Nru a/drivers/hotplug/cpqphp_core.c b/drivers/hotplug/cpqphp_core.c
@@ -467,7 +467,7 @@
 //
 // Output:	SUCCESS or FAILURE
 //=============================================================================
-static int get_slot_mapping (struct pci_ops *ops, u8 bus_num, u8 dev_num, u8 *slot)
+static int get_slot_mapping (struct pci_bus *bus, u8 bus_num, u8 dev_num, u8 *slot)
 {
 	struct irq_routing_table *PCIIRQRoutingInfoLength;
 	u32 work;
@@ -476,7 +476,7 @@
 
 	u8 tbus, tdevice, tslot, bridgeSlot;
 
-	dbg("%s: %p, %d, %d, %p\n", __FUNCTION__, ops, bus_num, dev_num, slot);
+	dbg("%s: %p, %d, %d, %p\n", __FUNCTION__, bus, bus_num, dev_num, slot);
 
 	bridgeSlot = 0xFF;
 
@@ -490,7 +490,6 @@
 		return -1;
 	}
 
-
 	for (loop = 0; loop < len; ++loop) {
 		tbus = PCIIRQRoutingInfoLength->slots[loop].bus;
 		tdevice = PCIIRQRoutingInfoLength->slots[loop].devfn >> 3;
@@ -499,7 +498,8 @@
 		if ((tbus == bus_num) && (tdevice == dev_num)) {
 			*slot = tslot;
 
-			if (PCIIRQRoutingInfoLength != NULL) kfree(PCIIRQRoutingInfoLength );
+			if (PCIIRQRoutingInfoLength != NULL)
+				kfree(PCIIRQRoutingInfoLength);
 			return 0;
 		} else {
 			// Didn't get a match on the target PCI device. Check if the
@@ -508,10 +508,11 @@
 			// device, I need to save the bridge's slot number.  If I can't 
 			// find an entry for the target device, I will have to assume it's 
 			// on the other side of the bridge, and assign it the bridge's slot.
-			pci_read_config_dword_nodev (ops, tbus, tdevice, 0, PCI_REVISION_ID, &work);
+			bus->number = tbus;
+			pci_bus_read_config_dword (bus, PCI_DEVFN(tdevice, 0), PCI_REVISION_ID, &work);
 
 			if ((work >> 8) == PCI_TO_PCI_BRIDGE_CLASS) {
-				pci_read_config_dword_nodev (ops, tbus, tdevice, 0, PCI_PRIMARY_BUS, &work);
+				pci_bus_read_config_dword (bus, PCI_DEVFN(tdevice, 0), PCI_PRIMARY_BUS, &work);
 				// See if bridge's secondary bus matches target bus.
 				if (((work >> 8) & 0x000000FF) == (long) bus_num) {
 					bridgeSlot = tslot;
@@ -521,7 +522,6 @@
 
 	}
 
-
 	// If we got here, we didn't find an entry in the IRQ mapping table 
 	// for the target PCI device.  If we did determine that the target 
 	// device is on the other side of a PCI-to-PCI bridge, return the 
@@ -991,12 +991,20 @@
 	dbg ("    pcix_support           %s\n", ctrl->pcix_support == 0 ? "not supported" : "supported");
 
 	ctrl->pci_dev = pdev;
-	ctrl->pci_ops = pdev->bus->ops;
+
+	/* make our own copy of the pci bus structure, as we like tweaking it a lot */
+	ctrl->pci_bus = kmalloc (sizeof (*ctrl->pci_bus), GFP_KERNEL);
+	if (!ctrl->pci_bus) {
+		err("out of memory\n");
+		rc = -ENOMEM;
+		goto err_free_ctrl;
+	}
+	memcpy (ctrl->pci_bus, pdev->bus, sizeof (*ctrl->pci_bus));
+
 	ctrl->bus = pdev->bus->number;
-	ctrl->device = PCI_SLOT(pdev->devfn);
-	ctrl->function = PCI_FUNC(pdev->devfn);
 	ctrl->rev = rev;
-	dbg("bus device function rev: %d %d %d %d\n", ctrl->bus, ctrl->device, ctrl->function, ctrl->rev);
+	dbg("bus device function rev: %d %d %d %d\n", ctrl->bus,
+	     PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), ctrl->rev);
 
 	init_MUTEX(&ctrl->crit_sect);
 	init_waitqueue_head(&ctrl->queue);
@@ -1004,7 +1012,7 @@
 	/* initialize our threads if they haven't already been started up */
 	rc = one_time_init();
 	if (rc) {
-		goto err_free_ctrl;
+		goto err_free_bus;
 	}
 	
 	dbg("pdev = %p\n", pdev);
@@ -1015,7 +1023,7 @@
 				pci_resource_len(pdev, 0), MY_NAME)) {
 		err("cannot reserve MMIO region\n");
 		rc = -ENOMEM;
-		goto err_free_ctrl;
+		goto err_free_bus;
 	}
 
 	ctrl->hpc_reg = ioremap(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0));
@@ -1043,7 +1051,7 @@
 	// in this case it will always be called for the "base"
 	// bus/dev/func of a slot.
 	// CS: this is leveraging the PCIIRQ routing code from the kernel (pci-pc.c: get_irq_routing_table)
-	rc = get_slot_mapping(ctrl->pci_ops, pdev->bus->number, (readb(ctrl->hpc_reg + SLOT_MASK) >> 4), &(ctrl->first_slot));
+	rc = get_slot_mapping(ctrl->pci_bus, pdev->bus->number, (readb(ctrl->hpc_reg + SLOT_MASK) >> 4), &(ctrl->first_slot));
 	dbg("get_slot_mapping: first_slot = %d, returned = %d\n", ctrl->first_slot, rc);
 	if (rc) {
 		err(msg_initialization_err, rc);
@@ -1188,6 +1196,8 @@
 	iounmap(ctrl->hpc_reg);
 err_free_mem_region:
 	release_mem_region(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0));
+err_free_bus:
+	kfree(ctrl->pci_bus);
 err_free_ctrl:
 	kfree(ctrl);
 	return rc;
@@ -1327,6 +1337,8 @@
 			res = res->next;
 			kfree(tres);
 		}
+
+		kfree (ctrl->pci_bus);
 
 		tctrl = ctrl;
 		ctrl = ctrl->next;
drivers/hotplug/cpqphp_ctrl.c +64 -49

359 lines not on this page · raw message

drivers/hotplug/cpqphp_nvram.c +5 -4
diff -Nru a/drivers/hotplug/cpqphp_nvram.c b/drivers/hotplug/cpqphp_nvram.c
@@ -286,12 +286,12 @@
 			return(rc);
 
 		// The device Number
-		rc = add_byte( &pFill, ctrl->device, &usedbytes, &available);
+		rc = add_byte( &pFill, PCI_SLOT(ctrl->pci_dev->devfn), &usedbytes, &available);
 		if (rc)
 			return(rc);
 
 		// The function Number
-		rc = add_byte( &pFill, ctrl->function, &usedbytes, &available);
+		rc = add_byte( &pFill, PCI_FUNC(ctrl->pci_dev->devfn), &usedbytes, &available);
 		if (rc)
 			return(rc);
 
@@ -479,8 +479,9 @@
 		device = p_ev_ctrl->device;
 		function = p_ev_ctrl->function;
 
-		while ((bus != ctrl->bus) || (device != ctrl->device)
-		       || (function != ctrl->function)) {
+		while ((bus != ctrl->bus) ||
+		       (device != PCI_SLOT(ctrl->pci_dev->devfn)) || 
+		       (function != PCI_FUNC(ctrl->pci_dev->devfn))) {
 			nummem = p_ev_ctrl->mem_avail;
 			numpmem = p_ev_ctrl->p_mem_avail;
 			numio = p_ev_ctrl->io_avail;
drivers/hotplug/cpqphp_pci.c +95 -78

467 lines not on this page · raw message

drivers/hotplug/cpqphp_proc.c +6 -4
diff -Nru a/drivers/hotplug/cpqphp_proc.c b/drivers/hotplug/cpqphp_proc.c
@@ -53,8 +53,9 @@
 	*eof = 1;
 
 	out += sprintf(out, "hot plug ctrl Info Page\n");
-	out += sprintf(out, "bus = %d, device = %d, function = %d\n",ctrl->bus,
-		       ctrl->device, ctrl->function);
+	out += sprintf(out, "bus = %d, device = %d, function = %d\n",
+		       ctrl->bus, PCI_SLOT(ctrl->pci_dev->devfn),
+		       PCI_FUNC(ctrl->pci_dev->devfn));
 	out += sprintf(out, "Free resources: memory\n");
 	index = 11;
 	res = ctrl->mem_head;
@@ -104,8 +105,9 @@
 	*eof = 1;
 
 	out += sprintf(out, "hot plug ctrl Info Page\n");
-	out += sprintf(out, "bus = %d, device = %d, function = %d\n",ctrl->bus,
-		       ctrl->device, ctrl->function);
+	out += sprintf(out, "bus = %d, device = %d, function = %d\n",
+		       ctrl->bus, PCI_SLOT(ctrl->pci_dev->devfn),
+		       PCI_FUNC(ctrl->pci_dev->devfn));
 
 	slot=ctrl->slot;
 
author
#9 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.632 -> 1.633
# drivers/hotplug/ibmphp_pci.c 1.2 -> 1.3
# drivers/hotplug/ibmphp.h 1.4 -> 1.5
# drivers/hotplug/ibmphp_core.c 1.10 -> 1.11
# drivers/hotplug/ibmphp_res.c 1.3 -> 1.4
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/09 [email protected] 1.633
# IBM PCI Hotplug driver: changed calls to pci_*_nodev() to pci_bus_*() # --------------------------------------------
#

drivers/hotplug/ibmphp.h +1 -2
diff -Nru a/drivers/hotplug/ibmphp.h b/drivers/hotplug/ibmphp.h
@@ -693,7 +693,7 @@
 #define PCIX66		0x05
 #define PCI66		0x04
 
-extern struct pci_ops *ibmphp_pci_root_ops;
+extern struct pci_bus *ibmphp_pci_bus;
 
 /* Variables */
 
@@ -764,7 +764,6 @@
 extern int ibmphp_update_slot_info (struct slot *);	/* This function is called from HPC, so we need it to not be be static */
 extern int ibmphp_configure_card (struct pci_func *, u8);
 extern int ibmphp_unconfigure_card (struct slot **, int);
-extern void ibmphp_increase_count (void);
 extern struct hotplug_slot_ops ibmphp_hotplug_slot_ops;
 
 static inline void long_delay (int delay)
drivers/hotplug/ibmphp_core.c +40 -27

112 lines not on this page · raw message

drivers/hotplug/ibmphp_pci.c +116 -99

519 lines not on this page · raw message

drivers/hotplug/ibmphp_res.c +18 -15
diff -Nru a/drivers/hotplug/ibmphp_res.c b/drivers/hotplug/ibmphp_res.c
@@ -1932,7 +1932,7 @@
  */
 static int __init update_bridge_ranges (struct bus_node **bus)
 {
-	u8 sec_busno, device, function, busno, hdr_type, start_io_address, end_io_address;
+	u8 sec_busno, device, function, hdr_type, start_io_address, end_io_address;
 	u16 vendor_id, upper_io_start, upper_io_end, start_mem_address, end_mem_address;
 	u32 start_address, end_address, upper_start, upper_end;
 	struct bus_node *bus_sec;
@@ -1941,21 +1941,24 @@
 	struct resource_node *mem;
 	struct resource_node *pfmem;
 	struct range_node *range;
+	unsigned int devfn;
+
 	bus_cur = *bus;
 	if (!bus_cur)
 		return -ENODEV;
-	busno = bus_cur->busno;
+	ibmphp_pci_bus->number = bus_cur->busno;
 
 	debug ("inside %s \n", __FUNCTION__);
 	debug ("bus_cur->busno = %x\n", bus_cur->busno);
 
 	for (device = 0; device < 32; device++) {
 		for (function = 0x00; function < 0x08; function++) {
-			pci_read_config_word_nodev (ibmphp_pci_root_ops, busno, device, function, PCI_VENDOR_ID, &vendor_id);
+			devfn = PCI_DEVFN(device, function);
+			pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_VENDOR_ID, &vendor_id);
 
 			if (vendor_id != PCI_VENDOR_ID_NOTVALID) {
 				/* found correct device!!! */
-				pci_read_config_byte_nodev (ibmphp_pci_root_ops, busno, device, function, PCI_HEADER_TYPE, &hdr_type);
+				pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_HEADER_TYPE, &hdr_type);
 
 				switch (hdr_type) {
 					case PCI_HEADER_TYPE_NORMAL:
@@ -1974,7 +1977,7 @@
 						   temp++;
 						   }
 						 */
-						pci_read_config_byte_nodev (ibmphp_pci_root_ops, busno, device, function, PCI_SECONDARY_BUS, &sec_busno);
+						pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, &sec_busno);
 						bus_sec = find_bus_wprev (sec_busno, NULL, 0); 
 						/* this bus structure doesn't exist yet, PPB was configured during previous loading of ibmphp */
 						if (!bus_sec) {
@@ -1982,10 +1985,10 @@
 							/* the rest will be populated during NVRAM call */
 							return 0;
 						}
-						pci_read_config_byte_nodev (ibmphp_pci_root_ops, busno, device, function, PCI_IO_BASE, &start_io_address);
-						pci_read_config_byte_nodev (ibmphp_pci_root_ops, busno, device, function, PCI_IO_LIMIT, &end_io_address);
-						pci_read_config_word_nodev (ibmphp_pci_root_ops, busno, device, function, PCI_IO_BASE_UPPER16, &upper_io_start);
-						pci_read_config_word_nodev (ibmphp_pci_root_ops, busno, device, function, PCI_IO_LIMIT_UPPER16, &upper_io_end);
+						pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_IO_BASE, &start_io_address);
+						pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_IO_LIMIT, &end_io_address);
+						pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_IO_BASE_UPPER16, &upper_io_start);
+						pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_IO_LIMIT_UPPER16, &upper_io_end);
 						start_address = (start_io_address & PCI_IO_RANGE_MASK) << 8;
 						start_address |= (upper_io_start << 16);
 						end_address = (end_io_address & PCI_IO_RANGE_MASK) << 8;
@@ -2035,8 +2038,8 @@
 							}
 						}	
 
-						pci_read_config_word_nodev (ibmphp_pci_root_ops, busno, device, function, PCI_MEMORY_BASE, &start_mem_address);
-						pci_read_config_word_nodev (ibmphp_pci_root_ops, busno, device, function, PCI_MEMORY_LIMIT, &end_mem_address);
+						pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_MEMORY_BASE, &start_mem_address);
+						pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_MEMORY_LIMIT, &end_mem_address);
 
 						start_address = 0x00000000 | (start_mem_address & PCI_MEMORY_RANGE_MASK) << 16;
 						end_address = 0x00000000 | (end_mem_address & PCI_MEMORY_RANGE_MASK) << 16;
@@ -2086,10 +2089,10 @@
 								ibmphp_add_resource (mem);
 							}
 						}
-						pci_read_config_word_nodev (ibmphp_pci_root_ops, busno, device, function, PCI_PREF_MEMORY_BASE, &start_mem_address);
-						pci_read_config_word_nodev (ibmphp_pci_root_ops, busno, device, function, PCI_PREF_MEMORY_LIMIT, &end_mem_address);
-						pci_read_config_dword_nodev (ibmphp_pci_root_ops, busno, device, function, PCI_PREF_BASE_UPPER32, &upper_start);
-						pci_read_config_dword_nodev (ibmphp_pci_root_ops, busno, device, function, PCI_PREF_LIMIT_UPPER32, &upper_end);
+						pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_BASE, &start_mem_address);
+						pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, &end_mem_address);
+						pci_bus_read_config_dword (ibmphp_pci_bus, devfn, PCI_PREF_BASE_UPPER32, &upper_start);
+						pci_bus_read_config_dword (ibmphp_pci_bus, devfn, PCI_PREF_LIMIT_UPPER32, &upper_end);
 						start_address = 0x00000000 | (start_mem_address & PCI_MEMORY_RANGE_MASK) << 16;
 						end_address = 0x00000000 | (end_mem_address & PCI_MEMORY_RANGE_MASK) << 16;
 #if BITS_PER_LONG == 64