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 p_slot->hpc_ops->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 p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); in shpchp_handle_switch_change()
79 p_slot->hpc_ops->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 p_slot->hpc_ops->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 (!(p_slot->hpc_ops->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 = p_slot->hpc_ops->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 = p_slot->hpc_ops->power_on_slot(p_slot); in board_added()
251 rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, PCI_SPEED_33MHz); in board_added()
259 rc = p_slot->hpc_ops->slot_enable(p_slot); in board_added()
266 rc = p_slot->hpc_ops->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 = p_slot->hpc_ops->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()
303 p_slot->status = 0; in board_added()
307 if (shpchp_configure_device(p_slot)) { in board_added()
309 pci_domain_nr(parent), p_slot->bus, p_slot->device); in board_added()
313 p_slot->status = 0; in board_added()
314 p_slot->is_a_board = 0x01; in board_added()
315 p_slot->pwr_save = 1; in board_added()
317 p_slot->hpc_ops->green_led_on(p_slot); in board_added()
323 rc = p_slot->hpc_ops->slot_disable(p_slot); in board_added()
338 static int remove_board(struct slot *p_slot) in remove_board() argument
340 struct controller *ctrl = p_slot->ctrl; in remove_board()
344 if (shpchp_unconfigure_device(p_slot)) in remove_board()
347 hp_slot = p_slot->device - ctrl->slot_device_offset; in remove_board()
348 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); in remove_board()
353 if (p_slot->is_a_board) in remove_board()
354 p_slot->status = 0x01; in remove_board()
357 rc = p_slot->hpc_ops->slot_disable(p_slot); in remove_board()
364 rc = p_slot->hpc_ops->set_attention_status(p_slot, 0); in remove_board()
370 p_slot->pwr_save = 0; in remove_board()
371 p_slot->is_a_board = 0; in remove_board()
378 struct slot *p_slot; member
393 struct slot *p_slot = info->p_slot; in shpchp_pushbutton_thread() local
395 mutex_lock(&p_slot->lock); in shpchp_pushbutton_thread()
396 switch (p_slot->state) { in shpchp_pushbutton_thread()
398 mutex_unlock(&p_slot->lock); in shpchp_pushbutton_thread()
399 shpchp_disable_slot(p_slot); in shpchp_pushbutton_thread()
400 mutex_lock(&p_slot->lock); in shpchp_pushbutton_thread()
401 p_slot->state = STATIC_STATE; in shpchp_pushbutton_thread()
404 mutex_unlock(&p_slot->lock); in shpchp_pushbutton_thread()
405 if (shpchp_enable_slot(p_slot)) in shpchp_pushbutton_thread()
406 p_slot->hpc_ops->green_led_off(p_slot); in shpchp_pushbutton_thread()
407 mutex_lock(&p_slot->lock); in shpchp_pushbutton_thread()
408 p_slot->state = STATIC_STATE; in shpchp_pushbutton_thread()
413 mutex_unlock(&p_slot->lock); in shpchp_pushbutton_thread()
420 struct slot *p_slot = container_of(work, struct slot, work.work); in shpchp_queue_pushbutton_work() local
425 ctrl_err(p_slot->ctrl, "%s: Cannot allocate memory\n", in shpchp_queue_pushbutton_work()
429 info->p_slot = p_slot; in shpchp_queue_pushbutton_work()
432 mutex_lock(&p_slot->lock); in shpchp_queue_pushbutton_work()
433 switch (p_slot->state) { in shpchp_queue_pushbutton_work()
435 p_slot->state = POWEROFF_STATE; in shpchp_queue_pushbutton_work()
438 p_slot->state = POWERON_STATE; in shpchp_queue_pushbutton_work()
444 queue_work(p_slot->wq, &info->work); in shpchp_queue_pushbutton_work()
446 mutex_unlock(&p_slot->lock); in shpchp_queue_pushbutton_work()
471 static void handle_button_press_event(struct slot *p_slot) in handle_button_press_event() argument
474 struct controller *ctrl = p_slot->ctrl; in handle_button_press_event()
476 switch (p_slot->state) { in handle_button_press_event()
478 p_slot->hpc_ops->get_power_status(p_slot, &getstatus); in handle_button_press_event()
480 p_slot->state = BLINKINGOFF_STATE; in handle_button_press_event()
482 slot_name(p_slot)); in handle_button_press_event()
484 p_slot->state = BLINKINGON_STATE; in handle_button_press_event()
486 slot_name(p_slot)); in handle_button_press_event()
489 p_slot->hpc_ops->green_led_blink(p_slot); in handle_button_press_event()
490 p_slot->hpc_ops->set_attention_status(p_slot, 0); in handle_button_press_event()
492 queue_delayed_work(p_slot->wq, &p_slot->work, 5*HZ); in handle_button_press_event()
502 slot_name(p_slot)); in handle_button_press_event()
503 cancel_delayed_work(&p_slot->work); in handle_button_press_event()
504 if (p_slot->state == BLINKINGOFF_STATE) in handle_button_press_event()
505 p_slot->hpc_ops->green_led_on(p_slot); in handle_button_press_event()
507 p_slot->hpc_ops->green_led_off(p_slot); in handle_button_press_event()
508 p_slot->hpc_ops->set_attention_status(p_slot, 0); in handle_button_press_event()
510 slot_name(p_slot)); in handle_button_press_event()
511 p_slot->state = STATIC_STATE; in handle_button_press_event()
521 slot_name(p_slot)); in handle_button_press_event()
522 update_slot_info(p_slot); in handle_button_press_event()
533 struct slot *p_slot = info->p_slot; in interrupt_event_handler() local
535 mutex_lock(&p_slot->lock); in interrupt_event_handler()
538 handle_button_press_event(p_slot); in interrupt_event_handler()
541 ctrl_dbg(p_slot->ctrl, "%s: Power fault\n", __func__); in interrupt_event_handler()
542 p_slot->hpc_ops->set_attention_status(p_slot, 1); in interrupt_event_handler()
543 p_slot->hpc_ops->green_led_off(p_slot); in interrupt_event_handler()
546 update_slot_info(p_slot); in interrupt_event_handler()
549 mutex_unlock(&p_slot->lock); in interrupt_event_handler()
555 static int shpchp_enable_slot (struct slot *p_slot) in shpchp_enable_slot() argument
559 struct controller *ctrl = p_slot->ctrl; in shpchp_enable_slot()
562 mutex_lock(&p_slot->ctrl->crit_sect); in shpchp_enable_slot()
563 rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); in shpchp_enable_slot()
565 ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot)); in shpchp_enable_slot()
568 rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); in shpchp_enable_slot()
570 ctrl_info(ctrl, "Latch open on slot(%s)\n", slot_name(p_slot)); in shpchp_enable_slot()
573 rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); in shpchp_enable_slot()
576 slot_name(p_slot)); in shpchp_enable_slot()
580 p_slot->is_a_board = 1; in shpchp_enable_slot()
583 p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); in shpchp_enable_slot()
584 p_slot->hpc_ops->get_power_status(p_slot, &(p_slot->pwr_save)); in shpchp_enable_slot()
585 ctrl_dbg(ctrl, "%s: p_slot->pwr_save %x\n", __func__, p_slot->pwr_save); in shpchp_enable_slot()
586 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); in shpchp_enable_slot()
588 if ((p_slot->ctrl->pci_dev->vendor == PCI_VENDOR_ID_AMD && in shpchp_enable_slot()
589 p_slot->ctrl->pci_dev->device == PCI_DEVICE_ID_AMD_POGO_7458) in shpchp_enable_slot()
590 && p_slot->ctrl->num_slots == 1) { in shpchp_enable_slot()
592 amd_pogo_errata_save_misc_reg(p_slot); in shpchp_enable_slot()
593 retval = board_added(p_slot); in shpchp_enable_slot()
595 amd_pogo_errata_restore_misc_reg(p_slot); in shpchp_enable_slot()
597 retval = board_added(p_slot); in shpchp_enable_slot()
600 p_slot->hpc_ops->get_adapter_status(p_slot, in shpchp_enable_slot()
601 &(p_slot->presence_save)); in shpchp_enable_slot()
602 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); in shpchp_enable_slot()
605 update_slot_info(p_slot); in shpchp_enable_slot()
607 mutex_unlock(&p_slot->ctrl->crit_sect); in shpchp_enable_slot()
612 static int shpchp_disable_slot (struct slot *p_slot) in shpchp_disable_slot() argument
616 struct controller *ctrl = p_slot->ctrl; in shpchp_disable_slot()
618 if (!p_slot->ctrl) in shpchp_disable_slot()
622 mutex_lock(&p_slot->ctrl->crit_sect); in shpchp_disable_slot()
624 rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); in shpchp_disable_slot()
626 ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot)); in shpchp_disable_slot()
629 rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); in shpchp_disable_slot()
631 ctrl_info(ctrl, "Latch open on slot(%s)\n", slot_name(p_slot)); in shpchp_disable_slot()
634 rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); in shpchp_disable_slot()
637 slot_name(p_slot)); in shpchp_disable_slot()
641 retval = remove_board(p_slot); in shpchp_disable_slot()
642 update_slot_info(p_slot); in shpchp_disable_slot()
644 mutex_unlock(&p_slot->ctrl->crit_sect); in shpchp_disable_slot()
648 int shpchp_sysfs_enable_slot(struct slot *p_slot) in shpchp_sysfs_enable_slot() argument
651 struct controller *ctrl = p_slot->ctrl; in shpchp_sysfs_enable_slot()
653 mutex_lock(&p_slot->lock); in shpchp_sysfs_enable_slot()
654 switch (p_slot->state) { in shpchp_sysfs_enable_slot()
656 cancel_delayed_work(&p_slot->work); in shpchp_sysfs_enable_slot()
659 p_slot->state = POWERON_STATE; in shpchp_sysfs_enable_slot()
660 mutex_unlock(&p_slot->lock); in shpchp_sysfs_enable_slot()
661 retval = shpchp_enable_slot(p_slot); in shpchp_sysfs_enable_slot()
662 mutex_lock(&p_slot->lock); in shpchp_sysfs_enable_slot()
663 p_slot->state = STATIC_STATE; in shpchp_sysfs_enable_slot()
667 slot_name(p_slot)); in shpchp_sysfs_enable_slot()
672 slot_name(p_slot)); in shpchp_sysfs_enable_slot()
676 slot_name(p_slot)); in shpchp_sysfs_enable_slot()
679 mutex_unlock(&p_slot->lock); in shpchp_sysfs_enable_slot()
684 int shpchp_sysfs_disable_slot(struct slot *p_slot) in shpchp_sysfs_disable_slot() argument
687 struct controller *ctrl = p_slot->ctrl; in shpchp_sysfs_disable_slot()
689 mutex_lock(&p_slot->lock); in shpchp_sysfs_disable_slot()
690 switch (p_slot->state) { in shpchp_sysfs_disable_slot()
692 cancel_delayed_work(&p_slot->work); in shpchp_sysfs_disable_slot()
695 p_slot->state = POWEROFF_STATE; in shpchp_sysfs_disable_slot()
696 mutex_unlock(&p_slot->lock); in shpchp_sysfs_disable_slot()
697 retval = shpchp_disable_slot(p_slot); in shpchp_sysfs_disable_slot()
698 mutex_lock(&p_slot->lock); in shpchp_sysfs_disable_slot()
699 p_slot->state = STATIC_STATE; in shpchp_sysfs_disable_slot()
703 slot_name(p_slot)); in shpchp_sysfs_disable_slot()
708 slot_name(p_slot)); in shpchp_sysfs_disable_slot()
712 slot_name(p_slot)); in shpchp_sysfs_disable_slot()
715 mutex_unlock(&p_slot->lock); in shpchp_sysfs_disable_slot()