Lines Matching refs:smi_info

125 struct smi_info {  struct
146 int (*oem_data_avail_handler)(struct smi_info *smi_info); argument
261 static int try_smi_init(struct smi_info *smi); argument
262 static void cleanup_one_si(struct smi_info *smi_info);
283 static void deliver_recv_msg(struct smi_info *smi_info, in deliver_recv_msg() argument
287 ipmi_smi_msg_received(smi_info->intf, msg); in deliver_recv_msg()
290 static void return_hosed_msg(struct smi_info *smi_info, int cCode) in return_hosed_msg() argument
292 struct ipmi_smi_msg *msg = smi_info->curr_msg; in return_hosed_msg()
304 smi_info->curr_msg = NULL; in return_hosed_msg()
305 deliver_recv_msg(smi_info, msg); in return_hosed_msg()
308 static enum si_sm_result start_next_msg(struct smi_info *smi_info) in start_next_msg() argument
312 if (!smi_info->waiting_msg) { in start_next_msg()
313 smi_info->curr_msg = NULL; in start_next_msg()
318 smi_info->curr_msg = smi_info->waiting_msg; in start_next_msg()
319 smi_info->waiting_msg = NULL; in start_next_msg()
322 0, smi_info); in start_next_msg()
327 err = smi_info->handlers->start_transaction( in start_next_msg()
328 smi_info->si_sm, in start_next_msg()
329 smi_info->curr_msg->data, in start_next_msg()
330 smi_info->curr_msg->data_size); in start_next_msg()
332 return_hosed_msg(smi_info, err); in start_next_msg()
340 static void smi_mod_timer(struct smi_info *smi_info, unsigned long new_val) in smi_mod_timer() argument
342 if (!smi_info->timer_can_start) in smi_mod_timer()
344 smi_info->last_timeout_jiffies = jiffies; in smi_mod_timer()
345 mod_timer(&smi_info->si_timer, new_val); in smi_mod_timer()
346 smi_info->timer_running = true; in smi_mod_timer()
352 static void start_new_msg(struct smi_info *smi_info, unsigned char *msg, in start_new_msg() argument
355 smi_mod_timer(smi_info, jiffies + SI_TIMEOUT_JIFFIES); in start_new_msg()
357 if (smi_info->thread) in start_new_msg()
358 wake_up_process(smi_info->thread); in start_new_msg()
360 smi_info->handlers->start_transaction(smi_info->si_sm, msg, size); in start_new_msg()
363 static void start_check_enables(struct smi_info *smi_info) in start_check_enables() argument
370 start_new_msg(smi_info, msg, 2); in start_check_enables()
371 smi_info->si_state = SI_CHECKING_ENABLES; in start_check_enables()
374 static void start_clear_flags(struct smi_info *smi_info) in start_clear_flags() argument
383 start_new_msg(smi_info, msg, 3); in start_clear_flags()
384 smi_info->si_state = SI_CLEARING_FLAGS; in start_clear_flags()
387 static void start_getting_msg_queue(struct smi_info *smi_info) in start_getting_msg_queue() argument
389 smi_info->curr_msg->data[0] = (IPMI_NETFN_APP_REQUEST << 2); in start_getting_msg_queue()
390 smi_info->curr_msg->data[1] = IPMI_GET_MSG_CMD; in start_getting_msg_queue()
391 smi_info->curr_msg->data_size = 2; in start_getting_msg_queue()
393 start_new_msg(smi_info, smi_info->curr_msg->data, in start_getting_msg_queue()
394 smi_info->curr_msg->data_size); in start_getting_msg_queue()
395 smi_info->si_state = SI_GETTING_MESSAGES; in start_getting_msg_queue()
398 static void start_getting_events(struct smi_info *smi_info) in start_getting_events() argument
400 smi_info->curr_msg->data[0] = (IPMI_NETFN_APP_REQUEST << 2); in start_getting_events()
401 smi_info->curr_msg->data[1] = IPMI_READ_EVENT_MSG_BUFFER_CMD; in start_getting_events()
402 smi_info->curr_msg->data_size = 2; in start_getting_events()
404 start_new_msg(smi_info, smi_info->curr_msg->data, in start_getting_events()
405 smi_info->curr_msg->data_size); in start_getting_events()
406 smi_info->si_state = SI_GETTING_EVENTS; in start_getting_events()
418 static inline bool disable_si_irq(struct smi_info *smi_info) in disable_si_irq() argument
420 if ((smi_info->io.irq) && (!smi_info->interrupt_disabled)) { in disable_si_irq()
421 smi_info->interrupt_disabled = true; in disable_si_irq()
422 start_check_enables(smi_info); in disable_si_irq()
428 static inline bool enable_si_irq(struct smi_info *smi_info) in enable_si_irq() argument
430 if ((smi_info->io.irq) && (smi_info->interrupt_disabled)) { in enable_si_irq()
431 smi_info->interrupt_disabled = false; in enable_si_irq()
432 start_check_enables(smi_info); in enable_si_irq()
444 static struct ipmi_smi_msg *alloc_msg_handle_irq(struct smi_info *smi_info) in alloc_msg_handle_irq() argument
450 if (!disable_si_irq(smi_info)) in alloc_msg_handle_irq()
451 smi_info->si_state = SI_NORMAL; in alloc_msg_handle_irq()
452 } else if (enable_si_irq(smi_info)) { in alloc_msg_handle_irq()
459 static void handle_flags(struct smi_info *smi_info) in handle_flags() argument
462 if (smi_info->msg_flags & WDT_PRE_TIMEOUT_INT) { in handle_flags()
464 smi_inc_stat(smi_info, watchdog_pretimeouts); in handle_flags()
466 start_clear_flags(smi_info); in handle_flags()
467 smi_info->msg_flags &= ~WDT_PRE_TIMEOUT_INT; in handle_flags()
468 ipmi_smi_watchdog_pretimeout(smi_info->intf); in handle_flags()
469 } else if (smi_info->msg_flags & RECEIVE_MSG_AVAIL) { in handle_flags()
471 smi_info->curr_msg = alloc_msg_handle_irq(smi_info); in handle_flags()
472 if (!smi_info->curr_msg) in handle_flags()
475 start_getting_msg_queue(smi_info); in handle_flags()
476 } else if (smi_info->msg_flags & EVENT_MSG_BUFFER_FULL) { in handle_flags()
478 smi_info->curr_msg = alloc_msg_handle_irq(smi_info); in handle_flags()
479 if (!smi_info->curr_msg) in handle_flags()
482 start_getting_events(smi_info); in handle_flags()
483 } else if (smi_info->msg_flags & OEM_DATA_AVAIL && in handle_flags()
484 smi_info->oem_data_avail_handler) { in handle_flags()
485 if (smi_info->oem_data_avail_handler(smi_info)) in handle_flags()
488 smi_info->si_state = SI_NORMAL; in handle_flags()
497 static u8 current_global_enables(struct smi_info *smi_info, u8 base, in current_global_enables() argument
502 if (smi_info->supports_event_msg_buff) in current_global_enables()
505 if (((smi_info->io.irq && !smi_info->interrupt_disabled) || in current_global_enables()
506 smi_info->cannot_disable_irq) && in current_global_enables()
507 !smi_info->irq_enable_broken) in current_global_enables()
510 if (smi_info->supports_event_msg_buff && in current_global_enables()
511 smi_info->io.irq && !smi_info->interrupt_disabled && in current_global_enables()
512 !smi_info->irq_enable_broken) in current_global_enables()
520 static void check_bt_irq(struct smi_info *smi_info, bool irq_on) in check_bt_irq() argument
522 u8 irqstate = smi_info->io.inputb(&smi_info->io, IPMI_BT_INTMASK_REG); in check_bt_irq()
530 smi_info->io.outputb(&smi_info->io, IPMI_BT_INTMASK_REG, in check_bt_irq()
533 smi_info->io.outputb(&smi_info->io, IPMI_BT_INTMASK_REG, 0); in check_bt_irq()
536 static void handle_transaction_done(struct smi_info *smi_info) in handle_transaction_done() argument
541 switch (smi_info->si_state) { in handle_transaction_done()
543 if (!smi_info->curr_msg) in handle_transaction_done()
546 smi_info->curr_msg->rsp_size in handle_transaction_done()
547 = smi_info->handlers->get_result( in handle_transaction_done()
548 smi_info->si_sm, in handle_transaction_done()
549 smi_info->curr_msg->rsp, in handle_transaction_done()
557 msg = smi_info->curr_msg; in handle_transaction_done()
558 smi_info->curr_msg = NULL; in handle_transaction_done()
559 deliver_recv_msg(smi_info, msg); in handle_transaction_done()
568 len = smi_info->handlers->get_result(smi_info->si_sm, msg, 4); in handle_transaction_done()
571 smi_info->si_state = SI_NORMAL; in handle_transaction_done()
577 smi_info->si_state = SI_NORMAL; in handle_transaction_done()
579 smi_info->msg_flags = msg[3]; in handle_transaction_done()
580 handle_flags(smi_info); in handle_transaction_done()
590 smi_info->handlers->get_result(smi_info->si_sm, msg, 3); in handle_transaction_done()
593 dev_warn(smi_info->io.dev, in handle_transaction_done()
596 smi_info->si_state = SI_NORMAL; in handle_transaction_done()
602 smi_info->curr_msg->rsp_size in handle_transaction_done()
603 = smi_info->handlers->get_result( in handle_transaction_done()
604 smi_info->si_sm, in handle_transaction_done()
605 smi_info->curr_msg->rsp, in handle_transaction_done()
613 msg = smi_info->curr_msg; in handle_transaction_done()
614 smi_info->curr_msg = NULL; in handle_transaction_done()
620 smi_info->msg_flags &= ~EVENT_MSG_BUFFER_FULL; in handle_transaction_done()
621 handle_flags(smi_info); in handle_transaction_done()
623 smi_inc_stat(smi_info, events); in handle_transaction_done()
631 handle_flags(smi_info); in handle_transaction_done()
633 deliver_recv_msg(smi_info, msg); in handle_transaction_done()
640 smi_info->curr_msg->rsp_size in handle_transaction_done()
641 = smi_info->handlers->get_result( in handle_transaction_done()
642 smi_info->si_sm, in handle_transaction_done()
643 smi_info->curr_msg->rsp, in handle_transaction_done()
651 msg = smi_info->curr_msg; in handle_transaction_done()
652 smi_info->curr_msg = NULL; in handle_transaction_done()
658 smi_info->msg_flags &= ~RECEIVE_MSG_AVAIL; in handle_transaction_done()
659 handle_flags(smi_info); in handle_transaction_done()
661 smi_inc_stat(smi_info, incoming_messages); in handle_transaction_done()
669 handle_flags(smi_info); in handle_transaction_done()
671 deliver_recv_msg(smi_info, msg); in handle_transaction_done()
683 smi_info->handlers->get_result(smi_info->si_sm, msg, 4); in handle_transaction_done()
685 dev_warn(smi_info->io.dev, in handle_transaction_done()
687 dev_warn(smi_info->io.dev, in handle_transaction_done()
689 smi_info->si_state = SI_NORMAL; in handle_transaction_done()
692 enables = current_global_enables(smi_info, 0, &irq_on); in handle_transaction_done()
693 if (smi_info->io.si_type == SI_BT) in handle_transaction_done()
695 check_bt_irq(smi_info, irq_on); in handle_transaction_done()
701 smi_info->handlers->start_transaction( in handle_transaction_done()
702 smi_info->si_sm, msg, 3); in handle_transaction_done()
703 smi_info->si_state = SI_SETTING_ENABLES; in handle_transaction_done()
704 } else if (smi_info->supports_event_msg_buff) { in handle_transaction_done()
705 smi_info->curr_msg = ipmi_alloc_smi_msg(); in handle_transaction_done()
706 if (!smi_info->curr_msg) { in handle_transaction_done()
707 smi_info->si_state = SI_NORMAL; in handle_transaction_done()
710 start_getting_events(smi_info); in handle_transaction_done()
712 smi_info->si_state = SI_NORMAL; in handle_transaction_done()
721 smi_info->handlers->get_result(smi_info->si_sm, msg, 4); in handle_transaction_done()
723 dev_warn(smi_info->io.dev, in handle_transaction_done()
727 if (smi_info->supports_event_msg_buff) { in handle_transaction_done()
728 smi_info->curr_msg = ipmi_alloc_smi_msg(); in handle_transaction_done()
729 if (!smi_info->curr_msg) { in handle_transaction_done()
730 smi_info->si_state = SI_NORMAL; in handle_transaction_done()
733 start_getting_events(smi_info); in handle_transaction_done()
735 smi_info->si_state = SI_NORMAL; in handle_transaction_done()
747 static enum si_sm_result smi_event_handler(struct smi_info *smi_info, in smi_event_handler() argument
761 si_sm_result = smi_info->handlers->event(smi_info->si_sm, time); in smi_event_handler()
764 si_sm_result = smi_info->handlers->event(smi_info->si_sm, 0); in smi_event_handler()
767 smi_inc_stat(smi_info, complete_transactions); in smi_event_handler()
769 handle_transaction_done(smi_info); in smi_event_handler()
772 smi_inc_stat(smi_info, hosed_count); in smi_event_handler()
778 smi_info->si_state = SI_NORMAL; in smi_event_handler()
779 if (smi_info->curr_msg != NULL) { in smi_event_handler()
785 return_hosed_msg(smi_info, IPMI_ERR_UNSPECIFIED); in smi_event_handler()
794 if (si_sm_result == SI_SM_ATTN || smi_info->got_attn) { in smi_event_handler()
797 if (smi_info->si_state != SI_NORMAL) { in smi_event_handler()
802 smi_info->got_attn = true; in smi_event_handler()
804 smi_info->got_attn = false; in smi_event_handler()
805 smi_inc_stat(smi_info, attentions); in smi_event_handler()
817 start_new_msg(smi_info, msg, 2); in smi_event_handler()
818 smi_info->si_state = SI_GETTING_FLAGS; in smi_event_handler()
825 smi_inc_stat(smi_info, idles); in smi_event_handler()
827 si_sm_result = start_next_msg(smi_info); in smi_event_handler()
833 && (atomic_read(&smi_info->req_events))) { in smi_event_handler()
838 atomic_set(&smi_info->req_events, 0); in smi_event_handler()
846 if (smi_info->supports_event_msg_buff || smi_info->io.irq) { in smi_event_handler()
847 start_check_enables(smi_info); in smi_event_handler()
849 smi_info->curr_msg = alloc_msg_handle_irq(smi_info); in smi_event_handler()
850 if (!smi_info->curr_msg) in smi_event_handler()
853 start_getting_events(smi_info); in smi_event_handler()
858 if (si_sm_result == SI_SM_IDLE && smi_info->timer_running) { in smi_event_handler()
860 if (del_timer(&smi_info->si_timer)) in smi_event_handler()
861 smi_info->timer_running = false; in smi_event_handler()
868 static void check_start_timer_thread(struct smi_info *smi_info) in check_start_timer_thread() argument
870 if (smi_info->si_state == SI_NORMAL && smi_info->curr_msg == NULL) { in check_start_timer_thread()
871 smi_mod_timer(smi_info, jiffies + SI_TIMEOUT_JIFFIES); in check_start_timer_thread()
873 if (smi_info->thread) in check_start_timer_thread()
874 wake_up_process(smi_info->thread); in check_start_timer_thread()
876 start_next_msg(smi_info); in check_start_timer_thread()
877 smi_event_handler(smi_info, 0); in check_start_timer_thread()
883 struct smi_info *smi_info = send_info; in flush_messages() local
890 result = smi_event_handler(smi_info, 0); in flush_messages()
893 result = smi_event_handler(smi_info, SI_SHORT_TIMEOUT_USEC); in flush_messages()
900 struct smi_info *smi_info = send_info; in sender() local
905 if (smi_info->run_to_completion) { in sender()
910 smi_info->waiting_msg = msg; in sender()
914 spin_lock_irqsave(&smi_info->si_lock, flags); in sender()
922 BUG_ON(smi_info->waiting_msg); in sender()
923 smi_info->waiting_msg = msg; in sender()
924 check_start_timer_thread(smi_info); in sender()
925 spin_unlock_irqrestore(&smi_info->si_lock, flags); in sender()
930 struct smi_info *smi_info = send_info; in set_run_to_completion() local
932 smi_info->run_to_completion = i_run_to_completion; in set_run_to_completion()
934 flush_messages(smi_info); in set_run_to_completion()
943 const struct smi_info *smi_info, in ipmi_thread_busy_wait() argument
948 if (smi_info->si_num < num_max_busy_us) in ipmi_thread_busy_wait()
949 max_busy_us = kipmid_max_busy_us[smi_info->si_num]; in ipmi_thread_busy_wait()
975 struct smi_info *smi_info = data; in ipmi_thread() local
984 spin_lock_irqsave(&(smi_info->si_lock), flags); in ipmi_thread()
985 smi_result = smi_event_handler(smi_info, 0); in ipmi_thread()
994 if (smi_result != SI_SM_IDLE && !smi_info->timer_running) in ipmi_thread()
995 smi_mod_timer(smi_info, jiffies + SI_TIMEOUT_JIFFIES); in ipmi_thread()
997 spin_unlock_irqrestore(&(smi_info->si_lock), flags); in ipmi_thread()
998 busy_wait = ipmi_thread_busy_wait(smi_result, smi_info, in ipmi_thread()
1009 if (smi_info->in_maintenance_mode) in ipmi_thread()
1014 if (atomic_read(&smi_info->need_watch)) { in ipmi_thread()
1031 struct smi_info *smi_info = send_info; in poll() local
1033 bool run_to_completion = smi_info->run_to_completion; in poll()
1041 spin_lock_irqsave(&smi_info->si_lock, flags); in poll()
1042 smi_event_handler(smi_info, 10); in poll()
1044 spin_unlock_irqrestore(&smi_info->si_lock, flags); in poll()
1049 struct smi_info *smi_info = send_info; in request_events() local
1051 if (!smi_info->has_event_buffer) in request_events()
1054 atomic_set(&smi_info->req_events, 1); in request_events()
1059 struct smi_info *smi_info = send_info; in set_need_watch() local
1065 atomic_set(&smi_info->need_watch, enable); in set_need_watch()
1066 spin_lock_irqsave(&smi_info->si_lock, flags); in set_need_watch()
1067 check_start_timer_thread(smi_info); in set_need_watch()
1068 spin_unlock_irqrestore(&smi_info->si_lock, flags); in set_need_watch()
1073 struct smi_info *smi_info = from_timer(smi_info, t, si_timer); in smi_timeout() local
1080 spin_lock_irqsave(&(smi_info->si_lock), flags); in smi_timeout()
1084 time_diff = (((long)jiffies_now - (long)smi_info->last_timeout_jiffies) in smi_timeout()
1086 smi_result = smi_event_handler(smi_info, time_diff); in smi_timeout()
1088 if ((smi_info->io.irq) && (!smi_info->interrupt_disabled)) { in smi_timeout()
1091 smi_inc_stat(smi_info, long_timeouts); in smi_timeout()
1100 smi_inc_stat(smi_info, short_timeouts); in smi_timeout()
1103 smi_inc_stat(smi_info, long_timeouts); in smi_timeout()
1109 smi_mod_timer(smi_info, timeout); in smi_timeout()
1111 smi_info->timer_running = false; in smi_timeout()
1112 spin_unlock_irqrestore(&(smi_info->si_lock), flags); in smi_timeout()
1117 struct smi_info *smi_info = data; in ipmi_si_irq_handler() local
1120 if (smi_info->io.si_type == SI_BT) in ipmi_si_irq_handler()
1122 smi_info->io.outputb(&smi_info->io, IPMI_BT_INTMASK_REG, in ipmi_si_irq_handler()
1126 spin_lock_irqsave(&(smi_info->si_lock), flags); in ipmi_si_irq_handler()
1128 smi_inc_stat(smi_info, interrupts); in ipmi_si_irq_handler()
1132 smi_event_handler(smi_info, 0); in ipmi_si_irq_handler()
1133 spin_unlock_irqrestore(&(smi_info->si_lock), flags); in ipmi_si_irq_handler()
1140 struct smi_info *new_smi = send_info; in smi_start_processing()
1185 struct smi_info *smi = send_info; in get_smi_info()
1197 struct smi_info *smi_info = send_info; in set_maintenance_mode() local
1200 atomic_set(&smi_info->req_events, 0); in set_maintenance_mode()
1201 smi_info->in_maintenance_mode = enable; in set_maintenance_mode()
1286 static int wait_for_msg_done(struct smi_info *smi_info) in wait_for_msg_done() argument
1290 smi_result = smi_info->handlers->event(smi_info->si_sm, 0); in wait_for_msg_done()
1295 smi_result = smi_info->handlers->event( in wait_for_msg_done()
1296 smi_info->si_sm, jiffies_to_usecs(1)); in wait_for_msg_done()
1298 smi_result = smi_info->handlers->event( in wait_for_msg_done()
1299 smi_info->si_sm, 0); in wait_for_msg_done()
1313 static int try_get_dev_id(struct smi_info *smi_info) in try_get_dev_id() argument
1333 smi_info->handlers->start_transaction(smi_info->si_sm, msg, 2); in try_get_dev_id()
1335 rv = wait_for_msg_done(smi_info); in try_get_dev_id()
1339 resp_len = smi_info->handlers->get_result(smi_info->si_sm, in try_get_dev_id()
1344 resp + 2, resp_len - 2, &smi_info->device_id); in try_get_dev_id()
1353 dev_warn(smi_info->io.dev, in try_get_dev_id()
1365 static int get_global_enables(struct smi_info *smi_info, u8 *enables) in get_global_enables() argument
1378 smi_info->handlers->start_transaction(smi_info->si_sm, msg, 2); in get_global_enables()
1380 rv = wait_for_msg_done(smi_info); in get_global_enables()
1382 dev_warn(smi_info->io.dev, in get_global_enables()
1388 resp_len = smi_info->handlers->get_result(smi_info->si_sm, in get_global_enables()
1395 dev_warn(smi_info->io.dev, in get_global_enables()
1412 static int set_global_enables(struct smi_info *smi_info, u8 enables) in set_global_enables() argument
1426 smi_info->handlers->start_transaction(smi_info->si_sm, msg, 3); in set_global_enables()
1428 rv = wait_for_msg_done(smi_info); in set_global_enables()
1430 dev_warn(smi_info->io.dev, in set_global_enables()
1436 resp_len = smi_info->handlers->get_result(smi_info->si_sm, in set_global_enables()
1442 dev_warn(smi_info->io.dev, in set_global_enables()
1462 static void check_clr_rcv_irq(struct smi_info *smi_info) in check_clr_rcv_irq() argument
1467 rv = get_global_enables(smi_info, &enables); in check_clr_rcv_irq()
1474 rv = set_global_enables(smi_info, enables); in check_clr_rcv_irq()
1478 dev_err(smi_info->io.dev, in check_clr_rcv_irq()
1488 dev_warn(smi_info->io.dev, in check_clr_rcv_irq()
1490 smi_info->cannot_disable_irq = true; in check_clr_rcv_irq()
1499 static void check_set_rcv_irq(struct smi_info *smi_info) in check_set_rcv_irq() argument
1504 if (!smi_info->io.irq) in check_set_rcv_irq()
1507 rv = get_global_enables(smi_info, &enables); in check_set_rcv_irq()
1510 rv = set_global_enables(smi_info, enables); in check_set_rcv_irq()
1514 dev_err(smi_info->io.dev, in check_set_rcv_irq()
1524 dev_warn(smi_info->io.dev, in check_set_rcv_irq()
1526 smi_info->cannot_disable_irq = true; in check_set_rcv_irq()
1527 smi_info->irq_enable_broken = true; in check_set_rcv_irq()
1531 static int try_enable_event_buffer(struct smi_info *smi_info) in try_enable_event_buffer() argument
1544 smi_info->handlers->start_transaction(smi_info->si_sm, msg, 2); in try_enable_event_buffer()
1546 rv = wait_for_msg_done(smi_info); in try_enable_event_buffer()
1552 resp_len = smi_info->handlers->get_result(smi_info->si_sm, in try_enable_event_buffer()
1566 smi_info->supports_event_msg_buff = true; in try_enable_event_buffer()
1573 smi_info->handlers->start_transaction(smi_info->si_sm, msg, 3); in try_enable_event_buffer()
1575 rv = wait_for_msg_done(smi_info); in try_enable_event_buffer()
1581 resp_len = smi_info->handlers->get_result(smi_info->si_sm, in try_enable_event_buffer()
1599 smi_info->supports_event_msg_buff = true; in try_enable_event_buffer()
1611 struct smi_info *smi_info = dev_get_drvdata(dev); \
1613 return snprintf(buf, 10, "%u\n", smi_get_stat(smi_info, name)); \
1621 struct smi_info *smi_info = dev_get_drvdata(dev); in type_show() local
1623 return snprintf(buf, 10, "%s\n", si_to_str[smi_info->io.si_type]); in type_show()
1631 struct smi_info *smi_info = dev_get_drvdata(dev); in interrupts_enabled_show() local
1632 int enabled = smi_info->io.irq && !smi_info->interrupt_disabled; in interrupts_enabled_show()
1655 struct smi_info *smi_info = dev_get_drvdata(dev); in params_show() local
1659 si_to_str[smi_info->io.si_type], in params_show()
1660 addr_space_to_str[smi_info->io.addr_space], in params_show()
1661 smi_info->io.addr_data, in params_show()
1662 smi_info->io.regspacing, in params_show()
1663 smi_info->io.regsize, in params_show()
1664 smi_info->io.regshift, in params_show()
1665 smi_info->io.irq, in params_show()
1666 smi_info->io.slave_addr); in params_show()
1699 static int oem_data_avail_to_receive_msg_avail(struct smi_info *smi_info) in oem_data_avail_to_receive_msg_avail() argument
1701 smi_info->msg_flags = ((smi_info->msg_flags & ~OEM_DATA_AVAIL) | in oem_data_avail_to_receive_msg_avail()
1735 static void setup_dell_poweredge_oem_data_handler(struct smi_info *smi_info) in setup_dell_poweredge_oem_data_handler() argument
1737 struct ipmi_device_id *id = &smi_info->device_id; in setup_dell_poweredge_oem_data_handler()
1742 smi_info->oem_data_avail_handler = in setup_dell_poweredge_oem_data_handler()
1747 smi_info->oem_data_avail_handler = in setup_dell_poweredge_oem_data_handler()
1754 static void return_hosed_msg_badsize(struct smi_info *smi_info) in return_hosed_msg_badsize() argument
1756 struct ipmi_smi_msg *msg = smi_info->curr_msg; in return_hosed_msg_badsize()
1763 smi_info->curr_msg = NULL; in return_hosed_msg_badsize()
1764 deliver_recv_msg(smi_info, msg); in return_hosed_msg_badsize()
1784 struct smi_info *smi_info = in; in dell_poweredge_bt_xaction_handler() local
1785 unsigned char *data = smi_info->curr_msg->data; in dell_poweredge_bt_xaction_handler()
1786 unsigned int size = smi_info->curr_msg->data_size; in dell_poweredge_bt_xaction_handler()
1791 return_hosed_msg_badsize(smi_info); in dell_poweredge_bt_xaction_handler()
1809 setup_dell_poweredge_bt_xaction_handler(struct smi_info *smi_info) in setup_dell_poweredge_bt_xaction_handler() argument
1811 struct ipmi_device_id *id = &smi_info->device_id; in setup_dell_poweredge_bt_xaction_handler()
1813 smi_info->io.si_type == SI_BT) in setup_dell_poweredge_bt_xaction_handler()
1825 static void setup_oem_data_handler(struct smi_info *smi_info) in setup_oem_data_handler() argument
1827 setup_dell_poweredge_oem_data_handler(smi_info); in setup_oem_data_handler()
1830 static void setup_xaction_handlers(struct smi_info *smi_info) in setup_xaction_handlers() argument
1832 setup_dell_poweredge_bt_xaction_handler(smi_info); in setup_xaction_handlers()
1835 static void check_for_broken_irqs(struct smi_info *smi_info) in check_for_broken_irqs() argument
1837 check_clr_rcv_irq(smi_info); in check_for_broken_irqs()
1838 check_set_rcv_irq(smi_info); in check_for_broken_irqs()
1841 static inline void stop_timer_and_thread(struct smi_info *smi_info) in stop_timer_and_thread() argument
1843 if (smi_info->thread != NULL) { in stop_timer_and_thread()
1844 kthread_stop(smi_info->thread); in stop_timer_and_thread()
1845 smi_info->thread = NULL; in stop_timer_and_thread()
1848 smi_info->timer_can_start = false; in stop_timer_and_thread()
1849 del_timer_sync(&smi_info->si_timer); in stop_timer_and_thread()
1852 static struct smi_info *find_dup_si(struct smi_info *info) in find_dup_si()
1854 struct smi_info *e; in find_dup_si()
1877 struct smi_info *new_smi, *dup; in ipmi_si_add_smi()
1947 static int try_smi_init(struct smi_info *new_smi) in try_smi_init()
2097 struct smi_info *e; in init_ipmi_si()
2165 struct smi_info *smi_info = send_info; in shutdown_smi() local
2167 if (smi_info->dev_group_added) { in shutdown_smi()
2168 device_remove_group(smi_info->io.dev, &ipmi_si_dev_attr_group); in shutdown_smi()
2169 smi_info->dev_group_added = false; in shutdown_smi()
2171 if (smi_info->io.dev) in shutdown_smi()
2172 dev_set_drvdata(smi_info->io.dev, NULL); in shutdown_smi()
2178 smi_info->interrupt_disabled = true; in shutdown_smi()
2179 if (smi_info->io.irq_cleanup) { in shutdown_smi()
2180 smi_info->io.irq_cleanup(&smi_info->io); in shutdown_smi()
2181 smi_info->io.irq_cleanup = NULL; in shutdown_smi()
2183 stop_timer_and_thread(smi_info); in shutdown_smi()
2197 while (smi_info->curr_msg || (smi_info->si_state != SI_NORMAL)) { in shutdown_smi()
2198 poll(smi_info); in shutdown_smi()
2201 if (smi_info->handlers) in shutdown_smi()
2202 disable_si_irq(smi_info); in shutdown_smi()
2203 while (smi_info->curr_msg || (smi_info->si_state != SI_NORMAL)) { in shutdown_smi()
2204 poll(smi_info); in shutdown_smi()
2207 if (smi_info->handlers) in shutdown_smi()
2208 smi_info->handlers->cleanup(smi_info->si_sm); in shutdown_smi()
2210 if (smi_info->io.addr_source_cleanup) { in shutdown_smi()
2211 smi_info->io.addr_source_cleanup(&smi_info->io); in shutdown_smi()
2212 smi_info->io.addr_source_cleanup = NULL; in shutdown_smi()
2214 if (smi_info->io.io_cleanup) { in shutdown_smi()
2215 smi_info->io.io_cleanup(&smi_info->io); in shutdown_smi()
2216 smi_info->io.io_cleanup = NULL; in shutdown_smi()
2219 kfree(smi_info->si_sm); in shutdown_smi()
2220 smi_info->si_sm = NULL; in shutdown_smi()
2222 smi_info->intf = NULL; in shutdown_smi()
2229 static void cleanup_one_si(struct smi_info *smi_info) in cleanup_one_si() argument
2231 if (!smi_info) in cleanup_one_si()
2234 list_del(&smi_info->link); in cleanup_one_si()
2236 if (smi_info->intf) in cleanup_one_si()
2237 ipmi_unregister_smi(smi_info->intf); in cleanup_one_si()
2239 kfree(smi_info); in cleanup_one_si()
2244 struct smi_info *e; in ipmi_si_remove_by_dev()
2264 struct smi_info *e, *tmp_e; in ipmi_si_remove_by_data()
2285 struct smi_info *e, *tmp_e; in cleanup_ipmi_si()