Lines Matching +full:multi +full:- +full:attr

1 // SPDX-License-Identifier: GPL-2.0+
12 * non-blocking I2C interface, add support for multi-part
63 /* ssif_debug is a bit-field
64 * SSIF_DEBUG_MSG - commands and their responses
65 * SSIF_DEBUG_STATES - message states
66 * SSIF_DEBUG_TIMING - Measure times between events in the driver
103 /* FIXME - add watchdog stuff. */
106 #define IS_SSIF_IDLE(ssif) ((ssif)->ssif_state == SSIF_IDLE \
107 && (ssif)->curr_msg == NULL)
293 atomic_inc(&(ssif)->stats[SSIF_STAT_ ## stat])
295 ((unsigned int) atomic_read(&(ssif)->stats[SSIF_STAT_ ## stat]))
309 __acquires(&ssif_info->lock) in ipmi_ssif_lock_cond()
311 spin_lock_irqsave(&ssif_info->lock, *flags); in ipmi_ssif_lock_cond()
317 __releases(&ssif_info->lock) in ipmi_ssif_unlock_cond()
319 spin_unlock_irqrestore(&ssif_info->lock, *flags); in ipmi_ssif_unlock_cond()
325 if (msg->rsp_size < 0) { in deliver_recv_msg()
327 dev_err(&ssif_info->client->dev, in deliver_recv_msg()
329 __func__, msg->rsp_size); in deliver_recv_msg()
331 ipmi_smi_msg_received(ssif_info->intf, msg); in deliver_recv_msg()
341 msg->rsp[0] = msg->data[0] | 4; in return_hosed_msg()
342 msg->rsp[1] = msg->data[1]; in return_hosed_msg()
343 msg->rsp[2] = 0xFF; /* Unknown error. */ in return_hosed_msg()
344 msg->rsp_size = 3; in return_hosed_msg()
359 ssif_info->msg_flags &= ~WDT_PRE_TIMEOUT_INT; in start_clear_flags()
360 ssif_info->ssif_state = SSIF_CLEARING_FLAGS; in start_clear_flags()
363 /* Make sure the watchdog pre-timeout flag is not set at startup. */ in start_clear_flags()
370 ssif_info->ssif_state = SSIF_IDLE; in start_clear_flags()
378 ssif_info->req_flags = false; in start_flag_fetch()
379 ssif_info->ssif_state = SSIF_GETTING_FLAGS; in start_flag_fetch()
385 ssif_info->ssif_state = SSIF_IDLE; in start_flag_fetch()
391 if (start_send(ssif_info, msg->data, msg->data_size) != 0) { in check_start_send()
395 ssif_info->curr_msg = NULL; in check_start_send()
396 ssif_info->ssif_state = SSIF_IDLE; in check_start_send()
406 ssif_info->req_events = false; in start_event_fetch()
410 ssif_info->ssif_state = SSIF_IDLE; in start_event_fetch()
415 ssif_info->curr_msg = msg; in start_event_fetch()
416 ssif_info->ssif_state = SSIF_GETTING_EVENTS; in start_event_fetch()
419 msg->data[0] = (IPMI_NETFN_APP_REQUEST << 2); in start_event_fetch()
420 msg->data[1] = IPMI_READ_EVENT_MSG_BUFFER_CMD; in start_event_fetch()
421 msg->data_size = 2; in start_event_fetch()
433 ssif_info->ssif_state = SSIF_IDLE; in start_recv_msg_fetch()
438 ssif_info->curr_msg = msg; in start_recv_msg_fetch()
439 ssif_info->ssif_state = SSIF_GETTING_MESSAGES; in start_recv_msg_fetch()
442 msg->data[0] = (IPMI_NETFN_APP_REQUEST << 2); in start_recv_msg_fetch()
443 msg->data[1] = IPMI_GET_MSG_CMD; in start_recv_msg_fetch()
444 msg->data_size = 2; in start_recv_msg_fetch()
457 if (ssif_info->msg_flags & WDT_PRE_TIMEOUT_INT) { in handle_flags()
458 /* Watchdog pre-timeout */ in handle_flags()
461 ipmi_smi_watchdog_pretimeout(ssif_info->intf); in handle_flags()
462 } else if (ssif_info->msg_flags & RECEIVE_MSG_AVAIL) in handle_flags()
465 else if (ssif_info->msg_flags & EVENT_MSG_BUFFER_FULL) in handle_flags()
469 ssif_info->ssif_state = SSIF_IDLE; in handle_flags()
483 &ssif_info->wake_thread); in ipmi_ssif_thread()
484 if (ssif_info->stopping) in ipmi_ssif_thread()
486 if (result == -ERESTARTSYS) in ipmi_ssif_thread()
488 init_completion(&ssif_info->wake_thread); in ipmi_ssif_thread()
490 if (ssif_info->i2c_read_write == I2C_SMBUS_WRITE) { in ipmi_ssif_thread()
492 ssif_info->client, ssif_info->i2c_command, in ipmi_ssif_thread()
493 ssif_info->i2c_data[0], in ipmi_ssif_thread()
494 ssif_info->i2c_data + 1); in ipmi_ssif_thread()
495 ssif_info->done_handler(ssif_info, result, NULL, 0); in ipmi_ssif_thread()
498 ssif_info->client, ssif_info->i2c_command, in ipmi_ssif_thread()
499 ssif_info->i2c_data); in ipmi_ssif_thread()
501 ssif_info->done_handler(ssif_info, result, in ipmi_ssif_thread()
504 ssif_info->done_handler(ssif_info, 0, in ipmi_ssif_thread()
505 ssif_info->i2c_data, in ipmi_ssif_thread()
518 ssif_info->done_handler = handler; in ssif_i2c_send()
520 ssif_info->i2c_read_write = read_write; in ssif_i2c_send()
521 ssif_info->i2c_command = command; in ssif_i2c_send()
522 ssif_info->i2c_data = data; in ssif_i2c_send()
523 ssif_info->i2c_size = size; in ssif_i2c_send()
524 complete(&ssif_info->wake_thread); in ssif_i2c_send()
533 ssif_info->multi_pos = 0; in start_get()
537 ssif_info->recv, I2C_SMBUS_BLOCK_DATA); in start_get()
548 if (ssif_info->stopping) in retry_timeout()
552 resend = ssif_info->do_resend; in retry_timeout()
553 ssif_info->do_resend = false; in retry_timeout()
554 waiting = ssif_info->waiting_alert; in retry_timeout()
555 ssif_info->waiting_alert = false; in retry_timeout()
571 if (ssif_info->stopping) in watch_timeout()
575 if (ssif_info->watch_timeout) { in watch_timeout()
576 mod_timer(&ssif_info->watch_timer, in watch_timeout()
577 jiffies + ssif_info->watch_timeout); in watch_timeout()
582 ssif_info->req_flags = true; in watch_timeout()
600 if (ssif_info->waiting_alert) { in ssif_alert()
601 ssif_info->waiting_alert = false; in ssif_alert()
602 del_timer(&ssif_info->retry_timer); in ssif_alert()
604 } else if (ssif_info->curr_msg) { in ssif_alert()
605 ssif_info->got_alert = true; in ssif_alert()
619 * We are single-threaded here, so no need for a lock until we in msg_done_handler()
624 ssif_info->retries_left--; in msg_done_handler()
625 if (ssif_info->retries_left > 0) { in msg_done_handler()
629 ssif_info->waiting_alert = true; in msg_done_handler()
630 if (!ssif_info->stopping) in msg_done_handler()
631 mod_timer(&ssif_info->retry_timer, in msg_done_handler()
639 if (ssif_info->ssif_debug & SSIF_DEBUG_MSG) in msg_done_handler()
640 dev_dbg(&ssif_info->client->dev, in msg_done_handler()
646 if ((len > 1) && (ssif_info->multi_pos == 0) in msg_done_handler()
648 /* Start of multi-part read. Start the next transaction. */ in msg_done_handler()
653 /* Remove the multi-part read marker. */ in msg_done_handler()
654 len -= 2; in msg_done_handler()
657 ssif_info->data[i] = data[i]; in msg_done_handler()
658 ssif_info->multi_len = len; in msg_done_handler()
659 ssif_info->multi_pos = 1; in msg_done_handler()
663 ssif_info->recv, I2C_SMBUS_BLOCK_DATA); in msg_done_handler()
665 } else if (ssif_info->multi_pos) { in msg_done_handler()
666 /* Middle of multi-part read. Start the next transaction. */ in msg_done_handler()
671 result = -EIO; in msg_done_handler()
672 if (ssif_info->ssif_debug & SSIF_DEBUG_MSG) in msg_done_handler()
673 dev_dbg(&ssif_info->client->dev, in msg_done_handler()
680 len--; in msg_done_handler()
685 result = -EIO; in msg_done_handler()
686 if (ssif_info->ssif_debug & SSIF_DEBUG_MSG) in msg_done_handler()
687 dev_dbg(&ssif_info->client->dev, in msg_done_handler()
693 if (ssif_info->multi_len + len > IPMI_MAX_MSG_LENGTH) { in msg_done_handler()
695 result = -E2BIG; in msg_done_handler()
696 if (ssif_info->ssif_debug & SSIF_DEBUG_MSG) in msg_done_handler()
697 dev_dbg(&ssif_info->client->dev, in msg_done_handler()
704 ssif_info->data[i + ssif_info->multi_len] = data[i]; in msg_done_handler()
705 ssif_info->multi_len += len; in msg_done_handler()
708 len = ssif_info->multi_len; in msg_done_handler()
709 data = ssif_info->data; in msg_done_handler()
710 } else if (blocknum + 1 != ssif_info->multi_pos) { in msg_done_handler()
716 if (ssif_info->ssif_debug & SSIF_DEBUG_MSG) in msg_done_handler()
717 dev_dbg(&ssif_info->client->dev, in msg_done_handler()
719 ssif_info->multi_pos - 1, blocknum); in msg_done_handler()
720 result = -EIO; in msg_done_handler()
724 ssif_info->multi_pos++; in msg_done_handler()
729 ssif_info->recv, in msg_done_handler()
743 if (ssif_info->ssif_debug & SSIF_DEBUG_STATE) in msg_done_handler()
744 dev_dbg(&ssif_info->client->dev, in msg_done_handler()
746 ssif_info->ssif_state, result); in msg_done_handler()
749 msg = ssif_info->curr_msg; in msg_done_handler()
754 memcpy(msg->rsp, data, len); in msg_done_handler()
758 msg->rsp_size = len; in msg_done_handler()
759 ssif_info->curr_msg = NULL; in msg_done_handler()
762 switch (ssif_info->ssif_state) { in msg_done_handler()
781 ssif_info->ssif_state = SSIF_IDLE; in msg_done_handler()
783 dev_warn(&ssif_info->client->dev, in msg_done_handler()
791 ssif_info->ssif_state = SSIF_IDLE; in msg_done_handler()
793 dev_warn(&ssif_info->client->dev, in msg_done_handler()
798 ssif_info->msg_flags = data[3]; in msg_done_handler()
807 dev_warn(&ssif_info->client->dev, in msg_done_handler()
812 dev_warn(&ssif_info->client->dev, in msg_done_handler()
816 ssif_info->ssif_state = SSIF_IDLE; in msg_done_handler()
823 dev_warn(&ssif_info->client->dev, in msg_done_handler()
829 if ((result < 0) || (len < 3) || (msg->rsp[2] != 0)) { in msg_done_handler()
831 msg->done(msg); in msg_done_handler()
834 ssif_info->msg_flags &= ~EVENT_MSG_BUFFER_FULL; in msg_done_handler()
836 } else if (msg->rsp[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2 in msg_done_handler()
837 || msg->rsp[1] != IPMI_READ_EVENT_MSG_BUFFER_CMD) { in msg_done_handler()
838 dev_warn(&ssif_info->client->dev, in msg_done_handler()
840 msg->rsp[0], msg->rsp[1]); in msg_done_handler()
841 msg->done(msg); in msg_done_handler()
843 ssif_info->msg_flags &= ~EVENT_MSG_BUFFER_FULL; in msg_done_handler()
855 dev_warn(&ssif_info->client->dev, in msg_done_handler()
861 if ((result < 0) || (len < 3) || (msg->rsp[2] != 0)) { in msg_done_handler()
863 msg->done(msg); in msg_done_handler()
866 ssif_info->msg_flags &= ~RECEIVE_MSG_AVAIL; in msg_done_handler()
868 } else if (msg->rsp[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2 in msg_done_handler()
869 || msg->rsp[1] != IPMI_GET_MSG_CMD) { in msg_done_handler()
870 dev_warn(&ssif_info->client->dev, in msg_done_handler()
872 msg->rsp[0], msg->rsp[1]); in msg_done_handler()
873 msg->done(msg); in msg_done_handler()
876 ssif_info->msg_flags &= ~RECEIVE_MSG_AVAIL; in msg_done_handler()
887 dev_warn(&ssif_info->client->dev, in msg_done_handler()
889 ssif_info->ssif_state); in msg_done_handler()
894 if (IS_SSIF_IDLE(ssif_info) && !ssif_info->stopping) { in msg_done_handler()
895 if (ssif_info->req_events) in msg_done_handler()
897 else if (ssif_info->req_flags) in msg_done_handler()
904 if (ssif_info->ssif_debug & SSIF_DEBUG_STATE) in msg_done_handler()
905 dev_dbg(&ssif_info->client->dev, in msg_done_handler()
906 "DONE 2: state = %d.\n", ssif_info->ssif_state); in msg_done_handler()
912 /* We are single-threaded here, so no need for a lock. */ in msg_written_handler()
914 ssif_info->retries_left--; in msg_written_handler()
915 if (ssif_info->retries_left > 0) { in msg_written_handler()
920 ssif_info->do_resend = true; in msg_written_handler()
921 mod_timer(&ssif_info->retry_timer, in msg_written_handler()
928 if (ssif_info->ssif_debug & SSIF_DEBUG_MSG) in msg_written_handler()
929 dev_dbg(&ssif_info->client->dev, in msg_written_handler()
932 msg_done_handler(ssif_info, -EIO, NULL, 0); in msg_written_handler()
936 if (ssif_info->multi_data) { in msg_written_handler()
938 * In the middle of a multi-data write. See the comment in msg_written_handler()
948 left = ssif_info->multi_len - ssif_info->multi_pos; in msg_written_handler()
953 ssif_info->multi_data[ssif_info->multi_pos] = to_write; in msg_written_handler()
954 data_to_send = ssif_info->multi_data + ssif_info->multi_pos; in msg_written_handler()
955 ssif_info->multi_pos += to_write; in msg_written_handler()
957 if (ssif_info->cmd8_works) { in msg_written_handler()
960 ssif_info->multi_data = NULL; in msg_written_handler()
963 ssif_info->multi_data = NULL; in msg_written_handler()
977 if (ssif_info->got_alert) { in msg_written_handler()
979 ssif_info->got_alert = false; in msg_written_handler()
984 ssif_info->waiting_alert = true; in msg_written_handler()
985 ssif_info->retries_left = SSIF_RECV_RETRIES; in msg_written_handler()
986 if (!ssif_info->stopping) in msg_written_handler()
987 mod_timer(&ssif_info->retry_timer, in msg_written_handler()
998 ssif_info->got_alert = false; in start_resend()
1000 if (ssif_info->data_len > 32) { in start_resend()
1002 ssif_info->multi_data = ssif_info->data; in start_resend()
1003 ssif_info->multi_len = ssif_info->data_len; in start_resend()
1009 ssif_info->multi_pos = 32; in start_resend()
1010 ssif_info->data[0] = 32; in start_resend()
1012 ssif_info->multi_data = NULL; in start_resend()
1014 ssif_info->data[0] = ssif_info->data_len; in start_resend()
1018 command, ssif_info->data, I2C_SMBUS_BLOCK_DATA); in start_resend()
1026 return -E2BIG; in start_send()
1027 if (len > ssif_info->max_xmit_msg_size) in start_send()
1028 return -E2BIG; in start_send()
1030 ssif_info->retries_left = SSIF_SEND_RETRIES; in start_send()
1031 memcpy(ssif_info->data + 1, data, len); in start_send()
1032 ssif_info->data_len = len; in start_send()
1049 if (!ssif_info->waiting_msg) { in start_next_msg()
1050 ssif_info->curr_msg = NULL; in start_next_msg()
1055 ssif_info->curr_msg = ssif_info->waiting_msg; in start_next_msg()
1056 ssif_info->waiting_msg = NULL; in start_next_msg()
1059 ssif_info->curr_msg->data, in start_next_msg()
1060 ssif_info->curr_msg->data_size); in start_next_msg()
1062 msg = ssif_info->curr_msg; in start_next_msg()
1063 ssif_info->curr_msg = NULL; in start_next_msg()
1077 BUG_ON(ssif_info->waiting_msg); in sender()
1078 ssif_info->waiting_msg = msg; in sender()
1083 if (ssif_info->ssif_debug & SSIF_DEBUG_TIMING) { in sender()
1087 dev_dbg(&ssif_info->client->dev, in sender()
1089 msg->data[0], msg->data[1], in sender()
1098 data->addr_src = ssif_info->addr_source; in get_smi_info()
1099 data->dev = &ssif_info->client->dev; in get_smi_info()
1100 data->addr_info = ssif_info->addr_info; in get_smi_info()
1101 get_device(data->dev); in get_smi_info()
1114 if (!ssif_info->has_event_buffer) in request_events()
1118 ssif_info->req_events = true; in request_events()
1138 if (timeout != ssif_info->watch_timeout) { in ssif_set_need_watch()
1139 ssif_info->watch_timeout = timeout; in ssif_set_need_watch()
1140 if (ssif_info->watch_timeout) in ssif_set_need_watch()
1141 mod_timer(&ssif_info->watch_timer, in ssif_set_need_watch()
1142 jiffies + ssif_info->watch_timeout); in ssif_set_need_watch()
1152 ssif_info->intf = intf; in ssif_start_processing()
1206 struct device_attribute *attr, \
1216 struct device_attribute *attr, in ipmi_type_show() argument
1238 &dev_attr_type.attr,
1239 &dev_attr_sent_messages.attr,
1240 &dev_attr_sent_messages_parts.attr,
1241 &dev_attr_send_retries.attr,
1242 &dev_attr_send_errors.attr,
1243 &dev_attr_received_messages.attr,
1244 &dev_attr_received_message_parts.attr,
1245 &dev_attr_receive_retries.attr,
1246 &dev_attr_receive_errors.attr,
1247 &dev_attr_flag_fetches.attr,
1248 &dev_attr_hosed.attr,
1249 &dev_attr_events.attr,
1250 &dev_attr_watchdog_pretimeouts.attr,
1251 &dev_attr_alerts.attr,
1263 device_remove_group(&ssif_info->client->dev, &ipmi_ssif_dev_attr_group); in shutdown_ssif()
1264 dev_set_drvdata(&ssif_info->client->dev, NULL); in shutdown_ssif()
1267 while (ssif_info->ssif_state != SSIF_IDLE) in shutdown_ssif()
1270 ssif_info->stopping = true; in shutdown_ssif()
1271 del_timer_sync(&ssif_info->watch_timer); in shutdown_ssif()
1272 del_timer_sync(&ssif_info->retry_timer); in shutdown_ssif()
1273 if (ssif_info->thread) { in shutdown_ssif()
1274 complete(&ssif_info->wake_thread); in shutdown_ssif()
1275 kthread_stop(ssif_info->thread); in shutdown_ssif()
1288 ipmi_unregister_smi(ssif_info->intf); in ssif_remove()
1291 if (addr_info->client == client) { in ssif_remove()
1292 addr_info->client = NULL; in ssif_remove()
1302 int ret = -ENODEV, retry_cnt = SSIF_RECV_RETRIES; in read_response()
1310 retry_cnt--; in read_response()
1328 retry_cnt--; in do_cmd()
1333 return -ENODEV; in do_cmd()
1342 ret = -EINVAL; in do_cmd()
1344 ret = -E2BIG; in do_cmd()
1363 return -ENOMEM; in ssif_detect()
1370 rv = -ENODEV; in ssif_detect()
1372 strscpy(info->type, DEVICE_NAME, I2C_NAME_SIZE); in ssif_detect()
1387 return -1; in strcmp_nospace()
1402 if (info->binfo.addr == addr) { in ssif_info_find()
1403 if (info->addr_src == SI_SMBIOS && !info->adapter_name) in ssif_info_find()
1404 info->adapter_name = kstrdup(adapter_name, in ssif_info_find()
1407 if (info->adapter_name || adapter_name) { in ssif_info_find()
1408 if (!info->adapter_name != !adapter_name) { in ssif_info_find()
1413 strcmp_nospace(info->adapter_name, in ssif_info_find()
1440 ssif_info->addr_source = SI_ACPI; in check_acpi()
1441 ssif_info->addr_info.acpi_info.acpi_handle = acpi_handle; in check_acpi()
1455 i2c_adapter_id(client->adapter), in find_slave_address()
1456 client->addr); in find_slave_address()
1472 retry_cnt--; in start_multipart_test()
1477 …dev_err(&client->dev, "Could not write multi-part start, though the BMC said it could handle it. … in start_multipart_test()
1488 …dev_err(&client->dev, "Could not write multi-part middle, though the BMC said it could handle it. … in start_multipart_test()
1503 if (ssif_info->max_xmit_msg_size <= 32) in test_multipart_messages()
1506 do_middle = ssif_info->max_xmit_msg_size > 63; in test_multipart_messages()
1514 * multi-part messages. Per what the specification says, it in test_multipart_messages()
1528 * implement cmd=8, they use a zero-length end transaction, in test_multipart_messages()
1532 * If it does, then we use that. If not, it tests zero- in test_multipart_messages()
1534 * we only allow 63-byte transactions max. in test_multipart_messages()
1550 ssif_info->cmd8_works = true; in test_multipart_messages()
1556 dev_err(&client->dev, "Second multipart test failed.\n"); in test_multipart_messages()
1566 /* Zero-size end parts work, use those. */ in test_multipart_messages()
1570 if (ssif_info->max_xmit_msg_size > 63) in test_multipart_messages()
1571 ssif_info->max_xmit_msg_size = 63; in test_multipart_messages()
1575 ssif_info->max_xmit_msg_size = 32; in test_multipart_messages()
1589 ipmi_unregister_smi(ssif_info->intf); in ssif_remove_dup()
1599 return -ENOMEM; in ssif_add_infos()
1600 info->addr_src = SI_ACPI; in ssif_add_infos()
1601 info->client = client; in ssif_add_infos()
1602 info->adapter_name = kstrdup(client->adapter->name, GFP_KERNEL); in ssif_add_infos()
1603 if (!info->adapter_name) { in ssif_add_infos()
1605 return -ENOMEM; in ssif_add_infos()
1608 info->binfo.addr = client->addr; in ssif_add_infos()
1609 list_add_tail(&info->link, &ssif_infos); in ssif_add_infos()
1624 if (!info->client) in ssif_check_and_remove()
1626 if (!strcmp(info->adapter_name, client->adapter->name) && in ssif_check_and_remove()
1627 info->binfo.addr == client->addr) { in ssif_check_and_remove()
1628 if (info->addr_src == SI_ACPI) in ssif_check_and_remove()
1629 return -EEXIST; in ssif_check_and_remove()
1631 if (ssif_info->addr_source == SI_ACPI && in ssif_check_and_remove()
1632 info->addr_src == SI_SMBIOS) { in ssif_check_and_remove()
1633 dev_info(&client->dev, in ssif_check_and_remove()
1634 "Removing %s-specified SSIF interface in favor of ACPI\n", in ssif_check_and_remove()
1635 ipmi_addr_src_to_str(info->addr_src)); in ssif_check_and_remove()
1636 ssif_remove_dup(info->client); in ssif_check_and_remove()
1659 return -ENOMEM; in ssif_probe()
1666 return -ENOMEM; in ssif_probe()
1669 if (!check_acpi(ssif_info, &client->dev)) { in ssif_probe()
1670 addr_info = ssif_info_find(client->addr, client->adapter->name, in ssif_probe()
1674 ssif_info->addr_source = SI_HOTMOD; in ssif_probe()
1676 ssif_info->addr_source = addr_info->addr_src; in ssif_probe()
1677 ssif_info->ssif_debug = addr_info->debug; in ssif_probe()
1678 ssif_info->addr_info = addr_info->addr_info; in ssif_probe()
1679 addr_info->client = client; in ssif_probe()
1680 slave_addr = addr_info->slave_addr; in ssif_probe()
1684 ssif_info->client = client; in ssif_probe()
1689 if (!rv && ssif_info->addr_source == SI_ACPI) { in ssif_probe()
1692 dev_err(&client->dev, "Out of memory!, exiting ..\n"); in ssif_probe()
1696 dev_err(&client->dev, "Not probing, Interface already present\n"); in ssif_probe()
1702 dev_info(&client->dev, in ssif_probe()
1703 "Trying %s-specified SSIF interface at i2c address 0x%x, adapter %s, slave address 0x%x\n", in ssif_probe()
1704 ipmi_addr_src_to_str(ssif_info->addr_source), in ssif_probe()
1705 client->addr, client->adapter->name, slave_addr); in ssif_probe()
1715 dev_dbg(&ssif_info->client->dev, in ssif_probe()
1721 ssif_info->max_xmit_msg_size = resp[5]; in ssif_probe()
1722 ssif_info->max_recv_msg_size = resp[6]; in ssif_probe()
1723 ssif_info->multi_support = (resp[4] >> 6) & 0x3; in ssif_probe()
1724 ssif_info->supports_pec = (resp[4] >> 3) & 0x1; in ssif_probe()
1727 switch (ssif_info->multi_support) { in ssif_probe()
1729 if (ssif_info->max_xmit_msg_size > 32) in ssif_probe()
1730 ssif_info->max_xmit_msg_size = 32; in ssif_probe()
1731 if (ssif_info->max_recv_msg_size > 32) in ssif_probe()
1732 ssif_info->max_recv_msg_size = 32; in ssif_probe()
1736 if (ssif_info->max_xmit_msg_size > 63) in ssif_probe()
1737 ssif_info->max_xmit_msg_size = 63; in ssif_probe()
1738 if (ssif_info->max_recv_msg_size > 62) in ssif_probe()
1739 ssif_info->max_recv_msg_size = 62; in ssif_probe()
1752 /* Assume no multi-part or PEC support */ in ssif_probe()
1753 dev_info(&ssif_info->client->dev, in ssif_probe()
1757 ssif_info->max_xmit_msg_size = 32; in ssif_probe()
1758 ssif_info->max_recv_msg_size = 32; in ssif_probe()
1759 ssif_info->multi_support = SSIF_NO_MULTI; in ssif_probe()
1760 ssif_info->supports_pec = 0; in ssif_probe()
1771 dev_warn(&ssif_info->client->dev, in ssif_probe()
1780 dev_warn(&ssif_info->client->dev, in ssif_probe()
1787 ssif_info->global_enables = resp[3]; in ssif_probe()
1790 ssif_info->has_event_buffer = true; in ssif_probe()
1797 msg[2] = ssif_info->global_enables | IPMI_BMC_EVT_MSG_BUFF; in ssif_probe()
1800 dev_warn(&ssif_info->client->dev, in ssif_probe()
1809 ssif_info->has_event_buffer = true; in ssif_probe()
1810 ssif_info->global_enables |= IPMI_BMC_EVT_MSG_BUFF; in ssif_probe()
1819 msg[2] = ssif_info->global_enables | IPMI_BMC_RCV_MSG_INTR; in ssif_probe()
1822 dev_warn(&ssif_info->client->dev, in ssif_probe()
1831 ssif_info->supports_alert = true; in ssif_probe()
1832 ssif_info->global_enables |= IPMI_BMC_RCV_MSG_INTR; in ssif_probe()
1837 dev_dbg(&ssif_info->client->dev, in ssif_probe()
1839 __func__, client->addr); in ssif_probe()
1842 spin_lock_init(&ssif_info->lock); in ssif_probe()
1843 ssif_info->ssif_state = SSIF_IDLE; in ssif_probe()
1844 timer_setup(&ssif_info->retry_timer, retry_timeout, 0); in ssif_probe()
1845 timer_setup(&ssif_info->watch_timer, watch_timeout, 0); in ssif_probe()
1848 atomic_set(&ssif_info->stats[i], 0); in ssif_probe()
1850 if (ssif_info->supports_pec) in ssif_probe()
1851 ssif_info->client->flags |= I2C_CLIENT_PEC; in ssif_probe()
1853 ssif_info->handlers.owner = THIS_MODULE; in ssif_probe()
1854 ssif_info->handlers.start_processing = ssif_start_processing; in ssif_probe()
1855 ssif_info->handlers.shutdown = shutdown_ssif; in ssif_probe()
1856 ssif_info->handlers.get_smi_info = get_smi_info; in ssif_probe()
1857 ssif_info->handlers.sender = sender; in ssif_probe()
1858 ssif_info->handlers.request_events = request_events; in ssif_probe()
1859 ssif_info->handlers.set_need_watch = ssif_set_need_watch; in ssif_probe()
1864 thread_num = ((i2c_adapter_id(ssif_info->client->adapter) in ssif_probe()
1866 ssif_info->client->addr); in ssif_probe()
1867 init_completion(&ssif_info->wake_thread); in ssif_probe()
1868 ssif_info->thread = kthread_run(ipmi_ssif_thread, ssif_info, in ssif_probe()
1870 if (IS_ERR(ssif_info->thread)) { in ssif_probe()
1871 rv = PTR_ERR(ssif_info->thread); in ssif_probe()
1872 dev_notice(&ssif_info->client->dev, in ssif_probe()
1879 dev_set_drvdata(&ssif_info->client->dev, ssif_info); in ssif_probe()
1880 rv = device_add_group(&ssif_info->client->dev, in ssif_probe()
1883 dev_err(&ssif_info->client->dev, in ssif_probe()
1889 rv = ipmi_register_smi(&ssif_info->handlers, in ssif_probe()
1891 &ssif_info->client->dev, in ssif_probe()
1894 dev_err(&ssif_info->client->dev, in ssif_probe()
1902 addr_info->client = NULL; in ssif_probe()
1904 dev_err(&ssif_info->client->dev, in ssif_probe()
1914 device_remove_group(&ssif_info->client->dev, &ipmi_ssif_dev_attr_group); in ssif_probe()
1915 dev_set_drvdata(&ssif_info->client->dev, NULL); in ssif_probe()
1929 rv = -EEXIST; in new_ssif_client()
1935 rv = -ENOMEM; in new_ssif_client()
1940 addr_info->adapter_name = kstrdup(adapter_name, GFP_KERNEL); in new_ssif_client()
1941 if (!addr_info->adapter_name) { in new_ssif_client()
1943 rv = -ENOMEM; in new_ssif_client()
1948 strncpy(addr_info->binfo.type, DEVICE_NAME, in new_ssif_client()
1949 sizeof(addr_info->binfo.type)); in new_ssif_client()
1950 addr_info->binfo.addr = addr; in new_ssif_client()
1951 addr_info->binfo.platform_data = addr_info; in new_ssif_client()
1952 addr_info->debug = debug; in new_ssif_client()
1953 addr_info->slave_addr = slave_addr; in new_ssif_client()
1954 addr_info->addr_src = addr_src; in new_ssif_client()
1955 addr_info->dev = dev; in new_ssif_client()
1960 list_add_tail(&addr_info->link, &ssif_infos); in new_ssif_client()
1975 list_del(&info->link); in free_ssif_clients()
1976 kfree(info->adapter_name); in free_ssif_clients()
1997 unsigned short addr = info->binfo.addr; in ssif_address_list()
2029 return -ENODEV; in dmi_ipmi_probe()
2031 rv = device_property_read_u16(&pdev->dev, "i2c-addr", &i2c_addr); in dmi_ipmi_probe()
2033 dev_warn(&pdev->dev, "No i2c-addr property\n"); in dmi_ipmi_probe()
2034 return -ENODEV; in dmi_ipmi_probe()
2037 rv = device_property_read_u8(&pdev->dev, "slave-addr", &slave_addr); in dmi_ipmi_probe()
2042 slave_addr, SI_SMBIOS, &pdev->dev); in dmi_ipmi_probe()
2047 return -ENODEV; in dmi_ipmi_probe()
2076 struct ssif_addr_info *addr_info = dev_get_drvdata(&dev->dev); in ssif_platform_remove()
2079 list_del(&addr_info->link); in ssif_platform_remove()
2086 { "dmi-ipmi-ssif", 0 },
2159 MODULE_ALIAS("platform:dmi-ipmi-ssif");