diff options
| author | Stephen Cprek <smcprek@us.ibm.com> | 2017-10-03 09:36:58 -0500 |
|---|---|---|
| committer | William G. Hoffa <wghoffa@us.ibm.com> | 2017-10-24 13:58:43 -0400 |
| commit | 0ff075bac5d78384a625de70b34b7ef363a25fd6 (patch) | |
| tree | 30e1a8e011be3b2bfde6d4e616f8745dde212d28 /src/usr/runtime/test | |
| parent | da12bd653f7eabbc2d97938a3ac25666187e6abb (diff) | |
| download | talos-hostboot-0ff075bac5d78384a625de70b34b7ef363a25fd6.tar.gz talos-hostboot-0ff075bac5d78384a625de70b34b7ef363a25fd6.zip | |
Create Pre Verified Lid Manager and refactor exisiting implementation
Change-Id: I5417b8e381bf15a1b696cf006940eedd7a1e235c
RTC:125304
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/47110
Reviewed-by: Michael Baiocchi <mbaiocch@us.ibm.com>
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: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src/usr/runtime/test')
| -rw-r--r-- | src/usr/runtime/test/makefile | 1 | ||||
| -rw-r--r-- | src/usr/runtime/test/testpreverifiedlidmgr.H | 123 |
2 files changed, 124 insertions, 0 deletions
diff --git a/src/usr/runtime/test/makefile b/src/usr/runtime/test/makefile index e307302f2..92715cf83 100644 --- a/src/usr/runtime/test/makefile +++ b/src/usr/runtime/test/makefile @@ -25,6 +25,7 @@ ROOTPATH = ../../../.. MODULE = testruntime +TESTS += testpreverifiedlidmgr.H #@TODO RTC 132750 #TESTS += hdatservicetest.H #@TODO RTC:178802 diff --git a/src/usr/runtime/test/testpreverifiedlidmgr.H b/src/usr/runtime/test/testpreverifiedlidmgr.H new file mode 100644 index 000000000..4fca35b5f --- /dev/null +++ b/src/usr/runtime/test/testpreverifiedlidmgr.H @@ -0,0 +1,123 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/runtime/test/testpreverifiedlidmgr.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2017 */ +/* [+] 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 _TESTPREVERIFIEDLIDMGR_H +#define _TESTPREVERIFIEDLIDMGR_H + +#include <cxxtest/TestSuite.H> +#include <errl/errlmanager.H> +#include <runtime/preverifiedlidmgr.H> +#include <secureboot/service.H> +#include <usr/vmmconst.h> +#include <runtime/populate_hbruntime.H> +#include <pnor/pnorif.H> + +extern trace_desc_t* g_trac_runtime; + +class PreVerifiedLidMgrTest : public CxxTest::TestSuite +{ + public: + + void testPreVerifiedLidMgrInit() + { + // Initialize Pre verified lid manager with test address space and + // payload kind none + PreVerifiedLidMgr::initLock(PREVERLIDMGR_TEST_ADDR); + + // Get Instance of Pre-Verified lid manager + auto l_preVerLidMgr = PreVerifiedLidMgr::getInstance(); + + if (l_preVerLidMgr.cv_payloadKind != TARGETING::PAYLOAD_KIND_NONE) + { + TS_FAIL("testPreVerifiedLidMgrInit> payload kind incorrect"); + } + + if (l_preVerLidMgr.cv_resvMemInfo.curAddr != PREVERLIDMGR_TEST_ADDR) + { + TS_FAIL("testPreVerifiedLidMgrInit> payload kind incorrect"); + } + + PreVerifiedLidMgr::unlock(); + } + + void testLoadFromPnor() + { + TRACFCOMP( g_trac_runtime, ENTER_MRK"testLoadFromPnor start" ); + + errlHndl_t l_errl = nullptr; + + do { + + // Initialize Pre verified lid manager with test address space and + // payload kind none + PreVerifiedLidMgr::initLock(PREVERLIDMGR_TEST_ADDR); + + // Get Instance of Pre-Verified lid manager + auto l_preVerLidMgr = PreVerifiedLidMgr::getInstance(); + + // Clear lids loaded cache as other test cases fill it in. + l_preVerLidMgr.cv_lidsLoaded.clear(); + + // Handle all Pre verified PNOR sections + for (const auto secId : RUNTIME::preVerifiedPnorSections) + { + l_errl = RUNTIME::hbResvLoadSecureSection(secId); + if (l_errl) + { + TS_FAIL("testLoadFromPnor> Failed to Load Pnor Section %s", + PNOR::SectionIdToString(secId)); + errlCommit(l_errl, RUNTIME_COMP_ID); + break; + } + } + if (l_errl) + { + break; + } + + // Each section has 2 lids each (Header, Content) except the RINGOVD + // section. It only has 1 or is inhibited in secure mode + size_t l_numSections = RUNTIME::preVerifiedPnorSections.size(); + size_t l_expectedLids = (2 * l_numSections) - 1; + if (SECUREBOOT::enabled()) + { + l_expectedLids--; + } + + // Ensure the expected number of lids were loaded. + if (l_preVerLidMgr.cv_lidsLoaded.size() != l_expectedLids) + { + TS_FAIL("testLoadFromPnor> Num of lids loaded not correct"); + break; + } + + } while(0); + + PreVerifiedLidMgr::unlock(); + + TRACFCOMP( g_trac_runtime, EXIT_MRK"testLoadFromPnor complete" ); + } +}; + +#endif
\ No newline at end of file |

