diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-10 03:41:42 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-10 03:41:42 +0100 |
commit | 977127174a7dff52d17faeeb4c4949a54221881f (patch) | |
tree | b05b9d18a1256d7ed97bdfb537213a8d70ccca57 /drivers/pci | |
parent | Merge master.kernel.org:/pub/scm/linux/kernel/git/mingo/mutex-2.6 (diff) | |
parent | [PATCH] drivers/*rest*: Replace pci_module_init() with pci_register_driver() (diff) | |
download | linux-977127174a7dff52d17faeeb4c4949a54221881f.tar.xz linux-977127174a7dff52d17faeeb4c4949a54221881f.zip |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/hotplug/acpiphp_glue.c | 6 | ||||
-rw-r--r-- | drivers/pci/hotplug/cpqphp.h | 8 | ||||
-rw-r--r-- | drivers/pci/hotplug/cpqphp_core.c | 127 | ||||
-rw-r--r-- | drivers/pci/hotplug/cpqphp_ctrl.c | 28 | ||||
-rw-r--r-- | drivers/pci/hotplug/cpqphp_sysfs.c | 138 | ||||
-rw-r--r-- | drivers/pci/hotplug/ibmphp_pci.c | 2 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp_core.c | 92 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp_hpc.c | 19 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp_pci.c | 52 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehprm_acpi.c | 13 | ||||
-rw-r--r-- | drivers/pci/hotplug/rpadlpar_core.c | 27 | ||||
-rw-r--r-- | drivers/pci/hotplug/rpaphp_pci.c | 47 | ||||
-rw-r--r-- | drivers/pci/hotplug/shpchp.h | 4 | ||||
-rw-r--r-- | drivers/pci/hotplug/shpchp_core.c | 16 | ||||
-rw-r--r-- | drivers/pci/hotplug/shpchp_ctrl.c | 37 | ||||
-rw-r--r-- | drivers/pci/hotplug/shpchp_hpc.c | 138 | ||||
-rw-r--r-- | drivers/pci/hotplug/shpchp_pci.c | 19 | ||||
-rw-r--r-- | drivers/pci/pci.c | 7 | ||||
-rw-r--r-- | drivers/pci/pci.h | 5 | ||||
-rw-r--r-- | drivers/pci/pcie/portdrv_core.c | 4 | ||||
-rw-r--r-- | drivers/pci/probe.c | 49 | ||||
-rw-r--r-- | drivers/pci/proc.c | 3 | ||||
-rw-r--r-- | drivers/pci/quirks.c | 26 | ||||
-rw-r--r-- | drivers/pci/remove.c | 3 |
24 files changed, 523 insertions, 347 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 8e21f6ab89a1..509a5b3ae998 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c @@ -794,12 +794,14 @@ static int enable_device(struct acpiphp_slot *slot) if (PCI_SLOT(dev->devfn) != slot->device) continue; if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || - dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) + dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) { max = pci_scan_bridge(bus, dev, max, pass); + if (pass && dev->subordinate) + pci_bus_size_bridges(dev->subordinate); + } } } - pci_bus_size_bridges(bus); pci_bus_assign_resources(bus); acpiphp_sanitize_bus(bus); pci_enable_bridges(bus); diff --git a/drivers/pci/hotplug/cpqphp.h b/drivers/pci/hotplug/cpqphp.h index 092491e25ef2..cb88404c89fe 100644 --- a/drivers/pci/hotplug/cpqphp.h +++ b/drivers/pci/hotplug/cpqphp.h @@ -317,6 +317,7 @@ struct controller { u16 vendor_id; struct work_struct int_task_event; wait_queue_head_t queue; /* sleep & wake process */ + struct dentry *dentry; /* debugfs dentry */ }; struct irq_mapping { @@ -399,8 +400,11 @@ struct resource_lists { #define msg_button_ignore "PCI slot #%d - button press ignored. (action in progress...)\n" -/* sysfs functions for the hotplug controller info */ -extern void cpqhp_create_ctrl_files (struct controller *ctrl); +/* debugfs functions for the hotplug controller info */ +extern void cpqhp_initialize_debugfs (void); +extern void cpqhp_shutdown_debugfs (void); +extern void cpqhp_create_debugfs_files (struct controller *ctrl); +extern void cpqhp_remove_debugfs_files (struct controller *ctrl); /* controller functions */ extern void cpqhp_pushbutton_thread (unsigned long event_pointer); diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c index 9aed8efe6a11..b3659ffccac9 100644 --- a/drivers/pci/hotplug/cpqphp_core.c +++ b/drivers/pci/hotplug/cpqphp_core.c @@ -327,7 +327,9 @@ static int ctrl_slot_setup(struct controller *ctrl, void __iomem *smbios_start, void __iomem *smbios_table) { - struct slot *new_slot; + struct slot *slot; + struct hotplug_slot *hotplug_slot; + struct hotplug_slot_info *hotplug_slot_info; u8 number_of_slots; u8 slot_device; u8 slot_number; @@ -345,93 +347,105 @@ static int ctrl_slot_setup(struct controller *ctrl, slot_number = ctrl->first_slot; while (number_of_slots) { - new_slot = kmalloc(sizeof(*new_slot), GFP_KERNEL); - if (!new_slot) + slot = kmalloc(sizeof(*slot), GFP_KERNEL); + if (!slot) goto error; - memset(new_slot, 0, sizeof(struct slot)); - new_slot->hotplug_slot = kmalloc(sizeof(*(new_slot->hotplug_slot)), + memset(slot, 0, sizeof(struct slot)); + slot->hotplug_slot = kmalloc(sizeof(*(slot->hotplug_slot)), GFP_KERNEL); - if (!new_slot->hotplug_slot) + if (!slot->hotplug_slot) goto error_slot; - memset(new_slot->hotplug_slot, 0, sizeof(struct hotplug_slot)); + hotplug_slot = slot->hotplug_slot; + memset(hotplug_slot, 0, sizeof(struct hotplug_slot)); - new_slot->hotplug_slot->info = - kmalloc(sizeof(*(new_slot->hotplug_slot->info)), + hotplug_slot->info = + kmalloc(sizeof(*(hotplug_slot->info)), GFP_KERNEL); - if (!new_slot->hotplug_slot->info) + if (!hotplug_slot->info) goto error_hpslot; - memset(new_slot->hotplug_slot->info, 0, + hotplug_slot_info = hotplug_slot->info; + memset(hotplug_slot_info, 0, sizeof(struct hotplug_slot_info)); - new_slot->hotplug_slot->name = kmalloc(SLOT_NAME_SIZE, GFP_KERNEL); - if (!new_slot->hotplug_slot->name) + hotplug_slot->name = kmalloc(SLOT_NAME_SIZE, GFP_KERNEL); + + if (!hotplug_slot->name) goto error_info; - new_slot->ctrl = ctrl; - new_slot->bus = ctrl->bus; - new_slot->device = slot_device; - new_slot->number = slot_number; - dbg("slot->number = %d\n",new_slot->number); + slot->ctrl = ctrl; + slot->bus = ctrl->bus; + slot->device = slot_device; + slot->number = slot_number; + dbg("slot->number = %d\n", slot->number); slot_entry = get_SMBIOS_entry(smbios_start, smbios_table, 9, slot_entry); - while (slot_entry && (readw(slot_entry + SMBIOS_SLOT_NUMBER) != new_slot->number)) { + while (slot_entry && (readw(slot_entry + SMBIOS_SLOT_NUMBER) != + slot->number)) { slot_entry = get_SMBIOS_entry(smbios_start, smbios_table, 9, slot_entry); } - new_slot->p_sm_slot = slot_entry; + slot->p_sm_slot = slot_entry; - init_timer(&new_slot->task_event); - new_slot->task_event.expires = jiffies + 5 * HZ; - new_slot->task_event.function = cpqhp_pushbutton_thread; + init_timer(&slot->task_event); + slot->task_event.expires = jiffies + 5 * HZ; + slot->task_event.function = cpqhp_pushbutton_thread; //FIXME: these capabilities aren't used but if they are // they need to be correctly implemented - new_slot->capabilities |= PCISLOT_REPLACE_SUPPORTED; - new_slot->capabilities |= PCISLOT_INTERLOCK_SUPPORTED; + slot->capabilities |= PCISLOT_REPLACE_SUPPORTED; + slot->capabilities |= PCISLOT_INTERLOCK_SUPPORTED; - if (is_slot64bit(new_slot)) - new_slot->capabilities |= PCISLOT_64_BIT_SUPPORTED; - if (is_slot66mhz(new_slot)) - new_slot->capabilities |= PCISLOT_66_MHZ_SUPPORTED; + if (is_slot64bit(slot)) + slot->capabilities |= PCISLOT_64_BIT_SUPPORTED; + if (is_slot66mhz(slot)) + slot->capabilities |= PCISLOT_66_MHZ_SUPPORTED; if (ctrl->speed == PCI_SPEED_66MHz) - new_slot->capabilities |= PCISLOT_66_MHZ_OPERATION; + slot->capabilities |= PCISLOT_66_MHZ_OPERATION; - ctrl_slot = slot_device - (readb(ctrl->hpc_reg + SLOT_MASK) >> 4); + ctrl_slot = + slot_device - (readb(ctrl->hpc_reg + SLOT_MASK) >> 4); // Check presence - new_slot->capabilities |= ((((~tempdword) >> 23) | ((~tempdword) >> 15)) >> ctrl_slot) & 0x02; + slot->capabilities |= + ((((~tempdword) >> 23) | + ((~tempdword) >> 15)) >> ctrl_slot) & 0x02; // Check the switch state - new_slot->capabilities |= ((~tempdword & 0xFF) >> ctrl_slot) & 0x01; + slot->capabilities |= + ((~tempdword & 0xFF) >> ctrl_slot) & 0x01; // Check the slot enable - new_slot->capabilities |= ((read_slot_enable(ctrl) << 2) >> ctrl_slot) & 0x04; + slot->capabilities |= + ((read_slot_enable(ctrl) << 2) >> ctrl_slot) & 0x04; /* register this slot with the hotplug pci core */ - new_slot->hotplug_slot->release = &release_slot; - new_slot->hotplug_slot->private = new_slot; - make_slot_name(new_slot->hotplug_slot->name, SLOT_NAME_SIZE, new_slot); - new_slot->hotplug_slot->ops = &cpqphp_hotplug_slot_ops; + hotplug_slot->release = &release_slot; + hotplug_slot->private = slot; + make_slot_name(hotplug_slot->name, SLOT_NAME_SIZE, slot); + hotplug_slot->ops = &cpqphp_hotplug_slot_ops; - new_slot->hotplug_slot->info->power_status = get_slot_enabled(ctrl, new_slot); - new_slot->hotplug_slot->info->attention_status = cpq_get_attention_status(ctrl, new_slot); - new_slot->hotplug_slot->info->latch_status = cpq_get_latch_status(ctrl, new_slot); - new_slot->hotplug_slot->info->adapter_status = get_presence_status(ctrl, new_slot); + hotplug_slot_info->power_status = get_slot_enabled(ctrl, slot); + hotplug_slot_info->attention_status = + cpq_get_attention_status(ctrl, slot); + hotplug_slot_info->latch_status = + cpq_get_latch_status(ctrl, slot); + hotplug_slot_info->adapter_status = + get_presence_status(ctrl, slot); - dbg ("registering bus %d, dev %d, number %d, " + dbg("registering bus %d, dev %d, number %d, " "ctrl->slot_device_offset %d, slot %d\n", - new_slot->bus, new_slot->device, - new_slot->number, ctrl->slot_device_offset, + slot->bus, slot->device, + slot->number, ctrl->slot_device_offset, slot_number); - result = pci_hp_register (new_slot->hotplug_slot); + result = pci_hp_register(hotplug_slot); if (result) { - err ("pci_hp_register failed with error %d\n", result); + err("pci_hp_register failed with error %d\n", result); goto error_name; } - new_slot->next = ctrl->slot; - ctrl->slot = new_slot; + slot->next = ctrl->slot; + ctrl->slot = slot; number_of_slots--; slot_device++; @@ -439,15 +453,14 @@ static int ctrl_slot_setup(struct controller *ctrl, } return 0; - error_name: - kfree(new_slot->hotplug_slot->name); + kfree(hotplug_slot->name); error_info: - kfree(new_slot->hotplug_slot->info); + kfree(hotplug_slot_info); error_hpslot: - kfree(new_slot->hotplug_slot); + kfree(hotplug_slot); error_slot: - kfree(new_slot); + kfree(slot); error: return result; } @@ -466,6 +479,8 @@ static int ctrl_slot_cleanup (struct controller * ctrl) old_slot = next_slot; } + cpqhp_remove_debugfs_files(ctrl); + //Free IRQ associated with hot plug device free_irq(ctrl->interrupt, ctrl); //Unmap the memory @@ -1262,7 +1277,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) // Done with exclusive hardware access up(&ctrl->crit_sect); - cpqhp_create_ctrl_files(ctrl); + cpqhp_create_debugfs_files(ctrl); return 0; @@ -1502,6 +1517,7 @@ static int __init cpqhpc_init(void) cpqhp_debug = debug; info (DRIVER_DESC " version: " DRIVER_VERSION "\n"); + cpqhp_initialize_debugfs(); result = pci_register_driver(&cpqhpc_driver); dbg("pci_register_driver = %d\n", result); return result; @@ -1515,6 +1531,7 @@ static void __exit cpqhpc_cleanup(void) dbg("pci_unregister_driver\n"); pci_unregister_driver(&cpqhpc_driver); + cpqhp_shutdown_debugfs(); } diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c index 10a5a7674a8a..771ed34b1819 100644 --- a/drivers/pci/hotplug/cpqphp_ctrl.c +++ b/drivers/pci/hotplug/cpqphp_ctrl.c @@ -2630,29 +2630,15 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func hold_mem_node = NULL; } - /* If we have prefetchable memory resources copy them and - * fill in the bridge's memory range registers. Otherwise, - * fill in the range registers with values that disable them. */ - if (p_mem_node) { - memcpy(hold_p_mem_node, p_mem_node, sizeof(struct pci_resource)); - p_mem_node->next = NULL; - - /* set Pre Mem base and Limit registers */ - temp_word = p_mem_node->base >> 16; - rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_BASE, temp_word); - - temp_word = (p_mem_node->base + p_mem_node->length - 1) >> 16; - rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word); - } else { - temp_word = 0xFFFF; - rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_BASE, temp_word); + memcpy(hold_p_mem_node, p_mem_node, sizeof(struct pci_resource)); + p_mem_node->next = NULL; - temp_word = 0x0000; - rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word); + /* set Pre Mem base and Limit registers */ + temp_word = p_mem_node->base >> 16; + rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_BASE, temp_word); - kfree(hold_p_mem_node); - hold_p_mem_node = NULL; - } + temp_word = (p_mem_node->base + p_mem_node->length - 1) >> 16; + rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word); /* Adjust this to compensate for extra adjustment in first loop */ irqs.barber_pole--; diff --git a/drivers/pci/hotplug/cpqphp_sysfs.c b/drivers/pci/hotplug/cpqphp_sysfs.c index 4c11048ad51b..bbfeed767ff1 100644 --- a/drivers/pci/hotplug/cpqphp_sysfs.c +++ b/drivers/pci/hotplug/cpqphp_sysfs.c @@ -33,22 +33,15 @@ #include <linux/proc_fs.h> #include <linux/workqueue.h> #include <linux/pci.h> +#include <linux/debugfs.h> #include "cpqphp.h" - -/* A few routines that create sysfs entries for the hot plug controller */ - -static ssize_t show_ctrl (struct device *dev, struct device_attribute *attr, char *buf) +static int show_ctrl (struct controller *ctrl, char *buf) { - struct pci_dev *pci_dev; - struct controller *ctrl; - char * out = buf; + char *out = buf; int index; struct pci_resource *res; - pci_dev = container_of (dev, struct pci_dev, dev); - ctrl = pci_get_drvdata(pci_dev); - out += sprintf(buf, "Free resources: memory\n"); index = 11; res = ctrl->mem_head; @@ -80,22 +73,16 @@ static ssize_t show_ctrl (struct device *dev, struct device_attribute *attr, cha return out - buf; } -static DEVICE_ATTR (ctrl, S_IRUGO, show_ctrl, NULL); -static ssize_t show_dev (struct device *dev, struct device_attribute *attr, char *buf) +static int show_dev (struct controller *ctrl, char *buf) { - struct pci_dev *pci_dev; - struct controller *ctrl; char * out = buf; int index; struct pci_resource *res; struct pci_func *new_slot; struct slot *slot; - pci_dev = container_of (dev, struct pci_dev, dev); - ctrl = pci_get_drvdata(pci_dev); - - slot=ctrl->slot; + slot = ctrl->slot; while (slot) { new_slot = cpqhp_slot_find(slot->bus, slot->device, 0); @@ -134,10 +121,117 @@ static ssize_t show_dev (struct device *dev, struct device_attribute *attr, char return out - buf; } -static DEVICE_ATTR (dev, S_IRUGO, show_dev, NULL); -void cpqhp_create_ctrl_files (struct controller *ctrl) +static int spew_debug_info(struct controller *ctrl, char *data, int size) { - device_create_file (&ctrl->pci_dev->dev, &dev_attr_ctrl); - device_create_file (&ctrl->pci_dev->dev, &dev_attr_dev); + int used; + + used = size - show_ctrl(ctrl, data); + used = (size - used) - show_dev(ctrl, &data[used]); + return used; +} + +struct ctrl_dbg { + int size; + char *data; + struct controller *ctrl; +}; + +#define MAX_OUTPUT (4*PAGE_SIZE) + +static int open(struct inode *inode, struct file *file) +{ + struct controller *ctrl = inode->u.generic_ip; + struct ctrl_dbg *dbg; + int retval = -ENOMEM; + + lock_kernel(); + dbg = kmalloc(sizeof(*dbg), GFP_KERNEL); + if (!dbg) + goto exit; + dbg->data = kmalloc(MAX_OUTPUT, GFP_KERNEL); + if (!dbg->data) { + kfree(dbg); + goto exit; + } + dbg->size = spew_debug_info(ctrl, dbg->data, MAX_OUTPUT); + file->private_data = dbg; + retval = 0; +exit: + unlock_kernel(); + return retval; +} + +static loff_t lseek(struct file *file, loff_t off, int whence) +{ + struct ctrl_dbg *dbg; + loff_t new = -1; + + lock_kernel(); + dbg = file->private_data; + + switch (whence) { + case 0: + new = off; + break; + case 1: + new = file->f_pos + off; + break; + } + if (new < 0 || new > dbg->size) { + unlock_kernel(); + return -EINVAL; + } + unlock_kernel(); + return (file->f_pos = new); } + +static ssize_t read(struct file *file, char __user *buf, + size_t nbytes, loff_t *ppos) +{ + struct ctrl_dbg *dbg = file->private_data; + return simple_read_from_buffer(buf, nbytes, ppos, dbg->data, dbg->size); +} + +static int release(struct inode *inode, struct file *file) +{ + struct ctrl_dbg *dbg = file->private_data; + + kfree(dbg->data); + kfree(dbg); + return 0; +} + +static struct file_operations debug_ops = { + .owner = THIS_MODULE, + .open = open, + .llseek = lseek, + .read = read, + .release = release, +}; + +static struct dentry *root; + +void cpqhp_initialize_debugfs(void) +{ + if (!root) + root = debugfs_create_dir("cpqhp", NULL); +} + +void cpqhp_shutdown_debugfs(void) +{ + debugfs_remove(root); +} + +void cpqhp_create_debugfs_files(struct controller *ctrl) +{ + ctrl->dentry = debugfs_create_file(ctrl->pci_dev->dev.bus_id, S_IRUGO, root, ctrl, &debug_ops); +} + +void cpqhp_remove_debugfs_files(struct controller *ctrl) +{ + if (ctrl->dentry) + debugfs_remove(ctrl->dentry); + ctrl->dentry = NULL; +} + diff --git a/drivers/pci/hotplug/ibmphp_pci.c b/drivers/pci/hotplug/ibmphp_pci.c index b1ba429e0a2d..155133fe5c12 100644 --- a/drivers/pci/hotplug/ibmphp_pci.c +++ b/drivers/pci/hotplug/ibmphp_pci.c @@ -969,7 +969,7 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno) debug ("io 32\n"); need_io_upper = TRUE; } - if ((io_base & PCI_PREF_RANGE_TYPE_MASK) == PCI_PREF_RANGE_TYPE_64) { + if ((pfmem_base & PCI_PREF_RANGE_TYPE_MASK) == PCI_PREF_RANGE_TYPE_64) { debug ("pfmem 64\n"); need_pfmem_upper = TRUE; } diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index 8df704860348..4fb569018a24 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c @@ -103,7 +103,10 @@ static void release_slot(struct hotplug_slot *hotplug_slot) static int init_slots(struct controller *ctrl) { - struct slot *new_slot; + struct slot *slot; + struct hpc_ops *hpc_ops; + struct hotplug_slot *hotplug_slot; + struct hotplug_slot_info *hotplug_slot_info; u8 number_of_slots; u8 slot_device; u32 slot_number; @@ -114,59 +117,66 @@ static int init_slots(struct controller *ctrl) slot_number = ctrl->first_slot; while (number_of_slots) { - new_slot = kmalloc(sizeof(*new_slot), GFP_KERNEL); - if (!new_slot) + slot = kmalloc(sizeof(*slot), GFP_KERNEL); + if (!slot) goto error; - memset(new_slot, 0, sizeof(struct slot)); - new_slot->hotplug_slot = - kmalloc(sizeof(*(new_slot->hotplug_slot)), + memset(slot, 0, sizeof(struct slot)); + slot->hotplug_slot = + kmalloc(sizeof(*(slot->hotplug_slot)), GFP_KERNEL); - if (!new_slot->hotplug_slot) + if (!slot->hotplug_slot) goto error_slot; - memset(new_slot->hotplug_slot, 0, sizeof(struct hotplug_slot)); + hotplug_slot = slot->hotplug_slot; + memset(hotplug_slot, 0, sizeof(struct hotplug_slot)); - new_slot->hotplug_slot->info = - kmalloc(sizeof(*(new_slot->hotplug_slot->info)), + hotplug_slot->info = + kmalloc(sizeof(*(hotplug_slot->info)), GFP_KERNEL); - if (!new_slot->hotplug_slot->info) + if (!hotplug_slot->info) goto error_hpslot; - memset(new_slot->hotplug_slot->info, 0, + hotplug_slot_info = hotplug_slot->info; + memset(hotplug_slot_info, 0, sizeof(struct hotplug_slot_info)); - new_slot->hotplug_slot->name = kmalloc(SLOT_NAME_SIZE, - GFP_KERNEL); - if (!new_slot->hotplug_slot->name) + hotplug_slot->name = kmalloc(SLOT_NAME_SIZE, GFP_KERNEL); + if (!hotplug_slot->name) goto error_info; - new_slot->ctrl = ctrl; - new_slot->bus = ctrl->slot_bus; - new_slot->device = slot_device; - new_slot->hpc_ops = ctrl->hpc_ops; + slot->ctrl = ctrl; + slot->bus = ctrl->slot_bus; + slot->device = slot_device; + slot->hpc_ops = hpc_ops = ctrl->hpc_ops; - new_slot->number = ctrl->first_slot; - new_slot->hp_slot = slot_device - ctrl->slot_device_offset; + slot->number = ctrl->first_slot; + slot->hp_slot = slot_device - ctrl->slot_device_offset; /* register this slot with the hotplug pci core */ - new_slot->hotplug_slot->private = new_slot; - new_slot->hotplug_slot->release = &release_slot; - make_slot_name(new_slot->hotplug_slot->name, SLOT_NAME_SIZE, new_slot); - new_slot->hotplug_slot->ops = &pciehp_hotplug_slot_ops; - - new_slot->hpc_ops->get_power_status(new_slot, &(new_slot->hotplug_slot->info->power_status)); - new_slot->hpc_ops->get_attention_status(new_slot, &(new_slot->hotplug_slot->info->attention_status)); - new_slot->hpc_ops->get_latch_status(new_slot, &(new_slot->hotplug_slot->info->latch_status)); - new_slot->hpc_ops->get_adapter_status(new_slot, &(new_slot->hotplug_slot->info->adapter_status)); - - dbg("Registering bus=%x dev=%x hp_slot=%x sun=%x slot_device_offset=%x\n", - new_slot->bus, new_slot->device, new_slot->hp_slot, new_slot->number, ctrl->slot_device_offset); - result = pci_hp_register (new_slot->hotplug_slot); + hotplug_slot->private = slot; + hotplug_slot->release = &release_slot; + make_slot_name(hotplug_slot->name, SLOT_NAME_SIZE, slot); + hotplug_slot->ops = &pciehp_hotplug_slot_ops; + + hpc_ops->get_power_status(slot, + &(hotplug_slot_info->power_status)); + hpc_ops->get_attention_status(slot, + &(hotplug_slot_info->attention_status)); + hpc_ops->get_latch_status(slot, + &(hotplug_slot_info->latch_status)); + hpc_ops->get_adapter_status(slot, + &(hotplug_slot_info->adapter_status)); + + dbg("Registering bus=%x dev=%x hp_slot=%x sun=%x " + "slot_device_offset=%x\n", + slot->bus, slot->device, slot->hp_slot, slot->number, + ctrl->slot_device_offset); + result = pci_hp_register(hotplug_slot); if (result) { err ("pci_hp_register failed with error %d\n", result); goto error_name; } - new_slot->next = ctrl->slot; - ctrl->slot = new_slot; + slot->next = ctrl->slot; + ctrl->slot = slot; number_of_slots--; slot_device++; @@ -176,13 +186,13 @@ static int init_slots(struct controller *ctrl) return 0; error_name: - kfree(new_slot->hotplug_slot->name); + kfree(hotplug_slot->name); error_info: - kfree(new_slot->hotplug_slot->info); + kfree(hotplug_slot_info); error_hpslot: - kfree(new_slot->hotplug_slot); + kfree(hotplug_slot); error_slot: - kfree(new_slot); + kfree(slot); error: return result; } @@ -502,7 +512,7 @@ static void __exit unload_pciehpd(void) } -int hpdriver_context = 0; +static int hpdriver_context = 0; static void pciehp_remove (struct pcie_device *device) { diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index ac1e495c314e..77e530321de2 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -787,8 +787,13 @@ static int hpc_power_on_slot(struct slot * slot) slot_cmd = (slot_ctrl & ~PWR_CTRL) | POWER_ON; + /* Enable detection that we turned off at slot power-off time */ if (!pciehp_poll_mode) - slot_cmd = slot_cmd | HP_INTR_ENABLE; + slot_cmd = slot_cmd | + PWR_FAULT_DETECT_ENABLE | + MRL_DETECT_ENABLE | + PRSN_DETECT_ENABLE | + HP_INTR_ENABLE; retval = pcie_write_cmd(slot, slot_cmd); @@ -833,8 +838,18 @@ static int hpc_power_off_slot(struct slot * slot) slot_cmd = (slot_ctrl & ~PWR_CTRL) | POWER_OFF; + /* + * If we get MRL or presence detect interrupts now, the isr + * will notice the sticky power-fault bit too and issue power + * indicator change commands. This will lead to an endless loop + * of command completions, since the power-fault bit remains on + * till the slot is powered on again. + */ if (!pciehp_poll_mode) - slot_cmd = slot_cmd | HP_INTR_ENABLE; + slot_cmd = (slot_cmd & + ~PWR_FAULT_DETECT_ENABLE & + ~MRL_DETECT_ENABLE & + ~PRSN_DETECT_ENABLE) | HP_INTR_ENABLE; retval = pcie_write_cmd(slot, slot_cmd); diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c index 647673a7d224..4017fb03a0b8 100644 --- a/drivers/pci/hotplug/pciehp_pci.c +++ b/drivers/pci/hotplug/pciehp_pci.c @@ -34,6 +34,31 @@ #include "../pci.h" #include "pciehp.h" +static int pciehp_add_bridge(struct pci_dev *dev) +{ + struct pci_bus *parent = dev->bus; + int pass, busnr, start = parent->secondary; + int end = parent->subordinate; + + for (busnr = start; busnr <= end; busnr++) { + if (!pci_find_bus(pci_domain_nr(parent), busnr)) + break; + } + if (busnr-- > end) { + err("No bus number available for hot-added bridge %s\n", + pci_name(dev)); + return -1; + } + for (pass = 0; pass < 2; pass++) + busnr = pci_scan_bridge(parent, dev, busnr, pass); + if (!dev->subordinate) + return -1; + pci_bus_size_bridges(dev->subordinate); + pci_bus_assign_resources(parent); + pci_enable_bridges(parent); + pci_bus_add_devices(parent); + return 0; +} int pciehp_configure_device(struct slot *p_slot) { @@ -55,8 +80,8 @@ int pciehp_configure_device(struct slot *p_slot) } for (fn = 0; fn < 8; fn++) { - if (!(dev = pci_find_slot(p_slot->bus, - PCI_DEVFN(p_slot->device, fn)))) + dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, fn)); + if (!dev) continue; if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) { err("Cannot hot-add display device %s\n", @@ -65,27 +90,7 @@ int pciehp_configure_device(struct slot *p_slot) } if ((dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) || (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)) { - /* Find an unused bus number for the new bridge */ - struct pci_bus *child; - unsigned char busnr, start = parent->secondary; - unsigned char end = parent->subordinate; - for (busnr = start; busnr <= end; busnr++) { - if (!pci_find_bus(pci_domain_nr(parent), - busnr)) - break; - } - if (busnr >= end) { - err("No free bus for hot-added bridge\n"); - continue; - } - child = pci_add_new_bus(parent, dev, busnr); - if (!child) { - err("Cannot add new bus for %s\n", - pci_name(dev)); - continue; - } - child->subordinate = pci_do_scan_bus(child); - pci_bus_size_bridges(child); + pciehp_add_bridge(dev); } /* TBD: program firmware provided _HPP values */ /* program_fw_provided_values(dev); */ @@ -93,7 +98,6 @@ int pciehp_configure_device(struct slot *p_slot) pci_bus_assign_resources(parent); pci_bus_add_devices(parent); - pci_enable_bridges(parent); return 0; } diff --git a/drivers/pci/hotplug/pciehprm_acpi.c b/drivers/pci/hotplug/pciehprm_acpi.c index ae244e218620..2bdb30f68bf8 100644 --- a/drivers/pci/hotplug/pciehprm_acpi.c +++ b/drivers/pci/hotplug/pciehprm_acpi.c @@ -174,7 +174,9 @@ int pciehp_get_hp_hw_control_from_firmware(struct pci_dev *dev) acpi_status status; acpi_handle chandle, handle = DEVICE_ACPI_HANDLE(&(dev->dev)); struct pci_dev *pdev = dev; + struct pci_bus *parent; u8 *path_name; + /* * Per PCI firmware specification, we should run the ACPI _OSC * method to get control of hotplug hardware before using it. @@ -190,17 +192,18 @@ int pciehp_get_hp_hw_control_from_firmware(struct pci_dev *dev) */ if (!pdev || !pdev->bus->parent) break; + parent = pdev->bus->parent; dbg("Could not find %s in acpi namespace, trying parent\n", pci_name(pdev)); - if (!pdev->bus->parent->self) + if (!parent->self) /* Parent must be a host bridge */ handle = acpi_get_pci_rootbridge_handle( - pci_domain_nr(pdev->bus->parent), - pdev->bus->parent->number); + pci_domain_nr(parent), + parent->number); else handle = DEVICE_ACPI_HANDLE( - &(pdev->bus->parent->self->dev)); - pdev = pdev->bus->parent->self; + &(parent->self->dev)); + pdev = parent->self; } while (handle) { diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c index cc03609f45d0..7d93dbaf628d 100644 --- a/drivers/pci/hotplug/rpadlpar_core.c +++ b/drivers/pci/hotplug/rpadlpar_core.c @@ -112,28 +112,6 @@ static struct slot *find_slot(struct device_node *dn) return NULL; } -static void rpadlpar_claim_one_bus(struct pci_bus *b) -{ - struct list_head *ld; - struct pci_bus *child_bus; - - for (ld = b->devices.next; ld != &b->devices; ld = ld->next) { - struct pci_dev *dev = pci_dev_b(ld); - int i; - - for (i = 0; i < PCI_NUM_RESOURCES; i++) { - struct resource *r = &dev->resource[i]; - - if (r->parent || !r->start || !r->flags) - continue; - rpaphp_claim_resource(dev, i); - } - } - - list_for_each_entry(child_bus, &b->children, node) - rpadlpar_claim_one_bus(child_bus); -} - static struct pci_dev *dlpar_find_new_dev(struct pci_bus *parent, struct device_node *dev_dn) { @@ -154,7 +132,8 @@ static struct pci_dev *dlpar_pci_add_bus(struct device_node *dn) struct pci_controller *phb = pdn->phb; struct pci_dev *dev = NULL; - rpaphp_eeh_init_nodes(dn); + eeh_add_device_tree_early(dn); + /* Add EADS device to PHB bus, adding new entry to bus->devices */ dev = of_create_pci_dev(dn, phb->bus, pdn->devfn); if (!dev) { @@ -170,7 +149,7 @@ static struct pci_dev *dlpar_pci_add_bus(struct device_node *dn) rpaphp_init_new_devs(dev->subordinate); /* Claim new bus resources */ - rpadlpar_claim_one_bus(dev->bus); + pcibios_claim_one_bus(dev->bus); /* ioremap() for child bus, which may or may not succeed */ (void) remap_bus_range(dev->bus); diff --git a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c index 4b35097b3d9f..396b54b0c847 100644 --- a/drivers/pci/hotplug/rpaphp_pci.c +++ b/drivers/pci/hotplug/rpaphp_pci.c @@ -62,28 +62,6 @@ struct pci_bus *rpaphp_find_pci_bus(struct device_node *dn) } EXPORT_SYMBOL_GPL(rpaphp_find_pci_bus); -int rpaphp_claim_resource(struct pci_dev *dev, int resource) -{ - struct resource *res = &dev->resource[resource]; - struct resource *root = pci_find_parent_resource(dev, res); - char *dtype = resource < PCI_BRIDGE_RESOURCES ? "device" : "bridge"; - int err = -EINVAL; - - if (root != NULL) { - err = request_resource(root, res); - } - - if (err) { - err("PCI: %s region %d of %s %s [%lx:%lx]\n", - root ? "Address space collision on" : - "No parent found for", - resource, dtype, pci_name(dev), res->start, res->end); - } - return err; -} - -EXPORT_SYMBOL_GPL(rpaphp_claim_resource); - static int rpaphp_get_sensor_state(struct slot *slot, int *state) { int rc; @@ -177,7 +155,7 @@ void rpaphp_fixup_new_pci_devices(struct pci_bus *bus, int fix_bus) if (r->parent || !r->start || !r->flags) continue; - rpaphp_claim_resource(dev, i); + pci_claim_resource(dev, i); } } } @@ -287,18 +265,6 @@ rpaphp_pci_config_slot(struct pci_bus *bus) return dev; } -void rpaphp_eeh_init_nodes(struct device_node *dn) -{ - struct device_node *sib; - - for (sib = dn->child; sib; sib = sib->sibling) - rpaphp_eeh_init_nodes(sib); - eeh_add_device_early(dn); - return; - -} -EXPORT_SYMBOL_GPL(rpaphp_eeh_init_nodes); - static void print_slot_pci_funcs(struct pci_bus *bus) { struct device_node *dn; @@ -324,7 +290,7 @@ int rpaphp_config_pci_adapter(struct pci_bus *bus) if (!dn) goto exit; - rpaphp_eeh_init_nodes(dn); + eeh_add_device_tree_early(dn); dev = rpaphp_pci_config_slot(bus); if (!dev) { err("%s: can't find any devices.\n", __FUNCTION__); @@ -370,13 +336,14 @@ EXPORT_SYMBOL_GPL(rpaphp_unconfig_pci_adapter); static int setup_pci_hotplug_slot_info(struct slot *slot) { + struct hotplug_slot_info *hotplug_slot_info = slot->hotplug_slot->info; + dbg("%s Initilize the PCI slot's hotplug->info structure ...\n", __FUNCTION__); - rpaphp_get_power_status(slot, &slot->hotplug_slot->info->power_status); + rpaphp_get_power_status(slot, &hotplug_slot_info->power_status); rpaphp_get_pci_adapter_status(slot, 1, - &slot->hotplug_slot->info-> - adapter_status); - if (slot->hotplug_slot->info->adapter_status == NOT_VALID) { + &hotplug_slot_info->adapter_status); + if (hotplug_slot_info->adapter_status == NOT_VALID) { err("%s: NOT_VALID: skip dn->full_name=%s\n", __FUNCTION__, slot->dn->full_name); return -EINVAL; diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h index 08ad26a0cae7..ce0e9b6ce833 100644 --- a/drivers/pci/hotplug/shpchp.h +++ b/drivers/pci/hotplug/shpchp.h @@ -98,6 +98,10 @@ struct controller { enum pci_bus_speed speed; u32 first_slot; /* First physical slot number */ u8 slot_bus; /* Bus where the slots handled by this controller sit */ + u32 cap_offset; + unsigned long mmio_base; + unsigned long mmio_size; + volatile int cmd_busy; }; struct hotplug_params { diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c index 63628e01dd43..a2b3f0010cec 100644 --- a/drivers/pci/hotplug/shpchp_core.c +++ b/drivers/pci/hotplug/shpchp_core.c @@ -65,6 +65,7 @@ static int get_power_status (struct hotplug_slot *slot, u8 *value); static int get_attention_status (struct hotplug_slot *slot, u8 *value); static int get_latch_status (struct hotplug_slot *slot, u8 *value); static int get_adapter_status (struct hotplug_slot *slot, u8 *value); +static int get_address (struct hotplug_slot *slot, u32 *value); static int get_max_bus_speed (struct hotplug_slot *slot, enum pci_bus_speed *value); static int get_cur_bus_speed (struct hotplug_slot *slot, enum pci_bus_speed *value); @@ -77,6 +78,7 @@ static struct hotplug_slot_ops shpchp_hotplug_slot_ops = { .get_attention_status = get_attention_status, .get_latch_status = get_latch_status, .get_adapter_status = get_adapter_status, + .get_address = get_address, .get_max_bus_speed = get_max_bus_speed, .get_cur_bus_speed = get_cur_bus_speed, }; @@ -314,6 +316,18 @@ static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value) return 0; } +static int get_address (struct hotplug_slot *hotplug_slot, u32 *value) +{ + struct slot *slot = get_slot (hotplug_slot, __FUNCTION__); + struct pci_bus *bus = slot->ctrl->pci_dev->subordinate; + + dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); + + *value = (pci_domain_nr(bus) << 16) | (slot->bus << 8) | slot->device; + + return 0; +} + static int get_max_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value) { struct slot *slot = get_slot (hotplug_slot, __FUNCTION__); @@ -377,8 +391,6 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto err_out_free_ctrl; } - ctrl->pci_dev = pdev; /* pci_dev of the P2P bridge */ - pci_set_drvdata(pdev, ctrl); ctrl->pci_bus = kmalloc (sizeof (*ctrl->pci_bus), GFP_KERNEL); diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c index 58619359ad08..25ccb0e47593 100644 --- a/drivers/pci/hotplug/shpchp_ctrl.c +++ b/drivers/pci/hotplug/shpchp_ctrl.c @@ -248,7 +248,6 @@ static int change_bus_speed(struct controller *ctrl, struct slot *p_slot, up(&ctrl->crit_sect); return WRONG_BUS_FREQUENCY; } - wait_for_ctrl_irq (ctrl); if ((rc = p_slot->hpc_ops->check_cmd_status(ctrl))) { err("%s: Can't set bus speed/mode in the case of adapter & bus mismatch\n", @@ -330,9 +329,6 @@ static int board_added(struct slot *p_slot) up(&ctrl->crit_sect); return -1; } - - /* Wait for the command to complete */ - wait_for_ctrl_irq (ctrl); rc = p_slot->hpc_ops->check_cmd_status(ctrl); if (rc) { @@ -352,7 +348,6 @@ static int board_added(struct slot *p_slot) up(&ctrl->crit_sect); return WRONG_BUS_FREQUENCY; } - wait_for_ctrl_irq (ctrl); if ((rc = p_slot->hpc_ops->check_cmd_status(ctrl))) { err("%s: Can't set bus speed/mode in the case of adapter & bus mismatch\n", @@ -367,7 +362,6 @@ static int board_added(struct slot *p_slot) up(&ctrl->crit_sect); return rc; } - wait_for_ctrl_irq (ctrl); if ((rc = p_slot->hpc_ops->check_cmd_status(ctrl))) { err("%s: Failed to enable slot, error code(%d)\n", __FUNCTION__, rc); @@ -494,7 +488,6 @@ static int board_added(struct slot *p_slot) up(&ctrl->crit_sect); return rc; } - wait_for_ctrl_irq (ctrl); if ((rc = p_slot->hpc_ops->check_cmd_status(ctrl))) { err("%s: Failed to enable slot, error code(%d)\n", __FUNCTION__, rc); @@ -532,9 +525,6 @@ static int board_added(struct slot *p_slot) p_slot->hpc_ops->green_led_on(p_slot); - /* Wait for the command to complete */ - wait_for_ctrl_irq (ctrl); - /* Done with exclusive hardware access */ up(&ctrl->crit_sect); @@ -552,8 +542,6 @@ err_exit: up(&ctrl->crit_sect); return rc; } - /* Wait for the command to complete */ - wait_for_ctrl_irq (ctrl); rc = p_slot->hpc_ops->check_cmd_status(ctrl); if (rc) { @@ -603,8 +591,6 @@ static int remove_board(struct slot *p_slot) up(&ctrl->crit_sect); return rc; } - /* Wait for the command to complete */ - wait_for_ctrl_irq (ctrl); rc = p_slot->hpc_ops->check_cmd_status(ctrl); if (rc) { @@ -621,8 +607,6 @@ static int remove_board(struct slot *p_slot) up(&ctrl->crit_sect); return rc; } - /* Wait for the command to complete */ - wait_for_ctrl_irq (ctrl); /* Done with exclusive hardware access */ up(&ctrl->crit_sect); @@ -676,9 +660,6 @@ static void shpchp_pushbutton_thread (unsigned long slot) p_slot->hpc_ops->green_led_off(p_slot); - /* Wait for the command to complete */ - wait_for_ctrl_irq (p_slot->ctrl); - /* Done with exclusive hardware access */ up(&p_slot->ctrl->crit_sect); } @@ -790,14 +771,9 @@ static void interrupt_event_handler(struct controller *ctrl) down(&ctrl->crit_sect); p_slot->hpc_ops->green_led_on(p_slot); - /* Wait for the command to complete */ - wait_for_ctrl_irq (ctrl); p_slot->hpc_ops->set_attention_status(p_slot, 0); - /* Wait for the command to complete */ - wait_for_ctrl_irq (ctrl); - /* Done with exclusive hardware access */ up(&ctrl->crit_sect); break; @@ -806,12 +782,8 @@ static void interrupt_event_handler(struct controller *ctrl) down(&ctrl->crit_sect); p_slot->hpc_ops->green_led_off(p_slot); - /* Wait for the command to complete */ - wait_for_ctrl_irq (ctrl); p_slot->hpc_ops->set_attention_status(p_slot, 0); - /* Wait for the command to complete */ - wait_for_ctrl_irq (ctrl); /* Done with exclusive hardware access */ up(&ctrl->crit_sect); @@ -845,14 +817,9 @@ static void interrupt_event_handler(struct controller *ctrl) /* blink green LED and turn off amber */ p_slot->hpc_ops->green_led_blink(p_slot); - /* Wait for the command to complete */ - wait_for_ctrl_irq (ctrl); p_slot->hpc_ops->set_attention_status(p_slot, 0); - /* Wait for the command to complete */ - wait_for_ctrl_irq (ctrl); - /* Done with exclusive hardware access */ up(&ctrl->crit_sect); @@ -870,12 +837,8 @@ static void interrupt_event_handler(struct controller *ctrl) down(&ctrl->crit_sect); p_slot->hpc_ops->set_attention_status(p_slot, 1); - /* Wait for the command to complete */ - wait_for_ctrl_irq (ctrl); p_slot->hpc_ops->green_led_off(p_slot); - /* Wait for the command to complete */ - wait_for_ctrl_irq (ctrl); /* Done with exclusive hardware access */ up(&ctrl->crit_sect); diff --git a/drivers/pci/hotplug/shpchp_hpc.c b/drivers/pci/hotplug/shpchp_hpc.c index 9987a6fd65b8..b4226ff3a854 100644 --- a/drivers/pci/hotplug/shpchp_hpc.c +++ b/drivers/pci/hotplug/shpchp_hpc.c @@ -275,6 +275,25 @@ static void start_int_poll_timer(struct php_ctlr_state_s *php_ctlr, int seconds) return; } +static inline int shpc_wait_cmd(struct controller *ctrl) +{ + int retval = 0; + unsigned int timeout_msec = shpchp_poll_mode ? 2000 : 1000; + unsigned long timeout = msecs_to_jiffies(timeout_msec); + int rc = wait_event_interruptible_timeout(ctrl->queue, + !ctrl->cmd_busy, timeout); + if (!rc) { + retval = -EIO; + err("Command not completed in %d msec\n", timeout_msec); + } else if (rc < 0) { + retval = -EINTR; + info("Command was interrupted by a signal\n"); + } + ctrl->cmd_busy = 0; + + return retval; +} + static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd) { struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle; @@ -314,8 +333,14 @@ static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd) /* To make sure the Controller Busy bit is 0 before we send out the * command. */ + slot->ctrl->cmd_busy = 1; writew(temp_word, php_ctlr->creg + CMD); + /* + * Wait for command completion. + */ + retval = shpc_wait_cmd(slot->ctrl); + DBG_LEAVE_ROUTINE return retval; } @@ -604,7 +629,7 @@ static int hpc_get_mode1_ECC_cap(struct slot *slot, u8 *mode) sec_bus_status = readw(php_ctlr->creg + SEC_BUS_CONFIG); if (pi == 2) { - *mode = (sec_bus_status & 0x0100) >> 7; + *mode = (sec_bus_status & 0x0100) >> 8; } else { retval = -1; } @@ -791,7 +816,7 @@ static void hpc_release_ctlr(struct controller *ctrl) } if (php_ctlr->pci_dev) { iounmap(php_ctlr->creg); - release_mem_region(pci_resource_start(php_ctlr->pci_dev, 0), pci_resource_len(php_ctlr->pci_dev, 0)); + release_mem_region(ctrl->mmio_base, ctrl->mmio_size); php_ctlr->pci_dev = NULL; } @@ -1058,12 +1083,13 @@ static irqreturn_t shpc_isr(int IRQ, void *dev_id, struct pt_regs *regs) if (intr_loc & 0x0001) { /* * Command Complete Interrupt Pending - * RO only - clear by writing 0 to the Command Completion + * RO only - clear by writing 1 to the Command Completion * Detect bit in Controller SERR-INT register */ temp_dword = readl(php_ctlr->creg + SERR_INTR_ENABLE); - temp_dword &= 0xfffeffff; + temp_dword &= 0xfffdffff; writel(temp_dword, php_ctlr->creg + SERR_INTR_ENABLE); + ctrl->cmd_busy = 0; wake_up_interruptible(&ctrl->queue); } @@ -1121,7 +1147,6 @@ static int hpc_get_max_bus_speed (struct slot *slot, enum pci_bus_speed *value) int retval = 0; u8 pi; u32 slot_avail1, slot_avail2; - int slot_num; DBG_ENTER_ROUTINE @@ -1140,39 +1165,39 @@ static int hpc_get_max_bus_speed (struct slot *slot, enum pci_bus_speed *value) slot_avail2 = readl(php_ctlr->creg + SLOT_AVAIL2); if (pi == 2) { - if ((slot_num = ((slot_avail2 & SLOT_133MHZ_PCIX_533) >> 27) ) != 0 ) + if (slot_avail2 & SLOT_133MHZ_PCIX_533) bus_speed = PCIX_133MHZ_533; - else if ((slot_num = ((slot_avail2 & SLOT_100MHZ_PCIX_533) >> 23) ) != 0 ) + else if (slot_avail2 & SLOT_100MHZ_PCIX_533) bus_speed = PCIX_100MHZ_533; - else if ((slot_num = ((slot_avail2 & SLOT_66MHZ_PCIX_533) >> 19) ) != 0 ) + else if (slot_avail2 & SLOT_66MHZ_PCIX_533) bus_speed = PCIX_66MHZ_533; - else if ((slot_num = ((slot_avail2 & SLOT_133MHZ_PCIX_266) >> 15) ) != 0 ) + else if (slot_avail2 & SLOT_133MHZ_PCIX_266) bus_speed = PCIX_133MHZ_266; - else if ((slot_num = ((slot_avail2 & SLOT_100MHZ_PCIX_266) >> 11) ) != 0 ) + else if (slot_avail2 & SLOT_100MHZ_PCIX_266) bus_speed = PCIX_100MHZ_266; - else if ((slot_num = ((slot_avail2 & SLOT_66MHZ_PCIX_266) >> 7) ) != 0 ) + else if (slot_avail2 & SLOT_66MHZ_PCIX_266) bus_speed = PCIX_66MHZ_266; - else if ((slot_num = ((slot_avail1 & SLOT_133MHZ_PCIX) >> 23) ) != 0 ) + else if (slot_avail1 & SLOT_133MHZ_PCIX) bus_speed = PCIX_133MHZ; - else if ((slot_num = ((slot_avail1 & SLOT_100MHZ_PCIX) >> 15) ) != 0 ) + else if (slot_avail1 & SLOT_100MHZ_PCIX) bus_speed = PCIX_100MHZ; - else if ((slot_num = ((slot_avail1 & SLOT_66MHZ_PCIX) >> 7) ) != 0 ) + else if (slot_avail1 & SLOT_66MHZ_PCIX) bus_speed = PCIX_66MHZ; - else if ((slot_num = (slot_avail2 & SLOT_66MHZ)) != 0 ) + else if (slot_avail2 & SLOT_66MHZ) bus_speed = PCI_66MHZ; - else if ((slot_num = (slot_avail1 & SLOT_33MHZ)) != 0 ) + else if (slot_avail1 & SLOT_33MHZ) bus_speed = PCI_33MHZ; else bus_speed = PCI_SPEED_UNKNOWN; } else { - if ((slot_num = ((slot_avail1 & SLOT_133MHZ_PCIX) >> 23) ) != 0 ) + if (slot_avail1 & SLOT_133MHZ_PCIX) bus_speed = PCIX_133MHZ; - else if ((slot_num = ((slot_avail1 & SLOT_100MHZ_PCIX) >> 15) ) != 0 ) + else if (slot_avail1 & SLOT_100MHZ_PCIX) bus_speed = PCIX_100MHZ; - else if ((slot_num = ((slot_avail1 & SLOT_66MHZ_PCIX) >> 7) ) != 0 ) + else if (slot_avail1 & SLOT_66MHZ_PCIX) bus_speed = PCIX_66MHZ; - else if ((slot_num = (slot_avail2 & SLOT_66MHZ)) != 0 ) + else if (slot_avail2 & SLOT_66MHZ) bus_speed = PCI_66MHZ; - else if ((slot_num = (slot_avail1 & SLOT_33MHZ)) != 0 ) + else if (slot_avail1 & SLOT_33MHZ) bus_speed = PCI_33MHZ; else bus_speed = PCI_SPEED_UNKNOWN; } @@ -1321,19 +1346,34 @@ static struct hpc_ops shpchp_hpc_ops = { .check_cmd_status = hpc_check_cmd_status, }; +inline static int shpc_indirect_creg_read(struct controller *ctrl, int index, + u32 *value) +{ + int rc; + u32 cap_offset = ctrl->cap_offset; + struct pci_dev *pdev = ctrl->pci_dev; + + rc = pci_write_config_byte(pdev, cap_offset + DWORD_SELECT, index); + if (rc) + return rc; + return pci_read_config_dword(pdev, cap_offset + DWORD_DATA, value); +} + int shpc_init(struct controller * ctrl, struct pci_dev * pdev) { struct php_ctlr_state_s *php_ctlr, *p; void *instance_id = ctrl; - int rc; + int rc, num_slots = 0; u8 hp_slot; static int first = 1; - u32 shpc_cap_offset, shpc_base_offset; + u32 shpc_base_offset; u32 tempdword, slot_reg; u8 i; DBG_ENTER_ROUTINE + ctrl->pci_dev = pdev; /* pci_dev of the P2P bridge */ + spin_lock_init(&list_lock); php_ctlr = (struct php_ctlr_state_s *) kmalloc(sizeof(struct php_ctlr_state_s), GFP_KERNEL); @@ -1348,41 +1388,45 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev) if ((pdev->vendor == PCI_VENDOR_ID_AMD) || (pdev->device == PCI_DEVICE_ID_AMD_GOLAM_7450)) { - shpc_base_offset = 0; /* amd shpc driver doesn't use this; assume 0 */ + /* amd shpc driver doesn't use Base Offset; assume 0 */ + ctrl->mmio_base = pci_resource_start(pdev, 0); + ctrl->mmio_size = pci_resource_len(pdev, 0); } else { - if ((shpc_cap_offset = pci_find_capability(pdev, PCI_CAP_ID_SHPC)) == 0) { - err("%s : shpc_cap_offset == 0\n", __FUNCTION__); + ctrl->cap_offset = pci_find_capability(pdev, PCI_CAP_ID_SHPC); + if (!ctrl->cap_offset) { + err("%s : cap_offset == 0\n", __FUNCTION__); goto abort_free_ctlr; } - dbg("%s: shpc_cap_offset = %x\n", __FUNCTION__, shpc_cap_offset); - - rc = pci_write_config_byte(pdev, (u8)shpc_cap_offset + DWORD_SELECT , BASE_OFFSET); + dbg("%s: cap_offset = %x\n", __FUNCTION__, ctrl->cap_offset); + + rc = shpc_indirect_creg_read(ctrl, 0, &shpc_base_offset); if (rc) { - err("%s : pci_word_config_byte failed\n", __FUNCTION__); + err("%s: cannot read base_offset\n", __FUNCTION__); goto abort_free_ctlr; } - - rc = pci_read_config_dword(pdev, (u8)shpc_cap_offset + DWORD_DATA, &shpc_base_offset); + + rc = shpc_indirect_creg_read(ctrl, 3, &tempdword); if (rc) { - err("%s : pci_read_config_dword failed\n", __FUNCTION__); + err("%s: cannot read slot config\n", __FUNCTION__); goto abort_free_ctlr; } + num_slots = tempdword & SLOT_NUM; + dbg("%s: num_slots (indirect) %x\n", __FUNCTION__, num_slots); - for (i = 0; i <= 14; i++) { - rc = pci_write_config_byte(pdev, (u8)shpc_cap_offset + DWORD_SELECT , i); - if (rc) { - err("%s : pci_word_config_byte failed\n", __FUNCTION__); - goto abort_free_ctlr; - } - - rc = pci_read_config_dword(pdev, (u8)shpc_cap_offset + DWORD_DATA, &tempdword); + for (i = 0; i < 9 + num_slots; i++) { + rc = shpc_indirect_creg_read(ctrl, i, &tempdword); if (rc) { - err("%s : pci_read_config_dword failed\n", __FUNCTION__); + err("%s: cannot read creg (index = %d)\n", + __FUNCTION__, i); goto abort_free_ctlr; } dbg("%s: offset %d: value %x\n", __FUNCTION__,i, tempdword); } + + ctrl->mmio_base = + pci_resource_start(pdev, 0) + shpc_base_offset; + ctrl->mmio_size = 0x24 + 0x4 * num_slots; } if (first) { @@ -1396,16 +1440,16 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev) if (pci_enable_device(pdev)) goto abort_free_ctlr; - if (!request_mem_region(pci_resource_start(pdev, 0) + shpc_base_offset, pci_resource_len(pdev, 0), MY_NAME)) { + if (!request_mem_region(ctrl->mmio_base, ctrl->mmio_size, MY_NAME)) { err("%s: cannot reserve MMIO region\n", __FUNCTION__); goto abort_free_ctlr; } - php_ctlr->creg = ioremap(pci_resource_start(pdev, 0) + shpc_base_offset, pci_resource_len(pdev, 0)); + php_ctlr->creg = ioremap(ctrl->mmio_base, ctrl->mmio_size); if (!php_ctlr->creg) { - err("%s: cannot remap MMIO region %lx @ %lx\n", __FUNCTION__, pci_resource_len(pdev, 0), - pci_resource_start(pdev, 0) + shpc_base_offset); - release_mem_region(pci_resource_start(pdev, 0) + shpc_base_offset, pci_resource_len(pdev, 0)); + err("%s: cannot remap MMIO region %lx @ %lx\n", __FUNCTION__, + ctrl->mmio_size, ctrl->mmio_base); + release_mem_region(ctrl->mmio_base, ctrl->mmio_size); goto abort_free_ctlr; } dbg("%s: php_ctlr->creg %p\n", __FUNCTION__, php_ctlr->creg); diff --git a/drivers/pci/hotplug/shpchp_pci.c b/drivers/pci/hotplug/shpchp_pci.c index 38009bc0fd5d..19e1a5e1e30b 100644 --- a/drivers/pci/hotplug/shpchp_pci.c +++ b/drivers/pci/hotplug/shpchp_pci.c @@ -89,10 +89,11 @@ int shpchp_configure_device(struct slot *p_slot) struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; int num, fn; - dev = pci_find_slot(p_slot->bus, PCI_DEVFN(p_slot->device, 0)); + dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0)); if (dev) { err("Device %s already exists at %x:%x, cannot hot-add\n", pci_name(dev), p_slot->bus, p_slot->device); + pci_dev_put(dev); return -EINVAL; } @@ -103,12 +104,13 @@ int shpchp_configure_device(struct slot *p_slot) } for (fn = 0; fn < 8; fn++) { - if (!(dev = pci_find_slot(p_slot->bus, - PCI_DEVFN(p_slot->device, fn)))) + dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, fn)); + if (!dev) continue; if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) { err("Cannot hot-add display device %s\n", pci_name(dev)); + pci_dev_put(dev); continue; } if ((dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) || @@ -124,18 +126,21 @@ int shpchp_configure_device(struct slot *p_slot) } if (busnr >= end) { err("No free bus for hot-added bridge\n"); + pci_dev_put(dev); continue; } child = pci_add_new_bus(parent, dev, busnr); if (!child) { err("Cannot add new bus for %s\n", pci_name(dev)); + pci_dev_put(dev); continue; } child->subordinate = pci_do_scan_bus(child); pci_bus_size_bridges(child); } program_fw_provided_values(dev); + pci_dev_put(dev); } pci_bus_assign_resources(parent); @@ -149,17 +154,19 @@ int shpchp_unconfigure_device(struct slot *p_slot) int rc = 0; int j; u8 bctl = 0; - + struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; + dbg("%s: bus/dev = %x/%x\n", __FUNCTION__, p_slot->bus, p_slot->device); for (j=0; j<8 ; j++) { - struct pci_dev* temp = pci_find_slot(p_slot->bus, + struct pci_dev* temp = pci_get_slot(parent, (p_slot->device << 3) | j); if (!temp) continue; if ((temp->class >> 16) == PCI_BASE_CLASS_DISPLAY) { err("Cannot remove display device %s\n", pci_name(temp)); + pci_dev_put(temp); continue; } if (temp->hdr_type == PCI_HEADER_TYPE_BRIDGE) { @@ -167,10 +174,12 @@ int shpchp_unconfigure_device(struct slot *p_slot) if (bctl & PCI_BRIDGE_CTL_VGA) { err("Cannot remove display device %s\n", pci_name(temp)); + pci_dev_put(temp); continue; } } pci_remove_bus_device(temp); + pci_dev_put(temp); } return rc; } diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 8e287a828d5d..d2a633efa10a 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -19,6 +19,7 @@ #include <asm/dma.h> /* isa_dma_bridge_buggy */ #include "pci.h" +#if 0 /** * pci_bus_max_busnr - returns maximum PCI bus number of given bus' children @@ -63,6 +64,8 @@ pci_max_busnr(void) return max; } +#endif /* 0 */ + static int __pci_find_next_cap(struct pci_bus *bus, unsigned int devfn, u8 pos, int cap) { u8 id; @@ -587,7 +590,7 @@ pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge) { u8 pin; - pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); + pin = dev->pin; if (!pin) return -1; pin--; @@ -917,8 +920,6 @@ EXPORT_SYMBOL_GPL(pci_restore_bars); EXPORT_SYMBOL(pci_enable_device_bars); EXPORT_SYMBOL(pci_enable_device); EXPORT_SYMBOL(pci_disable_device); -EXPORT_SYMBOL(pci_max_busnr); -EXPORT_SYMBOL(pci_bus_max_busnr); EXPORT_SYMBOL(pci_find_capability); EXPORT_SYMBOL(pci_bus_find_capability); EXPORT_SYMBOL(pci_release_regions); diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 294849d24590..a6dfee2f6d2b 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -26,20 +26,15 @@ extern int pci_user_write_config_dword(struct pci_dev *dev, int where, u32 val); #ifdef CONFIG_PROC_FS extern int pci_proc_attach_device(struct pci_dev *dev); extern int pci_proc_detach_device(struct pci_dev *dev); -extern int pci_proc_attach_bus(struct pci_bus *bus); extern int pci_proc_detach_bus(struct pci_bus *bus); #else static inline int pci_proc_attach_device(struct pci_dev *dev) { return 0; } static inline int pci_proc_detach_device(struct pci_dev *dev) { return 0; } -static inline int pci_proc_attach_bus(struct pci_bus *bus) { return 0; } static inline int pci_proc_detach_bus(struct pci_bus *bus) { return 0; } #endif /* Functions for PCI Hotplug drivers to use */ extern unsigned int pci_do_scan_bus(struct pci_bus *bus); -extern int pci_remove_device_safe(struct pci_dev *dev); -extern unsigned char pci_max_busnr(void); -extern unsigned char pci_bus_max_busnr(struct pci_bus *bus); extern int pci_bus_find_capability (struct pci_bus *bus, unsigned int devfn, int cap); extern void pci_remove_legacy_files(struct pci_bus *bus); diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index 467a4ceccf10..e4e5f1e8d816 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c @@ -238,8 +238,8 @@ static void pcie_device_init(struct pci_dev *parent, struct pcie_device *dev, device->driver = NULL; device->driver_data = NULL; device->release = release_pcie_device; /* callback to free pcie dev */ - sprintf(&device->bus_id[0], "pcie%02x", - get_descriptor_id(port_type, service_type)); + snprintf(device->bus_id, sizeof(device->bus_id), "%s:pcie%02x", + pci_name(parent), get_descriptor_id(port_type, service_type)); device->parent = &parent->dev; } diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index fce2cb2112d8..adfad4fd6a13 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -264,8 +264,10 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child) if (base <= limit) { res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) | IORESOURCE_IO; - res->start = base; - res->end = limit + 0xfff; + if (!res->start) + res->start = base; + if (!res->end) + res->end = limit + 0xfff; } res = child->resource[1]; @@ -431,7 +433,7 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max { struct pci_bus *child; int is_cardbus = (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS); - u32 buses, i; + u32 buses, i, j = 0; u16 bctl; pci_read_config_dword(dev, PCI_PRIMARY_BUS, &buses); @@ -541,10 +543,29 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max * as cards with a PCI-to-PCI bridge can be * inserted later. */ - for (i=0; i<CARDBUS_RESERVE_BUSNR; i++) + for (i=0; i<CARDBUS_RESERVE_BUSNR; i++) { + struct pci_bus *parent = bus; if (pci_find_bus(pci_domain_nr(bus), max+i+1)) break; + while (parent->parent) { + if ((!pcibios_assign_all_busses()) && + (parent->subordinate > max) && + (parent->subordinate <= max+i)) { + j = 1; + } + parent = parent->parent; + } + if (j) { + /* + * Often, there are two cardbus bridges + * -- try to leave one valid bus number + * for each one. + */ + i /= 2; + break; + } + } max += i; pci_fixup_parent_subordinate_busnr(child, max); } @@ -559,6 +580,22 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max sprintf(child->name, (is_cardbus ? "PCI CardBus #%02x" : "PCI Bus #%02x"), child->number); + while (bus->parent) { + if ((child->subordinate > bus->subordinate) || + (child->number > bus->subordinate) || + (child->number < bus->number) || + (child->subordinate < bus->number)) { + printk(KERN_WARNING "PCI: Bus #%02x (-#%02x) may be " + "hidden behind%s bridge #%02x (-#%02x)%s\n", + child->number, child->subordinate, + bus->self->transparent ? " transparent" : " ", + bus->number, bus->subordinate, + pcibios_assign_all_busses() ? " " : + " (try 'pci=assign-busses')"); + } + bus = bus->parent; + } + return max; } @@ -571,6 +608,7 @@ static void pci_read_irq(struct pci_dev *dev) unsigned char irq; pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &irq); + dev->pin = irq; if (irq) pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &irq); dev->irq = irq; @@ -624,6 +662,7 @@ static int pci_setup_device(struct pci_dev * dev) /* The PCI-to-PCI bridge spec requires that subtractive decoding (i.e. transparent) bridge must have programming interface code of 0x01. */ + pci_read_irq(dev); dev->transparent = ((dev->class & 0xff) == 1); pci_read_bases(dev, 2, PCI_ROM_ADDRESS1); break; @@ -678,7 +717,7 @@ static void pci_release_dev(struct device *dev) * reading the dword at 0x100 which must either be 0 or a valid extended * capability header. */ -static int pci_cfg_space_size(struct pci_dev *dev) +int pci_cfg_space_size(struct pci_dev *dev) { int pos; u32 status; diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c index 9cb6dd0834be..92a885760832 100644 --- a/drivers/pci/proc.c +++ b/drivers/pci/proc.c @@ -431,6 +431,7 @@ int pci_proc_detach_device(struct pci_dev *dev) return 0; } +#if 0 int pci_proc_attach_bus(struct pci_bus* bus) { struct proc_dir_entry *de = bus->procdir; @@ -447,6 +448,7 @@ int pci_proc_attach_bus(struct pci_bus* bus) } return 0; } +#endif /* 0 */ int pci_proc_detach_bus(struct pci_bus* bus) { @@ -612,7 +614,6 @@ __initcall(pci_proc_init); #ifdef CONFIG_HOTPLUG EXPORT_SYMBOL(pci_proc_attach_device); -EXPORT_SYMBOL(pci_proc_attach_bus); EXPORT_SYMBOL(pci_proc_detach_bus); #endif diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index f28ebdd3958a..605f0df0bfba 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -1342,6 +1342,32 @@ void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) pci_do_fixups(dev, start, end); } +/* Enable 1k I/O space granularity on the Intel P64H2 */ +static void __devinit quirk_p64h2_1k_io(struct pci_dev *dev) +{ + u16 en1k; + u8 io_base_lo, io_limit_lo; + unsigned long base, limit; + struct resource *res = dev->resource + PCI_BRIDGE_RESOURCES; + + pci_read_config_word(dev, 0x40, &en1k); + + if (en1k & 0x200) { + printk(KERN_INFO "PCI: Enable I/O Space to 1 KB Granularity\n"); + + pci_read_config_byte(dev, PCI_IO_BASE, &io_base_lo); + pci_read_config_byte(dev, PCI_IO_LIMIT, &io_limit_lo); + base = (io_base_lo & (PCI_IO_RANGE_MASK | 0x0c)) << 8; + limit = (io_limit_lo & (PCI_IO_RANGE_MASK | 0x0c)) << 8; + + if (base <= limit) { + res->start = base; + res->end = limit + 0x3ff; + } + } +} +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x1460, quirk_p64h2_1k_io); + EXPORT_SYMBOL(pcie_mch_quirk); #ifdef CONFIG_HOTPLUG EXPORT_SYMBOL(pci_fixup_device); diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c index 27a294b6965d..1a6bf9de166f 100644 --- a/drivers/pci/remove.c +++ b/drivers/pci/remove.c @@ -48,6 +48,7 @@ static void pci_destroy_dev(struct pci_dev *dev) * in question is not being used by a driver. * Returns 0 on success. */ +#if 0 int pci_remove_device_safe(struct pci_dev *dev) { if (pci_dev_driver(dev)) @@ -55,7 +56,7 @@ int pci_remove_device_safe(struct pci_dev *dev) pci_destroy_dev(dev); return 0; } -EXPORT_SYMBOL(pci_remove_device_safe); +#endif /* 0 */ void pci_remove_bus(struct pci_bus *pci_bus) { |