提交 c0ed74e9 编写于 作者: B Bjorn Helgaas

Merge branches 'pci/enumeration', 'pci/virtualization' and 'pci/cleanup' into next

* pci/enumeration:
  PCI: Generate uppercase hex for modalias interface class

* pci/virtualization:
  PCI: Add ACS quirk for Solarflare SFC9120 & SFC9140
  PCI: Remove unused pci_get_dma_source()
  PCI: Remove unused pci_find_upstream_pcie_bridge()

* pci/cleanup:
  PCI: Remove assignment from complicated "if" conditions
  PCI: Remove assignment from "if" conditions
  PCI: Remove unnecessary curly braces
  PCI: Add space before open parenthesis
...@@ -182,7 +182,8 @@ int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle) ...@@ -182,7 +182,8 @@ int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle)
{ {
acpi_handle bridge_handle, parent_handle; acpi_handle bridge_handle, parent_handle;
if (!(bridge_handle = acpi_pci_get_bridge_handle(pbus))) bridge_handle = acpi_pci_get_bridge_handle(pbus);
if (!bridge_handle)
return 0; return 0;
if ((ACPI_FAILURE(acpi_get_parent(handle, &parent_handle)))) if ((ACPI_FAILURE(acpi_get_parent(handle, &parent_handle))))
return 0; return 0;
......
...@@ -302,7 +302,7 @@ static int ibm_get_table_from_acpi(char **bufp) ...@@ -302,7 +302,7 @@ static int ibm_get_table_from_acpi(char **bufp)
goto read_table_done; goto read_table_done;
} }
for(size = 0, i = 0; i < package->package.count; i++) { for (size = 0, i = 0; i < package->package.count; i++) {
if (package->package.elements[i].type != ACPI_TYPE_BUFFER) { if (package->package.elements[i].type != ACPI_TYPE_BUFFER) {
pr_err("%s: Invalid APCI element %d\n", __func__, i); pr_err("%s: Invalid APCI element %d\n", __func__, i);
goto read_table_done; goto read_table_done;
......
...@@ -125,7 +125,8 @@ disable_slot(struct hotplug_slot *hotplug_slot) ...@@ -125,7 +125,8 @@ disable_slot(struct hotplug_slot *hotplug_slot)
/* Unconfigure device */ /* Unconfigure device */
dbg("%s - unconfiguring slot %s", __func__, slot_name(slot)); dbg("%s - unconfiguring slot %s", __func__, slot_name(slot));
if ((retval = cpci_unconfigure_slot(slot))) { retval = cpci_unconfigure_slot(slot);
if (retval) {
err("%s - could not unconfigure slot %s", err("%s - could not unconfigure slot %s",
__func__, slot_name(slot)); __func__, slot_name(slot));
goto disable_error; goto disable_error;
...@@ -141,9 +142,11 @@ disable_slot(struct hotplug_slot *hotplug_slot) ...@@ -141,9 +142,11 @@ disable_slot(struct hotplug_slot *hotplug_slot)
} }
cpci_led_on(slot); cpci_led_on(slot);
if (controller->ops->set_power) if (controller->ops->set_power) {
if ((retval = controller->ops->set_power(slot, 0))) retval = controller->ops->set_power(slot, 0);
if (retval)
goto disable_error; goto disable_error;
}
if (update_adapter_status(slot->hotplug_slot, 0)) if (update_adapter_status(slot->hotplug_slot, 0))
warn("failure to update adapter file"); warn("failure to update adapter file");
...@@ -467,9 +470,9 @@ check_slots(void) ...@@ -467,9 +470,9 @@ check_slots(void)
__func__, slot_name(slot), hs_csr); __func__, slot_name(slot), hs_csr);
if (!slot->extracting) { if (!slot->extracting) {
if (update_latch_status(slot->hotplug_slot, 0)) { if (update_latch_status(slot->hotplug_slot, 0))
warn("failure to update latch file"); warn("failure to update latch file");
}
slot->extracting = 1; slot->extracting = 1;
atomic_inc(&extracting); atomic_inc(&extracting);
} }
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
if (debug) \ if (debug) \
printk (KERN_DEBUG "%s: " format "\n", \ printk (KERN_DEBUG "%s: " format "\n", \
MY_NAME , ## arg); \ MY_NAME , ## arg); \
} while(0) } while (0)
#define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME , ## arg) #define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME , ## arg)
#define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME , ## arg) #define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME , ## arg)
#define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME , ## arg) #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME , ## arg)
...@@ -82,28 +82,28 @@ static int __init validate_parameters(void) ...@@ -82,28 +82,28 @@ static int __init validate_parameters(void)
char *p; char *p;
unsigned long tmp; unsigned long tmp;
if(!bridge) { if (!bridge) {
info("not configured, disabling."); info("not configured, disabling.");
return -EINVAL; return -EINVAL;
} }
str = bridge; str = bridge;
if(!*str) if (!*str)
return -EINVAL; return -EINVAL;
tmp = simple_strtoul(str, &p, 16); tmp = simple_strtoul(str, &p, 16);
if(p == str || tmp > 0xff) { if (p == str || tmp > 0xff) {
err("Invalid hotplug bus bridge device bus number"); err("Invalid hotplug bus bridge device bus number");
return -EINVAL; return -EINVAL;
} }
bridge_busnr = (u8) tmp; bridge_busnr = (u8) tmp;
dbg("bridge_busnr = 0x%02x", bridge_busnr); dbg("bridge_busnr = 0x%02x", bridge_busnr);
if(*p != ':') { if (*p != ':') {
err("Invalid hotplug bus bridge device"); err("Invalid hotplug bus bridge device");
return -EINVAL; return -EINVAL;
} }
str = p + 1; str = p + 1;
tmp = simple_strtoul(str, &p, 16); tmp = simple_strtoul(str, &p, 16);
if(p == str || tmp > 0x1f) { if (p == str || tmp > 0x1f) {
err("Invalid hotplug bus bridge device slot number"); err("Invalid hotplug bus bridge device slot number");
return -EINVAL; return -EINVAL;
} }
...@@ -112,18 +112,18 @@ static int __init validate_parameters(void) ...@@ -112,18 +112,18 @@ static int __init validate_parameters(void)
dbg("first_slot = 0x%02x", first_slot); dbg("first_slot = 0x%02x", first_slot);
dbg("last_slot = 0x%02x", last_slot); dbg("last_slot = 0x%02x", last_slot);
if(!(first_slot && last_slot)) { if (!(first_slot && last_slot)) {
err("Need to specify first_slot and last_slot"); err("Need to specify first_slot and last_slot");
return -EINVAL; return -EINVAL;
} }
if(last_slot < first_slot) { if (last_slot < first_slot) {
err("first_slot must be less than last_slot"); err("first_slot must be less than last_slot");
return -EINVAL; return -EINVAL;
} }
dbg("port = 0x%04x", port); dbg("port = 0x%04x", port);
dbg("enum_bit = 0x%02x", enum_bit); dbg("enum_bit = 0x%02x", enum_bit);
if(enum_bit > 7) { if (enum_bit > 7) {
err("Invalid #ENUM bit"); err("Invalid #ENUM bit");
return -EINVAL; return -EINVAL;
} }
...@@ -151,12 +151,12 @@ static int __init cpcihp_generic_init(void) ...@@ -151,12 +151,12 @@ static int __init cpcihp_generic_init(void)
return status; return status;
r = request_region(port, 1, "#ENUM hotswap signal register"); r = request_region(port, 1, "#ENUM hotswap signal register");
if(!r) if (!r)
return -EBUSY; return -EBUSY;
dev = pci_get_domain_bus_and_slot(0, bridge_busnr, dev = pci_get_domain_bus_and_slot(0, bridge_busnr,
PCI_DEVFN(bridge_slot, 0)); PCI_DEVFN(bridge_slot, 0));
if(!dev || dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) { if (!dev || dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) {
err("Invalid bridge device %s", bridge); err("Invalid bridge device %s", bridge);
pci_dev_put(dev); pci_dev_put(dev);
return -EINVAL; return -EINVAL;
...@@ -169,21 +169,21 @@ static int __init cpcihp_generic_init(void) ...@@ -169,21 +169,21 @@ static int __init cpcihp_generic_init(void)
generic_hpc.ops = &generic_hpc_ops; generic_hpc.ops = &generic_hpc_ops;
status = cpci_hp_register_controller(&generic_hpc); status = cpci_hp_register_controller(&generic_hpc);
if(status != 0) { if (status != 0) {
err("Could not register cPCI hotplug controller"); err("Could not register cPCI hotplug controller");
return -ENODEV; return -ENODEV;
} }
dbg("registered controller"); dbg("registered controller");
status = cpci_hp_register_bus(bus, first_slot, last_slot); status = cpci_hp_register_bus(bus, first_slot, last_slot);
if(status != 0) { if (status != 0) {
err("Could not register cPCI hotplug bus"); err("Could not register cPCI hotplug bus");
goto init_bus_register_error; goto init_bus_register_error;
} }
dbg("registered bus"); dbg("registered bus");
status = cpci_hp_start(); status = cpci_hp_start();
if(status != 0) { if (status != 0) {
err("Could not started cPCI hotplug system"); err("Could not started cPCI hotplug system");
goto init_start_error; goto init_start_error;
} }
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
if (debug) \ if (debug) \
printk (KERN_DEBUG "%s: " format "\n", \ printk (KERN_DEBUG "%s: " format "\n", \
MY_NAME , ## arg); \ MY_NAME , ## arg); \
} while(0) } while (0)
#define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME , ## arg) #define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME , ## arg)
#define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME , ## arg) #define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME , ## arg)
#define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME , ## arg) #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME , ## arg)
...@@ -82,13 +82,13 @@ static int zt5550_hc_config(struct pci_dev *pdev) ...@@ -82,13 +82,13 @@ static int zt5550_hc_config(struct pci_dev *pdev)
int ret; int ret;
/* Since we know that no boards exist with two HC chips, treat it as an error */ /* Since we know that no boards exist with two HC chips, treat it as an error */
if(hc_dev) { if (hc_dev) {
err("too many host controller devices?"); err("too many host controller devices?");
return -EBUSY; return -EBUSY;
} }
ret = pci_enable_device(pdev); ret = pci_enable_device(pdev);
if(ret) { if (ret) {
err("cannot enable %s\n", pci_name(pdev)); err("cannot enable %s\n", pci_name(pdev));
return ret; return ret;
} }
...@@ -98,7 +98,7 @@ static int zt5550_hc_config(struct pci_dev *pdev) ...@@ -98,7 +98,7 @@ static int zt5550_hc_config(struct pci_dev *pdev)
dbg("pci resource start %llx", (unsigned long long)pci_resource_start(hc_dev, 1)); dbg("pci resource start %llx", (unsigned long long)pci_resource_start(hc_dev, 1));
dbg("pci resource len %llx", (unsigned long long)pci_resource_len(hc_dev, 1)); dbg("pci resource len %llx", (unsigned long long)pci_resource_len(hc_dev, 1));
if(!request_mem_region(pci_resource_start(hc_dev, 1), if (!request_mem_region(pci_resource_start(hc_dev, 1),
pci_resource_len(hc_dev, 1), MY_NAME)) { pci_resource_len(hc_dev, 1), MY_NAME)) {
err("cannot reserve MMIO region"); err("cannot reserve MMIO region");
ret = -ENOMEM; ret = -ENOMEM;
...@@ -107,7 +107,7 @@ static int zt5550_hc_config(struct pci_dev *pdev) ...@@ -107,7 +107,7 @@ static int zt5550_hc_config(struct pci_dev *pdev)
hc_registers = hc_registers =
ioremap(pci_resource_start(hc_dev, 1), pci_resource_len(hc_dev, 1)); ioremap(pci_resource_start(hc_dev, 1), pci_resource_len(hc_dev, 1));
if(!hc_registers) { if (!hc_registers) {
err("cannot remap MMIO region %llx @ %llx", err("cannot remap MMIO region %llx @ %llx",
(unsigned long long)pci_resource_len(hc_dev, 1), (unsigned long long)pci_resource_len(hc_dev, 1),
(unsigned long long)pci_resource_start(hc_dev, 1)); (unsigned long long)pci_resource_start(hc_dev, 1));
...@@ -146,7 +146,7 @@ static int zt5550_hc_config(struct pci_dev *pdev) ...@@ -146,7 +146,7 @@ static int zt5550_hc_config(struct pci_dev *pdev)
static int zt5550_hc_cleanup(void) static int zt5550_hc_cleanup(void)
{ {
if(!hc_dev) if (!hc_dev)
return -ENODEV; return -ENODEV;
iounmap(hc_registers); iounmap(hc_registers);
...@@ -170,9 +170,9 @@ static int zt5550_hc_check_irq(void *dev_id) ...@@ -170,9 +170,9 @@ static int zt5550_hc_check_irq(void *dev_id)
u8 reg; u8 reg;
ret = 0; ret = 0;
if(dev_id == zt5550_hpc.dev_id) { if (dev_id == zt5550_hpc.dev_id) {
reg = readb(csr_int_status); reg = readb(csr_int_status);
if(reg) if (reg)
ret = 1; ret = 1;
} }
return ret; return ret;
...@@ -182,9 +182,9 @@ static int zt5550_hc_enable_irq(void) ...@@ -182,9 +182,9 @@ static int zt5550_hc_enable_irq(void)
{ {
u8 reg; u8 reg;
if(hc_dev == NULL) { if (hc_dev == NULL)
return -ENODEV; return -ENODEV;
}
reg = readb(csr_int_mask); reg = readb(csr_int_mask);
reg = reg & ~ENUM_INT_MASK; reg = reg & ~ENUM_INT_MASK;
writeb(reg, csr_int_mask); writeb(reg, csr_int_mask);
...@@ -195,9 +195,8 @@ static int zt5550_hc_disable_irq(void) ...@@ -195,9 +195,8 @@ static int zt5550_hc_disable_irq(void)
{ {
u8 reg; u8 reg;
if(hc_dev == NULL) { if (hc_dev == NULL)
return -ENODEV; return -ENODEV;
}
reg = readb(csr_int_mask); reg = readb(csr_int_mask);
reg = reg | ENUM_INT_MASK; reg = reg | ENUM_INT_MASK;
...@@ -210,15 +209,15 @@ static int zt5550_hc_init_one (struct pci_dev *pdev, const struct pci_device_id ...@@ -210,15 +209,15 @@ static int zt5550_hc_init_one (struct pci_dev *pdev, const struct pci_device_id
int status; int status;
status = zt5550_hc_config(pdev); status = zt5550_hc_config(pdev);
if(status != 0) { if (status != 0)
return status; return status;
}
dbg("returned from zt5550_hc_config"); dbg("returned from zt5550_hc_config");
memset(&zt5550_hpc, 0, sizeof (struct cpci_hp_controller)); memset(&zt5550_hpc, 0, sizeof (struct cpci_hp_controller));
zt5550_hpc_ops.query_enum = zt5550_hc_query_enum; zt5550_hpc_ops.query_enum = zt5550_hc_query_enum;
zt5550_hpc.ops = &zt5550_hpc_ops; zt5550_hpc.ops = &zt5550_hpc_ops;
if(!poll) { if (!poll) {
zt5550_hpc.irq = hc_dev->irq; zt5550_hpc.irq = hc_dev->irq;
zt5550_hpc.irq_flags = IRQF_SHARED; zt5550_hpc.irq_flags = IRQF_SHARED;
zt5550_hpc.dev_id = hc_dev; zt5550_hpc.dev_id = hc_dev;
...@@ -231,15 +230,16 @@ static int zt5550_hc_init_one (struct pci_dev *pdev, const struct pci_device_id ...@@ -231,15 +230,16 @@ static int zt5550_hc_init_one (struct pci_dev *pdev, const struct pci_device_id
} }
status = cpci_hp_register_controller(&zt5550_hpc); status = cpci_hp_register_controller(&zt5550_hpc);
if(status != 0) { if (status != 0) {
err("could not register cPCI hotplug controller"); err("could not register cPCI hotplug controller");
goto init_hc_error; goto init_hc_error;
} }
dbg("registered controller"); dbg("registered controller");
/* Look for first device matching cPCI bus's bridge vendor and device IDs */ /* Look for first device matching cPCI bus's bridge vendor and device IDs */
if(!(bus0_dev = pci_get_device(PCI_VENDOR_ID_DEC, bus0_dev = pci_get_device(PCI_VENDOR_ID_DEC,
PCI_DEVICE_ID_DEC_21154, NULL))) { PCI_DEVICE_ID_DEC_21154, NULL);
if (!bus0_dev) {
status = -ENODEV; status = -ENODEV;
goto init_register_error; goto init_register_error;
} }
...@@ -247,14 +247,14 @@ static int zt5550_hc_init_one (struct pci_dev *pdev, const struct pci_device_id ...@@ -247,14 +247,14 @@ static int zt5550_hc_init_one (struct pci_dev *pdev, const struct pci_device_id
pci_dev_put(bus0_dev); pci_dev_put(bus0_dev);
status = cpci_hp_register_bus(bus0, 0x0a, 0x0f); status = cpci_hp_register_bus(bus0, 0x0a, 0x0f);
if(status != 0) { if (status != 0) {
err("could not register cPCI hotplug bus"); err("could not register cPCI hotplug bus");
goto init_register_error; goto init_register_error;
} }
dbg("registered bus"); dbg("registered bus");
status = cpci_hp_start(); status = cpci_hp_start();
if(status != 0) { if (status != 0) {
err("could not started cPCI hotplug system"); err("could not started cPCI hotplug system");
cpci_hp_unregister_bus(bus0); cpci_hp_unregister_bus(bus0);
goto init_register_error; goto init_register_error;
...@@ -300,11 +300,11 @@ static int __init zt5550_init(void) ...@@ -300,11 +300,11 @@ static int __init zt5550_init(void)
info(DRIVER_DESC " version: " DRIVER_VERSION); info(DRIVER_DESC " version: " DRIVER_VERSION);
r = request_region(ENUM_PORT, 1, "#ENUM hotswap signal register"); r = request_region(ENUM_PORT, 1, "#ENUM hotswap signal register");
if(!r) if (!r)
return -EBUSY; return -EBUSY;
rc = pci_register_driver(&zt5550_hc_driver); rc = pci_register_driver(&zt5550_hc_driver);
if(rc < 0) if (rc < 0)
release_region(ENUM_PORT, 1); release_region(ENUM_PORT, 1);
return rc; return rc;
} }
......
...@@ -690,7 +690,7 @@ static inline int cpq_get_latch_status(struct controller *ctrl, ...@@ -690,7 +690,7 @@ static inline int cpq_get_latch_status(struct controller *ctrl,
status = (readl(ctrl->hpc_reg + INT_INPUT_CLEAR) & (0x01L << hp_slot)); status = (readl(ctrl->hpc_reg + INT_INPUT_CLEAR) & (0x01L << hp_slot));
return(status == 0) ? 1 : 0; return (status == 0) ? 1 : 0;
} }
......
...@@ -1096,9 +1096,8 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1096,9 +1096,8 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
/* initialize our threads if they haven't already been started up */ /* initialize our threads if they haven't already been started up */
rc = one_time_init(); rc = one_time_init();
if (rc) { if (rc)
goto err_free_bus; goto err_free_bus;
}
dbg("pdev = %p\n", pdev); dbg("pdev = %p\n", pdev);
dbg("pci resource start %llx\n", (unsigned long long)pci_resource_start(pdev, 0)); dbg("pci resource start %llx\n", (unsigned long long)pci_resource_start(pdev, 0));
......
...@@ -705,9 +705,8 @@ static struct pci_resource *get_max_resource(struct pci_resource **head, u32 siz ...@@ -705,9 +705,8 @@ static struct pci_resource *get_max_resource(struct pci_resource **head, u32 siz
if (temp == max) { if (temp == max) {
*head = max->next; *head = max->next;
} else { } else {
while (temp && temp->next != max) { while (temp && temp->next != max)
temp = temp->next; temp = temp->next;
}
if (temp) if (temp)
temp->next = max->next; temp->next = max->next;
...@@ -903,9 +902,8 @@ irqreturn_t cpqhp_ctrl_intr(int IRQ, void *data) ...@@ -903,9 +902,8 @@ irqreturn_t cpqhp_ctrl_intr(int IRQ, void *data)
/* /*
* Check to see if it was our interrupt * Check to see if it was our interrupt
*/ */
if (!(misc & 0x000C)) { if (!(misc & 0x000C))
return IRQ_NONE; return IRQ_NONE;
}
if (misc & 0x0004) { if (misc & 0x0004) {
/* /*
...@@ -1143,7 +1141,7 @@ static u8 set_controller_speed(struct controller *ctrl, u8 adapter_speed, u8 hp_ ...@@ -1143,7 +1141,7 @@ static u8 set_controller_speed(struct controller *ctrl, u8 adapter_speed, u8 hp_
/* We don't allow freq/mode changes if we find another adapter running /* We don't allow freq/mode changes if we find another adapter running
* in another slot on this controller * in another slot on this controller
*/ */
for(slot = ctrl->slot; slot; slot = slot->next) { for (slot = ctrl->slot; slot; slot = slot->next) {
if (slot->device == (hp_slot + ctrl->slot_device_offset)) if (slot->device == (hp_slot + ctrl->slot_device_offset))
continue; continue;
if (!slot->hotplug_slot || !slot->hotplug_slot->info) if (!slot->hotplug_slot || !slot->hotplug_slot->info)
...@@ -1193,7 +1191,7 @@ static u8 set_controller_speed(struct controller *ctrl, u8 adapter_speed, u8 hp_ ...@@ -1193,7 +1191,7 @@ static u8 set_controller_speed(struct controller *ctrl, u8 adapter_speed, u8 hp_
reg16 = readw(ctrl->hpc_reg + NEXT_CURR_FREQ); reg16 = readw(ctrl->hpc_reg + NEXT_CURR_FREQ);
reg16 &= ~0x000F; reg16 &= ~0x000F;
switch(adapter_speed) { switch (adapter_speed) {
case(PCI_SPEED_133MHz_PCIX): case(PCI_SPEED_133MHz_PCIX):
reg = 0x75; reg = 0x75;
reg16 |= 0xB; reg16 |= 0xB;
...@@ -2006,9 +2004,8 @@ int cpqhp_process_SI(struct controller *ctrl, struct pci_func *func) ...@@ -2006,9 +2004,8 @@ int cpqhp_process_SI(struct controller *ctrl, struct pci_func *func)
/* Check to see if the interlock is closed */ /* Check to see if the interlock is closed */
tempdword = readl(ctrl->hpc_reg + INT_INPUT_CLEAR); tempdword = readl(ctrl->hpc_reg + INT_INPUT_CLEAR);
if (tempdword & (0x01 << hp_slot)) { if (tempdword & (0x01 << hp_slot))
return 1; return 1;
}
if (func->is_a_board) { if (func->is_a_board) {
rc = board_replaced(func, ctrl); rc = board_replaced(func, ctrl);
...@@ -2070,9 +2067,8 @@ int cpqhp_process_SI(struct controller *ctrl, struct pci_func *func) ...@@ -2070,9 +2067,8 @@ int cpqhp_process_SI(struct controller *ctrl, struct pci_func *func)
} }
} }
if (rc) { if (rc)
dbg("%s: rc = %d\n", __func__, rc); dbg("%s: rc = %d\n", __func__, rc);
}
if (p_slot) if (p_slot)
update_slot_info(ctrl, p_slot); update_slot_info(ctrl, p_slot);
...@@ -2095,9 +2091,8 @@ int cpqhp_process_SS(struct controller *ctrl, struct pci_func *func) ...@@ -2095,9 +2091,8 @@ int cpqhp_process_SS(struct controller *ctrl, struct pci_func *func)
device = func->device; device = func->device;
func = cpqhp_slot_find(ctrl->bus, device, index++); func = cpqhp_slot_find(ctrl->bus, device, index++);
p_slot = cpqhp_find_slot(ctrl, device); p_slot = cpqhp_find_slot(ctrl, device);
if (p_slot) { if (p_slot)
physical_slot = p_slot->number; physical_slot = p_slot->number;
}
/* Make sure there are no video controllers here */ /* Make sure there are no video controllers here */
while (func && !rc) { while (func && !rc) {
......
...@@ -204,9 +204,8 @@ static int load_HRT (void __iomem *rom_start) ...@@ -204,9 +204,8 @@ static int load_HRT (void __iomem *rom_start)
u8 temp_byte = 0xFF; u8 temp_byte = 0xFF;
u32 rc; u32 rc;
if (!check_for_compaq_ROM(rom_start)) { if (!check_for_compaq_ROM(rom_start))
return -ENODEV; return -ENODEV;
}
available = 1024; available = 1024;
...@@ -250,9 +249,8 @@ static u32 store_HRT (void __iomem *rom_start) ...@@ -250,9 +249,8 @@ static u32 store_HRT (void __iomem *rom_start)
available = 1024; available = 1024;
if (!check_for_compaq_ROM(rom_start)) { if (!check_for_compaq_ROM(rom_start))
return(1); return(1);
}
buffer = (u32*) evbuffer; buffer = (u32*) evbuffer;
...@@ -427,9 +425,9 @@ static u32 store_HRT (void __iomem *rom_start) ...@@ -427,9 +425,9 @@ static u32 store_HRT (void __iomem *rom_start)
void compaq_nvram_init (void __iomem *rom_start) void compaq_nvram_init (void __iomem *rom_start)
{ {
if (rom_start) { if (rom_start)
compaq_int15_entry_point = (rom_start + ROM_INT15_PHY_ADDR - ROM_PHY_ADDR); compaq_int15_entry_point = (rom_start + ROM_INT15_PHY_ADDR - ROM_PHY_ADDR);
}
dbg("int15 entry = %p\n", compaq_int15_entry_point); dbg("int15 entry = %p\n", compaq_int15_entry_point);
/* initialize our int15 lock */ /* initialize our int15 lock */
...@@ -661,10 +659,9 @@ int compaq_nvram_store (void __iomem *rom_start) ...@@ -661,10 +659,9 @@ int compaq_nvram_store (void __iomem *rom_start)
if (evbuffer_init) { if (evbuffer_init) {
rc = store_HRT(rom_start); rc = store_HRT(rom_start);
if (rc) { if (rc)
err(msg_unable_to_save); err(msg_unable_to_save);
} }
}
return rc; return rc;
} }
...@@ -1023,7 +1023,8 @@ static int enable_slot(struct hotplug_slot *hs) ...@@ -1023,7 +1023,8 @@ static int enable_slot(struct hotplug_slot *hs)
debug("ENABLING SLOT........\n"); debug("ENABLING SLOT........\n");
slot_cur = hs->private; slot_cur = hs->private;
if ((rc = validate(slot_cur, ENABLE))) { rc = validate(slot_cur, ENABLE);
if (rc) {
err("validate function failed\n"); err("validate function failed\n");
goto error_nopower; goto error_nopower;
} }
...@@ -1199,9 +1200,8 @@ int ibmphp_do_disable_slot(struct slot *slot_cur) ...@@ -1199,9 +1200,8 @@ int ibmphp_do_disable_slot(struct slot *slot_cur)
debug("DISABLING SLOT...\n"); debug("DISABLING SLOT...\n");
if ((slot_cur == NULL) || (slot_cur->ctrl == NULL)) { if ((slot_cur == NULL) || (slot_cur->ctrl == NULL))
return -ENODEV; return -ENODEV;
}
flag = slot_cur->flag; flag = slot_cur->flag;
slot_cur->flag = 1; slot_cur->flag = 1;
...@@ -1336,17 +1336,20 @@ static int __init ibmphp_init(void) ...@@ -1336,17 +1336,20 @@ static int __init ibmphp_init(void)
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
irqs[i] = 0; irqs[i] = 0;
if ((rc = ibmphp_access_ebda())) rc = ibmphp_access_ebda();
if (rc)
goto error; goto error;
debug("after ibmphp_access_ebda()\n"); debug("after ibmphp_access_ebda()\n");
if ((rc = ibmphp_rsrc_init())) rc = ibmphp_rsrc_init();
if (rc)
goto error; goto error;
debug("AFTER Resource & EBDA INITIALIZATIONS\n"); debug("AFTER Resource & EBDA INITIALIZATIONS\n");
max_slots = get_max_slots(); max_slots = get_max_slots();
if ((rc = ibmphp_register_pci())) rc = ibmphp_register_pci();
if (rc)
goto error; goto error;
if (init_ops()) { if (init_ops()) {
...@@ -1355,9 +1358,9 @@ static int __init ibmphp_init(void) ...@@ -1355,9 +1358,9 @@ static int __init ibmphp_init(void)
} }
ibmphp_print_test(); ibmphp_print_test();
if ((rc = ibmphp_hpc_start_poll_thread())) { rc = ibmphp_hpc_start_poll_thread();
if (rc)
goto error; goto error;
}
exit: exit:
return rc; return rc;
......
...@@ -215,9 +215,8 @@ static void __init print_ebda_hpc (void) ...@@ -215,9 +215,8 @@ static void __init print_ebda_hpc (void)
debug ("%s - cap of the slot: %x\n", __func__, hpc_ptr->slots[index].slot_cap); debug ("%s - cap of the slot: %x\n", __func__, hpc_ptr->slots[index].slot_cap);
} }
for (index = 0; index < hpc_ptr->bus_count; index++) { for (index = 0; index < hpc_ptr->bus_count; index++)
debug ("%s - bus# of each bus controlled by this ctlr: %x\n", __func__, hpc_ptr->buses[index].bus_num); debug ("%s - bus# of each bus controlled by this ctlr: %x\n", __func__, hpc_ptr->buses[index].bus_num);
}
debug ("%s - type of hpc: %x\n", __func__, hpc_ptr->ctlr_type); debug ("%s - type of hpc: %x\n", __func__, hpc_ptr->ctlr_type);
switch (hpc_ptr->ctlr_type) { switch (hpc_ptr->ctlr_type) {
......
...@@ -997,9 +997,8 @@ static int process_changeinstatus (struct slot *pslot, struct slot *poldslot) ...@@ -997,9 +997,8 @@ static int process_changeinstatus (struct slot *pslot, struct slot *poldslot)
rc = ibmphp_do_disable_slot (pslot); rc = ibmphp_do_disable_slot (pslot);
} }
if (update || disable) { if (update || disable)
ibmphp_update_slot_info (pslot); ibmphp_update_slot_info (pslot);
}
debug ("%s - Exit rc[%d] disable[%x] update[%x]\n", __func__, rc, disable, update); debug ("%s - Exit rc[%d] disable[%x] update[%x]\n", __func__, rc, disable, update);
......
...@@ -145,7 +145,8 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno) ...@@ -145,7 +145,8 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno)
case PCI_HEADER_TYPE_NORMAL: case PCI_HEADER_TYPE_NORMAL:
debug ("single device case.... vendor id = %x, hdr_type = %x, class = %x\n", vendor_id, hdr_type, class); debug ("single device case.... vendor id = %x, hdr_type = %x, class = %x\n", vendor_id, hdr_type, class);
assign_alt_irq (cur_func, class_code); assign_alt_irq (cur_func, class_code);
if ((rc = configure_device (cur_func)) < 0) { rc = configure_device(cur_func);
if (rc < 0) {
/* We need to do this in case some other BARs were properly inserted */ /* We need to do this in case some other BARs were properly inserted */
err ("was not able to configure devfunc %x on bus %x.\n", err ("was not able to configure devfunc %x on bus %x.\n",
cur_func->device, cur_func->busno); cur_func->device, cur_func->busno);
...@@ -157,7 +158,8 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno) ...@@ -157,7 +158,8 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno)
break; break;
case PCI_HEADER_TYPE_MULTIDEVICE: case PCI_HEADER_TYPE_MULTIDEVICE:
assign_alt_irq (cur_func, class_code); assign_alt_irq (cur_func, class_code);
if ((rc = configure_device (cur_func)) < 0) { rc = configure_device(cur_func);
if (rc < 0) {
/* We need to do this in case some other BARs were properly inserted */ /* We need to do this in case some other BARs were properly inserted */
err ("was not able to configure devfunc %x on bus %x...bailing out\n", err ("was not able to configure devfunc %x on bus %x...bailing out\n",
cur_func->device, cur_func->busno); cur_func->device, cur_func->busno);
......
...@@ -224,7 +224,8 @@ int __init ibmphp_rsrc_init (void) ...@@ -224,7 +224,8 @@ int __init ibmphp_rsrc_init (void)
if ((curr->rsrc_type & RESTYPE) == MMASK) { if ((curr->rsrc_type & RESTYPE) == MMASK) {
/* no bus structure exists in place yet */ /* no bus structure exists in place yet */
if (list_empty (&gbuses)) { if (list_empty (&gbuses)) {
if ((rc = alloc_bus_range (&newbus, &newrange, curr, MEM, 1))) rc = alloc_bus_range(&newbus, &newrange, curr, MEM, 1);
if (rc)
return rc; return rc;
list_add_tail (&newbus->bus_list, &gbuses); list_add_tail (&newbus->bus_list, &gbuses);
debug ("gbuses = NULL, Memory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); debug ("gbuses = NULL, Memory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end);
...@@ -237,7 +238,8 @@ int __init ibmphp_rsrc_init (void) ...@@ -237,7 +238,8 @@ int __init ibmphp_rsrc_init (void)
return rc; return rc;
} else { } else {
/* went through all the buses and didn't find ours, need to create a new bus node */ /* went through all the buses and didn't find ours, need to create a new bus node */
if ((rc = alloc_bus_range (&newbus, &newrange, curr, MEM, 1))) rc = alloc_bus_range(&newbus, &newrange, curr, MEM, 1);
if (rc)
return rc; return rc;
list_add_tail (&newbus->bus_list, &gbuses); list_add_tail (&newbus->bus_list, &gbuses);
...@@ -248,7 +250,8 @@ int __init ibmphp_rsrc_init (void) ...@@ -248,7 +250,8 @@ int __init ibmphp_rsrc_init (void)
/* prefetchable memory */ /* prefetchable memory */
if (list_empty (&gbuses)) { if (list_empty (&gbuses)) {
/* no bus structure exists in place yet */ /* no bus structure exists in place yet */
if ((rc = alloc_bus_range (&newbus, &newrange, curr, PFMEM, 1))) rc = alloc_bus_range(&newbus, &newrange, curr, PFMEM, 1);
if (rc)
return rc; return rc;
list_add_tail (&newbus->bus_list, &gbuses); list_add_tail (&newbus->bus_list, &gbuses);
debug ("gbuses = NULL, PFMemory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); debug ("gbuses = NULL, PFMemory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end);
...@@ -261,7 +264,8 @@ int __init ibmphp_rsrc_init (void) ...@@ -261,7 +264,8 @@ int __init ibmphp_rsrc_init (void)
return rc; return rc;
} else { } else {
/* went through all the buses and didn't find ours, need to create a new bus node */ /* went through all the buses and didn't find ours, need to create a new bus node */
if ((rc = alloc_bus_range (&newbus, &newrange, curr, PFMEM, 1))) rc = alloc_bus_range(&newbus, &newrange, curr, PFMEM, 1);
if (rc)
return rc; return rc;
list_add_tail (&newbus->bus_list, &gbuses); list_add_tail (&newbus->bus_list, &gbuses);
debug ("1st Bus, PFMemory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); debug ("1st Bus, PFMemory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end);
...@@ -271,7 +275,8 @@ int __init ibmphp_rsrc_init (void) ...@@ -271,7 +275,8 @@ int __init ibmphp_rsrc_init (void)
/* IO */ /* IO */
if (list_empty (&gbuses)) { if (list_empty (&gbuses)) {
/* no bus structure exists in place yet */ /* no bus structure exists in place yet */
if ((rc = alloc_bus_range (&newbus, &newrange, curr, IO, 1))) rc = alloc_bus_range(&newbus, &newrange, curr, IO, 1);
if (rc)
return rc; return rc;
list_add_tail (&newbus->bus_list, &gbuses); list_add_tail (&newbus->bus_list, &gbuses);
debug ("gbuses = NULL, IO Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); debug ("gbuses = NULL, IO Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end);
...@@ -283,7 +288,8 @@ int __init ibmphp_rsrc_init (void) ...@@ -283,7 +288,8 @@ int __init ibmphp_rsrc_init (void)
return rc; return rc;
} else { } else {
/* went through all the buses and didn't find ours, need to create a new bus node */ /* went through all the buses and didn't find ours, need to create a new bus node */
if ((rc = alloc_bus_range (&newbus, &newrange, curr, IO, 1))) rc = alloc_bus_range(&newbus, &newrange, curr, IO, 1);
if (rc)
return rc; return rc;
list_add_tail (&newbus->bus_list, &gbuses); list_add_tail (&newbus->bus_list, &gbuses);
debug ("1st Bus, IO Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); debug ("1st Bus, IO Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end);
...@@ -1038,7 +1044,9 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge) ...@@ -1038,7 +1044,9 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge)
/* found our range */ /* found our range */
if (!res_prev) { if (!res_prev) {
/* first time in the loop */ /* first time in the loop */
if ((res_cur->start != range->start) && ((len_tmp = res_cur->start - 1 - range->start) >= res->len)) { len_tmp = res_cur->start - 1 - range->start;
if ((res_cur->start != range->start) && (len_tmp >= res->len)) {
debug ("len_tmp = %x\n", len_tmp); debug ("len_tmp = %x\n", len_tmp);
if ((len_tmp < len_cur) || (len_cur == 0)) { if ((len_tmp < len_cur) || (len_cur == 0)) {
...@@ -1078,7 +1086,9 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge) ...@@ -1078,7 +1086,9 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge)
} }
if (!res_cur->next) { if (!res_cur->next) {
/* last device on the range */ /* last device on the range */
if ((range->end != res_cur->end) && ((len_tmp = range->end - (res_cur->end + 1)) >= res->len)) { len_tmp = range->end - (res_cur->end + 1);
if ((range->end != res_cur->end) && (len_tmp >= res->len)) {
debug ("len_tmp = %x\n", len_tmp); debug ("len_tmp = %x\n", len_tmp);
if ((len_tmp < len_cur) || (len_cur == 0)) { if ((len_tmp < len_cur) || (len_cur == 0)) {
...@@ -1117,8 +1127,9 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge) ...@@ -1117,8 +1127,9 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge)
if (res_prev) { if (res_prev) {
if (res_prev->rangeno != res_cur->rangeno) { if (res_prev->rangeno != res_cur->rangeno) {
/* 1st device on this range */ /* 1st device on this range */
if ((res_cur->start != range->start) && len_tmp = res_cur->start - 1 - range->start;
((len_tmp = res_cur->start - 1 - range->start) >= res->len)) {
if ((res_cur->start != range->start) && (len_tmp >= res->len)) {
if ((len_tmp < len_cur) || (len_cur == 0)) { if ((len_tmp < len_cur) || (len_cur == 0)) {
if ((range->start % tmp_divide) == 0) { if ((range->start % tmp_divide) == 0) {
/* just perfect, starting address is divisible by length */ /* just perfect, starting address is divisible by length */
...@@ -1153,7 +1164,9 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge) ...@@ -1153,7 +1164,9 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge)
} }
} else { } else {
/* in the same range */ /* in the same range */
if ((len_tmp = res_cur->start - 1 - res_prev->end - 1) >= res->len) { len_tmp = res_cur->start - 1 - res_prev->end - 1;
if (len_tmp >= res->len) {
if ((len_tmp < len_cur) || (len_cur == 0)) { if ((len_tmp < len_cur) || (len_cur == 0)) {
if (((res_prev->end + 1) % tmp_divide) == 0) { if (((res_prev->end + 1) % tmp_divide) == 0) {
/* just perfect, starting address's divisible by length */ /* just perfect, starting address's divisible by length */
...@@ -1212,7 +1225,9 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge) ...@@ -1212,7 +1225,9 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge)
break; break;
} }
while (range) { while (range) {
if ((len_tmp = range->end - range->start) >= res->len) { len_tmp = range->end - range->start;
if (len_tmp >= res->len) {
if ((len_tmp < len_cur) || (len_cur == 0)) { if ((len_tmp < len_cur) || (len_cur == 0)) {
if ((range->start % tmp_divide) == 0) { if ((range->start % tmp_divide) == 0) {
/* just perfect, starting address's divisible by length */ /* just perfect, starting address's divisible by length */
...@@ -1276,7 +1291,9 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge) ...@@ -1276,7 +1291,9 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge)
break; break;
} }
while (range) { while (range) {
if ((len_tmp = range->end - range->start) >= res->len) { len_tmp = range->end - range->start;
if (len_tmp >= res->len) {
if ((len_tmp < len_cur) || (len_cur == 0)) { if ((len_tmp < len_cur) || (len_cur == 0)) {
if ((range->start % tmp_divide) == 0) { if ((range->start % tmp_divide) == 0) {
/* just perfect, starting address's divisible by length */ /* just perfect, starting address's divisible by length */
...@@ -1335,7 +1352,7 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge) ...@@ -1335,7 +1352,7 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge)
return -EINVAL; return -EINVAL;
} }
} }
} /* end if(!res_cur) */ } /* end if (!res_cur) */
return -EINVAL; return -EINVAL;
} }
......
...@@ -195,7 +195,8 @@ static int change_bus_speed(struct controller *ctrl, struct slot *p_slot, ...@@ -195,7 +195,8 @@ static int change_bus_speed(struct controller *ctrl, struct slot *p_slot,
int rc = 0; int rc = 0;
ctrl_dbg(ctrl, "Change speed to %d\n", speed); ctrl_dbg(ctrl, "Change speed to %d\n", speed);
if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, speed))) { rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, speed);
if (rc) {
ctrl_err(ctrl, "%s: Issue of set bus speed mode command failed\n", ctrl_err(ctrl, "%s: Issue of set bus speed mode command failed\n",
__func__); __func__);
return WRONG_BUS_FREQUENCY; return WRONG_BUS_FREQUENCY;
...@@ -261,14 +262,16 @@ static int board_added(struct slot *p_slot) ...@@ -261,14 +262,16 @@ static int board_added(struct slot *p_slot)
} }
if ((ctrl->pci_dev->vendor == 0x8086) && (ctrl->pci_dev->device == 0x0332)) { if ((ctrl->pci_dev->vendor == 0x8086) && (ctrl->pci_dev->device == 0x0332)) {
if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, PCI_SPEED_33MHz))) { rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, PCI_SPEED_33MHz);
if (rc) {
ctrl_err(ctrl, "%s: Issue of set bus speed mode command failed\n", ctrl_err(ctrl, "%s: Issue of set bus speed mode command failed\n",
__func__); __func__);
return WRONG_BUS_FREQUENCY; return WRONG_BUS_FREQUENCY;
} }
/* turn on board, blink green LED, turn off Amber LED */ /* turn on board, blink green LED, turn off Amber LED */
if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) { rc = p_slot->hpc_ops->slot_enable(p_slot);
if (rc) {
ctrl_err(ctrl, "Issue of Slot Enable command failed\n"); ctrl_err(ctrl, "Issue of Slot Enable command failed\n");
return rc; return rc;
} }
...@@ -296,7 +299,8 @@ static int board_added(struct slot *p_slot) ...@@ -296,7 +299,8 @@ static int board_added(struct slot *p_slot)
return rc; return rc;
/* turn on board, blink green LED, turn off Amber LED */ /* turn on board, blink green LED, turn off Amber LED */
if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) { rc = p_slot->hpc_ops->slot_enable(p_slot);
if (rc) {
ctrl_err(ctrl, "Issue of Slot Enable command failed\n"); ctrl_err(ctrl, "Issue of Slot Enable command failed\n");
return rc; return rc;
} }
...@@ -595,7 +599,7 @@ static int shpchp_enable_slot (struct slot *p_slot) ...@@ -595,7 +599,7 @@ static int shpchp_enable_slot (struct slot *p_slot)
ctrl_dbg(ctrl, "%s: p_slot->pwr_save %x\n", __func__, p_slot->pwr_save); ctrl_dbg(ctrl, "%s: p_slot->pwr_save %x\n", __func__, p_slot->pwr_save);
p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
if(((p_slot->ctrl->pci_dev->vendor == PCI_VENDOR_ID_AMD) || if (((p_slot->ctrl->pci_dev->vendor == PCI_VENDOR_ID_AMD) ||
(p_slot->ctrl->pci_dev->device == PCI_DEVICE_ID_AMD_POGO_7458)) (p_slot->ctrl->pci_dev->device == PCI_DEVICE_ID_AMD_POGO_7458))
&& p_slot->ctrl->num_slots == 1) { && p_slot->ctrl->num_slots == 1) {
/* handle amd pogo errata; this must be done before enable */ /* handle amd pogo errata; this must be done before enable */
......
...@@ -466,7 +466,8 @@ static int hpc_get_adapter_speed(struct slot *slot, enum pci_bus_speed *value) ...@@ -466,7 +466,8 @@ static int hpc_get_adapter_speed(struct slot *slot, enum pci_bus_speed *value)
u8 m66_cap = !!(slot_reg & MHZ66_CAP); u8 m66_cap = !!(slot_reg & MHZ66_CAP);
u8 pi, pcix_cap; u8 pi, pcix_cap;
if ((retval = hpc_get_prog_int(slot, &pi))) retval = hpc_get_prog_int(slot, &pi);
if (retval)
return retval; return retval;
switch (pi) { switch (pi) {
...@@ -798,7 +799,7 @@ static irqreturn_t shpc_isr(int irq, void *dev_id) ...@@ -798,7 +799,7 @@ static irqreturn_t shpc_isr(int irq, void *dev_id)
ctrl_dbg(ctrl, "%s: intr_loc = %x\n", __func__, intr_loc); ctrl_dbg(ctrl, "%s: intr_loc = %x\n", __func__, intr_loc);
if(!shpchp_poll_mode) { if (!shpchp_poll_mode) {
/* /*
* Mask Global Interrupt Mask - see implementation * Mask Global Interrupt Mask - see implementation
* note on p. 139 of SHPC spec rev 1.0 * note on p. 139 of SHPC spec rev 1.0
......
...@@ -177,7 +177,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, ...@@ -177,7 +177,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
{ {
struct pci_dev *pci_dev = to_pci_dev(dev); struct pci_dev *pci_dev = to_pci_dev(dev);
return sprintf(buf, "pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x\n", return sprintf(buf, "pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02X\n",
pci_dev->vendor, pci_dev->device, pci_dev->vendor, pci_dev->device,
pci_dev->subsystem_vendor, pci_dev->subsystem_device, pci_dev->subsystem_vendor, pci_dev->subsystem_device,
(u8)(pci_dev->class >> 16), (u8)(pci_dev->class >> 8), (u8)(pci_dev->class >> 16), (u8)(pci_dev->class >> 8),
......
...@@ -1003,12 +1003,19 @@ int pci_save_state(struct pci_dev *dev) ...@@ -1003,12 +1003,19 @@ int pci_save_state(struct pci_dev *dev)
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
pci_read_config_dword(dev, i * 4, &dev->saved_config_space[i]); pci_read_config_dword(dev, i * 4, &dev->saved_config_space[i]);
dev->state_saved = true; dev->state_saved = true;
if ((i = pci_save_pcie_state(dev)) != 0)
i = pci_save_pcie_state(dev);
if (i != 0)
return i; return i;
if ((i = pci_save_pcix_state(dev)) != 0)
i = pci_save_pcix_state(dev);
if (i != 0)
return i; return i;
if ((i = pci_save_vc_state(dev)) != 0)
i = pci_save_vc_state(dev);
if (i != 0)
return i; return i;
return 0; return 0;
} }
EXPORT_SYMBOL(pci_save_state); EXPORT_SYMBOL(pci_save_state);
......
...@@ -3534,57 +3534,6 @@ DECLARE_PCI_FIXUP_HEADER(0x1283, 0x8892, quirk_use_pcie_bridge_dma_alias); ...@@ -3534,57 +3534,6 @@ DECLARE_PCI_FIXUP_HEADER(0x1283, 0x8892, quirk_use_pcie_bridge_dma_alias);
/* Intel 82801, https://bugzilla.kernel.org/show_bug.cgi?id=44881#c49 */ /* Intel 82801, https://bugzilla.kernel.org/show_bug.cgi?id=44881#c49 */
DECLARE_PCI_FIXUP_HEADER(0x8086, 0x244e, quirk_use_pcie_bridge_dma_alias); DECLARE_PCI_FIXUP_HEADER(0x8086, 0x244e, quirk_use_pcie_bridge_dma_alias);
static struct pci_dev *pci_func_0_dma_source(struct pci_dev *dev)
{
if (!PCI_FUNC(dev->devfn))
return pci_dev_get(dev);
return pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn), 0));
}
static const struct pci_dev_dma_source {
u16 vendor;
u16 device;
struct pci_dev *(*dma_source)(struct pci_dev *dev);
} pci_dev_dma_source[] = {
/*
* https://bugzilla.redhat.com/show_bug.cgi?id=605888
*
* Some Ricoh devices use the function 0 source ID for DMA on
* other functions of a multifunction device. The DMA devices
* is therefore function 0, which will have implications of the
* iommu grouping of these devices.
*/
{ PCI_VENDOR_ID_RICOH, 0xe822, pci_func_0_dma_source },
{ PCI_VENDOR_ID_RICOH, 0xe230, pci_func_0_dma_source },
{ PCI_VENDOR_ID_RICOH, 0xe832, pci_func_0_dma_source },
{ PCI_VENDOR_ID_RICOH, 0xe476, pci_func_0_dma_source },
{ 0 }
};
/*
* IOMMUs with isolation capabilities need to be programmed with the
* correct source ID of a device. In most cases, the source ID matches
* the device doing the DMA, but sometimes hardware is broken and will
* tag the DMA as being sourced from a different device. This function
* allows that translation. Note that the reference count of the
* returned device is incremented on all paths.
*/
struct pci_dev *pci_get_dma_source(struct pci_dev *dev)
{
const struct pci_dev_dma_source *i;
for (i = pci_dev_dma_source; i->dma_source; i++) {
if ((i->vendor == dev->vendor ||
i->vendor == (u16)PCI_ANY_ID) &&
(i->device == dev->device ||
i->device == (u16)PCI_ANY_ID))
return i->dma_source(dev);
}
return pci_dev_get(dev);
}
/* /*
* AMD has indicated that the devices below do not support peer-to-peer * AMD has indicated that the devices below do not support peer-to-peer
* in any system where they are found in the southbridge with an AMD * in any system where they are found in the southbridge with an AMD
...@@ -3686,6 +3635,21 @@ static int pci_quirk_intel_pch_acs(struct pci_dev *dev, u16 acs_flags) ...@@ -3686,6 +3635,21 @@ static int pci_quirk_intel_pch_acs(struct pci_dev *dev, u16 acs_flags)
return acs_flags & ~flags ? 0 : 1; return acs_flags & ~flags ? 0 : 1;
} }
static int pci_quirk_solarflare_acs(struct pci_dev *dev, u16 acs_flags)
{
/*
* SV, TB, and UF are not relevant to multifunction endpoints.
*
* Solarflare indicates that peer-to-peer between functions is not
* possible, therefore RR, CR, and DT are not implemented. Mask
* these out as if they were clear in the ACS capabilities register.
*/
acs_flags &= ~(PCI_ACS_SV | PCI_ACS_TB | PCI_ACS_RR |
PCI_ACS_CR | PCI_ACS_UF | PCI_ACS_DT);
return acs_flags ? 0 : 1;
}
static const struct pci_dev_acs_enabled { static const struct pci_dev_acs_enabled {
u16 vendor; u16 vendor;
u16 device; u16 device;
...@@ -3697,6 +3661,8 @@ static const struct pci_dev_acs_enabled { ...@@ -3697,6 +3661,8 @@ static const struct pci_dev_acs_enabled {
{ PCI_VENDOR_ID_ATI, 0x439d, pci_quirk_amd_sb_acs }, { PCI_VENDOR_ID_ATI, 0x439d, pci_quirk_amd_sb_acs },
{ PCI_VENDOR_ID_ATI, 0x4384, pci_quirk_amd_sb_acs }, { PCI_VENDOR_ID_ATI, 0x4384, pci_quirk_amd_sb_acs },
{ PCI_VENDOR_ID_ATI, 0x4399, pci_quirk_amd_sb_acs }, { PCI_VENDOR_ID_ATI, 0x4399, pci_quirk_amd_sb_acs },
{ PCI_VENDOR_ID_SOLARFLARE, 0x0903, pci_quirk_solarflare_acs },
{ PCI_VENDOR_ID_SOLARFLARE, 0x0923, pci_quirk_solarflare_acs },
{ PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_quirk_intel_pch_acs }, { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_quirk_intel_pch_acs },
{ 0 } { 0 }
}; };
......
...@@ -103,40 +103,6 @@ int pci_for_each_dma_alias(struct pci_dev *pdev, ...@@ -103,40 +103,6 @@ int pci_for_each_dma_alias(struct pci_dev *pdev,
return ret; return ret;
} }
/*
* find the upstream PCIe-to-PCI bridge of a PCI device
* if the device is PCIE, return NULL
* if the device isn't connected to a PCIe bridge (that is its parent is a
* legacy PCI bridge and the bridge is directly connected to bus 0), return its
* parent
*/
struct pci_dev *pci_find_upstream_pcie_bridge(struct pci_dev *pdev)
{
struct pci_dev *tmp = NULL;
if (pci_is_pcie(pdev))
return NULL;
while (1) {
if (pci_is_root_bus(pdev->bus))
break;
pdev = pdev->bus->self;
/* a p2p bridge */
if (!pci_is_pcie(pdev)) {
tmp = pdev;
continue;
}
/* PCI device should connect to a PCIe bridge */
if (pci_pcie_type(pdev) != PCI_EXP_TYPE_PCI_BRIDGE) {
/* Busted hardware? */
WARN_ON_ONCE(1);
return NULL;
}
return pdev;
}
return tmp;
}
static struct pci_bus *pci_do_find_bus(struct pci_bus *bus, unsigned char busnr) static struct pci_bus *pci_do_find_bus(struct pci_bus *bus, unsigned char busnr)
{ {
struct pci_bus *child; struct pci_bus *child;
......
...@@ -1557,16 +1557,11 @@ enum pci_fixup_pass { ...@@ -1557,16 +1557,11 @@ enum pci_fixup_pass {
#ifdef CONFIG_PCI_QUIRKS #ifdef CONFIG_PCI_QUIRKS
void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
struct pci_dev *pci_get_dma_source(struct pci_dev *dev);
int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags); int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags);
void pci_dev_specific_enable_acs(struct pci_dev *dev); void pci_dev_specific_enable_acs(struct pci_dev *dev);
#else #else
static inline void pci_fixup_device(enum pci_fixup_pass pass, static inline void pci_fixup_device(enum pci_fixup_pass pass,
struct pci_dev *dev) { } struct pci_dev *dev) { }
static inline struct pci_dev *pci_get_dma_source(struct pci_dev *dev)
{
return pci_dev_get(dev);
}
static inline int pci_dev_specific_acs_enabled(struct pci_dev *dev, static inline int pci_dev_specific_acs_enabled(struct pci_dev *dev,
u16 acs_flags) u16 acs_flags)
{ {
...@@ -1828,17 +1823,6 @@ int pci_for_each_dma_alias(struct pci_dev *pdev, ...@@ -1828,17 +1823,6 @@ int pci_for_each_dma_alias(struct pci_dev *pdev,
int (*fn)(struct pci_dev *pdev, int (*fn)(struct pci_dev *pdev,
u16 alias, void *data), void *data); u16 alias, void *data), void *data);
/**
* pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device
* @pdev: the PCI device
*
* if the device is PCIE, return NULL
* if the device isn't connected to a PCIe bridge (that is its parent is a
* legacy PCI bridge and the bridge is directly connected to bus 0), return its
* parent
*/
struct pci_dev *pci_find_upstream_pcie_bridge(struct pci_dev *pdev);
/* helper functions for operation of device flag */ /* helper functions for operation of device flag */
static inline void pci_set_dev_assigned(struct pci_dev *pdev) static inline void pci_set_dev_assigned(struct pci_dev *pdev)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册