diff options
Diffstat (limited to 'src/usr/fapi2/test')
-rw-r--r-- | src/usr/fapi2/test/fapi2HwpTest.C | 63 | ||||
-rw-r--r-- | src/usr/fapi2/test/makefile | 1 | ||||
-rw-r--r-- | src/usr/fapi2/test/p9_hwtests.C | 192 | ||||
-rw-r--r-- | src/usr/fapi2/test/p9_hwtests.H | 67 |
4 files changed, 322 insertions, 1 deletions
diff --git a/src/usr/fapi2/test/fapi2HwpTest.C b/src/usr/fapi2/test/fapi2HwpTest.C index d8fb23c0c..35ce9bdc5 100644 --- a/src/usr/fapi2/test/fapi2HwpTest.C +++ b/src/usr/fapi2/test/fapi2HwpTest.C @@ -28,6 +28,7 @@ #include <fapi2.H> #include <hwpf_fapi2_reasoncodes.H> #include <fapi2TestUtils.H> +#include <p9_hwtests.H> namespace fapi2 { @@ -150,6 +151,66 @@ errlHndl_t fapi2HwpTest() TS_FAIL("Error occured in p9_sample_procedure_proc !!"); } numTests++; + FAPI_INVOKE_HWP(l_errl, p9_scomtest_getscom_fail, fapi2_procTarget); + if(l_errl != NULL) + { + delete l_errl; // delete expected error log + } + else + { + TS_FAIL("No error from p9_scomtest_getscom_fail !!"); + numFails++; + } + numTests++; + FAPI_INVOKE_HWP(l_errl, p9_scomtest_putscom_fail, fapi2_procTarget); + if(l_errl != NULL) + { + delete l_errl; // delete expected error log + } + else + { + TS_FAIL("No error from p9_scomtest_putscom_fail !!"); + numFails++; + } + numTests++; + FAPI_INVOKE_HWP(l_errl, p9_cfamtest_putcfam_fail, fapi2_procTarget); + if(l_errl != NULL) + { + delete l_errl; // delete expected error log + } + else + { + TS_FAIL("No error from p9_cfamtest_putcfam_fail !!"); + numFails++; + } + numTests++; + FAPI_INVOKE_HWP(l_errl, p9_cfamtest_getcfam_fail, fapi2_procTarget); + if(l_errl != NULL) + { + delete l_errl; // delete expected error log + } + else + { + TS_FAIL("No error from p9_cfamtest_getcfam_fail !!"); + numFails++; + } + numTests++; + FAPI_INVOKE_HWP(l_errl, p9_scomtest_getscom_pass, fapi2_procTarget); + if(l_errl) + { + TS_FAIL("Error from p9_scomtest_getscom_pass !!"); + numFails++; + } + numTests++; + FAPI_INVOKE_HWP(l_errl, p9_scomtest_putscom_pass, fapi2_procTarget); + if(l_errl) + { + TS_FAIL("Error from p9_scomtest_putscom_pass !!"); + numFails++; + } + + + numTests++; FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_eq, fapi2_eqTarget, scratchWriteValue); if(l_errl != NULL) { @@ -274,4 +335,4 @@ errlHndl_t fapi2HwpTest() return l_errl; } -}
\ No newline at end of file +} diff --git a/src/usr/fapi2/test/makefile b/src/usr/fapi2/test/makefile index ffebf05e3..5184e449e 100644 --- a/src/usr/fapi2/test/makefile +++ b/src/usr/fapi2/test/makefile @@ -37,6 +37,7 @@ EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/utils/ # Procedures OBJS += p9_sample_procedure.o +OBJS += p9_hwtests.o OBJS += fapi2TestUtils.o TESTS += fapi2Test.H diff --git a/src/usr/fapi2/test/p9_hwtests.C b/src/usr/fapi2/test/p9_hwtests.C new file mode 100644 index 000000000..2f066aa4e --- /dev/null +++ b/src/usr/fapi2/test/p9_hwtests.C @@ -0,0 +1,192 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/fapi2/test/p9_hwtests.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* [+] 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 p9_hwtests.C +/// +/// @brief These procedures test the fapi2 hw_access interfaces. +//----------------------------------------------------------------------------- + +#include <fapi2.H> + + +fapi2::ReturnCode p9_scomtest_getscom_fail( + fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target) +{ + fapi2::buffer<uint64_t> l_scomdata = 0; + + FAPI_INF("Entering p9_scomtest_getscom_fail..."); + + FAPI_INF("Do getscom on proc target"); + FAPI_TRY(fapi2::getScom(i_target, + 0x11223344, + l_scomdata)); + + fapi_try_exit: + + FAPI_INF("Exiting p9_scomtest_getscom_fail..."); + + return fapi2::current_err; + +} + +fapi2::ReturnCode p9_scomtest_putscom_fail( + fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target) +{ + fapi2::buffer<uint64_t> l_scomdata = 0; + + FAPI_INF("Entering p9_scomtest_putscom_fail..."); + + FAPI_INF("Do getscom on proc target"); + FAPI_TRY(fapi2::putScom(i_target, + 0x22334455, + l_scomdata)); + + fapi_try_exit: + + FAPI_INF("Exiting p9_scomtest_putscom_fail..."); + + return fapi2::current_err; + +} + +fapi2::ReturnCode p9_cfamtest_getcfam_fail( + fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target) +{ + fapi2::buffer<uint32_t> l_cfamdata = 0; + + FAPI_INF("Entering p9_cfamtest_getcfam_fail..."); + + FAPI_INF("Do getcfam on proc target"); + FAPI_TRY(fapi2::getCfamRegister(i_target, + 0x11223344, + l_cfamdata)); + + fapi_try_exit: + + FAPI_INF("Exiting p9_cfamtest_getcfam_fail..."); + + return fapi2::current_err; + +} + +fapi2::ReturnCode p9_cfamtest_putcfam_fail( + fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target) +{ + fapi2::buffer<uint32_t> l_cfamdata = 0; + + FAPI_INF("Entering p9_cfamtest_putcfam_fail..."); + + FAPI_INF("Do getcfam on proc target"); + FAPI_TRY(fapi2::putCfamRegister(i_target, + 0x22334455, + l_cfamdata)); + + fapi_try_exit: + + FAPI_INF("Exiting p9_cfamtest_putcfam_fail..."); + + return fapi2::current_err; + +} + +fapi2::ReturnCode p9_scomtest_getscom_pass( + fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target) +{ + fapi2::buffer<uint64_t> l_scomdata = 0; + + FAPI_INF("Entering p9_scomtest_getscom_pass..."); + + FAPI_INF("Do getscom on proc target"); + FAPI_TRY(fapi2::getScom(i_target, + 0x02010803, //CXA FIR Mask Register + l_scomdata)); + + fapi_try_exit: + + FAPI_INF("Exiting p9_scomtest_getscom_pass..."); + + return fapi2::current_err; + +} + +fapi2::ReturnCode p9_scomtest_putscom_pass( + fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target) +{ + fapi2::buffer<uint64_t> l_scomdata = 0; + + FAPI_INF("Entering p9_scomtest_putscom_pass..."); + + FAPI_INF("Do getscom on proc target"); + FAPI_TRY(fapi2::putScom(i_target, + 0x02010803, //CXA FIR Mask Register + l_scomdata)); + + fapi_try_exit: + + FAPI_INF("Exiting p9_scomtest_putscom_pass..."); + + return fapi2::current_err; + +} + +fapi2::ReturnCode p9_cfamtest_getcfam_pass( + fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target) +{ + fapi2::buffer<uint32_t> l_cfamdata = 0; + + FAPI_INF("Entering p9_cfamtest_getcfam_pass..."); + + FAPI_INF("Do getcfam on proc target"); + FAPI_TRY(fapi2::getCfamRegister(i_target, + 0x1000, //DATA_0 from FSI2PIB + l_cfamdata)); + + fapi_try_exit: + + FAPI_INF("Exiting p9_cfamtest_getcfam_pass..."); + + return fapi2::current_err; + +} + +fapi2::ReturnCode p9_cfamtest_putcfam_pass( + fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target) +{ + fapi2::buffer<uint32_t> l_cfamdata = 0; + + FAPI_INF("Entering p9_cfamtest_putcfam_pass..."); + + FAPI_INF("Do getcfam on proc target"); + FAPI_TRY(fapi2::putCfamRegister(i_target, + 0x1000, //DATA_0 from FSI2PIB + l_cfamdata)); + + fapi_try_exit: + + FAPI_INF("Exiting p9_cfamtest_putcfam_pass..."); + + return fapi2::current_err; + +} diff --git a/src/usr/fapi2/test/p9_hwtests.H b/src/usr/fapi2/test/p9_hwtests.H new file mode 100644 index 000000000..9143e2a64 --- /dev/null +++ b/src/usr/fapi2/test/p9_hwtests.H @@ -0,0 +1,67 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/fapi2/test/p9_hwtests.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* [+] 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 p9_hwtests.C +/// +/// @brief These procedures test the fapi2 hw_access interfaces. +//------------------------------------------------------------------------------ +#ifndef _P9_HWTESTS_H_ +#define _P9_HWTESTS_H_ + +#include <fapi2.H> + +fapi2::ReturnCode p9_scomtest_getscom_fail( + fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target); + + +fapi2::ReturnCode p9_scomtest_putscom_fail( + fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target); + + +fapi2::ReturnCode p9_cfamtest_getcfam_fail( + fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target); + + +fapi2::ReturnCode p9_cfamtest_putcfam_fail( + fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target); + + +fapi2::ReturnCode p9_scomtest_getscom_pass( + fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target); + + +fapi2::ReturnCode p9_scomtest_putscom_pass( + fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target); + + +fapi2::ReturnCode p9_cfamtest_getcfam_pass( + fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target); + + +fapi2::ReturnCode p9_cfamtest_putcfam_pass( + fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target); + + +#endif |