Lines Matching refs:ctrl

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()
375 cpqhp_set_attention_status(struct controller *ctrl, struct pci_func *func, in cpqhp_set_attention_status() argument
383 hp_slot = func->device - ctrl->slot_device_offset; in cpqhp_set_attention_status()
386 mutex_lock(&ctrl->crit_sect); in cpqhp_set_attention_status()
389 amber_LED_on(ctrl, hp_slot); in cpqhp_set_attention_status()
391 amber_LED_off(ctrl, hp_slot); in cpqhp_set_attention_status()
394 mutex_unlock(&ctrl->crit_sect); in cpqhp_set_attention_status()
398 set_SOGO(ctrl); in cpqhp_set_attention_status()
401 wait_for_ctrl_irq(ctrl); in cpqhp_set_attention_status()
404 mutex_unlock(&ctrl->crit_sect); in cpqhp_set_attention_status()
419 struct controller *ctrl = slot->ctrl; in set_attention_status() local
427 if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1) in set_attention_status()
438 return cpqhp_set_attention_status(ctrl, slot_func, status); in set_attention_status()
446 struct controller *ctrl = slot->ctrl; in process_SI() local
454 if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1) in process_SI()
469 dbg("board_added(%p, %p)\n", slot_func, ctrl); in process_SI()
470 return cpqhp_process_SI(ctrl, slot_func); in process_SI()
478 struct controller *ctrl = slot->ctrl; in process_SS() local
486 if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1) in process_SS()
497 dbg("In %s, slot_func = %p, ctrl = %p\n", __func__, slot_func, ctrl); in process_SS()
498 return cpqhp_process_SS(ctrl, slot_func); in process_SS()
505 struct controller *ctrl = slot->ctrl; in hardware_test() local
509 return cpqhp_hardware_test(ctrl, value); in hardware_test()
516 struct controller *ctrl = slot->ctrl; in get_power_status() local
520 *value = get_slot_enabled(ctrl, slot); in get_power_status()
527 struct controller *ctrl = slot->ctrl; in get_attention_status() local
531 *value = cpq_get_attention_status(ctrl, slot); in get_attention_status()
538 struct controller *ctrl = slot->ctrl; in get_latch_status() local
542 *value = cpq_get_latch_status(ctrl, slot); in get_latch_status()
550 struct controller *ctrl = slot->ctrl; in get_adapter_status() local
554 *value = get_presence_status(ctrl, slot); in get_adapter_status()
572 static int ctrl_slot_setup(struct controller *ctrl, in ctrl_slot_setup() argument
577 struct pci_bus *bus = ctrl->pci_bus; in ctrl_slot_setup()
589 tempdword = readl(ctrl->hpc_reg + INT_INPUT_CLEAR); in ctrl_slot_setup()
591 number_of_slots = readb(ctrl->hpc_reg + SLOT_MASK) & 0x0F; in ctrl_slot_setup()
592 slot_device = readb(ctrl->hpc_reg + SLOT_MASK) >> 4; in ctrl_slot_setup()
593 slot_number = ctrl->first_slot; in ctrl_slot_setup()
602 slot->ctrl = ctrl; in ctrl_slot_setup()
603 slot->bus = ctrl->bus; in ctrl_slot_setup()
636 slot_device - (readb(ctrl->hpc_reg + SLOT_MASK) >> 4); in ctrl_slot_setup()
647 ((read_slot_enable(ctrl) << 2) >> ctrl_slot) & 0x04; in ctrl_slot_setup()
655 slot->number, ctrl->slot_device_offset, in ctrl_slot_setup()
658 ctrl->pci_dev->bus, in ctrl_slot_setup()
666 slot->next = ctrl->slot; in ctrl_slot_setup()
667 ctrl->slot = slot; in ctrl_slot_setup()
765 struct controller *ctrl; in cpqhpc_probe() local
825 ctrl = kzalloc(sizeof(struct controller), GFP_KERNEL); in cpqhpc_probe()
826 if (!ctrl) { in cpqhpc_probe()
838 ctrl->vendor_id = vendor_id; in cpqhpc_probe()
843 ctrl->push_flag = 1; in cpqhpc_probe()
844 ctrl->slot_switch_type = 1; in cpqhpc_probe()
845 ctrl->push_button = 1; in cpqhpc_probe()
846 ctrl->pci_config_space = 1; in cpqhpc_probe()
847 ctrl->defeature_PHP = 1; in cpqhpc_probe()
848 ctrl->pcix_support = 1; in cpqhpc_probe()
849 ctrl->pcix_speed_capability = 1; in cpqhpc_probe()
878 ctrl->slot_switch_type = 1; in cpqhpc_probe()
880 ctrl->push_button = 0; in cpqhpc_probe()
881 ctrl->pci_config_space = 1; in cpqhpc_probe()
882 ctrl->defeature_PHP = 1; in cpqhpc_probe()
883 ctrl->pcix_support = 0; in cpqhpc_probe()
884 ctrl->pcix_speed_capability = 0; in cpqhpc_probe()
888 ctrl->push_flag = 1; in cpqhpc_probe()
889 ctrl->slot_switch_type = 1; in cpqhpc_probe()
891 ctrl->push_button = 1; in cpqhpc_probe()
892 ctrl->pci_config_space = 1; in cpqhpc_probe()
893 ctrl->defeature_PHP = 1; in cpqhpc_probe()
894 ctrl->pcix_support = 0; in cpqhpc_probe()
895 ctrl->pcix_speed_capability = 0; in cpqhpc_probe()
899 ctrl->slot_switch_type = 1; in cpqhpc_probe()
901 ctrl->push_button = 0; in cpqhpc_probe()
902 ctrl->pci_config_space = 1; in cpqhpc_probe()
903 ctrl->defeature_PHP = 1; in cpqhpc_probe()
904 ctrl->pcix_support = 0; in cpqhpc_probe()
905 ctrl->pcix_speed_capability = 0; in cpqhpc_probe()
909 ctrl->push_flag = 1; in cpqhpc_probe()
910 ctrl->slot_switch_type = 1; in cpqhpc_probe()
912 ctrl->push_button = 1; in cpqhpc_probe()
913 ctrl->pci_config_space = 1; in cpqhpc_probe()
914 ctrl->defeature_PHP = 1; in cpqhpc_probe()
915 ctrl->pcix_support = 0; in cpqhpc_probe()
916 ctrl->pcix_speed_capability = 0; in cpqhpc_probe()
920 ctrl->push_flag = 1; in cpqhpc_probe()
921 ctrl->slot_switch_type = 1; in cpqhpc_probe()
923 ctrl->push_button = 1; in cpqhpc_probe()
924 ctrl->pci_config_space = 1; in cpqhpc_probe()
925 ctrl->defeature_PHP = 1; in cpqhpc_probe()
926 ctrl->pcix_support = 1; in cpqhpc_probe()
927 ctrl->pcix_speed_capability = 0; in cpqhpc_probe()
945 ctrl->push_button = 0; in cpqhpc_probe()
947 ctrl->push_button = 1; in cpqhpc_probe()
951 ctrl->slot_switch_type = 0; in cpqhpc_probe()
953 ctrl->slot_switch_type = 1; in cpqhpc_probe()
957 ctrl->defeature_PHP = 1; /* PHP supported */ in cpqhpc_probe()
959 ctrl->defeature_PHP = 0; /* PHP not supported */ in cpqhpc_probe()
965 ctrl->alternate_base_address = 1; in cpqhpc_probe()
967 ctrl->alternate_base_address = 0; in cpqhpc_probe()
971 ctrl->pci_config_space = 1; in cpqhpc_probe()
973 ctrl->pci_config_space = 0; in cpqhpc_probe()
977 ctrl->pcix_support = 1; in cpqhpc_probe()
980 ctrl->pcix_speed_capability = 1; in cpqhpc_probe()
984 ctrl->pcix_speed_capability = 0; in cpqhpc_probe()
987 ctrl->pcix_support = 0; in cpqhpc_probe()
988 ctrl->pcix_speed_capability = 0; in cpqhpc_probe()
1004 dbg(" slot_switch_type %s\n", ctrl->slot_switch_type ? in cpqhpc_probe()
1006 dbg(" defeature_PHP %s\n", ctrl->defeature_PHP ? in cpqhpc_probe()
1008 dbg(" alternate_base_address %s\n", ctrl->alternate_base_address ? in cpqhpc_probe()
1010 dbg(" pci_config_space %s\n", ctrl->pci_config_space ? in cpqhpc_probe()
1012 dbg(" pcix_speed_capability %s\n", ctrl->pcix_speed_capability ? in cpqhpc_probe()
1014 dbg(" pcix_support %s\n", ctrl->pcix_support ? in cpqhpc_probe()
1017 ctrl->pci_dev = pdev; in cpqhpc_probe()
1018 pci_set_drvdata(pdev, ctrl); in cpqhpc_probe()
1022 ctrl->pci_bus = kmemdup(pdev->bus, sizeof(*ctrl->pci_bus), GFP_KERNEL); in cpqhpc_probe()
1023 if (!ctrl->pci_bus) { in cpqhpc_probe()
1029 ctrl->bus = pdev->bus->number; in cpqhpc_probe()
1030 ctrl->rev = pdev->revision; in cpqhpc_probe()
1031 dbg("bus device function rev: %d %d %d %d\n", ctrl->bus, in cpqhpc_probe()
1032 PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), ctrl->rev); in cpqhpc_probe()
1034 mutex_init(&ctrl->crit_sect); in cpqhpc_probe()
1035 init_waitqueue_head(&ctrl->queue); in cpqhpc_probe()
1053 ctrl->hpc_reg = ioremap(pci_resource_start(pdev, 0), in cpqhpc_probe()
1055 if (!ctrl->hpc_reg) { in cpqhpc_probe()
1064 bus->cur_bus_speed = get_controller_speed(ctrl); in cpqhpc_probe()
1081 rc = get_slot_mapping(ctrl->pci_bus, pdev->bus->number, in cpqhpc_probe()
1082 (readb(ctrl->hpc_reg + SLOT_MASK) >> 4), in cpqhpc_probe()
1083 &(ctrl->first_slot)); in cpqhpc_probe()
1085 ctrl->first_slot, rc); in cpqhpc_probe()
1092 rc = cpqhp_save_config(ctrl, ctrl->bus, readb(ctrl->hpc_reg + SLOT_MASK)); in cpqhpc_probe()
1103 ctrl->interrupt = pdev->irq; in cpqhpc_probe()
1104 if (ctrl->interrupt < 0x10) { in cpqhpc_probe()
1109 ctrl->cfgspc_irq = 0; in cpqhpc_probe()
1110 pci_read_config_byte(pdev, PCI_INTERRUPT_LINE, &ctrl->cfgspc_irq); in cpqhpc_probe()
1112 rc = cpqhp_find_available_resources(ctrl, cpqhp_rom_start); in cpqhpc_probe()
1113 ctrl->add_support = !rc; in cpqhpc_probe()
1123 ctrl->slot_device_offset = readb(ctrl->hpc_reg + SLOT_MASK) >> 4; in cpqhpc_probe()
1124 dbg("NumSlots %d\n", ctrl->slot_device_offset); in cpqhpc_probe()
1126 ctrl->next_event = 0; in cpqhpc_probe()
1129 rc = ctrl_slot_setup(ctrl, smbios_start, smbios_table); in cpqhpc_probe()
1138 writel(0xFFFFFFFFL, ctrl->hpc_reg + INT_MASK); in cpqhpc_probe()
1141 dbg("HPC interrupt = %d\n", ctrl->interrupt); in cpqhpc_probe()
1142 if (request_irq(ctrl->interrupt, cpqhp_ctrl_intr, in cpqhpc_probe()
1143 IRQF_SHARED, MY_NAME, ctrl)) { in cpqhpc_probe()
1145 ctrl->interrupt); in cpqhpc_probe()
1153 temp_word = readw(ctrl->hpc_reg + MISC); in cpqhpc_probe()
1155 writew(temp_word, ctrl->hpc_reg + MISC); in cpqhpc_probe()
1158 writel(0xFFFFFFFFL, ctrl->hpc_reg + INT_INPUT_CLEAR); in cpqhpc_probe()
1160 ctrl->ctrl_int_comp = readl(ctrl->hpc_reg + INT_INPUT_CLEAR); in cpqhpc_probe()
1162 writel(0x0L, ctrl->hpc_reg + INT_MASK); in cpqhpc_probe()
1165 cpqhp_ctrl_list = ctrl; in cpqhpc_probe()
1166 ctrl->next = NULL; in cpqhpc_probe()
1168 ctrl->next = cpqhp_ctrl_list; in cpqhpc_probe()
1169 cpqhp_ctrl_list = ctrl; in cpqhpc_probe()
1175 mutex_lock(&ctrl->crit_sect); in cpqhpc_probe()
1177 num_of_slots = readb(ctrl->hpc_reg + SLOT_MASK) & 0x0F; in cpqhpc_probe()
1180 device = readb(ctrl->hpc_reg + SLOT_MASK) >> 4; in cpqhpc_probe()
1184 func = cpqhp_slot_find(ctrl->bus, device, 0); in cpqhpc_probe()
1188 hp_slot = func->device - ctrl->slot_device_offset; in cpqhpc_probe()
1192 temp_word = ctrl->ctrl_int_comp >> 16; in cpqhpc_probe()
1196 if (ctrl->ctrl_int_comp & (0x1L << hp_slot)) in cpqhpc_probe()
1203 green_LED_off(ctrl, hp_slot); in cpqhpc_probe()
1204 slot_disable(ctrl, hp_slot); in cpqhpc_probe()
1212 set_SOGO(ctrl); in cpqhpc_probe()
1214 wait_for_ctrl_irq(ctrl); in cpqhpc_probe()
1217 rc = init_SERR(ctrl); in cpqhpc_probe()
1220 mutex_unlock(&ctrl->crit_sect); in cpqhpc_probe()
1225 mutex_unlock(&ctrl->crit_sect); in cpqhpc_probe()
1227 cpqhp_create_debugfs_files(ctrl); in cpqhpc_probe()
1232 free_irq(ctrl->interrupt, ctrl); in cpqhpc_probe()
1234 iounmap(ctrl->hpc_reg); in cpqhpc_probe()
1238 kfree(ctrl->pci_bus); in cpqhpc_probe()
1240 kfree(ctrl); in cpqhpc_probe()
1252 struct controller *ctrl; in unload_cpqphpd() local
1259 ctrl = cpqhp_ctrl_list; in unload_cpqphpd()
1261 while (ctrl) { in unload_cpqphpd()
1262 if (ctrl->hpc_reg) { in unload_cpqphpd()
1264 rc = read_slot_enable(ctrl); in unload_cpqphpd()
1266 writeb(0, ctrl->hpc_reg + SLOT_SERR); in unload_cpqphpd()
1267 writel(0xFFFFFFC0L | ~rc, ctrl->hpc_reg + INT_MASK); in unload_cpqphpd()
1269 misc = readw(ctrl->hpc_reg + MISC); in unload_cpqphpd()
1271 writew(misc, ctrl->hpc_reg + MISC); in unload_cpqphpd()
1274 ctrl_slot_cleanup(ctrl); in unload_cpqphpd()
1276 res = ctrl->io_head; in unload_cpqphpd()
1283 res = ctrl->mem_head; in unload_cpqphpd()
1290 res = ctrl->p_mem_head; in unload_cpqphpd()
1297 res = ctrl->bus_head; in unload_cpqphpd()
1304 kfree(ctrl->pci_bus); in unload_cpqphpd()
1306 tctrl = ctrl; in unload_cpqphpd()
1307 ctrl = ctrl->next; in unload_cpqphpd()