From 9db497dfa30d67c0496a13ce675f8561cc6bffd1 Mon Sep 17 00:00:00 2001 From: Greg Still Date: Sun, 18 Sep 2016 21:55:32 -0500 Subject: p9_pstates.h breakup - content needed by all platforms - cmeqm content created by p9_pstate_parameter_block for CME Hcode - occ content created by p9_pstate_parameter_block for OCC FW - pgpe content created by p9_pstate_parameter_block for PGPE Hcode - API definitions between PGPE Hcode and OCC FW including the current shared memory definition. - the IPC commands are update to better match OCC discussions - Addressed OCC FW<>PGPE Hcode review / Gerrit comments - Still have a HB and Jenkins fail with the p9_pm_utils. Cronus is fine. - Deleted ../hwp/lib/p9_pstate_parameter_block.C in deference to already merged ../hwp/pm/p9_pstate_parameter_block.C - Update IDDQ member names to be more descriptive to match WOF discussion - Remove endianess checks in p9_pm_utils.H Change-Id: I6ab884af08d5598da08bded1707b57c471f2f594 RTC: 163927 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/29915 Tested-by: Jenkins Server Tested-by: PPE CI Tested-by: Hostboot CI Reviewed-by: Christian R. Geddes Reviewed-by: RAHUL BATRA Reviewed-by: Jennifer A. Stofer Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/29916 Reviewed-by: Hostboot Team Tested-by: FSP CI Jenkins Reviewed-by: Sachin Gupta --- .../chips/p9/procedures/hwp/pm/p9_pm_utils.C | 69 ++++++++++++++++++++++ .../chips/p9/procedures/hwp/pm/p9_pm_utils.H | 46 ++------------- 2 files changed, 73 insertions(+), 42 deletions(-) (limited to 'src/import') diff --git a/src/import/chips/p9/procedures/hwp/pm/p9_pm_utils.C b/src/import/chips/p9/procedures/hwp/pm/p9_pm_utils.C index 87b0b88c..06a7db82 100644 --- a/src/import/chips/p9/procedures/hwp/pm/p9_pm_utils.C +++ b/src/import/chips/p9/procedures/hwp/pm/p9_pm_utils.C @@ -41,6 +41,75 @@ #include #include +/// Byte-reverse a 16-bit integer if on a little-endian machine + +uint16_t +revle16(const uint16_t i_x) +{ + uint16_t rx; + +#ifndef _BIG_ENDIAN + uint8_t* pix = (uint8_t*)(&i_x); + uint8_t* prx = (uint8_t*)(&rx); + + prx[0] = pix[1]; + prx[1] = pix[0]; +#else + rx = i_x; +#endif + + return rx; +} + +/// Byte-reverse a 32-bit integer if on a little-endian machine + +uint32_t +revle32(const uint32_t i_x) +{ + uint32_t rx; + +#ifndef _BIG_ENDIAN + uint8_t* pix = (uint8_t*)(&i_x); + uint8_t* prx = (uint8_t*)(&rx); + + prx[0] = pix[3]; + prx[1] = pix[2]; + prx[2] = pix[1]; + prx[3] = pix[0]; +#else + rx = i_x; +#endif + + return rx; +} + + +/// Byte-reverse a 64-bit integer if on a little-endian machine + +uint64_t +revle64(const uint64_t i_x) +{ + uint64_t rx; + +#ifndef _BIG_ENDIAN + uint8_t* pix = (uint8_t*)(&i_x); + uint8_t* prx = (uint8_t*)(&rx); + + prx[0] = pix[7]; + prx[1] = pix[6]; + prx[2] = pix[5]; + prx[3] = pix[4]; + prx[4] = pix[3]; + prx[5] = pix[2]; + prx[6] = pix[1]; + prx[7] = pix[0]; +#else + rx = i_x; +#endif + + return rx; +} + fapi2::ReturnCode p9_pm_glob_fir_trace( const fapi2::Target& i_target, const char* i_msg) diff --git a/src/import/chips/p9/procedures/hwp/pm/p9_pm_utils.H b/src/import/chips/p9/procedures/hwp/pm/p9_pm_utils.H index 101c3d8e..3ae5d3e7 100644 --- a/src/import/chips/p9/procedures/hwp/pm/p9_pm_utils.H +++ b/src/import/chips/p9/procedures/hwp/pm/p9_pm_utils.H @@ -29,7 +29,7 @@ // *HWP HWP Owner : Amit Kumar // *HWP Backup HWP Owner: Greg Still -// *HWP FW Owner : Bilicon Patil +// *HWP FW Owner : Prem Jha // *HWP Team : PM // *HWP Level : 1 // *HWP Consumed by : HS @@ -46,47 +46,9 @@ // Common macros //------------------------------------------------------------------------------ -#define SET_FIR_ACTION(b, x, y) \ - action_0.writeBit(x); \ - action_1.writeBit(y); - -#define SET_CHECK_STOP(b){SET_FIR_ACTION(b, 0, 0);} -#define SET_RECOV_ATTN(b){SET_FIR_ACTION(b, 0, 1);} -#define SET_RECOV_INTR(b){SET_FIR_ACTION(b, 1, 0);} -#define SET_MALF_ALERT(b){SET_FIR_ACTION(b, 1, 1);} -#define SET_FIR_MASKED(b){mask.setBit();} -#define CLEAR_FIR_MASK(b){mask.clearBit()} - - -/** - * @brief helper function to swizzle given input data - * @note swizles bytes to handle endianess issue. - */ -#if( __BYTE_ORDER == __BIG_ENDIAN ) - -// NOP if it is a big endian system -#define RevLe16(WORD) WORD -#define RevLe32(WORD) WORD -#define RevLe64(WORD) WORD - -#else -#define RevLe16(WORD) \ - ( (((WORD) >> 8) & 0x00FF) | (((WORD) << 8) & 0xFF00) ) - -#define RevLe32(WORD) \ - ( (((WORD) >> 24) & 0x000000FF) | (((WORD) >> 8) & 0x0000FF00) | \ - (((WORD) << 8) & 0x00FF0000) | (((WORD) << 24) & 0xFF000000) ) - -#define RevLe64(WORD) \ - ( (((WORD) >> 56) & 0x00000000000000FF) | \ - (((WORD) >> 40) & 0x000000000000FF00)| \ - (((WORD) >> 24) & 0x0000000000FF0000) | \ - (((WORD) >> 8) & 0x00000000FF000000) | \ - (((WORD) << 8) & 0x000000FF00000000) | \ - (((WORD) << 24) & 0x0000FF0000000000) | \ - (((WORD) << 40) & 0x00FF000000000000) | \ - (((WORD) << 56) & 0xFF00000000000000) ) -#endif +uint16_t revle16(const uint16_t i_x); +uint32_t revle32(const uint32_t i_x); +uint64_t revle64(const uint64_t i_x); //------------------------------------------------------------------------------ // Function prototype -- cgit v1.2.1