diff options
author | Christian Geddes <crgeddes@us.ibm.com> | 2019-08-28 17:13:58 -0500 |
---|---|---|
committer | Daniel M Crowell <dcrowell@us.ibm.com> | 2019-09-20 16:14:31 -0500 |
commit | b7c4af200f89786106e986767ed9f293291f3bdf (patch) | |
tree | 047f47154c383bc19ff821e4a2ce523feefe97d7 | |
parent | d0f0ff1e58757c833149b4e5ee6dc597a5028372 (diff) | |
download | talos-hostboot-b7c4af200f89786106e986767ed9f293291f3bdf.tar.gz talos-hostboot-b7c4af200f89786106e986767ed9f293291f3bdf.zip |
Add wrapper to exp_getidec HWP so we can call it in platform code
There has been a trend to create more HWPs that process raw data.
This allows Hostboot and Cronus to share more code. The trick is
that we generally want to call these HWPs inside traditionally
hostboot-only code. This new fapiwrap directory will help encapsulate
all of the calls to ekb code in one place. That way if we ever need
to remove HWPs/EKB code it will be easier to stub out the calls. In the
past we have contaminated a lot of Hostboot-only code with calls out
to EKB code. This new new directory should help avoid this issue.
Change-Id: I2b2d0d1e62c97f0976c9c9ede3fe2eac30c7a40f
RTC: 214627
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/83029
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Ilya Smirnov <ismirno@us.ibm.com>
Reviewed-by: Daniel M Crowell <dcrowell@us.ibm.com>
-rw-r--r-- | src/include/usr/fapiwrap/fapiWrapif.H | 60 | ||||
-rw-r--r-- | src/include/usr/hbotcompid.H | 10 | ||||
-rw-r--r-- | src/makefile | 1 | ||||
-rw-r--r-- | src/usr/fapiwrap/fapiWrap.C | 58 | ||||
-rw-r--r-- | src/usr/fapiwrap/makefile | 50 | ||||
-rw-r--r-- | src/usr/initservice/extinitsvc/extinitsvctasks.H | 12 | ||||
-rw-r--r-- | src/usr/makefile | 1 |
7 files changed, 191 insertions, 1 deletions
diff --git a/src/include/usr/fapiwrap/fapiWrapif.H b/src/include/usr/fapiwrap/fapiWrapif.H new file mode 100644 index 000000000..f37aea26b --- /dev/null +++ b/src/include/usr/fapiwrap/fapiWrapif.H @@ -0,0 +1,60 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/fapiwrap/fapiWrapif.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2019 */ +/* [+] 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 _FAPIWRAPIF_H +#define _FAPIWRAPIF_H + +#include <errl/errlentry.H> // Also gets us targeting/common/target.H + + +/* *** Overview *** + There has been a trend to create more HWPs that process raw data. + This allows Hostboot and Cronus (and other platforms to share more code. + The trick is that we generally want to call these HWPs inside what has + traditionally been Hostboot-only code. The fapiwrap directory will help + encapsulate all of the calls to ekb code in one place. That way if we + ever need to remove HWPs/EKB code it will be easier to stub out the calls. + We have found in the past we have contaminated a lot of Hostboot-only + code with calls to EKB code. This directory should help address that problem. +*/ + + +namespace FAPIWRAP +{ + /** + * @brief This function wraps around the FAPI2 HWP "exp_getidec" which + * takes in a OCMB target and returns the associated chipId + * and ec level. + * Chip Ids can be found in src/import/chips/common/utils/chipids.H + * @param[in] i_ocmbChip - Explorer OCMB target to lookup values on + * @param[out] o_chipId - Power Chip Id associated with this OCMB + * @param[out] o_ec - EC level of this chip + * @return errlHndl_t - nullptr if no error, otherwise contains error + */ + errlHndl_t explorer_getidec( TARGETING::Target * i_ocmbChip, + uint16_t& o_chipId, + uint8_t& o_ec); +} + +#endif
\ No newline at end of file diff --git a/src/include/usr/hbotcompid.H b/src/include/usr/hbotcompid.H index 924091fc6..d8d819f50 100644 --- a/src/include/usr/hbotcompid.H +++ b/src/include/usr/hbotcompid.H @@ -506,6 +506,16 @@ const char BPM_COMP_NAME[] = "bpm"; //@} // +/** @name FAPIWRAP + * Wrapper around fapi2 HWP for hb platform to use + */ +//@{ +const compId_t FAPIWRAP_COMP_ID = 0x4400; +const char FAPIWRAP_COMP_NAME[] = "fapiwrap"; + +//@} + +// // /** @name HDAT * HDAT component diff --git a/src/makefile b/src/makefile index 52b44336a..bd80d63bf 100644 --- a/src/makefile +++ b/src/makefile @@ -220,6 +220,7 @@ EXTENDED_MODULES += mmio EXTENDED_MODULES += smf EXTENDED_MODULES += expaccess EXTENDED_MODULES += expupd +EXTENDED_MODULES += fapiwrap #*************************************** # Working test modules diff --git a/src/usr/fapiwrap/fapiWrap.C b/src/usr/fapiwrap/fapiWrap.C new file mode 100644 index 000000000..dc52570e6 --- /dev/null +++ b/src/usr/fapiwrap/fapiWrap.C @@ -0,0 +1,58 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/fapiwrap/fapiWrap.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2019 */ +/* [+] 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 */ + +#include <fapiwrap/fapiWrapif.H> // interface definitions +#include <fapi2/plat_hwp_invoker.H> // FAPI_INVOKE_HWP +#include <trace/interface.H> // tracing includes + +#include <exp_getidec.H> // exp_getidec + +trace_desc_t* g_trac_fapiwrap; +TRAC_INIT(&g_trac_fapiwrap, FAPIWRAP_COMP_NAME, 6*KILOBYTE, TRACE::BUFFER_SLOW); + + +namespace FAPIWRAP +{ + errlHndl_t explorer_getidec( TARGETING::Target * i_ocmbChip, + uint16_t& o_chipId, + uint8_t& o_ec) + { + errlHndl_t l_errl = nullptr; + + //assert type of i_ocmbChip == TARGETING::TYPE_OCMB_CHIP + assert(i_ocmbChip->getAttr<TARGETING::ATTR_TYPE>() == TARGETING::TYPE_OCMB_CHIP, + "exp_getidec_wrap: error expected type OCMB_CHIP"); + + fapi2::Target <fapi2::TARGET_TYPE_OCMB_CHIP> l_fapi_ocmb_target(i_ocmbChip); + + FAPI_INVOKE_HWP(l_errl, + exp_getidec, + l_fapi_ocmb_target, + o_chipId, + o_ec); + + return l_errl; + } +}
\ No newline at end of file diff --git a/src/usr/fapiwrap/makefile b/src/usr/fapiwrap/makefile new file mode 100644 index 000000000..61ccd9646 --- /dev/null +++ b/src/usr/fapiwrap/makefile @@ -0,0 +1,50 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/fapiwrap/makefile $ +# +# OpenPOWER HostBoot Project +# +# Contributors Listed Below - COPYRIGHT 2019 +# [+] 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 +ROOTPATH = ../../.. +MODULE = fapiwrap + +# Add the import path to the include path +EXTRAINCDIR += ${ROOTPATH}/src/import +# to get fapi2.H +EXTRAINCDIR += ${ROOTPATH}/src/import/hwpf/fapi2/include/ +# to get target.H +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/fapi2/ +# to get common_ringId.H +EXTRAINCDIR += ${ROOTPATH}/src/import/chips/common/utils/imageProcs/ +# to get ffdc_includes.H +EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/ffdc/ + +# HWP include directories : +EXTRAINCDIR += ${ROOTPATH}/src/import/chips/ocmb/explorer/procedures/hwp/memory/ + +# HWP objects +OBJS += exp_getidec.o + +OBJS += fapiWrap.o + +# Add HWP src directories to VPATH +VPATH += ${ROOTPATH}/src/import/chips/ocmb/explorer/procedures/hwp/memory/ + +include ${ROOTPATH}/config.mk
\ No newline at end of file diff --git a/src/usr/initservice/extinitsvc/extinitsvctasks.H b/src/usr/initservice/extinitsvc/extinitsvctasks.H index b57469430..70b88a0d4 100644 --- a/src/usr/initservice/extinitsvc/extinitsvctasks.H +++ b/src/usr/initservice/extinitsvc/extinitsvctasks.H @@ -276,7 +276,17 @@ const TaskInfo g_exttaskinfolist[] = { EXT_IMAGE, // Extended Module } }, - + /** + * @brief fapiwrap task, handles fapi wrapper for platform libraries + */ + { + "libfapiwrap.so" , // taskname + NULL, // no pointer to fn + { + INIT_TASK, // task type + EXT_IMAGE, // Extended Module + } + }, // @todo RTC:145354 Restore testprdf and testattn in p9 branch /** diff --git a/src/usr/makefile b/src/usr/makefile index 5f4e94cf3..4566d6941 100644 --- a/src/usr/makefile +++ b/src/usr/makefile @@ -38,6 +38,7 @@ SUBDIRS += errl.d SUBDIRS += errldisplay.d SUBDIRS += expaccess.d SUBDIRS += fapi2.d +SUBDIRS += fapiwrap.d SUBDIRS += fsi.d SUBDIRS += fsiscom.d SUBDIRS += gpio.d |