diff options
author | Chris Phan <cphan@us.ibm.com> | 2014-10-22 09:44:16 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2014-12-03 11:24:30 -0600 |
commit | 1ab5c789dbb39c069237b480e0dd6d22c9a85104 (patch) | |
tree | d4815e59b0ee974d50c7718e61ae7dfd7a383587 /src/usr/diag/attn/runtime | |
parent | fbb82d303f1deefd65e87d850dc77a74a6102bf5 (diff) | |
download | talos-hostboot-1ab5c789dbb39c069237b480e0dd6d22c9a85104.tar.gz talos-hostboot-1ab5c789dbb39c069237b480e0dd6d22c9a85104.zip |
ATTN: separate hostboot specific code from common
Change-Id: I5eca0f1d5768135b9a902664d79580d5f89f6709
RTC: 110949
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/14129
Tested-by: Jenkins Server
Reviewed-by: Zane Shelley <zshelle@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/diag/attn/runtime')
-rw-r--r-- | src/usr/diag/attn/runtime/attn_rt.C | 73 | ||||
-rw-r--r-- | src/usr/diag/attn/runtime/attn_rt.mk | 4 | ||||
-rw-r--r-- | src/usr/diag/attn/runtime/attnsvc.C | 81 | ||||
-rw-r--r-- | src/usr/diag/attn/runtime/attnsvc.H | 95 | ||||
-rw-r--r-- | src/usr/diag/attn/runtime/makefile | 3 |
5 files changed, 241 insertions, 15 deletions
diff --git a/src/usr/diag/attn/runtime/attn_rt.C b/src/usr/diag/attn/runtime/attn_rt.C index b8a8506d2..64086914a 100644 --- a/src/usr/diag/attn/runtime/attn_rt.C +++ b/src/usr/diag/attn/runtime/attn_rt.C @@ -23,6 +23,7 @@ /* */ /* IBM_PROLOG_END_TAG */ +#include "runtime/attnsvc.H" #include "common/attntrace.H" #include <runtime/interface.h> #include <runtime/rt_targeting.H> @@ -45,14 +46,20 @@ namespace ATTN_RT */ int enableAttns(void) { - #define ATTN_FUNC "ATTN_RT::enableAttns() " + ATTN_SLOW(ENTER_MRK"ATTN_RT::enableAttns"); + int rc = 0; + errlHndl_t err = NULL; + err = Singleton<Service>::instance().enableAttns(); + if(err) + { + errlCommit(err, ATTN_COMP_ID); + rc = -1; + } - ATTN_ERR(ATTN_FUNC"not implemented yet!"); + ATTN_SLOW(EXIT_MRK"ATTN_RT::enableAttns rc: %d", rc); return rc; - - #undef ATTN_FUNC } /** Disable chip attentions @@ -61,14 +68,20 @@ namespace ATTN_RT */ int disableAttns(void) { - #define ATTN_FUNC "ATTN_RT::disableAttns() " + ATTN_SLOW(ENTER_MRK"ATTN_RT::disableAttns"); + int rc = 0; + errlHndl_t err = NULL; + err = Singleton<Service>::instance().disableAttns(); + if(err) + { + errlCommit(err, ATTN_COMP_ID); + rc = -1; + } - ATTN_ERR(ATTN_FUNC"not implemented yet!"); + ATTN_SLOW(EXIT_MRK"ATTN_RT::disableAttns rc: %d", rc); return rc; - - #undef ATTN_FUNC } /** brief handle chip attentions @@ -83,17 +96,50 @@ namespace ATTN_RT uint64_t i_ipollStatus, uint64_t i_ipollMask) { - #define ATTN_FUNC "ATTN_RT::handleAttns() " + ATTN_SLOW(ENTER_MRK"ATTN_RT::handleAttns RtProc: %llx" + ", ipollMask: %llx, ipollStatus: %llx", + i_proc, i_ipollMask, i_ipollStatus); + int rc = 0; + errlHndl_t err = NULL; - ATTN_ERR(ATTN_FUNC"not implemented yet!"); + do + { + // Convert chipIds to HB targets + TargetHandle_t proc = NULL; + err = RT_TARG::getHbTarget(i_proc, proc); + if(err) + { + ATTN_ERR("ATTN_RT::handleAttns getHbTarget " + "returned error for RtProc: %llx", i_proc); + rc = EINVAL; + break; + } - return rc; + err = Singleton<Service>::instance().handleAttentions(proc); + if(err) + { + ATTN_ERR("ATTN_RT::handleAttns service::handleAttentions " + "returned error for RtProc: %llx", i_proc); + break; + } + } while(0); - #undef ATTN_FUNC + if(err) + { + errlCommit( err, ATTN_COMP_ID ); + if(0 == rc) + { + rc = -1; + } + } + + ATTN_SLOW(EXIT_MRK"ATTN_RT::handleAttns rc: %d", rc); + + return rc; } - // register runtime interfaces + // register runtimeInterfaces struct registerAttn { registerAttn() @@ -103,6 +149,7 @@ namespace ATTN_RT { return; } + rt_intf->enable_attns = &enableAttns; rt_intf->disable_attns = &disableAttns; rt_intf->handle_attns = &handleAttns; diff --git a/src/usr/diag/attn/runtime/attn_rt.mk b/src/usr/diag/attn/runtime/attn_rt.mk index 8abe2bbec..ced2fd88e 100644 --- a/src/usr/diag/attn/runtime/attn_rt.mk +++ b/src/usr/diag/attn/runtime/attn_rt.mk @@ -1,7 +1,7 @@ # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # -# $Source: src/usr/diag/attn/runtime/attn_common.mk $ +# $Source: src/usr/diag/attn/runtime/attn_rt.mk $ # # OpenPOWER HostBoot Project # @@ -24,4 +24,4 @@ # IBM_PROLOG_END_TAG ATTN_RT_OBJS += attn_rt.o -ATTN_RT_OBJS += attntrace.o +ATTN_RT_OBJS += attnsvc.o diff --git a/src/usr/diag/attn/runtime/attnsvc.C b/src/usr/diag/attn/runtime/attnsvc.C new file mode 100644 index 000000000..d0552bfed --- /dev/null +++ b/src/usr/diag/attn/runtime/attnsvc.C @@ -0,0 +1,81 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/attn/runtime/attnsvc.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2014 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ +/** + * @file attnsvc.C + * + * @brief HBRT ATTN background service class function definitions. + */ + +#include <errl/errlmanager.H> +#include "runtime/attnsvc.H" +#include "common/attntrace.H" +#include "common/attnprd.H" +#include "common/attnproc.H" +#include "common/attnmem.H" +#include "common/attntarget.H" + +using namespace std; +using namespace PRDF; +using namespace TARGETING; +using namespace ERRORLOG; + +namespace ATTN +{ + +errlHndl_t Service::disableAttns() +{ + ATTN_SLOW("Service::disableAttns() enter"); + + errlHndl_t err = configureInterrupts(DOWN); + + ATTN_SLOW("Service::disableAttns() exit"); + + return err; +} + +errlHndl_t Service::enableAttns() +{ + ATTN_SLOW("Service::enableAttns() enter"); + + errlHndl_t err = configureInterrupts(UP); + + ATTN_SLOW("Service::enableAttns() exit"); + + return err; +} + +Service::~Service() +{ + ATTN_SLOW("Service::~Service() enter"); + errlHndl_t err = disableAttns(); + + if(err) + { + errlCommit(err, ATTN_COMP_ID); + } + ATTN_SLOW("Service::~Service() exit"); +} + +} diff --git a/src/usr/diag/attn/runtime/attnsvc.H b/src/usr/diag/attn/runtime/attnsvc.H new file mode 100644 index 000000000..1b1a32851 --- /dev/null +++ b/src/usr/diag/attn/runtime/attnsvc.H @@ -0,0 +1,95 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/attn/runtime/attnsvc.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2012,2014 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ +#ifndef __ATTN_ATTNSVC_H +#define __ATTN_ATTNSVC_H + +/** + * @file attnsvc.H + * + * @brief HBRT ATTN background service class definition. + */ + +#include "common/attnsvc_common.H" + +namespace ATTN +{ + +/** + * @brief Service Host attention handler background service class definition. + */ +class Service : public ServiceCommon +{ + public: + + /** + * @brief disable attentions. + * + * @post attentions are disabled. All resources reclaimed. + * + * @return errlHndl_t Error log. + * + * @retval[0] No error. + * @retval[!0] Unexpected error. + */ + errlHndl_t disableAttns(); + + /** + * @brief enable attentions. + * + * @post ServiceCommon started. + * + * @return errlHndl_t Error log. + * + * @retval[0] no error + * @retval[!0] unexpected error + */ + errlHndl_t enableAttns(); + + /** + * @brief ctor + */ + Service() {}; + + /** + * @brief dtor + */ + ~Service(); + + private: + + /** + * @brief copy disabled + */ + Service(const Service &); + + /** + * @brief assignment disabled + */ + Service &operator=(const Service &); + +}; + +} +#endif diff --git a/src/usr/diag/attn/runtime/makefile b/src/usr/diag/attn/runtime/makefile index 4a5217433..7bf1ba064 100644 --- a/src/usr/diag/attn/runtime/makefile +++ b/src/usr/diag/attn/runtime/makefile @@ -33,12 +33,15 @@ CFLAGS += -iquote${ROOTPATH}/src/usr/diag/attn MODULE = attn_rt include attn_rt.mk +include ../common/attn_common.mk OBJS += ${ATTN_RT_OBJS} +OBJS += ${ATTN_COMMON_OBJS} SUBDIRS += test.d VPATH += .. +VPATH += ../.. VPATH += ../common include ${ROOTPATH}/config.mk |