diff options
author | Dean Sanner <dsanner@us.ibm.com> | 2013-04-05 11:32:19 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2013-04-05 14:54:04 -0500 |
commit | 1c2753a32b9b8b819b7ae19438b7362fad58fe32 (patch) | |
tree | 2911f115ec5bddbfccf1d3ece2c6ffbd7ce5ade8 | |
parent | bfc1a5511eb003271517efa15908f02527be4dff (diff) | |
download | talos-hostboot-1c2753a32b9b8b819b7ae19438b7362fad58fe32.tar.gz talos-hostboot-1c2753a32b9b8b819b7ae19438b7362fad58fe32.zip |
Update p8_xip_* HWP and load SLW image from PNOR
Change-Id: I115c918b107ede18918909b60489476fc9e9b3d7
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/3902
Reviewed-by: Mark W. Wenning <wenning@us.ibm.com>
Reviewed-by: ADAM R. MUHLE <armuhle@us.ibm.com>
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
15 files changed, 607 insertions, 191 deletions
diff --git a/src/build/mkrules/hbfw/img/makefile b/src/build/mkrules/hbfw/img/makefile index a23d30598..1611c6d90 100755 --- a/src/build/mkrules/hbfw/img/makefile +++ b/src/build/mkrules/hbfw/img/makefile @@ -90,9 +90,16 @@ PNOR_BUILD_SCRIPT = ${buildpnor.pl:P} HOSTBOOT_DEFAULT_SECTIONS = HBB=${BASE_W_HEADER_ECC_IMAGE},HBI=${EXT_IMAGE} -PNOR_IMG_INFO = murano.pnor:defaultPnorLayout.xml:HBD=simics_MURANO_targeting.bin,${HOSTBOOT_DEFAULT_SECTIONS} \ - venice.pnor:defaultPnorLayout.xml:HBD=simics_VENICE_targeting.bin,${HOSTBOOT_DEFAULT_SECTIONS} \ - ${FIPS_PNOR_INFO} +HBFW_OBJPATH = ${.PATH:M*obj*} +ENGD_OBJPATH = ${HBFW_OBJPATH:S/hbfw\/img/engd\/href/g} +SLW_IMG = ${ENGD_OBJPATH:Fp8.ref_image.bin} +MURANO_SECT = HBD=simics_MURANO_targeting.bin,WINK=${SLW_IMG} +VENICE_SECT = HBD=simics_VENICE_targeting.bin,WINK=${SLW_IMG} + +PNOR_IMG_INFO = \ + murano.pnor:defaultPnorLayout.xml:${MURANO_SECT},${HOSTBOOT_DEFAULT_SECTIONS} \ + venice.pnor:defaultPnorLayout.xml:${VENICE_SECT},${HOSTBOOT_DEFAULT_SECTIONS} \ + ${FIPS_PNOR_INFO} __IMAGE_BUILD/% : .SPECTARG .PMAKE cp_hbfiles @${MAKE:T:R} BUILD_SPECIFIC_IMAGE \ diff --git a/src/include/usr/hwpf/istepreasoncodes.H b/src/include/usr/hwpf/istepreasoncodes.H index bc81acaae..fa184a9ea 100644 --- a/src/include/usr/hwpf/istepreasoncodes.H +++ b/src/include/usr/hwpf/istepreasoncodes.H @@ -172,6 +172,7 @@ enum istepReasonCode ISTEP_PROC_XBUS_SCOMINIT_FAILED = ISTEP_COMP_ID | 0x2B, ISTEP_PROC_ABUS_SCOMINIT_FAILED = ISTEP_COMP_ID | 0x2C, ISTEP_PROC_SWITCH_CFSIM_FAILED = ISTEP_COMP_ID | 0x2D, + ISTEP_LOAD_SLW_FROM_PNOR_FAILED = ISTEP_COMP_ID | 0x2E, }; // end ISTEP } diff --git a/src/makefile b/src/makefile index e1c137c15..36edf7724 100644 --- a/src/makefile +++ b/src/makefile @@ -84,7 +84,7 @@ hbicore_DATA_MODULES = sample.if p8.dmi.scom.if cen.dmi.scom.if \ p8.fbc.scom.if mbs_def.if mba_def.if cen_ddrphy.if \ p8.pe.phase1.scom.if p8.pe.phase2.scom.if \ dimmspd.dat centaur.sbe_pnor.bin procmvpd.dat \ - procpore.dat ${PRDR_RULE_TABLE_TARGETS} \ + ${PRDR_RULE_TABLE_TARGETS} \ p8.abus.scom.if p8.xbus.scom.if p8.mcs.scom.if \ p8.as.scom.if p8.nx.scom.if p8.dmi.custom.scom.if \ cen.dmi.custom.scom.if p8.abus.custom.scom.if \ diff --git a/src/usr/hwpf/hwp/build_winkle_images/build_winkle_images.C b/src/usr/hwpf/hwp/build_winkle_images/build_winkle_images.C index 23dc77ad6..277470570 100644 --- a/src/usr/hwpf/hwp/build_winkle_images/build_winkle_images.C +++ b/src/usr/hwpf/hwp/build_winkle_images/build_winkle_images.C @@ -54,6 +54,8 @@ #include <targeting/common/utilFilter.H> #include <targeting/namedtarget.H> +#include <pnor/pnorif.H> + // fapi support #include <fapi.H> #include <fapiPlatHwpInvoker.H> @@ -71,6 +73,8 @@ #include "p8_set_pore_bar/p8_set_pore_bar.H" #include "p8_pm.H" // PM_INIT #include "p8_set_pore_bar/p8_poreslw_init.H" +#include "p8_slw_build/sbe_xip_image.h" + namespace BUILD_WINKLE_IMAGES { @@ -88,65 +92,60 @@ using namespace DeviceFW; /** * @brief Load PORE image and return a pointer to it, or NULL * - * @param[in] - target pointer - pointer to the processor target, - * eventually we will need to know which processor to know - * which image to load. * @param[out] - address of the PORE image * @param[out] - size of the PORE image * * @return NULL if success, errorlog if failure * */ -errlHndl_t loadPoreImage( const TARGETING::Target *i_CpuTarget, - const char *& o_rporeAddr, - size_t & o_rporeSize ) +errlHndl_t loadPoreImage( const char *& o_rporeAddr, + uint32_t & o_rporeSize ) { - errlHndl_t l_errl = NULL; - const char * fileName = "procpore.dat"; - - /** - * @todo add code here later to look up the IDEC of the processor and - * load the appropriate PORE image. Currently we just have the single - * image. - */ + errlHndl_t l_errl = NULL; + PNOR::SectionInfo_t l_info; + int64_t rc = 0; + o_rporeSize = 0; do { - // Load the file - TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, - "Load PORE file %s", - fileName ); - l_errl = VFS::module_load( fileName ); - - if ( l_errl ) + // Get WINK PNOR section info from PNOR RP + l_errl = PNOR::getSectionInfo( PNOR::WINK,PNOR::CURRENT_SIDE, l_info ); + if( l_errl ) { - TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, - "ERROR: opening binary PORE file: %s", - fileName ); - - // quit and return errorlog break; } - // Get the starting address of the file/module - TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, - "Get starting address/size" ); - - l_errl = VFS::module_address( fileName, - o_rporeAddr, - o_rporeSize ); - if ( l_errl ) + rc = sbe_xip_image_size(reinterpret_cast<void*>(l_info.vaddr), + &o_rporeSize); + if((rc !=0) || (o_rporeSize == 0) || o_rporeSize > l_info.size) { TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, - "ERROR: getting address of binary PORE file : %s", - fileName ); - - // quit and return errorlog + "ERROR: invalid WINK image rc[%d] slwSize[%d] part size[%d]", + rc, o_rporeSize, l_info.size); + /*@ + * @errortype + * @reasoncode ISTEP_LOAD_SLW_FROM_PNOR_FAILED + * @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE + * @moduleid ISTEP_BUILD_WINKLE_IMAGES + * @userdata1 Hi 32 bits: return code from sbe_xip_image_size + * Lo 32 bits: Size of memory requested + * @userdata2 Size of WINK PNOR partition + * @devdesc Image from PNOR WINK partion invalid, too small, + * or too big + */ + l_errl = + new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE, + ISTEP::ISTEP_BUILD_WINKLE_IMAGES, + ISTEP::ISTEP_LOAD_SLW_FROM_PNOR_FAILED, + (rc<<32)|o_rporeSize, + l_info.size ); break; } - TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, - "PORE addr = 0x%p, size=0x%x", + o_rporeAddr = reinterpret_cast<const char*>(l_info.vaddr); + + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "WINK addr = 0x%p, size=0x%x", o_rporeAddr, o_rporeSize ); @@ -318,7 +317,7 @@ void* call_host_build_winkle( void *io_pArgs ) errlHndl_t l_errl = NULL; const char *l_pPoreImage = NULL; - size_t l_poreSize = 0; + uint32_t l_poreSize = 0; void *l_pRealMemBase = reinterpret_cast<void * const>( OUTPUT_PORE_IMG_ADDR ) ; ISTEP_ERROR::IStepError l_StepError; @@ -399,6 +398,20 @@ void* call_host_build_winkle( void *io_pArgs ) MAX_POSSIBLE_PROCS_IN_P8_SYSTEM, l_pRealMemBase ); + //Load the reference image from PNOR + l_errl = loadPoreImage( l_pPoreImage, + l_poreSize ); + if ( l_errl ) + { + TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, + "host_build_winkle ERROR : errorlog PLID=0x%x", + l_errl->plid() ); + + // drop out of do block with errorlog. + break; + } + + // Loop through all functional Procs and generate images for them. TARGETING::TargetHandleList l_procChips; getAllChips( l_procChips, @@ -422,18 +435,6 @@ void* call_host_build_winkle( void *io_pArgs ) "Build SLW image for proc " "target HUID %.8X", TARGETING::get_huid(l_procChip)); - l_errl = loadPoreImage( l_procChip, - l_pPoreImage, - l_poreSize ); - if ( l_errl ) - { - TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, - "host_build_winkle ERROR : errorlog PLID=0x%x", - l_errl->plid() ); - - // drop out of do block with errorlog. - break; - } // calculate size and location of the SLW output buffer uint32_t l_procNum = @@ -467,7 +468,7 @@ void* call_host_build_winkle( void *io_pArgs ) p8_slw_build, l_fapi_cpu_target, reinterpret_cast<const void*>(l_pPoreImage), - static_cast<uint32_t>(l_poreSize), + l_poreSize, l_pImageOut, &l_sizeImageOut ); diff --git a/src/usr/hwpf/hwp/build_winkle_images/makefile b/src/usr/hwpf/hwp/build_winkle_images/makefile index 3d87b1737..890cd5e25 100644 --- a/src/usr/hwpf/hwp/build_winkle_images/makefile +++ b/src/usr/hwpf/hwp/build_winkle_images/makefile @@ -72,10 +72,5 @@ OBJS = build_winkle_images.o \ VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images/p8_set_pore_bar -## Point to the PORE image in PNOR -## taken from ref image -## /afs/awd.austin.ibm.com/projects/eclipz/lab/p8/gsiexe/compiled_pgm_sources/scratch_image/vpo/910520/s1.sbe_ref.bin -BINARY_FILES = $(IMGDIR)/procpore.dat:8fdf410786758105603467a2ae0d46eeb5116387 - include ${ROOTPATH}/config.mk diff --git a/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_delta_scan_rw.h b/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_delta_scan_rw.h index 4e5e8b51e..4b0d7fc1a 100644 --- a/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_delta_scan_rw.h +++ b/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_delta_scan_rw.h @@ -20,10 +20,10 @@ /* Origin: 30 */ /* */ /* IBM_PROLOG_END_TAG */ -// $Id: p8_delta_scan_rw.h,v 1.40 2013/03/22 04:12:02 cmolsen Exp $ +// $Id: p8_delta_scan_rw.h,v 1.42 2013/04/01 17:31:22 cmolsen Exp $ #define OVERRIDE_OFFSET 8 // Byte offset of forward pointer's addr relative // to base forward pointer's addr. -#define SIZE_IMAGE_BUF_MAX 5000000 // Max ~50MB image buffer size. +#define SIZE_IMAGE_BUF_MAX 5000000 // Max ~5MB image buffer size. #define SIZE_IMAGE_CENTAUR_MAX 5000000 // Max ~5MB image buffer size. #define SIZE_REPR_RING_MAX 50000 // Max ~50kB repr ring buffer size. #define SCOM_REG_MASK 0x00ffffff // Scom register mask (within a chiplet) @@ -36,6 +36,7 @@ #define L2_SINGLE_MEMBER_ENABLE_TOC_NAME "l2_single_member_enable_mask" #define PROC_PIB_REPR_VECTOR_TOC_NAME "proc_sbe_pibmem_repair_vector" #define NEST_SKEWADJUST_VECTOR_TOC_NAME "proc_sbe_nest_skewadjust_vector" +#define SECURITY_SETUP_VECTOR_TOC_NAME "proc_sbe_security_setup_vector" #define MAX_PLL_RING_SIZE 128 // Bytes #define PERV_BNDY_PLL_RING_TOC_NAME "perv_bndy_pll_ring" #define PERV_BNDY_PLL_RING_ALT_TOC_NAME "perv_bndy_pll_ring_alt" @@ -89,9 +90,16 @@ #define IMGBUILD_INVALID_IMAGE 10 // Invalid image. #define IMGBUILD_IMAGE_SIZE_MISMATCH 11 // Mismatch between image sizes. #define IMGBUILD_IMAGE_SIZE_MESS 12 // Messed up image or section sizes. -#define IMGBUILD_ERR_DECOMPRESSION 13 // Error assoc with decompressing RS4. +#define IMGBUILD_RINGTYPE_NOT_ALLOWED 13 // Ringtype not allowed. +#define IMGBUILD_BUFFER_TOO_SMALL 14 // Buffer too small. #define IMGBUILD_ERR_PORE_INLINE 20 // Pore inline error. #define IMGBUILD_ERR_PORE_INLINE_ASM 21 // Err assoc w/inline assembler. +#define IMGBUILD_RING_SEARCH_MATCH 0 +#define IMGBUILD_RING_SEARCH_EXHAUST_MATCH 30 +#define IMGBUILD_RING_SEARCH_NO_MATCH 31 +#define IMGBUILD_RING_SEARCH_MESS 32 +#define IMGBUILD_ERR_RING_SEARCH 33 // Err assoc w/ring retrieval. +#define IMGBUILD_ERR_DATACARE_RING_MESS 34 // Err assoc w/datacare & vpd ring sizes. #define IMGBUILD_ERR_WF_CREATE 45 // Err assoc w/create_wiggle_flip_prg. #define IMGBUILD_ERR_RING_WRITE_TO_IMAGE 46 // Err assoc w/wr_ring_block_to_img. #define IMGBUILD_ERR_SECTION_SIZING 48 // Err assoc w/section sizing. @@ -106,6 +114,7 @@ #define IMGBUILD_ERR_XIP_MISC 57 // Miscellaneous XIP image error. #define IMGBUILD_ERR_XIP_UNKNOWN 58 // Unknown XIP image error. #define IMGBUILD_ERR_RS4_DECOMPRESS 59 // Error during RS4 decompression. +#define IMGBUILD_ERR_RS4_COMPRESS 60 // Error during RS4 compression. #define IMGBUILD_ERR_RAM_HDRS_NOT_SYNCED 61 // Ram headers not synchronized. #define IMGBUILD_ERR_RAM_TABLE_FULL 63 // Ram table is full. #define IMGBUILD_ERR_RAM_CODE 64 // Code error in Ram API code. @@ -179,8 +188,6 @@ #include <p8_scan_compression.H> #endif -#include <sbe_xip_image.h> - #undef __PORE_INLINE_ASSEMBLER_C__ #include <pore_inline.h> @@ -252,7 +259,10 @@ int write_ring_block_to_image( const uint8_t i_idxVector, // [0-15] - Ignored if ringName==NULL const uint8_t i_override, // [0,1] - Ignored if ringName==NULL const uint8_t i_overridable, // [0,1] - Ignored if ringName==NULL - const uint32_t i_sizeImageMax); + const uint32_t i_sizeImageMax, + const uint8_t i_xipSectionId, + void *i_bufTmp, + const uint32_t i_sizeBufTmp); #if !(defined __CEN_XIP_CUSTOMIZE_C) @@ -273,7 +283,8 @@ int get_ring_layout_from_image2( uint32_t i_ddLevel, uint8_t i_sysPhase, DeltaRingLayout **o_rs4RingLayout, - void **nextRing); + void **nextRing, + uint8_t i_xipSectionId); int gen_ring_delta_state( uint32_t bitLen, @@ -303,7 +314,8 @@ int write_vpd_ring_to_ipl_image( uint8_t i_sysPhase, char *i_ringName, void *i_bufTmp, - uint32_t i_sizeBufTmp); + uint32_t i_sizeBufTmp, + uint8_t i_xipSection); int write_vpd_ring_to_slw_image( void *io_image, @@ -316,6 +328,15 @@ int write_vpd_ring_to_slw_image( uint32_t i_sizeBufTmp, uint8_t i_bWcSpace); +int check_and_perform_ring_datacare( + void *i_imageRef, + void *io_buf1, + uint8_t i_ddLevel, + uint8_t i_sysPhase, + char *i_ringName, + void *i_buf2, + uint32_t i_sizeBuf2); + int get_delta_ring_from_image( char *i_fnImage, char *i_varName, diff --git a/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_image_help.C b/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_image_help.C index 6a69ed4cb..e24b52f1d 100644 --- a/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_image_help.C +++ b/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_image_help.C @@ -20,7 +20,7 @@ /* Origin: 30 */ /* */ /* IBM_PROLOG_END_TAG */ -// $Id: p8_image_help.C,v 1.52 2013/03/01 22:24:11 cmolsen Exp $ +// $Id: p8_image_help.C,v 1.55 2013/04/01 21:32:16 cmolsen Exp $ // /*------------------------------------------------------------------------------*/ /* *! TITLE : p8_image_help.C */ @@ -1431,12 +1431,13 @@ int update_runtime_scom_pointer( void *io_image) // Consider merging the two codes. int write_vpd_ring_to_ipl_image(void *io_image, uint32_t &io_sizeImageOut, - CompressedScanData *i_bufRs4Ring, // HB buf1 + CompressedScanData *i_bufRs4Ring, // HB buf1. BE format. uint32_t i_ddLevel, uint8_t i_sysPhase, char *i_ringName, void *i_bufTmp, // HB buf2 - uint32_t i_sizeBufTmp) + uint32_t i_sizeBufTmp, + uint8_t i_xipSectionId) // Used by delta_scan() { uint32_t rc=0, bufLC; uint8_t chipletId, idxVector=0; @@ -1575,7 +1576,10 @@ int write_vpd_ring_to_ipl_image(void *io_image, idxVector, 0, 0, - io_sizeImageOut); + io_sizeImageOut, + i_xipSectionId, + (void*)i_bufRs4Ring, // Reuse buffer as temp work buf. + i_sizeBufTmp); if (rc) { MY_ERR("write_ring_block_to_image() failed w/rc=%i \n",rc); MY_ERR("Check p8_delta_scan_rw.h for meaning of IMGBUILD_xyz rc code. \n"); @@ -1603,7 +1607,7 @@ int write_vpd_ring_to_ipl_image(void *io_image, // Notes: int write_vpd_ring_to_slw_image(void *io_image, uint32_t &io_sizeImageOut, - CompressedScanData *i_bufRs4Ring, // HB buf1 + CompressedScanData *i_bufRs4Ring, // HB buf1. BE format. uint32_t i_ddLevel, uint8_t i_sysPhase, char *i_ringName, @@ -1761,7 +1765,10 @@ int write_vpd_ring_to_slw_image(void *io_image, idxVector, 0, 0, - io_sizeImageOut); + io_sizeImageOut, + SBE_XIP_SECTION_RINGS, + (void*)i_bufRs4Ring, // Reuse buffer as temp work buf. + i_sizeBufTmp); if (rc) { MY_ERR("write_ring_block_to_image() failed w/rc=%i; \n",rc); MY_ERR("Check p8_delta_scan_rw.h for meaning of IMGBUILD_xyz rc code; \n"); @@ -1778,6 +1785,177 @@ int write_vpd_ring_to_slw_image(void *io_image, } +// check_and_perform_ring_datacare() +// +// Checks if the Mvpd ring passed has a datacare ring in the .dcrings image section. If it does, +// the Mvpd's ring bits corresponding to the care bits in the 1st half of the dc cring will be +// overwritten by the data bits in the 2nd half of the dc ring. +int check_and_perform_ring_datacare( void *i_imageRef, + void *io_buf1, // Mvpd ring in/out. BE format. + uint8_t i_ddLevel, + uint8_t i_sysPhase, + char *i_ringName, + void *io_buf2, // Work buffer. + uint32_t i_sizeBuf2) +{ + int rc=0, rcLoc=0; + uint32_t bitLength, ringBitLen, ringBitLenDc; + uint32_t scanSelect; + uint8_t ringId, chipletId, flushOpt; + DeltaRingLayout *rs4Datacare=NULL; + void *nextRing=NULL; + SbeXipItem xipTocItem; + uint8_t bMatch=0; + uint32_t sizeRs4Container; + + + bitLength = myRev32(((CompressedScanData*)io_buf1)->iv_length); + scanSelect = myRev32(((CompressedScanData*)io_buf1)->iv_scanSelect); + ringId = ((CompressedScanData*)io_buf1)->iv_ringId; + chipletId = ((CompressedScanData*)io_buf1)->iv_chipletId; + flushOpt = ((CompressedScanData*)io_buf1)->iv_flushOptimization; + + MY_INF("In check_and_perform_ring_datacare()...\n"); + + MY_DBG("Mvpd ring characteristics:\n"); + MY_DBG("Ring name: %s\n",i_ringName); + MY_DBG("Ring ID: 0x%02x\n",ringId); + MY_DBG("Chiplet ID: 0x%02x\n",chipletId); + MY_DBG("Flush Opt: %i\n",flushOpt); + MY_DBG("Scan select: 0x%08x\n",scanSelect); + + rc = sbe_xip_find( i_imageRef, i_ringName, &xipTocItem); + if (rc) { + MY_ERR("_find() failed w/rc=%i\n",rc); + return IMGBUILD_ERR_KEYWORD_NOT_FOUND; + } + MY_DBG("xipTocItem.iv_address=0x%016llx\n",xipTocItem.iv_address); + + // Now look for datacare match in .dcrings section. + nextRing = NULL; + rs4Datacare = NULL; + bMatch = 0; + do { + // Retrieve ptr to next ring in .dcrings + rcLoc = get_ring_layout_from_image2(i_imageRef, + i_ddLevel, + i_sysPhase, + &rs4Datacare, // Will pt to gptr overlay ring. + &nextRing, + SBE_XIP_SECTION_DCRINGS); + if (rcLoc==IMGBUILD_RING_SEARCH_MATCH || + rcLoc==IMGBUILD_RING_SEARCH_EXHAUST_MATCH || + rcLoc==IMGBUILD_RING_SEARCH_NO_MATCH) { + MY_DBG("get_ring_layout_from_image2() returned rc=%i \n",rc); + rc = 0; + } + else { + MY_ERR("get_ring_layout_from_image2() failed w/rc=%i\n",rcLoc); + return IMGBUILD_ERR_RING_SEARCH; + } + // Does the rings backPtr match the Vpd ring's vector addr? + if (rs4Datacare) { + MY_DBG("rs4Datacare->backItemPtr=0x%016llx\n",myRev64(rs4Datacare->backItemPtr)); + if (myRev64(rs4Datacare->backItemPtr)==xipTocItem.iv_address) { + MY_DBG("Found a match in .dcrings. \n"); + bMatch = 1; + // TBD + } + } + else + MY_DBG("rs4Datacare=NULL (no ring matched search criteria, or empty ring section.)\n"); + } while (nextRing!=NULL && !bMatch); + + if (bMatch) { + + // Decompress Mvpd ring. + MY_DBG("Decompressing Mvpd ring.\n"); + rc = _rs4_decompress( (uint8_t*)io_buf2, + i_sizeBuf2, + &ringBitLen, + (CompressedScanData*)io_buf1); + if (rc) { + MY_ERR("_rs4_decompress(mvpdring...) failed: rc=%i\n",rc); + return IMGBUILD_ERR_RS4_DECOMPRESS; + } + + // Decompress datacare overlay ring. + MY_DBG("Decompressing datacare ring.\n"); + rc = _rs4_decompress( (uint8_t*)io_buf1, + i_sizeBuf2, // Assumption is that sizeBuf2=sizeBuf1 + &ringBitLenDc, + (CompressedScanData*)( (uintptr_t)rs4Datacare + + myRev64(rs4Datacare->entryOffset) + + ASM_RS4_LAUNCH_BUF_SIZE) ); + if (rc) { + MY_ERR("_rs4_decompress(datacare...) failed: rc=%i\n",rc); + return IMGBUILD_ERR_RS4_DECOMPRESS; + } + + MY_DBG("bitLength=%i\n",bitLength); + MY_DBG("ringBitLen=%i\n",ringBitLen); + MY_DBG("ringBitLenDc=%i\n",ringBitLenDc); + if ( bitLength!=ringBitLen || (2*ringBitLen)!=ringBitLenDc ) { + MY_ERR("Mvpd ring length (=%i) is not exactly half of datacare ring length (=%i)\n", + ringBitLen, ringBitLenDc); + return IMGBUILD_ERR_DATACARE_RING_MESS; + } + + // Overlay io_buf2 bits according to care and data bits in io_buf1 + uint32_t iWord, remBits32; + uint32_t dataVpd, dataDc, careDc, careDc1, careDc2; + + // Split apart the raw datacare ring into data (1st part) and care (2nd part). + // Note that the order is already in BE for both Datacare and Mvpd rings. + // Further note that the care part is fractured into two words that need to + // be combined into a single word. (That's the black magic part below). + remBits32 = ringBitLen - (ringBitLen/32)*32; + for (iWord=0; iWord<(ringBitLen+31)/32; iWord++) { + dataDc = *((uint32_t*)io_buf1 + iWord); // Data part + // Split off the care part, do BE->LE, shift the two parts propoerly, and finally do + // LE->BE again. It's f*kin' black magic... + careDc1 = myRev32(*((uint32_t*)io_buf1 + ringBitLen/32 + iWord)); // Care part a + careDc2 = myRev32(*((uint32_t*)io_buf1 + ringBitLen/32 + 1 + iWord)); // Care part b + careDc = myRev32(careDc1<<remBits32 | careDc2>>(32-remBits32)); + dataVpd = *((uint32_t*)io_buf2 + iWord); + MY_DBG("data: %08x iWord=%i\n",dataDc,iWord); + MY_DBG("care: %08x\n",careDc); + MY_DBG("orig: %08x\n",dataVpd); + dataVpd = ( dataVpd & ~careDc ) | dataDc; + MY_DBG("new: %08x\n",dataVpd); + *((uint32_t*)io_buf2 + iWord) = dataVpd; + // Check for data+care construction. I.e., a 1-bit in data is illegal if corresponding + // care bit is a 0-bit. + if ((dataDc & ~careDc)!=0) { + MY_ERR("DataCare ring construction error:\n"); + MY_ERR("A data bit (in word i=%i) is set but the care bit is not set.\n",iWord); + return IMGBUILD_ERR_DATACARE_RING_MESS; + } + } + + // Compress overlayed Mvpd ring. + rc = _rs4_compress( (CompressedScanData*)io_buf1, + i_sizeBuf2, + &sizeRs4Container, + (uint8_t*)io_buf2, + bitLength, + (uint64_t)scanSelect<<32, + ringId, + chipletId, + flushOpt); + if (rc) { + MY_ERR("\t_rs4_compress() failed: rc=%i ",rc); + return IMGBUILD_ERR_RS4_DECOMPRESS; + } + + } + + MY_INF("Leaving check_and_perform_ring_datacare()...\n"); + + return rc; +} + + // CMO-20130208: Not used in: // - p8_image_help.C // - p8_image_help_base.C diff --git a/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_image_help_base.C b/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_image_help_base.C index a4f1f6009..bdcda3fea 100644 --- a/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_image_help_base.C +++ b/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_image_help_base.C @@ -20,7 +20,7 @@ /* Origin: 30 */ /* */ /* IBM_PROLOG_END_TAG */ -// $Id: p8_image_help_base.C,v 1.9 2013/03/01 22:23:03 cmolsen Exp $ +// $Id: p8_image_help_base.C,v 1.11 2013/03/28 16:03:16 cmolsen Exp $ /*------------------------------------------------------------------------------*/ /* *! TITLE : p8_image_help_base.c */ /* *! DESCRIPTION : Basic helper functions for building and extracting */ @@ -58,14 +58,15 @@ int get_ring_layout_from_image2( const void *i_imageIn, uint32_t i_ddLevel, uint8_t i_sysPhase, DeltaRingLayout **o_rs4RingLayout, - void **nextRing) + void **nextRing, + uint8_t i_xipSectionId) { - uint32_t rc=0, rcLoc=0; - uint8_t bRingFound=0, bRingEOS=0; - DeltaRingLayout *thisRingLayout, *nextRingLayout; //Pointers into memory mapped image. DO NOT CHANGE MEMBERS! - uint32_t sizeRings; - SbeXipSection hostSection; - void *ringsHostAddress0; + uint32_t rc=0, rcLoc=0; + uint8_t bRingFound=0, bRingEOS=0; + DeltaRingLayout *thisRingLayout=NULL, *nextRingLayout=NULL; //Pointers into memory mapped image. DO NOT CHANGE MEMBERS! + uint32_t sizeRings; + SbeXipSection xipSection; + void *hostSection; SBE_XIP_ERROR_STRINGS(g_errorStrings); @@ -73,31 +74,33 @@ int get_ring_layout_from_image2( const void *i_imageIn, // - .rings host address offset and // - .rings size // - rc = sbe_xip_get_section( i_imageIn, SBE_XIP_SECTION_RINGS, &hostSection); + rc = sbe_xip_get_section( i_imageIn, i_xipSectionId, &xipSection); if (rc) { - MY_INF("ERROR : sbe_xip_get_section() failed: %s", SBE_XIP_ERROR_STRING(g_errorStrings, rc)); - MY_INF("Probable cause:"); - MY_INF("\tThe section (=SBE_XIP_SECTION_RINGS=%i) was not found.",SBE_XIP_SECTION_RINGS); - return IMGBUILD_ERR_KEYWORD_NOT_FOUND; + MY_INF("ERROR : sbe_xip_get_section() failed: %s", SBE_XIP_ERROR_STRING(g_errorStrings, rc)); + MY_INF("Probable cause:"); + MY_INF("\tThe section (=SBE_XIP_SECTION_<xyz>=%i) was not found.",i_xipSectionId); + return IMGBUILD_ERR_KEYWORD_NOT_FOUND; } - if (hostSection.iv_offset==0) { - MY_INF("INFO : No ring data exists for the section ID = SBE_XIP_SECTION_RINGS (ID=%i).",SBE_XIP_SECTION_RINGS); - return DSLWB_RING_SEARCH_NO_MATCH; // Implies exhaust search as well. + if (xipSection.iv_offset==0) { + MY_INF("INFO : No ring data exists for the section ID = SBE_XIP_SECTION_<xyz> =%i\n",i_xipSectionId); + return IMGBUILD_RING_SEARCH_NO_MATCH; // Implies exhaust search as well. } - ringsHostAddress0 = (void*)((uintptr_t)i_imageIn + hostSection.iv_offset); - sizeRings = hostSection.iv_size; + hostSection = (void*)((uintptr_t)i_imageIn + xipSection.iv_offset); + sizeRings = xipSection.iv_size; // On first call, get the base offset to the .rings section. // On subsequent calls, we're into the search for ddLevel and sysPhase, so use nextRing instead. // if (*nextRing==NULL) - nextRingLayout = (DeltaRingLayout*)ringsHostAddress0; + nextRingLayout = (DeltaRingLayout*)hostSection; else nextRingLayout = (DeltaRingLayout*)*nextRing; - MY_DBG("ringsHostAddress0 = 0x%016llx",(uint64_t)ringsHostAddress0); + MY_DBG("hostSection = 0x%016llx",(uint64_t)hostSection); MY_DBG("sizeRings = %i", sizeRings); MY_DBG("nextRingLayout = 0x%016llx",(uint64_t)nextRingLayout); + MY_DBG("i_ddLevel = 0x%02x",i_ddLevel); + MY_DBG("i_sysPhase = %i",i_sysPhase); // Populate the output RS4 ring BE layout structure as well as local structure in host LE format where needed. // Note! Entire memory content is in BE format. So we do LE conversions where needed. @@ -123,32 +126,32 @@ int get_ring_layout_from_image2( const void *i_imageIn, (thisRingLayout->sysPhase==1 && i_sysPhase==1) || (thisRingLayout->sysPhase==2 && (i_sysPhase==0 || i_sysPhase==1))) { bRingFound = 1; - MY_DBG("\tRing match found!"); + MY_DBG("Ring match found! \n"); } } nextRingLayout = (DeltaRingLayout*)((uintptr_t)thisRingLayout + myRev32(thisRingLayout->sizeOfThis)); *nextRing = (void*)nextRingLayout; - if (nextRingLayout>=(DeltaRingLayout*)((uintptr_t)ringsHostAddress0+sizeRings)) { + if (nextRingLayout>=(DeltaRingLayout*)((uintptr_t)hostSection+sizeRings)) { bRingEOS = 1; *nextRing = NULL; - MY_DBG("\tRing search exhausted!"); + MY_DBG("Ring search exhausted! \n"); } } // End of SEARCH. if (bRingFound) { if (bRingEOS) - rcLoc = DSLWB_RING_SEARCH_EXHAUST_MATCH; + rcLoc = IMGBUILD_RING_SEARCH_EXHAUST_MATCH; else - rcLoc = DSLWB_RING_SEARCH_MATCH; + rcLoc = IMGBUILD_RING_SEARCH_MATCH; } else { *nextRing = NULL; if (bRingEOS) - return DSLWB_RING_SEARCH_NO_MATCH; // Implies exhaust search as well. + return IMGBUILD_RING_SEARCH_NO_MATCH; // Implies exhaust search as well. else { MY_INF("Messed up ring search. Check code and .rings content. Returning nothing."); - return DSLWB_RING_SEARCH_MESS; + return IMGBUILD_RING_SEARCH_MESS; } } @@ -173,9 +176,9 @@ int get_ring_layout_from_image2( const void *i_imageIn, return IMGBUILD_ERR_MISALIGNED_RING_LAYOUT; } - if (*nextRing > (void*)((uintptr_t)ringsHostAddress0 + sizeRings)) { + if (*nextRing > (void*)((uintptr_t)hostSection + sizeRings)) { MY_INF("Book keeping got messed up during .rings search. .rings section does not appear aligned."); - MY_INF("ringsHostAddress0+sizeRings = 0x%016llx",(uint64_t)ringsHostAddress0+sizeRings); + MY_INF("hostSection+sizeRings = 0x%016llx",(uint64_t)hostSection+sizeRings); MY_INF("nextRing = 0x%016llx",*(uint64_t*)nextRing); MY_INF("Continuing..."); } @@ -207,7 +210,10 @@ int write_ring_block_to_image( void *io_image, const uint8_t i_idxVector, const uint8_t i_override, const uint8_t i_overridable, - const uint32_t i_sizeImageMax) + const uint32_t i_sizeImageMax, + const uint8_t i_xipSectionId, + void *i_bufTmp, + const uint32_t i_sizeBufTmp) { uint32_t rc=0; SbeXipItem tocItem; @@ -232,26 +238,73 @@ int write_ring_block_to_image( void *io_image, MY_ERR("Probable cause: Ring name (=%s) not found in image.", i_ringName); return IMGBUILD_ERR_KEYWORD_NOT_FOUND; } - i_ringBlock->backItemPtr = myRev64( tocItem.iv_address + + i_ringBlock->backItemPtr = myRev64( tocItem.iv_address + i_idxVector*8*(1+i_overridable) + 8*i_override*i_overridable ); } - // Append ring block to .rings section. // + // Insert ring block to .rings or .dcrings section. + // ------ + + // Temporarily copy .dcrings section if inserting into .rings section. + SbeXipSection xipSectionDcrings; + void *hostSectionDcrings=NULL; + + if (i_xipSectionId==SBE_XIP_SECTION_RINGS) { + rc = sbe_xip_get_section(io_image, SBE_XIP_SECTION_DCRINGS, &xipSectionDcrings); + if (rc) { + MY_ERR("_get_section(.dcrings...) failed with rc=%i ",rc); + return IMGBUILD_ERR_GET_SECTION; + } + if (!(xipSectionDcrings.iv_size==0 && xipSectionDcrings.iv_offset==0)) { + hostSectionDcrings = (void*)((uint64_t)io_image + (uint64_t)xipSectionDcrings.iv_offset); + if (xipSectionDcrings.iv_size<=i_sizeBufTmp) { + memcpy(i_bufTmp, hostSectionDcrings, (size_t)xipSectionDcrings.iv_size); + } + else { + MY_ERR("Size of .dcrings section (=%i) exceeds buffer size (=%i). ", + xipSectionDcrings.iv_size, i_sizeBufTmp); + return IMGBUILD_BUFFER_TOO_SMALL; + } + rc = sbe_xip_delete_section(io_image, SBE_XIP_SECTION_DCRINGS); + if (rc) { + MY_ERR("_delete_section(.dcrings...) failed w/rc=%i ",rc); + return IMGBUILD_ERR_SECTION_DELETE; + } + } + } + rc = sbe_xip_append(io_image, - SBE_XIP_SECTION_RINGS, + i_xipSectionId, (void*)i_ringBlock, myRev32(i_ringBlock->sizeOfThis), i_sizeImageMax, &offsetRingBlock); if (rc) { - MY_ERR("sbe_xip_append() failed: %s", SBE_XIP_ERROR_STRING(g_errorStrings, rc)); + MY_ERR("sbe_xip_append() failed: %s ", SBE_XIP_ERROR_STRING(g_errorStrings, rc)); sbe_xip_image_size(io_image,&sizeImage); - MY_ERR("Input image size: %i\n", sizeImage); - MY_ERR("Max image size allowed: %i\n", i_sizeImageMax); + MY_ERR("Input image size: %i ", sizeImage); + MY_ERR("Max image size allowed: %i ", i_sizeImageMax); return IMGBUILD_ERR_APPEND; } + + // Re-append .dcrings section if inserting into .rings section. + if (i_xipSectionId==SBE_XIP_SECTION_RINGS) { + if (!(xipSectionDcrings.iv_size==0 && xipSectionDcrings.iv_offset==0)) { + rc = sbe_xip_append(io_image, + SBE_XIP_SECTION_DCRINGS, + i_bufTmp, + xipSectionDcrings.iv_size, + i_sizeImageMax, + NULL); + if (rc) { + MY_ERR("_append(.dcrings...) failed: w/rc=%i ", rc); + return IMGBUILD_ERR_APPEND; + } + } + } + // ...get new image size and test if successful update. rc = sbe_xip_image_size( io_image, &sizeImage); MY_DBG("Updated image size (after append): %i",sizeImage); @@ -266,16 +319,23 @@ int write_ring_block_to_image( void *io_image, } // Update forward pointer associated with the ring/var name + any override offset. + // (Note, we ONLY do this for .rings as we can't have forward ptrs to [non-scannable] + // rings in the .dcrings section.) // - // Convert the ring offset (wrt .rings address) to an PORE address - rc = sbe_xip_section2pore(io_image, SBE_XIP_SECTION_RINGS, offsetRingBlock, &ringPoreAddress); - MY_DBG("fwdPtr=0x%016llx", ringPoreAddress); - if (rc) { - MY_ERR("sbe_xip_section2pore() failed: %s", SBE_XIP_ERROR_STRING(g_errorStrings, rc)); - return IMGBUILD_ERR_XIP_MISC; - } + // Convert the ring offset to an PORE address + if (i_xipSectionId==SBE_XIP_SECTION_RINGS) { + rc = sbe_xip_section2pore(io_image, i_xipSectionId, offsetRingBlock, &ringPoreAddress); + MY_DBG("fwdPtr=0x%016llx", ringPoreAddress); + if (rc) { + MY_ERR("sbe_xip_section2pore() failed: %s", SBE_XIP_ERROR_STRING(g_errorStrings, rc)); + return IMGBUILD_ERR_XIP_MISC; + } + } + else + // We can not have forward ptr to [non-scannanble] rings in the .dcrings section. + ringPoreAddress = 0; - // Now, update the forward pointer. + // Now, update the forward pointer, making sure that it's zero for .dcrings section. // // First, retrieve the ring block's backPtr which tells us where the fwd ptr // is located. @@ -285,7 +345,7 @@ int write_ring_block_to_image( void *io_image, // backItemPtr in the input ring block already has this from the ref image, // and it shouldn't have changed after having been ported over to an // IPL/Seeprom image. - backPtr = myRev64(i_ringBlock->backItemPtr); + backPtr = myRev64(i_ringBlock->backItemPtr); MY_DBG("backPtr = 0x%016llx", backPtr); // Second, put the ring's Pore addr into the location pointed to by the back ptr. rc = sbe_xip_write_uint64( io_image, diff --git a/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_image_help_base.H b/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_image_help_base.H index 8163897af..e437b03e1 100644 --- a/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_image_help_base.H +++ b/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_image_help_base.H @@ -20,13 +20,15 @@ /* Origin: 30 */ /* */ /* IBM_PROLOG_END_TAG */ -// $Id: p8_image_help_base.H,v 1.15 2013/03/01 21:55:24 cmolsen Exp $ +// $Id: p8_image_help_base.H,v 1.16 2013/03/27 18:31:57 cmolsen Exp $ //------------------------------------------------------------------------------ // Title: p8_image_help_base.H // Description: Contains the most basic structures and defines needed for // image building and interpretation. //------------------------------------------------------------------------------ +#include <sbe_xip_image.h> + // // Various image/ring buffer sizes. Must be used by all users (VBU, FSP, HB, HBI, Cronus) // @@ -50,6 +52,11 @@ const uint32_t WF_WORST_CASE_SIZE_FAC = 4; // WC WF size = 3x ring length. const uint32_t LISTING_STRING_SIZE = 256; const uint64_t MAX_UINT64_T = (uint64_t)0xFFFFFFFF<<32 | (uint64_t)0xFFFFFFFF; +const uint8_t RING_SECTION_ID[] = { + SBE_XIP_SECTION_RINGS, + SBE_XIP_SECTION_DCRINGS, +}; +const uint8_t RING_SECTION_ID_SIZE = sizeof(RING_SECTION_ID) / sizeof(RING_SECTION_ID[0]); #ifdef __cplusplus extern "C" { diff --git a/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_slw_build.C b/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_slw_build.C index 96beebdee..addbf3174 100644 --- a/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_slw_build.C +++ b/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_slw_build.C @@ -20,7 +20,7 @@ /* Origin: 30 */ /* */ /* IBM_PROLOG_END_TAG */ -// $Id: p8_slw_build.C,v 1.21 2013/03/14 03:07:11 cmolsen Exp $ +// $Id: p8_slw_build.C,v 1.22 2013/03/27 20:05:52 cmolsen Exp $ /*------------------------------------------------------------------------------*/ /* *! TITLE : p8_slw_build */ /* *! DESCRIPTION : Extracts and decompresses delta ring states from EPROM */ @@ -194,8 +194,25 @@ ReturnCode p8_slw_build( const fapi::Target &i_target, return rc; } - // Third, delete .rings and .pibmem0 sections (but keep .halt) + // Third, delete .dcrings, .rings and .pibmem0 sections (but keep .halt) // + rcLoc = sbe_xip_delete_section( i_imageOut, SBE_XIP_SECTION_DCRINGS); + if (rcLoc) { + FAPI_ERR("xip_delete_section(.dcrings) failed w/rcLoc=%i",rcLoc); + uint32_t & RC_LOCAL=rcLoc; + FAPI_SET_HWP_ERROR(rc, RC_PROC_SLWB_DELETE_IMAGE_SECTION_ERROR); + return rc; + } + sbe_xip_image_size(i_imageOut, &sizeImage); + rcLoc = sbe_xip_validate(i_imageOut, sizeImage); + if (rcLoc) { + FAPI_ERR("xip_validate() failed w/rcLoc=%i",rcLoc); + uint32_t & RC_LOCAL=rcLoc; + FAPI_SET_HWP_ERROR(rc, RC_PROC_SLWB_MS_INTERNAL_IMAGE_ERR); + return rc; + } + FAPI_DBG("Image size (after .dcrings delete): %i",sizeImage); + rcLoc = sbe_xip_delete_section( i_imageOut, SBE_XIP_SECTION_RINGS); if (rcLoc) { FAPI_ERR("xip_delete_section(.rings) failed w/rcLoc=%i",rcLoc); @@ -356,8 +373,8 @@ ReturnCode p8_slw_build( const fapi::Target &i_target, FAPI_INF("Calling xip_customize().\n"); FAPI_EXEC_HWP(rc, p8_xip_customize, i_target, - i_imageOut, // This is both in and out image for xip_customize. - NULL, // No need to pass a separate out image + (void*)i_imageIn, + i_imageOut, sizeImageTmp, sysPhase, 2, // We're only interested in SRAM mode for non-fixed img. @@ -641,8 +658,8 @@ ReturnCode p8_slw_build( const fapi::Target &i_target, FAPI_INF("Calling xip_customize().\n"); FAPI_EXEC_HWP(rc, p8_xip_customize, i_target, - i_imageOut, // This is both in and out image for xip_customize. - NULL, // No need to pass a separate out image + (void*)i_imageIn, + i_imageOut, sizeImageTmp, sysPhase, 2, // We're only interested in SRAM mode for non-fixed img. diff --git a/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_xip_customize.C b/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_xip_customize.C index b23b06fe4..144aff7e0 100644 --- a/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_xip_customize.C +++ b/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_xip_customize.C @@ -20,7 +20,7 @@ /* Origin: 30 */ /* */ /* IBM_PROLOG_END_TAG */ -// $Id: p8_xip_customize.C,v 1.37 2013/03/18 16:08:32 cmolsen Exp $ +// $Id: p8_xip_customize.C,v 1.41 2013/04/01 17:30:50 cmolsen Exp $ /*------------------------------------------------------------------------------*/ /* *! TITLE : p8_xip_customize */ /* *! DESCRIPTION : Obtains repair rings from VPD and adds them to either */ @@ -37,6 +37,7 @@ // using "IMGBUILD_PPD_IGNORE_VPD" will ignore adding MVPD rings. // using "IMGBUILD_PPD_IGNORE_VPD_FIELD" will ignore using fapiGetMvpdField. // using "IMGBUILD_PPD_IGNORE_PLL_UPDATE" will ignore PLL attribute ring. +// using "IMGBUILD_PPD_IGNORE_L3_BAR" will ignore updating L3 Bar Scoms. // /* *! ASSUMPTIONS : */ // @@ -59,8 +60,8 @@ using namespace fapi; // Parameter list: // const fapi::Target &i_target: Processor chip target. -// void *i_imageIn: Ptr to input IPL or input/output SLW image. -// void *i_imageOut: Ptr to output IPL img. (Ignored for SLW/RAM imgs.) +// void *i_imageIn: Ptr to input img. The IPL img for IPL and the ref img for SLW. +// void *o_imageOut: Ptr to output img. // uint32_t io_sizeImageOut: In: Max size of IPL/SRAM workspace/img. Out: Final size. // MUST equal FIXED_SEEPROM_WORK_SPACE for IPL Seeprom build. // uint8_t i_sysPhase: 0: IPL 1: SLW @@ -76,7 +77,7 @@ using namespace fapi; // ReturnCode p8_xip_customize( const fapi::Target &i_target, void *i_imageIn, - void *i_imageOut, + void *o_imageOut, uint32_t &io_sizeImageOut, const uint8_t i_sysPhase, const uint8_t i_modeBuild, @@ -87,13 +88,11 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, { fapi::ReturnCode rcFapi, rc=FAPI_RC_SUCCESS; uint32_t rcLoc=0; - void *imageOut; uint32_t sizeImage, sizeImageIn, sizeImageOutMax, sizeImageMax; uint32_t iVec=0; + uint8_t attrDdLevel=0; uint64_t attrCombGoodVec[MAX_CHIPLETS]={ (uint64_t(0xfedcba98)<<32)+0x76543210 }; void *hostCombGoodVec; - uint32_t attrL2SingleMember=0; - void *hostL2SingleMember; SbeXipItem xipTocItem; uint32_t attrL2RT0Eps, attrL2RT1Eps, attrL2RT2Eps, attrL2WEps; uint8_t attrL2ForceRT2Eps; @@ -110,6 +109,13 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, sizeImageOutMax = io_sizeImageOut; + // First, get the system DD level. We'll need it several places. + rc = FAPI_ATTR_GET_PRIVILEGED(ATTR_EC, &i_target, attrDdLevel); + if (rc) { + FAPI_ERR("FAPI_ATTR_GET_PRIVILEGED() failed w/rc=%i and ddLevel=0x%02x",(uint32_t)rc,attrDdLevel); + return rc; + } + // ========================================================================== // Check and copy (if IPL phase) image to mainstore and clean it up. // ========================================================================== @@ -126,14 +132,14 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, } FAPI_INF("Input image:\n location=0x%016llx\n size=%i\n", (uint64_t)i_imageIn, sizeImageIn); - + // Second, if IPL phase, check image and buffer sizes and copy input image to // output mainstore [work] location. + // Note, we don't do this for SLW since it was already done in slw_build(). // if (i_sysPhase==0) { - imageOut = i_imageOut; FAPI_INF("Output image:\n location=0x%016llx\n size (max)=%i\n", - (uint64_t)imageOut, sizeImageOutMax); + (uint64_t)o_imageOut, sizeImageOutMax); // // First, we'll check image size. // @@ -154,9 +160,9 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, FAPI_SET_HWP_ERROR(rc, RC_PROC_XIPC_IMAGE_SIZE_MESS); return rc; } - memcpy( imageOut, i_imageIn, sizeImageIn); - sbe_xip_image_size(imageOut, &sizeImage); - rcLoc = sbe_xip_validate(imageOut, sizeImage); + memcpy( o_imageOut, i_imageIn, sizeImageIn); + sbe_xip_image_size(o_imageOut, &sizeImage); + rcLoc = sbe_xip_validate(o_imageOut, sizeImage); if (rcLoc) { FAPI_ERR("xip_validate() failed w/rcLoc=%i",rcLoc); uint32_t & RC_LOCAL=rcLoc; @@ -198,10 +204,6 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, return rc; } } - else { - // Output image is same as input image in SLW case (even for an SRAM build). - imageOut = i_imageIn; - } // ========================================================================== @@ -228,7 +230,7 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, FAPI_ERR("FAPI_ATTR_GET(ATTR_CHIP_REGIONS_TO_ENABLE) returned error.\n"); return rc; } - rcLoc = sbe_xip_find( imageOut, COMBINED_GOOD_VECTORS_TOC_NAME, &xipTocItem); + rcLoc = sbe_xip_find( o_imageOut, COMBINED_GOOD_VECTORS_TOC_NAME, &xipTocItem); if (rcLoc) { FAPI_ERR("sbe_xip_find() failed w/rc=%i and %s", rcLoc, SBE_XIP_ERROR_STRING(errorStrings, rcLoc)); FAPI_ERR("Probable cause:"); @@ -237,7 +239,7 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, FAPI_SET_HWP_ERROR(rc, RC_PROC_XIPC_KEYWORD_NOT_FOUND_ERROR); return rc; } - sbe_xip_pore2host( imageOut, xipTocItem.iv_address, &hostCombGoodVec); + sbe_xip_pore2host( o_imageOut, xipTocItem.iv_address, &hostCombGoodVec); FAPI_DBG("Dumping [initial] global variable content of combined_good_vectors, then the updated value:\n"); for (iVec=0; iVec<MAX_CHIPLETS; iVec++) { FAPI_DBG("combined_good_vectors[%2i]: Before=0x%016llX\n",iVec,*((uint64_t*)hostCombGoodVec+iVec)); @@ -253,12 +255,14 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, // Note: Governs if which cores' L2 may be flipped into single member mode. // ========================================================================== + uint32_t attrL2SingleMember=0; + void *hostL2SingleMember; rc = FAPI_ATTR_GET(ATTR_EX_L2_SINGLE_MEMBER_ENABLE, &i_target, attrL2SingleMember); if (rc) { FAPI_ERR("FAPI_ATTR_GET(ATTR_EX_L2_SINGLE_MEMBER_ENABLE) returned error.\n"); return rc; } - rcLoc = sbe_xip_find( imageOut, L2_SINGLE_MEMBER_ENABLE_TOC_NAME, &xipTocItem); + rcLoc = sbe_xip_find( o_imageOut, L2_SINGLE_MEMBER_ENABLE_TOC_NAME, &xipTocItem); if (rcLoc) { FAPI_ERR("sbe_xip_find() failed w/rc=%i and %s", rcLoc, SBE_XIP_ERROR_STRING(errorStrings, rcLoc)); FAPI_ERR("Probable cause:"); @@ -267,18 +271,50 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, FAPI_SET_HWP_ERROR(rc, RC_PROC_XIPC_KEYWORD_NOT_FOUND_ERROR); return rc; } - sbe_xip_pore2host( imageOut, xipTocItem.iv_address, &hostL2SingleMember); - FAPI_DBG("Dumping [initial] global variable content of l2_single_member_enable_mask, and then the updated value:\n"); - FAPI_DBG("l2_single_member_enable_mask: Before=0x%016llX\n",*(uint64_t*)hostL2SingleMember); + sbe_xip_pore2host( o_imageOut, xipTocItem.iv_address, &hostL2SingleMember); + FAPI_DBG("Dumping [initial] global variable content of %s, and then the updated value:\n", + L2_SINGLE_MEMBER_ENABLE_TOC_NAME); + FAPI_DBG(" Before=0x%016llX\n",*(uint64_t*)hostL2SingleMember); *(uint64_t*)hostL2SingleMember = myRev64((uint64_t)attrL2SingleMember<<32); - FAPI_DBG(" After =0x%016llX\n",*(uint64_t*)hostL2SingleMember); - + FAPI_DBG(" After =0x%016llX\n",*(uint64_t*)hostL2SingleMember); + + + // ========================================================================== + // CUSTOMIZE item: Security setup. + // Retrieval method: Attribute. + // System phase: IPL sysPhase. + // Note: TBD + // ========================================================================== + if (i_sysPhase==0) { + uint64_t attrSecuritySetupVec=0; + void *hostSecuritySetupVec; + rc = FAPI_ATTR_GET(ATTR_PROC_SECURITY_SETUP_VECTOR, &i_target, attrSecuritySetupVec); + if (rc) { + FAPI_ERR("FAPI_ATTR_GET(ATTR_PROC_SECURITY_SETUP_VECTOR) returned error.\n"); + return rc; + } + rcLoc = sbe_xip_find( o_imageOut, SECURITY_SETUP_VECTOR_TOC_NAME, &xipTocItem); + if (rcLoc) { + FAPI_ERR("sbe_xip_find() failed w/rc=%i and %s", rcLoc, SBE_XIP_ERROR_STRING(errorStrings, rcLoc)); + FAPI_ERR("Probable cause:"); + FAPI_ERR("\tThe keyword (=%s) was not found.",SECURITY_SETUP_VECTOR_TOC_NAME); + uint32_t & RC_LOCAL = rcLoc; + FAPI_SET_HWP_ERROR(rc, RC_PROC_XIPC_KEYWORD_NOT_FOUND_ERROR); + return rc; + } + sbe_xip_pore2host( o_imageOut, xipTocItem.iv_address, &hostSecuritySetupVec); + FAPI_DBG("Dumping [initial] global variable content of %s, and then the updated value:\n", + SECURITY_SETUP_VECTOR_TOC_NAME); + FAPI_DBG(" Before=0x%016llX\n",*(uint64_t*)hostSecuritySetupVec); + *(uint64_t*)hostSecuritySetupVec = myRev64(attrSecuritySetupVec); + FAPI_DBG(" After =0x%016llX\n",*(uint64_t*)hostSecuritySetupVec); + } #ifndef IMGBUILD_PPD_IGNORE_VPD_FIELD void *hostPibmemRepairVec, *hostNestSkewAdjVec; uint8_t *bufVpdField; uint32_t sizeVpdField=0; - uint8_t *byteField, *byteVector; + uint8_t *byteField, *byteVector; // ========================================================================== // CUSTOMIZE item: Update 20 swizzled bits for PIB repair vector. // Retrieval method: MVPD field. @@ -298,7 +334,7 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, FAPI_ERR("fapiGetMvpdField() w/keyword=PB returned error."); return rcFapi; } - rcLoc = sbe_xip_find( imageOut, PROC_PIB_REPR_VECTOR_TOC_NAME, &xipTocItem); + rcLoc = sbe_xip_find( o_imageOut, PROC_PIB_REPR_VECTOR_TOC_NAME, &xipTocItem); if (rcLoc) { FAPI_ERR("sbe_xip_find() failed w/rc=%i and %s", rcLoc, SBE_XIP_ERROR_STRING(errorStrings, rcLoc)); FAPI_ERR("Probable cause:"); @@ -314,7 +350,7 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, return rc; } FAPI_DBG("Dumping global variable content of pibmem_repair_vector:\n"); - sbe_xip_pore2host( imageOut, xipTocItem.iv_address, &hostPibmemRepairVec); + sbe_xip_pore2host( o_imageOut, xipTocItem.iv_address, &hostPibmemRepairVec); FAPI_INF("pibmem_repair_vector:Before (in BE)=0x%016llX\n",*(uint64_t*)hostPibmemRepairVec); byteField = (uint8_t*)bufVpdField; byteVector = (uint8_t*)hostPibmemRepairVec; @@ -346,7 +382,7 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, FAPI_ERR("fapiGetMvpdField() w/keyword=MK returned error."); return rcFapi; } - rcLoc = sbe_xip_find( imageOut, NEST_SKEWADJUST_VECTOR_TOC_NAME, &xipTocItem); + rcLoc = sbe_xip_find( o_imageOut, NEST_SKEWADJUST_VECTOR_TOC_NAME, &xipTocItem); if (rcLoc) { FAPI_ERR("sbe_xip_find() failed w/rc=%i and %s", rcLoc, SBE_XIP_ERROR_STRING(errorStrings, rcLoc)); FAPI_ERR("Probable cause:"); @@ -362,7 +398,7 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, return rc; } FAPI_DBG("Dumping global variable content of nest_skewadjust_vector:\n"); - sbe_xip_pore2host( imageOut, xipTocItem.iv_address, &hostNestSkewAdjVec); + sbe_xip_pore2host( o_imageOut, xipTocItem.iv_address, &hostNestSkewAdjVec); FAPI_INF("nest_skewadjust_vector: Before (in BE)=0x%016llX\n",*((uint64_t*)hostNestSkewAdjVec)); byteField = (uint8_t*)bufVpdField; byteVector = (uint8_t*)hostNestSkewAdjVec; @@ -399,7 +435,6 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, uint8_t attrRingData[MAX_PLL_RING_SIZE]={0}; uint8_t attrChipletId=0; uint32_t attrScanSelect=0; - uint8_t attrDdLevel=0; uint32_t attrRingDataSize=0; // Ring bit size uint32_t sizeDeltaPllRingAlt=0; uint32_t sizeRs4Launch=0; @@ -524,7 +559,7 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, // Construct RS4 launcher: // ...get the RS4 decompress address. - rcLoc = sbe_xip_get_scalar( imageOut, "proc_sbe_decompress_scan_chiplet_address", &scanChipletAddress); + rcLoc = sbe_xip_get_scalar( o_imageOut, "proc_sbe_decompress_scan_chiplet_address", &scanChipletAddress); if (rcLoc) { FAPI_ERR("sbe_xip_get_scalar() failed w/rc=%i", rcLoc); FAPI_ERR("Probable cause: Key word =proc_sbe_decompress_scan_chiplet_address not found in image."); @@ -582,11 +617,6 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, return rc; } bufPllRingAltBlock->sizeOfMeta = 0; - rc = FAPI_ATTR_GET_PRIVILEGED(ATTR_EC, &i_target, attrDdLevel); - if (rc) { - FAPI_ERR("FAPI_ATTR_GET_PRIVILEGED() failed w/rc=%i and ddLevel=0x%02x",(uint32_t)rc,attrDdLevel); - return rc; - } bufPllRingAltBlock->ddLevel = myRev32((uint32_t)attrDdLevel); bufPllRingAltBlock->sysPhase = i_sysPhase; bufPllRingAltBlock->override = 0; @@ -622,14 +652,16 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, // Append PLL _alt ring to image. // FAPI_INF("XIPC: PLL update: Appending RS4 PLL ring block to .rings section."); - rcLoc = write_ring_block_to_image( imageOut, + rcLoc = write_ring_block_to_image( o_imageOut, PERV_BNDY_PLL_RING_ALT_TOC_NAME, bufPllRingAltBlock, 0, 0, 0, - MAX_SEEPROM_IMAGE_SIZE); // OK, since sysPhase=0. -// SBE_XIP_SECTION_RINGS); + MAX_SEEPROM_IMAGE_SIZE, // OK, since sysPhase=0. + SBE_XIP_SECTION_RINGS, + i_buf2, + i_sizeBuf2); if (rcLoc) { FAPI_ERR("write_ring_block_to_image() failed w/rc=%i",rcLoc); FAPI_ERR("Check p8_delta_scan_rw.h for meaning of IMGBUILD_xyz rc code."); @@ -677,7 +709,21 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, uint8_t bValidChipletId=0,bRingAlreadyAdded=0; uint8_t chipletIdVpd; uint32_t sizeImageOut; + SbeXipSection xipSectionDcrings; + // First, is there an .dcrings section yet in the input image? We need this to know + // if we should do datacare on #G rings a little later. + // (Note, it makes no sense checking in output image since SLW has been wiped clean, and + // the same may be the case with IPL image in the future.) + rcLoc = sbe_xip_get_section(i_imageIn, SBE_XIP_SECTION_DCRINGS, &xipSectionDcrings); + if (rcLoc) { + FAPI_ERR("_get_section(.dcrings...) failed with rc=%i ",rcLoc); + uint32_t &RC_LOCAL=rcLoc; + FAPI_SET_HWP_ERROR(rc, RC_PROC_XIPC_IMGBUILD_ERROR); + return rc; + } + + // Now wade through all conceivable Mvpd rings and add any that's there to the image. for (iVpdType=0; iVpdType<NUM_OF_VPD_TYPES; iVpdType++) { if (iVpdType==0) { ring_id_list = (RingIdList*)RING_ID_LIST_PG; @@ -746,7 +792,6 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, bufVpdRing, sizeVpdRing); FAPI_DBG("XIPC: Mvpd rings: rcFapi=0x%08x",(uint32_t)rcFapi); - //FAPI_DBG("XIPC: Mvpd rings: RC_REPAIR_RING_NOT_FOUND=0x%08x",(uint32_t)RC_REPAIR_RING_NOT_FOUND); if (rcFapi==RC_REPAIR_RING_NOT_FOUND) { // No match, do nothing. Next (chipletId,ringId)-pair. FAPI_INF("XIPC: Mvpd rings: (iRing,ringId,chipletId)=(%i,0x%02X,0x%02X) not found.",iRing,ringId,chipletId); @@ -792,6 +837,26 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, return rc; } else { + // Enforce flush optimization for Mvpd rings. + ((CompressedScanData*)bufVpdRing)->iv_flushOptimization = 1; + // Do datacare, if needed. + if ( xipSectionDcrings.iv_offset!=0 ) { + FAPI_INF("Calling check_and_perform_ring_datacare()\n"); + rcLoc = check_and_perform_ring_datacare( + i_imageIn, + (void*)bufVpdRing, //HB buf1 + attrDdLevel, //Playing it safe. + i_sysPhase, + (char*)(ring_id_list+iRing)->ringNameImg, + (void*)i_buf2, //HB buf2 + i_sizeBuf2); + if (rcLoc) { + FAPI_ERR("check_and_perform_ring_datacare() failed w/rc=%i ",rcLoc); + uint32_t & RC_LOCAL = rcLoc; + FAPI_SET_HWP_ERROR(rc, RC_PROC_XIPC_PERFORM_RING_DATACARE_ERROR); + return rc; + } + } // Add VPD ring to image. if (!bRingAlreadyAdded) { rcLoc = 0; @@ -799,21 +864,21 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, sizeImageOut = MAX_SEEPROM_IMAGE_SIZE; // Add VPD ring to --->>> IPL <<<--- image rcLoc = write_vpd_ring_to_ipl_image( - imageOut, + o_imageOut, sizeImageOut, (CompressedScanData*)bufVpdRing, //HB buf1 ddLevel, i_sysPhase, (char*)(ring_id_list+iRing)->ringNameImg, (void*)i_buf2, //HB buf2 - i_sizeBuf2); -// SBE_XIP_SECTION_RINGS); + i_sizeBuf2, + SBE_XIP_SECTION_RINGS); } else { sizeImageOut = sizeImageOutMax; // Add VPD ring to --->>> SLW <<<--- image rcLoc = write_vpd_ring_to_slw_image( - imageOut, + o_imageOut, sizeImageOut, (CompressedScanData*)bufVpdRing, //HB buf1 ddLevel, @@ -843,6 +908,19 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, } } } + + // Now, we can safely remove the .dcrings section from the output image. Though, no + // need to do it for SLW which was wiped clean in slw_build(). + // + if (i_sysPhase==0) { + rcLoc = sbe_xip_delete_section(o_imageOut, SBE_XIP_SECTION_DCRINGS); + if (rcLoc) { + MY_ERR("_delete_section(.dcrings...) failed w/rc=%i ",rcLoc); + uint32_t & RC_LOCAL = rcLoc; + FAPI_SET_HWP_ERROR(rc, RC_PROC_XIPC_XIP_DELETE_SECTION_ERROR); + return rc; + } + } #endif @@ -865,12 +943,13 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, // ========================================================================== switch (i_modeBuild) { + // -------------------------------------------------------------------- // case 0: IPL mode. // - This is first time SLW image is built. Go all out. // -------------------------------------------------------------------- case P8_SLW_MODEBUILD_IPL: // IPL mode. - rcLoc = create_and_initialize_fixed_image(imageOut); + rcLoc = create_and_initialize_fixed_image(o_imageOut); if (rcLoc) { uint32_t & RC_LOCAL=rcLoc; FAPI_SET_HWP_ERROR(rc, RC_PROC_XIPC_CREATE_FIXED_IMAGE_ERROR); @@ -884,7 +963,7 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, // - Fixed positioning of .slw and .ffdc already done during IPL mode. // -------------------------------------------------------------------- case P8_SLW_MODEBUILD_REBUILD: // Rebuild mode. (Need to update Ram/Scom vectors.) - rcLoc = create_and_initialize_fixed_image(imageOut); + rcLoc = create_and_initialize_fixed_image(o_imageOut); if (rcLoc) { uint32_t & RC_LOCAL=rcLoc; FAPI_SET_HWP_ERROR(rc, RC_PROC_XIPC_CREATE_FIXED_IMAGE_ERROR); @@ -902,7 +981,7 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, // -------------------------------------------------------------------- case P8_SLW_MODEBUILD_SRAM: // SRAM mode. sizeImageTmp = sizeImageOutMax; - rcLoc = initialize_slw_section(imageOut, + rcLoc = initialize_slw_section(o_imageOut, &sizeImageTmp); if (rcLoc) { if (rcLoc==IMGBUILD_ERR_IMAGE_TOO_LARGE) { @@ -923,7 +1002,8 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, FAPI_ERR("Bad code, or bad modeBuild (=%i) parm.",i_modeBuild); FAPI_SET_HWP_ERROR(rc, RC_PROC_XIPC_BAD_CODE_OR_PARM); return rc; - } + + } // End of switch (i_modeBuild) // ========================================================================== @@ -969,7 +1049,7 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, for (coreId=0; coreId<=15; coreId++) { if (attrCombGoodVec[P8_CID_EX_LOW+coreId]) { rcLoc = p8_pore_gen_scom_fixed( - imageOut, + o_imageOut, 2, // modeBuild=2 (SRAM) for now. Change when switch to fixed img. (uint32_t)EX_L2_CERRS_RD_EPS_REG_0x10012814, // Scom addr. coreId, // The core ID. @@ -1028,7 +1108,7 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, for (coreId=0; coreId<=15; coreId++) { if (attrCombGoodVec[P8_CID_EX_LOW+coreId]) { rcLoc = p8_pore_gen_scom_fixed( - imageOut, + o_imageOut, 2, // modeBuild=2 (SRAM) for now. Change when switch to fixed img. (uint32_t)EX_L3_CERRS_RD_EPS_REG_0x10010829, // Scom addr. coreId, // The core ID. @@ -1057,7 +1137,7 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, for (coreId=0; coreId<=15; coreId++) { if (attrCombGoodVec[P8_CID_EX_LOW+coreId]) { rcLoc = p8_pore_gen_scom_fixed( - imageOut, + o_imageOut, 2, // modeBuild=2 (SRAM) for now. Change when switch to fixed img. (uint32_t)EX_L3_CERRS_WR_EPS_REG_0x1001082A, // Scom addr. coreId, // The core ID. @@ -1080,12 +1160,13 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, FAPI_INF("No active cores found. Did not update SCOM NC table w/L3 Epsilon data (2).\n"); } + // ========================================================================== - // CUSTOMIZE item: L3 BAR config register SCOM table updates. + // CUSTOMIZE item: L3 BAR config register SCOM table updates. (By JoeM) // Retrieval method: Attribute. // System phase: IPL and SLW sysPhase. // ========================================================================== - +#ifndef IMGBUILD_PPD_IGNORE_L3_BAR rc = FAPI_ATTR_GET(ATTR_PROC_L3_BAR1_REG, &i_target, attrL3BAR1); if (rc) { FAPI_ERR("FAPI_ATTR_GET(ATTR_PROC_L3_BAR1_REG) returned error.\n"); @@ -1110,7 +1191,7 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, for (coreId=0; coreId<=15; coreId++) { if (attrCombGoodVec[P8_CID_EX_LOW+coreId]) { rcLoc = p8_pore_gen_scom_fixed( - imageOut, + o_imageOut, 2, // modeBuild=2 (SRAM) for now. Change when switch to fixed img. (uint32_t)EX_L3_BAR1_REG_0x1001080B, // Scom addr. coreId, // The core ID. @@ -1139,7 +1220,7 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, for (coreId=0; coreId<=15; coreId++) { if (attrCombGoodVec[P8_CID_EX_LOW+coreId]) { rcLoc = p8_pore_gen_scom_fixed( - imageOut, + o_imageOut, 2, // modeBuild=2 (SRAM) for now. Change when switch to fixed img. (uint32_t)EX_L3_BAR2_REG_0x10010813, // Scom addr. coreId, // The core ID. @@ -1168,7 +1249,7 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, for (coreId=0; coreId<=15; coreId++) { if (attrCombGoodVec[P8_CID_EX_LOW+coreId]) { rcLoc = p8_pore_gen_scom_fixed( - imageOut, + o_imageOut, 2, // modeBuild=2 (SRAM) for now. Change when switch to fixed img. (uint32_t)EX_L3_BAR_GROUP_MASK_REG_0x10010816, // Scom addr. coreId, // The core ID. @@ -1190,6 +1271,7 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, else { FAPI_INF("No active cores found. Did not update SCOM NC table w/L3 BAR data (3).\n"); } +#endif } // End of if (i_sysPhase==1) @@ -1198,8 +1280,7 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, // Done customizing, yeah!! // - i_imageOut = imageOut; // Note, imageOut=i_imageIn for SLW but =i_imageOut for IPL. - sbe_xip_image_size( i_imageOut, &io_sizeImageOut); + sbe_xip_image_size( o_imageOut, &io_sizeImageOut); if (i_sysPhase==0) sizeImageMax = MAX_SEEPROM_IMAGE_SIZE; @@ -1208,7 +1289,7 @@ ReturnCode p8_xip_customize( const fapi::Target &i_target, FAPI_INF("XIPC: Final output image:\n "); FAPI_INF(" location=0x%016llx\n size (actual)=%i\n size (max allowed)=%i\n ", - (uint64_t)i_imageOut, io_sizeImageOut, sizeImageMax); + (uint64_t)o_imageOut, io_sizeImageOut, sizeImageMax); FAPI_INF("XIPC: Input image (just for reference):\n "); FAPI_INF(" location=0x%016llx\n size=%i\n ", (uint64_t)i_imageIn, sizeImageIn); diff --git a/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_xip_customize_attributes.xml b/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_xip_customize_attributes.xml index 68e088c3f..2eede590d 100644 --- a/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_xip_customize_attributes.xml +++ b/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_xip_customize_attributes.xml @@ -270,4 +270,17 @@ <persistRuntime/> </attribute> <!-- ********************************************************************* --> + <attribute> + <id>ATTR_PROC_SECURITY_SETUP_VECTOR</id> + <targetType>TARGET_TYPE_PROC_CHIP</targetType> + <description>64-bit proc_sbe_security_setup_vector used by proc_sbe_security_setup.S + creator: platform + firmware notes: + 64-bit proc_sbe_security_setup_vector + </description> + <valueType>uint64</valueType> + <platInit/> + <persistRuntime/> + </attribute> + <!-- ********************************************************************* --> </attributes> diff --git a/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_xip_customize_errors.xml b/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_xip_customize_errors.xml index 20b727be0..04a550eda 100644 --- a/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_xip_customize_errors.xml +++ b/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_xip_customize_errors.xml @@ -202,12 +202,24 @@ </hwpError> <!-- *********************************************************************** --> <hwpError> + <rc>RC_PROC_XIPC_PERFORM_RING_DATACARE_ERROR</rc> + <description>Error occured during check_and_perform_ring_datacare()</description> + <ffdc>RC_LOCAL</ffdc> +</hwpError> +<!-- *********************************************************************** --> +<hwpError> <rc>RC_PROC_XIPC_WRITE_VPD_RING_TO_IMAGE_ERROR</rc> <description>Error occured during write_vpd_ring_to_{ipl,slw}_image()</description> <ffdc>RC_LOCAL</ffdc> </hwpError> <!-- *********************************************************************** --> <hwpError> + <rc>RC_PROC_XIPC_XIP_DELETE_SECTION_ERROR</rc> + <description>sbe_xip_delete_section() failed w/local rc.</description> + <ffdc>RC_LOCAL</ffdc> +</hwpError> +<!-- *********************************************************************** --> +<hwpError> <rc>RC_PROC_XIPC_CREATE_FIXED_IMAGE_ERROR</rc> <description>Error associated with creating and initializing fixed image and fixed .slw and .ffdc sections.</description> <ffdc>RC_LOCAL</ffdc> diff --git a/src/usr/hwpf/hwp/sbe_centaur_init/cen_xip_customize.C b/src/usr/hwpf/hwp/sbe_centaur_init/cen_xip_customize.C index 45acf3c7d..e44dd3f86 100644 --- a/src/usr/hwpf/hwp/sbe_centaur_init/cen_xip_customize.C +++ b/src/usr/hwpf/hwp/sbe_centaur_init/cen_xip_customize.C @@ -20,7 +20,7 @@ /* Origin: 30 */ /* */ /* IBM_PROLOG_END_TAG */ -// $Id: cen_xip_customize.C,v 1.8 2013/03/14 03:33:21 cmolsen Exp $ +// $Id: cen_xip_customize.C,v 1.10 2013/03/28 00:21:54 cmolsen Exp $ /*------------------------------------------------------------------------------*/ /* *! TITLE : cen_xip_customize.C */ /* *! DESCRIPTION : Customizes Centaur images from a Centaur reference image. */ @@ -286,7 +286,10 @@ ReturnCode cen_xip_customize(const fapi::Target &i_target, 0, 0, 0, - sizeImageOutMax ); + sizeImageOutMax, + SBE_XIP_SECTION_RINGS, + i_buf2, // Use buf2 as temp buf. + i_sizeBuf2 ); if (rcLoc) { FAPI_ERR("write_ring_block_to_image() failed w/rc=%i",rcLoc); FAPI_ERR("Check p8_delta_scan_rw.h for meaning of IMGBUILD_xyz rc code."); diff --git a/src/usr/targeting/common/xmltohb/attribute_types.xml b/src/usr/targeting/common/xmltohb/attribute_types.xml index 8aafa7fbf..2380043aa 100644 --- a/src/usr/targeting/common/xmltohb/attribute_types.xml +++ b/src/usr/targeting/common/xmltohb/attribute_types.xml @@ -5660,6 +5660,26 @@ firmware notes: Used as override attribute for pstate procedure </hwpfToHbAttrMap> </attribute> +<attribute> + <id>PROC_SECURITY_SETUP_VECTOR</id> + <description> + Secureboot 64-bit proc_sbe_security_setup_vector used + by proc_sbe_security_setup.S. 0s are an unsecure SBE image + creator: platform + firmware notes: + 64-bit proc_sbe_security_setup_vector + </description> + <simpleType> + <uint64_t></uint64_t> + </simpleType> + <persistency>non-volatile</persistency> + <readable/> + <hwpfToHbAttrMap> + <id>ATTR_PROC_SECURITY_SETUP_VECTOR</id> + <macro>DIRECT</macro> + </hwpfToHbAttrMap> +</attribute> + <!-- ===== Attributes supporting memory_attributes.xml HWPF Attributes ===== --> <attribute> |