summaryrefslogtreecommitdiffstats
path: root/src/usr/targeting
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/targeting')
-rwxr-xr-xsrc/usr/targeting/attrrp.C143
-rwxr-xr-xsrc/usr/targeting/attrrp_common.C6
-rw-r--r--src/usr/targeting/runtime/attrrp_rt.C4
-rwxr-xr-xsrc/usr/targeting/targetservicestart.C67
4 files changed, 161 insertions, 59 deletions
diff --git a/src/usr/targeting/attrrp.C b/src/usr/targeting/attrrp.C
index 86cd1b748..d0cbda1b1 100755
--- a/src/usr/targeting/attrrp.C
+++ b/src/usr/targeting/attrrp.C
@@ -66,12 +66,13 @@ namespace TARGETING
return NULL;
}
- void AttrRP::startup(errlHndl_t& io_taskRetErrl)
+ void AttrRP::startup(errlHndl_t& io_taskRetErrl, bool i_isMpipl)
{
errlHndl_t l_errl = NULL;
do
{
+ iv_isMpipl = i_isMpipl;
// Parse PNOR headers.
l_errl = this->parseAttrSectHeader();
if (l_errl)
@@ -217,8 +218,8 @@ namespace TARGETING
if (rc != 0)
{
/*@
- * @errortype
- * @moduleid TARG_MOD_ATTRRP
+ * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE
+ * @moduleid TARG_MSG_SERVICE_TASK
* @reasoncode TARG_RC_ATTR_MSG_FAIL
* @userdata1 Virtual Address
* @userdata2 (Msg Type << 32) | Section #
@@ -229,10 +230,13 @@ namespace TARGETING
* address outside a valid range or a message
* request that is invalid for the attribute
* section containing the address.
+ *
+ * @custdesc Attribute Resource Provider failed to handle
+ * request
*/
const bool hbSwError = true;
errlHndl_t l_errl = new ErrlEntry(ERRL_SEV_UNRECOVERABLE,
- TARG_MOD_ATTRRP,
+ TARG_MSG_SERVICE_TASK,
TARG_RC_ATTR_MSG_FAIL,
vAddr,
TWO_UINT32_TO_UINT64(
@@ -261,13 +265,58 @@ namespace TARGETING
{
// Locate attribute section in PNOR.
PNOR::SectionInfo_t l_pnorSectionInfo;
+ TargetingHeader* l_header = nullptr;
l_errl = PNOR::getSectionInfo(PNOR::HB_DATA,
l_pnorSectionInfo);
if (l_errl) break;
-
- // Find attribute section header.
- TargetingHeader* l_header =
+ if(!iv_isMpipl)
+ {
+ // Find attribute section header.
+ l_header =
reinterpret_cast<TargetingHeader*>(l_pnorSectionInfo.vaddr);
+ }
+ else
+ {
+ TRACFCOMP(g_trac_targeting,
+ "Reading attributes from memory, NOT PNOR");
+ //Create a block map of the address space we used to store
+ //attribute information on the initial IPL
+ l_header = reinterpret_cast<TargetingHeader*>(
+ mm_block_map(reinterpret_cast<void*>(MPIPL_ATTR_DATA_ADDR),
+ MPIPL_ATTR_VMM_SIZE));
+ if(l_header == 0)
+ {
+ TRACFCOMP(g_trac_targeting,
+ "Failed mapping phys addr: %p for %lx bytes",
+ MPIPL_ATTR_DATA_ADDR,
+ MPIPL_ATTR_VMM_SIZE);
+ //Error mm_block_map returned invalid ptr
+ /*@
+ * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE
+ * @moduleid TARG_PARSE_ATTR_SECT_HEADER
+ * @reasoncode TARG_RC_MM_BLOCK_MAP_FAIL
+ * @userdata1 physical address of target info
+ * @userdata2 size we tried to map
+ *
+ * @devdesc While attempting to map a phys addr to a virtual
+ * addr for our targeting information the kernel
+ * returned an error
+ * @custdesc Kernel failed to block map memory
+ */
+ l_errl = new ErrlEntry(ERRL_SEV_UNRECOVERABLE,
+ TARG_PARSE_ATTR_SECT_HEADER,
+ TARG_RC_MM_BLOCK_FAIL,
+ MPIPL_ATTR_DATA_ADDR,
+ MPIPL_ATTR_VMM_SIZE,
+ true);
+ break;
+ }
+ TRACFCOMP(g_trac_targeting,
+ "Mapped phys addr: %p to virt addr: %p",
+ reinterpret_cast<void*>(MPIPL_ATTR_DATA_ADDR),
+ l_header);
+ }
+
// Validate eye catch.
if (l_header->eyeCatcher != PNOR_TARG_EYE_CATCHER)
@@ -278,8 +327,8 @@ namespace TARGETING
l_header->eyeCatcher,
PNOR_TARG_EYE_CATCHER);
/*@
- * @errortype
- * @moduleid TARG_MOD_ATTRRP
+ * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE
+ * @moduleid TARG_PARSE_ATTR_SECT_HEADER
* @reasoncode TARG_RC_BAD_EYECATCH
* @userdata1 Observed Header Eyecatch Value
* @userdata2 Expected Eyecatch Value
@@ -297,7 +346,7 @@ namespace TARGETING
* to be parsed.
*/
l_errl = new ErrlEntry(ERRL_SEV_UNRECOVERABLE,
- TARG_MOD_ATTRRP,
+ TARG_PARSE_ATTR_SECT_HEADER,
TARG_RC_BAD_EYECATCH,
l_header->eyeCatcher,
PNOR_TARG_EYE_CATCHER);
@@ -308,13 +357,28 @@ namespace TARGETING
iv_sectionCount = l_header->numSections;
iv_sections = new AttrRP_Section[iv_sectionCount];
- // Find start to first section:
- // (PNOR addr + size of header + offset in header).
- TargetingSection* l_section =
+ TargetingSection* l_section = nullptr;
+ if(!iv_isMpipl)
+ {
+ // Find start to first section:
+ // (PNOR addr + size of header + offset in header).
+ l_section =
+ reinterpret_cast<TargetingSection*>(
+ l_pnorSectionInfo.vaddr + sizeof(TargetingHeader) +
+ l_header->offsetToSections
+ );
+ }
+ else
+ {
+ // Find start to first section:
+ // (header address + size of header + offset in header)
+ l_section =
reinterpret_cast<TargetingSection*>(
- l_pnorSectionInfo.vaddr + sizeof(TargetingHeader) +
- l_header->offsetToSections
- );
+ reinterpret_cast<uint64_t>(l_header) +
+ sizeof(TargetingHeader) + l_header->offsetToSections
+ );
+
+ }
// Parse each section.
for (size_t i = 0; i < iv_sectionCount; i++, ++l_section)
@@ -329,8 +393,16 @@ namespace TARGETING
static_cast<uint64_t>(
TARG_TO_PLAT_PTR(l_header->vmmBaseAddress)) +
l_header->vmmSectionOffset*i;
- iv_sections[i].pnorAddress = l_pnorSectionInfo.vaddr +
- l_section->sectionOffset;
+ if(!iv_isMpipl)
+ {
+ iv_sections[i].pnorAddress = l_pnorSectionInfo.vaddr + l_section->sectionOffset;
+ }
+ else
+ {
+ //For MPIPL we are reading from real memory, not pnor flash. Set the real memory address
+ //in place of the pnor address because that is where we are reading the data from
+ iv_sections[i].pnorAddress = reinterpret_cast<uint64_t>(l_header) + l_section->sectionOffset;
+ }
iv_sections[i].size = l_section->sectionSize;
TRACFCOMP(g_trac_targeting,
@@ -383,16 +455,17 @@ namespace TARGETING
default:
/*@
- * @errortype
- * @moduleid TARG_MOD_ATTRRP
+ * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE
+ * @moduleid TARG_CREATE_VMM_SECTIONS
* @reasoncode TARG_RC_UNHANDLED_ATTR_SEC_TYPE
* @userdata1 Section type
*
* @devdesc Found unhandled attribute section type
+ * @custdesc FW error, unexpected Attribute section type
*/
const bool hbSwError = true;
l_errl = new ErrlEntry(ERRL_SEV_UNRECOVERABLE,
- TARG_MOD_ATTRRP,
+ TARG_CREATE_VMM_SECTIONS,
TARG_RC_UNHANDLED_ATTR_SEC_TYPE,
iv_sections[i].type,
0, hbSwError);
@@ -420,8 +493,8 @@ namespace TARGETING
if (rc)
{
/*@
- * @errortype
- * @moduleid TARG_MOD_ATTRRP
+ * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE
+ * @moduleid TARG_CREATE_VMM_SECTIONS
* @reasoncode TARG_RC_MM_BLOCK_FAIL
* @userdata1 vAddress attempting to allocate.
* @userdata2 RC from kernel.
@@ -429,10 +502,11 @@ namespace TARGETING
* @devdesc While attempting to allocate a virtual
* memory block for an attribute section, the
* kernel returned an error.
+ * @custdesc Kernel failed to block memory
*/
const bool hbSwError = true;
l_errl = new ErrlEntry(ERRL_SEV_UNRECOVERABLE,
- TARG_MOD_ATTRRP,
+ TARG_CREATE_VMM_SECTIONS,
TARG_RC_MM_BLOCK_FAIL,
iv_sections[i].vmmAddress,
rc, hbSwError);
@@ -441,6 +515,8 @@ namespace TARGETING
if(iv_sections[i].type == SECTION_TYPE_PNOR_RW)
{
+ // TODO RTC:164480 For MPIPL we need to map the RW section
+ // in real memory to virtual address of the section in PNOR
/*
* Register this memory range to be FLUSHed during
* a shutdown.
@@ -458,8 +534,8 @@ namespace TARGETING
if (rc)
{
/*@
- * @errortype
- * @moduleid TARG_MOD_ATTRRP
+ * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE
+ * @moduleid TARG_CREATE_VMM_SECTIONS
* @reasoncode TARG_RC_MM_PERM_FAIL
* @userdata1 vAddress attempting to allocate.
* @userdata2 (kernel-rc << 32) | (Permissions)
@@ -467,10 +543,13 @@ namespace TARGETING
* @devdesc While attempting to set permissions on
* a virtual memory block for an attribute
* section, the kernel returned an error.
+ *
+ * @custdesc Kernel failed to set permissions on
+ * virtual memory block
*/
const bool hbSwError = true;
l_errl = new ErrlEntry(ERRL_SEV_UNRECOVERABLE,
- TARG_MOD_ATTRRP,
+ TARG_CREATE_VMM_SECTIONS,
TARG_RC_MM_PERM_FAIL,
iv_sections[i].vmmAddress,
TWO_UINT32_TO_UINT64(rc, l_perm),
@@ -478,6 +557,16 @@ namespace TARGETING
break;
}
+ // The volatile sections in MPIPL need to be copied because
+ // on the MPIPL flow we will not run the HWPs that set these attrs
+ if(((iv_sections[i].type == SECTION_TYPE_HEAP_ZERO_INIT) ||
+ (iv_sections[i].type == SECTION_TYPE_HB_HEAP_ZERO_INIT)) &&
+ iv_isMpipl)
+ {
+ memcpy(reinterpret_cast<void*>(iv_sections[i].vmmAddress),
+ reinterpret_cast<void*>(iv_sections[i].pnorAddress),
+ (iv_sections[i].size));
+ }
} // End iteration through each section
if(l_errl)
diff --git a/src/usr/targeting/attrrp_common.C b/src/usr/targeting/attrrp_common.C
index 69810898d..07df1b1e3 100755
--- a/src/usr/targeting/attrrp_common.C
+++ b/src/usr/targeting/attrrp_common.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2013,2015 */
+/* Contributors Listed Below - COPYRIGHT 2013,2016 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -59,10 +59,10 @@ namespace TARGETING
TARG_ASSERT(false, "Assert to exit ~AttrRP");
}
- void AttrRP::init(errlHndl_t &io_taskRetErrl)
+ void AttrRP::init(errlHndl_t &io_taskRetErrl, bool i_isMpipl)
{
// Call startup on singleton instance.
- Singleton<AttrRP>::instance().startup(io_taskRetErrl);
+ Singleton<AttrRP>::instance().startup(io_taskRetErrl, i_isMpipl);
}
bool AttrRP::writeSectionData(
diff --git a/src/usr/targeting/runtime/attrrp_rt.C b/src/usr/targeting/runtime/attrrp_rt.C
index dde880cc0..cf4370f05 100644
--- a/src/usr/targeting/runtime/attrrp_rt.C
+++ b/src/usr/targeting/runtime/attrrp_rt.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2013,2015 */
+/* Contributors Listed Below - COPYRIGHT 2013,2016 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -36,7 +36,7 @@ using namespace ERRORLOG;
namespace TARGETING
{
- void AttrRP::startup(errlHndl_t& io_taskRetErrl)
+ void AttrRP::startup(errlHndl_t& io_taskRetErrl, bool isMpipl)
{
errlHndl_t l_errl = NULL;
diff --git a/src/usr/targeting/targetservicestart.C b/src/usr/targeting/targetservicestart.C
index 073f70eb5..89874132b 100755
--- a/src/usr/targeting/targetservicestart.C
+++ b/src/usr/targeting/targetservicestart.C
@@ -78,7 +78,10 @@ namespace TARGETING
/*
* @brief Initialize any attributes that need to be set early on
*/
-static void initializeAttributes(TargetService& i_targetService);
+static void initializeAttributes(TargetService& i_targetService,
+ bool i_isMpipl,
+ bool i_istepMode,
+ ATTR_MASTER_MBOX_SCRATCH_type& i_masterScratch);
/**
* @brief Check that at least one processor of our cpu type is being targeted
@@ -101,14 +104,41 @@ static void initTargeting(errlHndl_t& io_pError)
TARG_ENTER();
- AttrRP::init(io_pError);
+ //Need to stash away the master mbox regs as they will
+ //be overwritten
+ bool l_isMpipl = false;
+ bool l_isIstepMode = false;
+ ATTR_MASTER_MBOX_SCRATCH_type l_scratch = {0,0,0,0,0,0,0,0};
+
+ for(size_t i=0; i< sizeof(l_scratch)/sizeof(l_scratch[0]); i++)
+ {
+ l_scratch[i] =
+ Util::readScratchReg(MBOX_SCRATCH_REG1+i);
+ }
+
+ // Check mbox scratch reg 3 for IPL boot options
+ // Specifically istep mode (bit 0) and MPIPL (bit 2)
+ INITSERVICE::SPLESS::MboxScratch3_t l_scratch3;
+ l_scratch3.data32 = l_scratch[SCRATCH_3];
+
+ if(l_scratch3.isMpipl)
+ {
+ TARG_INF("We are running MPIPL mode");
+ l_isMpipl = true;
+ }
+ if(l_scratch3.istepMode)
+ {
+ l_isIstepMode = true;
+ }
+
+ AttrRP::init(io_pError, l_isMpipl);
if (io_pError == NULL)
{
TargetService& l_targetService = targetService();
(void)l_targetService.init();
- initializeAttributes(l_targetService);
+ initializeAttributes(l_targetService, l_isMpipl, l_isIstepMode, l_scratch);
checkProcessorTargeting(l_targetService);
// Print out top-level model value from loaded targeting values.
@@ -209,12 +239,14 @@ static void checkProcessorTargeting(TargetService& i_targetService)
/*
* @brief Initialize any attributes that need to be set early on
*/
-static void initializeAttributes(TargetService& i_targetService)
+static void initializeAttributes(TargetService& i_targetService,
+ bool i_isMpipl,
+ bool i_istepMode,
+ ATTR_MASTER_MBOX_SCRATCH_type& i_masterScratch)
{
#define TARG_FN "initializeAttributes()...)"
TARG_ENTER();
- bool l_isMpipl = false;
Target* l_pTopLevel = NULL;
i_targetService.getTopLevelTarget(l_pTopLevel);
@@ -244,36 +276,17 @@ static void initializeAttributes(TargetService& i_targetService)
l_pMasterProcChip->setAttr<ATTR_I2C_SWITCHES>(l_i2c_switches);
- //Need to stash away the master mbox regs as they will
- //be overwritten
- ATTR_MASTER_MBOX_SCRATCH_type l_scratch;
- for(size_t i=0; i< sizeof(l_scratch)/sizeof(l_scratch[0]); i++)
- {
- l_scratch[i] =
- Util::readScratchReg(MBOX_SCRATCH_REG1+i);
- }
-
- l_pTopLevel->setAttr<ATTR_MASTER_MBOX_SCRATCH>(l_scratch);
-
- // Check mbox scratch reg 3 for IPL boot options
- // Specifically istep mode (bit 0) and MPIPL (bit 2)
- INITSERVICE::SPLESS::MboxScratch3_t l_scratch3;
- l_scratch3.data32 = l_scratch[SCRATCH_3];
+ l_pTopLevel->setAttr<ATTR_MASTER_MBOX_SCRATCH>(i_masterScratch);
// Targeting data defaults to non istep, only turn "on" if bit
// is set so we don't tromp default setting
- if (l_scratch3.istepMode)
+ if (i_istepMode)
{
l_pTopLevel->setAttr<ATTR_ISTEP_MODE>(1);
}
-
- if (l_scratch3.isMpipl)
- {
- l_isMpipl = true;
- }
}
- if(l_isMpipl)
+ if(i_isMpipl)
{
l_pTopLevel->setAttr<ATTR_IS_MPIPL_HB>(1);
}
OpenPOWER on IntegriCloud