Lines Matching refs:p_slot

25 static int shpchp_enable_slot(struct slot *p_slot);
26 static int shpchp_disable_slot(struct slot *p_slot);
28 static int queue_interrupt_event(struct slot *p_slot, u32 event_type) in queue_interrupt_event() argument
37 info->p_slot = p_slot; in queue_interrupt_event()
40 queue_work(p_slot->wq, &info->work); in queue_interrupt_event()
47 struct slot *p_slot; in shpchp_handle_attention_button() local
53 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); in shpchp_handle_attention_button()
54 shpchp_get_adapter_status(p_slot, &p_slot->presence_save); in shpchp_handle_attention_button()
59 ctrl_info(ctrl, "Button pressed on Slot(%s)\n", slot_name(p_slot)); in shpchp_handle_attention_button()
62 queue_interrupt_event(p_slot, event_type); in shpchp_handle_attention_button()
70 struct slot *p_slot; in shpchp_handle_switch_change() local
77 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); in shpchp_handle_switch_change()
78 shpchp_get_adapter_status(p_slot, &p_slot->presence_save); in shpchp_handle_switch_change()
79 shpchp_get_latch_status(p_slot, &getstatus); in shpchp_handle_switch_change()
81 p_slot->presence_save, p_slot->pwr_save); in shpchp_handle_switch_change()
87 ctrl_info(ctrl, "Latch open on Slot(%s)\n", slot_name(p_slot)); in shpchp_handle_switch_change()
89 if (p_slot->pwr_save && p_slot->presence_save) { in shpchp_handle_switch_change()
97 ctrl_info(ctrl, "Latch close on Slot(%s)\n", slot_name(p_slot)); in shpchp_handle_switch_change()
101 queue_interrupt_event(p_slot, event_type); in shpchp_handle_switch_change()
108 struct slot *p_slot; in shpchp_handle_presence_change() local
114 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); in shpchp_handle_presence_change()
119 shpchp_get_adapter_status(p_slot, &p_slot->presence_save); in shpchp_handle_presence_change()
120 if (p_slot->presence_save) { in shpchp_handle_presence_change()
125 slot_name(p_slot)); in shpchp_handle_presence_change()
132 slot_name(p_slot)); in shpchp_handle_presence_change()
136 queue_interrupt_event(p_slot, event_type); in shpchp_handle_presence_change()
143 struct slot *p_slot; in shpchp_handle_power_fault() local
149 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); in shpchp_handle_power_fault()
151 if (!(shpchp_query_power_fault(p_slot))) { in shpchp_handle_power_fault()
156 slot_name(p_slot)); in shpchp_handle_power_fault()
157 p_slot->status = 0x00; in shpchp_handle_power_fault()
163 ctrl_info(ctrl, "Power fault on Slot(%s)\n", slot_name(p_slot)); in shpchp_handle_power_fault()
166 p_slot->status = 0xFF; in shpchp_handle_power_fault()
170 queue_interrupt_event(p_slot, event_type); in shpchp_handle_power_fault()
178 static int change_bus_speed(struct controller *ctrl, struct slot *p_slot, in change_bus_speed() argument
184 rc = shpchp_set_bus_speed_mode(p_slot, speed); in change_bus_speed()
229 static int board_added(struct slot *p_slot) in board_added() argument
235 struct controller *ctrl = p_slot->ctrl; in board_added()
238 hp_slot = p_slot->device - ctrl->slot_device_offset; in board_added()
241 __func__, p_slot->device, ctrl->slot_device_offset, hp_slot); in board_added()
244 rc = shpchp_power_on_slot(p_slot); in board_added()
251 rc = shpchp_set_bus_speed_mode(p_slot, PCI_SPEED_33MHz); in board_added()
259 rc = shpchp_slot_enable(p_slot); in board_added()
266 rc = shpchp_get_adapter_speed(p_slot, &asp); in board_added()
283 rc = fix_bus_speed(ctrl, p_slot, slots_not_empty, asp, bsp, msp); in board_added()
288 rc = shpchp_slot_enable(p_slot); in board_added()
297 ctrl_dbg(ctrl, "%s: slot status = %x\n", __func__, p_slot->status); in board_added()
299 if (p_slot->status == 0xFF) { in board_added()
302 p_slot->status = 0; in board_added()
306 if (shpchp_configure_device(p_slot)) { in board_added()
308 pci_domain_nr(parent), p_slot->bus, p_slot->device); in board_added()
312 p_slot->status = 0; in board_added()
313 p_slot->is_a_board = 0x01; in board_added()
314 p_slot->pwr_save = 1; in board_added()
316 shpchp_green_led_on(p_slot); in board_added()
322 rc = shpchp_slot_disable(p_slot); in board_added()
337 static int remove_board(struct slot *p_slot) in remove_board() argument
339 struct controller *ctrl = p_slot->ctrl; in remove_board()
343 shpchp_unconfigure_device(p_slot); in remove_board()
345 hp_slot = p_slot->device - ctrl->slot_device_offset; in remove_board()
346 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); in remove_board()
351 if (p_slot->is_a_board) in remove_board()
352 p_slot->status = 0x01; in remove_board()
355 rc = shpchp_slot_disable(p_slot); in remove_board()
362 rc = shpchp_set_attention_status(p_slot, 0); in remove_board()
368 p_slot->pwr_save = 0; in remove_board()
369 p_slot->is_a_board = 0; in remove_board()
376 struct slot *p_slot; member
391 struct slot *p_slot = info->p_slot; in shpchp_pushbutton_thread() local
393 mutex_lock(&p_slot->lock); in shpchp_pushbutton_thread()
394 switch (p_slot->state) { in shpchp_pushbutton_thread()
396 mutex_unlock(&p_slot->lock); in shpchp_pushbutton_thread()
397 shpchp_disable_slot(p_slot); in shpchp_pushbutton_thread()
398 mutex_lock(&p_slot->lock); in shpchp_pushbutton_thread()
399 p_slot->state = STATIC_STATE; in shpchp_pushbutton_thread()
402 mutex_unlock(&p_slot->lock); in shpchp_pushbutton_thread()
403 if (shpchp_enable_slot(p_slot)) in shpchp_pushbutton_thread()
404 shpchp_green_led_off(p_slot); in shpchp_pushbutton_thread()
405 mutex_lock(&p_slot->lock); in shpchp_pushbutton_thread()
406 p_slot->state = STATIC_STATE; in shpchp_pushbutton_thread()
411 mutex_unlock(&p_slot->lock); in shpchp_pushbutton_thread()
418 struct slot *p_slot = container_of(work, struct slot, work.work); in shpchp_queue_pushbutton_work() local
423 ctrl_err(p_slot->ctrl, "%s: Cannot allocate memory\n", in shpchp_queue_pushbutton_work()
427 info->p_slot = p_slot; in shpchp_queue_pushbutton_work()
430 mutex_lock(&p_slot->lock); in shpchp_queue_pushbutton_work()
431 switch (p_slot->state) { in shpchp_queue_pushbutton_work()
433 p_slot->state = POWEROFF_STATE; in shpchp_queue_pushbutton_work()
436 p_slot->state = POWERON_STATE; in shpchp_queue_pushbutton_work()
442 queue_work(p_slot->wq, &info->work); in shpchp_queue_pushbutton_work()
444 mutex_unlock(&p_slot->lock); in shpchp_queue_pushbutton_work()
458 static void handle_button_press_event(struct slot *p_slot) in handle_button_press_event() argument
461 struct controller *ctrl = p_slot->ctrl; in handle_button_press_event()
463 switch (p_slot->state) { in handle_button_press_event()
465 shpchp_get_power_status(p_slot, &getstatus); in handle_button_press_event()
467 p_slot->state = BLINKINGOFF_STATE; in handle_button_press_event()
469 slot_name(p_slot)); in handle_button_press_event()
471 p_slot->state = BLINKINGON_STATE; in handle_button_press_event()
473 slot_name(p_slot)); in handle_button_press_event()
476 shpchp_green_led_blink(p_slot); in handle_button_press_event()
477 shpchp_set_attention_status(p_slot, 0); in handle_button_press_event()
479 queue_delayed_work(p_slot->wq, &p_slot->work, 5*HZ); in handle_button_press_event()
489 slot_name(p_slot)); in handle_button_press_event()
490 cancel_delayed_work(&p_slot->work); in handle_button_press_event()
491 if (p_slot->state == BLINKINGOFF_STATE) in handle_button_press_event()
492 shpchp_green_led_on(p_slot); in handle_button_press_event()
494 shpchp_green_led_off(p_slot); in handle_button_press_event()
495 shpchp_set_attention_status(p_slot, 0); in handle_button_press_event()
497 slot_name(p_slot)); in handle_button_press_event()
498 p_slot->state = STATIC_STATE; in handle_button_press_event()
508 slot_name(p_slot)); in handle_button_press_event()
509 update_slot_info(p_slot); in handle_button_press_event()
520 struct slot *p_slot = info->p_slot; in interrupt_event_handler() local
522 mutex_lock(&p_slot->lock); in interrupt_event_handler()
525 handle_button_press_event(p_slot); in interrupt_event_handler()
528 ctrl_dbg(p_slot->ctrl, "%s: Power fault\n", __func__); in interrupt_event_handler()
529 shpchp_set_attention_status(p_slot, 1); in interrupt_event_handler()
530 shpchp_green_led_off(p_slot); in interrupt_event_handler()
533 update_slot_info(p_slot); in interrupt_event_handler()
536 mutex_unlock(&p_slot->lock); in interrupt_event_handler()
542 static int shpchp_enable_slot (struct slot *p_slot) in shpchp_enable_slot() argument
546 struct controller *ctrl = p_slot->ctrl; in shpchp_enable_slot()
549 mutex_lock(&p_slot->ctrl->crit_sect); in shpchp_enable_slot()
550 rc = shpchp_get_adapter_status(p_slot, &getstatus); in shpchp_enable_slot()
552 ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot)); in shpchp_enable_slot()
555 rc = shpchp_get_latch_status(p_slot, &getstatus); in shpchp_enable_slot()
557 ctrl_info(ctrl, "Latch open on slot(%s)\n", slot_name(p_slot)); in shpchp_enable_slot()
560 rc = shpchp_get_power_status(p_slot, &getstatus); in shpchp_enable_slot()
563 slot_name(p_slot)); in shpchp_enable_slot()
567 p_slot->is_a_board = 1; in shpchp_enable_slot()
570 shpchp_get_adapter_status(p_slot, &p_slot->presence_save); in shpchp_enable_slot()
571 shpchp_get_power_status(p_slot, &p_slot->pwr_save); in shpchp_enable_slot()
572 ctrl_dbg(ctrl, "%s: p_slot->pwr_save %x\n", __func__, p_slot->pwr_save); in shpchp_enable_slot()
573 shpchp_get_latch_status(p_slot, &getstatus); in shpchp_enable_slot()
575 if ((p_slot->ctrl->pci_dev->vendor == PCI_VENDOR_ID_AMD && in shpchp_enable_slot()
576 p_slot->ctrl->pci_dev->device == PCI_DEVICE_ID_AMD_POGO_7458) in shpchp_enable_slot()
577 && p_slot->ctrl->num_slots == 1) { in shpchp_enable_slot()
579 amd_pogo_errata_save_misc_reg(p_slot); in shpchp_enable_slot()
580 retval = board_added(p_slot); in shpchp_enable_slot()
582 amd_pogo_errata_restore_misc_reg(p_slot); in shpchp_enable_slot()
584 retval = board_added(p_slot); in shpchp_enable_slot()
587 shpchp_get_adapter_status(p_slot, &p_slot->presence_save); in shpchp_enable_slot()
588 shpchp_get_latch_status(p_slot, &getstatus); in shpchp_enable_slot()
591 update_slot_info(p_slot); in shpchp_enable_slot()
593 mutex_unlock(&p_slot->ctrl->crit_sect); in shpchp_enable_slot()
598 static int shpchp_disable_slot (struct slot *p_slot) in shpchp_disable_slot() argument
602 struct controller *ctrl = p_slot->ctrl; in shpchp_disable_slot()
604 if (!p_slot->ctrl) in shpchp_disable_slot()
608 mutex_lock(&p_slot->ctrl->crit_sect); in shpchp_disable_slot()
610 rc = shpchp_get_adapter_status(p_slot, &getstatus); in shpchp_disable_slot()
612 ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot)); in shpchp_disable_slot()
615 rc = shpchp_get_latch_status(p_slot, &getstatus); in shpchp_disable_slot()
617 ctrl_info(ctrl, "Latch open on slot(%s)\n", slot_name(p_slot)); in shpchp_disable_slot()
620 rc = shpchp_get_power_status(p_slot, &getstatus); in shpchp_disable_slot()
623 slot_name(p_slot)); in shpchp_disable_slot()
627 retval = remove_board(p_slot); in shpchp_disable_slot()
628 update_slot_info(p_slot); in shpchp_disable_slot()
630 mutex_unlock(&p_slot->ctrl->crit_sect); in shpchp_disable_slot()
634 int shpchp_sysfs_enable_slot(struct slot *p_slot) in shpchp_sysfs_enable_slot() argument
637 struct controller *ctrl = p_slot->ctrl; in shpchp_sysfs_enable_slot()
639 mutex_lock(&p_slot->lock); in shpchp_sysfs_enable_slot()
640 switch (p_slot->state) { in shpchp_sysfs_enable_slot()
642 cancel_delayed_work(&p_slot->work); in shpchp_sysfs_enable_slot()
645 p_slot->state = POWERON_STATE; in shpchp_sysfs_enable_slot()
646 mutex_unlock(&p_slot->lock); in shpchp_sysfs_enable_slot()
647 retval = shpchp_enable_slot(p_slot); in shpchp_sysfs_enable_slot()
648 mutex_lock(&p_slot->lock); in shpchp_sysfs_enable_slot()
649 p_slot->state = STATIC_STATE; in shpchp_sysfs_enable_slot()
653 slot_name(p_slot)); in shpchp_sysfs_enable_slot()
658 slot_name(p_slot)); in shpchp_sysfs_enable_slot()
662 slot_name(p_slot)); in shpchp_sysfs_enable_slot()
665 mutex_unlock(&p_slot->lock); in shpchp_sysfs_enable_slot()
670 int shpchp_sysfs_disable_slot(struct slot *p_slot) in shpchp_sysfs_disable_slot() argument
673 struct controller *ctrl = p_slot->ctrl; in shpchp_sysfs_disable_slot()
675 mutex_lock(&p_slot->lock); in shpchp_sysfs_disable_slot()
676 switch (p_slot->state) { in shpchp_sysfs_disable_slot()
678 cancel_delayed_work(&p_slot->work); in shpchp_sysfs_disable_slot()
681 p_slot->state = POWEROFF_STATE; in shpchp_sysfs_disable_slot()
682 mutex_unlock(&p_slot->lock); in shpchp_sysfs_disable_slot()
683 retval = shpchp_disable_slot(p_slot); in shpchp_sysfs_disable_slot()
684 mutex_lock(&p_slot->lock); in shpchp_sysfs_disable_slot()
685 p_slot->state = STATIC_STATE; in shpchp_sysfs_disable_slot()
689 slot_name(p_slot)); in shpchp_sysfs_disable_slot()
694 slot_name(p_slot)); in shpchp_sysfs_disable_slot()
698 slot_name(p_slot)); in shpchp_sysfs_disable_slot()
701 mutex_unlock(&p_slot->lock); in shpchp_sysfs_disable_slot()