Lines Matching defs:p_slot

40 static int queue_interrupt_event(struct slot *p_slot, u32 event_type)
49 info->p_slot = p_slot;
57 u8 pciehp_handle_attention_button(struct slot *p_slot)
60 struct controller *ctrl = p_slot->ctrl;
68 ctrl_info(ctrl, "Button pressed on Slot(%s)\n", slot_name(p_slot));
71 queue_interrupt_event(p_slot, event_type);
76 u8 pciehp_handle_switch_change(struct slot *p_slot)
80 struct controller *ctrl = p_slot->ctrl;
85 pciehp_get_latch_status(p_slot, &getstatus);
90 ctrl_info(ctrl, "Latch open on Slot(%s)\n", slot_name(p_slot));
96 ctrl_info(ctrl, "Latch close on Slot(%s)\n", slot_name(p_slot));
100 queue_interrupt_event(p_slot, event_type);
105 u8 pciehp_handle_presence_change(struct slot *p_slot)
109 struct controller *ctrl = p_slot->ctrl;
117 pciehp_get_adapter_status(p_slot, &presence_save);
122 ctrl_info(ctrl, "Card present on Slot(%s)\n", slot_name(p_slot));
129 slot_name(p_slot));
133 queue_interrupt_event(p_slot, event_type);
138 u8 pciehp_handle_power_fault(struct slot *p_slot)
141 struct controller *ctrl = p_slot->ctrl;
145 ctrl_err(ctrl, "Power fault on slot %s\n", slot_name(p_slot));
148 queue_interrupt_event(p_slot, event_type);
188 * @p_slot: &slot where board is added
193 static int board_added(struct slot *p_slot)
196 struct controller *ctrl = p_slot->ctrl;
201 retval = pciehp_power_on_slot(p_slot);
207 pciehp_green_led_blink(p_slot);
217 if (ctrl->power_fault_detected || pciehp_query_power_fault(p_slot)) {
218 ctrl_err(ctrl, "Power fault on slot %s\n", slot_name(p_slot));
223 retval = pciehp_configure_device(p_slot);
231 pciehp_green_led_on(p_slot);
236 set_slot_off(ctrl, p_slot);
242 * @p_slot: slot where board is being removed
244 static int remove_board(struct slot *p_slot)
247 struct controller *ctrl = p_slot->ctrl;
249 retval = pciehp_unconfigure_device(p_slot);
255 retval = pciehp_power_off_slot(p_slot);
271 pciehp_green_led_off(p_slot);
277 struct slot *p_slot;
292 struct slot *p_slot = info->p_slot;
294 mutex_lock(&p_slot->lock);
295 switch (p_slot->state) {
297 mutex_unlock(&p_slot->lock);
298 ctrl_dbg(p_slot->ctrl,
300 pci_domain_nr(p_slot->ctrl->pcie->port->subordinate),
301 p_slot->ctrl->pcie->port->subordinate->number);
302 pciehp_disable_slot(p_slot);
303 mutex_lock(&p_slot->lock);
304 p_slot->state = STATIC_STATE;
307 mutex_unlock(&p_slot->lock);
308 if (pciehp_enable_slot(p_slot) && PWR_LED(p_slot->ctrl))
309 pciehp_green_led_off(p_slot);
310 mutex_lock(&p_slot->lock);
311 p_slot->state = STATIC_STATE;
316 mutex_unlock(&p_slot->lock);
323 struct slot *p_slot = container_of(work, struct slot, work.work);
328 ctrl_err(p_slot->ctrl, "%s: Cannot allocate memory\n",
332 info->p_slot = p_slot;
335 mutex_lock(&p_slot->lock);
336 switch (p_slot->state) {
338 p_slot->state = POWEROFF_STATE;
341 p_slot->state = POWERON_STATE;
349 mutex_unlock(&p_slot->lock);
355 static void handle_button_press_event(struct slot *p_slot)
357 struct controller *ctrl = p_slot->ctrl;
360 switch (p_slot->state) {
362 pciehp_get_power_status(p_slot, &getstatus);
364 p_slot->state = BLINKINGOFF_STATE;
367 "press.\n", slot_name(p_slot));
369 p_slot->state = BLINKINGON_STATE;
372 "press.\n", slot_name(p_slot));
376 pciehp_green_led_blink(p_slot);
378 pciehp_set_attention_status(p_slot, 0);
380 queue_delayed_work(pciehp_wq, &p_slot->work, 5*HZ);
389 ctrl_info(ctrl, "Button cancel on Slot(%s)\n", slot_name(p_slot));
390 cancel_delayed_work(&p_slot->work);
391 if (p_slot->state == BLINKINGOFF_STATE) {
393 pciehp_green_led_on(p_slot);
396 pciehp_green_led_off(p_slot);
399 pciehp_set_attention_status(p_slot, 0);
401 "due to button press\n", slot_name(p_slot));
402 p_slot->state = STATIC_STATE;
411 ctrl_info(ctrl, "Button ignore on Slot(%s)\n", slot_name(p_slot));
422 static void handle_surprise_event(struct slot *p_slot)
429 ctrl_err(p_slot->ctrl, "%s: Cannot allocate memory\n",
433 info->p_slot = p_slot;
436 pciehp_get_adapter_status(p_slot, &getstatus);
438 p_slot->state = POWEROFF_STATE;
440 p_slot->state = POWERON_STATE;
448 struct slot *p_slot = info->p_slot;
449 struct controller *ctrl = p_slot->ctrl;
451 mutex_lock(&p_slot->lock);
454 handle_button_press_event(p_slot);
460 pciehp_set_attention_status(p_slot, 1);
462 pciehp_green_led_off(p_slot);
469 handle_surprise_event(p_slot);
474 mutex_unlock(&p_slot->lock);
479 int pciehp_enable_slot(struct slot *p_slot)
483 struct controller *ctrl = p_slot->ctrl;
485 rc = pciehp_get_adapter_status(p_slot, &getstatus);
487 ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot));
490 if (MRL_SENS(p_slot->ctrl)) {
491 rc = pciehp_get_latch_status(p_slot, &getstatus);
494 slot_name(p_slot));
499 if (POWER_CTRL(p_slot->ctrl)) {
500 rc = pciehp_get_power_status(p_slot, &getstatus);
503 slot_name(p_slot));
508 pciehp_get_latch_status(p_slot, &getstatus);
510 rc = board_added(p_slot);
512 pciehp_get_latch_status(p_slot, &getstatus);
518 int pciehp_disable_slot(struct slot *p_slot)
522 struct controller *ctrl = p_slot->ctrl;
524 if (!p_slot->ctrl)
527 if (!HP_SUPR_RM(p_slot->ctrl)) {
528 ret = pciehp_get_adapter_status(p_slot, &getstatus);
531 slot_name(p_slot));
536 if (MRL_SENS(p_slot->ctrl)) {
537 ret = pciehp_get_latch_status(p_slot, &getstatus);
540 slot_name(p_slot));
545 if (POWER_CTRL(p_slot->ctrl)) {
546 ret = pciehp_get_power_status(p_slot, &getstatus);
549 slot_name(p_slot));
554 return remove_board(p_slot);
557 int pciehp_sysfs_enable_slot(struct slot *p_slot)
560 struct controller *ctrl = p_slot->ctrl;
562 mutex_lock(&p_slot->lock);
563 switch (p_slot->state) {
565 cancel_delayed_work(&p_slot->work);
567 p_slot->state = POWERON_STATE;
568 mutex_unlock(&p_slot->lock);
569 retval = pciehp_enable_slot(p_slot);
570 mutex_lock(&p_slot->lock);
571 p_slot->state = STATIC_STATE;
575 slot_name(p_slot));
580 slot_name(p_slot));
584 slot_name(p_slot));
587 mutex_unlock(&p_slot->lock);
592 int pciehp_sysfs_disable_slot(struct slot *p_slot)
595 struct controller *ctrl = p_slot->ctrl;
597 mutex_lock(&p_slot->lock);
598 switch (p_slot->state) {
600 cancel_delayed_work(&p_slot->work);
602 p_slot->state = POWEROFF_STATE;
603 mutex_unlock(&p_slot->lock);
604 retval = pciehp_disable_slot(p_slot);
605 mutex_lock(&p_slot->lock);
606 p_slot->state = STATIC_STATE;
610 slot_name(p_slot));
615 slot_name(p_slot));
619 slot_name(p_slot));
622 mutex_unlock(&p_slot->lock);