Lines Matching full:ctrl

116  * @ctrl: controller to use
120 static int init_SERR(struct controller *ctrl) in init_SERR() argument
125 if (!ctrl) in init_SERR()
128 tempdword = ctrl->first_slot; in init_SERR()
130 number_of_slots = readb(ctrl->hpc_reg + SLOT_MASK) & 0x0F; in init_SERR()
133 writeb(0, ctrl->hpc_reg + SLOT_SERR); in init_SERR()
266 static int ctrl_slot_cleanup(struct controller *ctrl) in ctrl_slot_cleanup() argument
270 old_slot = ctrl->slot; in ctrl_slot_cleanup()
271 ctrl->slot = NULL; in ctrl_slot_cleanup()
280 cpqhp_remove_debugfs_files(ctrl); in ctrl_slot_cleanup()
283 free_irq(ctrl->interrupt, ctrl); in ctrl_slot_cleanup()
285 iounmap(ctrl->hpc_reg); in ctrl_slot_cleanup()
287 release_mem_region(pci_resource_start(ctrl->pci_dev, 0), in ctrl_slot_cleanup()
288 pci_resource_len(ctrl->pci_dev, 0)); in ctrl_slot_cleanup()
369 * @ctrl: struct controller to use
374 cpqhp_set_attention_status(struct controller *ctrl, struct pci_func *func, in cpqhp_set_attention_status() argument
382 hp_slot = func->device - ctrl->slot_device_offset; in cpqhp_set_attention_status()
385 mutex_lock(&ctrl->crit_sect); in cpqhp_set_attention_status()
388 amber_LED_on(ctrl, hp_slot); in cpqhp_set_attention_status()
390 amber_LED_off(ctrl, hp_slot); in cpqhp_set_attention_status()
393 mutex_unlock(&ctrl->crit_sect); in cpqhp_set_attention_status()
397 set_SOGO(ctrl); in cpqhp_set_attention_status()
400 wait_for_ctrl_irq(ctrl); in cpqhp_set_attention_status()
403 mutex_unlock(&ctrl->crit_sect); in cpqhp_set_attention_status()
418 struct controller *ctrl = slot->ctrl; in set_attention_status() local
426 if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1) in set_attention_status()
437 return cpqhp_set_attention_status(ctrl, slot_func, status); in set_attention_status()
445 struct controller *ctrl = slot->ctrl; in process_SI() local
453 if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1) in process_SI()
468 dbg("board_added(%p, %p)\n", slot_func, ctrl); in process_SI()
469 return cpqhp_process_SI(ctrl, slot_func); in process_SI()
477 struct controller *ctrl = slot->ctrl; in process_SS() local
485 if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1) in process_SS()
496 dbg("In %s, slot_func = %p, ctrl = %p\n", __func__, slot_func, ctrl); in process_SS()
497 return cpqhp_process_SS(ctrl, slot_func); in process_SS()
504 struct controller *ctrl = slot->ctrl; in hardware_test() local
508 return cpqhp_hardware_test(ctrl, value); in hardware_test()
515 struct controller *ctrl = slot->ctrl; in get_power_status() local
519 *value = get_slot_enabled(ctrl, slot); in get_power_status()
526 struct controller *ctrl = slot->ctrl; in get_attention_status() local
530 *value = cpq_get_attention_status(ctrl, slot); in get_attention_status()
537 struct controller *ctrl = slot->ctrl; in get_latch_status() local
541 *value = cpq_get_latch_status(ctrl, slot); in get_latch_status()
549 struct controller *ctrl = slot->ctrl; in get_adapter_status() local
553 *value = get_presence_status(ctrl, slot); in get_adapter_status()
571 static int ctrl_slot_setup(struct controller *ctrl, in ctrl_slot_setup() argument
576 struct pci_bus *bus = ctrl->pci_bus; in ctrl_slot_setup()
588 tempdword = readl(ctrl->hpc_reg + INT_INPUT_CLEAR); in ctrl_slot_setup()
590 number_of_slots = readb(ctrl->hpc_reg + SLOT_MASK) & 0x0F; in ctrl_slot_setup()
591 slot_device = readb(ctrl->hpc_reg + SLOT_MASK) >> 4; in ctrl_slot_setup()
592 slot_number = ctrl->first_slot; in ctrl_slot_setup()
601 slot->ctrl = ctrl; in ctrl_slot_setup()
602 slot->bus = ctrl->bus; in ctrl_slot_setup()
635 slot_device - (readb(ctrl->hpc_reg + SLOT_MASK) >> 4); in ctrl_slot_setup()
646 ((read_slot_enable(ctrl) << 2) >> ctrl_slot) & 0x04; in ctrl_slot_setup()
652 dbg("registering bus %d, dev %d, number %d, ctrl->slot_device_offset %d, slot %d\n", in ctrl_slot_setup()
654 slot->number, ctrl->slot_device_offset, in ctrl_slot_setup()
657 ctrl->pci_dev->bus, in ctrl_slot_setup()
665 slot->next = ctrl->slot; in ctrl_slot_setup()
666 ctrl->slot = slot; in ctrl_slot_setup()
764 struct controller *ctrl; in cpqhpc_probe() local
824 ctrl = kzalloc(sizeof(struct controller), GFP_KERNEL); in cpqhpc_probe()
825 if (!ctrl) { in cpqhpc_probe()
837 ctrl->vendor_id = vendor_id; in cpqhpc_probe()
842 ctrl->push_flag = 1; in cpqhpc_probe()
843 ctrl->slot_switch_type = 1; in cpqhpc_probe()
844 ctrl->push_button = 1; in cpqhpc_probe()
845 ctrl->pci_config_space = 1; in cpqhpc_probe()
846 ctrl->defeature_PHP = 1; in cpqhpc_probe()
847 ctrl->pcix_support = 1; in cpqhpc_probe()
848 ctrl->pcix_speed_capability = 1; in cpqhpc_probe()
877 ctrl->slot_switch_type = 1; in cpqhpc_probe()
879 ctrl->push_button = 0; in cpqhpc_probe()
880 ctrl->pci_config_space = 1; in cpqhpc_probe()
881 ctrl->defeature_PHP = 1; in cpqhpc_probe()
882 ctrl->pcix_support = 0; in cpqhpc_probe()
883 ctrl->pcix_speed_capability = 0; in cpqhpc_probe()
887 ctrl->push_flag = 1; in cpqhpc_probe()
888 ctrl->slot_switch_type = 1; in cpqhpc_probe()
890 ctrl->push_button = 1; in cpqhpc_probe()
891 ctrl->pci_config_space = 1; in cpqhpc_probe()
892 ctrl->defeature_PHP = 1; in cpqhpc_probe()
893 ctrl->pcix_support = 0; in cpqhpc_probe()
894 ctrl->pcix_speed_capability = 0; in cpqhpc_probe()
898 ctrl->slot_switch_type = 1; in cpqhpc_probe()
900 ctrl->push_button = 0; in cpqhpc_probe()
901 ctrl->pci_config_space = 1; in cpqhpc_probe()
902 ctrl->defeature_PHP = 1; in cpqhpc_probe()
903 ctrl->pcix_support = 0; in cpqhpc_probe()
904 ctrl->pcix_speed_capability = 0; in cpqhpc_probe()
908 ctrl->push_flag = 1; in cpqhpc_probe()
909 ctrl->slot_switch_type = 1; in cpqhpc_probe()
911 ctrl->push_button = 1; in cpqhpc_probe()
912 ctrl->pci_config_space = 1; in cpqhpc_probe()
913 ctrl->defeature_PHP = 1; in cpqhpc_probe()
914 ctrl->pcix_support = 0; in cpqhpc_probe()
915 ctrl->pcix_speed_capability = 0; in cpqhpc_probe()
919 ctrl->push_flag = 1; in cpqhpc_probe()
920 ctrl->slot_switch_type = 1; in cpqhpc_probe()
922 ctrl->push_button = 1; in cpqhpc_probe()
923 ctrl->pci_config_space = 1; in cpqhpc_probe()
924 ctrl->defeature_PHP = 1; in cpqhpc_probe()
925 ctrl->pcix_support = 1; in cpqhpc_probe()
926 ctrl->pcix_speed_capability = 0; in cpqhpc_probe()
944 ctrl->push_button = 0; in cpqhpc_probe()
946 ctrl->push_button = 1; in cpqhpc_probe()
950 ctrl->slot_switch_type = 0; in cpqhpc_probe()
952 ctrl->slot_switch_type = 1; in cpqhpc_probe()
956 ctrl->defeature_PHP = 1; /* PHP supported */ in cpqhpc_probe()
958 ctrl->defeature_PHP = 0; /* PHP not supported */ in cpqhpc_probe()
964 ctrl->alternate_base_address = 1; in cpqhpc_probe()
966 ctrl->alternate_base_address = 0; in cpqhpc_probe()
970 ctrl->pci_config_space = 1; in cpqhpc_probe()
972 ctrl->pci_config_space = 0; in cpqhpc_probe()
976 ctrl->pcix_support = 1; in cpqhpc_probe()
979 ctrl->pcix_speed_capability = 1; in cpqhpc_probe()
983 ctrl->pcix_speed_capability = 0; in cpqhpc_probe()
986 ctrl->pcix_support = 0; in cpqhpc_probe()
987 ctrl->pcix_speed_capability = 0; in cpqhpc_probe()
1003 dbg(" slot_switch_type %s\n", ctrl->slot_switch_type ? in cpqhpc_probe()
1005 dbg(" defeature_PHP %s\n", ctrl->defeature_PHP ? in cpqhpc_probe()
1007 dbg(" alternate_base_address %s\n", ctrl->alternate_base_address ? in cpqhpc_probe()
1009 dbg(" pci_config_space %s\n", ctrl->pci_config_space ? in cpqhpc_probe()
1011 dbg(" pcix_speed_capability %s\n", ctrl->pcix_speed_capability ? in cpqhpc_probe()
1013 dbg(" pcix_support %s\n", ctrl->pcix_support ? in cpqhpc_probe()
1016 ctrl->pci_dev = pdev; in cpqhpc_probe()
1017 pci_set_drvdata(pdev, ctrl); in cpqhpc_probe()
1021 ctrl->pci_bus = kmemdup(pdev->bus, sizeof(*ctrl->pci_bus), GFP_KERNEL); in cpqhpc_probe()
1022 if (!ctrl->pci_bus) { in cpqhpc_probe()
1028 ctrl->bus = pdev->bus->number; in cpqhpc_probe()
1029 ctrl->rev = pdev->revision; in cpqhpc_probe()
1030 dbg("bus device function rev: %d %d %d %d\n", ctrl->bus, in cpqhpc_probe()
1031 PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), ctrl->rev); in cpqhpc_probe()
1033 mutex_init(&ctrl->crit_sect); in cpqhpc_probe()
1034 init_waitqueue_head(&ctrl->queue); in cpqhpc_probe()
1052 ctrl->hpc_reg = ioremap(pci_resource_start(pdev, 0), in cpqhpc_probe()
1054 if (!ctrl->hpc_reg) { in cpqhpc_probe()
1063 bus->cur_bus_speed = get_controller_speed(ctrl); in cpqhpc_probe()
1080 rc = get_slot_mapping(ctrl->pci_bus, pdev->bus->number, in cpqhpc_probe()
1081 (readb(ctrl->hpc_reg + SLOT_MASK) >> 4), in cpqhpc_probe()
1082 &(ctrl->first_slot)); in cpqhpc_probe()
1084 ctrl->first_slot, rc); in cpqhpc_probe()
1091 rc = cpqhp_save_config(ctrl, ctrl->bus, readb(ctrl->hpc_reg + SLOT_MASK)); in cpqhpc_probe()
1102 ctrl->interrupt = pdev->irq; in cpqhpc_probe()
1103 if (ctrl->interrupt < 0x10) { in cpqhpc_probe()
1108 ctrl->cfgspc_irq = 0; in cpqhpc_probe()
1109 pci_read_config_byte(pdev, PCI_INTERRUPT_LINE, &ctrl->cfgspc_irq); in cpqhpc_probe()
1111 rc = cpqhp_find_available_resources(ctrl, cpqhp_rom_start); in cpqhpc_probe()
1112 ctrl->add_support = !rc; in cpqhpc_probe()
1120 * Finish setting up the hot plug ctrl device in cpqhpc_probe()
1122 ctrl->slot_device_offset = readb(ctrl->hpc_reg + SLOT_MASK) >> 4; in cpqhpc_probe()
1123 dbg("NumSlots %d\n", ctrl->slot_device_offset); in cpqhpc_probe()
1125 ctrl->next_event = 0; in cpqhpc_probe()
1128 rc = ctrl_slot_setup(ctrl, smbios_start, smbios_table); in cpqhpc_probe()
1137 writel(0xFFFFFFFFL, ctrl->hpc_reg + INT_MASK); in cpqhpc_probe()
1140 dbg("HPC interrupt = %d\n", ctrl->interrupt); in cpqhpc_probe()
1141 if (request_irq(ctrl->interrupt, cpqhp_ctrl_intr, in cpqhpc_probe()
1142 IRQF_SHARED, MY_NAME, ctrl)) { in cpqhpc_probe()
1144 ctrl->interrupt); in cpqhpc_probe()
1152 temp_word = readw(ctrl->hpc_reg + MISC); in cpqhpc_probe()
1154 writew(temp_word, ctrl->hpc_reg + MISC); in cpqhpc_probe()
1157 writel(0xFFFFFFFFL, ctrl->hpc_reg + INT_INPUT_CLEAR); in cpqhpc_probe()
1159 ctrl->ctrl_int_comp = readl(ctrl->hpc_reg + INT_INPUT_CLEAR); in cpqhpc_probe()
1161 writel(0x0L, ctrl->hpc_reg + INT_MASK); in cpqhpc_probe()
1164 cpqhp_ctrl_list = ctrl; in cpqhpc_probe()
1165 ctrl->next = NULL; in cpqhpc_probe()
1167 ctrl->next = cpqhp_ctrl_list; in cpqhpc_probe()
1168 cpqhp_ctrl_list = ctrl; in cpqhpc_probe()
1174 mutex_lock(&ctrl->crit_sect); in cpqhpc_probe()
1176 num_of_slots = readb(ctrl->hpc_reg + SLOT_MASK) & 0x0F; in cpqhpc_probe()
1178 /* find first device number for the ctrl */ in cpqhpc_probe()
1179 device = readb(ctrl->hpc_reg + SLOT_MASK) >> 4; in cpqhpc_probe()
1183 func = cpqhp_slot_find(ctrl->bus, device, 0); in cpqhpc_probe()
1187 hp_slot = func->device - ctrl->slot_device_offset; in cpqhpc_probe()
1191 temp_word = ctrl->ctrl_int_comp >> 16; in cpqhpc_probe()
1195 if (ctrl->ctrl_int_comp & (0x1L << hp_slot)) in cpqhpc_probe()
1202 green_LED_off(ctrl, hp_slot); in cpqhpc_probe()
1203 slot_disable(ctrl, hp_slot); in cpqhpc_probe()
1211 set_SOGO(ctrl); in cpqhpc_probe()
1213 wait_for_ctrl_irq(ctrl); in cpqhpc_probe()
1216 rc = init_SERR(ctrl); in cpqhpc_probe()
1219 mutex_unlock(&ctrl->crit_sect); in cpqhpc_probe()
1224 mutex_unlock(&ctrl->crit_sect); in cpqhpc_probe()
1226 cpqhp_create_debugfs_files(ctrl); in cpqhpc_probe()
1231 free_irq(ctrl->interrupt, ctrl); in cpqhpc_probe()
1233 iounmap(ctrl->hpc_reg); in cpqhpc_probe()
1237 kfree(ctrl->pci_bus); in cpqhpc_probe()
1239 kfree(ctrl); in cpqhpc_probe()
1251 struct controller *ctrl; in unload_cpqphpd() local
1258 ctrl = cpqhp_ctrl_list; in unload_cpqphpd()
1260 while (ctrl) { in unload_cpqphpd()
1261 if (ctrl->hpc_reg) { in unload_cpqphpd()
1263 rc = read_slot_enable(ctrl); in unload_cpqphpd()
1265 writeb(0, ctrl->hpc_reg + SLOT_SERR); in unload_cpqphpd()
1266 writel(0xFFFFFFC0L | ~rc, ctrl->hpc_reg + INT_MASK); in unload_cpqphpd()
1268 misc = readw(ctrl->hpc_reg + MISC); in unload_cpqphpd()
1270 writew(misc, ctrl->hpc_reg + MISC); in unload_cpqphpd()
1273 ctrl_slot_cleanup(ctrl); in unload_cpqphpd()
1275 res = ctrl->io_head; in unload_cpqphpd()
1282 res = ctrl->mem_head; in unload_cpqphpd()
1289 res = ctrl->p_mem_head; in unload_cpqphpd()
1296 res = ctrl->bus_head; in unload_cpqphpd()
1303 kfree(ctrl->pci_bus); in unload_cpqphpd()
1305 tctrl = ctrl; in unload_cpqphpd()
1306 ctrl = ctrl->next; in unload_cpqphpd()