diff options
author | Alistair Popple <alistair@popple.id.au> | 2014-09-15 10:58:10 +1000 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-10-01 14:25:26 +1000 |
commit | b652c6004db44c6ba1371e90b6a5da7213b40522 (patch) | |
tree | 739b7d86f52e3770f9f20f491895735fbe6a25fb /hw/ipmi | |
parent | 6a2019f7227ba5a65dfe28aaeb5c9fc5c5bcfea8 (diff) | |
download | skiboot-b652c6004db44c6ba1371e90b6a5da7213b40522.zip skiboot-b652c6004db44c6ba1371e90b6a5da7213b40522.tar.gz skiboot-b652c6004db44c6ba1371e90b6a5da7213b40522.tar.bz2 |
bt: Add message timeout
This patch adds message timeouts to the bt layer. When a response to a
message is not recieved within a given time we call the error callback
with a completion code indicating a timeout.
Signed-off-by: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'hw/ipmi')
-rw-r--r-- | hw/ipmi/ipmi-rtc.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/hw/ipmi/ipmi-rtc.c b/hw/ipmi/ipmi-rtc.c index 7ac33ff..7dc7f59 100644 --- a/hw/ipmi/ipmi-rtc.c +++ b/hw/ipmi/ipmi-rtc.c @@ -24,7 +24,13 @@ /* Sane default (2014/01/01) */ static time_t time = 1388494800; -static enum {idle, waiting, updated} time_status; +static enum {idle, waiting, updated, error} time_status; + +static void get_sel_time_error(struct ipmi_msg *msg) +{ + time_status = error; + ipmi_free_msg(msg); +} static void get_sel_time_complete(struct ipmi_msg *msg) { @@ -33,6 +39,7 @@ static void get_sel_time_complete(struct ipmi_msg *msg) memcpy(&result, msg->data, 4); time = le32_to_cpu(result); time_status = updated; + ipmi_free_msg(msg); } static int64_t ipmi_get_sel_time(void) @@ -44,6 +51,8 @@ static int64_t ipmi_get_sel_time(void) if (!msg) return OPAL_HARDWARE; + msg->error = get_sel_time_error; + return ipmi_queue_msg(msg); } @@ -59,7 +68,6 @@ static int64_t ipmi_set_sel_time(uint32_t tv) return ipmi_queue_msg(msg); } -void bt_poll(void *data __unused); static int64_t ipmi_opal_rtc_read(uint32_t *y_m_d, uint64_t *h_m_s_m) { @@ -84,6 +92,11 @@ static int64_t ipmi_opal_rtc_read(uint32_t *y_m_d, time_status = idle; ret = OPAL_SUCCESS; break; + + case error: + time_status = idle; + ret = OPAL_HARDWARE; + break; } return ret; |