diff options
Diffstat (limited to 'src/include/usr/hwpf')
| -rw-r--r-- | src/include/usr/hwpf/hwpf_reasoncodes.H | 90 | ||||
| -rw-r--r-- | src/include/usr/hwpf/plat/fapiPlatAttributeService.H | 141 |
2 files changed, 111 insertions, 120 deletions
diff --git a/src/include/usr/hwpf/hwpf_reasoncodes.H b/src/include/usr/hwpf/hwpf_reasoncodes.H index cb20f4b9c..bfd8b462c 100644 --- a/src/include/usr/hwpf/hwpf_reasoncodes.H +++ b/src/include/usr/hwpf/hwpf_reasoncodes.H @@ -41,46 +41,22 @@ namespace fapi // PLAT generated errors MOD_FAPI_GET_CHILD_CHIPLETS = 0x03, MOD_FAPI_GET_PARENT_CHIP = 0x04, - MOD_PLAT_ATTR_SVC_CREATE_ATTR_ACCESS_ERROR = 0x05, - MOD_HANDLE_ECMD_BUF_RC = 0x06, + MOD_PLAT_ATTR_SVC_GET_TARG_ATTR = 0x05, + MOD_PLAT_ATTR_SVC_SET_TARG_ATTR = 0x06, MOD_VERIFY_CFAM_ACCESS_TARGET = 0x07, MOD_ATTR_BASE_ADDR_GET = 0x08, - MOD_ATTR_DQ_MAP_GET = 0x09, - MOD_GET_CFAM_CHIP_TARGET = 0x0A, - MOD_ATTR_GET_TARGET_NAME = 0x0B, - MOD_FAPI_GET_ASSOCIATE_DIMMS = 0x0C, - MOD_EDI_EI_IO_RUN_TRAINING = 0x0D, - MOD_THREAD_ACTIVATE = 0x0E, - MOD_ATTR_GET_FUNCTIONAL = 0x0F, - MOD_ATTR_GET_HB_TARGET = 0x10, - MOD_ATTR_PROC_MEMBASE_GET = 0x11, - MOD_ATTR_PROC_MIRRORBASE_GET = 0x12, - MOD_ATTR_PROC_FOREIGN_NEAR_BASE_GET = 0x13, - MOD_ATTR_PROC_FOREIGN_NEAR_SIZE_GET = 0x14, - MOD_ATTR_PROC_FOREIGN_FAR_BASE_GET = 0x15, - MOD_ATTR_PROC_FOREIGN_FAR_SIZE_GET = 0x16, - MOD_ATTR_PROC_HA_BASE_GET = 0x17, - MOD_ATTR_PROC_HA_SIZE_GET = 0x18, - MOD_ATTR_PROC_PSI_BRIDGE_BAR_ENABLE_GET = 0x19, - MOD_ATTR_PROC_PSI_BRIDGE_BAR_BASE_ADDR_GET = 0x1A, - MOD_ATTR_PROC_FSP_BAR_ENABLE_GET = 0x1B, - MOD_ATTR_PROC_FSP_BAR_BASE_ADDR_GET = 0x1C, - MOD_ATTR_PROC_FSP_BAR_SIZE_GET = 0x1D, - MOD_ATTR_PROC_FSP_MMIO_MASK_SIZE_GET = 0x1E, - MOD_ATTR_PROC_INTP_BAR_ENABLE_GET = 0x1F, - MOD_ATTR_PROC_INTP_BAR_BASE_ADDR_GET = 0x20, - MOD_ATTR_PROC_NX_MMIO_BAR_ENABLE_GET = 0x21, - MOD_ATTR_PROC_NX_MMIO_BAR_BASE_ADDR_GET = 0x22, - MOD_ATTR_PROC_NX_MMIO_BAR_SIZE_GET = 0x23, - MOD_ATTR_PROC_PCIE_BAR_ENABLE_GET = 0x24, - MOD_ATTR_PROC_PCIE_BAR_BASE_ADDR_GET = 0x25, - MOD_ATTR_PROC_PCIE_BAR_SIZE_GET = 0x26, - MOD_MVPD_ACCESS = 0x27, - MOD_EXIT_CACHE_CONTAINED = 0x28, - MOD_GET_CACHE_DECONFIG = 0x29, - MOD_FAPI_GET_OTHER_SIDE_OF_MEM_CHANNEL = 0x2A, - MOD_MBVPD_ACCESS = 0x2B, - MOD_OCC_LOAD_OCC_IMAGE_TO_HOMER = 0x2C, + MOD_GET_CFAM_CHIP_TARGET = 0x09, + MOD_FAPI_GET_ASSOCIATE_DIMMS = 0x0A, + MOD_EDI_EI_IO_RUN_TRAINING = 0x0B, + MOD_THREAD_ACTIVATE = 0x0C, + MOD_ATTR_GET_TARGETING_TARGET = 0x0D, + MOD_ATTR_GET_TARGET_NAME = 0x0E, + MOD_MVPD_ACCESS = 0x0F, + MOD_EXIT_CACHE_CONTAINED = 0x10, + MOD_GET_CACHE_DECONFIG = 0x11, + MOD_FAPI_GET_OTHER_SIDE_OF_MEM_CHANNEL = 0x12, + MOD_MBVPD_ACCESS = 0x13, + MOD_OCC_LOAD_OCC_IMAGE_TO_HOMER = 0x14, }; /** @@ -99,29 +75,25 @@ namespace fapi RC_UNSUPPORTED_REQUEST = HWPF_COMP_ID | 0x11, RC_NO_SINGLE_PARENT = HWPF_COMP_ID | 0x12, RC_FAILED_TO_ACCESS_ATTRIBUTE = HWPF_COMP_ID | 0x13, - RC_ECMD_OPERATION_FAILURE = HWPF_COMP_ID | 0x14, - RC_CFAM_ACCESS_ON_PROC_ERR = HWPF_COMP_ID | 0x15, - RC_ATTR_BAD_TARGET_PARAM = HWPF_COMP_ID | 0x16, - RC_INVALID_NUM_PARENT_CHIP = HWPF_COMP_ID | 0x17, - RC_EMBEDDED_NULL_TARGET_PTR = HWPF_COMP_ID | 0x18, - RC_MIXED_PBUS_CONNECTION = HWPF_COMP_ID | 0x19, - RC_SAME_CHIP_PBUS_CONNECTION = HWPF_COMP_ID | 0x1A, - RC_CONFLICT_PBUS_CONNECTION = HWPF_COMP_ID | 0x1B, - RC_NO_MASTER_CORE_TARGET = HWPF_COMP_ID | 0x1C, - RC_NULL_FAPI_TARGET = HWPF_COMP_ID | 0x1D, - RC_UNEXPECTED_TARGET_TYPE = HWPF_COMP_ID | 0x1E, - RC_ATTR_UNKNOWN_TARGET_NAME = HWPF_COMP_ID | 0x1F, - RC_ATTR_UNSUPPORTED_PROC_NUM = HWPF_COMP_ID | 0x20, - RC_INVALID_RECORD = HWPF_COMP_ID | 0x21, - RC_INVALID_KEYWORD = HWPF_COMP_ID | 0x22, - RC_MM_EXTEND_FAILED = HWPF_COMP_ID | 0x23, - RC_INCORRECT_KEWORD_SIZE = HWPF_COMP_ID | 0x24, - RC_NO_SINGLE_MCS = HWPF_COMP_ID | 0x25, - RC_NO_SINGLE_MEMBUFF = HWPF_COMP_ID | 0x26, - RC_STATE_MISMATCH = HWPF_COMP_ID | 0x27, + RC_CFAM_ACCESS_ON_PROC_ERR = HWPF_COMP_ID | 0x14, + RC_ATTR_BAD_TARGET_PARAM = HWPF_COMP_ID | 0x15, + RC_INVALID_NUM_PARENT_CHIP = HWPF_COMP_ID | 0x16, + RC_EMBEDDED_NULL_TARGET_PTR = HWPF_COMP_ID | 0x17, + RC_MIXED_PBUS_CONNECTION = HWPF_COMP_ID | 0x18, + RC_SAME_CHIP_PBUS_CONNECTION = HWPF_COMP_ID | 0x19, + RC_CONFLICT_PBUS_CONNECTION = HWPF_COMP_ID | 0x1A, + RC_NO_MASTER_CORE_TARGET = HWPF_COMP_ID | 0x1B, + RC_UNEXPECTED_TARGET_TYPE = HWPF_COMP_ID | 0x1C, + RC_INVALID_RECORD = HWPF_COMP_ID | 0x1D, + RC_INVALID_KEYWORD = HWPF_COMP_ID | 0x1E, + RC_MM_EXTEND_FAILED = HWPF_COMP_ID | 0x1F, + RC_INCORRECT_KEWORD_SIZE = HWPF_COMP_ID | 0x20, + RC_NO_SINGLE_MCS = HWPF_COMP_ID | 0x21, + RC_NO_SINGLE_MEMBUFF = HWPF_COMP_ID | 0x22, + RC_STATE_MISMATCH = HWPF_COMP_ID | 0x23, // OCC Errors - RC_MMIO_UNMAP_ERR = HWPF_COMP_ID | 0x28, + RC_MMIO_UNMAP_ERR = HWPF_COMP_ID | 0x24, }; /** diff --git a/src/include/usr/hwpf/plat/fapiPlatAttributeService.H b/src/include/usr/hwpf/plat/fapiPlatAttributeService.H index 21bdae861..3fb49a56d 100644 --- a/src/include/usr/hwpf/plat/fapiPlatAttributeService.H +++ b/src/include/usr/hwpf/plat/fapiPlatAttributeService.H @@ -69,51 +69,69 @@ namespace platAttrSvc { /** - * @brief Returns the system target + * @brief Compile time check that a FAPI attribute is the same size as a + * TARGETING attribute when they are direct mapped * - * @par Detailed Description: - * Returns the system target. If the target service has not been - * initialized -or- there is any failure to acquire it, the function - * will assert + * If the size is different then an undefined class is instantiated leading + * to a compile time failure else an empty inline function is optimized out + * by the compiler. * - * @return Target handle to the system target + * @param[in] result of size comparison * - * @retval !NULL An actual target handle - * @retval NULL Not possible + * @return Pointer to Targeting Target */ -TARGETING::Target* getSystemTarget(); +class ErrorFapiTargSizeMismatch; +template<const bool SIZE_MISMATCH> void failIfFapiTargAttrSizeMismatch() +{ + ErrorFapiTargSizeMismatch(); +} +template <> inline void failIfFapiTargAttrSizeMismatch<false>() {} /** - * @brief Returns a fapiReturn code containing information on an attribute - * access error + * @brief Gets a Targeting attribute, this is called by the macro that maps a + * FAPI Attribute get to a TARGETING attribute and should not be called + * directly + * + * @param[in] i_pFapiTarget Pointer to FAPI Target + * @param[in] i_targAttrId TARGETING Attribute ID + * @param[in] i_attrSize Size of attribute in bytes + * @param[in] o_pAttr Pointer to attribute where value is copied to * - * @param[in] i_targAttrId Platform attribute ID - * @param[in] i_fapiAttrId FAPI attribute ID which maps to the platform - * attribute ID - * @param[in] i_pFapiTarget Pointer to the FAPI target holding the - * requested attribute + * @return ReturnCode + */ +fapi::ReturnCode getTargetingAttr(const fapi::Target * i_pFapiTarget, + const TARGETING::ATTRIBUTE_ID i_targAttrId, + const uint32_t i_attrSize, + void * o_pAttr); + +/** + * @brief Sets a Targeting attribute, this is called by the macro that maps a + * FAPI Attribute set to a TARGETING attribute and should not be called + * directly * - * @return fapiReturn code containing a platform generated error log + * @param[in] i_pFapiTarget Pointer to FAPI Target + * @param[in] i_targAttrId TARGETING Attribute ID + * @param[in] i_attrSize Size of attribute in bytes + * @param[in] i_pAttr Pointer to attribute where value is retrieved from * - * @retval FAPI_RC_PLAT_ERR_SEE_DATA (return code value) which informs - * caller there is a host boot error log attached + * @return ReturnCode */ -fapi::ReturnCode createAttrAccessError( - const TARGETING::ATTRIBUTE_ID i_targAttrId, - const fapi::AttributeId i_fapiAttrId, - const fapi::Target* i_pFapiTarget); +fapi::ReturnCode setTargetingAttr(const fapi::Target * i_pFapiTarget, + const TARGETING::ATTRIBUTE_ID i_targAttrId, + const uint32_t i_attrSize, + void * i_pAttr); /** * @brief This function is called by the FAPI_ATTR_GET macro when accessing * SPD ATTR. It should not be called directly * - * @param[in] i_target Target pointer to operate on - * @param[in] i_keyword SPD keyword - * @param[out] o_data Address of Storage for saving the attribute value - * @param[in] i_len Size of storage + * @param[in] i_pFapiTarget Target pointer to operate on + * @param[in] i_keyword SPD keyword + * @param[out] o_data Address of Storage for saving the attribute value + * @param[in] i_len Size of storage * @return ReturnCode. Zero on success, else platform specified error */ -fapi::ReturnCode fapiPlatGetSpdAttr(const fapi::Target * i_target, +fapi::ReturnCode fapiPlatGetSpdAttr(const fapi::Target * i_pFapiTarget, const uint16_t i_keyword, void * o_data, size_t i_len ); @@ -122,13 +140,13 @@ fapi::ReturnCode fapiPlatGetSpdAttr(const fapi::Target * i_target, * @brief This function is called by the FAPI_ATTR_SET macro when accessing * SPD ATTR. It should not be called directly * - * @param[in] i_target Target pointer to operate on - * @param[in] i_keyword SPD keyword - * @param[in] i_data Pointer to data - * @param[in] i_len Size of data + * @param[in] i_pFapiTarget Target pointer to operate on + * @param[in] i_keyword SPD keyword + * @param[in] i_data Pointer to data + * @param[in] i_len Size of data * @return ReturnCode. Zero on success, else platform specified error */ -fapi::ReturnCode fapiPlatSetSpdAttr(const fapi::Target * i_target, +fapi::ReturnCode fapiPlatSetSpdAttr(const fapi::Target * i_pFapiTarget, const uint16_t i_keyword, void * i_data, size_t i_len ); @@ -159,33 +177,33 @@ fapi::ReturnCode fapiPlatGetMirrorBaseAddr(const fapi::Target * i_pMcsTarget, * @brief This function is called by the FAPI_ATTR_GET macro when getting * ATTR_CEN_DQ_TO_DIMM_CONN_DQ. It should not be called directly * - * @param[in] i_pDimmTarget DIMM target pointer - * @param[out] o_data Output data + * @param[in] i_pDimmFapiTarget DIMM target pointer + * @param[out] o_data Output data * @return ReturnCode. Zero on success, else platform specified error */ -fapi::ReturnCode fapiPlatGetDqMapping(const fapi::Target * i_pDimmTarget, +fapi::ReturnCode fapiPlatGetDqMapping(const fapi::Target * i_pDimmFapiTarget, uint8_t (&o_data)[DIMM_DQ_NUM_DQS]); /** * @brief This function is called by the FAPI_ATTR_GET macro when getting * ATTR_NAME. It should not be called directly * - * @param[in] i_pTarget Target pointer - * @param[out] o_name Output Name (from enum ATTR_NAME_Enum) + * @param[in] i_pFapiTarget Target pointer + * @param[out] o_name Output Name (from enum ATTR_NAME_Enum) * @return ReturnCode. Zero on success, else platform specified error */ -fapi::ReturnCode fapiPlatGetTargetName(const fapi::Target * i_pTarget, +fapi::ReturnCode fapiPlatGetTargetName(const fapi::Target * i_pFapiTarget, uint8_t & o_name); /** * @brief This function is called by the FAPI_ATTR_GET macro when getting * ATTR_FUNCTIONAL. It should not be called directly * - * @param[in] i_pTarget Target pointer - * @param[out] o_functional 1 = functional, else 0 + * @param[in] i_pFapiTarget Target pointer + * @param[out] o_functional 1 = functional, else 0 * @return ReturnCode. Zero on success, else platform specified error */ -fapi::ReturnCode fapiPlatGetFunctional(const fapi::Target * i_pTarget, +fapi::ReturnCode fapiPlatGetFunctional(const fapi::Target * i_pFapiTarget, uint8_t & o_functional); /** @@ -429,30 +447,31 @@ fapi::ReturnCode fapiPlatGetSingleMemberEnableAttr( } // namespace fapi /** - * @brief Macro which directly maps a FAPI request to get a platform - * attribute to the equivalent host boot request + * @brief Macro which directly maps a FAPI_ATTR_GET to a Targeting attr get + * + * Firstly there is a compile time check that the FAPI Attribute has the same + * size as the correpsonding TARGETING attribute, this is optimized out, then + * there is a single function call */ #define FAPI_PLAT_ATTR_SVC_GETMACRO_DIRECT(ID, PTARGET, VAL) \ - ( ((PTARGET > 0) ? \ - static_cast<TARGETING::Target*>( \ - static_cast<const fapi::Target*>(PTARGET)->get()) \ - : fapi::platAttrSvc::getSystemTarget())->tryGetAttr< \ - FAPI_PLAT_ATTR_SVC_MACRO_DIRECT_FAPI_##ID>(VAL)) \ - ? fapi::FAPI_RC_SUCCESS : fapi::platAttrSvc::createAttrAccessError( \ - FAPI_PLAT_ATTR_SVC_MACRO_DIRECT_FAPI_##ID,fapi::ID,PTARGET) + (fapi::platAttrSvc::failIfFapiTargAttrSizeMismatch<sizeof(VAL) != \ + sizeof(TARGETING::AttributeTraits \ + <FAPI_PLAT_ATTR_SVC_MACRO_DIRECT_FAPI_##ID>::Type)>(), \ + fapi::platAttrSvc::getTargetingAttr(PTARGET, \ + FAPI_PLAT_ATTR_SVC_MACRO_DIRECT_FAPI_##ID, sizeof(VAL), &(VAL))) /** - * @brief Macro which directly maps a FAPI request to set a platform - * attribute to the equivalent host boot request + * @brief Macro which directly maps a FAPI_ATTR_SET to a Targeting attr set + * + * Firstly there is a compile time check that the FAPI Attribute has the same + * size as the correpsonding TARGETING attribute, this is optimized out, then + * there is a single function call */ #define FAPI_PLAT_ATTR_SVC_SETMACRO_DIRECT(ID, PTARGET, VAL) \ - ( ((PTARGET > 0) ? \ - static_cast<TARGETING::Target*>( \ - static_cast<const fapi::Target*>(PTARGET)->get()) \ - : fapi::platAttrSvc::getSystemTarget())->trySetAttr< \ - FAPI_PLAT_ATTR_SVC_MACRO_DIRECT_FAPI_##ID>(VAL)) \ - ? fapi::FAPI_RC_SUCCESS : fapi::platAttrSvc::createAttrAccessError( \ - FAPI_PLAT_ATTR_SVC_MACRO_DIRECT_FAPI_##ID,fapi::ID,PTARGET) - + (fapi::platAttrSvc::failIfFapiTargAttrSizeMismatch<sizeof(VAL) != \ + sizeof(TARGETING::AttributeTraits \ + <FAPI_PLAT_ATTR_SVC_MACRO_DIRECT_FAPI_##ID>::Type)>(), \ + fapi::platAttrSvc::setTargetingAttr(PTARGET, \ + FAPI_PLAT_ATTR_SVC_MACRO_DIRECT_FAPI_##ID, sizeof(VAL), &(VAL))) //------------------------------------------------------------------------------ // MACRO to support the overriding of Chip EC Feature Attributes |

