diff options
| author | Bill Schwartz <whs@us.ibm.com> | 2014-10-30 07:29:56 -0500 |
|---|---|---|
| committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2014-12-01 16:07:34 -0600 |
| commit | 90b6464a0364c1bb86ad490c3807dcbbaab3b26b (patch) | |
| tree | d67fd5142ed026198b8bc7bdcb7a0035a43c5b72 /src/usr/ipmi/ipmidd.C | |
| parent | cae9d6a9bfdb1834aa5015ffedc7b1f7025ad7b9 (diff) | |
| download | blackbird-hostboot-90b6464a0364c1bb86ad490c3807dcbbaab3b26b.tar.gz blackbird-hostboot-90b6464a0364c1bb86ad490c3807dcbbaab3b26b.zip | |
BMC: Shutdown handling in IPMI Resource
Quiesce activity and free resources
Depends-on: I2a763e5e3ea59e6afb7b7ab7d088fb236ee3428e
Change-Id: Id801368fb81f0421c7b11e96898142548417db5c
RTC: 106887
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/14251
Tested-by: Jenkins Server
Reviewed-by: Brian Silver <bsilver@us.ibm.com>
Reviewed-by: ANIRUDH BAGEPALLI <abagepa@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/ipmi/ipmidd.C')
| -rw-r--r-- | src/usr/ipmi/ipmidd.C | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/src/usr/ipmi/ipmidd.C b/src/usr/ipmi/ipmidd.C index 4484daca5..7e5e3722c 100644 --- a/src/usr/ipmi/ipmidd.C +++ b/src/usr/ipmi/ipmidd.C @@ -208,6 +208,8 @@ static void* poll_control_register( void* /* unused */ ) */ void IpmiDD::pollCtrl(void) { + IPMI_TRAC(ENTER_MRK "poll_control_register" ); + // Mark as an independent daemon so if it crashes we terminate. task_detach(); @@ -222,12 +224,14 @@ void IpmiDD::pollCtrl(void) while(1) { mutex_lock(&iv_mutex); + errlHndl_t err = readLPC(REG_CONTROL, ctrl); // Not sure there's much we can do here but commit the log // and let this thread fail. if (err) { + mutex_unlock(&iv_mutex); IPMI_TRAC(ERR_MRK "polling loop encountered an error, exiting"); errlCommit(err, IPMI_COMP_ID); break; @@ -238,14 +242,22 @@ void IpmiDD::pollCtrl(void) // pending messages which were delayed due to contention. But don't // send a message everytime we see idle, only if there we suspect // we sent EAGAINs. - if (((ctrl & IDLE_STATE) == 0) && iv_eagains) + if ((ctrl & IDLE_STATE) == 0) { - msg = msg_allocate(); - msg->type = IPMI::MSG_STATE_IDLE; - msg_send(mq, msg); - iv_eagains = false; + if (iv_eagains) + { + msg = msg_allocate(); + msg->type = IPMI::MSG_STATE_IDLE; + msg_send(mq, msg); + iv_eagains = false; + } + // Check on shutdown if idle + else if (iv_shutdown_now) + { + mutex_unlock(&iv_mutex); + break; // exit loop and terminate task + } } - // If we see the B2H_ATN, there's a response waiting else if (ctrl & CTRL_B2H_ATN) { @@ -264,8 +276,10 @@ void IpmiDD::pollCtrl(void) } } mutex_unlock(&iv_mutex); + nanosleep(0, WAIT_TIME); } + IPMI_TRAC(EXIT_MRK "poll_control_register" ); } /** @@ -473,9 +487,25 @@ errlHndl_t IpmiDD::receive(IPMI::BTMessage* o_msg) } /** + * @brief shutdown the device driver + */ +void IpmiDD::handleShutdown(void) +{ + IPMI_TRAC(ENTER_MRK "handle Shutdown" ); + mutex_lock(&iv_mutex); + iv_shutdown_now = true; // signal poll controller to terminate + + // TODO: RTC 116600 mask interrupts + + mutex_unlock(&iv_mutex); + IPMI_TRAC(EXIT_MRK "handle Shutdown" ); +} + +/** * @brief Constructor */ IpmiDD::IpmiDD(void): + iv_shutdown_now(false), iv_eagains(false) { mutex_init(&iv_mutex); |

