From c69f417ba60c393d4a0e978fa22804d715c6252b Mon Sep 17 00:00:00 2001 From: Claus Michael Olsen Date: Wed, 30 Mar 2016 14:35:25 -0500 Subject: Relocation of header files to ./tools/imageProcs directory and associated changes to various *.mk files to point to new location as well as minor changes to xip_tool. Removed p9_ring_apply.mk because it isn't needed at this point anyway and causes Jenkins to fail. Giri is checking this file plus associated corrections to the other p9_ring_apply.* files. Added and updated p9_xip_image.h, and updated p9_scan_compression.H, according to commit 22997. Change-Id: I888dc2fccf92d3173ae45870b7cdefeb29757058 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/22682 Tested-by: Hostboot CI Tested-by: Jenkins Server Tested-by: PPE CI Reviewed-by: Claus M. Olsen Reviewed-by: Prachi Gupta Reviewed-by: Daniel M. Crowell Reviewed-by: Martin Peschke Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/22687 --- import/chips/p9/xip/Makefile | 3 +- import/chips/p9/xip/fapi_sbe_common.H | 60 ----------- import/chips/p9/xip/p9_image_help_base.H | 7 ++ import/chips/p9/xip/p9_ring_identification.H | 62 ----------- import/chips/p9/xip/p9_ring_identification.c | 155 --------------------------- import/chips/p9/xip/p9_xip_image.h | 8 +- import/chips/p9/xip/p9_xip_tool.c | 39 ++++--- import/tools/imageProcs/fapi_sbe_common.H | 60 +++++++++++ 8 files changed, 92 insertions(+), 302 deletions(-) delete mode 100644 import/chips/p9/xip/fapi_sbe_common.H delete mode 100644 import/chips/p9/xip/p9_ring_identification.H delete mode 100644 import/chips/p9/xip/p9_ring_identification.c create mode 100644 import/tools/imageProcs/fapi_sbe_common.H (limited to 'import') diff --git a/import/chips/p9/xip/Makefile b/import/chips/p9/xip/Makefile index 565a37ad..466bca0b 100644 --- a/import/chips/p9/xip/Makefile +++ b/import/chips/p9/xip/Makefile @@ -51,7 +51,6 @@ endif XIP_SOURCES = p9_xip_image.c XIP_SOURCES += p9_xip_tool.c -XIP_SOURCES += p9_ring_identification.c XIP_UTILS = p9_xip_tool @@ -71,7 +70,7 @@ $(OBJ_DIR): $(OBJ_DIR)/%.o: %.c $(CXX) $(CXX_FLAGS) $(INCLUDES) $(XIP_FLAGS) -c -o $@ $< -$(OBJ_DIR)/p9_xip_tool: $(OBJ_DIR)/p9_xip_image.o $(OBJ_DIR)/p9_ring_identification.o $(OBJ_DIR)/p9_xip_tool.o +$(OBJ_DIR)/p9_xip_tool: $(OBJ_DIR)/p9_xip_image.o $(OBJ_DIR)/p9_xip_tool.o $(CXX) -o $@ $^ clean: diff --git a/import/chips/p9/xip/fapi_sbe_common.H b/import/chips/p9/xip/fapi_sbe_common.H deleted file mode 100644 index d125eead..00000000 --- a/import/chips/p9/xip/fapi_sbe_common.H +++ /dev/null @@ -1,60 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: chips/p9/xip/fapi_sbe_common.H $ */ -/* */ -/* IBM CONFIDENTIAL */ -/* */ -/* EKB Project */ -/* */ -/* COPYRIGHT 2015,2016 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* The source code for this program is not published or otherwise */ -/* divested of its trade secrets, irrespective of what has been */ -/* deposited with the U.S. Copyright Office. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -/// \file fapi_sbe_common.H -/// \brief provides several preprocessor macros used functions in fixed secion. -/// -/// Several preprocessor macros are required to have different definitions in -/// C, C++ and SBE assembly procedures. These common forms are collected here. - -#ifndef __FAPI_SBE_COMMON_H -#define __FAPI_SBE_COMMON_H - -/// Several preprocessor macros are required to have different definitions in -/// C, C++ and SBE assembly procedures. These common forms are collected here. - -#if defined __ASSEMBLER__ - - #define CONST_UINT8_T(name, expr) .set name, (expr) - #define CONST_UINT32_T(name, expr) .set name, (expr) - #define CONST_UINT64_T(name, expr) .set name, (expr) - - #define ULL(x) x - -#elif defined __cplusplus - - #include - - #define CONST_UINT8_T(name, expr) const uint8_t name = (expr); - #define CONST_UINT32_T(name, expr) const uint32_t name = (expr); - #define CONST_UINT64_T(name, expr) const uint64_t name = (expr); - - #define ULL(x) x##ull - -#else // C code - - // CONST_UINT[8,3,64]_T() can't be used in C code/headers; Use - // - // #define [ or ULL() for 64-bit constants - - #define ULL(x) x##ull - -#endif // __ASSEMBLER__ - -#endif // __FAPI_SBE_COMMON_H diff --git a/import/chips/p9/xip/p9_image_help_base.H b/import/chips/p9/xip/p9_image_help_base.H index 7b1e550c..4aa23885 100644 --- a/import/chips/p9/xip/p9_image_help_base.H +++ b/import/chips/p9/xip/p9_image_help_base.H @@ -45,6 +45,13 @@ 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[] = +//{ +// P9_XIP_SECTION_RINGS, +// P9_XIP_SECTION_OVERLAYS, +//}; +//const uint8_t RING_SECTION_ID_SIZE = sizeof(RING_SECTION_ID) / sizeof(RING_SECTION_ID[0]); + #ifdef __cplusplus extern "C" { #endif diff --git a/import/chips/p9/xip/p9_ring_identification.H b/import/chips/p9/xip/p9_ring_identification.H deleted file mode 100644 index de5927fa..00000000 --- a/import/chips/p9/xip/p9_ring_identification.H +++ /dev/null @@ -1,62 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: chips/p9/xip/p9_ring_identification.H $ */ -/* */ -/* IBM CONFIDENTIAL */ -/* */ -/* EKB Project */ -/* */ -/* COPYRIGHT 2015,2016 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* The source code for this program is not published or otherwise */ -/* divested of its trade secrets, irrespective of what has been */ -/* deposited with the U.S. Copyright Office. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -#ifndef _P9_RING_IDENT_H_ -#define _P9_RING_IDENT_H_ -#include -#include -#include -#include - - -// Ring ID list structure. -typedef struct -{ - const char* ringName; - uint8_t ringId; - uint8_t chipIdMin; // the min chipletId - uint8_t chipIdMax; // the max chipletId - const char* ringNameImg; // Ring name in image: ringName + "_ring" - uint8_t vpdKeyword; - uint8_t bWcSpace; // 0: fitted 1: worst-case space (3 x ring length) -} RingIdList; - -extern const RingIdList RING_ID_LIST_PG[], RING_ID_LIST_PR[]; -extern const uint32_t RING_ID_LIST_PG_SIZE, RING_ID_LIST_PR_SIZE; -extern const RingIdList RING_ID_LIST[]; -extern const uint32_t RING_ID_LIST_SIZE; - -// Enumerated VPD keyword values. -// Note! This is DIFFERENT from the MvpdKeyword list in fapiMvpdAccess.H which -// can't be used in this file since it's not, per se, a fapi file. So -// these values need to be translated in xip_customize when passing the -// mvpdKeyword to getMvpdRing(); -enum VpdKeyword -{ - VPD_KEYWORD_PDG, - VPD_KEYWORD_PDR, - NUM_OF_VPD_TYPES -}; - -int get_vpd_ring_list_entry(const char* i_ringName, - const uint8_t i_ringId, - RingIdList** i_ringIdList); - - -#endif diff --git a/import/chips/p9/xip/p9_ring_identification.c b/import/chips/p9/xip/p9_ring_identification.c deleted file mode 100644 index 29fc40c5..00000000 --- a/import/chips/p9/xip/p9_ring_identification.c +++ /dev/null @@ -1,155 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: chips/p9/xip/p9_ring_identification.c $ */ -/* */ -/* IBM CONFIDENTIAL */ -/* */ -/* EKB Project */ -/* */ -/* COPYRIGHT 2015,2016 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* The source code for this program is not published or otherwise */ -/* divested of its trade secrets, irrespective of what has been */ -/* deposited with the U.S. Copyright Office. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -#include - -const RingIdList RING_ID_LIST_PG[] = -{ - /* ringName ringId chipletId ringNameImg mvpdKeyword wc */ - /* min max */ - {"ab_gptr_ab", 0xA0, 0x08, 0x08, "ab_gptr_ab_ring", VPD_KEYWORD_PDG, 0}, - {"ab_gptr_ioa", 0xA1, 0x08, 0x08, "ab_gptr_ioa_ring", VPD_KEYWORD_PDG, 0}, - {"ab_gptr_perv", 0xA2, 0x08, 0x08, "ab_gptr_perv_ring", VPD_KEYWORD_PDG, 0}, - {"ab_gptr_pll", 0xA3, 0x08, 0x08, "ab_gptr_pll_ring", VPD_KEYWORD_PDG, 0}, - {"ab_time", 0xA4, 0x08, 0x08, "ab_time_ring", VPD_KEYWORD_PDG, 0}, - {"ex_gptr_core", 0xA5, 0xFF, 0xFF, "ex_gptr_core_ring", VPD_KEYWORD_PDG, 0}, //Chip specific - {"ex_gptr_dpll", 0xA6, 0xFF, 0xFF, "ex_gptr_dpll_ring", VPD_KEYWORD_PDG, 0}, //Chip specific - {"ex_gptr_l2", 0xA7, 0xFF, 0xFF, "ex_gptr_l2_ring", VPD_KEYWORD_PDG, 0}, //Chip specific - {"ex_gptr_l3", 0xA8, 0xFF, 0xFF, "ex_gptr_l3_ring", VPD_KEYWORD_PDG, 0}, //Chip specific - {"ex_gptr_l3refr", 0xA9, 0xFF, 0xFF, "ex_gptr_l3refr_ring", VPD_KEYWORD_PDG, 0}, //Chip specific - {"ex_gptr_perv", 0xAA, 0xFF, 0xFF, "ex_gptr_perv_ring", VPD_KEYWORD_PDG, 0}, //Chip specific - {"ex_time_core", 0xAB, 0x10, 0x1F, "ex_time_core_ring", VPD_KEYWORD_PDG, 0}, //Chiplet specfc - {"ex_time_eco", 0xAC, 0x10, 0x1F, "ex_time_eco_ring", VPD_KEYWORD_PDG, 0}, //Chiplet specfc - {"pb_gptr_dmipll", 0xAD, 0x02, 0x02, "pb_gptr_dmipll_ring", VPD_KEYWORD_PDG, 0}, - {"pb_gptr_mcr", 0xAE, 0x02, 0x02, "pb_gptr_mcr_ring", VPD_KEYWORD_PDG, 0}, - {"pb_gptr_nest", 0xAF, 0x02, 0x02, "pb_gptr_nest_ring", VPD_KEYWORD_PDG, 0}, - {"pb_gptr_nx", 0xB0, 0x02, 0x02, "pb_gptr_nx_ring", VPD_KEYWORD_PDG, 0}, - {"pb_gptr_pcis", 0xB1, 0x02, 0x02, "pb_gptr_pcis_ring", VPD_KEYWORD_PDG, 0}, - {"pb_gptr_perv", 0xB2, 0x02, 0x02, "pb_gptr_perv_ring", VPD_KEYWORD_PDG, 0}, - {"pb_time", 0xB3, 0x02, 0x02, "pb_time_ring", VPD_KEYWORD_PDG, 0}, - {"pb_time_mcr", 0xB4, 0x02, 0x02, "pb_time_mcr_ring", VPD_KEYWORD_PDG, 0}, - {"pb_time_nx", 0xB5, 0x02, 0x02, "pb_time_nx_ring", VPD_KEYWORD_PDG, 0}, - {"pci_gptr_iopci", 0xB6, 0x09, 0x09, "pci_gptr_iopci_ring", VPD_KEYWORD_PDG, 0}, - {"pci_gptr_pbf", 0xB7, 0x09, 0x09, "pci_gptr_pbf_ring", VPD_KEYWORD_PDG, 0}, - {"pci_gptr_pci0", 0xB8, 0x09, 0x09, "pci_gptr_pci0_ring", VPD_KEYWORD_PDG, 0}, - {"pci_gptr_pci1", 0xB9, 0x09, 0x09, "pci_gptr_pci1_ring", VPD_KEYWORD_PDG, 0}, - {"pci_gptr_pci2", 0xBA, 0x09, 0x09, "pci_gptr_pci2_ring", VPD_KEYWORD_PDG, 0}, - {"pci_gptr_perv", 0xBB, 0x09, 0x09, "pci_gptr_perv_ring", VPD_KEYWORD_PDG, 0}, - {"pci_gptr_pll", 0xBC, 0x09, 0x09, "pci_gptr_pll_ring", VPD_KEYWORD_PDG, 0}, - {"pci_time", 0xBD, 0x09, 0x09, "pci_time_ring", VPD_KEYWORD_PDG, 0}, - {"perv_gptr_net", 0xBE, 0x00, 0x00, "perv_gptr_net_ring", VPD_KEYWORD_PDG, 0}, - {"perv_gptr_occ", 0xBF, 0x00, 0x00, "perv_gptr_occ_ring", VPD_KEYWORD_PDG, 0}, - {"perv_gptr_perv", 0xC0, 0x00, 0x00, "perv_gptr_perv_ring", VPD_KEYWORD_PDG, 0}, - {"perv_gptr_pib", 0xC1, 0x00, 0x00, "perv_gptr_pib_ring", VPD_KEYWORD_PDG, 0}, - {"perv_gptr_pll", 0xC2, 0x00, 0x00, "perv_gptr_pll_ring", VPD_KEYWORD_PDG, 0}, - {"perv_time", 0xC3, 0x00, 0x00, "perv_time_ring", VPD_KEYWORD_PDG, 0}, - {"xb_gptr_iopci", 0xC4, 0x04, 0x04, "xb_gptr_iopci_ring", VPD_KEYWORD_PDG, 0}, - {"xb_gptr_iox", 0xC5, 0x04, 0x04, "xb_gptr_iox_ring", VPD_KEYWORD_PDG, 0}, - {"xb_gptr_pben", 0xC6, 0x04, 0x04, "xb_gptr_pben_ring", VPD_KEYWORD_PDG, 0}, - {"xb_gptr_perv", 0xC7, 0x04, 0x04, "xb_gptr_perv_ring", VPD_KEYWORD_PDG, 0}, - {"xb_time", 0xC8, 0x04, 0x04, "xb_time_ring", VPD_KEYWORD_PDG, 0}, - {"pb_gptr_mcl", 0xC9, 0x02, 0x02, "pb_gptr_mcl_ring", VPD_KEYWORD_PDG, 0}, - {"pb_time_mcl", 0xCA, 0x02, 0x02, "pb_time_mcl_ring", VPD_KEYWORD_PDG, 0}, -}; - -const RingIdList RING_ID_LIST_PR[] = -{ - /* ringName ringId chipIdMin chipIdMax ringNameImg mvpdKeyword */ - {"ab_repr", 0xE0, 0x08, 0x08, "ab_repr_ring", VPD_KEYWORD_PDR, 0}, - {"ex_repr_core", 0xE1, 0x10, 0x1F, "ex_repr_core_ring", VPD_KEYWORD_PDR, 1}, - {"ex_repr_eco", 0xE2, 0x10, 0x1F, "ex_repr_eco_ring", VPD_KEYWORD_PDR, 1}, - {"pb_repr", 0xE3, 0x02, 0x02, "pb_repr_ring", VPD_KEYWORD_PDR, 0}, - {"pb_repr_mcr", 0xE4, 0x02, 0x02, "pb_repr_mcr_ring", VPD_KEYWORD_PDR, 0}, - {"pb_repr_nx", 0xE5, 0x02, 0x02, "pb_repr_nx_ring", VPD_KEYWORD_PDR, 0}, - {"pci_repr", 0xE6, 0x09, 0x09, "pci_repr_ring", VPD_KEYWORD_PDR, 0}, - {"perv_repr", 0xE7, 0x00, 0x00, "perv_repr_ring", VPD_KEYWORD_PDR, 0}, - {"perv_repr_net", 0xE8, 0x00, 0x00, "perv_repr_net_ring", VPD_KEYWORD_PDR, 0}, - {"perv_repr_pib", 0xE9, 0x00, 0x00, "perv_repr_pib_ring", VPD_KEYWORD_PDR, 0}, - {"xb_repr", 0xEA, 0x04, 0x04, "xb_repr_ring", VPD_KEYWORD_PDR, 0}, - {"pb_repr_mcl", 0xEB, 0x02, 0x02, "pb_repr_mcl_ring", VPD_KEYWORD_PDR, 0}, -}; - -const uint32_t RING_ID_LIST_PG_SIZE = sizeof(RING_ID_LIST_PG) / sizeof(RING_ID_LIST_PG[0]); -const uint32_t RING_ID_LIST_PR_SIZE = sizeof(RING_ID_LIST_PR) / sizeof(RING_ID_LIST_PR[0]); - -// get_vpd_ring_list_entry() retrieves the MVPD list entry based on either a ringName -// or a ringId. If both are supplied, only the ringName is used. If ringName==NULL, -// then the ringId is used. A pointer to the RingIdList is returned. -int get_vpd_ring_list_entry(const char* i_ringName, - const uint8_t i_ringId, - RingIdList** i_ringIdList) -{ - int rc = 0, NOT_FOUND = 1, FOUND = 0; - uint8_t iVpdType; - uint8_t iRing; - RingIdList* ring_id_list = NULL; - uint8_t ring_id_list_size; - - rc = NOT_FOUND; - - for (iVpdType = 0; iVpdType < NUM_OF_VPD_TYPES; iVpdType++) - { - if (iVpdType == 0) - { - ring_id_list = (RingIdList*)RING_ID_LIST_PG; - ring_id_list_size = (uint32_t)RING_ID_LIST_PG_SIZE; - } - else - { - ring_id_list = (RingIdList*)RING_ID_LIST_PR; - ring_id_list_size = (uint32_t)RING_ID_LIST_PR_SIZE; - } - - // Search the MVPD reference lists for either a: - // - ringName match with or w/o _image in the name, or - // - ringId match. - if (i_ringName) - { - // Search for ringName match. - for (iRing = 0; iRing < ring_id_list_size; iRing++) - { - if ( strcmp((ring_id_list + iRing)->ringName, i_ringName) == 0 || - strcmp((ring_id_list + iRing)->ringNameImg, i_ringName) == 0 ) - { - *i_ringIdList = ring_id_list + iRing; - return FOUND; - } - } - } - else - { - // Search for ringId match (since ringName was not supplied). - for (iRing = 0; iRing < ring_id_list_size; iRing++) - { - if ((ring_id_list + iRing)->ringId == i_ringId) - { - *i_ringIdList = ring_id_list + iRing; - return FOUND; - } - } - } - - } - - return rc; -} - - - - diff --git a/import/chips/p9/xip/p9_xip_image.h b/import/chips/p9/xip/p9_xip_image.h index 6c9ff69d..6f00e92c 100644 --- a/import/chips/p9/xip/p9_xip_image.h +++ b/import/chips/p9/xip/p9_xip_image.h @@ -29,8 +29,6 @@ #ifndef __P9_XIP_IMAGE_H #define __P9_XIP_IMAGE_H -#include "fapi_sbe_common.H" - /// Current version (fields, layout, sections) of the P9_XIP header /// /// If any changes are made to this file or to p9_xip_header.H, please update @@ -46,6 +44,12 @@ /// /// @{ +#ifdef __ASSEMBLER__ + #define ULL(x) x +#else + #define ULL(x) x##ull +#endif + #define P9_XIP_MAGIC 0x58495020 // "XIP " #define P9_XIP_MAGIC_BASE ULL(0x5849502042415345) // "XIP BASE" #define P9_XIP_MAGIC_SEEPROM ULL(0x584950205345504d) // "XIP SEPM" diff --git a/import/chips/p9/xip/p9_xip_tool.c b/import/chips/p9/xip/p9_xip_tool.c index 39574e68..44157757 100644 --- a/import/chips/p9/xip/p9_xip_tool.c +++ b/import/chips/p9/xip/p9_xip_tool.c @@ -35,13 +35,10 @@ #include #include - - #define __PPE__ #include "p9_xip_image.h" -#include "p9_image_help_base.H" -#include "p9_ring_identification.H" +#define LINE_SIZE_MAX 1024 // Max size of a single snprintf dump. // Usage: p9_xip_tool [- ...] normalize // p9_xip_tool [- ...] get @@ -1856,7 +1853,7 @@ int disassembleSection(void* i_image, P9XipSection hostSection; ImageInlineContext ctx; ImageInlineDisassembly dis; - char lineDis[LISTING_STRING_SIZE]; + char lineDis[LINE_SIZE_MAX]; void* hostRs4Container; uint32_t compressedBits = 0, ringLength = 0; double compressionPct = 0; @@ -2091,14 +2088,14 @@ int disassembleSection(void* i_image, if (pairingInfo.override) { - sizeDisLine = snprintf(lineDis, LISTING_STRING_SIZE, + sizeDisLine = snprintf(lineDis, LINE_SIZE_MAX, "# ------------------------------\n# %i.\n# ringName = %s (override)\n# vectorPos = %i\n# overRidable = %i\n# backPtr = 0x%08x\n# fwdPtr = 0x%08x\n# Compressed Bits = %u\n# Ring Length Bits = %u\n# Compression = %0.2f%%\n", ringSeqNo, ringName, vectorPos, overRidable, (uint32_t)backPtr, (uint32_t)fwdPtr, compressedBits, ringLength, compressionPct); } else { - sizeDisLine = snprintf(lineDis, LISTING_STRING_SIZE, + sizeDisLine = snprintf(lineDis, LINE_SIZE_MAX, "# ------------------------------\n# %i.\n# ringName = %s (base)\n# vectorPos = %i\n# overRidable = %i\n# backPtr = 0x%08x\n# fwdPtr = 0x%08x\n# Compressed Bits = %u\n# Ring Length Bits = %u\n# Compression = %0.2f%%\n", ringSeqNo, ringName, vectorPos, overRidable, (uint32_t)backPtr, (uint32_t)fwdPtr, compressedBits, ringLength, compressionPct); @@ -2106,7 +2103,7 @@ int disassembleSection(void* i_image, } else { - sizeDisLine = snprintf(lineDis, LISTING_STRING_SIZE, + sizeDisLine = snprintf(lineDis, LINE_SIZE_MAX, "# ------------------------------\n# %i.\n# ringName = Not found (but TOC's available)\n# backPtr = 0x%08x\n# fwdPtr = 0x%08x\n", ringSeqNo, (uint32_t)backPtr, (uint32_t)fwdPtr); } @@ -2141,13 +2138,13 @@ int disassembleSection(void* i_image, // RS4 header, which has override info if (((Rs4RingLayout*)nextBlock)->override == 0) { - sizeDisLine = snprintf(lineDis, LISTING_STRING_SIZE, + sizeDisLine = snprintf(lineDis, LINE_SIZE_MAX, "# ------------------------------\n# %i.\n# ringName = Not available (base)\n# backPtr = 0x%08x\n# fwdPtr = 0x%08x\n# Compressed Bits = %u\n# Ring Length Bits = %u\n# Compression = %0.2f%%\n", ringSeqNo, (uint32_t)backPtr, (uint32_t)fwdPtr, compressedBits, ringLength, compressionPct); } else { - sizeDisLine = snprintf(lineDis, LISTING_STRING_SIZE, + sizeDisLine = snprintf(lineDis, LINE_SIZE_MAX, "# ------------------------------\n# %i.\n# ringName = Not available (override)\n# backPtr = 0x%08x\n# fwdPtr = 0x%08x\n# Compressed Bits = %u\n# Ring Length Bits = %u\n# Compression = %0.2f%%\n", ringSeqNo, (uint32_t)backPtr, (uint32_t)fwdPtr, compressedBits, ringLength, compressionPct); } @@ -2155,7 +2152,7 @@ int disassembleSection(void* i_image, else { // WF header, which doesn't have override info - sizeDisLine = snprintf(lineDis, LISTING_STRING_SIZE, + sizeDisLine = snprintf(lineDis, LINE_SIZE_MAX, "# ------------------------------\n# %i.\n# ringName and override = Not available\n# backPtr = 0x%08x\n# fwdPtr = 0x%08x\n", ringSeqNo, (uint32_t)backPtr, (uint32_t)fwdPtr); } @@ -2188,7 +2185,7 @@ int disassembleSection(void* i_image, if (typeRingsSection == 0) // RS4 header. { - sizeDisLine = snprintf(lineDis, LISTING_STRING_SIZE, + sizeDisLine = snprintf(lineDis, LINE_SIZE_MAX, "# ddLevel = 0x%02x\n# override= %i\n# sysPhase= %i\n# Block size= %i\n", myRev32(((Rs4RingLayout*)nextBlock)->ddLevel), ((Rs4RingLayout*)nextBlock)->override, @@ -2199,13 +2196,13 @@ int disassembleSection(void* i_image, { if (bFoundInToc) { - sizeDisLine = snprintf(lineDis, LISTING_STRING_SIZE, + sizeDisLine = snprintf(lineDis, LINE_SIZE_MAX, "# override= %i\n# Block size= %i\n", pairingInfo.override, sizeBlock); } else { - sizeDisLine = snprintf(lineDis, LISTING_STRING_SIZE, + sizeDisLine = snprintf(lineDis, LINE_SIZE_MAX, "# override= Not available\n# Block size= %i\n", sizeBlock); } @@ -2235,14 +2232,14 @@ int disassembleSection(void* i_image, do { rc = image_inline_disassemble( &ctx, &dis); - sizeDisLine = snprintf(lineDis, LISTING_STRING_SIZE, "%s\n", dis.s); + sizeDisLine = snprintf(lineDis, LINE_SIZE_MAX, "%s\n", dis.s); sizeList = sizeList + sizeDisLine; disList = strcat(disList, lineDis); if (rc) { rcSet = rcSet | 0x1; - sizeDisLine = snprintf(lineDis, LISTING_STRING_SIZE, + sizeDisLine = snprintf(lineDis, LINE_SIZE_MAX, "WARNING: %s (rc=%i) -> Stopping disasm. Check code and sectionID=%i.\n", image_inline_error_strings[rc], rc, sectionId); sizeList = sizeList + sizeDisLine; @@ -2273,7 +2270,7 @@ int disassembleSection(void* i_image, { rc = image_inline_disassemble( &ctx, &dis); ctx.options = IMAGE_INLINE_LISTING_MODE; - sizeDisLine = snprintf(lineDis, LISTING_STRING_SIZE, "%s\n", dis.s); + sizeDisLine = snprintf(lineDis, LINE_SIZE_MAX, "%s\n", dis.s); sizeList = sizeList + sizeDisLine; disList = strcat(disList, lineDis); @@ -2284,13 +2281,13 @@ int disassembleSection(void* i_image, if (sectionId == P9_XIP_SECTION_RINGS) { - sizeDisLine = snprintf(lineDis, LISTING_STRING_SIZE, + sizeDisLine = snprintf(lineDis, LINE_SIZE_MAX, "WARNING: %s (rc=%i) -> Trying data disasm mode. Check code, xyzRingLayout structures and image section.\n", image_inline_error_strings[rc], rc); } else { - sizeDisLine = snprintf(lineDis, LISTING_STRING_SIZE, + sizeDisLine = snprintf(lineDis, LINE_SIZE_MAX, "WARNING: %s (rc=%i) -> Trying data disasm mode.\n", image_inline_error_strings[rc], rc); } @@ -2333,14 +2330,14 @@ int disassembleSection(void* i_image, do { rc = image_inline_disassemble( &ctx, &dis); - sizeDisLine = snprintf(lineDis, LISTING_STRING_SIZE, "%s\n", dis.s); + sizeDisLine = snprintf(lineDis, LINE_SIZE_MAX, "%s\n", dis.s); sizeList = sizeList + sizeDisLine; disList = strcat(disList, lineDis); if (rc) { rcSet = rcSet | 0x4; - sizeDisLine = snprintf(lineDis, LISTING_STRING_SIZE, + sizeDisLine = snprintf(lineDis, LINE_SIZE_MAX, "WARNING: %s (rc=%i) -> Stopping disasm. Check code and sectionID=%i.\n", image_inline_error_strings[rc], rc, sectionId); sizeList = sizeList + sizeDisLine; diff --git a/import/tools/imageProcs/fapi_sbe_common.H b/import/tools/imageProcs/fapi_sbe_common.H new file mode 100644 index 00000000..4d660448 --- /dev/null +++ b/import/tools/imageProcs/fapi_sbe_common.H @@ -0,0 +1,60 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: tools/imageProcs/fapi_sbe_common.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* EKB Project */ +/* */ +/* COPYRIGHT 2015,2016 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* IBM_PROLOG_END_TAG */ + +/// \file fapi_sbe_common.H +/// \brief provides several preprocessor macros used functions in fixed secion. +/// +/// Several preprocessor macros are required to have different definitions in +/// C, C++ and SBE assembly procedures. These common forms are collected here. + +#ifndef __FAPI_SBE_COMMON_H +#define __FAPI_SBE_COMMON_H + +/// Several preprocessor macros are required to have different definitions in +/// C, C++ and SBE assembly procedures. These common forms are collected here. + +#if defined __ASSEMBLER__ + + #define CONST_UINT8_T(name, expr) .set name, (expr) + #define CONST_UINT32_T(name, expr) .set name, (expr) + #define CONST_UINT64_T(name, expr) .set name, (expr) + + #define ULL(x) x + +#elif defined __cplusplus + + #include + + #define CONST_UINT8_T(name, expr) const uint8_t name = (expr); + #define CONST_UINT32_T(name, expr) const uint32_t name = (expr); + #define CONST_UINT64_T(name, expr) const uint64_t name = (expr); + + #define ULL(x) x##ull + +#else // C code + + // CONST_UINT[8,3,64]_T() can't be used in C code/headers; Use + // + // #define [ or ULL() for 64-bit constants + + #define ULL(x) x##ull + +#endif // __ASSEMBLER__ + +#endif // __FAPI_SBE_COMMON_H -- cgit v1.2.1