Commit a51d493e authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge bk://soma.bkbits.net/linux-2.5-cpci

into kroah.com:/home/linux/BK/pci-2.5
parents 8916e8f1 b924062a
......@@ -99,22 +99,17 @@ config HOTPLUG_PCI_ACPI
When in doubt, say N.
config HOTPLUG_PCI_CPCI
tristate "CompactPCI Hotplug driver"
bool "CompactPCI Hotplug driver"
depends on HOTPLUG_PCI
help
Say Y here if you have a CompactPCI system card with CompactPCI
hotswap support per the PICMG 2.1 specification.
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 cpci_hotplug. 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_CPCI_ZT5550
tristate "Ziatech ZT5550 CompactPCI Hotplug driver"
depends on HOTPLUG_PCI_CPCI && X86
depends on HOTPLUG_PCI && HOTPLUG_PCI_CPCI && X86
help
Say Y here if you have an Performance Technologies (formerly Intel,
formerly just Ziatech) Ziatech ZT5550 CompactPCI system card.
......@@ -128,7 +123,7 @@ config HOTPLUG_PCI_CPCI_ZT5550
config HOTPLUG_PCI_CPCI_GENERIC
tristate "Generic port I/O CompactPCI Hotplug driver"
depends on HOTPLUG_PCI_CPCI && X86
depends on HOTPLUG_PCI && HOTPLUG_PCI_CPCI && X86
help
Say Y here if you have a CompactPCI system card that exposes the #ENUM
hotswap signal as a bit in a system register that can be read through
......
......@@ -75,7 +75,6 @@ extern int cpci_hp_register_controller(struct cpci_hp_controller *controller);
extern int cpci_hp_unregister_controller(struct cpci_hp_controller *controller);
extern int cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last);
extern int cpci_hp_unregister_bus(struct pci_bus *bus);
extern struct slot *cpci_find_slot(struct pci_bus *bus, unsigned int devfn);
extern int cpci_hp_start(void);
extern int cpci_hp_stop(void);
......
......@@ -427,34 +427,6 @@ cpci_hp_unregister_bus(struct pci_bus *bus)
return 0;
}
struct slot *
cpci_find_slot(struct pci_bus *bus, unsigned int devfn)
{
struct slot *slot;
struct slot *found;
struct list_head *tmp;
if(!bus) {
return NULL;
}
spin_lock(&list_lock);
if(!slots) {
spin_unlock(&list_lock);
return NULL;
}
found = NULL;
list_for_each(tmp, &slot_list) {
slot = list_entry(tmp, struct slot, slot_list);
if(slot->bus == bus && slot->devfn == devfn) {
found = slot;
break;
}
}
spin_unlock(&list_lock);
return found;
}
/* This is the interrupt mode interrupt handler */
irqreturn_t
cpci_hp_intr(int irq, void *data, struct pt_regs *regs)
......@@ -924,6 +896,5 @@ EXPORT_SYMBOL_GPL(cpci_hp_register_controller);
EXPORT_SYMBOL_GPL(cpci_hp_unregister_controller);
EXPORT_SYMBOL_GPL(cpci_hp_register_bus);
EXPORT_SYMBOL_GPL(cpci_hp_unregister_bus);
EXPORT_SYMBOL_GPL(cpci_find_slot);
EXPORT_SYMBOL_GPL(cpci_hp_start);
EXPORT_SYMBOL_GPL(cpci_hp_stop);
......@@ -448,7 +448,7 @@ static int cpci_configure_bridge(struct pci_bus* bus, struct pci_dev* dev)
}
static int configure_visit_pci_dev(struct pci_dev_wrapped *wrapped_dev,
struct pci_bus_wrapped *wrapped_bus)
struct pci_bus_wrapped *wrapped_bus)
{
int rc;
struct pci_dev *dev = wrapped_dev->dev;
......@@ -461,8 +461,8 @@ static int configure_visit_pci_dev(struct pci_dev_wrapped *wrapped_dev,
* We need to fix up the hotplug representation with the Linux
* representation.
*/
slot = cpci_find_slot(dev->bus, dev->devfn);
if(slot) {
if(wrapped_dev->data) {
slot = (struct slot*) wrapped_dev->data;
slot->dev = dev;
}
......@@ -494,9 +494,7 @@ static int unconfigure_visit_pci_dev_phase2(struct pci_dev_wrapped *wrapped_dev,
return -ENODEV;
/* Remove the Linux representation */
if(pci_remove_device_safe(dev) == 0) {
kfree(dev);
} else {
if(pci_remove_device_safe(dev)) {
err("Could not remove device\n");
return -1;
}
......@@ -504,8 +502,8 @@ static int unconfigure_visit_pci_dev_phase2(struct pci_dev_wrapped *wrapped_dev,
/*
* Now remove the hotplug representation.
*/
slot = cpci_find_slot(dev->bus, dev->devfn);
if(slot) {
if(wrapped_dev->data) {
slot = (struct slot*) wrapped_dev->data;
slot->dev = NULL;
} else {
dbg("No hotplug representation for %02x:%02x.%x",
......@@ -574,13 +572,18 @@ int cpci_configure_slot(struct slot* slot)
/* Still NULL? Well then scan for it! */
if(slot->dev == NULL) {
int n;
dbg("pci_dev still null");
/*
* This will generate pci_dev structures for all functions, but
* we will only call this case when lookup fails.
*/
slot->dev = pci_scan_slot(slot->bus, slot->devfn);
n = pci_scan_slot(slot->bus, slot->devfn);
dbg("%s: pci_scan_slot returned %d", __FUNCTION__, n);
if(n > 0)
pci_bus_add_devices(slot->bus);
slot->dev = pci_find_slot(slot->bus->number, slot->devfn);
if(slot->dev == NULL) {
err("Could not find PCI device for slot %02x", slot->number);
return 0;
......@@ -603,6 +606,10 @@ int cpci_configure_slot(struct slot* slot)
continue;
wrapped_dev.dev = dev;
wrapped_bus.bus = slot->dev->bus;
if(i)
wrapped_dev.data = NULL;
else
wrapped_dev.data = (void*) slot;
rc = pci_visit_dev(&configure_functions, &wrapped_dev, &wrapped_bus);
}
}
......@@ -635,9 +642,14 @@ int cpci_unconfigure_slot(struct slot* slot)
if(dev) {
wrapped_dev.dev = dev;
wrapped_bus.bus = dev->bus;
if(i)
wrapped_dev.data = NULL;
else
wrapped_dev.data = (void*) slot;
dbg("%s - unconfigure phase 2", __FUNCTION__);
rc = pci_visit_dev(&unconfigure_functions_phase2,
&wrapped_dev, &wrapped_bus);
&wrapped_dev,
&wrapped_bus);
if(rc)
break;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment