diff options
author | Prachi Gupta <pragupta@us.ibm.com> | 2015-01-23 14:18:43 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2015-02-24 15:36:10 -0600 |
commit | b908135a569ed584b12262a020664d0150e4d933 (patch) | |
tree | 695a74c1598415beefc984d27f8a7fd9713ccf2f /src/usr/pnor/pnor_common.H | |
parent | b03dc1b8e4b20a8039775e474bd9ebf2503bf48c (diff) | |
download | blackbird-hostboot-b908135a569ed584b12262a020664d0150e4d933.tar.gz blackbird-hostboot-b908135a569ed584b12262a020664d0150e4d933.zip |
determine the toc locations in pnorrp and rt_pnor code
RTC: 120733
Change-Id: I5372a102ce9761a514a6f7245ca206a2226f1f3b
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/15456
Tested-by: Jenkins Server
Reviewed-by: STEPHEN M. CPREK <smcprek@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/pnor/pnor_common.H')
-rw-r--r-- | src/usr/pnor/pnor_common.H | 58 |
1 files changed, 50 insertions, 8 deletions
diff --git a/src/usr/pnor/pnor_common.H b/src/usr/pnor/pnor_common.H index 5eb893412..b1106237a 100644 --- a/src/usr/pnor/pnor_common.H +++ b/src/usr/pnor/pnor_common.H @@ -26,6 +26,10 @@ #define PNOR_COMMON_H #include <pnor/pnorif.H> +#include "ffs.h" +#include <devicefw/driverif.H> +#include <initservice/mboxRegs.H> + namespace PNOR { /** * Internal information to deal with the sections of PNOR @@ -51,18 +55,13 @@ namespace PNOR { enum { - // @TODO RTC: 120061 - Determine TOC locations - // TOC offsets based on pnor layout - SIDE_A_TOC_0_OFFSET = 0, - SIDE_A_TOC_1_OFFSET = 0x8000, - SIDE_B_TOC_0_OFFSET = 0x2000000, - SIDE_B_TOC_1_OFFSET = 0x2008000, - /** Real number of bytes required to read 1 logical page */ PAGESIZE_PLUS_ECC = ((PAGESIZE * 9)/8), // 8B data + 1B of ECC SUPPORTED_FFS_VERSION = 0x1, /**< Supported FFS Version */ FFS_TABLE_BASE_ADDR = 0x0, /**< Currently only have FFS table */ + TOC_SIZE = 0x8000, + INVALID_OFFSET = 0xFFFFFFF, }; /** @@ -81,7 +80,7 @@ namespace PNOR { /** * @brief parse the TOCs read from memory and store section - * information from one of the verified TOC's + * information from one of the verified TOCs * @param[in] i_toc0Buffer Pointer to toc0 * @param[in] i_toc1Buffer Pointer to toc1 * @param[out] o_TOC_used which TOC is used @@ -91,6 +90,49 @@ namespace PNOR { */ errlHndl_t parseTOC(uint8_t* i_toc0Buffer, uint8_t* i_toc1Buffer, TOCS & o_TOC_used, SectionData_t * o_TOC, uint64_t i_baseVAddr); + + /* + * @brief: determine the physical offset of ffs entry + * (to be used before readTOC is called) + * @param[in] i_tocAddress - ffs hdr pointing to a valid TOC + * @param[in] i_entryName - Name of the ffs entry to find the offset of + * @param[out] o_offset - physical offset of the ffs entry + */ + void findPhysicalOffset(ffs_hdr* i_tocAddress, + const char* i_entryName, + uint64_t & o_offset); + + /* + * @brief used to translate mmio offset stored in mbox scratch 2 + * to physical offset of HBB Image + * @param[out] o_hbbAddress Physical Offset of HB Base Image + * associated with the current boot + * @return Error + */ + errlHndl_t mmioToPhysicalOffset(uint64_t& o_hbbAddress); + + /* + * @brief used to translate HBB Address to MMIO offset + * @param[in] i_hbbAddress - Physical Offset of the HB Base image + * @param[out] o_mmioOffest - MMIO Offset of the HB Base image + */ + void physicalToMmioOffset(uint64_t i_hbbAddress, + uint64_t& o_mmioOffset); + + enum + { + LPC_TOP_OF_FLASH_OFFSET = 0x0FFFFFFF, +#ifdef CONFIG_PNOR_IS_32MB + PNOR_SIZE = 32*MEGABYTE, +#else //default to 64MB + PNOR_SIZE = 64*MEGABYTE, +#endif + //The direct offset value must be equal to <top of flash>-<pnor size>+1 + // for the SBE to work so we can rely on that same assertion + /**< Offset to direct read space, from FW base */ + LPC_SFC_MMIO_OFFSET = LPC_TOP_OF_FLASH_OFFSET-PNOR_SIZE+1, + }; + } #endif |