From f1b76d406973cffd6276fcbf05a036a0ef31b150 Mon Sep 17 00:00:00 2001 From: Glenn Miles Date: Wed, 24 Apr 2019 19:09:15 -0500 Subject: Load and validate OCMB FW image in istep 12.13 Adds function for loading and validating the OCMB firmware image. RTC: 193924 Change-Id: I398d80940710f46cf7e0b66ed663116e574e54b9 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/76624 Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: Matt Derksen Reviewed-by: Ilya Smirnov Reviewed-by: Daniel M. Crowell --- src/include/usr/expupd/expupd.H | 45 +++++++++++ src/include/usr/expupd/expupd_reasoncodes.H | 13 +++- src/include/usr/expupd/ocmbFwImage_const.H | 111 ++++++++++++++++++++++++++++ src/include/usr/isteps/istep12list.H | 1 + 4 files changed, 167 insertions(+), 3 deletions(-) create mode 100644 src/include/usr/expupd/expupd.H create mode 100644 src/include/usr/expupd/ocmbFwImage_const.H (limited to 'src/include') diff --git a/src/include/usr/expupd/expupd.H b/src/include/usr/expupd/expupd.H new file mode 100644 index 000000000..a686d7f91 --- /dev/null +++ b/src/include/usr/expupd/expupd.H @@ -0,0 +1,45 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/expupd/expupd.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2019 */ +/* [+] 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 __EXPUPD_H +#define __EXPUPD_H + +#include + +namespace expupd +{ + +/** + * @brief Check flash image SHA512 hash value of each explorer chip + * and update the flash if it does not match the SHA512 hash + * of the image in PNOR. + * + * @param[out] o_stepError Error handle for logging istep failures + * + */ +void updateAll(ISTEP_ERROR::IStepError& o_stepError); + +}//namespace expupd + +#endif diff --git a/src/include/usr/expupd/expupd_reasoncodes.H b/src/include/usr/expupd/expupd_reasoncodes.H index ed3cd2717..d5837206a 100644 --- a/src/include/usr/expupd/expupd_reasoncodes.H +++ b/src/include/usr/expupd/expupd_reasoncodes.H @@ -33,13 +33,20 @@ namespace EXPUPD enum ExpUpdModuleId { - MOD_UPDATE_ALL_EXP_FLASH_IMAGES = 0x01, + MOD_OCMB_FW_VALIDATE_IMAGE = 0x01, + MOD_PARSE_TAGGED_DATA_TRIPLET = 0x02, }; enum ExpUpdReasonCode { - EXPUPD_INVALID_EYECATCHER = UCD_COMP_ID | 0x01, - EXPUPD_INVALID_MAJOR_VER = UCD_COMP_ID | 0x02, + INVALID_PARMS = EXPUPD_COMP_ID | 0x01, + INVALID_EYE_CATCHER = EXPUPD_COMP_ID | 0x02, + INVALID_HEADER_VERSION = EXPUPD_COMP_ID | 0x03, + INVALID_HEADER_SIZE = EXPUPD_COMP_ID | 0x04, + MISSING_SHA512_HASH = EXPUPD_COMP_ID | 0x05, + INVALID_DATA_TRIPLET_SIZE = EXPUPD_COMP_ID | 0x06, + INVALID_HASH_TRIPLET_SIZE = EXPUPD_COMP_ID | 0x07, + INVALID_TAG_ID = EXPUPD_COMP_ID | 0x08, }; }; // namespace EXPUPD diff --git a/src/include/usr/expupd/ocmbFwImage_const.H b/src/include/usr/expupd/ocmbFwImage_const.H new file mode 100644 index 000000000..b97b1adcf --- /dev/null +++ b/src/include/usr/expupd/ocmbFwImage_const.H @@ -0,0 +1,111 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/expupd/ocmbFwImage_const.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2019 */ +/* [+] 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 __OCMBFWIMAGE_CONST_H +#define __OCMBFWIMAGE_CONST_H + +namespace expupd +{ + +// ********************************WARNING********************************** +// +// THIS FILE MUST BE KEPT IN SYNC WITH src/build/buildpnor/pkgOcmbFw.pl +// +// ********************************WARNING********************************** + + +/** + * @brief Eyecatcher value is the ascii representation of the + * null terminated string, "OCMBHDR". + */ +constexpr uint64_t EYE_CATCHER_VALUE = 0x4F434D4248445200ULL; + +constexpr uint32_t MAX_BIN_TRACE = 256; + +/** + * @brief Miscellaneous constants related to the OCMB firmware header + */ +enum OCMBFW_HEADER_CONSTS: uint32_t +{ + HEADER_VERSION_MAJOR = 1, + HEADER_VERSION_MINOR = 0, + HEADER_MAX_SIZE = 4096, +}; + +/** + * @brief Header for the OCMB flash image content + */ +typedef struct ocmbFwHeader +{ + // See EYE_CATCHER_VALUE above + uint64_t eyeCatcher; + + // The major and minor version of this header + uint32_t majorVersion; + uint32_t minorVersion; + + // The total size of this header (must be 8 byte aligned) + uint32_t headerSize; + + // The number of "tagged data triplets" included + // in this header. (see taggedTriplet_t) + uint32_t numTriplets; + + // Variable sized, unordered tagged data triplets start here +}ocmbFwHeader_t; + +/** + * @brief Tag Id's for tagged triplets + */ +enum TRIPLET_TAG_IDS: uint32_t +{ + // Data contains 64 bytes of SHA512 hash data + TAG_SHA512 = 1, + + // Data contains a null-terminated string of comma separated + // key/value pairs with the following format: + // =,=,= + // + // Keys and values are defined by the manufacturer and must + // not contain the characters "=" or "," + TAG_KEY_VALUE_PAIRS = 2, +}; + +/** + * @brief Tagged triplet data format + */ +typedef struct taggedTriplet +{ + // Identifies the data format for this triplet + uint32_t tagId; + + // Size of the data that follows (must be 8 byte aligned) + uint32_t dataSize; + + // variable sized data starts here +}taggedTriplet_t; + +} //namespace expupd + +#endif diff --git a/src/include/usr/isteps/istep12list.H b/src/include/usr/isteps/istep12list.H index 2fadd6fee..7041a61f1 100644 --- a/src/include/usr/isteps/istep12list.H +++ b/src/include/usr/isteps/istep12list.H @@ -290,6 +290,7 @@ const DepModInfo g_istep12Dependancies = { DEP_LIB(libnestmemutils.so), DEP_LIB(libisteps_io.so), DEP_LIB(libisteps_mss.so), + DEP_LIB(libexpupd.so), NULL } }; -- cgit v1.2.3