Skip to content

Commit

Permalink
WOF: Function to calculate the Active Quad step number
Browse files Browse the repository at this point in the history
Change-Id: I3acafe872623838fa2ad16e8c85288dddb275fb5
RTC: 130216
Depends-on: I2249777134608d9f79bdc85692a3acbf7907c3f5
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/34657
Reviewed-by: William A. Bryan <wilbryan@us.ibm.com>
Tested-by: William A. Bryan <wilbryan@us.ibm.com>
  • Loading branch information
aalugore authored and wilbryan committed Feb 1, 2017
1 parent 009f439 commit 4d6a999
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 5 deletions.
38 changes: 38 additions & 0 deletions src/occ_405/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,44 @@ void read_wof_header(void)
memcpy(&G_wof_header, &(l_temp_bce_buff.data[pad]), sizeof(wof_header_data_t));


// Make sure the header is reporting a valid number of quads i.e. 1 or 6
if( (G_wof_header.active_quads_size != ACTIVE_QUAD_SZ_MIN) &&
(G_wof_header.active_quads_size != ACTIVE_QUAD_SZ_MAX) )
{
CMDH_TRAC_ERR("read_wof_header: Invalid number of active quads!"
" Expected: 1 or 6, Actual %d",
G_wof_header.active_quads_size );

/*
* @errortype
* @moduleid READ_WOF_HEADER
* @reasoncode INVALID_ACTIVE_QUAD_COUNT
* @userdata1 Reported active quad count
* @devdesc Read an invalid number of active quads
*/
l_reasonCode = INVALID_ACTIVE_QUAD_COUNT;
l_extReasonCode = ERC_WOF_QUAD_COUNT_FAILURE;
errlHndl_t l_errl = createErrl(READ_WOF_HEADER, //modId
INVALID_ACTIVE_QUAD_COUNT, //reasoncode
ERC_WOF_QUAD_COUNT_FAILURE, //Extended reason code
ERRL_SEV_UNRECOVERABLE, //Severity
NULL, //Trace Buf
0, //Trace Size
G_wof_header.active_quads_size, //userdata1
0); //userdata2

// Callout firmware
addCalloutToErrl(l_errl,
ERRL_CALLOUT_TYPE_COMPONENT_ID,
ERRL_COMPONENT_ID_FIRMWARE,
ERRL_CALLOUT_PRIORITY_HIGH);

// Commit error log
commitErrl(&l_errl);

// We were unable to get the active quad count. Do not run wof algo.
G_run_wof_main = false;
}


}while( 0 );
Expand Down
4 changes: 4 additions & 0 deletions src/occ_405/occ_service_codes.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ enum occReasonCode
SSX_GENERIC_FAILURE = 0x17,
/// Failure to handshake with an external fw entity (HB, FSP, PHYP, etc)
EXTERNAL_INTERFACE_FAILURE = 0x18,
/// Incorrect number of active quads reported
INVALID_ACTIVE_QUAD_COUNT = 0x19,
/// VRM reached error threshold (VR_HOT asserted)
VRM_ERROR_TEMP = 0x20,
/// VR_FAN - AVS Bus over-temperature reported
Expand Down Expand Up @@ -240,6 +242,8 @@ enum occExtReasonCode
ERC_PGPE_SUSPEND_FAILURE = 0x00B6,
ERC_PGPE_CLIP_FAILURE = 0x00B7,
ERC_PGPE_PPMR_OPPB_SIZE_MISMATCH = 0x00B8,

ERC_WOF_QUAD_COUNT_FAILURE = 0x00C0,
};

// Error log Module Ids
Expand Down
19 changes: 18 additions & 1 deletion src/occ_405/wof/wof.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void wof_main(void)


/**
* calculate_step
* calculate_step_from_start
*
* Description: Calculates the step number for the current VDN/VDD
*
Expand Down Expand Up @@ -135,3 +135,20 @@ uint16_t calculate_step_from_start(uint16_t i_ceff_vdx,

return l_current_step;
}


/**
* calc_quad_step_from_start
*
* Description: Calculates the step number for the current number
* of active quads
*
* Param[in]: i_num_active_quads - The current number of active quads.
*
* Return: The calculated step for current active quads
*/
uint8_t calc_quad_step_from_start( uint8_t i_num_active_quads )
{
return (G_wof_header.active_quads_size == ACTIVE_QUAD_SZ_MIN) ? 0 :
(i_num_active_quads - 1);
}
13 changes: 9 additions & 4 deletions src/occ_405/wof/wof.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
// Define
//******************************************************************************
#define MIN_BCE_REQ_SIZE 256

#define ACTIVE_QUAD_SZ_MIN 1
#define ACTIVE_QUAD_SZ_MAX 6

typedef struct __attribute__ ((packed))
{
Expand Down Expand Up @@ -67,8 +68,12 @@ typedef struct
void wof_main( void );

uint16_t calculate_step_from_start( uint16_t i_ceff_vdx,
uint8_t i_step_size,
uint8_t i_min_step,
uint8_t i_max_step );
uint8_t i_step_size,
uint8_t i_min_step,
uint8_t i_max_step );

uint8_t calc_quad_step_from_start( uint8_t i_num_active_quads );



#endif

0 comments on commit 4d6a999

Please sign in to comment.