diff options
author | Alistair Popple <alistair@popple.id.au> | 2015-02-04 16:07:45 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-02-09 13:55:26 +1100 |
commit | c5a06a551ef55468e7bc46615f71f4ee4dbeaa02 (patch) | |
tree | f701ba60986781f2c28210081c37ad1371ffde66 /core/ipmi.c | |
parent | e8b2e4ab0683dbbdf975c96a22c374d05dac8d90 (diff) | |
download | skiboot-c5a06a551ef55468e7bc46615f71f4ee4dbeaa02.zip skiboot-c5a06a551ef55468e7bc46615f71f4ee4dbeaa02.tar.gz skiboot-c5a06a551ef55468e7bc46615f71f4ee4dbeaa02.tar.bz2 |
ipmi: Add support for synchronous message sending
This patch adds support for sending ipmi messages synchronously. This
is necessary to allow messages to be sent during skiboot
initialisation as interrupt servicing/polling is controlled by the
host operating system which is not yet running.
Signed-off-by: Alistair Popple <alistair@popple.id.au>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core/ipmi.c')
-rw-r--r-- | core/ipmi.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/core/ipmi.c b/core/ipmi.c index 5caf057..941cf52 100644 --- a/core/ipmi.c +++ b/core/ipmi.c @@ -22,8 +22,13 @@ #include <opal-api.h> #include <device.h> #include <skiboot.h> +#include <lock.h> +#include <cpu.h> +#include <timebase.h> struct ipmi_backend *ipmi_backend = NULL; +static struct lock sync_lock = LOCK_UNLOCKED; +static struct ipmi_msg *sync_msg = NULL; void ipmi_free_msg(struct ipmi_msg *msg) { @@ -112,6 +117,24 @@ void ipmi_cmd_done(uint8_t cmd, uint8_t netfn, uint8_t cc, struct ipmi_msg *msg) /* At this point the message has should have been freed by the completion functions. */ + + /* If this is a synchronous message flag that we are done */ + if (msg == sync_msg) + sync_msg = NULL; +} + +void ipmi_queue_msg_sync(struct ipmi_msg *msg) +{ + lock(&sync_lock); + + assert(!sync_msg); + sync_msg = msg; + ipmi_queue_msg(msg); + + while (sync_msg) + time_wait_ms(100); + + unlock(&sync_lock); } void ipmi_register_backend(struct ipmi_backend *backend) |