aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c58
1 files changed, 25 insertions, 33 deletions
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 9ffbb5f9c7bd..a4c3336cec06 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -42,6 +42,25 @@ static void need_waiter(ipmi_smi_t intf);
42static int handle_one_recv_msg(ipmi_smi_t intf, 42static int handle_one_recv_msg(ipmi_smi_t intf,
43 struct ipmi_smi_msg *msg); 43 struct ipmi_smi_msg *msg);
44 44
45#ifdef DEBUG
46static void ipmi_debug_msg(const char *title, unsigned char *data,
47 unsigned int len)
48{
49 int i, pos;
50 char buf[100];
51
52 pos = snprintf(buf, sizeof(buf), "%s: ", title);
53 for (i = 0; i < len; i++)
54 pos += snprintf(buf + pos, sizeof(buf) - pos,
55 " %2.2x", data[i]);
56 pr_debug("%s\n", buf);
57}
58#else
59static void ipmi_debug_msg(const char *title, unsigned char *data,
60 unsigned int len)
61{ }
62#endif
63
45static int initialized; 64static int initialized;
46 65
47enum ipmi_panic_event_op { 66enum ipmi_panic_event_op {
@@ -2051,14 +2070,7 @@ static int i_ipmi_request(ipmi_user_t user,
2051 goto out_err; 2070 goto out_err;
2052 } 2071 }
2053 2072
2054#ifdef DEBUG_MSGING 2073 ipmi_debug_msg("Send", smi_msg->data, smi_msg->data_size);
2055 {
2056 int m;
2057 for (m = 0; m < smi_msg->data_size; m++)
2058 printk(" %2.2x", smi_msg->data[m]);
2059 printk("\n");
2060 }
2061#endif
2062 2074
2063 smi_send(intf, intf->handlers, smi_msg, priority); 2075 smi_send(intf, intf->handlers, smi_msg, priority);
2064 rcu_read_unlock(); 2076 rcu_read_unlock();
@@ -3736,15 +3748,8 @@ static int handle_ipmb_get_msg_cmd(ipmi_smi_t intf,
3736 msg->data[10] = ipmb_checksum(&(msg->data[6]), 4); 3748 msg->data[10] = ipmb_checksum(&(msg->data[6]), 4);
3737 msg->data_size = 11; 3749 msg->data_size = 11;
3738 3750
3739#ifdef DEBUG_MSGING 3751 ipmi_debug_msg("Invalid command:", msg->data, msg->data_size);
3740 { 3752
3741 int m;
3742 printk("Invalid command:");
3743 for (m = 0; m < msg->data_size; m++)
3744 printk(" %2.2x", msg->data[m]);
3745 printk("\n");
3746 }
3747#endif
3748 rcu_read_lock(); 3753 rcu_read_lock();
3749 if (!intf->in_shutdown) { 3754 if (!intf->in_shutdown) {
3750 smi_send(intf, intf->handlers, msg, 0); 3755 smi_send(intf, intf->handlers, msg, 0);
@@ -4247,13 +4252,7 @@ static int handle_one_recv_msg(ipmi_smi_t intf,
4247 int requeue; 4252 int requeue;
4248 int chan; 4253 int chan;
4249 4254
4250#ifdef DEBUG_MSGING 4255 ipmi_debug_msg("Recv:", msg->rsp, msg->rsp_size);
4251 int m;
4252 printk("Recv:");
4253 for (m = 0; m < msg->rsp_size; m++)
4254 printk(" %2.2x", msg->rsp[m]);
4255 printk("\n");
4256#endif
4257 if (msg->rsp_size < 2) { 4256 if (msg->rsp_size < 2) {
4258 /* Message is too small to be correct. */ 4257 /* Message is too small to be correct. */
4259 dev_warn(intf->si_dev, 4258 dev_warn(intf->si_dev,
@@ -4614,15 +4613,8 @@ smi_from_recv_msg(ipmi_smi_t intf, struct ipmi_recv_msg *recv_msg,
4614 smi_msg->data_size = recv_msg->msg.data_len; 4613 smi_msg->data_size = recv_msg->msg.data_len;
4615 smi_msg->msgid = STORE_SEQ_IN_MSGID(seq, seqid); 4614 smi_msg->msgid = STORE_SEQ_IN_MSGID(seq, seqid);
4616 4615
4617#ifdef DEBUG_MSGING 4616 ipmi_debug_msg("Resend: ", smi_msg->data, smi_msg->data_size);
4618 { 4617
4619 int m;
4620 printk("Resend: ");
4621 for (m = 0; m < smi_msg->data_size; m++)
4622 printk(" %2.2x", smi_msg->data[m]);
4623 printk("\n");
4624 }
4625#endif
4626 return smi_msg; 4618 return smi_msg;
4627} 4619}
4628 4620