aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2015-11-12 17:22:56 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-11-17 17:22:57 +1100
commitfbe869fce820b75c5c60cab1c65790e0e1e92dd2 (patch)
tree08a637f83f0bad931c834b567b1baad5d6042c18 /hw
parent43ee80a44691da19e3e69d40b98750eeef1b6e20 (diff)
downloadskiboot-fbe869fce820b75c5c60cab1c65790e0e1e92dd2.zip
skiboot-fbe869fce820b75c5c60cab1c65790e0e1e92dd2.tar.gz
skiboot-fbe869fce820b75c5c60cab1c65790e0e1e92dd2.tar.bz2
hw/bt: Convert retry_count to send_count
It is useful to know if a message has been sent at all, the counter used to retry sending can be used for this. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Acked-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/bt.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/hw/bt.c b/hw/bt.c
index 1c46965..71b738a 100644
--- a/hw/bt.c
+++ b/hw/bt.c
@@ -67,7 +67,7 @@
/*
* Maximum number of times to attempt sending a message before giving up.
*/
-#define BT_MAX_RETRY_COUNT 1
+#define BT_MAX_SEND_COUNT 2
#define BT_QUEUE_DEBUG 0
@@ -104,7 +104,7 @@ struct bt_msg {
struct list_node link;
unsigned long tb;
uint8_t seq;
- uint8_t retry_count;
+ uint8_t send_count;
struct ipmi_msg ipmi_msg;
};
@@ -211,6 +211,7 @@ static void bt_send_msg(struct bt_msg *bt_msg)
bt_outb(ipmi_msg->data[i], BT_HOST2BMC);
BT_Q_DBG(bt_msg, "Message sent to host");
+ bt_msg->send_count++;
bt_outb(BT_CTRL_H2B_ATN, BT_CTRL);
bt_set_state(BT_STATE_RESP_WAIT);
@@ -315,13 +316,14 @@ static void bt_expire_old_msg(uint64_t tb)
bt_msg = list_top(&bt.msgq, struct bt_msg, link);
if (bt_msg && bt_msg->tb > 0 && (bt_msg->tb + BT_MSG_TIMEOUT) < tb) {
- if (bt_msg->retry_count < BT_MAX_RETRY_COUNT) {
+ if (bt_msg->send_count < BT_MAX_SEND_COUNT) {
/* A message timeout is usually due to the BMC
clearing the H2B_ATN flag without actually
doing anything. The data will still be in the
FIFO so just reset the flag.*/
BT_Q_ERR(bt_msg, "Retry sending message");
- bt_msg->retry_count++;
+ bt_msg->send_count++;
+
bt_msg->tb = tb;
bt_outb(BT_CTRL_H2B_ATN, BT_CTRL);
} else {
@@ -347,7 +349,7 @@ static void print_debug_queue_info(void)
printed = false;
BT_DBG("-------- BT Msg Queue --------\n");
list_for_each(&bt.msgq, msg, link) {
- BT_Q_DBG(msg, "[]");
+ BT_Q_DBG(msg, "[ sent %d ]", msg->send_count);
}
prlog(PR_DEBUG, "-----------------------------\n");
} else if (!printed) {
@@ -429,7 +431,7 @@ static void bt_add_msg(struct bt_msg *bt_msg)
{
bt_msg->tb = 0;
bt_msg->seq = ipmi_seq++;
- bt_msg->retry_count = 0;
+ bt_msg->send_count = 0;
bt.queue_len++;
if (bt.queue_len > BT_MAX_QUEUE_LEN) {
/* Maximum queue length exceeded - remove the oldest message