aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlistair Popple <alistair@popple.id.au>2015-02-20 18:01:19 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-02-23 15:09:59 +1100
commite2f52aa8ea1c31794d03c6d7298f8270e702698d (patch)
treee8c8cb917d9b31d5e1d5cc42484116b553f577db
parent2d9cfc99ce6d1bd77e6dd722858147b78dd3962d (diff)
downloadskiboot-e2f52aa8ea1c31794d03c6d7298f8270e702698d.zip
skiboot-e2f52aa8ea1c31794d03c6d7298f8270e702698d.tar.gz
skiboot-e2f52aa8ea1c31794d03c6d7298f8270e702698d.tar.bz2
bt: Improve error messages
Most of the error messages in the bt layer don't report enough information to assist with debugging. This patch standardises the information reported when the bt layer encounters an error such as a timeout. It also fixes a problem where expired messages would produce a spurious warning about an incorrect netfn. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--hw/bt.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/hw/bt.c b/hw/bt.c
index 3adcd85..3278896 100644
--- a/hw/bt.c
+++ b/hw/bt.c
@@ -66,6 +66,10 @@
#define BT_QUEUE_DEBUG 0
+#define BT_ERR(msg, fmt, args...) \
+ do { prerror("BT seq 0x%02x cmd 0x%02x: " fmt "\n", \
+ (msg)->seq, (msg)->ipmi_msg.cmd, ##args); } while(0)
+
enum bt_states {
BT_STATE_IDLE = 0,
BT_STATE_RESP_WAIT,
@@ -133,7 +137,7 @@ static void bt_msg_del(struct bt_msg *bt_msg)
{
list_del(&bt_msg->link);
bt.queue_len--;
- ipmi_cmd_done(bt_msg->ipmi_msg.cmd, bt_msg->ipmi_msg.netfn + 1,
+ ipmi_cmd_done(bt_msg->ipmi_msg.cmd, bt_msg->ipmi_msg.netfn + (1 << 2),
IPMI_TIMEOUT_ERR, &bt_msg->ipmi_msg);
}
@@ -169,7 +173,7 @@ static void bt_send_msg(void)
ipmi_msg = &bt_msg->ipmi_msg;
if (!bt_idle()) {
- prerror("BT: Interface in an unexpected state, attempting reset\n");
+ BT_ERR(bt_msg, "Interface in unexpected state, attempting reset\n");
bt_reset_interface();
unlock(&bt.lock);
return;
@@ -262,7 +266,7 @@ static void bt_get_resp(void)
* bt_inb(BT_HOST2BMC) < BT_MIN_RESP_LEN (which should never occur).
*/
if (resp_len > ipmi_msg->resp_size) {
- prerror("BT: Invalid resp_len %d for ipmi_msg->cmd = 0x%02x\n", resp_len, ipmi_msg->cmd);
+ BT_ERR(bt_msg, "Invalid resp_len %d", resp_len);
resp_len = ipmi_msg->resp_size;
cc = IPMI_ERR_MSG_TRUNCATED;
}
@@ -301,7 +305,7 @@ static void bt_expire_old_msg(void)
bt_msg = list_top(&bt.msgq, struct bt_msg, link);
if (bt_msg && bt_msg->tb > 0 && (bt_msg->tb + BT_MSG_TIMEOUT) < tb) {
- prerror("BT: Expiring old messsage number 0x%02x\n", bt_msg->seq);
+ BT_ERR(bt_msg, "Timeout sending message");
bt_msg_del(bt_msg);
/* Timing out a message is inherently racy as the BMC
@@ -391,9 +395,10 @@ static void bt_add_msg(struct bt_msg *bt_msg)
if (bt.queue_len > BT_MAX_QUEUE_LEN) {
/* Maximum ueue lenght exceeded - remove the oldest message
from the queue. */
- prerror("BT: Maximum queue length exceeded\n");
+ BT_ERR(bt_msg, "Maximum queue length exceeded");
bt_msg = list_tail(&bt.msgq, struct bt_msg, link);
assert(bt_msg);
+ BT_ERR(bt_msg, "Removed from queue");
bt_msg_del(bt_msg);
}
}