Lines Matching refs:p_slot
39 static int shpchp_enable_slot(struct slot *p_slot);
40 static int shpchp_disable_slot(struct slot *p_slot);
42 static int queue_interrupt_event(struct slot *p_slot, u32 event_type) in queue_interrupt_event() argument
51 info->p_slot = p_slot; in queue_interrupt_event()
54 queue_work(p_slot->wq, &info->work); in queue_interrupt_event()
61 struct slot *p_slot; in shpchp_handle_attention_button() local
67 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); in shpchp_handle_attention_button()
68 p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); in shpchp_handle_attention_button()
73 ctrl_info(ctrl, "Button pressed on Slot(%s)\n", slot_name(p_slot)); in shpchp_handle_attention_button()
76 queue_interrupt_event(p_slot, event_type); in shpchp_handle_attention_button()
84 struct slot *p_slot; in shpchp_handle_switch_change() local
91 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); in shpchp_handle_switch_change()
92 p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); in shpchp_handle_switch_change()
93 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); in shpchp_handle_switch_change()
95 p_slot->presence_save, p_slot->pwr_save); in shpchp_handle_switch_change()
101 ctrl_info(ctrl, "Latch open on Slot(%s)\n", slot_name(p_slot)); in shpchp_handle_switch_change()
103 if (p_slot->pwr_save && p_slot->presence_save) { in shpchp_handle_switch_change()
111 ctrl_info(ctrl, "Latch close on Slot(%s)\n", slot_name(p_slot)); in shpchp_handle_switch_change()
115 queue_interrupt_event(p_slot, event_type); in shpchp_handle_switch_change()
122 struct slot *p_slot; in shpchp_handle_presence_change() local
128 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); in shpchp_handle_presence_change()
133 p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); in shpchp_handle_presence_change()
134 if (p_slot->presence_save) { in shpchp_handle_presence_change()
139 slot_name(p_slot)); in shpchp_handle_presence_change()
146 slot_name(p_slot)); in shpchp_handle_presence_change()
150 queue_interrupt_event(p_slot, event_type); in shpchp_handle_presence_change()
157 struct slot *p_slot; in shpchp_handle_power_fault() local
163 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); in shpchp_handle_power_fault()
165 if (!(p_slot->hpc_ops->query_power_fault(p_slot))) { in shpchp_handle_power_fault()
170 slot_name(p_slot)); in shpchp_handle_power_fault()
171 p_slot->status = 0x00; in shpchp_handle_power_fault()
177 ctrl_info(ctrl, "Power fault on Slot(%s)\n", slot_name(p_slot)); in shpchp_handle_power_fault()
180 p_slot->status = 0xFF; in shpchp_handle_power_fault()
184 queue_interrupt_event(p_slot, event_type); in shpchp_handle_power_fault()
192 static int change_bus_speed(struct controller *ctrl, struct slot *p_slot, in change_bus_speed() argument
198 rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, speed); in change_bus_speed()
243 static int board_added(struct slot *p_slot) in board_added() argument
249 struct controller *ctrl = p_slot->ctrl; in board_added()
252 hp_slot = p_slot->device - ctrl->slot_device_offset; in board_added()
255 __func__, p_slot->device, ctrl->slot_device_offset, hp_slot); in board_added()
258 rc = p_slot->hpc_ops->power_on_slot(p_slot); in board_added()
265 rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, PCI_SPEED_33MHz); in board_added()
273 rc = p_slot->hpc_ops->slot_enable(p_slot); in board_added()
280 rc = p_slot->hpc_ops->get_adapter_speed(p_slot, &asp); in board_added()
297 rc = fix_bus_speed(ctrl, p_slot, slots_not_empty, asp, bsp, msp); in board_added()
302 rc = p_slot->hpc_ops->slot_enable(p_slot); in board_added()
311 ctrl_dbg(ctrl, "%s: slot status = %x\n", __func__, p_slot->status); in board_added()
313 if (p_slot->status == 0xFF) { in board_added()
317 p_slot->status = 0; in board_added()
321 if (shpchp_configure_device(p_slot)) { in board_added()
323 pci_domain_nr(parent), p_slot->bus, p_slot->device); in board_added()
327 p_slot->status = 0; in board_added()
328 p_slot->is_a_board = 0x01; in board_added()
329 p_slot->pwr_save = 1; in board_added()
331 p_slot->hpc_ops->green_led_on(p_slot); in board_added()
337 rc = p_slot->hpc_ops->slot_disable(p_slot); in board_added()
352 static int remove_board(struct slot *p_slot) in remove_board() argument
354 struct controller *ctrl = p_slot->ctrl; in remove_board()
358 if (shpchp_unconfigure_device(p_slot)) in remove_board()
361 hp_slot = p_slot->device - ctrl->slot_device_offset; in remove_board()
362 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); in remove_board()
367 if (p_slot->is_a_board) in remove_board()
368 p_slot->status = 0x01; in remove_board()
371 rc = p_slot->hpc_ops->slot_disable(p_slot); in remove_board()
378 rc = p_slot->hpc_ops->set_attention_status(p_slot, 0); in remove_board()
384 p_slot->pwr_save = 0; in remove_board()
385 p_slot->is_a_board = 0; in remove_board()
392 struct slot *p_slot; member
407 struct slot *p_slot = info->p_slot; in shpchp_pushbutton_thread() local
409 mutex_lock(&p_slot->lock); in shpchp_pushbutton_thread()
410 switch (p_slot->state) { in shpchp_pushbutton_thread()
412 mutex_unlock(&p_slot->lock); in shpchp_pushbutton_thread()
413 shpchp_disable_slot(p_slot); in shpchp_pushbutton_thread()
414 mutex_lock(&p_slot->lock); in shpchp_pushbutton_thread()
415 p_slot->state = STATIC_STATE; in shpchp_pushbutton_thread()
418 mutex_unlock(&p_slot->lock); in shpchp_pushbutton_thread()
419 if (shpchp_enable_slot(p_slot)) in shpchp_pushbutton_thread()
420 p_slot->hpc_ops->green_led_off(p_slot); in shpchp_pushbutton_thread()
421 mutex_lock(&p_slot->lock); in shpchp_pushbutton_thread()
422 p_slot->state = STATIC_STATE; in shpchp_pushbutton_thread()
427 mutex_unlock(&p_slot->lock); in shpchp_pushbutton_thread()
434 struct slot *p_slot = container_of(work, struct slot, work.work); in shpchp_queue_pushbutton_work() local
439 ctrl_err(p_slot->ctrl, "%s: Cannot allocate memory\n", in shpchp_queue_pushbutton_work()
443 info->p_slot = p_slot; in shpchp_queue_pushbutton_work()
446 mutex_lock(&p_slot->lock); in shpchp_queue_pushbutton_work()
447 switch (p_slot->state) { in shpchp_queue_pushbutton_work()
449 p_slot->state = POWEROFF_STATE; in shpchp_queue_pushbutton_work()
452 p_slot->state = POWERON_STATE; in shpchp_queue_pushbutton_work()
458 queue_work(p_slot->wq, &info->work); in shpchp_queue_pushbutton_work()
460 mutex_unlock(&p_slot->lock); in shpchp_queue_pushbutton_work()
485 static void handle_button_press_event(struct slot *p_slot) in handle_button_press_event() argument
488 struct controller *ctrl = p_slot->ctrl; in handle_button_press_event()
490 switch (p_slot->state) { in handle_button_press_event()
492 p_slot->hpc_ops->get_power_status(p_slot, &getstatus); in handle_button_press_event()
494 p_slot->state = BLINKINGOFF_STATE; in handle_button_press_event()
496 slot_name(p_slot)); in handle_button_press_event()
498 p_slot->state = BLINKINGON_STATE; in handle_button_press_event()
500 slot_name(p_slot)); in handle_button_press_event()
503 p_slot->hpc_ops->green_led_blink(p_slot); in handle_button_press_event()
504 p_slot->hpc_ops->set_attention_status(p_slot, 0); in handle_button_press_event()
506 queue_delayed_work(p_slot->wq, &p_slot->work, 5*HZ); in handle_button_press_event()
516 slot_name(p_slot)); in handle_button_press_event()
517 cancel_delayed_work(&p_slot->work); in handle_button_press_event()
518 if (p_slot->state == BLINKINGOFF_STATE) in handle_button_press_event()
519 p_slot->hpc_ops->green_led_on(p_slot); in handle_button_press_event()
521 p_slot->hpc_ops->green_led_off(p_slot); in handle_button_press_event()
522 p_slot->hpc_ops->set_attention_status(p_slot, 0); in handle_button_press_event()
524 slot_name(p_slot)); in handle_button_press_event()
525 p_slot->state = STATIC_STATE; in handle_button_press_event()
535 slot_name(p_slot)); in handle_button_press_event()
536 update_slot_info(p_slot); in handle_button_press_event()
547 struct slot *p_slot = info->p_slot; in interrupt_event_handler() local
549 mutex_lock(&p_slot->lock); in interrupt_event_handler()
552 handle_button_press_event(p_slot); in interrupt_event_handler()
555 ctrl_dbg(p_slot->ctrl, "%s: Power fault\n", __func__); in interrupt_event_handler()
556 p_slot->hpc_ops->set_attention_status(p_slot, 1); in interrupt_event_handler()
557 p_slot->hpc_ops->green_led_off(p_slot); in interrupt_event_handler()
560 update_slot_info(p_slot); in interrupt_event_handler()
563 mutex_unlock(&p_slot->lock); in interrupt_event_handler()
569 static int shpchp_enable_slot (struct slot *p_slot) in shpchp_enable_slot() argument
573 struct controller *ctrl = p_slot->ctrl; in shpchp_enable_slot()
576 mutex_lock(&p_slot->ctrl->crit_sect); in shpchp_enable_slot()
577 rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); in shpchp_enable_slot()
579 ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot)); in shpchp_enable_slot()
582 rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); in shpchp_enable_slot()
584 ctrl_info(ctrl, "Latch open on slot(%s)\n", slot_name(p_slot)); in shpchp_enable_slot()
587 rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); in shpchp_enable_slot()
590 slot_name(p_slot)); in shpchp_enable_slot()
594 p_slot->is_a_board = 1; in shpchp_enable_slot()
597 p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); in shpchp_enable_slot()
598 p_slot->hpc_ops->get_power_status(p_slot, &(p_slot->pwr_save)); in shpchp_enable_slot()
599 ctrl_dbg(ctrl, "%s: p_slot->pwr_save %x\n", __func__, p_slot->pwr_save); in shpchp_enable_slot()
600 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); in shpchp_enable_slot()
602 if (((p_slot->ctrl->pci_dev->vendor == PCI_VENDOR_ID_AMD) || in shpchp_enable_slot()
603 (p_slot->ctrl->pci_dev->device == PCI_DEVICE_ID_AMD_POGO_7458)) in shpchp_enable_slot()
604 && p_slot->ctrl->num_slots == 1) { in shpchp_enable_slot()
606 amd_pogo_errata_save_misc_reg(p_slot); in shpchp_enable_slot()
607 retval = board_added(p_slot); in shpchp_enable_slot()
609 amd_pogo_errata_restore_misc_reg(p_slot); in shpchp_enable_slot()
611 retval = board_added(p_slot); in shpchp_enable_slot()
614 p_slot->hpc_ops->get_adapter_status(p_slot, in shpchp_enable_slot()
615 &(p_slot->presence_save)); in shpchp_enable_slot()
616 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); in shpchp_enable_slot()
619 update_slot_info(p_slot); in shpchp_enable_slot()
621 mutex_unlock(&p_slot->ctrl->crit_sect); in shpchp_enable_slot()
626 static int shpchp_disable_slot (struct slot *p_slot) in shpchp_disable_slot() argument
630 struct controller *ctrl = p_slot->ctrl; in shpchp_disable_slot()
632 if (!p_slot->ctrl) in shpchp_disable_slot()
636 mutex_lock(&p_slot->ctrl->crit_sect); in shpchp_disable_slot()
638 rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); in shpchp_disable_slot()
640 ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot)); in shpchp_disable_slot()
643 rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); in shpchp_disable_slot()
645 ctrl_info(ctrl, "Latch open on slot(%s)\n", slot_name(p_slot)); in shpchp_disable_slot()
648 rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); in shpchp_disable_slot()
651 slot_name(p_slot)); in shpchp_disable_slot()
655 retval = remove_board(p_slot); in shpchp_disable_slot()
656 update_slot_info(p_slot); in shpchp_disable_slot()
658 mutex_unlock(&p_slot->ctrl->crit_sect); in shpchp_disable_slot()
662 int shpchp_sysfs_enable_slot(struct slot *p_slot) in shpchp_sysfs_enable_slot() argument
665 struct controller *ctrl = p_slot->ctrl; in shpchp_sysfs_enable_slot()
667 mutex_lock(&p_slot->lock); in shpchp_sysfs_enable_slot()
668 switch (p_slot->state) { in shpchp_sysfs_enable_slot()
670 cancel_delayed_work(&p_slot->work); in shpchp_sysfs_enable_slot()
672 p_slot->state = POWERON_STATE; in shpchp_sysfs_enable_slot()
673 mutex_unlock(&p_slot->lock); in shpchp_sysfs_enable_slot()
674 retval = shpchp_enable_slot(p_slot); in shpchp_sysfs_enable_slot()
675 mutex_lock(&p_slot->lock); in shpchp_sysfs_enable_slot()
676 p_slot->state = STATIC_STATE; in shpchp_sysfs_enable_slot()
680 slot_name(p_slot)); in shpchp_sysfs_enable_slot()
685 slot_name(p_slot)); in shpchp_sysfs_enable_slot()
689 slot_name(p_slot)); in shpchp_sysfs_enable_slot()
692 mutex_unlock(&p_slot->lock); in shpchp_sysfs_enable_slot()
697 int shpchp_sysfs_disable_slot(struct slot *p_slot) in shpchp_sysfs_disable_slot() argument
700 struct controller *ctrl = p_slot->ctrl; in shpchp_sysfs_disable_slot()
702 mutex_lock(&p_slot->lock); in shpchp_sysfs_disable_slot()
703 switch (p_slot->state) { in shpchp_sysfs_disable_slot()
705 cancel_delayed_work(&p_slot->work); in shpchp_sysfs_disable_slot()
707 p_slot->state = POWEROFF_STATE; in shpchp_sysfs_disable_slot()
708 mutex_unlock(&p_slot->lock); in shpchp_sysfs_disable_slot()
709 retval = shpchp_disable_slot(p_slot); in shpchp_sysfs_disable_slot()
710 mutex_lock(&p_slot->lock); in shpchp_sysfs_disable_slot()
711 p_slot->state = STATIC_STATE; in shpchp_sysfs_disable_slot()
715 slot_name(p_slot)); in shpchp_sysfs_disable_slot()
720 slot_name(p_slot)); in shpchp_sysfs_disable_slot()
724 slot_name(p_slot)); in shpchp_sysfs_disable_slot()
727 mutex_unlock(&p_slot->lock); in shpchp_sysfs_disable_slot()