Lines Matching refs:func
42 static u32 configure_new_device(struct controller *ctrl, struct pci_func *func,
44 static int configure_new_function(struct controller *ctrl, struct pci_func *func,
72 struct pci_func *func; in handle_switch_change() local
86 func = cpqhp_slot_find(ctrl->bus, in handle_switch_change()
99 func->presence_save = (temp_word >> hp_slot) & 0x01; in handle_switch_change()
100 func->presence_save |= (temp_word >> (hp_slot + 7)) & 0x02; in handle_switch_change()
107 func->switch_save = 0; in handle_switch_change()
115 func->switch_save = 0x10; in handle_switch_change()
147 struct pci_func *func; in handle_presence_change() local
165 func = cpqhp_slot_find(ctrl->bus, in handle_presence_change()
181 if (func->switch_save && (ctrl->push_button == 1)) { in handle_presence_change()
186 if (temp_byte != func->presence_save) { in handle_presence_change()
216 func->presence_save = (temp_word >> hp_slot) & 0x01; in handle_presence_change()
217 func->presence_save |= (temp_word >> (hp_slot + 7)) & 0x02; in handle_presence_change()
239 struct pci_func *func; in handle_power_fault() local
256 func = cpqhp_slot_find(ctrl->bus, in handle_power_fault()
269 func->status = 0x00; in handle_power_fault()
297 func->status = 0xFF; in handle_power_fault()
1084 struct pci_func *func; in cpqhp_slot_find() local
1086 func = cpqhp_slot_list[bus]; in cpqhp_slot_find()
1088 if ((func == NULL) || ((func->device == device) && (index == 0))) in cpqhp_slot_find()
1089 return func; in cpqhp_slot_find()
1091 if (func->device == device) in cpqhp_slot_find()
1094 while (func->next != NULL) { in cpqhp_slot_find()
1095 func = func->next; in cpqhp_slot_find()
1097 if (func->device == device) in cpqhp_slot_find()
1101 return func; in cpqhp_slot_find()
1110 static int is_bridge(struct pci_func *func) in is_bridge() argument
1113 if (((func->config_space[0x03] >> 16) & 0xFF) == 0x01) in is_bridge()
1270 static u32 board_replaced(struct pci_func *func, struct controller *ctrl) in board_replaced() argument
1278 hp_slot = func->device - ctrl->slot_device_offset; in board_replaced()
1348 if (func->status == 0xFF) { in board_replaced()
1351 func->status = 0; in board_replaced()
1353 rc = cpqhp_valid_replace(ctrl, func); in board_replaced()
1358 rc = cpqhp_configure_board(ctrl, func); in board_replaced()
1421 static u32 board_added(struct pci_func *func, struct controller *ctrl) in board_added() argument
1434 hp_slot = func->device - ctrl->slot_device_offset; in board_added()
1436 __func__, func->device, ctrl->slot_device_offset, hp_slot); in board_added()
1512 dbg("%s: func status = %x\n", __func__, func->status); in board_added()
1514 if (func->status == 0xFF) { in board_added()
1519 func->status = 0; in board_added()
1522 ctrl->pci_bus->number = func->bus; in board_added()
1523 …rc = pci_bus_read_config_dword (ctrl->pci_bus, PCI_DEVFN(func->device, func->function), PCI_VENDOR… in board_added()
1544 rc = configure_new_device(ctrl, func, 0, &res_lists); in board_added()
1572 cpqhp_save_slot_config(ctrl, func); in board_added()
1576 func->status = 0; in board_added()
1577 func->switch_save = 0x10; in board_added()
1578 func->is_a_board = 0x01; in board_added()
1585 new_slot = cpqhp_slot_find(ctrl->bus, func->device, index++); in board_added()
1626 static u32 remove_board(struct pci_func *func, u32 replace_flag, struct controller *ctrl) in remove_board() argument
1637 if (cpqhp_unconfigure_device(func)) in remove_board()
1640 device = func->device; in remove_board()
1642 hp_slot = func->device - ctrl->slot_device_offset; in remove_board()
1648 rc = cpqhp_save_base_addr_length(ctrl, func); in remove_board()
1649 else if (!func->bus_head && !func->mem_head && in remove_board()
1650 !func->p_mem_head && !func->io_head) { in remove_board()
1655 temp_func = cpqhp_slot_find(func->bus, func->device, index++); in remove_board()
1666 rc = cpqhp_save_used_resources(ctrl, func); in remove_board()
1669 if (func->is_a_board) in remove_board()
1670 func->status = 0x01; in remove_board()
1671 func->configured = 0; in remove_board()
1691 while (func) { in remove_board()
1697 cpqhp_return_board_resources(func, &res_lists); in remove_board()
1709 if (is_bridge(func)) { in remove_board()
1710 bridge_slot_remove(func); in remove_board()
1712 slot_remove(func); in remove_board()
1714 func = cpqhp_slot_find(ctrl->bus, device, 0); in remove_board()
1718 func = cpqhp_slot_create(ctrl->bus); in remove_board()
1720 if (func == NULL) in remove_board()
1723 func->bus = ctrl->bus; in remove_board()
1724 func->device = device; in remove_board()
1725 func->function = 0; in remove_board()
1726 func->configured = 0; in remove_board()
1727 func->switch_save = 0x10; in remove_board()
1728 func->is_a_board = 0; in remove_board()
1729 func->p_task_event = NULL; in remove_board()
1805 struct pci_func *func; in interrupt_event_handler() local
1817 func = cpqhp_slot_find(ctrl->bus, (hp_slot + ctrl->slot_device_offset), 0); in interrupt_event_handler()
1818 if (!func) in interrupt_event_handler()
1826 hp_slot, func, p_slot); in interrupt_event_handler()
1927 struct pci_func *func; in cpqhp_pushbutton_thread() local
1939 func = cpqhp_slot_find(p_slot->bus, p_slot->device, 0); in cpqhp_pushbutton_thread()
1940 dbg("In power_down_board, func = %p, ctrl = %p\n", func, ctrl); in cpqhp_pushbutton_thread()
1941 if (!func) { in cpqhp_pushbutton_thread()
1946 if (cpqhp_process_SS(ctrl, func) != 0) { in cpqhp_pushbutton_thread()
1961 func = cpqhp_slot_find(p_slot->bus, p_slot->device, 0); in cpqhp_pushbutton_thread()
1962 dbg("In add_board, func = %p, ctrl = %p\n", func, ctrl); in cpqhp_pushbutton_thread()
1963 if (!func) { in cpqhp_pushbutton_thread()
1969 if (cpqhp_process_SI(ctrl, func) != 0) { in cpqhp_pushbutton_thread()
1987 int cpqhp_process_SI(struct controller *ctrl, struct pci_func *func) in cpqhp_process_SI() argument
1998 device = func->device; in cpqhp_process_SI()
2010 if (func->is_a_board) { in cpqhp_process_SI()
2011 rc = board_replaced(func, ctrl); in cpqhp_process_SI()
2014 slot_remove(func); in cpqhp_process_SI()
2016 func = cpqhp_slot_create(ctrl->bus); in cpqhp_process_SI()
2017 if (func == NULL) in cpqhp_process_SI()
2020 func->bus = ctrl->bus; in cpqhp_process_SI()
2021 func->device = device; in cpqhp_process_SI()
2022 func->function = 0; in cpqhp_process_SI()
2023 func->configured = 0; in cpqhp_process_SI()
2024 func->is_a_board = 1; in cpqhp_process_SI()
2028 func->presence_save = (temp_word >> hp_slot) & 0x01; in cpqhp_process_SI()
2029 func->presence_save |= (temp_word >> (hp_slot + 7)) & 0x02; in cpqhp_process_SI()
2032 func->switch_save = 0; in cpqhp_process_SI()
2034 func->switch_save = 0x10; in cpqhp_process_SI()
2037 rc = board_added(func, ctrl); in cpqhp_process_SI()
2039 if (is_bridge(func)) { in cpqhp_process_SI()
2040 bridge_slot_remove(func); in cpqhp_process_SI()
2042 slot_remove(func); in cpqhp_process_SI()
2045 func = cpqhp_slot_create(ctrl->bus); in cpqhp_process_SI()
2047 if (func == NULL) in cpqhp_process_SI()
2050 func->bus = ctrl->bus; in cpqhp_process_SI()
2051 func->device = device; in cpqhp_process_SI()
2052 func->function = 0; in cpqhp_process_SI()
2053 func->configured = 0; in cpqhp_process_SI()
2054 func->is_a_board = 0; in cpqhp_process_SI()
2058 func->presence_save = (temp_word >> hp_slot) & 0x01; in cpqhp_process_SI()
2059 func->presence_save |= in cpqhp_process_SI()
2063 func->switch_save = 0; in cpqhp_process_SI()
2065 func->switch_save = 0x10; in cpqhp_process_SI()
2080 int cpqhp_process_SS(struct controller *ctrl, struct pci_func *func) in cpqhp_process_SS() argument
2091 device = func->device; in cpqhp_process_SS()
2092 func = cpqhp_slot_find(ctrl->bus, device, index++); in cpqhp_process_SS()
2098 while (func && !rc) { in cpqhp_process_SS()
2099 pci_bus->number = func->bus; in cpqhp_process_SS()
2100 devfn = PCI_DEVFN(func->device, func->function); in cpqhp_process_SS()
2129 func = cpqhp_slot_find(ctrl->bus, device, index++); in cpqhp_process_SS()
2132 func = cpqhp_slot_find(ctrl->bus, device, 0); in cpqhp_process_SS()
2133 if ((func != NULL) && !rc) { in cpqhp_process_SS()
2136 rc = remove_board(func, replace_flag, ctrl); in cpqhp_process_SS()
2268 static u32 configure_new_device(struct controller *ctrl, struct pci_func *func, in configure_new_device() argument
2277 new_slot = func; in configure_new_device()
2281 ctrl->pci_bus->number = func->bus; in configure_new_device()
2282 …rc = pci_bus_read_config_byte (ctrl->pci_bus, PCI_DEVFN(func->device, func->function), 0x0E, &temp… in configure_new_device()
2320 pci_bus_read_config_dword (ctrl->pci_bus, PCI_DEVFN(func->device, function), 0x00, &ID); in configure_new_device()
2326 new_slot = cpqhp_slot_create(func->bus); in configure_new_device()
2331 new_slot->bus = func->bus; in configure_new_device()
2332 new_slot->device = func->device; in configure_new_device()
2364 static int configure_new_function(struct controller *ctrl, struct pci_func *func, in configure_new_function() argument
2395 pci_bus->number = func->bus; in configure_new_function()
2396 devfn = PCI_DEVFN(func->device, func->function); in configure_new_function()
2405 dbg("set Primary bus = %d\n", func->bus); in configure_new_function()
2406 rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_PRIMARY_BUS, func->bus); in configure_new_function()
2564 pci_bus->number = func->bus; in configure_new_function()
2599 rc = cpqhp_set_irq(func->bus, func->device, in configure_new_function()
2612 hold_bus_node->next = func->bus_head; in configure_new_function()
2613 func->bus_head = hold_bus_node; in configure_new_function()
2654 hold_IO_node->next = func->io_head; in configure_new_function()
2655 func->io_head = hold_IO_node; in configure_new_function()
2671 hold_IO_node->next = func->io_head; in configure_new_function()
2672 func->io_head = hold_IO_node; in configure_new_function()
2676 hold_IO_node->next = func->io_head; in configure_new_function()
2677 func->io_head = hold_IO_node; in configure_new_function()
2704 hold_mem_node->next = func->mem_head; in configure_new_function()
2705 func->mem_head = hold_mem_node; in configure_new_function()
2723 hold_mem_node->next = func->mem_head; in configure_new_function()
2724 func->mem_head = hold_mem_node; in configure_new_function()
2728 hold_mem_node->next = func->mem_head; in configure_new_function()
2729 func->mem_head = hold_mem_node; in configure_new_function()
2757 hold_p_mem_node->next = func->p_mem_head; in configure_new_function()
2758 func->p_mem_head = hold_p_mem_node; in configure_new_function()
2774 hold_p_mem_node->next = func->p_mem_head; in configure_new_function()
2775 func->p_mem_head = hold_p_mem_node; in configure_new_function()
2779 hold_p_mem_node->next = func->p_mem_head; in configure_new_function()
2780 func->p_mem_head = hold_p_mem_node; in configure_new_function()
2830 dbg("func (%p) io_head (%p)\n", func, func->io_head); in configure_new_function()
2836 io_node->next = func->io_head; in configure_new_function()
2837 func->io_head = io_node; in configure_new_function()
2852 p_mem_node->next = func->p_mem_head; in configure_new_function()
2853 func->p_mem_head = p_mem_node; in configure_new_function()
2868 mem_node->next = func->mem_head; in configure_new_function()
2869 func->mem_head = mem_node; in configure_new_function()
2921 rc = cpqhp_set_irq(func->bus, func->device, temp_byte, IRQ); in configure_new_function()
2960 func->configured = 1; in configure_new_function()