From 6677ffcbda04c73a7d3ed1e651e3394c8218e503 Mon Sep 17 00:00:00 2001 From: Dan Crowell Date: Mon, 6 Mar 2017 16:36:11 -0600 Subject: Propagate attribute overrides up to the HBRT code Attribute overrides are stored in a separate tank of memory from the regular attribute values. This tank will be added as an additional reserved memory section for HBRT to consume (only if overrides exist). Also fixed a couple bugs encountered while testing: - No longer crashes if an error is created inside the targeting initialization code. - Added reserved bytes to RHB definition. Change-Id: I5b10f7ad8dfcb58c550868bb83c4d843f48e1aae RTC: 169942 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/38547 Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Tested-by: FSP CI Jenkins Reviewed-by: Corey V. Swenson Reviewed-by: Martin Gloff Reviewed-by: Christian R. Geddes Reviewed-by: Daniel M. Crowell --- src/include/usr/fapi2/plat_attr_override_sync.H | 6 +++- src/include/usr/targeting/attrPlatOverride.H | 11 ++---- src/include/usr/targeting/attrrp.H | 45 +++++++++++++++++++++---- src/include/usr/targeting/targplatreasoncodes.H | 6 +++- 4 files changed, 52 insertions(+), 16 deletions(-) (limited to 'src/include/usr') diff --git a/src/include/usr/fapi2/plat_attr_override_sync.H b/src/include/usr/fapi2/plat_attr_override_sync.H index acb2d26df..83d8fff53 100644 --- a/src/include/usr/fapi2/plat_attr_override_sync.H +++ b/src/include/usr/fapi2/plat_attr_override_sync.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2016 */ +/* Contributors Listed Below - COPYRIGHT 2015,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -53,6 +53,8 @@ namespace TARGETING { errlHndl_t getAttrOverrides(PNOR::SectionInfo_t &i_sectionInfo, AttributeTank* io_tanks[AttributeTank::TANK_LAYER_LAST]); + + class AttrRP; } namespace RT_TARG @@ -106,6 +108,8 @@ public: friend int RT_TARG::apply_attr_override(uint8_t* i_data, size_t i_size ); + friend class TARGETING::AttrRP; + /** * @brief Maximum size of a direct attribute override */ diff --git a/src/include/usr/targeting/attrPlatOverride.H b/src/include/usr/targeting/attrPlatOverride.H index 266f1976e..2ac3af20a 100644 --- a/src/include/usr/targeting/attrPlatOverride.H +++ b/src/include/usr/targeting/attrPlatOverride.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014,2015 */ +/* Contributors Listed Below - COPYRIGHT 2014,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -52,13 +52,8 @@ struct AttrOverrideSection * enums and make it obvious which layers map to what PNOR section. * Currrently the pair is only used in a test case to keep it in order */ -const std::pair - tankLayerToPnor[AttributeTank::TANK_LAYER_LAST] = - { - std::make_pair(AttributeTank::TANK_LAYER_FAPI, PNOR::ATTR_TMP), - std::make_pair(AttributeTank::TANK_LAYER_TARG, PNOR::ATTR_TMP), - std::make_pair(AttributeTank::TANK_LAYER_PERM, PNOR::ATTR_PERM) - }; +extern const std::pair + tankLayerToPnor[AttributeTank::TANK_LAYER_LAST]; /** * @brief This function gets any Attribute Overrides in PNOR diff --git a/src/include/usr/targeting/attrrp.H b/src/include/usr/targeting/attrrp.H index 50eb200d9..b9059db96 100644 --- a/src/include/usr/targeting/attrrp.H +++ b/src/include/usr/targeting/attrrp.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2016 */ +/* Contributors Listed Below - COPYRIGHT 2012,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -41,6 +41,7 @@ #include #include #include +#include namespace TARGETING { @@ -161,12 +162,9 @@ class AttrRP /** * @brief Copies all present attribute sections to memory. * - * The copy will grow down from the input address. - * * @param[in,out] i_addr - * Physical address at the top of the desired region to - * place. After function will be the address at the bottom of - * the region. + * Physical address at the bottom of the desired region to + * place. * * @return Virtual address to the region. */ @@ -181,6 +179,21 @@ class AttrRP * @return Size of all attribute sections */ static uint64_t maxSize( ); + + /** + * @brief Copies all present attribute override tanks to memory. + * + * @param[in] i_dest + * Physical address to copy override data into + * @param[in,out] io_size + * in: Maximum size of allocated space in bytes + * out: Actual number of bytes used (zero means no overrides) + * + * @return Error log + */ + static errlHndl_t saveOverrides( uint8_t* i_dest, + size_t& io_size ); + #endif protected: @@ -315,6 +328,26 @@ class AttrRP /** Internal implementation of save function. */ void* _save(uint64_t&); + /** Internal implementation of saveOverrides function. */ + errlHndl_t _saveOverrides( uint8_t* i_dest, + size_t& io_size ); + + /** + * @brief Serialize and copy a single override tank out to memory + * + * @param[in] i_dest Starting address to copy data into + * @param[inout] io_size Input: Size of i_dest buffer + * Output: Size of serialized data + * @param[in] i_tank Override tank to serialize out + * @param[in] i_layer Type of tank being worked on + * + * @return Error log + */ + errlHndl_t saveOverrideTank( uint8_t* i_dest, + size_t& io_size, + AttributeTank* i_tank, + AttributeTank::TankLayer i_layer ); + /** * @brief Starts the attribute provider's message processor * diff --git a/src/include/usr/targeting/targplatreasoncodes.H b/src/include/usr/targeting/targplatreasoncodes.H index ea8a2ea63..56faa3025 100644 --- a/src/include/usr/targeting/targplatreasoncodes.H +++ b/src/include/usr/targeting/targplatreasoncodes.H @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ +/* Contributors Listed Below - COPYRIGHT 2013,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. */ @@ -54,6 +56,7 @@ enum PlatTargetingModuleId TARG_MOD_QUERY_MASTER_PROC_CHIP = 0x80, TARG_MOD_SET_MASTER_NODE = 0x81, TARG_MOD_ATTRRP_RT = 0x82, + TARG_MOD_SAVE_OVERRIDE_TANK = 0x83, }; /** @@ -66,6 +69,7 @@ enum PlatTargetingReasonCode { TARG_RC_INVALID_NODE = TARG_COMP_ID | 0x80, TARG_RC_TARGET_NOT_FOUND = TARG_COMP_ID | 0x81, + TARG_SPACE_OVERRUN = TARG_COMP_ID | 0x82, }; } // End TARGETING namespace -- cgit v1.2.3