More PCI fixes for 2.5.73
Subsystems (5)
PATCH 1/1 More PCI fixes for 2.5.73
Hi,
Here's some PCI fixes that are against the latest 2.5.73 bk tree. They fix some PCI domain issues in the core and acpi, a reference count bug in the PCI Hotplug core, and a fix for a character driver I broke with one of the older PCI reference count patches.
I've also added a "fake" pci hotplug driver that might be useful for some people to test their PCI drivers with, if they don't have access to any PCI hotplug hardware.
Please pull from:
bk://kernel.bkbits.net/gregkh/linux/pci-2.5
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.
Documentation/pci.txt | 37 +++-- arch/i386/pci/acpi.c | 10 + arch/ia64/pci/pci.c | 14 - drivers/acpi/pci_root.c | 4 drivers/char/ip2main.c | 60 ++++---- drivers/pci/Makefile | 9 - drivers/pci/hotplug/Kconfig | 25 +++ drivers/pci/hotplug/Makefile | 1 drivers/pci/hotplug/fakephp.c | 232 +++++++++++++++++++++++++++++++++ drivers/pci/hotplug/ibmphp_hpc.c | 61 ++++---- drivers/pci/hotplug/ibmphp_res.c | 4 drivers/pci/hotplug/pci_hotplug.h | 4 drivers/pci/hotplug/pci_hotplug_core.c | 22 +-- drivers/pci/probe.c | 34 ++-- include/acpi/acpi_drivers.h | 4 include/asm-ia64/pci.h | 1 17 files changed, 399 insertions(+), 123 deletions(-)
-----
Eduardo Pereira Habkost:
o Fix compilation of ip2main
Greg Kroah-Hartman:
o PCI Hotplug: add fake PCI hotplug driver
o IBM PCI Hotplug: fixes found by sparse
o PCI Hotplug: fix core problem with kobject lifespans
Matthew Wilcox:
o PCI: fixes for pci/probe.c
o PCI: more PCI gubbins
o PCI documentation
o PCI: [PATCH] pcibios_scan_acpi()
PATCH 1/1 More PCI fixes for 2.5.73
ChangeSet 1.1429.2.1, 2003/06/24 15:09:07-07:00, [email protected]
[PATCH] Fix compilation of ip2main
The following patch fix compilation of drivers/char/ip2main.c. It was broken by the removal of pci_present().
It just adds open and closing braces around the code that declares the pci_dev_i variable. The rest of the patch just change the indentation.
drivers/char/ip2main.c | 60 +++++++++++++++++++++++++------------------------ 1 files changed, 31 insertions(+), 29 deletions(-)
drivers/char/ip2main.c +31 -29
@@ -707,40 +707,42 @@ } }#else /* LINUX_VERSION_CODE > 2.1.99 */ -struct pci_dev *pci_dev_i =NULL ; - pci_dev_i =pci_find_device (PCI_VENDOR_ID_COMPUTONE , -PCI_DEVICE_ID_COMPUTONE_IP2EX , pci_dev_i); -if (pci_dev_i !=NULL ) { -unsigned int addr; -unsigned char pci_irq; + { +struct pci_dev *pci_dev_i =NULL ; + pci_dev_i =pci_find_device (PCI_VENDOR_ID_COMPUTONE , +PCI_DEVICE_ID_COMPUTONE_IP2EX , pci_dev_i); +if (pci_dev_i !=NULL ) { +unsigned int addr; +unsigned char pci_irq; - ip2config.type[i] =PCI ; - status = -pci_read_config_dword (pci_dev_i,PCI_BASE_ADDRESS_1 , &addr); -if ( addr &1 ) { - ip2config.addr[i]=(USHORT )(addr&0xfffe ); - }else { -printk (KERN_ERR "IP2: PCI I/O address error\n" ); - } - status = -pci_read_config_byte (pci_dev_i,PCI_INTERRUPT_LINE , &pci_irq); + ip2config.type[i] =PCI ; + status = +pci_read_config_dword (pci_dev_i,PCI_BASE_ADDRESS_1 , &addr); +if ( addr &1 ) { + ip2config.addr[i]=(USHORT )(addr&0xfffe ); + }else { +printk (KERN_ERR "IP2: PCI I/O address error\n" ); + } + status = +pci_read_config_byte (pci_dev_i,PCI_INTERRUPT_LINE , &pci_irq);// If the PCI BIOS assigned it, lets try and use it. If we // can't acquire it or it screws up, deal with it then. -// if (!is_valid_irq(pci_irq)) { -// printk( KERN_ERR "IP2: Bad PCI BIOS IRQ(%d)\n",pci_irq); -// pci_irq = 0; -// } - ip2config.irq[i] = pci_irq; - }else {// ann error - ip2config.addr[i] =0 ; -if (status ==PCIBIOS_DEVICE_NOT_FOUND ) { -printk (KERN_ERR "IP2: PCI board %d not found\n" , i ); - }else { -pcibios_strerror (status); - } - } +// if (!is_valid_irq(pci_irq)) { +// printk( KERN_ERR "IP2: Bad PCI BIOS IRQ(%d)\n",pci_irq); +// pci_irq = 0; +// } + ip2config.irq[i] = pci_irq; + }else {// ann error + ip2config.addr[i] =0 ; +if (status ==PCIBIOS_DEVICE_NOT_FOUND ) { +printk (KERN_ERR "IP2: PCI board %d not found\n" , i ); + }else { +pcibios_strerror (status); + } + } + }#endif /* ! 2_0_X */ #else printk (KERN_ERR "IP2: PCI card specified but PCI support not\n" );
ChangeSet 1.1429.2.2, 2003/06/24 15:09:40-07:00, [email protected]
[PATCH] PCI: [PATCH] pcibios_scan_acpi()
Quoted 3 lines · Greg KH
Quoted 1 line
How about
acpi_scan_pci_bus_root()?I agree, that sounds better.
I think it's too long ... so unless anyone has a better idea, I'm going with pci_acpi_scan_root(). Here's the patch, presented in patch -p1 format to make greg's scripts happy ;-)
ia64 needs to be passed the pci domain and the acpi handle corresponding to each root bus. Rather than change pcibios_scan_root to take additional arguments, this patch introduces pci_acpi_scan_root().
arch/i386/pci/acpi.c | 10 ++++++++++ arch/ia64/pci/pci.c | 14 +++++++------- drivers/acpi/pci_root.c | 4 +--- include/acpi/acpi_drivers.h | 4 ++++ include/asm-ia64/pci.h | 1 - 5 files changed, 22 insertions(+), 11 deletions(-)
arch/i386/pci/acpi.c +10 -0
@@ -3,6 +3,16 @@#include <linux/init.h> #include "pci.h" +struct pci_bus *__devinit pci_acpi_scan_root (struct acpi_device *device,int domain,int busnum) +{ +if (domain !=0 ) { +printk (KERN_WARNING "PCI: Multiple domains not supported\n" ); +return NULL ; + } + +return pcibios_scan_root (busnum); +} +static int __init pci_acpi_init (void ) {if (pcibios_scanned)
arch/ia64/pci/pci.c +7 -7
@@ -284,21 +284,21 @@ }struct pci_bus * -pcibios_scan_root (void *handle,int seg,int bus) +pci_acpi_scan_root (struct acpi_device *device,int domain,int bus) {struct pci_root_info info;struct pci_controller *controller;unsigned int windows =0 ;char *name; -printk ("PCI: Probing PCI hardware on bus (%02x:%02x)\n" , seg, bus); - controller =alloc_pci_controller (seg); +printk ("PCI: Probing PCI hardware on bus (%04x:%02x)\n" , domain, bus); + controller =alloc_pci_controller (domain);if (!controller) goto out1; - controller->acpi_handle = handle; + controller->acpi_handle = device->handle; -acpi_walk_resources (handle,METHOD_NAME__CRS , count_window, &windows); +acpi_walk_resources (device->handle,METHOD_NAME__CRS , count_window, &windows); controller->window =kmalloc (sizeof (*controller->window) * windows,GFP_KERNEL );if (!controller->window) goto out2;
@@ -307,10 +307,10 @@if (!name) goto out3; -sprintf (name,"PCI Bus %02x:%02x" , seg, bus); +sprintf (name,"PCI Bus %04x:%02x" , domain, bus); info.controller = controller; info.name = name; -acpi_walk_resources (handle,METHOD_NAME__CRS , add_window, &info); +acpi_walk_resources (device->handle,METHOD_NAME__CRS , add_window, &info);return scan_root_bus (bus, &pci_root_ops, controller);
drivers/acpi/pci_root.c +1 -3
@@ -246,8 +246,6 @@switch (status) {case AE_OK : root->id.segment = (u16 ) value; -printk ("_SEG exists! Unsupported. Abort.\n" ); -BUG ();break ;case AE_NOT_FOUND : ACPI_DEBUG_PRINT((ACPI_DB_INFO,
@@ -309,7 +307,7 @@* PCI namespace does not get created until this call is made (and * thus the root bridge's pci_dev does not exist). */ - root->bus =pcibios_scan_root (root->id.bus); + root->bus =pci_acpi_scan_root (device, root->id.segment, root->id.bus);if (!root->bus) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Bus %02x:%02x not present in PCI namespace\n",
include/acpi/acpi_drivers.h +4 -0
@@ -73,6 +73,10 @@int acpi_pci_bind (struct acpi_device *device);int acpi_pci_bind_root (struct acpi_device *device,struct acpi_pci_id *id,struct pci_bus *bus); +/* Arch-defined function to add a bus to the system */ + +struct pci_bus *pci_acpi_scan_root (struct acpi_device *device,int domain,int bus); +#endif /*CONFIG_ACPI_PCI*/
include/asm-ia64/pci.h +0 -1
@@ -21,7 +21,6 @@#define PCIBIOS_MIN_MEM 0x10000000void pcibios_config_init (void ); -struct pci_bus *pcibios_scan_root (void *acpi_handle,int segment,int bus);struct pci_dev ;
ChangeSet 1.1429.2.3, 2003/06/24 15:40:24-07:00, [email protected]
[PATCH] PCI documentation
Update the PCI Documentation to reflect some of the functions which have recently been added and removed.
Index: Documentation/pci.txt
===================================================================
RCS file: /var/cvs/linux-2.5/Documentation/pci.txt,v retrieving revision 1.4
Documentation/pci.txt | 37 ++++++++++++++++++++++--------------- 1 files changed, 22 insertions(+), 15 deletions(-)
Documentation/pci.txt +22 -15
@@ -155,17 +155,11 @@ VENDOR_ID or DEVICE_ID. This allows searching for any device from a specific vendor, for example. - In case you need to decide according to some more complex criteria, -you can walk the list of all known PCI devices yourself: - - struct pci_dev *dev; - pci_for_each_dev(dev) { - ... do anything you want with dev ... - } - -For compatibility with device ordering in older kernels, you can also -use pci_for_each_dev_reverse(dev) for walking the list in the opposite -direction. +Note that these functions are not hotplug-safe. Their hotplug-safe +replacements are pci_get_device(), pci_get_class() and pci_get_subsys(). +They increment the reference count on the pci_dev that they return. +You must eventually (possibly at module unload) decrement the reference +count on these devices by calling pci_dev_put(). 3. Enabling devices
@@ -193,6 +187,10 @@ string by pcibios_strerror. Most drivers expect that accesses to valid PCI devices don't fail. + If you don't have a struct pci_dev available, you can call +pci_bus_(read|write)_config_(byte|word|dword) to access a given device +and function on that bus. + If you access fields in the standard portion of the config header, please use symbolic names of locations and bits declared in <linux/pci.h>.
@@ -253,14 +251,23 @@ 8. Obsolete functions ~~~~~~~~~~~~~~~~~~~~~ -There are several functions kept only for compatibility with old drivers -not updated to the new PCI interface. Please don't use them in new code. +There are several functions which you might come across when trying to +port an old driver to the new PCI interface. They are no longer present +in the kernel as they aren't compatible with hotplug or PCI domains or +having sane locking. -pcibios_present() Since ages, you don't need to test presence - of PCI subsystem when trying to talk with it. +pcibios_present() and Since ages, you don't need to test presence +pci_present() of PCI subsystem when trying to talk to it. If it's not there, the list of PCI devices is empty and all functions for searching for devices just return NULL. pcibios_(read|write)_* Superseded by their pci_(read|write)_* counterparts. pcibios_find_* Superseded by their pci_find_* counterparts. +pci_for_each_dev() Superseded by pci_find_device() +pci_for_each_dev_reverse() Superseded by pci_find_device_reverse() +pci_for_each_bus() Superseded by pci_find_next_bus() +pci_find_device() Superseded by pci_get_device() +pci_find_subsys() Superseded by pci_get_subsys() +pcibios_find_class() Superseded by pci_find_class() +pci_(read|write)_*_nodev() Superseded by pci_bus_(read|write)_*()
ChangeSet 1.1429.2.4, 2003/06/25 17:03:44-07:00, [email protected]
[PATCH] PCI: more PCI gubbins
I noticed we have a couple of redundancies in drivers/pci/Makefile, have a patch...
drivers/pci/Makefile | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-)
drivers/pci/Makefile +2 -7
@@ -8,7 +8,7 @@ obj-$(CONFIG_PROC_FS) += proc.o ifndef CONFIG_SPARC64 -obj-$(CONFIG_PCI) += setup-res.o +obj-y += setup-res.o endif obj-$(CONFIG_HOTPLUG) += hotplug.o
@@ -29,12 +29,7 @@ obj-$(CONFIG_SGI_IP32) += setup-irq.o obj-$(CONFIG_X86_VISWS) += setup-irq.o -# CompactPCI hotplug requires the pbus_* functions -ifdef CONFIG_HOTPLUG_PCI_CPCI -obj-y += setup-bus.o -endif - -# Hotplug (eg, cardbus) now requires setup-bus +# Cardbus & CompactPCI use setup-bus obj-$(CONFIG_HOTPLUG) += setup-bus.o ifndef CONFIG_X86
ChangeSet 1.1429.2.5, 2003/06/25 17:08:13-07:00, [email protected]
[PATCH] PCI: fixes for pci/probe.c
- Combine pci_alloc_primary_bus_parented into pci_scan_bus_parented.
- Move the EXPORT_SYMBOL for pci_root_buses up to its definition.
- Don't EXPORT_SYMBOL pci_scan_bus since it's a static inline.
- Add the pci_domain_nr() to the sysfs name for this bus.
drivers/pci/probe.c | 34 +++++++++++++++------------------- 1 files changed, 15 insertions(+), 19 deletions(-)
drivers/pci/probe.c +15 -19
@@ -18,7 +18,10 @@#define CARDBUS_LATENCY_TIMER 176/* secondary latency timer */ #define CARDBUS_RESERVE_BUSNR 3 +/* Ugh. Need to stop exporting this to modules. */ LIST_HEAD (pci_root_buses); +EXPORT_SYMBOL (pci_root_buses); +LIST_HEAD (pci_devices);/*
@@ -643,7 +646,7 @@return 0 ; } -static struct pci_bus *__devinit pci_alloc_primary_bus_parented (struct device *parent,int bus) +struct pci_bus *__devinit pci_scan_bus_parented (struct device *parent,int bus,struct pci_ops *ops,void *sysdata) {struct pci_bus *b;
@@ -656,46 +659,39 @@ b =pci_alloc_bus ();if (!b)return NULL ; - + b->dev =kmalloc (sizeof (*(b->dev)),GFP_KERNEL );if (!b->dev){kfree (b);return NULL ; } - + + b->sysdata = sysdata; + b->ops = ops; +list_add_tail (&b->node, &pci_root_buses);memset (b->dev,0 ,sizeof (*(b->dev))); -sprintf (b->dev->bus_id,"pci%d" ,bus); -strcpy (b->dev->name,"Host/PCI Bridge" ); b->dev->parent = parent; +sprintf (b->dev->bus_id,"pci%04x:%02x" ,pci_domain_nr (b), bus); +strcpy (b->dev->name,"Host/PCI Bridge" );device_register (b->dev); b->number = b->secondary = bus; b->resource[0 ] = &ioport_resource; b->resource[1 ] = &iomem_resource; -return b; -} -struct pci_bus *__devinit pci_scan_bus_parented (struct device *parent,int bus,struct pci_ops *ops,void *sysdata) -{ -struct pci_bus *b =pci_alloc_primary_bus_parented (parent, bus); -if (b) { - b->sysdata = sysdata; - b->ops = ops; - b->subordinate =pci_scan_child_bus (b); -pci_bus_add_devices (b); - } + b->subordinate =pci_scan_child_bus (b); + +pci_bus_add_devices (b); +return b; }EXPORT_SYMBOL (pci_scan_bus_parented); -EXPORT_SYMBOL (pci_root_buses); -#ifdef CONFIG_HOTPLUG EXPORT_SYMBOL (pci_add_new_bus);EXPORT_SYMBOL (pci_do_scan_bus);EXPORT_SYMBOL (pci_scan_slot); -EXPORT_SYMBOL (pci_scan_bus);EXPORT_SYMBOL (pci_scan_bridge);#endif
ChangeSet 1.1429.2.6, 2003/06/25 17:13:44-07:00, [email protected]
[PATCH] PCI Hotplug: fix core problem with kobject lifespans.
Added needed release function, now all pci hotplug drivers need to implement it...
drivers/pci/hotplug/pci_hotplug.h | 4 ++++ drivers/pci/hotplug/pci_hotplug_core.c | 22 +++++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-)
drivers/pci/hotplug/pci_hotplug.h +4 -0
@@ -51,6 +51,8 @@ssize_t (*show)(struct hotplug_slot *,char *);ssize_t (*store)(struct hotplug_slot *,const char *,size_t ); }; +#define to_hotplug_attr (n) container_of(n, struct hotplug_slot_attribute, attr); +/** * struct hotplug_slot_ops -the callbacks that the hotplug pci core can use * @owner: The module owner of this structure
@@ -130,12 +132,14 @@char *name;struct hotplug_slot_ops *ops;struct hotplug_slot_info *info; +void (*release) (struct hotplug_slot *slot);void *private;/* Variables below this are for use only by the hotplug pci core. */ struct list_head slot_list;struct kobject kobj; }; +#define to_hotplug_slot (n) container_of(n, struct hotplug_slot, kobj)extern int pci_hp_register (struct hotplug_slot *slot);extern int pci_hp_deregister (struct hotplug_slot *slot);
drivers/pci/hotplug/pci_hotplug_core.c +13 -9
@@ -74,20 +74,16 @@static ssize_t hotplug_slot_attr_show (struct kobject *kobj,struct attribute *attr,char *buf) { -struct hotplug_slot *slot=container_of (kobj, - struct hotplug_slot,kobj); -struct hotplug_slot_attribute *attribute = - container_of(attr, struct hotplug_slot_attribute, attr); +struct hotplug_slot *slot =to_hotplug_slot (kobj); +struct hotplug_slot_attribute *attribute =to_hotplug_attr (attr);return attribute->show ? attribute->show (slot, buf) :0 ; }static ssize_t hotplug_slot_attr_store (struct kobject *kobj,struct attribute *attr,const char *buf,size_t len) { -struct hotplug_slot *slot=container_of (kobj, - struct hotplug_slot,kobj); -struct hotplug_slot_attribute *attribute = - container_of(attr, struct hotplug_slot_attribute, attr); +struct hotplug_slot *slot =to_hotplug_slot (kobj); +struct hotplug_slot_attribute *attribute =to_hotplug_attr (attr);return attribute->store ? attribute->store (slot, buf, len) :0 ; }
@@ -96,8 +92,16 @@ .store = hotplug_slot_attr_store, }; +static void hotplug_slot_release (struct kobject *kobj) +{ +struct hotplug_slot *slot =to_hotplug_slot (kobj); +if (slot->release) + slot->release (slot); +} +static struct kobj_type hotplug_slot_ktype = { - .sysfs_ops = &hotplug_slot_sysfs_ops + .sysfs_ops = &hotplug_slot_sysfs_ops, + .release = &hotplug_slot_release, }; static decl_subsys(hotplug_slots, &hotplug_slot_ktype, NULL);
ChangeSet 1.1429.2.7, 2003/06/25 17:16:12-07:00, [email protected]
[PATCH] IBM PCI Hotplug: fixes found by sparse
drivers/pci/hotplug/ibmphp_hpc.c | 61 +++++++++++++++++++-------------------- drivers/pci/hotplug/ibmphp_res.c | 4 +- 2 files changed, 32 insertions(+), 33 deletions(-)
drivers/pci/hotplug/ibmphp_hpc.c +30 -31
@@ -152,11 +152,11 @@u8 status;int i;void *wpg_addr;// base addr + offset -ulong wpg_data,// data to/from WPG LOHI format - ultemp, data;// actual data HILO format +unsigned long wpg_data;// data to/from WPG LOHI format +unsigned long ultemp; +unsigned long data;// actual data HILO format - -debug_polling ("%s - Entry WPGBbar[%lx] index[%x] \n" , __FUNCTION__, (ulong ) WPGBbar, index); +debug_polling ("%s - Entry WPGBbar[%p] index[%x] \n" , __FUNCTION__, WPGBbar, index);//-------------------------------------------------------------------- // READ - step 1
@@ -165,17 +165,17 @@if (ctlr_ptr->ctlr_type ==0x02 ) { data =WPG_READATADDR_MASK ;// fill in I2C address - ultemp = (ulong ) ctlr_ptr->u.wpeg_ctlr.i2c_addr; + ultemp = (unsigned long )ctlr_ptr->u.wpeg_ctlr.i2c_addr; ultemp = ultemp >>1 ; data |= (ultemp <<8 );// fill in index - data |= (ulong ) index; + data |= (unsigned long )index; }else if (ctlr_ptr->ctlr_type ==0x04 ) { data =WPG_READDIRECT_MASK ;// fill in index - ultemp = (ulong ) index; + ultemp = (unsigned long )index; ultemp = ultemp <<8 ; data |= ultemp; }else {
@@ -184,14 +184,14 @@ } wpg_data =swab32 (data);// swap data before writing - (ulong ) wpg_addr = (ulong ) WPGBbar + (ulong )WPG_I2CMOSUP_OFFSET ; + wpg_addr = WPGBbar +WPG_I2CMOSUP_OFFSET ;writel (wpg_data, wpg_addr);//-------------------------------------------------------------------- // READ - step 2 : clear the message buffer data =0x00000000 ; wpg_data =swab32 (data); - (ulong ) wpg_addr = (ulong ) WPGBbar + (ulong )WPG_I2CMBUFL_OFFSET ; + wpg_addr = WPGBbar +WPG_I2CMBUFL_OFFSET ;writel (wpg_data, wpg_addr);//--------------------------------------------------------------------
@@ -199,7 +199,7 @@// 2020 : [20] OR operation at [20] offset 0x20 data =WPG_I2CMCNTL_STARTOP_MASK ; wpg_data =swab32 (data); - (ulong ) wpg_addr = (ulong ) WPGBbar + (ulong )WPG_I2CMCNTL_OFFSET + (ulong )WPG_I2C_OR ; + wpg_addr = WPGBbar +WPG_I2CMCNTL_OFFSET +WPG_I2C_OR ;writel (wpg_data, wpg_addr);//--------------------------------------------------------------------
@@ -207,7 +207,7 @@ i =CMD_COMPLETE_TOUT_SEC ;while (i) {long_delay (1 *HZ /100 ); - (ulong ) wpg_addr = (ulong ) WPGBbar + (ulong )WPG_I2CMCNTL_OFFSET ; + wpg_addr = WPGBbar +WPG_I2CMCNTL_OFFSET ; wpg_data =readl (wpg_addr); data =swab32 (wpg_data);if (!(data &WPG_I2CMCNTL_STARTOP_MASK ))
@@ -223,7 +223,7 @@ i =CMD_COMPLETE_TOUT_SEC ;while (i) {long_delay (1 *HZ /100 ); - (ulong ) wpg_addr = (ulong ) WPGBbar + (ulong )WPG_I2CSTAT_OFFSET ; + wpg_addr = WPGBbar +WPG_I2CSTAT_OFFSET ; wpg_data =readl (wpg_addr); data =swab32 (wpg_data);if (HPC_I2CSTATUS_CHECK (data))
@@ -237,7 +237,7 @@//-------------------------------------------------------------------- // READ - step 6 : get DATA - (ulong ) wpg_addr = (ulong ) WPGBbar + (ulong )WPG_I2CMBUFL_OFFSET ; + wpg_addr = WPGBbar +WPG_I2CMBUFL_OFFSET ; wpg_data =readl (wpg_addr); data =swab32 (wpg_data);
@@ -259,12 +259,12 @@ {u8 rc;void *wpg_addr;// base addr + offset -ulong wpg_data,// data to/from WPG LOHI format - ultemp, data;// actual data HILO format +unsigned long wpg_data;// data to/from WPG LOHI format +unsigned long ultemp; +unsigned long data;// actual data HILO format int i; - -debug_polling ("%s - Entry WPGBbar[%lx] index[%x] cmd[%x]\n" , __FUNCTION__, (ulong ) WPGBbar, index, cmd); +debug_polling ("%s - Entry WPGBbar[%p] index[%x] cmd[%x]\n" , __FUNCTION__, WPGBbar, index, cmd); rc =0 ;//--------------------------------------------------------------------
@@ -276,17 +276,17 @@if (ctlr_ptr->ctlr_type ==0x02 ) { data =WPG_WRITEATADDR_MASK ;// fill in I2C address - ultemp = (ulong ) ctlr_ptr->u.wpeg_ctlr.i2c_addr; + ultemp = (unsigned long )ctlr_ptr->u.wpeg_ctlr.i2c_addr; ultemp = ultemp >>1 ; data |= (ultemp <<8 );// fill in index - data |= (ulong ) index; + data |= (unsigned long )index; }else if (ctlr_ptr->ctlr_type ==0x04 ) { data =WPG_WRITEDIRECT_MASK ;// fill in index - ultemp = (ulong ) index; + ultemp = (unsigned long )index; ultemp = ultemp <<8 ; data |= ultemp; }else {
@@ -295,14 +295,14 @@ } wpg_data =swab32 (data);// swap data before writing - (ulong ) wpg_addr = (ulong ) WPGBbar + (ulong )WPG_I2CMOSUP_OFFSET ; + wpg_addr = WPGBbar +WPG_I2CMOSUP_OFFSET ;writel (wpg_data, wpg_addr);//-------------------------------------------------------------------- // WRITE - step 2 : clear the message buffer - data =0x00000000 | (ulong ) cmd; + data =0x00000000 | (unsigned long )cmd; wpg_data =swab32 (data); - (ulong ) wpg_addr = (ulong ) WPGBbar + (ulong )WPG_I2CMBUFL_OFFSET ; + wpg_addr = WPGBbar +WPG_I2CMBUFL_OFFSET ;writel (wpg_data, wpg_addr);//--------------------------------------------------------------------
@@ -310,7 +310,7 @@// 2020 : [20] OR operation at [20] offset 0x20 data =WPG_I2CMCNTL_STARTOP_MASK ; wpg_data =swab32 (data); - (ulong ) wpg_addr = (ulong ) WPGBbar + (ulong )WPG_I2CMCNTL_OFFSET + (ulong )WPG_I2C_OR ; + wpg_addr = WPGBbar +WPG_I2CMCNTL_OFFSET +WPG_I2C_OR ;writel (wpg_data, wpg_addr);//--------------------------------------------------------------------
@@ -318,7 +318,7 @@ i =CMD_COMPLETE_TOUT_SEC ;while (i) {long_delay (1 *HZ /100 ); - (ulong ) wpg_addr = (ulong ) WPGBbar + (ulong )WPG_I2CMCNTL_OFFSET ; + wpg_addr = WPGBbar +WPG_I2CMCNTL_OFFSET ; wpg_data =readl (wpg_addr); data =swab32 (wpg_data);if (!(data &WPG_I2CMCNTL_STARTOP_MASK ))
@@ -335,7 +335,7 @@ i =CMD_COMPLETE_TOUT_SEC ;while (i) {long_delay (1 *HZ /100 ); - (ulong ) wpg_addr = (ulong ) WPGBbar + (ulong )WPG_I2CSTAT_OFFSET ; + wpg_addr = WPGBbar +WPG_I2CSTAT_OFFSET ; wpg_data =readl (wpg_addr); data =swab32 (wpg_data);if (HPC_I2CSTATUS_CHECK (data))
@@ -543,7 +543,7 @@int rc =0 ;int busindex; -debug_polling ("%s - Entry pslot[%lx] cmd[%x] pstatus[%lx]\n" , __FUNCTION__, (ulong ) pslot, cmd, (ulong ) pstatus); +debug_polling ("%s - Entry pslot[%p] cmd[%x] pstatus[%p]\n" , __FUNCTION__, pslot, cmd, pstatus);if ((pslot ==NULL ) || ((pstatus ==NULL ) && (cmd !=READ_ALLSTAT ) && (cmd !=READ_BUSSTATUS ))) {
@@ -683,7 +683,7 @@int rc =0 ;int timeout; -debug_polling ("%s - Entry pslot[%lx] cmd[%x]\n" , __FUNCTION__, (ulong ) pslot, cmd); +debug_polling ("%s - Entry pslot[%p] cmd[%x]\n" , __FUNCTION__, pslot, cmd);if (pslot ==NULL ) { rc = -EINVAL ;err ("%s - Error Exit rc[%d]\n" , __FUNCTION__, rc);
@@ -976,7 +976,7 @@ {int rc =0 ; -debug ("%s - Entry pslot[%lx]\n" , __FUNCTION__, (ulong ) pslot); +debug ("%s - Entry pslot[%p]\n" , __FUNCTION__, pslot); rc =ibmphp_hpc_readslot (pslot,READ_ALLSTAT ,NULL );debug ("%s - Exit rc[%d]\n" , __FUNCTION__, rc);return rc;
@@ -1004,8 +1004,7 @@u8 disable = FALSE;u8 update = FALSE; -debug ("process_changeinstatus - Entry pslot[%lx], poldslot[%lx]\n" , (ulong ) pslot, - (ulong ) poldslot); +debug ("process_changeinstatus - Entry pslot[%p], poldslot[%p]\n" , pslot, poldslot);// bit 0 - HPC_SLOT_POWER if ((pslot->status &0x01 ) != (poldslot->status &0x01 ))
drivers/pci/hotplug/ibmphp_res.c +2 -2
@@ -42,7 +42,7 @@static int update_bridge_ranges (struct bus_node **);static int add_range (int type,struct range_node *,struct bus_node *);static void fix_resources (struct bus_node *); -static inline struct bus_node *find_bus_wprev (u8 ,struct bus_node **,u8 ); +static struct bus_node *find_bus_wprev (u8 ,struct bus_node **,u8 );static LIST_HEAD (gbuses);LIST_HEAD (ibmphp_res_head);
@@ -1757,7 +1757,7 @@return find_bus_wprev (bus_number,NULL ,0 ); } -static inline struct bus_node *find_bus_wprev (u8 bus_number,struct bus_node **prev,u8 flag) +static struct bus_node *find_bus_wprev (u8 bus_number,struct bus_node **prev,u8 flag) {struct bus_node *bus_cur;struct list_head *tmp;
ChangeSet 1.1429.2.8, 2003/06/25 17:24:47-07:00, [email protected]
PCI Hotplug: add fake PCI hotplug driver.
Useful for testing hotplug issues with pci drivers.
drivers/pci/hotplug/Kconfig | 25 ++++ drivers/pci/hotplug/Makefile | 1 drivers/pci/hotplug/fakephp.c | 232 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 258 insertions(+)
drivers/pci/hotplug/Kconfig +25 -0
@@ -21,6 +21,31 @@ When in doubt, say N. +config HOTPLUG_PCI_FAKE + tristate "Fake PCI Hotplug driver" + depends on HOTPLUG_PCI + help + Say Y here if you want to use the fake PCI hotplug driver. It can + be used to simulate PCI hotplug events if even if your system is + not PCI hotplug capable. + + This driver will "emulate" removing PCI devices from the system. + If the "power" file is written to with "0" then the specified PCI + device will be completely removed from the kernel. + + WARNING, this does NOT turn off the power to the PCI device. + This is a "logical" removal, not a physical or electrical + removal. + + Use this module at your own risk. You have been warned! + + 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 fakephp. If you want to compile it + as a module, say M here and read <file:Documentation/modules.txt>. + + When in doubt, say N. + config HOTPLUG_PCI_COMPAQ tristate "Compaq PCI Hotplug driver" depends on HOTPLUG_PCI && X86
drivers/pci/hotplug/Makefile +1 -0
@@ -3,6 +3,7 @@ # obj-$(CONFIG_HOTPLUG_PCI) += pci_hotplug.o +obj-$(CONFIG_HOTPLUG_PCI_FAKE) += fakephp.o obj-$(CONFIG_HOTPLUG_PCI_COMPAQ) += cpqphp.o obj-$(CONFIG_HOTPLUG_PCI_IBM) += ibmphp.o obj-$(CONFIG_HOTPLUG_PCI_ACPI) += acpiphp.o
drivers/pci/hotplug/fakephp.c new file +232 -0
232 lines not on this page · raw message