Lines Matching refs:ctrl
120 static int init_SERR(struct controller *ctrl) in init_SERR() argument
126 if (!ctrl) in init_SERR()
129 tempdword = ctrl->first_slot; in init_SERR()
131 number_of_slots = readb(ctrl->hpc_reg + SLOT_MASK) & 0x0F; in init_SERR()
135 writeb(0, ctrl->hpc_reg + SLOT_SERR); in init_SERR()
269 static int ctrl_slot_cleanup(struct controller *ctrl) in ctrl_slot_cleanup() argument
273 old_slot = ctrl->slot; in ctrl_slot_cleanup()
274 ctrl->slot = NULL; in ctrl_slot_cleanup()
285 cpqhp_remove_debugfs_files(ctrl); in ctrl_slot_cleanup()
288 free_irq(ctrl->interrupt, ctrl); in ctrl_slot_cleanup()
290 iounmap(ctrl->hpc_reg); in ctrl_slot_cleanup()
292 release_mem_region(pci_resource_start(ctrl->pci_dev, 0), in ctrl_slot_cleanup()
293 pci_resource_len(ctrl->pci_dev, 0)); in ctrl_slot_cleanup()
379 cpqhp_set_attention_status(struct controller *ctrl, struct pci_func *func, in cpqhp_set_attention_status() argument
387 hp_slot = func->device - ctrl->slot_device_offset; in cpqhp_set_attention_status()
390 mutex_lock(&ctrl->crit_sect); in cpqhp_set_attention_status()
393 amber_LED_on(ctrl, hp_slot); in cpqhp_set_attention_status()
395 amber_LED_off(ctrl, hp_slot); in cpqhp_set_attention_status()
398 mutex_unlock(&ctrl->crit_sect); in cpqhp_set_attention_status()
402 set_SOGO(ctrl); in cpqhp_set_attention_status()
405 wait_for_ctrl_irq(ctrl); in cpqhp_set_attention_status()
408 mutex_unlock(&ctrl->crit_sect); in cpqhp_set_attention_status()
423 struct controller *ctrl = slot->ctrl; in set_attention_status() local
431 if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1) in set_attention_status()
442 return cpqhp_set_attention_status(ctrl, slot_func, status); in set_attention_status()
450 struct controller *ctrl = slot->ctrl; in process_SI() local
458 if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1) in process_SI()
473 dbg("board_added(%p, %p)\n", slot_func, ctrl); in process_SI()
474 return cpqhp_process_SI(ctrl, slot_func); in process_SI()
482 struct controller *ctrl = slot->ctrl; in process_SS() local
490 if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1) in process_SS()
501 dbg("In %s, slot_func = %p, ctrl = %p\n", __func__, slot_func, ctrl); in process_SS()
502 return cpqhp_process_SS(ctrl, slot_func); in process_SS()
509 struct controller *ctrl = slot->ctrl; in hardware_test() local
513 return cpqhp_hardware_test(ctrl, value); in hardware_test()
520 struct controller *ctrl = slot->ctrl; in get_power_status() local
524 *value = get_slot_enabled(ctrl, slot); in get_power_status()
531 struct controller *ctrl = slot->ctrl; in get_attention_status() local
535 *value = cpq_get_attention_status(ctrl, slot); in get_attention_status()
542 struct controller *ctrl = slot->ctrl; in get_latch_status() local
546 *value = cpq_get_latch_status(ctrl, slot); in get_latch_status()
554 struct controller *ctrl = slot->ctrl; in get_adapter_status() local
558 *value = get_presence_status(ctrl, slot); in get_adapter_status()
576 static int ctrl_slot_setup(struct controller *ctrl, in ctrl_slot_setup() argument
583 struct pci_bus *bus = ctrl->pci_bus; in ctrl_slot_setup()
595 tempdword = readl(ctrl->hpc_reg + INT_INPUT_CLEAR); in ctrl_slot_setup()
597 number_of_slots = readb(ctrl->hpc_reg + SLOT_MASK) & 0x0F; in ctrl_slot_setup()
598 slot_device = readb(ctrl->hpc_reg + SLOT_MASK) >> 4; in ctrl_slot_setup()
599 slot_number = ctrl->first_slot; in ctrl_slot_setup()
624 slot->ctrl = ctrl; in ctrl_slot_setup()
625 slot->bus = ctrl->bus; in ctrl_slot_setup()
658 slot_device - (readb(ctrl->hpc_reg + SLOT_MASK) >> 4); in ctrl_slot_setup()
669 ((read_slot_enable(ctrl) << 2) >> ctrl_slot) & 0x04; in ctrl_slot_setup()
676 hotplug_slot_info->power_status = get_slot_enabled(ctrl, slot); in ctrl_slot_setup()
678 cpq_get_attention_status(ctrl, slot); in ctrl_slot_setup()
680 cpq_get_latch_status(ctrl, slot); in ctrl_slot_setup()
682 get_presence_status(ctrl, slot); in ctrl_slot_setup()
686 slot->number, ctrl->slot_device_offset, in ctrl_slot_setup()
689 ctrl->pci_dev->bus, in ctrl_slot_setup()
697 slot->next = ctrl->slot; in ctrl_slot_setup()
698 ctrl->slot = slot; in ctrl_slot_setup()
800 struct controller *ctrl; in cpqhpc_probe() local
860 ctrl = kzalloc(sizeof(struct controller), GFP_KERNEL); in cpqhpc_probe()
861 if (!ctrl) { in cpqhpc_probe()
873 ctrl->vendor_id = vendor_id; in cpqhpc_probe()
878 ctrl->push_flag = 1; in cpqhpc_probe()
879 ctrl->slot_switch_type = 1; in cpqhpc_probe()
880 ctrl->push_button = 1; in cpqhpc_probe()
881 ctrl->pci_config_space = 1; in cpqhpc_probe()
882 ctrl->defeature_PHP = 1; in cpqhpc_probe()
883 ctrl->pcix_support = 1; in cpqhpc_probe()
884 ctrl->pcix_speed_capability = 1; in cpqhpc_probe()
913 ctrl->slot_switch_type = 1; in cpqhpc_probe()
915 ctrl->push_button = 0; in cpqhpc_probe()
916 ctrl->pci_config_space = 1; in cpqhpc_probe()
917 ctrl->defeature_PHP = 1; in cpqhpc_probe()
918 ctrl->pcix_support = 0; in cpqhpc_probe()
919 ctrl->pcix_speed_capability = 0; in cpqhpc_probe()
923 ctrl->push_flag = 1; in cpqhpc_probe()
924 ctrl->slot_switch_type = 1; in cpqhpc_probe()
926 ctrl->push_button = 1; in cpqhpc_probe()
927 ctrl->pci_config_space = 1; in cpqhpc_probe()
928 ctrl->defeature_PHP = 1; in cpqhpc_probe()
929 ctrl->pcix_support = 0; in cpqhpc_probe()
930 ctrl->pcix_speed_capability = 0; in cpqhpc_probe()
934 ctrl->slot_switch_type = 1; in cpqhpc_probe()
936 ctrl->push_button = 0; in cpqhpc_probe()
937 ctrl->pci_config_space = 1; in cpqhpc_probe()
938 ctrl->defeature_PHP = 1; in cpqhpc_probe()
939 ctrl->pcix_support = 0; in cpqhpc_probe()
940 ctrl->pcix_speed_capability = 0; in cpqhpc_probe()
944 ctrl->push_flag = 1; in cpqhpc_probe()
945 ctrl->slot_switch_type = 1; in cpqhpc_probe()
947 ctrl->push_button = 1; in cpqhpc_probe()
948 ctrl->pci_config_space = 1; in cpqhpc_probe()
949 ctrl->defeature_PHP = 1; in cpqhpc_probe()
950 ctrl->pcix_support = 0; in cpqhpc_probe()
951 ctrl->pcix_speed_capability = 0; in cpqhpc_probe()
955 ctrl->push_flag = 1; in cpqhpc_probe()
956 ctrl->slot_switch_type = 1; in cpqhpc_probe()
958 ctrl->push_button = 1; in cpqhpc_probe()
959 ctrl->pci_config_space = 1; in cpqhpc_probe()
960 ctrl->defeature_PHP = 1; in cpqhpc_probe()
961 ctrl->pcix_support = 1; in cpqhpc_probe()
962 ctrl->pcix_speed_capability = 0; in cpqhpc_probe()
980 ctrl->push_button = 0; in cpqhpc_probe()
982 ctrl->push_button = 1; in cpqhpc_probe()
986 ctrl->slot_switch_type = 0; in cpqhpc_probe()
988 ctrl->slot_switch_type = 1; in cpqhpc_probe()
992 ctrl->defeature_PHP = 1; /* PHP supported */ in cpqhpc_probe()
994 ctrl->defeature_PHP = 0; /* PHP not supported */ in cpqhpc_probe()
1000 ctrl->alternate_base_address = 1; in cpqhpc_probe()
1002 ctrl->alternate_base_address = 0; in cpqhpc_probe()
1006 ctrl->pci_config_space = 1; in cpqhpc_probe()
1008 ctrl->pci_config_space = 0; in cpqhpc_probe()
1012 ctrl->pcix_support = 1; in cpqhpc_probe()
1015 ctrl->pcix_speed_capability = 1; in cpqhpc_probe()
1019 ctrl->pcix_speed_capability = 0; in cpqhpc_probe()
1022 ctrl->pcix_support = 0; in cpqhpc_probe()
1023 ctrl->pcix_speed_capability = 0; in cpqhpc_probe()
1039 dbg(" slot_switch_type %s\n", ctrl->slot_switch_type ? in cpqhpc_probe()
1041 dbg(" defeature_PHP %s\n", ctrl->defeature_PHP ? in cpqhpc_probe()
1043 dbg(" alternate_base_address %s\n", ctrl->alternate_base_address ? in cpqhpc_probe()
1045 dbg(" pci_config_space %s\n", ctrl->pci_config_space ? in cpqhpc_probe()
1047 dbg(" pcix_speed_capability %s\n", ctrl->pcix_speed_capability ? in cpqhpc_probe()
1049 dbg(" pcix_support %s\n", ctrl->pcix_support ? in cpqhpc_probe()
1052 ctrl->pci_dev = pdev; in cpqhpc_probe()
1053 pci_set_drvdata(pdev, ctrl); in cpqhpc_probe()
1057 ctrl->pci_bus = kmemdup(pdev->bus, sizeof(*ctrl->pci_bus), GFP_KERNEL); in cpqhpc_probe()
1058 if (!ctrl->pci_bus) { in cpqhpc_probe()
1064 ctrl->bus = pdev->bus->number; in cpqhpc_probe()
1065 ctrl->rev = pdev->revision; in cpqhpc_probe()
1066 dbg("bus device function rev: %d %d %d %d\n", ctrl->bus, in cpqhpc_probe()
1067 PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), ctrl->rev); in cpqhpc_probe()
1069 mutex_init(&ctrl->crit_sect); in cpqhpc_probe()
1070 init_waitqueue_head(&ctrl->queue); in cpqhpc_probe()
1088 ctrl->hpc_reg = ioremap(pci_resource_start(pdev, 0), in cpqhpc_probe()
1090 if (!ctrl->hpc_reg) { in cpqhpc_probe()
1099 bus->cur_bus_speed = get_controller_speed(ctrl); in cpqhpc_probe()
1116 rc = get_slot_mapping(ctrl->pci_bus, pdev->bus->number, in cpqhpc_probe()
1117 (readb(ctrl->hpc_reg + SLOT_MASK) >> 4), in cpqhpc_probe()
1118 &(ctrl->first_slot)); in cpqhpc_probe()
1120 ctrl->first_slot, rc); in cpqhpc_probe()
1127 rc = cpqhp_save_config(ctrl, ctrl->bus, readb(ctrl->hpc_reg + SLOT_MASK)); in cpqhpc_probe()
1138 ctrl->interrupt = pdev->irq; in cpqhpc_probe()
1139 if (ctrl->interrupt < 0x10) { in cpqhpc_probe()
1144 ctrl->cfgspc_irq = 0; in cpqhpc_probe()
1145 pci_read_config_byte(pdev, PCI_INTERRUPT_LINE, &ctrl->cfgspc_irq); in cpqhpc_probe()
1147 rc = cpqhp_find_available_resources(ctrl, cpqhp_rom_start); in cpqhpc_probe()
1148 ctrl->add_support = !rc; in cpqhpc_probe()
1158 ctrl->slot_device_offset = readb(ctrl->hpc_reg + SLOT_MASK) >> 4; in cpqhpc_probe()
1159 dbg("NumSlots %d\n", ctrl->slot_device_offset); in cpqhpc_probe()
1161 ctrl->next_event = 0; in cpqhpc_probe()
1164 rc = ctrl_slot_setup(ctrl, smbios_start, smbios_table); in cpqhpc_probe()
1173 writel(0xFFFFFFFFL, ctrl->hpc_reg + INT_MASK); in cpqhpc_probe()
1176 dbg("HPC interrupt = %d\n", ctrl->interrupt); in cpqhpc_probe()
1177 if (request_irq(ctrl->interrupt, cpqhp_ctrl_intr, in cpqhpc_probe()
1178 IRQF_SHARED, MY_NAME, ctrl)) { in cpqhpc_probe()
1180 ctrl->interrupt); in cpqhpc_probe()
1188 temp_word = readw(ctrl->hpc_reg + MISC); in cpqhpc_probe()
1190 writew(temp_word, ctrl->hpc_reg + MISC); in cpqhpc_probe()
1193 writel(0xFFFFFFFFL, ctrl->hpc_reg + INT_INPUT_CLEAR); in cpqhpc_probe()
1195 ctrl->ctrl_int_comp = readl(ctrl->hpc_reg + INT_INPUT_CLEAR); in cpqhpc_probe()
1197 writel(0x0L, ctrl->hpc_reg + INT_MASK); in cpqhpc_probe()
1200 cpqhp_ctrl_list = ctrl; in cpqhpc_probe()
1201 ctrl->next = NULL; in cpqhpc_probe()
1203 ctrl->next = cpqhp_ctrl_list; in cpqhpc_probe()
1204 cpqhp_ctrl_list = ctrl; in cpqhpc_probe()
1210 mutex_lock(&ctrl->crit_sect); in cpqhpc_probe()
1212 num_of_slots = readb(ctrl->hpc_reg + SLOT_MASK) & 0x0F; in cpqhpc_probe()
1215 device = readb(ctrl->hpc_reg + SLOT_MASK) >> 4; in cpqhpc_probe()
1219 func = cpqhp_slot_find(ctrl->bus, device, 0); in cpqhpc_probe()
1223 hp_slot = func->device - ctrl->slot_device_offset; in cpqhpc_probe()
1227 temp_word = ctrl->ctrl_int_comp >> 16; in cpqhpc_probe()
1231 if (ctrl->ctrl_int_comp & (0x1L << hp_slot)) in cpqhpc_probe()
1238 green_LED_off(ctrl, hp_slot); in cpqhpc_probe()
1239 slot_disable(ctrl, hp_slot); in cpqhpc_probe()
1247 set_SOGO(ctrl); in cpqhpc_probe()
1249 wait_for_ctrl_irq(ctrl); in cpqhpc_probe()
1252 rc = init_SERR(ctrl); in cpqhpc_probe()
1255 mutex_unlock(&ctrl->crit_sect); in cpqhpc_probe()
1260 mutex_unlock(&ctrl->crit_sect); in cpqhpc_probe()
1262 cpqhp_create_debugfs_files(ctrl); in cpqhpc_probe()
1267 free_irq(ctrl->interrupt, ctrl); in cpqhpc_probe()
1269 iounmap(ctrl->hpc_reg); in cpqhpc_probe()
1273 kfree(ctrl->pci_bus); in cpqhpc_probe()
1275 kfree(ctrl); in cpqhpc_probe()
1287 struct controller *ctrl; in unload_cpqphpd() local
1294 ctrl = cpqhp_ctrl_list; in unload_cpqphpd()
1296 while (ctrl) { in unload_cpqphpd()
1297 if (ctrl->hpc_reg) { in unload_cpqphpd()
1299 rc = read_slot_enable(ctrl); in unload_cpqphpd()
1301 writeb(0, ctrl->hpc_reg + SLOT_SERR); in unload_cpqphpd()
1302 writel(0xFFFFFFC0L | ~rc, ctrl->hpc_reg + INT_MASK); in unload_cpqphpd()
1304 misc = readw(ctrl->hpc_reg + MISC); in unload_cpqphpd()
1306 writew(misc, ctrl->hpc_reg + MISC); in unload_cpqphpd()
1309 ctrl_slot_cleanup(ctrl); in unload_cpqphpd()
1311 res = ctrl->io_head; in unload_cpqphpd()
1318 res = ctrl->mem_head; in unload_cpqphpd()
1325 res = ctrl->p_mem_head; in unload_cpqphpd()
1332 res = ctrl->bus_head; in unload_cpqphpd()
1339 kfree(ctrl->pci_bus); in unload_cpqphpd()
1341 tctrl = ctrl; in unload_cpqphpd()
1342 ctrl = ctrl->next; in unload_cpqphpd()