Lines Matching refs:intf
57 static void handle_new_recv_msgs(ipmi_smi_t intf);
58 static void need_waiter(ipmi_smi_t intf);
59 static int handle_one_recv_msg(ipmi_smi_t intf,
109 ipmi_smi_t intf; member
424 void (*null_user_handler)(ipmi_smi_t intf, struct ipmi_recv_msg *msg);
470 #define ipmi_inc_stat(intf, stat) \ argument
471 atomic_inc(&(intf)->stats[IPMI_STAT_ ## stat])
472 #define ipmi_get_stat(intf, stat) \ argument
473 ((unsigned int) atomic_read(&(intf)->stats[IPMI_STAT_ ## stat]))
523 static void clean_up_interface_data(ipmi_smi_t intf) in clean_up_interface_data() argument
529 tasklet_kill(&intf->recv_tasklet); in clean_up_interface_data()
531 free_smi_msg_list(&intf->waiting_rcv_msgs); in clean_up_interface_data()
532 free_recv_msg_list(&intf->waiting_events); in clean_up_interface_data()
538 mutex_lock(&intf->cmd_rcvrs_mutex); in clean_up_interface_data()
540 list_splice_init_rcu(&intf->cmd_rcvrs, &list, synchronize_rcu); in clean_up_interface_data()
541 mutex_unlock(&intf->cmd_rcvrs_mutex); in clean_up_interface_data()
547 if ((intf->seq_table[i].inuse) in clean_up_interface_data()
548 && (intf->seq_table[i].recv_msg)) in clean_up_interface_data()
549 ipmi_free_recv_msg(intf->seq_table[i].recv_msg); in clean_up_interface_data()
555 ipmi_smi_t intf = container_of(ref, struct ipmi_smi, refcount); in intf_free() local
557 clean_up_interface_data(intf); in intf_free()
558 kfree(intf); in intf_free()
563 ipmi_smi_t intf; member
569 ipmi_smi_t intf; in ipmi_smi_watcher_register() local
578 list_for_each_entry(intf, &ipmi_interfaces, link) { in ipmi_smi_watcher_register()
579 if (intf->intf_num == -1) in ipmi_smi_watcher_register()
584 kref_get(&intf->refcount); in ipmi_smi_watcher_register()
585 e->intf = intf; in ipmi_smi_watcher_register()
586 e->intf_num = intf->intf_num; in ipmi_smi_watcher_register()
597 watcher->new_smi(e->intf_num, e->intf->si_dev); in ipmi_smi_watcher_register()
598 kref_put(&e->intf->refcount, intf_free); in ipmi_smi_watcher_register()
611 kref_put(&e->intf->refcount, intf_free); in ipmi_smi_watcher_register()
737 ipmi_smi_t intf = msg->user_msg_data; in deliver_response() local
740 if (intf->null_user_handler) { in deliver_response()
741 intf->null_user_handler(intf, msg); in deliver_response()
742 ipmi_inc_stat(intf, handled_local_responses); in deliver_response()
745 ipmi_inc_stat(intf, unhandled_local_responses); in deliver_response()
776 static int intf_next_seq(ipmi_smi_t intf, in intf_next_seq() argument
787 for (i = intf->curr_seq; (i+1)%IPMI_IPMB_NUM_SEQ != intf->curr_seq; in intf_next_seq()
789 if (!intf->seq_table[i].inuse) in intf_next_seq()
793 if (!intf->seq_table[i].inuse) { in intf_next_seq()
794 intf->seq_table[i].recv_msg = recv_msg; in intf_next_seq()
800 intf->seq_table[i].timeout = MAX_MSG_TIMEOUT; in intf_next_seq()
801 intf->seq_table[i].orig_timeout = timeout; in intf_next_seq()
802 intf->seq_table[i].retries_left = retries; in intf_next_seq()
803 intf->seq_table[i].broadcast = broadcast; in intf_next_seq()
804 intf->seq_table[i].inuse = 1; in intf_next_seq()
805 intf->seq_table[i].seqid = NEXT_SEQID(intf->seq_table[i].seqid); in intf_next_seq()
807 *seqid = intf->seq_table[i].seqid; in intf_next_seq()
808 intf->curr_seq = (i+1)%IPMI_IPMB_NUM_SEQ; in intf_next_seq()
809 need_waiter(intf); in intf_next_seq()
824 static int intf_find_seq(ipmi_smi_t intf, in intf_find_seq() argument
838 spin_lock_irqsave(&(intf->seq_lock), flags); in intf_find_seq()
839 if (intf->seq_table[seq].inuse) { in intf_find_seq()
840 struct ipmi_recv_msg *msg = intf->seq_table[seq].recv_msg; in intf_find_seq()
846 intf->seq_table[seq].inuse = 0; in intf_find_seq()
850 spin_unlock_irqrestore(&(intf->seq_lock), flags); in intf_find_seq()
857 static int intf_start_seq_timer(ipmi_smi_t intf, in intf_start_seq_timer() argument
868 spin_lock_irqsave(&(intf->seq_lock), flags); in intf_start_seq_timer()
873 if ((intf->seq_table[seq].inuse) in intf_start_seq_timer()
874 && (intf->seq_table[seq].seqid == seqid)) { in intf_start_seq_timer()
875 struct seq_table *ent = &(intf->seq_table[seq]); in intf_start_seq_timer()
879 spin_unlock_irqrestore(&(intf->seq_lock), flags); in intf_start_seq_timer()
885 static int intf_err_seq(ipmi_smi_t intf, in intf_err_seq() argument
898 spin_lock_irqsave(&(intf->seq_lock), flags); in intf_err_seq()
903 if ((intf->seq_table[seq].inuse) in intf_err_seq()
904 && (intf->seq_table[seq].seqid == seqid)) { in intf_err_seq()
905 struct seq_table *ent = &(intf->seq_table[seq]); in intf_err_seq()
911 spin_unlock_irqrestore(&(intf->seq_lock), flags); in intf_err_seq()
928 ipmi_smi_t intf; in ipmi_create_user() local
963 list_for_each_entry_rcu(intf, &ipmi_interfaces, link) { in ipmi_create_user()
964 if (intf->intf_num == if_num) in ipmi_create_user()
973 kref_get(&intf->refcount); in ipmi_create_user()
978 new_user->intf = intf; in ipmi_create_user()
981 if (!try_module_get(intf->handlers->owner)) { in ipmi_create_user()
986 if (intf->handlers->inc_usecount) { in ipmi_create_user()
987 rv = intf->handlers->inc_usecount(intf->send_info); in ipmi_create_user()
989 module_put(intf->handlers->owner); in ipmi_create_user()
1001 spin_lock_irqsave(&intf->seq_lock, flags); in ipmi_create_user()
1002 list_add_rcu(&new_user->link, &intf->users); in ipmi_create_user()
1003 spin_unlock_irqrestore(&intf->seq_lock, flags); in ipmi_create_user()
1006 if (atomic_inc_return(&intf->event_waiters) == 1) in ipmi_create_user()
1007 need_waiter(intf); in ipmi_create_user()
1013 kref_put(&intf->refcount, intf_free); in ipmi_create_user()
1024 ipmi_smi_t intf; in ipmi_get_smi_info() local
1028 list_for_each_entry_rcu(intf, &ipmi_interfaces, link) { in ipmi_get_smi_info()
1029 if (intf->intf_num == if_num) in ipmi_get_smi_info()
1038 handlers = intf->handlers; in ipmi_get_smi_info()
1041 rv = handlers->get_smi_info(intf->send_info, data); in ipmi_get_smi_info()
1056 ipmi_smi_t intf = user->intf; in ipmi_destroy_user() local
1065 atomic_dec(&intf->event_waiters); in ipmi_destroy_user()
1068 atomic_dec(&intf->event_waiters); in ipmi_destroy_user()
1071 spin_lock_irqsave(&intf->seq_lock, flags); in ipmi_destroy_user()
1075 if (intf->seq_table[i].inuse in ipmi_destroy_user()
1076 && (intf->seq_table[i].recv_msg->user == user)) { in ipmi_destroy_user()
1077 intf->seq_table[i].inuse = 0; in ipmi_destroy_user()
1078 ipmi_free_recv_msg(intf->seq_table[i].recv_msg); in ipmi_destroy_user()
1081 spin_unlock_irqrestore(&intf->seq_lock, flags); in ipmi_destroy_user()
1089 mutex_lock(&intf->cmd_rcvrs_mutex); in ipmi_destroy_user()
1090 list_for_each_entry_rcu(rcvr, &intf->cmd_rcvrs, link) { in ipmi_destroy_user()
1097 mutex_unlock(&intf->cmd_rcvrs_mutex); in ipmi_destroy_user()
1106 if (intf->handlers) { in ipmi_destroy_user()
1107 module_put(intf->handlers->owner); in ipmi_destroy_user()
1108 if (intf->handlers->dec_usecount) in ipmi_destroy_user()
1109 intf->handlers->dec_usecount(intf->send_info); in ipmi_destroy_user()
1113 kref_put(&intf->refcount, intf_free); in ipmi_destroy_user()
1125 *major = user->intf->ipmi_version_major; in ipmi_get_version()
1126 *minor = user->intf->ipmi_version_minor; in ipmi_get_version()
1136 user->intf->channels[channel].address = address; in ipmi_set_my_address()
1147 *address = user->intf->channels[channel].address; in ipmi_get_my_address()
1158 user->intf->channels[channel].lun = LUN & 0x3; in ipmi_set_my_LUN()
1169 *address = user->intf->channels[channel].lun; in ipmi_get_my_LUN()
1179 spin_lock_irqsave(&user->intf->maintenance_mode_lock, flags); in ipmi_get_maintenance_mode()
1180 mode = user->intf->maintenance_mode; in ipmi_get_maintenance_mode()
1181 spin_unlock_irqrestore(&user->intf->maintenance_mode_lock, flags); in ipmi_get_maintenance_mode()
1187 static void maintenance_mode_update(ipmi_smi_t intf) in maintenance_mode_update() argument
1189 if (intf->handlers->set_maintenance_mode) in maintenance_mode_update()
1190 intf->handlers->set_maintenance_mode( in maintenance_mode_update()
1191 intf->send_info, intf->maintenance_mode_enable); in maintenance_mode_update()
1198 ipmi_smi_t intf = user->intf; in ipmi_set_maintenance_mode() local
1200 spin_lock_irqsave(&intf->maintenance_mode_lock, flags); in ipmi_set_maintenance_mode()
1201 if (intf->maintenance_mode != mode) { in ipmi_set_maintenance_mode()
1204 intf->maintenance_mode_enable in ipmi_set_maintenance_mode()
1205 = (intf->auto_maintenance_timeout > 0); in ipmi_set_maintenance_mode()
1209 intf->maintenance_mode_enable = false; in ipmi_set_maintenance_mode()
1213 intf->maintenance_mode_enable = true; in ipmi_set_maintenance_mode()
1220 intf->maintenance_mode = mode; in ipmi_set_maintenance_mode()
1222 maintenance_mode_update(intf); in ipmi_set_maintenance_mode()
1225 spin_unlock_irqrestore(&intf->maintenance_mode_lock, flags); in ipmi_set_maintenance_mode()
1234 ipmi_smi_t intf = user->intf; in ipmi_set_gets_events() local
1240 spin_lock_irqsave(&intf->events_lock, flags); in ipmi_set_gets_events()
1247 if (atomic_inc_return(&intf->event_waiters) == 1) in ipmi_set_gets_events()
1248 need_waiter(intf); in ipmi_set_gets_events()
1250 atomic_dec(&intf->event_waiters); in ipmi_set_gets_events()
1253 if (intf->delivering_events) in ipmi_set_gets_events()
1261 while (user->gets_events && !list_empty(&intf->waiting_events)) { in ipmi_set_gets_events()
1262 list_for_each_entry_safe(msg, msg2, &intf->waiting_events, link) in ipmi_set_gets_events()
1264 intf->waiting_events_count = 0; in ipmi_set_gets_events()
1265 if (intf->event_msg_printed) { in ipmi_set_gets_events()
1268 intf->event_msg_printed = 0; in ipmi_set_gets_events()
1271 intf->delivering_events = 1; in ipmi_set_gets_events()
1272 spin_unlock_irqrestore(&intf->events_lock, flags); in ipmi_set_gets_events()
1280 spin_lock_irqsave(&intf->events_lock, flags); in ipmi_set_gets_events()
1281 intf->delivering_events = 0; in ipmi_set_gets_events()
1285 spin_unlock_irqrestore(&intf->events_lock, flags); in ipmi_set_gets_events()
1291 static struct cmd_rcvr *find_cmd_rcvr(ipmi_smi_t intf, in find_cmd_rcvr() argument
1298 list_for_each_entry_rcu(rcvr, &intf->cmd_rcvrs, link) { in find_cmd_rcvr()
1306 static int is_cmd_rcvr_exclusive(ipmi_smi_t intf, in is_cmd_rcvr_exclusive() argument
1313 list_for_each_entry_rcu(rcvr, &intf->cmd_rcvrs, link) { in is_cmd_rcvr_exclusive()
1326 ipmi_smi_t intf = user->intf; in ipmi_register_for_cmd() local
1339 mutex_lock(&intf->cmd_rcvrs_mutex); in ipmi_register_for_cmd()
1341 if (!is_cmd_rcvr_exclusive(intf, netfn, cmd, chans)) { in ipmi_register_for_cmd()
1346 if (atomic_inc_return(&intf->event_waiters) == 1) in ipmi_register_for_cmd()
1347 need_waiter(intf); in ipmi_register_for_cmd()
1349 list_add_rcu(&rcvr->link, &intf->cmd_rcvrs); in ipmi_register_for_cmd()
1352 mutex_unlock(&intf->cmd_rcvrs_mutex); in ipmi_register_for_cmd()
1365 ipmi_smi_t intf = user->intf; in ipmi_unregister_for_cmd() local
1370 mutex_lock(&intf->cmd_rcvrs_mutex); in ipmi_unregister_for_cmd()
1374 rcvr = find_cmd_rcvr(intf, netfn, cmd, i); in ipmi_unregister_for_cmd()
1387 mutex_unlock(&intf->cmd_rcvrs_mutex); in ipmi_unregister_for_cmd()
1390 atomic_dec(&intf->event_waiters); in ipmi_unregister_for_cmd()
1493 static struct ipmi_smi_msg *smi_add_send_msg(ipmi_smi_t intf, in smi_add_send_msg() argument
1497 if (intf->curr_msg) { in smi_add_send_msg()
1499 list_add_tail(&smi_msg->link, &intf->hp_xmit_msgs); in smi_add_send_msg()
1501 list_add_tail(&smi_msg->link, &intf->xmit_msgs); in smi_add_send_msg()
1504 intf->curr_msg = smi_msg; in smi_add_send_msg()
1511 static void smi_send(ipmi_smi_t intf, const struct ipmi_smi_handlers *handlers, in smi_send() argument
1514 int run_to_completion = intf->run_to_completion; in smi_send()
1517 smi_msg = smi_add_send_msg(intf, smi_msg, priority); in smi_send()
1521 spin_lock_irqsave(&intf->xmit_msgs_lock, flags); in smi_send()
1522 smi_msg = smi_add_send_msg(intf, smi_msg, priority); in smi_send()
1523 spin_unlock_irqrestore(&intf->xmit_msgs_lock, flags); in smi_send()
1527 handlers->sender(intf->send_info, smi_msg); in smi_send()
1537 ipmi_smi_t intf, in i_ipmi_request() argument
1576 if (intf->in_shutdown) { in i_ipmi_request()
1602 ipmi_inc_stat(intf, sent_invalid_commands); in i_ipmi_request()
1617 ipmi_inc_stat(intf, sent_invalid_commands); in i_ipmi_request()
1626 spin_lock_irqsave(&intf->maintenance_mode_lock, flags); in i_ipmi_request()
1627 intf->auto_maintenance_timeout in i_ipmi_request()
1629 if (!intf->maintenance_mode in i_ipmi_request()
1630 && !intf->maintenance_mode_enable) { in i_ipmi_request()
1631 intf->maintenance_mode_enable = true; in i_ipmi_request()
1632 maintenance_mode_update(intf); in i_ipmi_request()
1634 spin_unlock_irqrestore(&intf->maintenance_mode_lock, in i_ipmi_request()
1639 ipmi_inc_stat(intf, sent_invalid_commands); in i_ipmi_request()
1651 ipmi_inc_stat(intf, sent_local_commands); in i_ipmi_request()
1659 ipmi_inc_stat(intf, sent_invalid_commands); in i_ipmi_request()
1664 if (intf->channels[addr->channel].medium in i_ipmi_request()
1666 ipmi_inc_stat(intf, sent_invalid_commands); in i_ipmi_request()
1697 ipmi_inc_stat(intf, sent_invalid_commands); in i_ipmi_request()
1704 ipmi_inc_stat(intf, sent_invalid_commands); in i_ipmi_request()
1716 ipmi_inc_stat(intf, sent_ipmb_responses); in i_ipmi_request()
1729 spin_lock_irqsave(&(intf->seq_lock), flags); in i_ipmi_request()
1735 rv = intf_next_seq(intf, in i_ipmi_request()
1747 spin_unlock_irqrestore(&(intf->seq_lock), in i_ipmi_request()
1752 ipmi_inc_stat(intf, sent_ipmb_commands); in i_ipmi_request()
1781 spin_unlock_irqrestore(&(intf->seq_lock), flags); in i_ipmi_request()
1789 ipmi_inc_stat(intf, sent_invalid_commands); in i_ipmi_request()
1794 if ((intf->channels[addr->channel].medium in i_ipmi_request()
1796 && (intf->channels[addr->channel].medium in i_ipmi_request()
1798 ipmi_inc_stat(intf, sent_invalid_commands); in i_ipmi_request()
1811 ipmi_inc_stat(intf, sent_invalid_commands); in i_ipmi_request()
1818 ipmi_inc_stat(intf, sent_invalid_commands); in i_ipmi_request()
1830 ipmi_inc_stat(intf, sent_lan_responses); in i_ipmi_request()
1842 spin_lock_irqsave(&(intf->seq_lock), flags); in i_ipmi_request()
1848 rv = intf_next_seq(intf, in i_ipmi_request()
1860 spin_unlock_irqrestore(&(intf->seq_lock), in i_ipmi_request()
1865 ipmi_inc_stat(intf, sent_lan_commands); in i_ipmi_request()
1893 spin_unlock_irqrestore(&(intf->seq_lock), flags); in i_ipmi_request()
1897 ipmi_inc_stat(intf, sent_invalid_commands); in i_ipmi_request()
1911 smi_send(intf, intf->handlers, smi_msg, priority); in i_ipmi_request()
1923 static int check_addr(ipmi_smi_t intf, in check_addr() argument
1930 *lun = intf->channels[addr->channel].lun; in check_addr()
1931 *saddr = intf->channels[addr->channel].address; in check_addr()
1949 rv = check_addr(user->intf, addr, &saddr, &lun); in ipmi_request_settime()
1953 user->intf, in ipmi_request_settime()
1981 rv = check_addr(user->intf, addr, &saddr, &lun); in ipmi_request_supply_msgs()
1985 user->intf, in ipmi_request_supply_msgs()
2002 ipmi_smi_t intf = m->private; in smi_ipmb_proc_show() local
2005 seq_printf(m, "%x", intf->channels[0].address); in smi_ipmb_proc_show()
2007 seq_printf(m, " %x", intf->channels[i].address); in smi_ipmb_proc_show()
2027 ipmi_smi_t intf = m->private; in smi_version_proc_show() local
2030 ipmi_version_major(&intf->bmc->id), in smi_version_proc_show()
2031 ipmi_version_minor(&intf->bmc->id)); in smi_version_proc_show()
2050 ipmi_smi_t intf = m->private; in smi_stats_proc_show() local
2053 ipmi_get_stat(intf, sent_invalid_commands)); in smi_stats_proc_show()
2055 ipmi_get_stat(intf, sent_local_commands)); in smi_stats_proc_show()
2057 ipmi_get_stat(intf, handled_local_responses)); in smi_stats_proc_show()
2059 ipmi_get_stat(intf, unhandled_local_responses)); in smi_stats_proc_show()
2061 ipmi_get_stat(intf, sent_ipmb_commands)); in smi_stats_proc_show()
2063 ipmi_get_stat(intf, sent_ipmb_command_errs)); in smi_stats_proc_show()
2065 ipmi_get_stat(intf, retransmitted_ipmb_commands)); in smi_stats_proc_show()
2067 ipmi_get_stat(intf, timed_out_ipmb_commands)); in smi_stats_proc_show()
2069 ipmi_get_stat(intf, timed_out_ipmb_broadcasts)); in smi_stats_proc_show()
2071 ipmi_get_stat(intf, sent_ipmb_responses)); in smi_stats_proc_show()
2073 ipmi_get_stat(intf, handled_ipmb_responses)); in smi_stats_proc_show()
2075 ipmi_get_stat(intf, invalid_ipmb_responses)); in smi_stats_proc_show()
2077 ipmi_get_stat(intf, unhandled_ipmb_responses)); in smi_stats_proc_show()
2079 ipmi_get_stat(intf, sent_lan_commands)); in smi_stats_proc_show()
2081 ipmi_get_stat(intf, sent_lan_command_errs)); in smi_stats_proc_show()
2083 ipmi_get_stat(intf, retransmitted_lan_commands)); in smi_stats_proc_show()
2085 ipmi_get_stat(intf, timed_out_lan_commands)); in smi_stats_proc_show()
2087 ipmi_get_stat(intf, sent_lan_responses)); in smi_stats_proc_show()
2089 ipmi_get_stat(intf, handled_lan_responses)); in smi_stats_proc_show()
2091 ipmi_get_stat(intf, invalid_lan_responses)); in smi_stats_proc_show()
2093 ipmi_get_stat(intf, unhandled_lan_responses)); in smi_stats_proc_show()
2095 ipmi_get_stat(intf, handled_commands)); in smi_stats_proc_show()
2097 ipmi_get_stat(intf, invalid_commands)); in smi_stats_proc_show()
2099 ipmi_get_stat(intf, unhandled_commands)); in smi_stats_proc_show()
2101 ipmi_get_stat(intf, invalid_events)); in smi_stats_proc_show()
2103 ipmi_get_stat(intf, events)); in smi_stats_proc_show()
2105 ipmi_get_stat(intf, dropped_rexmit_lan_commands)); in smi_stats_proc_show()
2107 ipmi_get_stat(intf, dropped_rexmit_ipmb_commands)); in smi_stats_proc_show()
2427 static void ipmi_bmc_unregister(ipmi_smi_t intf) in ipmi_bmc_unregister() argument
2429 struct bmc_device *bmc = intf->bmc; in ipmi_bmc_unregister()
2431 sysfs_remove_link(&intf->si_dev->kobj, "bmc"); in ipmi_bmc_unregister()
2432 if (intf->my_dev_name) { in ipmi_bmc_unregister()
2433 sysfs_remove_link(&bmc->pdev.dev.kobj, intf->my_dev_name); in ipmi_bmc_unregister()
2434 kfree(intf->my_dev_name); in ipmi_bmc_unregister()
2435 intf->my_dev_name = NULL; in ipmi_bmc_unregister()
2440 intf->bmc = NULL; in ipmi_bmc_unregister()
2444 static int ipmi_bmc_register(ipmi_smi_t intf, int ifnum) in ipmi_bmc_register() argument
2447 struct bmc_device *bmc = intf->bmc; in ipmi_bmc_register()
2469 intf->bmc = old_bmc; in ipmi_bmc_register()
2532 dev_info(intf->si_dev, "Found new BMC (man_id: 0x%6.6x, " in ipmi_bmc_register()
2543 rv = sysfs_create_link(&intf->si_dev->kobj, &bmc->pdev.dev.kobj, "bmc"); in ipmi_bmc_register()
2551 intf->my_dev_name = kasprintf(GFP_KERNEL, "ipmi%d", ifnum); in ipmi_bmc_register()
2552 if (!intf->my_dev_name) { in ipmi_bmc_register()
2560 rv = sysfs_create_link(&bmc->pdev.dev.kobj, &intf->si_dev->kobj, in ipmi_bmc_register()
2561 intf->my_dev_name); in ipmi_bmc_register()
2563 kfree(intf->my_dev_name); in ipmi_bmc_register()
2564 intf->my_dev_name = NULL; in ipmi_bmc_register()
2575 ipmi_bmc_unregister(intf); in ipmi_bmc_register()
2580 send_guid_cmd(ipmi_smi_t intf, int chan) in send_guid_cmd() argument
2594 intf, in send_guid_cmd()
2598 intf, in send_guid_cmd()
2602 intf->channels[0].address, in send_guid_cmd()
2603 intf->channels[0].lun, in send_guid_cmd()
2608 guid_handler(ipmi_smi_t intf, struct ipmi_recv_msg *msg) in guid_handler() argument
2618 intf->bmc->guid_set = 0; in guid_handler()
2623 intf->bmc->guid_set = 0; in guid_handler()
2632 memcpy(intf->bmc->guid, msg->msg.data, 16); in guid_handler()
2633 intf->bmc->guid_set = 1; in guid_handler()
2635 wake_up(&intf->waitq); in guid_handler()
2639 get_guid(ipmi_smi_t intf) in get_guid() argument
2643 intf->bmc->guid_set = 0x2; in get_guid()
2644 intf->null_user_handler = guid_handler; in get_guid()
2645 rv = send_guid_cmd(intf, 0); in get_guid()
2648 intf->bmc->guid_set = 0; in get_guid()
2649 wait_event(intf->waitq, intf->bmc->guid_set != 2); in get_guid()
2650 intf->null_user_handler = NULL; in get_guid()
2654 send_channel_info_cmd(ipmi_smi_t intf, int chan) in send_channel_info_cmd() argument
2670 intf, in send_channel_info_cmd()
2674 intf, in send_channel_info_cmd()
2678 intf->channels[0].address, in send_channel_info_cmd()
2679 intf->channels[0].lun, in send_channel_info_cmd()
2684 channel_handler(ipmi_smi_t intf, struct ipmi_recv_msg *msg) in channel_handler() argument
2703 intf->channels[0].medium in channel_handler()
2705 intf->channels[0].protocol in channel_handler()
2708 intf->curr_channel = IPMI_MAX_CHANNELS; in channel_handler()
2709 wake_up(&intf->waitq); in channel_handler()
2718 chan = intf->curr_channel; in channel_handler()
2719 intf->channels[chan].medium = msg->msg.data[2] & 0x7f; in channel_handler()
2720 intf->channels[chan].protocol = msg->msg.data[3] & 0x1f; in channel_handler()
2723 intf->curr_channel++; in channel_handler()
2724 if (intf->curr_channel >= IPMI_MAX_CHANNELS) in channel_handler()
2725 wake_up(&intf->waitq); in channel_handler()
2727 rv = send_channel_info_cmd(intf, intf->curr_channel); in channel_handler()
2733 " %d: %d\n", intf->curr_channel, rv); in channel_handler()
2735 intf->curr_channel = IPMI_MAX_CHANNELS; in channel_handler()
2736 wake_up(&intf->waitq); in channel_handler()
2743 static void ipmi_poll(ipmi_smi_t intf) in ipmi_poll() argument
2745 if (intf->handlers->poll) in ipmi_poll()
2746 intf->handlers->poll(intf->send_info); in ipmi_poll()
2748 handle_new_recv_msgs(intf); in ipmi_poll()
2753 ipmi_poll(user->intf); in ipmi_poll_interface()
2765 ipmi_smi_t intf; in ipmi_register_smi() local
2785 intf = kzalloc(sizeof(*intf), GFP_KERNEL); in ipmi_register_smi()
2786 if (!intf) in ipmi_register_smi()
2789 intf->ipmi_version_major = ipmi_version_major(device_id); in ipmi_register_smi()
2790 intf->ipmi_version_minor = ipmi_version_minor(device_id); in ipmi_register_smi()
2792 intf->bmc = kzalloc(sizeof(*intf->bmc), GFP_KERNEL); in ipmi_register_smi()
2793 if (!intf->bmc) { in ipmi_register_smi()
2794 kfree(intf); in ipmi_register_smi()
2797 intf->intf_num = -1; /* Mark it invalid for now. */ in ipmi_register_smi()
2798 kref_init(&intf->refcount); in ipmi_register_smi()
2799 intf->bmc->id = *device_id; in ipmi_register_smi()
2800 intf->si_dev = si_dev; in ipmi_register_smi()
2802 intf->channels[j].address = IPMI_BMC_SLAVE_ADDR; in ipmi_register_smi()
2803 intf->channels[j].lun = 2; in ipmi_register_smi()
2806 intf->channels[0].address = slave_addr; in ipmi_register_smi()
2807 INIT_LIST_HEAD(&intf->users); in ipmi_register_smi()
2808 intf->handlers = handlers; in ipmi_register_smi()
2809 intf->send_info = send_info; in ipmi_register_smi()
2810 spin_lock_init(&intf->seq_lock); in ipmi_register_smi()
2812 intf->seq_table[j].inuse = 0; in ipmi_register_smi()
2813 intf->seq_table[j].seqid = 0; in ipmi_register_smi()
2815 intf->curr_seq = 0; in ipmi_register_smi()
2817 mutex_init(&intf->proc_entry_lock); in ipmi_register_smi()
2819 spin_lock_init(&intf->waiting_rcv_msgs_lock); in ipmi_register_smi()
2820 INIT_LIST_HEAD(&intf->waiting_rcv_msgs); in ipmi_register_smi()
2821 tasklet_init(&intf->recv_tasklet, in ipmi_register_smi()
2823 (unsigned long) intf); in ipmi_register_smi()
2824 atomic_set(&intf->watchdog_pretimeouts_to_deliver, 0); in ipmi_register_smi()
2825 spin_lock_init(&intf->xmit_msgs_lock); in ipmi_register_smi()
2826 INIT_LIST_HEAD(&intf->xmit_msgs); in ipmi_register_smi()
2827 INIT_LIST_HEAD(&intf->hp_xmit_msgs); in ipmi_register_smi()
2828 spin_lock_init(&intf->events_lock); in ipmi_register_smi()
2829 atomic_set(&intf->event_waiters, 0); in ipmi_register_smi()
2830 intf->ticks_to_req_ev = IPMI_REQUEST_EV_TIME; in ipmi_register_smi()
2831 INIT_LIST_HEAD(&intf->waiting_events); in ipmi_register_smi()
2832 intf->waiting_events_count = 0; in ipmi_register_smi()
2833 mutex_init(&intf->cmd_rcvrs_mutex); in ipmi_register_smi()
2834 spin_lock_init(&intf->maintenance_mode_lock); in ipmi_register_smi()
2835 INIT_LIST_HEAD(&intf->cmd_rcvrs); in ipmi_register_smi()
2836 init_waitqueue_head(&intf->waitq); in ipmi_register_smi()
2838 atomic_set(&intf->stats[i], 0); in ipmi_register_smi()
2840 intf->proc_dir = NULL; in ipmi_register_smi()
2856 list_add_rcu(&intf->link, &ipmi_interfaces); in ipmi_register_smi()
2858 list_add_tail_rcu(&intf->link, link); in ipmi_register_smi()
2860 rv = handlers->start_processing(send_info, intf); in ipmi_register_smi()
2864 get_guid(intf); in ipmi_register_smi()
2866 if ((intf->ipmi_version_major > 1) in ipmi_register_smi()
2867 || ((intf->ipmi_version_major == 1) in ipmi_register_smi()
2868 && (intf->ipmi_version_minor >= 5))) { in ipmi_register_smi()
2873 intf->null_user_handler = channel_handler; in ipmi_register_smi()
2874 intf->curr_channel = 0; in ipmi_register_smi()
2875 rv = send_channel_info_cmd(intf, 0); in ipmi_register_smi()
2884 wait_event(intf->waitq, in ipmi_register_smi()
2885 intf->curr_channel >= IPMI_MAX_CHANNELS); in ipmi_register_smi()
2886 intf->null_user_handler = NULL; in ipmi_register_smi()
2889 intf->channels[0].medium = IPMI_CHANNEL_MEDIUM_IPMB; in ipmi_register_smi()
2890 intf->channels[0].protocol = IPMI_CHANNEL_PROTOCOL_IPMB; in ipmi_register_smi()
2891 intf->curr_channel = IPMI_MAX_CHANNELS; in ipmi_register_smi()
2894 rv = ipmi_bmc_register(intf, i); in ipmi_register_smi()
2897 rv = add_proc_entries(intf, i); in ipmi_register_smi()
2901 if (intf->proc_dir) in ipmi_register_smi()
2902 remove_proc_entries(intf); in ipmi_register_smi()
2903 intf->handlers = NULL; in ipmi_register_smi()
2904 list_del_rcu(&intf->link); in ipmi_register_smi()
2908 kref_put(&intf->refcount, intf_free); in ipmi_register_smi()
2916 intf->intf_num = i; in ipmi_register_smi()
2919 call_smi_watchers(i, intf->si_dev); in ipmi_register_smi()
2927 static void deliver_smi_err_response(ipmi_smi_t intf, in deliver_smi_err_response() argument
2936 handle_one_recv_msg(intf, msg); in deliver_smi_err_response()
2939 static void cleanup_smi_msgs(ipmi_smi_t intf) in cleanup_smi_msgs() argument
2949 list_splice_tail(&intf->hp_xmit_msgs, &tmplist); in cleanup_smi_msgs()
2950 list_splice_tail(&intf->xmit_msgs, &tmplist); in cleanup_smi_msgs()
2953 while (intf->curr_msg && !list_empty(&intf->waiting_rcv_msgs)) { in cleanup_smi_msgs()
2968 deliver_smi_err_response(intf, msg, IPMI_ERR_UNSPECIFIED); in cleanup_smi_msgs()
2972 ent = &(intf->seq_table[i]); in cleanup_smi_msgs()
2979 int ipmi_unregister_smi(ipmi_smi_t intf) in ipmi_unregister_smi() argument
2982 int intf_num = intf->intf_num; in ipmi_unregister_smi()
2987 intf->intf_num = -1; in ipmi_unregister_smi()
2988 intf->in_shutdown = true; in ipmi_unregister_smi()
2989 list_del_rcu(&intf->link); in ipmi_unregister_smi()
2993 cleanup_smi_msgs(intf); in ipmi_unregister_smi()
2998 list_for_each_entry_rcu(user, &intf->users, link) { in ipmi_unregister_smi()
2999 module_put(intf->handlers->owner); in ipmi_unregister_smi()
3000 if (intf->handlers->dec_usecount) in ipmi_unregister_smi()
3001 intf->handlers->dec_usecount(intf->send_info); in ipmi_unregister_smi()
3004 intf->handlers = NULL; in ipmi_unregister_smi()
3007 remove_proc_entries(intf); in ipmi_unregister_smi()
3008 ipmi_bmc_unregister(intf); in ipmi_unregister_smi()
3018 kref_put(&intf->refcount, intf_free); in ipmi_unregister_smi()
3023 static int handle_ipmb_get_msg_rsp(ipmi_smi_t intf, in handle_ipmb_get_msg_rsp() argument
3035 ipmi_inc_stat(intf, invalid_ipmb_responses); in handle_ipmb_get_msg_rsp()
3053 if (intf_find_seq(intf, in handle_ipmb_get_msg_rsp()
3064 ipmi_inc_stat(intf, unhandled_ipmb_responses); in handle_ipmb_get_msg_rsp()
3080 ipmi_inc_stat(intf, handled_ipmb_responses); in handle_ipmb_get_msg_rsp()
3086 static int handle_ipmb_get_msg_cmd(ipmi_smi_t intf, in handle_ipmb_get_msg_cmd() argument
3100 ipmi_inc_stat(intf, invalid_commands); in handle_ipmb_get_msg_cmd()
3114 rcvr = find_cmd_rcvr(intf, netfn, cmd, chan); in handle_ipmb_get_msg_cmd()
3124 ipmi_inc_stat(intf, unhandled_commands); in handle_ipmb_get_msg_cmd()
3132 msg->data[6] = intf->channels[msg->rsp[3] & 0xf].address; in handle_ipmb_get_msg_cmd()
3150 if (!intf->in_shutdown) { in handle_ipmb_get_msg_cmd()
3151 smi_send(intf, intf->handlers, msg, 0); in handle_ipmb_get_msg_cmd()
3162 ipmi_inc_stat(intf, handled_commands); in handle_ipmb_get_msg_cmd()
3207 static int handle_lan_get_msg_rsp(ipmi_smi_t intf, in handle_lan_get_msg_rsp() argument
3220 ipmi_inc_stat(intf, invalid_lan_responses); in handle_lan_get_msg_rsp()
3241 if (intf_find_seq(intf, in handle_lan_get_msg_rsp()
3252 ipmi_inc_stat(intf, unhandled_lan_responses); in handle_lan_get_msg_rsp()
3268 ipmi_inc_stat(intf, handled_lan_responses); in handle_lan_get_msg_rsp()
3274 static int handle_lan_get_msg_cmd(ipmi_smi_t intf, in handle_lan_get_msg_cmd() argument
3288 ipmi_inc_stat(intf, invalid_commands); in handle_lan_get_msg_cmd()
3302 rcvr = find_cmd_rcvr(intf, netfn, cmd, chan); in handle_lan_get_msg_cmd()
3312 ipmi_inc_stat(intf, unhandled_commands); in handle_lan_get_msg_cmd()
3321 ipmi_inc_stat(intf, handled_commands); in handle_lan_get_msg_cmd()
3374 static int handle_oem_get_msg_cmd(ipmi_smi_t intf, in handle_oem_get_msg_cmd() argument
3392 ipmi_inc_stat(intf, invalid_commands); in handle_oem_get_msg_cmd()
3410 rcvr = find_cmd_rcvr(intf, netfn, cmd, chan); in handle_oem_get_msg_cmd()
3420 ipmi_inc_stat(intf, unhandled_commands); in handle_oem_get_msg_cmd()
3430 ipmi_inc_stat(intf, handled_commands); in handle_oem_get_msg_cmd()
3494 static int handle_read_event_rsp(ipmi_smi_t intf, in handle_read_event_rsp() argument
3506 ipmi_inc_stat(intf, invalid_events); in handle_read_event_rsp()
3517 spin_lock_irqsave(&intf->events_lock, flags); in handle_read_event_rsp()
3519 ipmi_inc_stat(intf, events); in handle_read_event_rsp()
3526 list_for_each_entry_rcu(user, &intf->users, link) { in handle_read_event_rsp()
3562 } else if (intf->waiting_events_count < MAX_EVENTS_IN_QUEUE) { in handle_read_event_rsp()
3579 list_add_tail(&(recv_msg->link), &(intf->waiting_events)); in handle_read_event_rsp()
3580 intf->waiting_events_count++; in handle_read_event_rsp()
3581 } else if (!intf->event_msg_printed) { in handle_read_event_rsp()
3588 intf->event_msg_printed = 1; in handle_read_event_rsp()
3592 spin_unlock_irqrestore(&(intf->events_lock), flags); in handle_read_event_rsp()
3597 static int handle_bmc_rsp(ipmi_smi_t intf, in handle_bmc_rsp() argument
3617 ipmi_inc_stat(intf, unhandled_local_responses); in handle_bmc_rsp()
3622 ipmi_inc_stat(intf, handled_local_responses); in handle_bmc_rsp()
3648 static int handle_one_recv_msg(ipmi_smi_t intf, in handle_one_recv_msg() argument
3737 if (intf->curr_channel < IPMI_MAX_CHANNELS) { in handle_one_recv_msg()
3742 switch (intf->channels[chan].medium) { in handle_one_recv_msg()
3749 requeue = handle_ipmb_get_msg_rsp(intf, msg); in handle_one_recv_msg()
3755 requeue = handle_ipmb_get_msg_cmd(intf, msg); in handle_one_recv_msg()
3766 requeue = handle_lan_get_msg_rsp(intf, msg); in handle_one_recv_msg()
3772 requeue = handle_lan_get_msg_cmd(intf, msg); in handle_one_recv_msg()
3779 if ((intf->channels[chan].medium in handle_one_recv_msg()
3781 && (intf->channels[chan].medium in handle_one_recv_msg()
3783 requeue = handle_oem_get_msg_cmd(intf, msg); in handle_one_recv_msg()
3796 requeue = handle_read_event_rsp(intf, msg); in handle_one_recv_msg()
3799 requeue = handle_bmc_rsp(intf, msg); in handle_one_recv_msg()
3809 static void handle_new_recv_msgs(ipmi_smi_t intf) in handle_new_recv_msgs() argument
3814 int run_to_completion = intf->run_to_completion; in handle_new_recv_msgs()
3818 spin_lock_irqsave(&intf->waiting_rcv_msgs_lock, flags); in handle_new_recv_msgs()
3819 while (!list_empty(&intf->waiting_rcv_msgs)) { in handle_new_recv_msgs()
3820 smi_msg = list_entry(intf->waiting_rcv_msgs.next, in handle_new_recv_msgs()
3824 spin_unlock_irqrestore(&intf->waiting_rcv_msgs_lock, in handle_new_recv_msgs()
3826 rv = handle_one_recv_msg(intf, smi_msg); in handle_new_recv_msgs()
3828 spin_lock_irqsave(&intf->waiting_rcv_msgs_lock, flags); in handle_new_recv_msgs()
3837 list_add(&smi_msg->link, &intf->waiting_rcv_msgs); in handle_new_recv_msgs()
3847 spin_unlock_irqrestore(&intf->waiting_rcv_msgs_lock, flags); in handle_new_recv_msgs()
3853 if (atomic_add_unless(&intf->watchdog_pretimeouts_to_deliver, -1, 0)) { in handle_new_recv_msgs()
3857 list_for_each_entry_rcu(user, &intf->users, link) { in handle_new_recv_msgs()
3869 ipmi_smi_t intf = (ipmi_smi_t) val; in smi_recv_tasklet() local
3870 int run_to_completion = intf->run_to_completion; in smi_recv_tasklet()
3884 spin_lock_irqsave(&intf->xmit_msgs_lock, flags); in smi_recv_tasklet()
3885 if (intf->curr_msg == NULL && !intf->in_shutdown) { in smi_recv_tasklet()
3889 if (!list_empty(&intf->hp_xmit_msgs)) in smi_recv_tasklet()
3890 entry = intf->hp_xmit_msgs.next; in smi_recv_tasklet()
3891 else if (!list_empty(&intf->xmit_msgs)) in smi_recv_tasklet()
3892 entry = intf->xmit_msgs.next; in smi_recv_tasklet()
3897 intf->curr_msg = newmsg; in smi_recv_tasklet()
3901 spin_unlock_irqrestore(&intf->xmit_msgs_lock, flags); in smi_recv_tasklet()
3903 intf->handlers->sender(intf->send_info, newmsg); in smi_recv_tasklet()
3907 handle_new_recv_msgs(intf); in smi_recv_tasklet()
3911 void ipmi_smi_msg_received(ipmi_smi_t intf, in ipmi_smi_msg_received() argument
3915 int run_to_completion = intf->run_to_completion; in ipmi_smi_msg_received()
3922 if (intf->in_shutdown) in ipmi_smi_msg_received()
3948 else if ((intf->channels[chan].medium in ipmi_smi_msg_received()
3950 || (intf->channels[chan].medium in ipmi_smi_msg_received()
3952 ipmi_inc_stat(intf, sent_lan_command_errs); in ipmi_smi_msg_received()
3954 ipmi_inc_stat(intf, sent_ipmb_command_errs); in ipmi_smi_msg_received()
3955 intf_err_seq(intf, msg->msgid, msg->rsp[2]); in ipmi_smi_msg_received()
3958 intf_start_seq_timer(intf, msg->msgid); in ipmi_smi_msg_received()
3968 spin_lock_irqsave(&intf->waiting_rcv_msgs_lock, flags); in ipmi_smi_msg_received()
3969 list_add_tail(&msg->link, &intf->waiting_rcv_msgs); in ipmi_smi_msg_received()
3971 spin_unlock_irqrestore(&intf->waiting_rcv_msgs_lock, in ipmi_smi_msg_received()
3976 spin_lock_irqsave(&intf->xmit_msgs_lock, flags); in ipmi_smi_msg_received()
3981 if (msg == intf->curr_msg) in ipmi_smi_msg_received()
3982 intf->curr_msg = NULL; in ipmi_smi_msg_received()
3984 spin_unlock_irqrestore(&intf->xmit_msgs_lock, flags); in ipmi_smi_msg_received()
3987 smi_recv_tasklet((unsigned long) intf); in ipmi_smi_msg_received()
3989 tasklet_schedule(&intf->recv_tasklet); in ipmi_smi_msg_received()
3993 void ipmi_smi_watchdog_pretimeout(ipmi_smi_t intf) in ipmi_smi_watchdog_pretimeout() argument
3995 if (intf->in_shutdown) in ipmi_smi_watchdog_pretimeout()
3998 atomic_set(&intf->watchdog_pretimeouts_to_deliver, 1); in ipmi_smi_watchdog_pretimeout()
3999 tasklet_schedule(&intf->recv_tasklet); in ipmi_smi_watchdog_pretimeout()
4004 smi_from_recv_msg(ipmi_smi_t intf, struct ipmi_recv_msg *recv_msg, in smi_from_recv_msg() argument
4031 static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent, in check_msg_timeout() argument
4040 if (intf->in_shutdown) in check_msg_timeout()
4058 ipmi_inc_stat(intf, timed_out_ipmb_broadcasts); in check_msg_timeout()
4060 ipmi_inc_stat(intf, timed_out_lan_commands); in check_msg_timeout()
4062 ipmi_inc_stat(intf, timed_out_ipmb_commands); in check_msg_timeout()
4075 smi_msg = smi_from_recv_msg(intf, ent->recv_msg, slot, in check_msg_timeout()
4079 ipmi_inc_stat(intf, in check_msg_timeout()
4082 ipmi_inc_stat(intf, in check_msg_timeout()
4087 spin_unlock_irqrestore(&intf->seq_lock, *flags); in check_msg_timeout()
4096 handlers = intf->handlers; in check_msg_timeout()
4099 ipmi_inc_stat(intf, in check_msg_timeout()
4102 ipmi_inc_stat(intf, in check_msg_timeout()
4105 smi_send(intf, handlers, smi_msg, 0); in check_msg_timeout()
4109 spin_lock_irqsave(&intf->seq_lock, *flags); in check_msg_timeout()
4113 static unsigned int ipmi_timeout_handler(ipmi_smi_t intf, in ipmi_timeout_handler() argument
4128 spin_lock_irqsave(&intf->seq_lock, flags); in ipmi_timeout_handler()
4130 check_msg_timeout(intf, &(intf->seq_table[i]), in ipmi_timeout_handler()
4133 spin_unlock_irqrestore(&intf->seq_lock, flags); in ipmi_timeout_handler()
4146 if (intf->auto_maintenance_timeout > 0) { in ipmi_timeout_handler()
4147 spin_lock_irqsave(&intf->maintenance_mode_lock, flags); in ipmi_timeout_handler()
4148 if (intf->auto_maintenance_timeout > 0) { in ipmi_timeout_handler()
4149 intf->auto_maintenance_timeout in ipmi_timeout_handler()
4151 if (!intf->maintenance_mode in ipmi_timeout_handler()
4152 && (intf->auto_maintenance_timeout <= 0)) { in ipmi_timeout_handler()
4153 intf->maintenance_mode_enable = false; in ipmi_timeout_handler()
4154 maintenance_mode_update(intf); in ipmi_timeout_handler()
4157 spin_unlock_irqrestore(&intf->maintenance_mode_lock, in ipmi_timeout_handler()
4161 tasklet_schedule(&intf->recv_tasklet); in ipmi_timeout_handler()
4166 static void ipmi_request_event(ipmi_smi_t intf) in ipmi_request_event() argument
4169 if (intf->maintenance_mode_enable) in ipmi_request_event()
4172 if (!intf->in_shutdown) in ipmi_request_event()
4173 intf->handlers->request_events(intf->send_info); in ipmi_request_event()
4182 ipmi_smi_t intf; in ipmi_timeout() local
4189 list_for_each_entry_rcu(intf, &ipmi_interfaces, link) { in ipmi_timeout()
4192 if (atomic_read(&intf->event_waiters)) { in ipmi_timeout()
4193 intf->ticks_to_req_ev--; in ipmi_timeout()
4194 if (intf->ticks_to_req_ev == 0) { in ipmi_timeout()
4195 ipmi_request_event(intf); in ipmi_timeout()
4196 intf->ticks_to_req_ev = IPMI_REQUEST_EV_TIME; in ipmi_timeout()
4201 lnt += ipmi_timeout_handler(intf, IPMI_TIMEOUT_TIME); in ipmi_timeout()
4204 if (lnt != intf->last_needs_timer && in ipmi_timeout()
4205 intf->handlers->set_need_watch) in ipmi_timeout()
4206 intf->handlers->set_need_watch(intf->send_info, lnt); in ipmi_timeout()
4207 intf->last_needs_timer = lnt; in ipmi_timeout()
4217 static void need_waiter(ipmi_smi_t intf) in need_waiter() argument
4290 static void ipmi_panic_request_and_wait(ipmi_smi_t intf, in ipmi_panic_request_and_wait() argument
4302 intf, in ipmi_panic_request_and_wait()
4306 intf, in ipmi_panic_request_and_wait()
4310 intf->channels[0].address, in ipmi_panic_request_and_wait()
4311 intf->channels[0].lun, in ipmi_panic_request_and_wait()
4315 else if (intf->handlers->flush_messages) in ipmi_panic_request_and_wait()
4316 intf->handlers->flush_messages(intf->send_info); in ipmi_panic_request_and_wait()
4319 ipmi_poll(intf); in ipmi_panic_request_and_wait()
4323 static void event_receiver_fetcher(ipmi_smi_t intf, struct ipmi_recv_msg *msg) in event_receiver_fetcher() argument
4330 intf->event_receiver = msg->msg.data[1]; in event_receiver_fetcher()
4331 intf->event_receiver_lun = msg->msg.data[2] & 0x3; in event_receiver_fetcher()
4335 static void device_id_fetcher(ipmi_smi_t intf, struct ipmi_recv_msg *msg) in device_id_fetcher() argument
4345 intf->local_sel_device = (msg->msg.data[6] >> 2) & 1; in device_id_fetcher()
4346 intf->local_event_generator = (msg->msg.data[6] >> 5) & 1; in device_id_fetcher()
4354 ipmi_smi_t intf; in send_panic_events() local
4386 list_for_each_entry_rcu(intf, &ipmi_interfaces, link) { in send_panic_events()
4387 if (!intf->handlers) in send_panic_events()
4392 ipmi_panic_request_and_wait(intf, &addr, &msg); in send_panic_events()
4404 list_for_each_entry_rcu(intf, &ipmi_interfaces, link) { in send_panic_events()
4409 if (intf->intf_num == -1) in send_panic_events()
4430 intf->local_sel_device = 0; in send_panic_events()
4431 intf->local_event_generator = 0; in send_panic_events()
4432 intf->event_receiver = 0; in send_panic_events()
4439 intf->null_user_handler = device_id_fetcher; in send_panic_events()
4440 ipmi_panic_request_and_wait(intf, &addr, &msg); in send_panic_events()
4442 if (intf->local_event_generator) { in send_panic_events()
4448 intf->null_user_handler = event_receiver_fetcher; in send_panic_events()
4449 ipmi_panic_request_and_wait(intf, &addr, &msg); in send_panic_events()
4451 intf->null_user_handler = NULL; in send_panic_events()
4458 if (((intf->event_receiver & 1) == 0) in send_panic_events()
4459 && (intf->event_receiver != 0) in send_panic_events()
4460 && (intf->event_receiver != intf->channels[0].address)) { in send_panic_events()
4468 ipmb->lun = intf->event_receiver_lun; in send_panic_events()
4469 ipmb->slave_addr = intf->event_receiver; in send_panic_events()
4470 } else if (intf->local_sel_device) { in send_panic_events()
4497 data[3] = intf->channels[0].address; in send_panic_events()
4506 ipmi_panic_request_and_wait(intf, &addr, &msg); in send_panic_events()
4519 ipmi_smi_t intf; in panic_event() local
4526 list_for_each_entry_rcu(intf, &ipmi_interfaces, link) { in panic_event()
4527 if (!intf->handlers) in panic_event()
4537 if (!spin_trylock(&intf->xmit_msgs_lock)) { in panic_event()
4538 INIT_LIST_HEAD(&intf->xmit_msgs); in panic_event()
4539 INIT_LIST_HEAD(&intf->hp_xmit_msgs); in panic_event()
4541 spin_unlock(&intf->xmit_msgs_lock); in panic_event()
4543 if (!spin_trylock(&intf->waiting_rcv_msgs_lock)) in panic_event()
4544 INIT_LIST_HEAD(&intf->waiting_rcv_msgs); in panic_event()
4546 spin_unlock(&intf->waiting_rcv_msgs_lock); in panic_event()
4548 intf->run_to_completion = 1; in panic_event()
4549 intf->handlers->set_run_to_completion(intf->send_info, 1); in panic_event()