aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/cpqphp_ctrl.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/hotplug/cpqphp_ctrl.c')
-rw-r--r--drivers/pci/hotplug/cpqphp_ctrl.c57
1 files changed, 20 insertions, 37 deletions
diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c
index 36112fe212d3..d282019cda5f 100644
--- a/drivers/pci/hotplug/cpqphp_ctrl.c
+++ b/drivers/pci/hotplug/cpqphp_ctrl.c
@@ -1900,8 +1900,7 @@ static void interrupt_event_handler(struct controller *ctrl)
1900 dbg("power fault\n"); 1900 dbg("power fault\n");
1901 } else { 1901 } else {
1902 /* refresh notification */ 1902 /* refresh notification */
1903 if (p_slot) 1903 update_slot_info(ctrl, p_slot);
1904 update_slot_info(ctrl, p_slot);
1905 } 1904 }
1906 1905
1907 ctrl->event_queue[loop].event_type = 0; 1906 ctrl->event_queue[loop].event_type = 0;
@@ -2520,44 +2519,28 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func
2520 2519
2521 /* If we have IO resources copy them and fill in the bridge's 2520 /* If we have IO resources copy them and fill in the bridge's
2522 * IO range registers */ 2521 * IO range registers */
2523 if (io_node) { 2522 memcpy(hold_IO_node, io_node, sizeof(struct pci_resource));
2524 memcpy(hold_IO_node, io_node, sizeof(struct pci_resource)); 2523 io_node->next = NULL;
2525 io_node->next = NULL;
2526 2524
2527 /* set IO base and Limit registers */ 2525 /* set IO base and Limit registers */
2528 temp_byte = io_node->base >> 8; 2526 temp_byte = io_node->base >> 8;
2529 rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_IO_BASE, temp_byte); 2527 rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_IO_BASE, temp_byte);
2530 2528
2531 temp_byte = (io_node->base + io_node->length - 1) >> 8; 2529 temp_byte = (io_node->base + io_node->length - 1) >> 8;
2532 rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_IO_LIMIT, temp_byte); 2530 rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_IO_LIMIT, temp_byte);
2533 } else {
2534 kfree(hold_IO_node);
2535 hold_IO_node = NULL;
2536 }
2537
2538 /* If we have memory resources copy them and fill in the
2539 * bridge's memory range registers. Otherwise, fill in the
2540 * range registers with values that disable them. */
2541 if (mem_node) {
2542 memcpy(hold_mem_node, mem_node, sizeof(struct pci_resource));
2543 mem_node->next = NULL;
2544
2545 /* set Mem base and Limit registers */
2546 temp_word = mem_node->base >> 16;
2547 rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_BASE, temp_word);
2548 2531
2549 temp_word = (mem_node->base + mem_node->length - 1) >> 16; 2532 /* Copy the memory resources and fill in the bridge's memory
2550 rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word); 2533 * range registers.
2551 } else { 2534 */
2552 temp_word = 0xFFFF; 2535 memcpy(hold_mem_node, mem_node, sizeof(struct pci_resource));
2553 rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_BASE, temp_word); 2536 mem_node->next = NULL;
2554 2537
2555 temp_word = 0x0000; 2538 /* set Mem base and Limit registers */
2556 rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word); 2539 temp_word = mem_node->base >> 16;
2540 rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_BASE, temp_word);
2557 2541
2558 kfree(hold_mem_node); 2542 temp_word = (mem_node->base + mem_node->length - 1) >> 16;
2559 hold_mem_node = NULL; 2543 rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word);
2560 }
2561 2544
2562 memcpy(hold_p_mem_node, p_mem_node, sizeof(struct pci_resource)); 2545 memcpy(hold_p_mem_node, p_mem_node, sizeof(struct pci_resource));
2563 p_mem_node->next = NULL; 2546 p_mem_node->next = NULL;
@@ -2627,7 +2610,7 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func
2627 /* Return unused bus resources 2610 /* Return unused bus resources
2628 * First use the temporary node to store information for 2611 * First use the temporary node to store information for
2629 * the board */ 2612 * the board */
2630 if (hold_bus_node && bus_node && temp_resources.bus_head) { 2613 if (bus_node && temp_resources.bus_head) {
2631 hold_bus_node->length = bus_node->base - hold_bus_node->base; 2614 hold_bus_node->length = bus_node->base - hold_bus_node->base;
2632 2615
2633 hold_bus_node->next = func->bus_head; 2616 hold_bus_node->next = func->bus_head;
@@ -2751,7 +2734,7 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func
2751 } 2734 }
2752 /* If we have prefetchable memory space available and there 2735 /* If we have prefetchable memory space available and there
2753 * is some left at the end, return the unused portion */ 2736 * is some left at the end, return the unused portion */
2754 if (hold_p_mem_node && temp_resources.p_mem_head) { 2737 if (temp_resources.p_mem_head) {
2755 p_mem_node = do_pre_bridge_resource_split(&(temp_resources.p_mem_head), 2738 p_mem_node = do_pre_bridge_resource_split(&(temp_resources.p_mem_head),
2756 &hold_p_mem_node, 0x100000); 2739 &hold_p_mem_node, 0x100000);
2757 2740