diff --git a/src/include/usr/fapiwrap/fapiWrapif.H b/src/include/usr/fapiwrap/fapiWrapif.H new file mode 100644 index 00000000000..f37aea26b90 --- /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 // 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 924091fc689..d8d819f504c 100644 --- a/src/include/usr/hbotcompid.H +++ b/src/include/usr/hbotcompid.H @@ -505,6 +505,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 diff --git a/src/makefile b/src/makefile index 52b44336a65..bd80d63bfb4 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 00000000000..dc52570e6de --- /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 // interface definitions +#include // FAPI_INVOKE_HWP +#include // tracing includes + +#include // 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::TYPE_OCMB_CHIP, + "exp_getidec_wrap: error expected type OCMB_CHIP"); + + fapi2::Target 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 00000000000..61ccd9646cd --- /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 b57469430c1..70b88a0d4ab 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 5f4e94cf391..4566d694132 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