diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/include/builtins.h | 55 | ||||
-rw-r--r-- | src/include/usr/trace/interface.H | 6 | ||||
-rw-r--r-- | src/include/util/pp/for_each.h | 159 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/build_winkle_images/build_winkle_images.C | 4 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/fapiHwpExecInitFile.C | 12 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/slave_sbe/slave_sbe.C | 7 |
6 files changed, 205 insertions, 38 deletions
diff --git a/src/include/builtins.h b/src/include/builtins.h index 7be919cca..1c07e8d04 100644 --- a/src/include/builtins.h +++ b/src/include/builtins.h @@ -1,30 +1,32 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/include/builtins.h $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2011 -// -// p1 -// -// Object Code Only (OCO) source materials -// Licensed Internal Code Source Materials -// IBM HostBoot Licensed Internal Code -// -// The source code for this program is not published or other- -// wise divested of its trade secrets, irrespective of what has -// been deposited with the U.S. Copyright Office. -// -// Origin: 30 -// -// IBM_PROLOG_END +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/builtins.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2011,2013 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* 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. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ #include <stdint.h> #ifndef _BUILTINS_H #define _BUILTINS_H +#include <util/pp/for_each.h> + #ifdef __cplusplus extern "C" { @@ -62,11 +64,18 @@ extern "C" #define SYMB_SECTION(x) __attribute__((section(#x))) /** - * Use of this macro will ensure a data structure is not padded + * Use of this macro will ensure a data structure is not padded */ #define PACKED __attribute__((packed)) /** + * Use of this macro will hide compile errors when a variable is not used, + * usually because it is used in debug / assert statements only. + */ +#define SUPPRESS_UNUSED_VARIABLE(...) \ + PREPROCESSOR_FOR_EACH((void),##__VA_ARGS__) + +/** * Compiler hint for branch conditions. "condition is likely to be true" */ #define likely(expr) __builtin_expect((expr),1) diff --git a/src/include/usr/trace/interface.H b/src/include/usr/trace/interface.H index d4e2c9398..3fc72646d 100644 --- a/src/include/usr/trace/interface.H +++ b/src/include/usr/trace/interface.H @@ -5,7 +5,7 @@ /* */ /* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2012 */ +/* COPYRIGHT International Business Machines Corp. 2011,2013 */ /* */ /* p1 */ /* */ @@ -41,6 +41,7 @@ /******************************************************************************/ // Includes /******************************************************************************/ +#include <builtins.h> #include <stdint.h> #include <trace/trace.H> // Internal function and struct definitions @@ -95,7 +96,8 @@ const uint32_t TRACE_FIELD = 0; //Indicates trace is field #else #ifndef HOSTBOOT_DEBUG -#define TRACDCOMP(des,printf_string,args...) do {} while(0) +#define TRACDCOMP(des,printf_string,args...) \ + SUPPRESS_UNUSED_VARIABLE(NULL, ##args) #define TRACDBIN(des,descString,address,length) do {} while(0) #else diff --git a/src/include/util/pp/for_each.h b/src/include/util/pp/for_each.h new file mode 100644 index 000000000..ed8c883a0 --- /dev/null +++ b/src/include/util/pp/for_each.h @@ -0,0 +1,159 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/util/pp/for_each.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2013 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* 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. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ +#ifndef __UTIL_PP_FOR_EACH_H +#define __UTIL_PP_FOR_EACH_H + +/** @file for_each.h + * + * Macros to support a for-each preprocessor directive. + * + * Ex. PREPROCESSOR_FOR_EACH( foo, a, b, c, 1, 2, 3) would expand to: + * foo(a); foo(b); foo(c); foo(1); foo(2); foo(3) + */ + + +// Recursive macros to expand the Nth parameter. +#define PREPROCESSOR_FOR_EACH_0(WHAT) +#define PREPROCESSOR_FOR_EACH_1(WHAT, VAL) WHAT(VAL) +#define PREPROCESSOR_FOR_EACH_2(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_1(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_3(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_2(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_4(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_3(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_5(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_4(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_6(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_5(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_7(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_6(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_8(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_7(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_9(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_8(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_10(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_9(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_11(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_10(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_12(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_11(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_13(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_12(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_14(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_13(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_15(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_14(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_16(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_15(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_17(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_16(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_18(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_17(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_19(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_18(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_20(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_19(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_21(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_20(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_22(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_21(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_23(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_22(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_24(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_23(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_25(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_24(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_26(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_25(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_27(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_26(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_28(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_27(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_29(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_28(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_30(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_29(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_31(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_30(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_32(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_31(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_33(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_32(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_34(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_33(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_35(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_34(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_36(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_35(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_37(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_36(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_38(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_37(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_39(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_38(WHAT, __VA_ARGS__) +#define PREPROCESSOR_FOR_EACH_40(WHAT, VAL, ...) \ + WHAT(VAL); PREPROCESSOR_FOR_EACH_39(WHAT, __VA_ARGS__) + +/** A list of _N tags in reversed order. + * + * This is used to count the number of va-arg parameters to the for-each. + */ +#define PREPROCESSOR_REVERSE_LIST_40 \ + _40, _39, _38, _37, _36, _35, _34, _33, _32, _31, \ + _30, _29, _28, _27, _26, _25, _24, _23, _22, _21, \ + _20, _19, _18, _17, _16, _15, _14, _13, _12, _11, \ + _10, _9, _8, _7, _6, _5, _4, _3, _2, _1, _0 + +/** Count the number of va_arg macros. + * + * Returns a tag from PREPROCESSOR_REVERSE_LIST_40, like _10, based on how + * many va-args there are. + */ +#define PREPROCESSOR_COUNT_N_(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \ + _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, \ + _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, \ + _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, \ + WHICH, ...) WHICH +/** Preprocessor redirection to PREPROCESSOR_COUNT_N_ */ +#define PREPROCESSOR_COUNT_N(...) PREPROCESSOR_COUNT_N_(__VA_ARGS__) + +/** Concatenates two keywords together to make a preprocessor tag */ +#define PREPROCESSOR_FOR_EACH_CAT(FN, COUNT) FN ## COUNT + +/* Preprocessor redirection to the proper FOR_EACH_N macro. */ +#define PREPROCESSOR_FOR_EACH_(FN, COUNT, WHAT, ...) \ + PREPROCESSOR_FOR_EACH_CAT(FN, COUNT)(WHAT,##__VA_ARGS__) + +/** Perform a preprocessor for-each operation. + * + * @param WHAT - Action to perform on each variable. + * @param ... - Variable arguments to perform actions on. + * + */ +#define PREPROCESSOR_FOR_EACH(WHAT, ...) \ + PREPROCESSOR_FOR_EACH_(PREPROCESSOR_FOR_EACH, \ + PREPROCESSOR_COUNT_N(0, ##__VA_ARGS__ , \ + PREPROCESSOR_REVERSE_LIST_40), \ + WHAT,##__VA_ARGS__) + +#endif 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 277470570..38aa4601e 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 @@ -394,8 +394,8 @@ void* call_host_build_winkle( void *io_pArgs ) // Continue, build SLW images TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, - "Got real mem buffer for 0x%08x cpu's = 0x%p", - MAX_POSSIBLE_PROCS_IN_P8_SYSTEM, + "Got real mem buffer for %d cpus = 0x%p", + P8_MAX_PROCS, l_pRealMemBase ); //Load the reference image from PNOR diff --git a/src/usr/hwpf/hwp/fapiHwpExecInitFile.C b/src/usr/hwpf/hwp/fapiHwpExecInitFile.C index 664cdd69b..146829704 100644 --- a/src/usr/hwpf/hwp/fapiHwpExecInitFile.C +++ b/src/usr/hwpf/hwp/fapiHwpExecInitFile.C @@ -77,6 +77,10 @@ extern "C" { +#ifndef SUPPRESS_UNUSED_VARIABLE +#define SUPPRESS_UNUSED_VARIABLE(...) +#endif + // -------------------------------------------------------------------- // enable minimal debug. This will trace: // Attr table, literal table, scoms, rows, and expressions being processed. @@ -86,7 +90,7 @@ extern "C" #ifdef HWPEXECINITFILE_DEBUG #define IF_DBG(_fmt_, _args_...) FAPI_IMP(_fmt_, ##_args_) #else -#define IF_DBG(_fmt_, _args_...) +#define IF_DBG(_fmt_, _args_...) SUPPRESS_UNUSED_VARIABLE(NULL, ##_args_) #endif // -------------------------------------------------------------------- @@ -98,7 +102,7 @@ extern "C" #ifdef HWPEXECINITFILE_MALLOC_DEBUG #define IF_MDBG(_fmt_, _args_...) FAPI_IMP(_fmt_, ##_args_) #else -#define IF_MDBG(_fmt_, _args_...) +#define IF_MDBG(_fmt_, _args_...) SUPPRESS_UNUSED_VARIABLE(NULL, ##_args_) #endif // -------------------------------------------------------------------- @@ -109,7 +113,7 @@ extern "C" #ifdef HWPEXECINITFILE_ATTR_DEBUG #define IF_ADBG(_fmt_, _args_...) FAPI_IMP(_fmt_, ##_args_) #else -#define IF_ADBG(_fmt_, _args_...) +#define IF_ADBG(_fmt_, _args_...) SUPPRESS_UNUSED_VARIABLE(NULL, ##_args_) #endif // -------------------------------------------------------------------- @@ -120,7 +124,7 @@ extern "C" #ifdef HWPEXECINITFILE_DEBUG2 #define IF_DBG2(_fmt_, _args_...) FAPI_INF(_fmt_, ##_args_) #else -#define IF_DBG2(_fmt_, _args_...) +#define IF_DBG2(_fmt_, _args_...) SUPPRESS_UNUSED_VARIABLE(NULL, ##_args_) #endif //****************************************************************************** diff --git a/src/usr/hwpf/hwp/slave_sbe/slave_sbe.C b/src/usr/hwpf/hwp/slave_sbe/slave_sbe.C index 1f13794ba..e96dd3ea5 100644 --- a/src/usr/hwpf/hwp/slave_sbe/slave_sbe.C +++ b/src/usr/hwpf/hwp/slave_sbe/slave_sbe.C @@ -133,7 +133,6 @@ void* call_proc_revert_sbe_mcs_setup(void *io_pArgs) //****************************************************************************** void* call_host_slave_sbe_config(void *io_pArgs) { - errlHndl_t l_errl = NULL; IStepError l_stepError; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, @@ -142,8 +141,6 @@ void* call_host_slave_sbe_config(void *io_pArgs) // execute proc_read_nest_freq.C // execute proc_setup_sbe_config.C - l_errl = NULL; // assignment to make the compiler happy - TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_host_slave_sbe_config exit" ); @@ -157,13 +154,11 @@ void* call_host_slave_sbe_config(void *io_pArgs) //****************************************************************************** void* call_host_sbe_start( void *io_pArgs ) { - errlHndl_t l_errl = NULL; IStepError l_stepError; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_host_sbe_start entry" ); // call proc_sbe_start.C - l_errl = NULL; // assignment to make the compiler happy TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_host_sbe_start exit" ); @@ -339,14 +334,12 @@ void* call_proc_check_slave_sbe_seeprom_complete( void *io_pArgs ) //****************************************************************************** void* call_proc_xmit_sbe(void *io_pArgs ) { - errlHndl_t l_errl = NULL; IStepError l_stepError; TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_proc_xmit_sbe entry" ); // call proc_xmit_sbe.C - l_errl = NULL; // assignment to make the compiler happy TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_proc_xmit_sbe exit" ); |