summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/include/usr/hwpf/hwp/occ/occ.H5
-rw-r--r--src/include/usr/pnor/pnorif.H1
-rw-r--r--src/include/usr/util/util_reasoncodes.H19
-rw-r--r--src/include/usr/util/utillidmgr.H48
-rw-r--r--src/usr/hwpf/hwp/occ/occ.C6
-rw-r--r--src/usr/hwpf/hwp/occ/runtime/rt_occ.C4
-rw-r--r--src/usr/hwpf/test/runtime/rt_occtest.H9
-rw-r--r--src/usr/pnor/pnorrp.C3
-rw-r--r--src/usr/util/runtime/test/testlidmgr_rt.H (renamed from src/usr/util/runtime/test/testlidmgr.H)11
-rw-r--r--src/usr/util/runtime/utillidmgr_rt.C7
-rw-r--r--src/usr/util/test/testlidmgr.H165
-rw-r--r--src/usr/util/utillidmgr.C612
-rw-r--r--src/usr/util/utillidpnor.H70
13 files changed, 673 insertions, 287 deletions
diff --git a/src/include/usr/hwpf/hwp/occ/occ.H b/src/include/usr/hwpf/hwp/occ/occ.H
index a94cceb14..aa00823d5 100644
--- a/src/include/usr/hwpf/hwp/occ/occ.H
+++ b/src/include/usr/hwpf/hwp/occ/occ.H
@@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2013,2014 */
+/* Contributors Listed Below - COPYRIGHT 2013,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. */
@@ -37,7 +39,6 @@ namespace HBOCC {
enum
{
OccHostDataVersion = 1,
- OCC_LIDID = 0x81e00430,
OCC_IBSCOM_RANGE_IN_MB = MEGABYTE,
};
diff --git a/src/include/usr/pnor/pnorif.H b/src/include/usr/pnor/pnorif.H
index 6aed66234..971a399c0 100644
--- a/src/include/usr/pnor/pnorif.H
+++ b/src/include/usr/pnor/pnorif.H
@@ -56,6 +56,7 @@ enum SectionId
CENTAUR_VPD, /**< Centaur VPD */
ATTR_OVER, /**< Attribute Override */
NVRAM, /**< Opal NVRAM */
+ OCC, /**< OCC lid */
TEST, /**< Scratch space for PNOR test cases */
NUM_SECTIONS, /**< Number of defined sections */
diff --git a/src/include/usr/util/util_reasoncodes.H b/src/include/usr/util/util_reasoncodes.H
index 6825c8f6b..7f6ab0c1d 100644
--- a/src/include/usr/util/util_reasoncodes.H
+++ b/src/include/usr/util/util_reasoncodes.H
@@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2012,2014 */
+/* 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. */
@@ -40,13 +42,14 @@ namespace Util
enum ReasonCode
{
- UTIL_ERC_NONE = UTIL_COMP_ID | 0x01,
- UTIL_ERC_BAD_PTR = UTIL_COMP_ID | 0x02,
- UTIL_ERC_EOF = UTIL_COMP_ID | 0x03,
- UTIL_LIDMGR_RC_FAIL = UTIL_COMP_ID | 0x04,
- UTIL_LIDMGR_INVAL_DATA = UTIL_COMP_ID | 0x05,
- UTIL_LIDMGR_INVAL_SIZE = UTIL_COMP_ID | 0x06,
- UTIL_LIDMGR_UNSUP_MSG = UTIL_COMP_ID | 0x07,
+ UTIL_ERC_NONE = UTIL_COMP_ID | 0x01,
+ UTIL_ERC_BAD_PTR = UTIL_COMP_ID | 0x02,
+ UTIL_ERC_EOF = UTIL_COMP_ID | 0x03,
+ UTIL_LIDMGR_RC_FAIL = UTIL_COMP_ID | 0x04,
+ UTIL_LIDMGR_INVAL_DATA = UTIL_COMP_ID | 0x05,
+ UTIL_LIDMGR_INVAL_SIZE = UTIL_COMP_ID | 0x06,
+ UTIL_LIDMGR_UNSUP_MSG = UTIL_COMP_ID | 0x07,
+ UTIL_LIDMGR_INVAL_SIZE_PNOR = UTIL_COMP_ID | 0x08,
};
};
diff --git a/src/include/usr/util/utillidmgr.H b/src/include/usr/util/utillidmgr.H
index 5a726add6..624f040f3 100644
--- a/src/include/usr/util/utillidmgr.H
+++ b/src/include/usr/util/utillidmgr.H
@@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2013,2014 */
+/* Contributors Listed Below - COPYRIGHT 2013,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. */
@@ -35,8 +37,18 @@
#include <mbox/mboxif.H>
#include <errl/errlentry.H>
#include <sys/msg.h>
+#include <pnor/pnorif.H>
+namespace Util
+{
+// Lid id's
+enum LidId
+{
+ TEST_LIDID = 0x00000111,
+ OCC_LIDID = 0x81e00430,
+};
+}
class UtilLidMgr
{
@@ -305,6 +317,19 @@ class UtilLidMgr
* @brief Pointer to message queue
*/
msg_q_t iv_HbMsgQ;
+
+ /**
+ * @brief search lidToPnor array for the pnor section for the given lid
+ * lidToPnor array does not includes the ext img section
+ *
+ * @param[in] i_lidId - provide lid id to search for
+ * @param[out] o_lidPnorInfo - pnor section that the lid is in
+ *
+ * @return bool - True if lid is in a section, false otherwise
+ */
+ bool getLidPnorSection(uint32_t i_lidId,
+ PNOR::SectionInfo_t &o_lidPnorInfo);
+
#else // __HOSTBOOT_RUNTIME
/**
@@ -339,6 +364,27 @@ class UtilLidMgr
*/
size_t iv_lidSize;
+ /**
+ * @brief pnor section (other than ext img) current lid is in
+ * PNOR::INVALID_SECTION if not in other sections
+ */
+ PNOR::SectionInfo_t iv_lidPnorInfo;
+
+ /**
+ * @brief value indicating if lid is in its own pnor partition
+ *
+ */
+ bool iv_isLidInPnor;
+
+ /**
+ * @brief value indicating if a fsp exists
+ */
+ bool iv_spBaseServicesEnabled;
+
+ /**
+ * @brief value indicating if lid is in extended image
+ */
+ bool iv_isLidInVFS;
};
diff --git a/src/usr/hwpf/hwp/occ/occ.C b/src/usr/hwpf/hwp/occ/occ.C
index ea9d97076..e28a51415 100644
--- a/src/usr/hwpf/hwp/occ/occ.C
+++ b/src/usr/hwpf/hwp/occ/occ.C
@@ -87,14 +87,14 @@ namespace HBOCC
errlHndl_t l_errl = NULL;
size_t lidSize = 0;
do {
- UtilLidMgr lidMgr(OCC_LIDID);
+ UtilLidMgr lidMgr(Util::OCC_LIDID);
l_errl = lidMgr.getLidSize(lidSize);
if(l_errl)
{
TRACFCOMP( g_fapiImpTd,
ERR_MRK"loadOCCImageToHomer: Error getting lid size. lidId=0x%.8x",
- OCC_LIDID);
+ Util::OCC_LIDID);
break;
}
@@ -103,7 +103,7 @@ namespace HBOCC
{
TRACFCOMP( g_fapiImpTd,
ERR_MRK"loadOCCImageToHomer: Error getting lid.. lidId=0x%.8x",
- OCC_LIDID);
+ Util::OCC_LIDID);
break;
}
diff --git a/src/usr/hwpf/hwp/occ/runtime/rt_occ.C b/src/usr/hwpf/hwp/occ/runtime/rt_occ.C
index d76d403d4..07f63e79f 100644
--- a/src/usr/hwpf/hwp/occ/runtime/rt_occ.C
+++ b/src/usr/hwpf/hwp/occ/runtime/rt_occ.C
@@ -198,7 +198,7 @@ namespace RT_OCC
}
// Load HOMER image
- UtilLidMgr lidmgr(HBOCC::OCC_LIDID);
+ UtilLidMgr lidmgr(Util::OCC_LIDID);
size_t lidSize = 0;
err = lidmgr.getLidSize(lidSize);
@@ -216,7 +216,7 @@ namespace RT_OCC
TRACFCOMP( g_fapiTd,
"OCC lid loaded. ID:%x size:%d",
- HBOCC::OCC_LIDID,
+ Util::OCC_LIDID,
lidSize);
// Setup Host Data area of HOMER
diff --git a/src/usr/hwpf/test/runtime/rt_occtest.H b/src/usr/hwpf/test/runtime/rt_occtest.H
index 23d671a54..2ddfd5dbe 100644
--- a/src/usr/hwpf/test/runtime/rt_occtest.H
+++ b/src/usr/hwpf/test/runtime/rt_occtest.H
@@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2014 */
+/* 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. */
@@ -30,6 +32,7 @@
#include <targeting/common/commontargeting.H>
#include <vmmconst.h>
#include <sys/mm.h>
+#include <util/utillidmgr.H>
class OccTest: public CxxTest::TestSuite
{
@@ -79,9 +82,9 @@ class OccTest: public CxxTest::TestSuite
{
TS_FAIL("runtimeInterfaces->get_lid_list empty list");
}
- else if (list[0] != HBOCC::OCC_LIDID)
+ else if (list[0] != Util::OCC_LIDID)
{
- TS_FAIL("runtimeInterface->get_list_list missing OCCLID");
+ TS_FAIL("runtimeInterface->get_lid_list missing OCCLID");
}
}
diff --git a/src/usr/pnor/pnorrp.C b/src/usr/pnor/pnorrp.C
index 9060743da..faf0c1cdd 100644
--- a/src/usr/pnor/pnorrp.C
+++ b/src/usr/pnor/pnorrp.C
@@ -73,7 +73,8 @@ const char* cv_EYECATCHER[] = {
"CVPD", /**< PNOR::CENTAUR_VPD : Centaur VPD */
"ATTROVER", /**< PNOR::ATTR_OVER : Attribute Override */
"NVRAM", /**< PNOR::NVRAM : OPAL Storage */
- "TEST", /**< PNOR::TEST : Test space for PNOR*/
+ "OCC", /**< PNOR::OCC : OCC LID */
+ "TEST", /**< PNOR::TEST : Test space for PNOR*/
//Not currently used
// "XXX", /**< NUM_SECTIONS : Used as invalid entry */
diff --git a/src/usr/util/runtime/test/testlidmgr.H b/src/usr/util/runtime/test/testlidmgr_rt.H
index c27ba51df..47b16605c 100644
--- a/src/usr/util/runtime/test/testlidmgr.H
+++ b/src/usr/util/runtime/test/testlidmgr_rt.H
@@ -1,11 +1,13 @@
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
-/* $Source: src/usr/util/runtime/test/testlidmgr.H $ */
+/* $Source: src/usr/util/runtime/test/testlidmgr_rt.H $ */
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2013,2014 */
+/* 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. */
@@ -22,7 +24,7 @@
/* IBM_PROLOG_END_TAG */
#include <util/utillidmgr.H>
-class LidMgrTest : public CxxTest::TestSuite
+class LidMgrRtTest : public CxxTest::TestSuite
{
public:
void testMissingLid()
@@ -32,13 +34,14 @@ class LidMgrTest : public CxxTest::TestSuite
size_t l_size = 0;
errlHndl_t l_errl = lidmgr.getLidSize(l_size);
- if (NULL == l_errl)
+ if (l_size != 0)
{
TS_FAIL("Found missing lid -1.");
}
else
{
delete l_errl;
+ l_errl = NULL;
}
}
};
diff --git a/src/usr/util/runtime/utillidmgr_rt.C b/src/usr/util/runtime/utillidmgr_rt.C
index 71ce2a813..51d1d371c 100644
--- a/src/usr/util/runtime/utillidmgr_rt.C
+++ b/src/usr/util/runtime/utillidmgr_rt.C
@@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2013,2014 */
+/* Contributors Listed Below - COPYRIGHT 2013,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. */
@@ -82,6 +84,7 @@ errlHndl_t UtilLidMgr::getLid(void* i_dest, size_t i_destSize)
errlHndl_t UtilLidMgr::loadLid()
{
+ //@TODO RTC:108836 - figure out how to read lid from pnor with OPAL
// Check if it is already loaded.
if (NULL != iv_lidBuffer) return NULL;
@@ -150,7 +153,7 @@ const uint32_t * UtilLidMgr::getLidList(size_t * o_num)
{
static uint32_t lidlist[] =
{
- HBOCC::OCC_LIDID
+ Util::OCC_LIDID
// add SLW lids if ever needed
};
*o_num = sizeof(lidlist)/sizeof(lidlist[0]);
diff --git a/src/usr/util/test/testlidmgr.H b/src/usr/util/test/testlidmgr.H
new file mode 100644
index 000000000..6980c5a64
--- /dev/null
+++ b/src/usr/util/test/testlidmgr.H
@@ -0,0 +1,165 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/util/test/testlidmgr.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 _TESTLIDMGR_H
+#define _TESTLIDMGR_H
+
+/**
+ * @file testlidmgr.H
+ *
+ * @brief Test case for utillidmgr (non-runtime)
+*/
+
+#include <cxxtest/TestSuite.H>
+
+#include <errl/errlmanager.H>
+#include "../utilbase.H"
+#include "../utillidpnor.H"
+
+class LidMgrTest : public CxxTest::TestSuite
+{
+public:
+
+ /**
+ * @brief Test to check if the const array lidToPnor is sorted
+ */
+ void testLidToPnorSorted(void)
+ {
+ for (size_t i = 0; (i+1) < Util::NUM_LID_TO_PNOR; ++i)
+ {
+ if (Util::lidToPnor[i].first > Util::lidToPnor[i+1].first)
+ {
+ TS_FAIL("testLidToPnorSorted: utilidmgr lidToPnor[] is not sorted");
+ }
+ }
+ }
+
+ /**
+ * @brief Test to check if the structure that maps lidID's to pnor sections
+ * is working correctly
+ */
+ void testLidInPnorTest(void)
+ {
+ errlHndl_t l_errl = NULL;
+ size_t l_lidSize = 0;
+ UtilLidMgr l_lidMgr(Util::TEST_LIDID);
+
+ do
+ {
+ l_errl = l_lidMgr.getLidSize(l_lidSize);
+ if(l_errl)
+ {
+ errlCommit(l_errl,UTIL_COMP_ID);
+ TS_FAIL("testLidInPnor: Error getting lidId=0x%.8x",
+ Util::TEST_LIDID);
+ break;
+ }
+
+ PNOR::SectionInfo_t l_lidPnorInfo;
+ l_errl = PNOR::getSectionInfo(PNOR::TEST, l_lidPnorInfo);
+ if(l_errl)
+ {
+ errlCommit(l_errl,UTIL_COMP_ID);
+ TS_FAIL("testLidInPnor: could not get pnor section %s",
+ l_lidPnorInfo.name);
+ break;
+ }
+
+ if (l_lidSize != l_lidPnorInfo.size)
+ {
+ TS_FAIL("testLidInPnor: lidSize does not match pnor test section size 0x%.8X > 0x%.8X",
+ l_lidSize, l_lidPnorInfo.size);
+ break;
+ }
+
+ // Purposely pass in a size smaller than the pnor test section size
+ uint32_t l_testSize = 0x1000;
+ char * l_ptrTest = new char[l_lidPnorInfo.size];
+ l_errl = l_lidMgr.getLid(l_ptrTest, l_testSize);
+ if(l_errl)
+ {
+ UTIL_FT(INFO_MRK"testLidInPnor: expected error");
+ delete l_errl;
+ l_errl = NULL;
+ }
+ else
+ {
+ TS_FAIL("testLidInPnor: should fail getLid() due to lidSize > provided size");
+ }
+ delete[] l_ptrTest;
+ }while(0);
+ }
+
+ /**
+ * @brief Test to check if the structure that maps lidID's to pnor sections
+ * is working correctly
+ */
+ void testLidInPnorOcc(void)
+ {
+ errlHndl_t l_errl = NULL;
+
+ do
+ {
+ size_t l_lidSize = 0;
+ UtilLidMgr l_lidMgr(Util::OCC_LIDID);
+
+ PNOR::SectionInfo_t l_lidPnorInfo;
+ l_errl = PNOR::getSectionInfo(PNOR::OCC, l_lidPnorInfo);
+ // Section only present in openPOWER systems
+ if (l_errl)
+ {
+ delete l_errl;
+ l_errl = NULL;
+ break;
+ }
+
+ l_errl = l_lidMgr.getLidSize(l_lidSize);
+ if(l_errl)
+ {
+ errlCommit(l_errl,UTIL_COMP_ID);
+ TS_FAIL("testLidInPnorOcc: Error getting lidId=0x%.8x",
+ Util::TEST_LIDID);
+ break;
+ }
+
+ if (l_lidSize != l_lidPnorInfo.size)
+ {
+ TS_FAIL("testLidInPnorOcc: lidSize does not match pnor OCC section size 0x%.8X > 0x%.8X",
+ l_lidSize, l_lidPnorInfo.size);
+ break;
+ }
+
+ char * l_ptrOcc = new char[l_lidPnorInfo.size];
+ l_errl = l_lidMgr.getLid(l_ptrOcc, l_lidPnorInfo.size);
+ if(l_errl)
+ {
+ errlCommit(l_errl, UTIL_COMP_ID);
+ TS_FAIL("testLidInPnorOcc: failed to get lid from PNOR");
+ }
+ delete[] l_ptrOcc;
+ }while(0);
+ }
+};
+
+#endif \ No newline at end of file
diff --git a/src/usr/util/utillidmgr.C b/src/usr/util/utillidmgr.C
index 77a2c4bc2..9b8ef828c 100644
--- a/src/usr/util/utillidmgr.C
+++ b/src/usr/util/utillidmgr.C
@@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2013,2014 */
+/* Contributors Listed Below - COPYRIGHT 2013,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. */
@@ -30,11 +32,12 @@
#include <errl/errlmanager.H>
#include "utillidmgrdefs.H"
#include "utilbase.H"
+#include <initservice/initserviceif.H>
+#include "utillidpnor.H"
using namespace ERRORLOG;
mutex_t UtilLidMgr::cv_mutex = MUTEX_INITIALIZER;
-
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
UtilLidMgr::UtilLidMgr(uint32_t i_lidId)
@@ -44,6 +47,7 @@ UtilLidMgr::UtilLidMgr(uint32_t i_lidId)
,iv_lidSize(0)
{
updateLid(i_lidId);
+ iv_spBaseServicesEnabled = INITSERVICE::spBaseServicesEnabled();
}
///////////////////////////////////////////////////////////
@@ -91,61 +95,64 @@ errlHndl_t UtilLidMgr::getLidSize(size_t& o_lidSize)
// allocate message buffer
// buffer will be initialized to zero by msg_allocate()
- msg_t * l_pMsg = msg_allocate();
+ if (iv_spBaseServicesEnabled)
+ {
+ msg_t * l_pMsg = msg_allocate();
- l_pMsg->type = UTILLID::GET_INFO;
+ l_pMsg->type = UTILLID::GET_INFO;
- UTILLID_ADD_LID_ID( iv_lidId, l_pMsg->data[0] );
- UTILLID_ADD_HEADER_FLAG( 0 , l_pMsg->data[0] );
+ UTILLID_ADD_LID_ID( iv_lidId, l_pMsg->data[0] );
+ UTILLID_ADD_HEADER_FLAG( 0 , l_pMsg->data[0] );
- errl = sendMboxMessage( SYNCHRONOUS, l_pMsg );
- if(errl)
- {
- UTIL_FT(ERR_MRK"getLidSize: Error when calling sendMboxMessage(SYNCHRONOUS)");
- break;
- }
+ errl = sendMboxMessage( SYNCHRONOUS, l_pMsg );
+ if(errl)
+ {
+ UTIL_FT(ERR_MRK"getLidSize: Error when calling sendMboxMessage(SYNCHRONOUS)");
+ break;
+ }
- // see if there was an error on the other end
- UTILLID::UTILLID_RC return_code = UTILLID_GET_RC( l_pMsg->data[0] );
+ // see if there was an error on the other end
+ UTILLID::UTILLID_RC return_code = UTILLID_GET_RC(l_pMsg->data[0]);
+
+ if ( return_code )
+ {
+ UTIL_FT(ERR_MRK"getLidSize: rc 0x%x received from FSP for Sync to HB request",
+ return_code );
+
+ /*@
+ * @errortype
+ * @moduleid Util::UTIL_LIDMGR_GETLIDSIZE
+ * @reasoncode Util::UTIL_LIDMGR_RC_FAIL
+ * @userdata1 return code from FSP
+ * @userdata2 LID ID
+ * @devdesc The LID transfer code on the FSP side was
+ * unable to fulfill the LID GET_INFO request.
+ */
+ errl = new ErrlEntry(ERRL_SEV_UNRECOVERABLE,
+ Util::UTIL_LIDMGR_GETLIDSIZE,
+ Util::UTIL_LIDMGR_RC_FAIL,
+ return_code,
+ iv_lidId);
+ errl->addProcedureCallout(HWAS::EPUB_PRC_SP_CODE,
+ HWAS::SRCI_PRIORITY_HIGH);
+ errl->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE,
+ HWAS::SRCI_PRIORITY_MED);
+ // for a syncronous message we need to free the message
+ msg_free( l_pMsg );
+ l_pMsg = NULL;
+ break;
+ }
+
+ // Get the LID Size
+ iv_lidSize = UTILLID_GET_SIZE( l_pMsg->data[0] );
+
+ o_lidSize = iv_lidSize;
- if ( return_code )
- {
- UTIL_FT(ERR_MRK"getLidSize: rc 0x%x received from FSP for Sync to HB request",
- return_code );
-
- /*@
- * @errortype
- * @moduleid Util::UTIL_LIDMGR_GETLIDSIZE
- * @reasoncode Util::UTIL_LIDMGR_RC_FAIL
- * @userdata1 return code from FSP
- * @userdata2 LID ID
- * @devdesc The LID transfer code on the FSP side was
- * unable to fulfill the LID GET_INFO request.
- */
- errl = new ErrlEntry(ERRL_SEV_UNRECOVERABLE,
- Util::UTIL_LIDMGR_GETLIDSIZE,
- Util::UTIL_LIDMGR_RC_FAIL,
- return_code,
- iv_lidId);
- errl->addProcedureCallout(HWAS::EPUB_PRC_SP_CODE,
- HWAS::SRCI_PRIORITY_HIGH);
- errl->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE,
- HWAS::SRCI_PRIORITY_MED);
// for a syncronous message we need to free the message
msg_free( l_pMsg );
l_pMsg = NULL;
- break;
}
- // Get the LID Size
- iv_lidSize = UTILLID_GET_SIZE( l_pMsg->data[0] );
-
- o_lidSize = iv_lidSize;
-
- // for a syncronous message we need to free the message
- msg_free( l_pMsg );
- l_pMsg = NULL;
-
}while(0);
return errl;
@@ -162,31 +169,36 @@ errlHndl_t UtilLidMgr::getLidSizePnor(size_t& o_lidSize, bool& o_imgInPnor)
o_imgInPnor = false;
do{
-
- if(!VFS::module_exists(iv_lidFileName))
+ if (iv_isLidInPnor)
{
- //Lid not in extended image
- break;
+ o_lidSize = iv_lidPnorInfo.size;
}
-
- // Load the file
- UTIL_DT(INFO_MRK"getLidSizePnor: Try to load %s.", iv_lidFileName);
- errl = VFS::module_load( iv_lidFileName );
- if ( errl )
+ else if (iv_isLidInVFS)
{
- //Lid not in extended image
- delete errl;
- errl = NULL;
- break;
- }
+ // Load the file
+ UTIL_DT(INFO_MRK"getLidSizePnor: Try to load %s.", iv_lidFileName);
+ errl = VFS::module_load( iv_lidFileName );
+ if ( errl )
+ {
+ //Lid not in extended image
+ delete errl;
+ errl = NULL;
+ break;
+ }
- errl = VFS::module_address( iv_lidFileName,
- lidAddr,
- o_lidSize );
- if ( errl )
+ errl = VFS::module_address( iv_lidFileName,
+ lidAddr,
+ o_lidSize );
+ if ( errl )
+ {
+ UTIL_FT(ERR_MRK"getLidSizePnor: getting address of file : %s",
+ iv_lidFileName );
+ break;
+ }
+ }
+ else
{
- UTIL_FT(ERR_MRK"getLidSizePnor: getting address of file : %s",
- iv_lidFileName );
+ // Lid is not in extended image or other pnor sections
break;
}
o_imgInPnor = true;
@@ -207,63 +219,98 @@ errlHndl_t UtilLidMgr::getLidPnor(void* i_dest,
o_imgInPnor = false; //assume not found to start.
do{
- if(!VFS::module_exists(iv_lidFileName))
+ if(iv_isLidInPnor)
{
- //Lid not in extended image
- break;
+ lidSize = iv_lidPnorInfo.size;
+ lidAddr = reinterpret_cast<char *>(iv_lidPnorInfo.vaddr);
}
-
- if(!VFS::module_is_loaded(iv_lidFileName))
+ else if (iv_isLidInVFS)
{
- // Load the file
- UTIL_DT(INFO_MRK"getLidPnor: Try to load %s.", iv_lidFileName);
+ if(!VFS::module_is_loaded(iv_lidFileName))
+ {
+ // Load the file
+ UTIL_DT(INFO_MRK"getLidPnor: Try to load %s.", iv_lidFileName);
- errl = VFS::module_load( iv_lidFileName );
+ errl = VFS::module_load( iv_lidFileName );
+ if ( errl )
+ {
+ //Lid not in extended image
+ delete errl;
+ errl = NULL;
+ break;
+ }
+ }
+
+ errl = VFS::module_address( iv_lidFileName,
+ lidAddr,
+ lidSize );
if ( errl )
{
- //Lid not in extended image
- delete errl;
- errl = NULL;
+ UTIL_FT(ERR_MRK"getLidPnor: getting address of file : %s",
+ iv_lidFileName );
break;
}
}
-
- errl = VFS::module_address( iv_lidFileName,
- lidAddr,
- lidSize );
- if ( errl )
+ else
{
- UTIL_FT(ERR_MRK"getLidPnor: getting address of file : %s",
- iv_lidFileName );
+ // Lid is not in extended image or other pnor sections
break;
}
+
o_imgInPnor = true;
if(lidSize > i_destSize)
{
- UTIL_FT(ERR_MRK"getLidPnor: lid=%s found in Ext image has size=0x%.8X, which does not fit in provided space=0x%.8X",
- iv_lidFileName, lidSize, i_destSize);
-
- /*@
- * @errortype
- * @moduleid Util::UTIL_LIDMGR_GETLIDPNOR
- * @reasoncode Util::UTIL_LIDMGR_INVAL_SIZE
- * @userdata1[0:31] LID size found in Ext Img
- * @userdata1[32:63] Reserved space provided
- * @userdata2 LID ID
- * @devdesc Insufficient space provided for LID by calling
- * function.
- */
- errl = new ErrlEntry(ERRL_SEV_UNRECOVERABLE,
- Util::UTIL_LIDMGR_GETLIDPNOR,
- Util::UTIL_LIDMGR_INVAL_SIZE,
- TWO_UINT32_TO_UINT64(lidSize,
- i_destSize),
- iv_lidId,
- true /*Add HB Software Callout*/);
- break;
- }
+ if (iv_isLidInPnor)
+ {
+ UTIL_FT(ERR_MRK"getLidPnor: lid=%s in PNOR::%s has size=0x%.8X, which does not fit in provided space=0x%.8X",
+ iv_lidFileName, iv_lidPnorInfo.name, lidSize,
+ i_destSize);
+ /*@
+ * @errortype
+ * @moduleid Util::UTIL_LIDMGR_GETLIDPNOR
+ * @reasoncode Util::UTIL_LIDMGR_INVAL_SIZE_PNOR
+ * @userdata1[0:31] LID size found in pnor
+ * @userdata1[32:63] Reserved space provided
+ * @userdata2 LID ID
+ * @devdesc Insufficient space provided for LID by calling
+ * function.
+ */
+ errl = new ErrlEntry(ERRL_SEV_UNRECOVERABLE,
+ Util::UTIL_LIDMGR_GETLIDPNOR,
+ Util::UTIL_LIDMGR_INVAL_SIZE_PNOR,
+ TWO_UINT32_TO_UINT64(lidSize,
+ i_destSize),
+ iv_lidId,
+ true /*Add HB Software Callout*/);
+ break;
+ }
+ else
+ {
+ UTIL_FT(ERR_MRK"getLidPnor: lid=%s found in Ext image has size=0x%.8X, which does not fit in provided space=0x%.8X",
+ iv_lidFileName, lidSize, i_destSize);
+
+ /*@
+ * @errortype
+ * @moduleid Util::UTIL_LIDMGR_GETLIDPNOR
+ * @reasoncode Util::UTIL_LIDMGR_INVAL_SIZE
+ * @userdata1[0:31] LID size found in Ext Img
+ * @userdata1[32:63] Reserved space provided
+ * @userdata2 LID ID
+ * @devdesc Insufficient space provided for LID by calling
+ * function.
+ */
+ errl = new ErrlEntry(ERRL_SEV_UNRECOVERABLE,
+ Util::UTIL_LIDMGR_GETLIDPNOR,
+ Util::UTIL_LIDMGR_INVAL_SIZE,
+ TWO_UINT32_TO_UINT64(lidSize,
+ i_destSize),
+ iv_lidId,
+ true /*Add HB Software Callout*/);
+ break;
+ }
+ }
//Copy file to indicated offset.
memcpy(i_dest, lidAddr, lidSize);
@@ -298,196 +345,197 @@ errlHndl_t UtilLidMgr::getLid(void* i_dest, size_t i_destSize)
}
//Image not in PNOR, request from FSP.
-
- errl = createMsgQueue();
- if(errl)
+ if(iv_spBaseServicesEnabled)
{
- UTIL_FT(ERR_MRK"getLid: Error while creating message queue.");
- break;
- }
-
- //Send message to FSP requesting the DMA up the LID in chunks
-
- // allocate message buffer
- // buffer will be initialized to zero by msg_allocate()
- msg_t * l_pMsg = msg_allocate();
+ errl = createMsgQueue();
+ if(errl)
+ {
+ UTIL_FT(ERR_MRK"getLid: Error while creating message queue.");
+ break;
+ }
- l_pMsg->type = UTILLID::SEND_TO_HB;
+ //Send message to FSP requesting the DMA up the LID in chunks
+ // allocate message buffer
+ // buffer will be initialized to zero by msg_allocate()
+ msg_t * l_pMsg = msg_allocate();
- UTILLID_ADD_LID_ID( iv_lidId, l_pMsg->data[0] );
- UTILLID_ADD_HEADER_FLAG( 0 , l_pMsg->data[0] );
- //change to use TCE Window for improved performance. RTC: 68295
- UTILLID_ADD_TCE_TOKEN( 0 , l_pMsg->data[1] );
+ l_pMsg->type = UTILLID::SEND_TO_HB;
- errl = sendMboxMessage( SYNCHRONOUS, l_pMsg );
- if(errl)
- {
- UTIL_FT(ERR_MRK"getLid: Error when calling sendMboxMessage(SYNCHRONOUS)");
- break;
- }
+ UTILLID_ADD_LID_ID( iv_lidId, l_pMsg->data[0] );
+ UTILLID_ADD_HEADER_FLAG( 0 , l_pMsg->data[0] );
+ //change to use TCE Window for improved performance. RTC: 68295
+ UTILLID_ADD_TCE_TOKEN( 0 , l_pMsg->data[1] );
- // see if there was an error on the other end
- UTILLID::UTILLID_RC return_code = UTILLID_GET_RC( l_pMsg->data[0] );
+ errl = sendMboxMessage( SYNCHRONOUS, l_pMsg );
+ if(errl)
+ {
+ UTIL_FT(ERR_MRK"getLid: Error when calling sendMboxMessage(SYNCHRONOUS)");
+ break;
+ }
- if ( return_code )
- {
- UTIL_FT(ERR_MRK"getLid: rc 0x%x received from FSP for Sync to HB request",
- return_code );
-
- /*@
- * @errortype
- * @moduleid Util::UTIL_LIDMGR_GETLID
- * @reasoncode Util::UTIL_LIDMGR_RC_FAIL
- * @userdata1 return code from FSP
- * @userdata2 LID ID
- * @devdesc The LID transfer code on the FSP side was
- * unable to fulfill the LID SEND_TO_HB request.
- */
- errl = new ErrlEntry(ERRL_SEV_UNRECOVERABLE,
- Util::UTIL_LIDMGR_GETLID,
- Util::UTIL_LIDMGR_RC_FAIL,
- return_code,
- iv_lidId);
- errl->addProcedureCallout(HWAS::EPUB_PRC_SP_CODE,
- HWAS::SRCI_PRIORITY_HIGH);
- errl->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE,
- HWAS::SRCI_PRIORITY_MED);
+ // see if there was an error on the other end
+ UTILLID::UTILLID_RC return_code = UTILLID_GET_RC( l_pMsg->data[0] );
- // for a syncronous message we need to free the message
- msg_free( l_pMsg );
- l_pMsg = NULL;
- break;
- }
+ if ( return_code )
+ {
+ UTIL_FT(ERR_MRK"getLid: rc 0x%x received from FSP for Sync to HB request",
+ return_code );
+ /*@
+ * @errortype
+ * @moduleid Util::UTIL_LIDMGR_GETLID
+ * @reasoncode Util::UTIL_LIDMGR_RC_FAIL
+ * @userdata1 return code from FSP
+ * @userdata2 LID ID
+ * @devdesc The LID transfer code on the FSP side was
+ * unable to fulfill the LID SEND_TO_HB request.
+ */
+ errl = new ErrlEntry(ERRL_SEV_UNRECOVERABLE,
+ Util::UTIL_LIDMGR_GETLID,
+ Util::UTIL_LIDMGR_RC_FAIL,
+ return_code,
+ iv_lidId);
+ errl->addProcedureCallout(HWAS::EPUB_PRC_SP_CODE,
+ HWAS::SRCI_PRIORITY_HIGH);
+ errl->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE,
+ HWAS::SRCI_PRIORITY_MED);
- //Now wait for FSP to send the LID page-by-page.
- do{
- //Wait for a message
- msg_t * l_pMsg = msg_wait(iv_HbMsgQ);
+ // for a syncronous message we need to free the message
+ msg_free( l_pMsg );
+ l_pMsg = NULL;
+ break;
+ }
- //process received message
- if( UTILLID::PAGE_TO_HB == l_pMsg->type )
- {
- UTIL_DT("getLid: received a page of data");
- curLid = UTILLID_GET_LID_ID(l_pMsg->data[0]);
- pageNumber = UTILLID_GET_PAGE_COUNT(l_pMsg->data[0]);
- dataSize = UTILLID_GET_SIZE(l_pMsg->data[1]);
- dataPtr = reinterpret_cast<uint8_t *> (l_pMsg->extra_data);
+ //Now wait for FSP to send the LID page-by-page.
+ do{
+ //Wait for a message
+ msg_t * l_pMsg = msg_wait(iv_HbMsgQ);
- if((curLid != iv_lidId) ||
- (NULL == dataPtr))
+ //process received message
+ if( UTILLID::PAGE_TO_HB == l_pMsg->type )
{
- UTIL_FT(ERR_MRK"getLid: rc 0x%x received from FSP for Sync to HB request",
- return_code );
-
- /*@
- * @errortype
- * @moduleid Util::UTIL_LIDMGR_GETLID
- * @reasoncode Util::UTIL_LIDMGR_INVAL_DATA
- * @userdata1[0:31] received LID ID
- * @userdata1[32:63] expected LID ID
- * @userdata2[0:31] pointer to extra data
- * @devdesc DMA message contains data for wrong LID.
- */
- errl = new ErrlEntry(ERRL_SEV_UNRECOVERABLE,
- Util::UTIL_LIDMGR_GETLID,
- Util::UTIL_LIDMGR_INVAL_DATA,
- TWO_UINT32_TO_UINT64(curLid,
- iv_lidId),
- TWO_UINT32_TO_UINT64(
- NULL != dataPtr ? *(dataPtr) : 0,
- 0)
- );
-
- errl->addProcedureCallout(HWAS::EPUB_PRC_SP_CODE,
- HWAS::SRCI_PRIORITY_HIGH);
+ UTIL_DT("getLid: received a page of data");
+
+ curLid = UTILLID_GET_LID_ID(l_pMsg->data[0]);
+ pageNumber = UTILLID_GET_PAGE_COUNT(l_pMsg->data[0]);
+ dataSize = UTILLID_GET_SIZE(l_pMsg->data[1]);
+ dataPtr = reinterpret_cast<uint8_t *> (l_pMsg->extra_data);
+
+ if((curLid != iv_lidId) ||
+ (NULL == dataPtr))
+ {
+ UTIL_FT(ERR_MRK"getLid: rc 0x%x received from FSP for Sync to HB request",
+ return_code );
+
+ /*@
+ * @errortype
+ * @moduleid Util::UTIL_LIDMGR_GETLID
+ * @reasoncode Util::UTIL_LIDMGR_INVAL_DATA
+ * @userdata1[0:31] received LID ID
+ * @userdata1[32:63] expected LID ID
+ * @userdata2[0:31] pointer to extra data
+ * @devdesc DMA message contains data for wrong LID.
+ */
+ errl = new ErrlEntry(ERRL_SEV_UNRECOVERABLE,
+ Util::UTIL_LIDMGR_GETLID,
+ Util::UTIL_LIDMGR_INVAL_DATA,
+ TWO_UINT32_TO_UINT64(curLid,
+ iv_lidId),
+ TWO_UINT32_TO_UINT64(
+ NULL != dataPtr ? *(dataPtr) : 0,
+ 0)
+ );
+
+ errl->addProcedureCallout(HWAS::EPUB_PRC_SP_CODE,
+ HWAS::SRCI_PRIORITY_HIGH);
+
+ free(l_pMsg->extra_data);
+ l_pMsg->extra_data = NULL;
+ break;
+ }
+
+
+ //confirm that the data fits in the allocated space
+ uint32_t needed_size = ((static_cast<uint32_t>(pageNumber))*
+ (4*KILOBYTE)) + dataSize;
+ if( needed_size > i_destSize )
+ {
+ UTIL_FT(ERR_MRK"getLid: lid=%s has size=0x%.8X, which does not fit in provided space=0x%.8X",
+ iv_lidFileName, i_destSize, needed_size);
+
+ /*@
+ * @errortype
+ * @moduleid Util::UTIL_LIDMGR_GETLID
+ * @reasoncode Util::UTIL_LIDMGR_INVAL_SIZE
+ * @userdata1[0:31] Allocated Size
+ * @userdata1[32:63] Size needed for current data page
+ * @userdata2[32:63] Lid ID
+ * @devdesc Insufficient space provided for LID by
+ * calling function.
+ */
+ errl = new ErrlEntry(ERRL_SEV_UNRECOVERABLE,
+ Util::UTIL_LIDMGR_GETLID,
+ Util::UTIL_LIDMGR_INVAL_SIZE,
+ TWO_UINT32_TO_UINT64(i_destSize,
+ needed_size),
+ iv_lidId,
+ true /*Add HB Software Callout*/
+ );
+
+ free(l_pMsg->extra_data);
+ l_pMsg->extra_data = NULL;
+ break;
+
+ }
+ //copy the page into memory
+ copyOffset = (reinterpret_cast<uint8_t *>(i_dest)) + (pageNumber*PAGESIZE);
+
+ memcpy(copyOffset, dataPtr, dataSize);
+
+ transferred_data+=dataSize;
free(l_pMsg->extra_data);
l_pMsg->extra_data = NULL;
- break;
- }
- //confirm that the data fits in the allocated space
- uint32_t needed_size = ((static_cast<uint32_t>(pageNumber))*
- (4*KILOBYTE)) + dataSize;
- if( needed_size > i_destSize )
+ } //if UTILLID::PAGE_TO_HB
+ else
{
- UTIL_FT(ERR_MRK"getLid: rc 0x%x received from FSP for Sync to HB request",
- return_code );
+ UTIL_FT(ERR_MRK"getLid: Invalid Message type (0x%x) received from FSP.",
+ l_pMsg->type );
/*@
* @errortype
* @moduleid Util::UTIL_LIDMGR_GETLID
- * @reasoncode Util::UTIL_LIDMGR_INVAL_SIZE
- * @userdata1[0:31] Allocated Size
- * @userdata1[32:63] Size needed for current data page
- * @userdata2[32:63] Lid ID
- * @devdesc Insufficient space provided for LID by
- * calling function.
+ * @reasoncode Util::UTIL_LIDMGR_UNSUP_MSG
+ * @userdata1 LID ID
+ * @userdata2 Message Type
+ * @devdesc Invalid Message type received from FSP when
+ * transferring LID pages.
*/
errl = new ErrlEntry(ERRL_SEV_UNRECOVERABLE,
Util::UTIL_LIDMGR_GETLID,
- Util::UTIL_LIDMGR_INVAL_SIZE,
- TWO_UINT32_TO_UINT64(i_destSize,
- needed_size),
+ Util::UTIL_LIDMGR_UNSUP_MSG,
iv_lidId,
- true /*Add HB Software Callout*/
- );
-
- free(l_pMsg->extra_data);
- l_pMsg->extra_data = NULL;
- break;
+ l_pMsg->type);
+ errl->addProcedureCallout(HWAS::EPUB_PRC_SP_CODE,
+ HWAS::SRCI_PRIORITY_HIGH);
}
- //copy the page into memory
- copyOffset = (reinterpret_cast<uint8_t *>(i_dest)) + (pageNumber*PAGESIZE);
-
- memcpy(copyOffset, dataPtr, dataSize);
-
- transferred_data+=dataSize;
-
- free(l_pMsg->extra_data);
- l_pMsg->extra_data = NULL;
-
-
- } //if UTILLID::PAGE_TO_HB
- else
- {
- UTIL_FT(ERR_MRK"getLid: Invalid Message type (0x%x) received from FSP.",
- l_pMsg->type );
-
- /*@
- * @errortype
- * @moduleid Util::UTIL_LIDMGR_GETLID
- * @reasoncode Util::UTIL_LIDMGR_UNSUP_MSG
- * @userdata1 LID ID
- * @userdata2 Message Type
- * @devdesc Invalid Message type received from FSP when
- * transferring LID pages.
- */
- errl = new ErrlEntry(ERRL_SEV_UNRECOVERABLE,
- Util::UTIL_LIDMGR_GETLID,
- Util::UTIL_LIDMGR_UNSUP_MSG,
- iv_lidId,
- l_pMsg->type);
-
- errl->addProcedureCallout(HWAS::EPUB_PRC_SP_CODE,
- HWAS::SRCI_PRIORITY_HIGH);
- }
-
- }while(transferred_data < iv_lidSize);
+ }while(transferred_data < iv_lidSize);
+ }
if(errl)
{
break;
}
-
-
}while(0);
- unregisterMsgQueue();
+ if (iv_spBaseServicesEnabled)
+ {
+ unregisterMsgQueue();
+ }
return errl;
}
@@ -627,6 +675,48 @@ void UtilLidMgr::updateLid(uint32_t i_lidId)
//if it's in PNOR, it's not technically lid, so use a slightly
//different extension.
sprintf(iv_lidFileName, "%x.lidbin", iv_lidId);
+ iv_isLidInPnor = getLidPnorSection(iv_lidId, iv_lidPnorInfo);
+ UTIL_FT(INFO_MRK "UtilLidMgr: LID 0x%.8X in pnor: %d",
+ iv_lidId ,iv_isLidInPnor);
+ iv_isLidInVFS = VFS::module_exists(iv_lidFileName);
return;
}
+
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+bool UtilLidMgr::getLidPnorSection(uint32_t i_lidId,
+ PNOR::SectionInfo_t &o_lidPnorInfo)
+{
+ errlHndl_t l_err = NULL;
+ bool l_lidInPnor = false;
+
+ const std::pair<uint32_t, PNOR::SectionId> l_lid(i_lidId,
+ PNOR::INVALID_SECTION);
+
+ const std::pair<uint32_t, PNOR::SectionId>* l_result =
+ std::lower_bound (Util::lidToPnor,
+ Util::lidToPnor + Util::NUM_LID_TO_PNOR,
+ l_lid,
+ Util::cmpLidToPnor);
+
+ if (l_result != (Util::lidToPnor + Util::NUM_LID_TO_PNOR) &&
+ l_result->first == l_lid.first &&
+ l_result->second != PNOR::INVALID_SECTION)
+ {
+ l_err = PNOR::getSectionInfo(l_result->second, o_lidPnorInfo);
+ // Section is optional or lid is not in PNOR, so just delete error
+ if (l_err)
+ {
+ o_lidPnorInfo.id = PNOR::INVALID_SECTION;
+ l_lidInPnor = false;
+ delete l_err;
+ l_err = NULL;
+ }
+ else
+ {
+ l_lidInPnor = true;
+ }
+ }
+ return l_lidInPnor;
+}
diff --git a/src/usr/util/utillidpnor.H b/src/usr/util/utillidpnor.H
new file mode 100644
index 000000000..91749caab
--- /dev/null
+++ b/src/usr/util/utillidpnor.H
@@ -0,0 +1,70 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/util/utillidpnor.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 _UTILLIDPNOR_H
+#define _UTILLIDPNOR_H
+
+/**
+ * @file lidpnor.H
+ *
+ * @brief brief Provides the lid to pnor mapping currently used in the lidmgr
+ * In its own file to limit number of duplicate definitions for
+ * every user compared to being defined in utillidmgr
+ *
+ */
+
+#include <util/utillidmgr.H>
+#include <utility>
+
+namespace Util
+{
+
+/**
+ * @brief Simple compare function for lidToPnor elements
+ */
+bool cmpLidToPnor (const std::pair<uint32_t, PNOR::SectionId> p1,
+ const std::pair<uint32_t, PNOR::SectionId> p2)
+{
+ return (p1.first < p2.first);
+}
+
+/**
+ * @brief Array containing lid to pnor mappings
+ * When adding maintain order by uint32_t (lidID)
+ * There is a test case to confirm this is sorted
+ */
+const std::pair<uint32_t, PNOR::SectionId>
+ lidToPnor[] =
+ {
+ std::make_pair(Util::TEST_LIDID, PNOR::TEST), // TEST_LIDID = 0x00000111
+ std::make_pair(Util::OCC_LIDID, PNOR::OCC) // OCC_LIDID = 0x81e00430
+ };
+
+// Size of lidToPnor[]
+const size_t NUM_LID_TO_PNOR = ( sizeof(lidToPnor) /
+ sizeof(std::pair<uint32_t, PNOR::SectionId>));
+
+}
+
+#endif \ No newline at end of file
OpenPOWER on IntegriCloud