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)
37 info->p_slot = p_slot;
40 queue_work(p_slot->wq, &info->work);
47 struct slot *p_slot;
53 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
54 p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save));
59 ctrl_info(ctrl, "Button pressed on Slot(%s)\n", slot_name(p_slot));
62 queue_interrupt_event(p_slot, event_type);
70 struct slot *p_slot;
77 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
78 p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save));
79 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
81 p_slot->presence_save, p_slot->pwr_save);
87 ctrl_info(ctrl, "Latch open on Slot(%s)\n", slot_name(p_slot));
89 if (p_slot->pwr_save && p_slot->presence_save) {
97 ctrl_info(ctrl, "Latch close on Slot(%s)\n", slot_name(p_slot));
101 queue_interrupt_event(p_slot, event_type);
108 struct slot *p_slot;
114 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
119 p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save));
120 if (p_slot->presence_save) {
125 slot_name(p_slot));
132 slot_name(p_slot));
136 queue_interrupt_event(p_slot, event_type);
143 struct slot *p_slot;
149 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
151 if (!(p_slot->hpc_ops->query_power_fault(p_slot))) {
156 slot_name(p_slot));
157 p_slot->status = 0x00;
163 ctrl_info(ctrl, "Power fault on Slot(%s)\n", slot_name(p_slot));
166 p_slot->status = 0xFF;
170 queue_interrupt_event(p_slot, event_type);
178 static int change_bus_speed(struct controller *ctrl, struct slot *p_slot,
184 rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, speed);
224 * @p_slot: target &slot
229 static int board_added(struct slot *p_slot)
235 struct controller *ctrl = p_slot->ctrl;
238 hp_slot = p_slot->device - ctrl->slot_device_offset;
240 ctrl_dbg(ctrl, "%s: p_slot->device, slot_offset, hp_slot = %d, %d ,%d\n",
241 __func__, p_slot->device, ctrl->slot_device_offset, hp_slot);
244 rc = p_slot->hpc_ops->power_on_slot(p_slot);
251 rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, PCI_SPEED_33MHz);
259 rc = p_slot->hpc_ops->slot_enable(p_slot);
266 rc = p_slot->hpc_ops->get_adapter_speed(p_slot, &asp);
283 rc = fix_bus_speed(ctrl, p_slot, slots_not_empty, asp, bsp, msp);
288 rc = p_slot->hpc_ops->slot_enable(p_slot);
297 ctrl_dbg(ctrl, "%s: slot status = %x\n", __func__, p_slot->status);
299 if (p_slot->status == 0xFF) {
302 p_slot->status = 0;
306 if (shpchp_configure_device(p_slot)) {
308 pci_domain_nr(parent), p_slot->bus, p_slot->device);
312 p_slot->status = 0;
313 p_slot->is_a_board = 0x01;
314 p_slot->pwr_save = 1;
316 p_slot->hpc_ops->green_led_on(p_slot);
322 rc = p_slot->hpc_ops->slot_disable(p_slot);
335 * @p_slot: target &slot
337 static int remove_board(struct slot *p_slot)
339 struct controller *ctrl = p_slot->ctrl;
343 shpchp_unconfigure_device(p_slot);
345 hp_slot = p_slot->device - ctrl->slot_device_offset;
346 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
351 if (p_slot->is_a_board)
352 p_slot->status = 0x01;
355 rc = p_slot->hpc_ops->slot_disable(p_slot);
362 rc = p_slot->hpc_ops->set_attention_status(p_slot, 0);
368 p_slot->pwr_save = 0;
369 p_slot->is_a_board = 0;
376 struct slot *p_slot;
391 struct slot *p_slot = info->p_slot;
393 mutex_lock(&p_slot->lock);
394 switch (p_slot->state) {
396 mutex_unlock(&p_slot->lock);
397 shpchp_disable_slot(p_slot);
398 mutex_lock(&p_slot->lock);
399 p_slot->state = STATIC_STATE;
402 mutex_unlock(&p_slot->lock);
403 if (shpchp_enable_slot(p_slot))
404 p_slot->hpc_ops->green_led_off(p_slot);
405 mutex_lock(&p_slot->lock);
406 p_slot->state = STATIC_STATE;
411 mutex_unlock(&p_slot->lock);
418 struct slot *p_slot = container_of(work, struct slot, work.work);
423 ctrl_err(p_slot->ctrl, "%s: Cannot allocate memory\n",
427 info->p_slot = p_slot;
430 mutex_lock(&p_slot->lock);
431 switch (p_slot->state) {
433 p_slot->state = POWEROFF_STATE;
436 p_slot->state = POWERON_STATE;
442 queue_work(p_slot->wq, &info->work);
444 mutex_unlock(&p_slot->lock);
458 static void handle_button_press_event(struct slot *p_slot)
461 struct controller *ctrl = p_slot->ctrl;
463 switch (p_slot->state) {
465 p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
467 p_slot->state = BLINKINGOFF_STATE;
469 slot_name(p_slot));
471 p_slot->state = BLINKINGON_STATE;
473 slot_name(p_slot));
476 p_slot->hpc_ops->green_led_blink(p_slot);
477 p_slot->hpc_ops->set_attention_status(p_slot, 0);
479 queue_delayed_work(p_slot->wq, &p_slot->work, 5*HZ);
489 slot_name(p_slot));
490 cancel_delayed_work(&p_slot->work);
491 if (p_slot->state == BLINKINGOFF_STATE)
492 p_slot->hpc_ops->green_led_on(p_slot);
494 p_slot->hpc_ops->green_led_off(p_slot);
495 p_slot->hpc_ops->set_attention_status(p_slot, 0);
497 slot_name(p_slot));
498 p_slot->state = STATIC_STATE;
508 slot_name(p_slot));
509 update_slot_info(p_slot);
520 struct slot *p_slot = info->p_slot;
522 mutex_lock(&p_slot->lock);
525 handle_button_press_event(p_slot);
528 ctrl_dbg(p_slot->ctrl, "%s: Power fault\n", __func__);
529 p_slot->hpc_ops->set_attention_status(p_slot, 1);
530 p_slot->hpc_ops->green_led_off(p_slot);
533 update_slot_info(p_slot);
536 mutex_unlock(&p_slot->lock);
542 static int shpchp_enable_slot (struct slot *p_slot)
546 struct controller *ctrl = p_slot->ctrl;
549 mutex_lock(&p_slot->ctrl->crit_sect);
550 rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
552 ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot));
555 rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
557 ctrl_info(ctrl, "Latch open on slot(%s)\n", slot_name(p_slot));
560 rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
563 slot_name(p_slot));
567 p_slot->is_a_board = 1;
570 p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save));
571 p_slot->hpc_ops->get_power_status(p_slot, &(p_slot->pwr_save));
572 ctrl_dbg(ctrl, "%s: p_slot->pwr_save %x\n", __func__, p_slot->pwr_save);
573 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
575 if ((p_slot->ctrl->pci_dev->vendor == PCI_VENDOR_ID_AMD &&
576 p_slot->ctrl->pci_dev->device == PCI_DEVICE_ID_AMD_POGO_7458)
577 && p_slot->ctrl->num_slots == 1) {
579 amd_pogo_errata_save_misc_reg(p_slot);
580 retval = board_added(p_slot);
582 amd_pogo_errata_restore_misc_reg(p_slot);
584 retval = board_added(p_slot);
587 p_slot->hpc_ops->get_adapter_status(p_slot,
588 &(p_slot->presence_save));
589 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
592 update_slot_info(p_slot);
594 mutex_unlock(&p_slot->ctrl->crit_sect);
599 static int shpchp_disable_slot (struct slot *p_slot)
603 struct controller *ctrl = p_slot->ctrl;
605 if (!p_slot->ctrl)
609 mutex_lock(&p_slot->ctrl->crit_sect);
611 rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
613 ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot));
616 rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
618 ctrl_info(ctrl, "Latch open on slot(%s)\n", slot_name(p_slot));
621 rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
624 slot_name(p_slot));
628 retval = remove_board(p_slot);
629 update_slot_info(p_slot);
631 mutex_unlock(&p_slot->ctrl->crit_sect);
635 int shpchp_sysfs_enable_slot(struct slot *p_slot)
638 struct controller *ctrl = p_slot->ctrl;
640 mutex_lock(&p_slot->lock);
641 switch (p_slot->state) {
643 cancel_delayed_work(&p_slot->work);
646 p_slot->state = POWERON_STATE;
647 mutex_unlock(&p_slot->lock);
648 retval = shpchp_enable_slot(p_slot);
649 mutex_lock(&p_slot->lock);
650 p_slot->state = STATIC_STATE;
654 slot_name(p_slot));
659 slot_name(p_slot));
663 slot_name(p_slot));
666 mutex_unlock(&p_slot->lock);
671 int shpchp_sysfs_disable_slot(struct slot *p_slot)
674 struct controller *ctrl = p_slot->ctrl;
676 mutex_lock(&p_slot->lock);
677 switch (p_slot->state) {
679 cancel_delayed_work(&p_slot->work);
682 p_slot->state = POWEROFF_STATE;
683 mutex_unlock(&p_slot->lock);
684 retval = shpchp_disable_slot(p_slot);
685 mutex_lock(&p_slot->lock);
686 p_slot->state = STATIC_STATE;
690 slot_name(p_slot));
695 slot_name(p_slot));
699 slot_name(p_slot));
702 mutex_unlock(&p_slot->lock);