diff options
author | Doug Gilbert <dgilbert@us.ibm.com> | 2014-06-17 12:04:14 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2014-07-07 10:14:28 -0500 |
commit | a2446df07549799749c8146634926dcb621244e9 (patch) | |
tree | 2ad67bed7a8b2e0deb0964796a314e44afcd90d8 /src/usr/mbox/mailboxsp.C | |
parent | 38a5b53f55fbccced9b6f4bc0134dcbfe5fe39d0 (diff) | |
download | talos-hostboot-a2446df07549799749c8146634926dcb621244e9.tar.gz talos-hostboot-a2446df07549799749c8146634926dcb621244e9.zip |
Clean handling of shutdown path in error cases
Change-Id: Id03c0f2fc91a31b05572222a2a2743db1518198c
RTC: 109993
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/11636
Tested-by: Jenkins Server
Reviewed-by: Michael Baiocchi <baiocchi@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Reviewed-by: Corey V. Swenson <cswenson@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/mbox/mailboxsp.C')
-rw-r--r-- | src/usr/mbox/mailboxsp.C | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/src/usr/mbox/mailboxsp.C b/src/usr/mbox/mailboxsp.C index 90d5ab8c5..1c293c4ea 100644 --- a/src/usr/mbox/mailboxsp.C +++ b/src/usr/mbox/mailboxsp.C @@ -43,6 +43,7 @@ #include <kernel/ipc.H> #include <arch/ppc.H> #include <errl/errlmanager.H> +#include <sys/misc.h> // Local functions namespace MBOX @@ -307,7 +308,9 @@ void MailboxSp::msgHandler() case MSG_MBOX_SHUTDOWN: { - TRACFCOMP(g_trac_mbox,"MBOXSP Shutdown event received"); + TRACFCOMP(g_trac_mbox, + "MBOXSP Shutdown event received. Status 0x%x", + msg->data[1]); iv_shutdown_msg = msg; // Respond to this when done iv_disabled = true; // stop incomming new messages @@ -1471,6 +1474,49 @@ errlHndl_t MailboxSp::handleInterrupt() return err; } +bool MailboxSp::quiesced() +{ + bool result = iv_rts && !iv_dma_pend && iv_sendq.empty(); + + if( result == true ) + { + if(iv_shutdown_msg == NULL || + (iv_shutdown_msg->data[1] == SHUTDOWN_STATUS_GOOD)) + { + result = result && iv_respondq.empty(); + } + else // mbox is shutting down and system status is bad + { + // Wait for HB to FSP sync message to complete. + // Don't wait for FSP to HB sync message to complete + msg_respond_t * resp = iv_respondq.begin(); + while(resp) + { + if( resp->msg_queue_id >= MBOX::FSP_FIRST_MSGQ) + { + // stil have pending HB->FSP sync messages + result = false; + break; + } + resp = resp->next; + } + // if result is still true then remaining responds, if any, + // should be ignored - mbox is quiesced. + if(result) + { + while(!iv_respondq.empty()) + { + resp = iv_respondq.begin(); + iv_respondq.erase(resp); + delete resp; + } + } + } + } + + return result; +} + void MailboxSp::handleIPC(queue_id_t i_msg_q_id, msg_t * i_msg) { |