summaryrefslogtreecommitdiffstats
path: root/hw/fsp/fsp.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/fsp/fsp.c')
-rw-r--r--hw/fsp/fsp.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/hw/fsp/fsp.c b/hw/fsp/fsp.c
index 58219a0a..c25e42c8 100644
--- a/hw/fsp/fsp.c
+++ b/hw/fsp/fsp.c
@@ -1689,6 +1689,7 @@ void fsp_interrupt(void)
unlock(&fsp_lock);
}
+
int fsp_sync_msg(struct fsp_msg *msg, bool autofree)
{
int rc;
@@ -1977,6 +1978,36 @@ static void fsp_opal_poll(void *data __unused)
}
}
+int fsp_fatal_msg(struct fsp_msg *msg)
+{
+ int rc = 0;
+
+ rc = fsp_queue_msg(msg, NULL);
+ if (rc)
+ return rc;
+
+ while(fsp_msg_busy(msg)) {
+ cpu_relax();
+ fsp_opal_poll(NULL);
+ }
+
+ switch(msg->state) {
+ case fsp_msg_done:
+ rc = 0;
+ break;
+ case fsp_msg_timeout:
+ rc = -1; /* XXX to improve */
+ break;
+ default:
+ rc = -1; /* Should not happen... (assert ?) */
+ }
+
+ if (msg->resp)
+ rc = (msg->resp->word1 >> 8) & 0xff;
+
+ return rc;
+}
+
static bool fsp_init_one(const char *compat)
{
struct dt_node *fsp_node;
OpenPOWER on IntegriCloud