aboutsummaryrefslogtreecommitdiff
path: root/hw/bt.c
diff options
context:
space:
mode:
authorAlistair Popple <alistair@popple.id.au>2014-11-13 17:16:03 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2014-12-02 18:38:04 +1100
commitf8a0bb99bb6879124f153a161339bbfdef2049bf (patch)
tree2b38b3d7323a76f24d5477f63c4a9fb2ffdee6a5 /hw/bt.c
parent89348d6f95a3dff8ccc1d51c132b524d60c1b1eb (diff)
downloadskiboot-f8a0bb99bb6879124f153a161339bbfdef2049bf.zip
skiboot-f8a0bb99bb6879124f153a161339bbfdef2049bf.tar.gz
skiboot-f8a0bb99bb6879124f153a161339bbfdef2049bf.tar.bz2
ipmi/bt: Enable adding messages to the start of the queue
By default new ipmi messages are added to the end of the transmission queue. However sometimes it is necessary to add messages to the start of the queue. This patch adds a new ipmi function that adds messages to the start of the transmission queue. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/bt.c')
-rw-r--r--hw/bt.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/hw/bt.c b/hw/bt.c
index 355cc93..afdd5df 100644
--- a/hw/bt.c
+++ b/hw/bt.c
@@ -374,14 +374,10 @@ static void bt_poll(struct timer *t __unused, void *data __unused)
bt.irq_ok ? TIMER_POLL : msecs_to_tb(BT_DEFAULT_POLL_MS));
}
-static int bt_add_ipmi_msg(struct ipmi_msg *ipmi_msg)
+static void bt_add_msg(struct bt_msg *bt_msg)
{
- struct bt_msg *bt_msg = container_of(ipmi_msg, struct bt_msg, ipmi_msg);
-
- lock(&bt.msgq_lock);
bt_msg->tb = 0;
bt_msg->seq = ipmi_seq++;
- list_add_tail(&bt.msgq, &bt_msg->link);
bt.queue_len++;
if (bt.queue_len > BT_MAX_QUEUE_LEN) {
/* Maximum ueue lenght exceeded - remove the oldest message
@@ -391,10 +387,31 @@ static int bt_add_ipmi_msg(struct ipmi_msg *ipmi_msg)
assert(bt_msg);
bt_msg_del(bt_msg);
}
+}
+
+static int bt_add_ipmi_msg_head(struct ipmi_msg *ipmi_msg)
+{
+ struct bt_msg *bt_msg = container_of(ipmi_msg, struct bt_msg, ipmi_msg);
+
+ lock(&bt.msgq_lock);
+ bt_add_msg(bt_msg);
+ list_add(&bt.msgq, &bt_msg->link);
unlock(&bt.msgq_lock);
bt_poll(NULL, NULL);
+ return 0;
+}
+
+static int bt_add_ipmi_msg(struct ipmi_msg *ipmi_msg)
+{
+ struct bt_msg *bt_msg = container_of(ipmi_msg, struct bt_msg, ipmi_msg);
+ lock(&bt.msgq_lock);
+ bt_add_msg(bt_msg);
+ list_add_tail(&bt.msgq, &bt_msg->link);
+ unlock(&bt.msgq_lock);
+
+ bt_poll(NULL, NULL);
return 0;
}
@@ -459,6 +476,7 @@ struct ipmi_backend bt_backend = {
.alloc_msg = bt_alloc_ipmi_msg,
.free_msg = bt_free_ipmi_msg,
.queue_msg = bt_add_ipmi_msg,
+ .queue_msg_head = bt_add_ipmi_msg_head,
.dequeue_msg = bt_del_ipmi_msg,
};