H A D | ibmphp_core.c | 78 struct slot *slot_cur = *sl; get_cur_bus_info() local 80 debug("options = %x\n", slot_cur->ctrl->options); get_cur_bus_info() 81 debug("revision = %x\n", slot_cur->ctrl->revision); get_cur_bus_info() 83 if (READ_BUS_STATUS(slot_cur->ctrl)) get_cur_bus_info() 84 rc = ibmphp_hpc_readslot(slot_cur, READ_BUSSTATUS, NULL); get_cur_bus_info() 89 slot_cur->bus_on->current_speed = CURRENT_BUS_SPEED(slot_cur->busstatus); get_cur_bus_info() 90 if (READ_BUS_MODE(slot_cur->ctrl)) get_cur_bus_info() 91 slot_cur->bus_on->current_bus_mode = get_cur_bus_info() 92 CURRENT_BUS_MODE(slot_cur->busstatus); get_cur_bus_info() 94 slot_cur->bus_on->current_bus_mode = 0xFF; get_cur_bus_info() 97 slot_cur->busstatus, get_cur_bus_info() 98 slot_cur->bus_on->current_speed, get_cur_bus_info() 99 slot_cur->bus_on->current_bus_mode); get_cur_bus_info() 101 *sl = slot_cur; get_cur_bus_info() 118 struct slot *slot_cur; get_max_slots() local 123 slot_cur = list_entry(tmp, struct slot, ibm_slot_list); get_max_slots() 125 slot_count = max(slot_count, slot_cur->number); get_max_slots() 202 static inline int power_on(struct slot *slot_cur) power_on() argument 207 retval = ibmphp_hpc_writeslot(slot_cur, cmd); power_on() 212 if (CTLR_RESULT(slot_cur->ctrl->status)) { power_on() 220 static inline int power_off(struct slot *slot_cur) power_off() argument 225 retval = ibmphp_hpc_writeslot(slot_cur, cmd); power_off() 230 if (CTLR_RESULT(slot_cur->ctrl->status)) { power_off() 503 struct slot *slot_cur; init_ops() local 509 slot_cur = list_entry(tmp, struct slot, ibm_slot_list); init_ops() 511 if (!slot_cur) init_ops() 515 slot_cur->number); init_ops() 516 if (slot_cur->ctrl->revision == 0xFF) init_ops() 517 if (get_ctrl_revision(slot_cur, init_ops() 518 &slot_cur->ctrl->revision)) init_ops() 521 if (slot_cur->bus_on->current_speed == 0xFF) init_ops() 522 if (get_cur_bus_info(&slot_cur)) init_ops() 524 get_max_bus_speed(slot_cur); init_ops() 526 if (slot_cur->ctrl->options == 0xFF) init_ops() 527 if (get_hpc_options(slot_cur, &slot_cur->ctrl->options)) init_ops() 530 retval = slot_update(&slot_cur); init_ops() 534 debug("status = %x\n", slot_cur->status); init_ops() 535 debug("ext_status = %x\n", slot_cur->ext_status); init_ops() 536 debug("SLOT_POWER = %x\n", SLOT_POWER(slot_cur->status)); init_ops() 537 debug("SLOT_PRESENT = %x\n", SLOT_PRESENT(slot_cur->status)); init_ops() 538 debug("SLOT_LATCH = %x\n", SLOT_LATCH(slot_cur->status)); init_ops() 540 if ((SLOT_PWRGD(slot_cur->status)) && init_ops() 541 !(SLOT_PRESENT(slot_cur->status)) && init_ops() 542 !(SLOT_LATCH(slot_cur->status))) { init_ops() 544 rc = power_off(slot_cur); init_ops() 548 /* retval = slot_update(&slot_cur); init_ops() 551 * ibmphp_update_slot_info(slot_cur); init_ops() 564 static int validate(struct slot *slot_cur, int opn) validate() argument 569 if (!slot_cur) validate() 571 number = slot_cur->number; validate() 574 debug("slot_number in validate is %d\n", slot_cur->number); validate() 576 retval = slot_update(&slot_cur); validate() 582 if (!(SLOT_PWRGD(slot_cur->status)) && validate() 583 (SLOT_PRESENT(slot_cur->status)) && validate() 584 !(SLOT_LATCH(slot_cur->status))) validate() 588 if ((SLOT_PWRGD(slot_cur->status)) && validate() 589 (SLOT_PRESENT(slot_cur->status)) && validate() 590 !(SLOT_LATCH(slot_cur->status))) validate() 605 int ibmphp_update_slot_info(struct slot *slot_cur) ibmphp_update_slot_info() argument 608 struct pci_bus *bus = slot_cur->hotplug_slot->pci_slot->bus; ibmphp_update_slot_info() 619 info->power_status = SLOT_PWRGD(slot_cur->status); ibmphp_update_slot_info() 620 info->attention_status = SLOT_ATTN(slot_cur->status, ibmphp_update_slot_info() 621 slot_cur->ext_status); ibmphp_update_slot_info() 622 info->latch_status = SLOT_LATCH(slot_cur->status); ibmphp_update_slot_info() 623 if (!SLOT_PRESENT(slot_cur->status)) { ibmphp_update_slot_info() 628 /* get_max_adapter_speed_1(slot_cur->hotplug_slot, ibmphp_update_slot_info() 632 bus_speed = slot_cur->bus_on->current_speed; ibmphp_update_slot_info() 633 mode = slot_cur->bus_on->current_bus_mode; ibmphp_update_slot_info() 657 rc = pci_hp_change_slot_info(slot_cur->hotplug_slot, info); ibmphp_update_slot_info() 671 struct slot *slot_cur; ibm_slot_find() local 674 slot_cur = list_entry(tmp, struct slot, ibm_slot_list); ibm_slot_find() 675 if (slot_cur->func) { ibm_slot_find() 676 func_cur = slot_cur->func; ibm_slot_find() 696 struct slot *slot_cur; free_slots() local 703 slot_cur = list_entry(tmp, struct slot, ibm_slot_list); free_slots() 704 pci_hp_deregister(slot_cur->hotplug_slot); free_slots() 830 static int is_bus_empty(struct slot *slot_cur) is_bus_empty() argument 834 u8 i = slot_cur->bus_on->slot_min; is_bus_empty() 836 while (i <= slot_cur->bus_on->slot_max) { is_bus_empty() 837 if (i == slot_cur->number) { is_bus_empty() 861 static int set_bus(struct slot *slot_cur) set_bus() argument 872 debug("%s - entry slot # %d\n", __func__, slot_cur->number); set_bus() 873 if (SET_BUS_STATUS(slot_cur->ctrl) && is_bus_empty(slot_cur)) { set_bus() 874 rc = slot_update(&slot_cur); set_bus() 877 speed = SLOT_SPEED(slot_cur->ext_status); set_bus() 878 debug("ext_status = %x, speed = %x\n", slot_cur->ext_status, speed); set_bus() 884 if (SLOT_PCIX(slot_cur->ext_status)) { set_bus() 885 if ((slot_cur->supported_speed >= BUS_SPEED_66) && set_bus() 886 (slot_cur->supported_bus_mode == BUS_MODE_PCIX)) set_bus() 888 else if (!SLOT_BUS_MODE(slot_cur->ext_status)) set_bus() 896 if (slot_cur->supported_speed >= BUS_SPEED_66) set_bus() 903 switch (slot_cur->supported_speed) { set_bus() 908 if (slot_cur->supported_bus_mode == BUS_MODE_PCIX) set_bus() 919 ibmphp_hpc_writeslot(slot_cur, set_bus() 933 slot_cur->number, cmd); set_bus() 934 retval = ibmphp_hpc_writeslot(slot_cur, cmd); set_bus() 939 if (CTLR_RESULT(slot_cur->ctrl->status)) { set_bus() 958 static int check_limitations(struct slot *slot_cur) check_limitations() argument 965 for (i = slot_cur->bus_on->slot_min; i <= slot_cur->bus_on->slot_max; i++) { check_limitations() 973 get_cur_bus_info(&slot_cur); check_limitations() 974 switch (slot_cur->bus_on->current_speed) { check_limitations() 976 limitation = slot_cur->bus_on->slots_at_33_conv; check_limitations() 979 if (slot_cur->bus_on->current_bus_mode == BUS_MODE_PCIX) check_limitations() 980 limitation = slot_cur->bus_on->slots_at_66_pcix; check_limitations() 982 limitation = slot_cur->bus_on->slots_at_66_conv; check_limitations() 985 limitation = slot_cur->bus_on->slots_at_100_pcix; check_limitations() 988 limitation = slot_cur->bus_on->slots_at_133_pcix; check_limitations() 997 static inline void print_card_capability(struct slot *slot_cur) print_card_capability() argument 1000 if ((slot_cur->ext_status & CARD_INFO) == PCIX133) print_card_capability() 1002 else if ((slot_cur->ext_status & CARD_INFO) == PCIX66) print_card_capability() 1004 else if ((slot_cur->ext_status & CARD_INFO) == PCI66) print_card_capability() 1019 struct slot *slot_cur; enable_slot() local 1026 slot_cur = hs->private; enable_slot() 1028 rc = validate(slot_cur, ENABLE); enable_slot() 1034 attn_LED_blink(slot_cur); enable_slot() 1036 rc = set_bus(slot_cur); enable_slot() 1043 get_cur_bus_info(&slot_cur); enable_slot() 1045 slot_cur->bus_on->current_speed); enable_slot() 1048 rc = check_limitations(slot_cur); enable_slot() 1057 rc = power_on(slot_cur); enable_slot() 1062 attn_off(slot_cur); enable_slot() 1063 attn_on(slot_cur); enable_slot() 1064 if (slot_update(&slot_cur)) { enable_slot() 1065 attn_off(slot_cur); enable_slot() 1066 attn_on(slot_cur); enable_slot() 1071 if ((SLOT_POWER(slot_cur->status)) && enable_slot() 1072 !(SLOT_PWRGD(slot_cur->status))) enable_slot() 1074 else if (SLOT_BUS_SPEED(slot_cur->status)) { enable_slot() 1076 print_card_capability(slot_cur); enable_slot() 1077 } else if (SLOT_BUS_MODE(slot_cur->ext_status)) { enable_slot() 1079 print_card_capability(slot_cur); enable_slot() 1081 ibmphp_update_slot_info(slot_cur); enable_slot() 1086 get_cur_bus_info(&slot_cur); enable_slot() 1088 slot_cur->bus_on->current_speed); enable_slot() 1091 rc = slot_update(&slot_cur); enable_slot() 1096 if (SLOT_POWER(slot_cur->status) && !(SLOT_PWRGD(slot_cur->status))) { enable_slot() 1100 if (SLOT_POWER(slot_cur->status) && (SLOT_BUS_SPEED(slot_cur->status))) { enable_slot() 1102 print_card_capability(slot_cur); enable_slot() 1107 if (!(SLOT_POWER(slot_cur->status))) { enable_slot() 1112 slot_cur->func = kzalloc(sizeof(struct pci_func), GFP_KERNEL); enable_slot() 1113 if (!slot_cur->func) { enable_slot() 1120 slot_cur->func->busno = slot_cur->bus; enable_slot() 1121 slot_cur->func->device = slot_cur->device; enable_slot() 1123 slot_cur->func->irq[i] = slot_cur->irq[i]; enable_slot() 1125 debug("b4 configure_card, slot_cur->bus = %x, slot_cur->device = %x\n", enable_slot() 1126 slot_cur->bus, slot_cur->device); enable_slot() 1128 if (ibmphp_configure_card(slot_cur->func, slot_cur->number)) { enable_slot() 1132 ibmphp_unconfigure_card(&slot_cur, 1); enable_slot() 1134 slot_cur->func = NULL; enable_slot() 1141 tmp_func = ibm_slot_find(slot_cur->bus, slot_cur->func->device, enable_slot() 1147 attn_off(slot_cur); enable_slot() 1148 if (slot_update(&slot_cur)) { enable_slot() 1153 rc = ibmphp_update_slot_info(slot_cur); enable_slot() 1159 attn_off(slot_cur); /* need to turn off if was blinking b4 */ enable_slot() 1160 attn_on(slot_cur); enable_slot() 1162 rcpr = slot_update(&slot_cur); enable_slot() 1167 ibmphp_update_slot_info(slot_cur); enable_slot() 1171 attn_off(slot_cur); /* need to turn off if was blinking b4 */ enable_slot() 1172 attn_on(slot_cur); enable_slot() 1173 rcpr = power_off(slot_cur); enable_slot() 1198 int ibmphp_do_disable_slot(struct slot *slot_cur) ibmphp_do_disable_slot() argument 1205 if ((slot_cur == NULL) || (slot_cur->ctrl == NULL)) ibmphp_do_disable_slot() 1208 flag = slot_cur->flag; ibmphp_do_disable_slot() 1209 slot_cur->flag = 1; ibmphp_do_disable_slot() 1212 rc = validate(slot_cur, DISABLE); ibmphp_do_disable_slot() 1217 attn_LED_blink(slot_cur); ibmphp_do_disable_slot() 1219 if (slot_cur->func == NULL) { ibmphp_do_disable_slot() 1221 slot_cur->func = kzalloc(sizeof(struct pci_func), GFP_KERNEL); ibmphp_do_disable_slot() 1222 if (!slot_cur->func) { ibmphp_do_disable_slot() 1227 slot_cur->func->busno = slot_cur->bus; ibmphp_do_disable_slot() 1228 slot_cur->func->device = slot_cur->device; ibmphp_do_disable_slot() 1231 ibm_unconfigure_device(slot_cur->func); ibmphp_do_disable_slot() 1241 attn_off(slot_cur); ibmphp_do_disable_slot() 1245 rc = ibmphp_unconfigure_card(&slot_cur, 0); ibmphp_do_disable_slot() 1246 slot_cur->func = NULL; ibmphp_do_disable_slot() 1253 rc = ibmphp_hpc_writeslot(slot_cur, HPC_SLOT_OFF); ibmphp_do_disable_slot() 1257 attn_off(slot_cur); ibmphp_do_disable_slot() 1258 rc = slot_update(&slot_cur); ibmphp_do_disable_slot() 1262 rc = ibmphp_update_slot_info(slot_cur); ibmphp_do_disable_slot() 1269 attn_off(slot_cur); ibmphp_do_disable_slot() 1270 attn_on(slot_cur); ibmphp_do_disable_slot() 1271 if (slot_update(&slot_cur)) { ibmphp_do_disable_slot() 1276 ibmphp_update_slot_info(slot_cur); ibmphp_do_disable_slot()
|