summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Phan <cphan@us.ibm.com>2014-10-22 09:44:16 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2014-12-03 11:24:30 -0600
commit1ab5c789dbb39c069237b480e0dd6d22c9a85104 (patch)
treed4815e59b0ee974d50c7718e61ae7dfd7a383587
parentfbb82d303f1deefd65e87d850dc77a74a6102bf5 (diff)
downloadtalos-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>
-rw-r--r--src/makefile1
-rw-r--r--src/usr/diag/attn/common/attn_common.mk2
-rw-r--r--src/usr/diag/attn/common/attnprd.C146
-rw-r--r--src/usr/diag/attn/common/attnsvc_common.C405
-rw-r--r--src/usr/diag/attn/common/attnsvc_common.H149
-rw-r--r--src/usr/diag/attn/ipl/attn.C157
-rw-r--r--src/usr/diag/attn/ipl/attnsvc.C333
-rw-r--r--src/usr/diag/attn/ipl/attnsvc.H31
-rw-r--r--src/usr/diag/attn/ipl/test/attntestipl.H12
-rw-r--r--src/usr/diag/attn/ipl/test/attntestmem.H13
-rw-r--r--src/usr/diag/attn/ipl/test/attntestproc.H13
-rw-r--r--src/usr/diag/attn/ipl/test/attntestsvc.H7
-rw-r--r--src/usr/diag/attn/runtime/attn_rt.C73
-rw-r--r--src/usr/diag/attn/runtime/attn_rt.mk4
-rw-r--r--src/usr/diag/attn/runtime/attnsvc.C81
-rw-r--r--src/usr/diag/attn/runtime/attnsvc.H95
-rw-r--r--src/usr/diag/attn/runtime/makefile3
17 files changed, 1004 insertions, 521 deletions
diff --git a/src/makefile b/src/makefile
index 46b0b3d65..a7ce0cc1c 100644
--- a/src/makefile
+++ b/src/makefile
@@ -234,6 +234,7 @@ RUNTIME_MODULES += $(if $(CONFIG_HTMGT),htmgt_rt)
RUNTIME_MODULES += $(if $(CONFIG_HBRT_PRD),prdf_rt)
RUNTIME_MODULES += $(if $(CONFIG_HBRT_PRD),bus_training_rt)
RUNTIME_MODULES += $(if $(CONFIG_HBRT_PRD),attn_rt)
+RUNTIME_MODULES += $(if $(CONFIG_HBRT_PRD),prdf_rt)
RUNTIME_DATA_MODULES +=
RUNTIME_TESTCASE_MODULES += cxxtest_rt
diff --git a/src/usr/diag/attn/common/attn_common.mk b/src/usr/diag/attn/common/attn_common.mk
index f5993c83c..b39b827b1 100644
--- a/src/usr/diag/attn/common/attn_common.mk
+++ b/src/usr/diag/attn/common/attn_common.mk
@@ -30,3 +30,5 @@ ATTN_COMMON_OBJS += attntarget.o
ATTN_COMMON_OBJS += attnscom.o
ATTN_COMMON_OBJS += attnproc.o
ATTN_COMMON_OBJS += attnmem.o
+ATTN_COMMON_OBJS += attnprd.o
+ATTN_COMMON_OBJS += attnsvc_common.o
diff --git a/src/usr/diag/attn/common/attnprd.C b/src/usr/diag/attn/common/attnprd.C
new file mode 100644
index 000000000..3fcce006b
--- /dev/null
+++ b/src/usr/diag/attn/common/attnprd.C
@@ -0,0 +1,146 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/attn/common/attnprd.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 attnprd.C
+ *
+ * @brief HBATTN PRD wrapper class definitions.
+ */
+
+#include "ipl/attnsvc.H"
+#include "common/attnprd.H"
+#include "common/attnops.H"
+#include "common/attnlist.H"
+#include "common/attntrace.H"
+#include "common/attntarget.H"
+#include "common/attnproc.H"
+#include "common/attnmem.H"
+#include <util/singleton.H>
+#include <errl/errlmanager.H>
+
+using namespace std;
+using namespace PRDF;
+using namespace TARGETING;
+using namespace Util;
+
+namespace ATTN
+{
+
+void PrdImpl::installPrd()
+{
+ getPrdWrapper().setImpl(*this);
+}
+
+errlHndl_t PrdImpl::callPrd(const AttentionList & i_attentions)
+{
+ // forward call to the real PRD
+
+ errlHndl_t err = NULL;
+
+ // convert attention list to PRD type
+
+ AttnList attnList;
+
+ i_attentions.getAttnList(attnList);
+
+ if(!attnList.empty())
+ {
+ // AttentionLists keep themselves sorted by attention type
+ // with higher priority attentions
+ // appearing before those with lower priority, where the
+ // priority is defined by the ATTENTION_VALUE_TYPE enum.
+ //
+ // When an AttentionList is converted to an AttnList
+ // the order is preserved. In this way, the PRD
+ // requirement that the highest priority attention
+ // appear first in the argument list is satisfied.
+
+ err = PRDF::main(attnList.front().attnType, attnList);
+ }
+
+ return err;
+}
+
+PrdWrapper & getPrdWrapper()
+{
+ // prd wrapper singleton access
+ return Singleton<PrdWrapper>::instance();
+}
+
+PrdWrapper::PrdWrapper()
+ : iv_impl(&Singleton<PrdImpl>::instance())
+{
+ // default call the real PRD
+}
+
+errlHndl_t PrdWrapper::callPrd(const AttentionList & i_attentions)
+{
+ // forward call to the installed PRD implementation.
+
+ ATTN_DBG("call PRD with %d using: %p", i_attentions.size(), iv_impl);
+
+ return iv_impl->callPrd(i_attentions);
+}
+
+ProcOps & getProcOps()
+{
+ return Singleton<ProcOps>::instance();
+}
+
+MemOps & getMemOps()
+{
+ return Singleton<MemOps>::instance();
+}
+
+int64_t Attention::compare(const Attention & i_rhs) const
+{
+ return ATTN::compare(iv_data, i_rhs.iv_data);
+}
+
+int64_t compare(const AttnData & i_l, const AttnData & i_r)
+{
+ if(i_l.attnType < i_r.attnType)
+ {
+ return -1;
+ }
+
+ if(i_r.attnType < i_l.attnType)
+ {
+ return 1;
+ }
+
+ if(i_l.targetHndl < i_r.targetHndl)
+ {
+ return -1;
+ }
+
+ if(i_r.targetHndl < i_l.targetHndl)
+ {
+ return 1;
+ }
+
+ return 0;
+}
+}
diff --git a/src/usr/diag/attn/common/attnsvc_common.C b/src/usr/diag/attn/common/attnsvc_common.C
new file mode 100644
index 000000000..9acc19594
--- /dev/null
+++ b/src/usr/diag/attn/common/attnsvc_common.C
@@ -0,0 +1,405 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/attn/common/attnsvc_common.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_common.C
+ *
+ * @brief HBATTN common service class function definitions.
+ */
+
+#include <errl/errlmanager.H>
+#include "common/attnsvc_common.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
+{
+
+void getPbGp2Mask(uint64_t i_pos, void * i_data)
+{
+ uint64_t & mask = *static_cast<uint64_t *>(i_data);
+
+ uint64_t tmp = 0;
+ GP1::getCheckbits(i_pos, tmp);
+
+ mask |= tmp;
+}
+
+/**
+ * @brief calculated mask cache for ipoll
+ */
+class HostMask
+{
+ uint64_t iv_hostMask;
+ uint64_t iv_nonHostMask;
+
+ HostMask() : iv_hostMask(0), iv_nonHostMask(0)
+ {
+ IPOLL::getCheckbits(HOST, iv_hostMask);
+ IPOLL::forEach(~0, &iv_nonHostMask, &getIpollMask);
+
+ iv_nonHostMask = iv_nonHostMask & ~iv_hostMask;
+ }
+
+ static void getIpollMask(uint64_t i_type, void * i_data)
+ {
+ uint64_t & mask = *static_cast<uint64_t *>(i_data);
+
+ uint64_t tmp = 0;
+ IPOLL::getCheckbits(i_type, tmp);
+
+ mask |= tmp;
+ }
+
+ static HostMask & get()
+ {
+ static HostMask hm;
+
+ return hm;
+ }
+
+ public:
+
+ static uint64_t host()
+ {
+ return get().iv_hostMask;
+ }
+
+ static uint64_t nonHost()
+ {
+ return get().iv_nonHostMask;
+ }
+};
+
+errlHndl_t ServiceCommon::configureInterrupts(
+ ConfigureMode i_mode)
+{
+ errlHndl_t err = NULL;
+
+ TargetHandleList procs;
+ getTargetService().getAllChips(procs, TYPE_PROC);
+ TargetHandleList::iterator it = procs.begin();
+
+ while(it != procs.end())
+ {
+ uint64_t mask = 0;
+
+ // clear GPIO interrupt type status register
+
+ if(i_mode == UP)
+ {
+ err = putScom(*it, INTR_TYPE_LCL_ERR_STATUS_AND_REG,
+ 0);
+ }
+
+ if(err)
+ {
+ break;
+ }
+
+ // unmask GPIO interrupt type
+
+ mask = 0x8000000000000000ull;
+
+ err = putScom(*it,
+ (i_mode == UP
+ ? INTR_TYPE_MASK_AND_REG
+ : INTR_TYPE_MASK_OR_REG),
+ i_mode == UP ? ~mask : mask);
+
+ if(err)
+ {
+ break;
+ }
+
+ // set GPIO interrupt type mode - or
+
+ if(i_mode == UP)
+ {
+ err = putScom(*it, INTR_TYPE_CONFIG_AND_REG,
+ ~mask);
+ }
+
+ if(err)
+ {
+ break;
+ }
+
+ // enable/disable MCSes
+
+ mask = 0;
+
+ GP1::forEach(~0, &mask, &getPbGp2Mask);
+
+ err = modifyScom(*it,
+ GP2_REG,
+ i_mode == UP ? mask : ~mask,
+ i_mode == UP ? SCOM_OR : SCOM_AND);
+
+ if(err)
+ {
+ break;
+ }
+
+ // enable attentions in ipoll mask
+
+ mask = HostMask::nonHost();
+ mask |= HostMask::host();
+
+ // this doesn't have an and/or reg for some reason...
+
+ err = modifyScom(*it,
+ IPOLL::address,
+ i_mode == UP ? ~mask : mask,
+ i_mode == UP ? SCOM_AND : SCOM_OR);
+
+ if(err)
+ {
+ break;
+ }
+
+ ++it;
+ }
+
+ return err;
+}
+
+void ServiceCommon::processAttnPreAck(const TargetHandle_t i_proc)
+{
+ uint64_t hostMask = HostMask::host();
+ uint64_t nonHostMask = HostMask::nonHost();
+ uint64_t data = 0;
+
+ // do the minimum that is required
+ // for sending EOI without getting
+ // another interrupt. for host attentions
+ // this is clearing the gpio interrupt
+ // type status register
+ // and for xstp,rec,spcl this is
+ // masking the appropriate bit in
+ // ipoll mask
+
+ // read the ipoll status register
+ // to determine the interrupt was
+ // caused by host attn or something
+ // else (xstp,rec,spcl)
+
+ errlHndl_t err = getScom(i_proc, IPOLL_STATUS_REG, data);
+
+ if(err)
+ {
+ errlCommit(err, ATTN_COMP_ID);
+
+ // assume everything is on
+
+ data = hostMask | nonHostMask;
+ }
+
+ if(data & hostMask)
+ {
+ // if host attention, clear the ITR macro gpio interrupt
+ // type status register.
+
+ err = putScom(i_proc, INTR_TYPE_LCL_ERR_STATUS_AND_REG, 0);
+
+ if(err)
+ {
+ errlCommit(err, ATTN_COMP_ID);
+ }
+ }
+
+ if(data & nonHostMask)
+ {
+ // mask local proc xstp,rec and/or special attns if on.
+
+ // the other thread might be trying to unmask
+ // on the same target. The mutex ensures
+ // neither thread corrupts the register.
+
+ mutex_lock(&iv_mutex);
+
+ err = modifyScom(i_proc, IPOLL::address, data & nonHostMask, SCOM_OR);
+
+ mutex_unlock(&iv_mutex);
+
+ if(err)
+ {
+ errlCommit(err, ATTN_COMP_ID);
+ }
+ }
+}
+
+void ServiceCommon::processAttentions(const TargetHandleList & i_procs)
+{
+ errlHndl_t err = NULL;
+ AttentionList attentions;
+
+ MemOps & memOps = getMemOps();
+ ProcOps & procOps = getProcOps();
+
+ do {
+
+ attentions.clear();
+
+ // enumerate the highest priority pending attention
+ // on every chip and then give the entire set to PRD
+
+ TargetHandleList::const_iterator pit = i_procs.end();
+
+ while(pit-- != i_procs.begin())
+ {
+ // enumerate proc local attentions (xstp,spcl,rec).
+
+ err = procOps.resolveIpoll(*pit, attentions);
+
+ if(err)
+ {
+ errlCommit(err, ATTN_COMP_ID);
+ }
+
+ // enumerate host attentions and convert
+ // to centaur targets
+
+ err = memOps.resolve(*pit, attentions);
+
+ if(err)
+ {
+ errlCommit(err, ATTN_COMP_ID);
+ }
+ }
+
+ err = getPrdWrapper().callPrd(attentions);
+
+ if(err)
+ {
+ errlCommit(err, ATTN_COMP_ID);
+ }
+
+ // unmask proc local attentions
+ // (xstp,rec,special) in ipoll mask
+
+ // any pending attentions will be found
+ // on the next pass
+
+ pit = i_procs.end();
+
+ while(pit-- != i_procs.begin())
+ {
+ mutex_lock(&iv_mutex);
+
+ // the other thread might be trying to mask
+ // on the same target. The mutex ensures
+ // neither thread corrupts the register.
+
+ err = modifyScom(
+ *pit,
+ IPOLL::address,
+ ~HostMask::nonHost(),
+ SCOM_AND);
+
+ mutex_unlock(&iv_mutex);
+
+ if(err)
+ {
+ errlCommit(err, ATTN_COMP_ID);
+ }
+ }
+
+ // if on a given Centaur with a pending attention
+ // on an MBA, an attention comes on in the other MBA
+ // we don't get an interrupt for that. So make another
+ // pass and check for that.
+
+ } while(!attentions.empty());
+
+}
+
+ServiceCommon::ServiceCommon()
+{
+ mutex_init(&iv_mutex);
+}
+
+ServiceCommon::~ServiceCommon()
+{
+ mutex_destroy(&iv_mutex);
+}
+
+errlHndl_t ServiceCommon::handleAttentions(const TargetHandle_t i_proc)
+{
+ errlHndl_t err = NULL;
+ AttentionList attentions;
+
+ MemOps & memOps = getMemOps();
+ ProcOps & procOps = getProcOps();
+
+ do {
+
+ attentions.clear();
+
+ // query the proc resolver for active attentions
+
+ err = procOps.resolve(i_proc, 0, attentions);
+
+ if(err)
+ {
+ break;
+ }
+
+ // query the mem resolver for active attentions
+
+ err = memOps.resolve(i_proc, attentions);
+
+ if(err)
+ {
+ break;
+ }
+
+ if(!attentions.empty())
+ {
+ err = getPrdWrapper().callPrd(attentions);
+ }
+
+ if(err)
+ {
+ break;
+ }
+ #ifdef __HOSTBOOT_RUNTIME
+ // During runtime, we will only handle one attention at a time
+ //and give control back to OPAL.
+ break;
+ #endif //__HOSTBOOT_RUNTIME
+
+ } while(!attentions.empty());
+
+ return err;
+}
+}
diff --git a/src/usr/diag/attn/common/attnsvc_common.H b/src/usr/diag/attn/common/attnsvc_common.H
new file mode 100644
index 000000000..bf6d3bad3
--- /dev/null
+++ b/src/usr/diag/attn/common/attnsvc_common.H
@@ -0,0 +1,149 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/attn/common/attnsvc_common.H $ */
+/* */
+/* 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 */
+#ifndef __ATTN_ATTNSVCCOMMON_H
+#define __ATTN_ATTNSVCCOMMON_H
+
+/**
+ * @file attnsvc_common.H
+ *
+ * @brief HBATTN common service class definition.
+ */
+
+#include "common/attnfwd.H"
+#include "common/attnlist.H"
+
+namespace ATTN
+{
+
+/**
+ * @brief Service Host attention handler background service class definition.
+ */
+class ServiceCommon
+{
+ public:
+
+ /**
+ * @brief ConfigureMode
+ *
+ * Up or down for parameter for configure methods.
+ */
+ enum ConfigureMode
+ {
+ UP, DOWN,
+ };
+
+ /**
+ * @brief ctor
+ */
+ ServiceCommon();
+
+ /**
+ * @brief dtor
+ */
+ ~ServiceCommon();
+
+ /**
+ * @brief processAttentions process interrupt task wakeup
+ *
+ * call prd to analyze attentions
+ *
+ * @param[i_procs] procs to check for attentions behind
+ *
+ * @post attentions analyzed by prd. attentions cleared by prd unmasked
+ */
+ void processAttentions(const TARGETING::TargetHandleList & i_procs);
+
+ /**
+ * @brief handles attentions on a proc
+ *
+ * call prd to analyze attentions if attentions exist
+ *
+ * @param[i_proc] proc to check for attentions behind
+ *
+ * @post attentions analyzed by prd.
+ *
+ * @retval[0] No error
+ * @retval[!0] Unexpected error
+ */
+ errlHndl_t handleAttentions(const TARGETING::TargetHandle_t i_proc);
+
+ protected:
+
+ /**
+ * @brief processAttnPreAck pre EOI interrupt service message
+ * processing
+ *
+ * Perform the interrupt service message processing steps that must
+ * be done before EOI can be sent by the interrupt service.
+ *
+ * @post interrupt service message ready to be acknowledged
+ *
+ * @param[in] i_proc processor target handle
+ */
+ void processAttnPreAck(const TARGETING::TargetHandle_t i_proc);
+
+ /**
+ * @brief configureInterrupts enable or
+ * disable interrupts used by the ServiceCommon, on all
+ * functioning processors.
+ *
+ * @post ServiceCommon (un)hooked to/from interrupt ServiceCommon
+ * for local error and host interrupts.
+ * @post Local error and host priority set(cleared).
+ * @post Local error and host interrupts (un)masked at GFIR macro.
+ *
+ * @param[in] i_mode Up or down
+ *
+ * @retval[0] No error
+ * @retval[!0] Unexpected error
+ */
+ errlHndl_t configureInterrupts(ConfigureMode i_mode);
+
+ /**
+ * @brief iv_mutex pendingAttentions protection
+ */
+ mutex_t iv_mutex;
+
+ private:
+
+ /**
+ * @brief copy disabled
+ */
+ ServiceCommon(const ServiceCommon &);
+
+ /**
+ * @brief assignment disabled
+ */
+ ServiceCommon &operator=(const ServiceCommon &);
+
+ /**
+ * @brief AttnSvcTest Provide access to unit test.
+ */
+ friend class ::AttnSvcTest;
+ friend class ::AttnProcTest;
+ friend class ::AttnMemTest;
+};
+}
+#endif
diff --git a/src/usr/diag/attn/ipl/attn.C b/src/usr/diag/attn/ipl/attn.C
index 021c275bb..d6f839162 100644
--- a/src/usr/diag/attn/ipl/attn.C
+++ b/src/usr/diag/attn/ipl/attn.C
@@ -64,9 +64,6 @@ errlHndl_t checkForIplAttentions()
assert(!Singleton<Service>::instance().running());
- ProcOps & procOps = Singleton<ProcOps>::instance();
- MemOps & memOps = Singleton<MemOps>::instance();
-
TargetHandleList list;
getTargetService().getAllChips(list, TYPE_PROC);
@@ -75,165 +72,17 @@ errlHndl_t checkForIplAttentions()
while(tit != list.end())
{
- AttentionList attentions;
-
- do {
-
- attentions.clear();
-
- // query the proc resolver for active attentions
-
- err = procOps.resolve(*tit, 0, attentions);
-
- if(err)
- {
- break;
- }
-
- // query the mem resolver for active attentions
-
- err = memOps.resolve(*tit, attentions);
-
- if(err)
- {
- break;
- }
-
- // TODO RTC 51547
- // historically ATTN has enumerated
- // all chips on the entire system so that
- // PRD can figure out who caused a system
- // checkstop.
-
- // since hostboot won't be handling that
- // its faster to just enumerate attentions one
- // chip at a time
-
- // The intent of the RTC is to confirm this
- // is the desired behavior
-
- if(!attentions.empty())
- {
- err = getPrdWrapper().callPrd(attentions);
- }
-
- if(err)
- {
- break;
- }
-
- } while(!attentions.empty());
-
- if(err || attentions.empty())
- {
- tit = list.erase(tit);
- }
+ err = Singleton<Service>::instance().handleAttentions(*tit);
if(err)
{
errlCommit(err, ATTN_COMP_ID);
}
- }
-
- return 0;
-}
-
-void PrdImpl::installPrd()
-{
- getPrdWrapper().setImpl(*this);
-}
-
-errlHndl_t PrdImpl::callPrd(const AttentionList & i_attentions)
-{
- // forward call to the real PRD
- errlHndl_t err = NULL;
-
- // convert attention list to PRD type
-
- AttnList attnList;
-
- i_attentions.getAttnList(attnList);
-
- if(!attnList.empty())
- {
- // AttentionLists keep themselves sorted by attention type
- // with higher priority attentions
- // appearing before those with lower priority, where the
- // priority is defined by the ATTENTION_VALUE_TYPE enum.
- //
- // When an AttentionList is converted to an AttnList
- // the order is preserved. In this way, the PRD
- // requirement that the highest priority attention
- // appear first in the argument list is satisfied.
-
- err = PRDF::main(attnList.front().attnType, attnList);
- }
-
- return err;
-}
-
-PrdWrapper & getPrdWrapper()
-{
- // prd wrapper singleton access
-
- static PrdWrapper w;
-
- return w;
-}
-
-PrdWrapper::PrdWrapper()
- : iv_impl(&Singleton<PrdImpl>::instance())
-{
- // default call the real PRD
-}
-
-errlHndl_t PrdWrapper::callPrd(const AttentionList & i_attentions)
-{
- // forward call to the installed PRD implementation.
-
- ATTN_DBG("call PRD with %d using: %p", i_attentions.size(), iv_impl);
-
- return iv_impl->callPrd(i_attentions);
-}
-
-ProcOps & getProcOps()
-{
- return Singleton<ProcOps>::instance();
-}
-
-MemOps & getMemOps()
-{
- return Singleton<MemOps>::instance();
-}
-
-int64_t Attention::compare(const Attention & i_rhs) const
-{
- return ATTN::compare(iv_data, i_rhs.iv_data);
-}
-
-int64_t compare(const AttnData & i_l, const AttnData & i_r)
-{
- if(i_l.attnType < i_r.attnType)
- {
- return -1;
- }
-
- if(i_r.attnType < i_l.attnType)
- {
- return 1;
- }
-
- if(i_l.targetHndl < i_r.targetHndl)
- {
- return -1;
- }
-
- if(i_r.targetHndl < i_l.targetHndl)
- {
- return 1;
+ tit = list.erase(tit);
}
return 0;
}
+
}
diff --git a/src/usr/diag/attn/ipl/attnsvc.C b/src/usr/diag/attn/ipl/attnsvc.C
index 4b6b75faa..51fb87603 100644
--- a/src/usr/diag/attn/ipl/attnsvc.C
+++ b/src/usr/diag/attn/ipl/attnsvc.C
@@ -45,170 +45,38 @@ using namespace ERRORLOG;
namespace ATTN
{
-void getPbGp2Mask(uint64_t i_pos, void * i_data)
-{
- uint64_t & mask = *static_cast<uint64_t *>(i_data);
-
- uint64_t tmp = 0;
- GP1::getCheckbits(i_pos, tmp);
-
- mask |= tmp;
-}
-
-/**
- * @brief calculated mask cache for ipoll
- */
-class HostMask
-{
- uint64_t iv_hostMask;
- uint64_t iv_nonHostMask;
-
- HostMask() : iv_hostMask(0), iv_nonHostMask(0)
- {
- IPOLL::getCheckbits(HOST, iv_hostMask);
- IPOLL::forEach(~0, &iv_nonHostMask, &getIpollMask);
-
- iv_nonHostMask = iv_nonHostMask & ~iv_hostMask;
- }
-
- static void getIpollMask(uint64_t i_type, void * i_data)
- {
- uint64_t & mask = *static_cast<uint64_t *>(i_data);
-
- uint64_t tmp = 0;
- IPOLL::getCheckbits(i_type, tmp);
-
- mask |= tmp;
- }
-
- static HostMask & get()
- {
- static HostMask hm;
-
- return hm;
- }
-
- public:
-
- static uint64_t host()
- {
- return get().iv_hostMask;
- }
-
- static uint64_t nonHost()
- {
- return get().iv_nonHostMask;
- }
-};
-
errlHndl_t Service::configureInterrupts(
msg_q_t i_q,
ConfigureMode i_mode)
{
errlHndl_t err = NULL;
- // First register for Q
- // This will set up the psi host bridge logic for
- // lcl_err interrupt on all chips
-
- if(i_mode == UP)
+ do
{
- err = INTR::registerMsgQ(i_q,
- ATTENTION,
- INTR::ISN_LCL_ERR);
- }
+ // First register for Q
+ // This will set up the psi host bridge logic for
+ // lcl_err interrupt on all chips
- // setup the ITR macro for GPIO type host attentions,
- // on all procs
-
- if(!err)
- {
- TargetHandleList procs;
- getTargetService().getAllChips(procs, TYPE_PROC);
- TargetHandleList::iterator it = procs.begin();
-
- while(it != procs.end())
+ if(i_mode == UP)
{
- uint64_t mask = 0;
-
- // clear GPIO interrupt type status register
-
- if(i_mode == UP)
- {
- err = putScom(*it, INTR_TYPE_LCL_ERR_STATUS_AND_REG,
- 0);
- }
-
- if(err)
- {
- break;
- }
-
- // unmask GPIO interrupt type
-
- mask = 0x8000000000000000ull;
-
- err = putScom(
- *it,
- (i_mode == UP
- ? INTR_TYPE_MASK_AND_REG
- : INTR_TYPE_MASK_OR_REG),
- i_mode == UP ? ~mask : mask);
-
- if(err)
- {
- break;
- }
-
- // set GPIO interrupt type mode - or
-
- if(i_mode == UP)
- {
- err = putScom(*it, INTR_TYPE_CONFIG_AND_REG,
- ~mask);
- }
-
- if(err)
- {
- break;
- }
-
- // enable/disable MCSes
-
- mask = 0;
-
- GP1::forEach(~0, &mask, &getPbGp2Mask);
-
- err = modifyScom(
- *it,
- GP2_REG,
- i_mode == UP ? mask : ~mask,
- i_mode == UP ? SCOM_OR : SCOM_AND);
-
- if(err)
- {
- break;
- }
-
- // enable attentions in ipoll mask
-
- mask = HostMask::nonHost();
- mask |= HostMask::host();
-
- // this doesn't have an and/or reg for some reason...
-
- err = modifyScom(
- *it,
- IPOLL::address,
- i_mode == UP ? ~mask : mask,
- i_mode == UP ? SCOM_AND : SCOM_OR);
+ err = INTR::registerMsgQ(i_q,
+ ATTENTION,
+ INTR::ISN_LCL_ERR);
+ }
- if(err)
- {
- break;
- }
+ if(err)
+ {
+ ATTN_ERR("INTR::registerMsgQ returned error");
+ break;
+ }
- ++it;
+ // enable/disable attentions
+ err = ServiceCommon::configureInterrupts(i_mode);
+ if(err)
+ {
+ ATTN_ERR("ServiceCommon::configureInterrupts "
+ "returned error i_mode: 0x%x", i_mode);
+ break;
}
if(!err && i_mode == DOWN)
@@ -219,14 +87,15 @@ errlHndl_t Service::configureInterrupts(
INTR::ISN_LCL_ERR);
}
}
- }
+
+ } while(0);
+
return err;
}
void * Service::intrTask(void * i_svc)
{
// interrupt task loop
-
Service & svc = *static_cast<Service *>(i_svc);
bool shutdown = false;
msg_t * msg = NULL;
@@ -246,6 +115,7 @@ void * Service::intrTask(void * i_svc)
svc.processIntrQMsg(*msg);
}
+
return NULL;
}
@@ -253,7 +123,6 @@ bool Service::intrTaskWait(msg_t * & o_msg)
{
// wait for a shutdown message
// or an interrupt
-
bool shutdown = false;
msg_q_t q = iv_intrTaskQ;
@@ -296,6 +165,7 @@ void Service::processIntrQMsgPreAck(const msg_t & i_msg)
TargetHandleList procs;
getTargetService().getAllChips(procs, TYPE_PROC);
+
TargetHandleList::iterator it = procs.begin();
// resolve the xisr to a proc target
@@ -317,67 +187,8 @@ void Service::processIntrQMsgPreAck(const msg_t & i_msg)
++it;
}
- uint64_t hostMask = HostMask::host();
- uint64_t nonHostMask = HostMask::nonHost();
- uint64_t data = 0;
-
- // do the minimum that is required
- // for sending EOI without getting
- // another interrupt. for host attentions
- // this is clearing the gpio interrupt
- // type status register
- // and for xstp,rec,spcl this is
- // masking the appropriate bit in
- // ipoll mask
-
- // read the ipoll status register
- // to determine the interrupt was
- // caused by host attn or something
- // else (xstp,rec,spcl)
-
- errlHndl_t err = getScom(proc, IPOLL_STATUS_REG, data);
-
- if(err)
- {
- errlCommit(err, ATTN_COMP_ID);
-
- // assume everything is on
-
- data = hostMask | nonHostMask;
- }
-
- if(data & hostMask)
- {
- // if host attention, clear the ITR macro gpio interrupt
- // type status register.
-
- err = putScom(proc, INTR_TYPE_LCL_ERR_STATUS_AND_REG, 0);
+ ServiceCommon::processAttnPreAck(proc);
- if(err)
- {
- errlCommit(err, ATTN_COMP_ID);
- }
- }
-
- if(data & nonHostMask)
- {
- // mask local proc xstp,rec and/or special attns if on.
-
- // the other thread might be trying to unmask
- // on the same target. The mutex ensures
- // neither thread corrupts the register.
-
- mutex_lock(&iv_mutex);
-
- err = modifyScom(proc, IPOLL::address, data & nonHostMask, SCOM_OR);
-
- mutex_unlock(&iv_mutex);
-
- if(err)
- {
- errlCommit(err, ATTN_COMP_ID);
- }
- }
}
void Service::processIntrQMsg(msg_t & i_msg)
@@ -402,12 +213,12 @@ void Service::processIntrQMsg(msg_t & i_msg)
mutex_unlock(&iv_mutex);
sync_cond_signal(&iv_cond);
+
}
void* Service::prdTask(void * i_svc)
{
// prd task loop
-
Service & svc = *static_cast<Service *>(i_svc);
bool shutdown = false;
@@ -439,7 +250,6 @@ void* Service::prdTask(void * i_svc)
bool Service::prdTaskWait()
{
// wait for a wakeup
-
bool shutdown = false;
mutex_lock(&iv_mutex);
@@ -470,90 +280,6 @@ bool Service::prdTaskWait()
return shutdown;
}
-void Service::processAttentions(const TargetHandleList & i_procs)
-{
- errlHndl_t err = NULL;
- AttentionList attentions;
-
- MemOps & memOps = getMemOps();
- ProcOps & procOps = getProcOps();
-
- do {
-
- attentions.clear();
-
- // enumerate the highest priority pending attention
- // on every chip and then give the entire set to PRD
-
- TargetHandleList::const_iterator pit = i_procs.end();
-
- while(pit-- != i_procs.begin())
- {
- // enumerate proc local attentions (xstp,spcl,rec).
-
- err = procOps.resolveIpoll(*pit, attentions);
-
- if(err)
- {
- errlCommit(err, ATTN_COMP_ID);
- }
-
- // enumerate host attentions and convert
- // to centaur targets
-
- err = memOps.resolve(*pit, attentions);
-
- if(err)
- {
- errlCommit(err, ATTN_COMP_ID);
- }
- }
-
- err = getPrdWrapper().callPrd(attentions);
-
- if(err)
- {
- errlCommit(err, ATTN_COMP_ID);
- }
-
- // unmask proc local attentions
- // (xstp,rec,special) in ipoll mask
-
- // any pending attentions will be found
- // on the next pass
-
- pit = i_procs.end();
-
- while(pit-- != i_procs.begin())
- {
- mutex_lock(&iv_mutex);
-
- // the other thread might be trying to mask
- // on the same target. The mutex ensures
- // neither thread corrupts the register.
-
- err = modifyScom(
- *pit,
- IPOLL::address,
- ~HostMask::nonHost(),
- SCOM_AND);
-
- mutex_unlock(&iv_mutex);
-
- if(err)
- {
- errlCommit(err, ATTN_COMP_ID);
- }
- }
-
- // if on a given Centaur with a pending attention
- // on an MBA, an attention comes on in the other MBA
- // we don't get an interrupt for that. So make another
- // pass and check for that.
-
- } while(!attentions.empty());
-}
-
errlHndl_t Service::stop()
{
ATTN_SLOW("shutting down...");
@@ -686,13 +412,13 @@ errlHndl_t Service::start()
}
Service::Service() :
+ ServiceCommon(),
iv_interrupt(false),
iv_intrTaskQ(0),
iv_shutdownPrdTask(false),
iv_prdTask(0),
iv_intrTask(0)
{
- mutex_init(&iv_mutex);
sync_cond_init(&iv_cond);
}
@@ -706,7 +432,6 @@ Service::~Service()
}
sync_cond_destroy(&iv_cond);
- mutex_destroy(&iv_mutex);
}
bool Service::running()
diff --git a/src/usr/diag/attn/ipl/attnsvc.H b/src/usr/diag/attn/ipl/attnsvc.H
index 27713e3a2..7f0d3f487 100644
--- a/src/usr/diag/attn/ipl/attnsvc.H
+++ b/src/usr/diag/attn/ipl/attnsvc.H
@@ -33,8 +33,7 @@
#include <sys/task.h>
#include <sys/sync.h>
-#include "common/attnfwd.H"
-#include "common/attnlist.H"
+#include "common/attnsvc_common.H"
namespace ATTN
{
@@ -42,7 +41,7 @@ namespace ATTN
/**
* @brief Service Host attention handler background service class definition.
*/
-class Service
+class Service : public ServiceCommon
{
public:
@@ -95,16 +94,6 @@ class Service
private:
/**
- * @brief ConfigureMode
- *
- * Up or down for parameter for configure methods.
- */
- enum ConfigureMode
- {
- UP, DOWN,
- };
-
- /**
* @brief configureInterrupts enable or
* disable interrupts used by the service, on all
* functioning processors.
@@ -227,17 +216,6 @@ class Service
bool prdTaskWait();
/**
- * @brief processAttentions process interrupt task wakeup
- *
- * call prd to analyze attentions
- *
- * @param[i_procs] procs to check for attentions behind
- *
- * @post attentions analyzed by prd. attentions cleared by prd unmasked
- */
- void processAttentions(const TARGETING::TargetHandleList & i_procs);
-
- /**
* @brief iv_interrupt PRD thread wakeup indicator
*/
bool iv_interrupt;
@@ -263,11 +241,6 @@ class Service
tid_t iv_intrTask;
/**
- * @brief iv_mutex pendingAttentions protection
- */
- mutex_t iv_mutex;
-
- /**
* @brief iv_cond pendingAttentions and shutdown flag condition
*/
sync_cond_t iv_cond;
diff --git a/src/usr/diag/attn/ipl/test/attntestipl.H b/src/usr/diag/attn/ipl/test/attntestipl.H
index 28b69fb4f..8c71ae5bb 100644
--- a/src/usr/diag/attn/ipl/test/attntestipl.H
+++ b/src/usr/diag/attn/ipl/test/attntestipl.H
@@ -41,6 +41,7 @@
#include "attntest.H"
#include "../../common/attnproc.H"
#include <cxxtest/TestSuite.H>
+#include "../../common/attntrace.H"
using namespace ATTN;
using namespace TARGETING;
@@ -59,12 +60,13 @@ class AttnCheckForIplAttentionsTest : public CxxTest::TestSuite
*/
void testCheckForIplAttentions(void)
{
+ ATTN_SLOW(ENTER_MRK "AttnCheckForIplAttentionsTest::"
+ "testCheckForIplAttentions");
+
static const uint64_t targetPoolSize = 8;
static const uint64_t iterations = 100;
static const uint64_t maxAttnsPerIteration = 5;
- TS_TRACE(ENTER_MRK "testCheckForIplAttentions");
-
errlHndl_t err = 0;
FakeSystem system;
@@ -131,7 +133,8 @@ class AttnCheckForIplAttentionsTest : public CxxTest::TestSuite
uint64_t count = system.count();
if(count)
{
- TS_FAIL("%d unexpected attentions present after check for ipl attentions.", count);
+ TS_FAIL("%d unexpected attentions present after check for "
+ "ipl attentions.", count);
system.dump();
break;
@@ -139,7 +142,8 @@ class AttnCheckForIplAttentionsTest : public CxxTest::TestSuite
} while(0);
- TS_TRACE(EXIT_MRK "testCheckForIplAttentions");
+ ATTN_SLOW(EXIT_MRK "AttnCheckForIplAttentionsTest::"
+ "testCheckForIplAttentions");
}
};
#endif
diff --git a/src/usr/diag/attn/ipl/test/attntestmem.H b/src/usr/diag/attn/ipl/test/attntestmem.H
index b0f7739fd..9b4997715 100644
--- a/src/usr/diag/attn/ipl/test/attntestmem.H
+++ b/src/usr/diag/attn/ipl/test/attntestmem.H
@@ -47,6 +47,7 @@
#include "attnmeminject.H"
#include <cxxtest/TestSuite.H>
#include <sys/time.h>
+#include "../../common/attntrace.H"
using namespace ATTN;
using namespace std;
@@ -64,12 +65,12 @@ class AttnMemTest: public CxxTest::TestSuite
*/
void testFakeAttentions()
{
+ ATTN_SLOW(ENTER_MRK "AttnMemTest::testFakeAttentions");
+
static const uint64_t targetPoolSize = 8;
static const uint64_t iterations = 5;
static const uint64_t maxAttentionsPerIteration = 5;
- TS_TRACE(ENTER_MRK "testFakeAttentions");
-
errlHndl_t err = 0;
Service svc;
@@ -173,7 +174,7 @@ class AttnMemTest: public CxxTest::TestSuite
v.dump();
}
- TS_TRACE(EXIT_MRK "testFakeAttentions");
+ ATTN_SLOW(EXIT_MRK "AttnMemTest::testFakeAttentions");
}
/**
@@ -182,11 +183,11 @@ class AttnMemTest: public CxxTest::TestSuite
*/
void testAttentions(void)
{
+ ATTN_SLOW(ENTER_MRK "AttnMemTest::testAttentions");
+
static const uint64_t iterations = 1;
static const uint64_t maxAttnsPerIteration = 1;
- TS_TRACE(ENTER_MRK "testAttentions");
-
errlHndl_t err = 0;
Service svc;
@@ -244,7 +245,7 @@ class AttnMemTest: public CxxTest::TestSuite
delete err;
}
- TS_TRACE(EXIT_MRK "testAttentions");
+ ATTN_SLOW(EXIT_MRK "AttnMemTest::testAttentions");
}
};
#endif
diff --git a/src/usr/diag/attn/ipl/test/attntestproc.H b/src/usr/diag/attn/ipl/test/attntestproc.H
index 7e56daeb1..06e1d4f1a 100644
--- a/src/usr/diag/attn/ipl/test/attntestproc.H
+++ b/src/usr/diag/attn/ipl/test/attntestproc.H
@@ -44,6 +44,7 @@
#include "attnvalidate.H"
#include <cxxtest/TestSuite.H>
#include <sys/time.h>
+#include "../../common/attntrace.H"
using namespace ATTN;
using namespace PRDF;
@@ -62,11 +63,11 @@ class AttnProcTest: public CxxTest::TestSuite
*/
void testQuery(void)
{
+ ATTN_SLOW(ENTER_MRK "AttnProcTest::testQuery");
+
static const uint64_t iterations = 100;
static const uint64_t targetPoolSize = 8;
- TS_TRACE(ENTER_MRK "testQuery");
-
errlHndl_t err = 0;
ProcOps ops;
@@ -144,7 +145,7 @@ class AttnProcTest: public CxxTest::TestSuite
}
}
- TS_TRACE(EXIT_MRK "testQuery");
+ ATTN_SLOW(EXIT_MRK "AttnProcTest::testQuery");
}
/**
@@ -153,12 +154,12 @@ class AttnProcTest: public CxxTest::TestSuite
*/
void testFakeAttentions()
{
+ ATTN_SLOW(ENTER_MRK "AttnProcTest::testFakeAttentions");
+
static const uint64_t targetPoolSize = 8;
static const uint64_t iterations = 5;
static const uint64_t maxAttnsPerIteration = 5;
- TS_TRACE(ENTER_MRK "testFakeAttentions");
-
errlHndl_t err = 0;
Service svc;
@@ -269,7 +270,7 @@ class AttnProcTest: public CxxTest::TestSuite
v.dump();
}
- TS_TRACE(EXIT_MRK "testFakeAttentions");
+ ATTN_SLOW(EXIT_MRK "AttnProcTest::testFakeAttentions");
}
};
#endif
diff --git a/src/usr/diag/attn/ipl/test/attntestsvc.H b/src/usr/diag/attn/ipl/test/attntestsvc.H
index f873108ce..daadf1489 100644
--- a/src/usr/diag/attn/ipl/test/attntestsvc.H
+++ b/src/usr/diag/attn/ipl/test/attntestsvc.H
@@ -35,6 +35,7 @@
#include "attnfakesys.H"
#include "attntest.H"
#include <cxxtest/TestSuite.H>
+#include "../../common/attntrace.H"
using namespace ATTN;
using namespace std;
@@ -188,12 +189,12 @@ class AttnSvcTest: public CxxTest::TestSuite
*/
void testAttentions()
{
+ ATTN_SLOW(ENTER_MRK "AttnSvcTest:testAttentions");
+
static const uint64_t targetPoolSize = 8;
static const uint64_t iterations = 5;
static const uint64_t maxAttnsPerIteration = 5;
- TS_TRACE(ENTER_MRK "testAttentions");
-
errlHndl_t err = 0;
Service svc;
@@ -333,7 +334,7 @@ class AttnSvcTest: public CxxTest::TestSuite
v.dump();
}
- TS_TRACE(EXIT_MRK "testAttentions");
+ ATTN_SLOW(EXIT_MRK "AttnSvcTest:testAttentions");
}
};
#endif
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
OpenPOWER on IntegriCloud