Lines Matching refs:ctrl

130  * @ctrl: controller to use
134 static int init_SERR(struct controller *ctrl)
140 if (!ctrl)
143 tempdword = ctrl->first_slot;
145 number_of_slots = readb(ctrl->hpc_reg + SLOT_MASK) & 0x0F;
149 writeb(0, ctrl->hpc_reg + SLOT_SERR);
294 static int ctrl_slot_cleanup (struct controller *ctrl)
298 old_slot = ctrl->slot;
299 ctrl->slot = NULL;
308 cpqhp_remove_debugfs_files(ctrl);
311 free_irq(ctrl->interrupt, ctrl);
313 iounmap(ctrl->hpc_reg);
315 release_mem_region(pci_resource_start(ctrl->pci_dev, 0),
316 pci_resource_len(ctrl->pci_dev, 0));
397 * @ctrl: struct controller to use
402 cpqhp_set_attention_status(struct controller *ctrl, struct pci_func *func,
410 hp_slot = func->device - ctrl->slot_device_offset;
413 mutex_lock(&ctrl->crit_sect);
416 amber_LED_on (ctrl, hp_slot);
418 amber_LED_off (ctrl, hp_slot);
421 mutex_unlock(&ctrl->crit_sect);
425 set_SOGO(ctrl);
428 wait_for_ctrl_irq (ctrl);
431 mutex_unlock(&ctrl->crit_sect);
446 struct controller *ctrl = slot->ctrl;
454 if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1)
465 return cpqhp_set_attention_status(ctrl, slot_func, status);
473 struct controller *ctrl = slot->ctrl;
481 if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1)
496 dbg("board_added(%p, %p)\n", slot_func, ctrl);
497 return cpqhp_process_SI(ctrl, slot_func);
505 struct controller *ctrl = slot->ctrl;
513 if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1)
524 dbg("In %s, slot_func = %p, ctrl = %p\n", __func__, slot_func, ctrl);
525 return cpqhp_process_SS(ctrl, slot_func);
532 struct controller *ctrl = slot->ctrl;
536 return cpqhp_hardware_test(ctrl, value);
543 struct controller *ctrl = slot->ctrl;
547 *value = get_slot_enabled(ctrl, slot);
554 struct controller *ctrl = slot->ctrl;
558 *value = cpq_get_attention_status(ctrl, slot);
565 struct controller *ctrl = slot->ctrl;
569 *value = cpq_get_latch_status(ctrl, slot);
577 struct controller *ctrl = slot->ctrl;
581 *value = get_presence_status(ctrl, slot);
599 static int ctrl_slot_setup(struct controller *ctrl,
606 struct pci_bus *bus = ctrl->pci_bus;
618 tempdword = readl(ctrl->hpc_reg + INT_INPUT_CLEAR);
620 number_of_slots = readb(ctrl->hpc_reg + SLOT_MASK) & 0x0F;
621 slot_device = readb(ctrl->hpc_reg + SLOT_MASK) >> 4;
622 slot_number = ctrl->first_slot;
647 slot->ctrl = ctrl;
648 slot->bus = ctrl->bus;
682 slot_device - (readb(ctrl->hpc_reg + SLOT_MASK) >> 4);
693 ((read_slot_enable(ctrl) << 2) >> ctrl_slot) & 0x04;
701 hotplug_slot_info->power_status = get_slot_enabled(ctrl, slot);
703 cpq_get_attention_status(ctrl, slot);
705 cpq_get_latch_status(ctrl, slot);
707 get_presence_status(ctrl, slot);
709 dbg("registering bus %d, dev %d, number %d, ctrl->slot_device_offset %d, slot %d\n",
711 slot->number, ctrl->slot_device_offset,
714 ctrl->pci_dev->bus,
722 slot->next = ctrl->slot;
723 ctrl->slot = slot;
825 struct controller *ctrl;
884 ctrl = kzalloc(sizeof(struct controller), GFP_KERNEL);
885 if (!ctrl) {
898 ctrl->vendor_id = vendor_id;
903 ctrl->push_flag = 1;
904 ctrl->slot_switch_type = 1;
905 ctrl->push_button = 1;
906 ctrl->pci_config_space = 1;
907 ctrl->defeature_PHP = 1;
908 ctrl->pcix_support = 1;
909 ctrl->pcix_speed_capability = 1;
938 ctrl->slot_switch_type = 1;
940 ctrl->push_button = 0;
941 ctrl->pci_config_space = 1;
942 ctrl->defeature_PHP = 1;
943 ctrl->pcix_support = 0;
944 ctrl->pcix_speed_capability = 0;
948 ctrl->push_flag = 1;
949 ctrl->slot_switch_type = 1;
951 ctrl->push_button = 1;
952 ctrl->pci_config_space = 1;
953 ctrl->defeature_PHP = 1;
954 ctrl->pcix_support = 0;
955 ctrl->pcix_speed_capability = 0;
959 ctrl->slot_switch_type = 1;
961 ctrl->push_button = 0;
962 ctrl->pci_config_space = 1;
963 ctrl->defeature_PHP = 1;
964 ctrl->pcix_support = 0;
965 ctrl->pcix_speed_capability = 0;
969 ctrl->push_flag = 1;
970 ctrl->slot_switch_type = 1;
972 ctrl->push_button = 1;
973 ctrl->pci_config_space = 1;
974 ctrl->defeature_PHP = 1;
975 ctrl->pcix_support = 0;
976 ctrl->pcix_speed_capability = 0;
980 ctrl->push_flag = 1;
981 ctrl->slot_switch_type = 1;
983 ctrl->push_button = 1;
984 ctrl->pci_config_space = 1;
985 ctrl->defeature_PHP = 1;
986 ctrl->pcix_support = 1;
987 ctrl->pcix_speed_capability = 0;
1005 ctrl->push_button = 0;
1007 ctrl->push_button = 1;
1011 ctrl->slot_switch_type = 0;
1013 ctrl->slot_switch_type = 1;
1017 ctrl->defeature_PHP = 1; /* PHP supported */
1019 ctrl->defeature_PHP = 0; /* PHP not supported */
1025 ctrl->alternate_base_address = 1;
1027 ctrl->alternate_base_address = 0;
1031 ctrl->pci_config_space = 1;
1033 ctrl->pci_config_space = 0;
1037 ctrl->pcix_support = 1;
1040 ctrl->pcix_speed_capability = 1;
1044 ctrl->pcix_speed_capability = 0;
1047 ctrl->pcix_support = 0;
1048 ctrl->pcix_speed_capability = 0;
1064 dbg(" slot_switch_type %s\n", ctrl->slot_switch_type ?
1066 dbg(" defeature_PHP %s\n", ctrl->defeature_PHP ?
1068 dbg(" alternate_base_address %s\n", ctrl->alternate_base_address ?
1070 dbg(" pci_config_space %s\n", ctrl->pci_config_space ?
1072 dbg(" pcix_speed_capability %s\n", ctrl->pcix_speed_capability ?
1074 dbg(" pcix_support %s\n", ctrl->pcix_support ?
1077 ctrl->pci_dev = pdev;
1078 pci_set_drvdata(pdev, ctrl);
1082 ctrl->pci_bus = kmemdup(pdev->bus, sizeof(*ctrl->pci_bus), GFP_KERNEL);
1083 if (!ctrl->pci_bus) {
1089 ctrl->bus = pdev->bus->number;
1090 ctrl->rev = pdev->revision;
1091 dbg("bus device function rev: %d %d %d %d\n", ctrl->bus,
1092 PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), ctrl->rev);
1094 mutex_init(&ctrl->crit_sect);
1095 init_waitqueue_head(&ctrl->queue);
1113 ctrl->hpc_reg = ioremap(pci_resource_start(pdev, 0),
1115 if (!ctrl->hpc_reg) {
1124 bus->cur_bus_speed = get_controller_speed(ctrl);
1141 rc = get_slot_mapping(ctrl->pci_bus, pdev->bus->number,
1142 (readb(ctrl->hpc_reg + SLOT_MASK) >> 4),
1143 &(ctrl->first_slot));
1145 ctrl->first_slot, rc);
1152 rc = cpqhp_save_config(ctrl, ctrl->bus, readb(ctrl->hpc_reg + SLOT_MASK));
1163 ctrl->interrupt = pdev->irq;
1164 if (ctrl->interrupt < 0x10) {
1169 ctrl->cfgspc_irq = 0;
1170 pci_read_config_byte(pdev, PCI_INTERRUPT_LINE, &ctrl->cfgspc_irq);
1172 rc = cpqhp_find_available_resources(ctrl, cpqhp_rom_start);
1173 ctrl->add_support = !rc;
1181 * Finish setting up the hot plug ctrl device
1183 ctrl->slot_device_offset = readb(ctrl->hpc_reg + SLOT_MASK) >> 4;
1184 dbg("NumSlots %d \n", ctrl->slot_device_offset);
1186 ctrl->next_event = 0;
1189 rc = ctrl_slot_setup(ctrl, smbios_start, smbios_table);
1198 writel(0xFFFFFFFFL, ctrl->hpc_reg + INT_MASK);
1201 dbg("HPC interrupt = %d \n", ctrl->interrupt);
1202 if (request_irq(ctrl->interrupt, cpqhp_ctrl_intr,
1203 IRQF_SHARED, MY_NAME, ctrl)) {
1205 ctrl->interrupt);
1213 temp_word = readw(ctrl->hpc_reg + MISC);
1215 writew(temp_word, ctrl->hpc_reg + MISC);
1218 writel(0xFFFFFFFFL, ctrl->hpc_reg + INT_INPUT_CLEAR);
1220 ctrl->ctrl_int_comp = readl(ctrl->hpc_reg + INT_INPUT_CLEAR);
1222 writel(0x0L, ctrl->hpc_reg + INT_MASK);
1225 cpqhp_ctrl_list = ctrl;
1226 ctrl->next = NULL;
1228 ctrl->next = cpqhp_ctrl_list;
1229 cpqhp_ctrl_list = ctrl;
1235 mutex_lock(&ctrl->crit_sect);
1237 num_of_slots = readb(ctrl->hpc_reg + SLOT_MASK) & 0x0F;
1239 /* find first device number for the ctrl */
1240 device = readb(ctrl->hpc_reg + SLOT_MASK) >> 4;
1244 func = cpqhp_slot_find(ctrl->bus, device, 0);
1248 hp_slot = func->device - ctrl->slot_device_offset;
1252 temp_word = ctrl->ctrl_int_comp >> 16;
1256 if (ctrl->ctrl_int_comp & (0x1L << hp_slot))
1263 green_LED_off(ctrl, hp_slot);
1264 slot_disable(ctrl, hp_slot);
1272 set_SOGO(ctrl);
1274 wait_for_ctrl_irq(ctrl);
1277 rc = init_SERR(ctrl);
1280 mutex_unlock(&ctrl->crit_sect);
1285 mutex_unlock(&ctrl->crit_sect);
1287 cpqhp_create_debugfs_files(ctrl);
1292 free_irq(ctrl->interrupt, ctrl);
1294 iounmap(ctrl->hpc_reg);
1298 kfree(ctrl->pci_bus);
1300 kfree(ctrl);
1312 struct controller *ctrl;
1319 ctrl = cpqhp_ctrl_list;
1321 while (ctrl) {
1322 if (ctrl->hpc_reg) {
1324 rc = read_slot_enable (ctrl);
1326 writeb(0, ctrl->hpc_reg + SLOT_SERR);
1327 writel(0xFFFFFFC0L | ~rc, ctrl->hpc_reg + INT_MASK);
1329 misc = readw(ctrl->hpc_reg + MISC);
1331 writew(misc, ctrl->hpc_reg + MISC);
1334 ctrl_slot_cleanup(ctrl);
1336 res = ctrl->io_head;
1343 res = ctrl->mem_head;
1350 res = ctrl->p_mem_head;
1357 res = ctrl->bus_head;
1364 kfree (ctrl->pci_bus);
1366 tctrl = ctrl;
1367 ctrl = ctrl->next;