Lines Matching refs:p_slot
40 void pciehp_queue_interrupt_event(struct slot *p_slot, u32 event_type) in pciehp_queue_interrupt_event() argument
46 ctrl_err(p_slot->ctrl, "dropped event %d (ENOMEM)\n", event_type); in pciehp_queue_interrupt_event()
52 info->p_slot = p_slot; in pciehp_queue_interrupt_event()
53 queue_work(p_slot->wq, &info->work); in pciehp_queue_interrupt_event()
85 static int board_added(struct slot *p_slot) in board_added() argument
88 struct controller *ctrl = p_slot->ctrl; in board_added()
93 retval = pciehp_power_on_slot(p_slot); in board_added()
98 pciehp_green_led_blink(p_slot); in board_added()
108 if (ctrl->power_fault_detected || pciehp_query_power_fault(p_slot)) { in board_added()
109 ctrl_err(ctrl, "Power fault on slot %s\n", slot_name(p_slot)); in board_added()
114 retval = pciehp_configure_device(p_slot); in board_added()
122 pciehp_green_led_on(p_slot); in board_added()
126 set_slot_off(ctrl, p_slot); in board_added()
134 static int remove_board(struct slot *p_slot) in remove_board() argument
137 struct controller *ctrl = p_slot->ctrl; in remove_board()
139 retval = pciehp_unconfigure_device(p_slot); in remove_board()
144 pciehp_power_off_slot(p_slot); in remove_board()
155 pciehp_green_led_off(p_slot); in remove_board()
160 struct slot *p_slot; member
178 struct slot *p_slot = info->p_slot; in pciehp_power_thread() local
183 mutex_lock(&p_slot->hotplug_lock); in pciehp_power_thread()
184 pciehp_disable_slot(p_slot); in pciehp_power_thread()
185 mutex_unlock(&p_slot->hotplug_lock); in pciehp_power_thread()
186 mutex_lock(&p_slot->lock); in pciehp_power_thread()
187 p_slot->state = STATIC_STATE; in pciehp_power_thread()
188 mutex_unlock(&p_slot->lock); in pciehp_power_thread()
191 mutex_lock(&p_slot->hotplug_lock); in pciehp_power_thread()
192 ret = pciehp_enable_slot(p_slot); in pciehp_power_thread()
193 mutex_unlock(&p_slot->hotplug_lock); in pciehp_power_thread()
195 pciehp_green_led_off(p_slot); in pciehp_power_thread()
196 mutex_lock(&p_slot->lock); in pciehp_power_thread()
197 p_slot->state = STATIC_STATE; in pciehp_power_thread()
198 mutex_unlock(&p_slot->lock); in pciehp_power_thread()
207 static void pciehp_queue_power_work(struct slot *p_slot, int req) in pciehp_queue_power_work() argument
211 p_slot->state = (req == ENABLE_REQ) ? POWERON_STATE : POWEROFF_STATE; in pciehp_queue_power_work()
215 ctrl_err(p_slot->ctrl, "no memory to queue %s request\n", in pciehp_queue_power_work()
219 info->p_slot = p_slot; in pciehp_queue_power_work()
222 queue_work(p_slot->wq, &info->work); in pciehp_queue_power_work()
227 struct slot *p_slot = container_of(work, struct slot, work.work); in pciehp_queue_pushbutton_work() local
229 mutex_lock(&p_slot->lock); in pciehp_queue_pushbutton_work()
230 switch (p_slot->state) { in pciehp_queue_pushbutton_work()
232 pciehp_queue_power_work(p_slot, DISABLE_REQ); in pciehp_queue_pushbutton_work()
235 pciehp_queue_power_work(p_slot, ENABLE_REQ); in pciehp_queue_pushbutton_work()
240 mutex_unlock(&p_slot->lock); in pciehp_queue_pushbutton_work()
246 static void handle_button_press_event(struct slot *p_slot) in handle_button_press_event() argument
248 struct controller *ctrl = p_slot->ctrl; in handle_button_press_event()
251 switch (p_slot->state) { in handle_button_press_event()
253 pciehp_get_power_status(p_slot, &getstatus); in handle_button_press_event()
255 p_slot->state = BLINKINGOFF_STATE; in handle_button_press_event()
257 slot_name(p_slot)); in handle_button_press_event()
259 p_slot->state = BLINKINGON_STATE; in handle_button_press_event()
261 slot_name(p_slot)); in handle_button_press_event()
264 pciehp_green_led_blink(p_slot); in handle_button_press_event()
265 pciehp_set_attention_status(p_slot, 0); in handle_button_press_event()
266 queue_delayed_work(p_slot->wq, &p_slot->work, 5*HZ); in handle_button_press_event()
275 ctrl_info(ctrl, "Button cancel on Slot(%s)\n", slot_name(p_slot)); in handle_button_press_event()
276 cancel_delayed_work(&p_slot->work); in handle_button_press_event()
277 if (p_slot->state == BLINKINGOFF_STATE) in handle_button_press_event()
278 pciehp_green_led_on(p_slot); in handle_button_press_event()
280 pciehp_green_led_off(p_slot); in handle_button_press_event()
281 pciehp_set_attention_status(p_slot, 0); in handle_button_press_event()
283 slot_name(p_slot)); in handle_button_press_event()
284 p_slot->state = STATIC_STATE; in handle_button_press_event()
293 ctrl_info(ctrl, "Button ignore on Slot(%s)\n", slot_name(p_slot)); in handle_button_press_event()
296 ctrl_warn(ctrl, "ignoring invalid state %#x\n", p_slot->state); in handle_button_press_event()
304 static void handle_surprise_event(struct slot *p_slot) in handle_surprise_event() argument
308 pciehp_get_adapter_status(p_slot, &getstatus); in handle_surprise_event()
310 pciehp_queue_power_work(p_slot, DISABLE_REQ); in handle_surprise_event()
312 pciehp_queue_power_work(p_slot, ENABLE_REQ); in handle_surprise_event()
318 static void handle_link_event(struct slot *p_slot, u32 event) in handle_link_event() argument
320 struct controller *ctrl = p_slot->ctrl; in handle_link_event()
322 switch (p_slot->state) { in handle_link_event()
325 cancel_delayed_work(&p_slot->work); in handle_link_event()
328 pciehp_queue_power_work(p_slot, event == INT_LINK_UP ? in handle_link_event()
335 slot_name(p_slot)); in handle_link_event()
339 slot_name(p_slot)); in handle_link_event()
340 pciehp_queue_power_work(p_slot, DISABLE_REQ); in handle_link_event()
347 slot_name(p_slot)); in handle_link_event()
348 pciehp_queue_power_work(p_slot, ENABLE_REQ); in handle_link_event()
352 slot_name(p_slot)); in handle_link_event()
357 p_slot->state, slot_name(p_slot)); in handle_link_event()
365 struct slot *p_slot = info->p_slot; in interrupt_event_handler() local
366 struct controller *ctrl = p_slot->ctrl; in interrupt_event_handler()
368 mutex_lock(&p_slot->lock); in interrupt_event_handler()
371 handle_button_press_event(p_slot); in interrupt_event_handler()
376 pciehp_set_attention_status(p_slot, 1); in interrupt_event_handler()
377 pciehp_green_led_off(p_slot); in interrupt_event_handler()
380 handle_surprise_event(p_slot); in interrupt_event_handler()
387 handle_surprise_event(p_slot); in interrupt_event_handler()
391 handle_link_event(p_slot, info->event_type); in interrupt_event_handler()
396 mutex_unlock(&p_slot->lock); in interrupt_event_handler()
404 int pciehp_enable_slot(struct slot *p_slot) in pciehp_enable_slot() argument
408 struct controller *ctrl = p_slot->ctrl; in pciehp_enable_slot()
410 pciehp_get_adapter_status(p_slot, &getstatus); in pciehp_enable_slot()
412 ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot)); in pciehp_enable_slot()
415 if (MRL_SENS(p_slot->ctrl)) { in pciehp_enable_slot()
416 pciehp_get_latch_status(p_slot, &getstatus); in pciehp_enable_slot()
419 slot_name(p_slot)); in pciehp_enable_slot()
424 if (POWER_CTRL(p_slot->ctrl)) { in pciehp_enable_slot()
425 pciehp_get_power_status(p_slot, &getstatus); in pciehp_enable_slot()
428 slot_name(p_slot)); in pciehp_enable_slot()
433 pciehp_get_latch_status(p_slot, &getstatus); in pciehp_enable_slot()
435 rc = board_added(p_slot); in pciehp_enable_slot()
437 pciehp_get_latch_status(p_slot, &getstatus); in pciehp_enable_slot()
445 int pciehp_disable_slot(struct slot *p_slot) in pciehp_disable_slot() argument
448 struct controller *ctrl = p_slot->ctrl; in pciehp_disable_slot()
450 if (!p_slot->ctrl) in pciehp_disable_slot()
453 if (POWER_CTRL(p_slot->ctrl)) { in pciehp_disable_slot()
454 pciehp_get_power_status(p_slot, &getstatus); in pciehp_disable_slot()
457 slot_name(p_slot)); in pciehp_disable_slot()
462 return remove_board(p_slot); in pciehp_disable_slot()
465 int pciehp_sysfs_enable_slot(struct slot *p_slot) in pciehp_sysfs_enable_slot() argument
468 struct controller *ctrl = p_slot->ctrl; in pciehp_sysfs_enable_slot()
470 mutex_lock(&p_slot->lock); in pciehp_sysfs_enable_slot()
471 switch (p_slot->state) { in pciehp_sysfs_enable_slot()
473 cancel_delayed_work(&p_slot->work); in pciehp_sysfs_enable_slot()
475 p_slot->state = POWERON_STATE; in pciehp_sysfs_enable_slot()
476 mutex_unlock(&p_slot->lock); in pciehp_sysfs_enable_slot()
477 mutex_lock(&p_slot->hotplug_lock); in pciehp_sysfs_enable_slot()
478 retval = pciehp_enable_slot(p_slot); in pciehp_sysfs_enable_slot()
479 mutex_unlock(&p_slot->hotplug_lock); in pciehp_sysfs_enable_slot()
480 mutex_lock(&p_slot->lock); in pciehp_sysfs_enable_slot()
481 p_slot->state = STATIC_STATE; in pciehp_sysfs_enable_slot()
485 slot_name(p_slot)); in pciehp_sysfs_enable_slot()
490 slot_name(p_slot)); in pciehp_sysfs_enable_slot()
494 p_slot->state, slot_name(p_slot)); in pciehp_sysfs_enable_slot()
497 mutex_unlock(&p_slot->lock); in pciehp_sysfs_enable_slot()
502 int pciehp_sysfs_disable_slot(struct slot *p_slot) in pciehp_sysfs_disable_slot() argument
505 struct controller *ctrl = p_slot->ctrl; in pciehp_sysfs_disable_slot()
507 mutex_lock(&p_slot->lock); in pciehp_sysfs_disable_slot()
508 switch (p_slot->state) { in pciehp_sysfs_disable_slot()
510 cancel_delayed_work(&p_slot->work); in pciehp_sysfs_disable_slot()
512 p_slot->state = POWEROFF_STATE; in pciehp_sysfs_disable_slot()
513 mutex_unlock(&p_slot->lock); in pciehp_sysfs_disable_slot()
514 retval = pciehp_disable_slot(p_slot); in pciehp_sysfs_disable_slot()
515 mutex_lock(&p_slot->lock); in pciehp_sysfs_disable_slot()
516 p_slot->state = STATIC_STATE; in pciehp_sysfs_disable_slot()
520 slot_name(p_slot)); in pciehp_sysfs_disable_slot()
525 slot_name(p_slot)); in pciehp_sysfs_disable_slot()
529 p_slot->state, slot_name(p_slot)); in pciehp_sysfs_disable_slot()
532 mutex_unlock(&p_slot->lock); in pciehp_sysfs_disable_slot()