Lines Matching defs:func
28 static u32 configure_new_device(struct controller *ctrl, struct pci_func *func,
30 static int configure_new_function(struct controller *ctrl, struct pci_func *func,
58 struct pci_func *func;
72 func = cpqhp_slot_find(ctrl->bus,
85 func->presence_save = (temp_word >> hp_slot) & 0x01;
86 func->presence_save |= (temp_word >> (hp_slot + 7)) & 0x02;
93 func->switch_save = 0;
101 func->switch_save = 0x10;
133 struct pci_func *func;
151 func = cpqhp_slot_find(ctrl->bus,
167 if (func->switch_save && (ctrl->push_button == 1)) {
172 if (temp_byte != func->presence_save) {
202 func->presence_save = (temp_word >> hp_slot) & 0x01;
203 func->presence_save |= (temp_word >> (hp_slot + 7)) & 0x02;
225 struct pci_func *func;
242 func = cpqhp_slot_find(ctrl->bus,
255 func->status = 0x00;
283 func->status = 0xFF;
1070 struct pci_func *func;
1072 func = cpqhp_slot_list[bus];
1074 if ((func == NULL) || ((func->device == device) && (index == 0)))
1075 return func;
1077 if (func->device == device)
1080 while (func->next != NULL) {
1081 func = func->next;
1083 if (func->device == device)
1087 return func;
1096 static int is_bridge(struct pci_func *func)
1099 if (((func->config_space[0x03] >> 16) & 0xFF) == 0x01)
1245 * @func: PCI device/function information
1254 static u32 board_replaced(struct pci_func *func, struct controller *ctrl)
1262 hp_slot = func->device - ctrl->slot_device_offset;
1332 if (func->status == 0xFF) {
1335 func->status = 0;
1337 rc = cpqhp_valid_replace(ctrl, func);
1342 rc = cpqhp_configure_board(ctrl, func);
1347 * called for the "base" bus/dev/func of an
1374 * bus/dev/func of an adapter.
1399 * @func: PCI device/function info
1405 static u32 board_added(struct pci_func *func, struct controller *ctrl)
1418 hp_slot = func->device - ctrl->slot_device_offset;
1419 dbg("%s: func->device, slot_offset, hp_slot = %d, %d ,%d\n",
1420 __func__, func->device, ctrl->slot_device_offset, hp_slot);
1496 dbg("%s: func status = %x\n", __func__, func->status);
1498 if (func->status == 0xFF) {
1503 func->status = 0;
1506 ctrl->pci_bus->number = func->bus;
1507 rc = pci_bus_read_config_dword(ctrl->pci_bus, PCI_DEVFN(func->device, func->function), PCI_VENDOR_ID, &temp_register);
1528 rc = configure_new_device(ctrl, func, 0, &res_lists);
1556 cpqhp_save_slot_config(ctrl, func);
1560 func->status = 0;
1561 func->switch_save = 0x10;
1562 func->is_a_board = 0x01;
1569 new_slot = cpqhp_slot_find(ctrl->bus, func->device, index++);
1606 * @func: PCI device/function info
1610 static u32 remove_board(struct pci_func *func, u32 replace_flag, struct controller *ctrl)
1621 if (cpqhp_unconfigure_device(func))
1624 device = func->device;
1626 hp_slot = func->device - ctrl->slot_device_offset;
1632 rc = cpqhp_save_base_addr_length(ctrl, func);
1633 else if (!func->bus_head && !func->mem_head &&
1634 !func->p_mem_head && !func->io_head) {
1639 temp_func = cpqhp_slot_find(func->bus, func->device, index++);
1650 rc = cpqhp_save_used_resources(ctrl, func);
1653 if (func->is_a_board)
1654 func->status = 0x01;
1655 func->configured = 0;
1675 while (func) {
1681 cpqhp_return_board_resources(func, &res_lists);
1693 if (is_bridge(func)) {
1694 bridge_slot_remove(func);
1696 slot_remove(func);
1698 func = cpqhp_slot_find(ctrl->bus, device, 0);
1702 func = cpqhp_slot_create(ctrl->bus);
1704 if (func == NULL)
1707 func->bus = ctrl->bus;
1708 func->device = device;
1709 func->function = 0;
1710 func->configured = 0;
1711 func->switch_save = 0x10;
1712 func->is_a_board = 0;
1713 func->p_task_event = NULL;
1772 struct pci_func *func;
1784 func = cpqhp_slot_find(ctrl->bus, (hp_slot + ctrl->slot_device_offset), 0);
1785 if (!func)
1792 dbg("hp_slot %d, func %p, p_slot %p\n",
1793 hp_slot, func, p_slot);
1889 struct pci_func *func;
1901 func = cpqhp_slot_find(p_slot->bus, p_slot->device, 0);
1902 dbg("In power_down_board, func = %p, ctrl = %p\n", func, ctrl);
1903 if (!func) {
1904 dbg("Error! func NULL in %s\n", __func__);
1908 if (cpqhp_process_SS(ctrl, func) != 0) {
1923 func = cpqhp_slot_find(p_slot->bus, p_slot->device, 0);
1924 dbg("In add_board, func = %p, ctrl = %p\n", func, ctrl);
1925 if (!func) {
1926 dbg("Error! func NULL in %s\n", __func__);
1931 if (cpqhp_process_SI(ctrl, func) != 0) {
1947 int cpqhp_process_SI(struct controller *ctrl, struct pci_func *func)
1958 device = func->device;
1970 if (func->is_a_board) {
1971 rc = board_replaced(func, ctrl);
1974 slot_remove(func);
1976 func = cpqhp_slot_create(ctrl->bus);
1977 if (func == NULL)
1980 func->bus = ctrl->bus;
1981 func->device = device;
1982 func->function = 0;
1983 func->configured = 0;
1984 func->is_a_board = 1;
1988 func->presence_save = (temp_word >> hp_slot) & 0x01;
1989 func->presence_save |= (temp_word >> (hp_slot + 7)) & 0x02;
1992 func->switch_save = 0;
1994 func->switch_save = 0x10;
1997 rc = board_added(func, ctrl);
1999 if (is_bridge(func)) {
2000 bridge_slot_remove(func);
2002 slot_remove(func);
2005 func = cpqhp_slot_create(ctrl->bus);
2007 if (func == NULL)
2010 func->bus = ctrl->bus;
2011 func->device = device;
2012 func->function = 0;
2013 func->configured = 0;
2014 func->is_a_board = 0;
2018 func->presence_save = (temp_word >> hp_slot) & 0x01;
2019 func->presence_save |=
2023 func->switch_save = 0;
2025 func->switch_save = 0x10;
2037 int cpqhp_process_SS(struct controller *ctrl, struct pci_func *func)
2048 device = func->device;
2049 func = cpqhp_slot_find(ctrl->bus, device, index++);
2055 while (func && !rc) {
2056 pci_bus->number = func->bus;
2057 devfn = PCI_DEVFN(func->device, func->function);
2086 func = cpqhp_slot_find(ctrl->bus, device, index++);
2089 func = cpqhp_slot_find(ctrl->bus, device, 0);
2090 if ((func != NULL) && !rc) {
2093 rc = remove_board(func, replace_flag, ctrl);
2216 * @func: pointer to function structure
2222 static u32 configure_new_device(struct controller *ctrl, struct pci_func *func,
2231 new_slot = func;
2235 ctrl->pci_bus->number = func->bus;
2236 rc = pci_bus_read_config_byte(ctrl->pci_bus, PCI_DEVFN(func->device, func->function), 0x0E, &temp_byte);
2274 pci_bus_read_config_dword(ctrl->pci_bus, PCI_DEVFN(func->device, function), 0x00, &ID);
2280 new_slot = cpqhp_slot_create(func->bus);
2285 new_slot->bus = func->bus;
2286 new_slot->device = func->device;
2311 * @func: pointer to function structure
2318 static int configure_new_function(struct controller *ctrl, struct pci_func *func,
2349 pci_bus->number = func->bus;
2350 devfn = PCI_DEVFN(func->device, func->function);
2359 dbg("set Primary bus = %d\n", func->bus);
2360 rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_PRIMARY_BUS, func->bus);
2518 pci_bus->number = func->bus;
2553 rc = cpqhp_set_irq(func->bus, func->device,
2566 hold_bus_node->next = func->bus_head;
2567 func->bus_head = hold_bus_node;
2608 hold_IO_node->next = func->io_head;
2609 func->io_head = hold_IO_node;
2625 hold_IO_node->next = func->io_head;
2626 func->io_head = hold_IO_node;
2630 hold_IO_node->next = func->io_head;
2631 func->io_head = hold_IO_node;
2658 hold_mem_node->next = func->mem_head;
2659 func->mem_head = hold_mem_node;
2677 hold_mem_node->next = func->mem_head;
2678 func->mem_head = hold_mem_node;
2682 hold_mem_node->next = func->mem_head;
2683 func->mem_head = hold_mem_node;
2711 hold_p_mem_node->next = func->p_mem_head;
2712 func->p_mem_head = hold_p_mem_node;
2728 hold_p_mem_node->next = func->p_mem_head;
2729 func->p_mem_head = hold_p_mem_node;
2733 hold_p_mem_node->next = func->p_mem_head;
2734 func->p_mem_head = hold_p_mem_node;
2786 dbg("func (%p) io_head (%p)\n", func, func->io_head);
2790 io_node->next = func->io_head;
2791 func->io_head = io_node;
2804 p_mem_node->next = func->p_mem_head;
2805 func->p_mem_head = p_mem_node;
2820 mem_node->next = func->mem_head;
2821 func->mem_head = mem_node;
2873 rc = cpqhp_set_irq(func->bus, func->device, temp_byte, IRQ);
2912 func->configured = 1;