Skip to content

Commit

Permalink
WOF: Implement wof debug commands
Browse files Browse the repository at this point in the history
-Command to set/clear bits in wof_disabled
-Command to hexdump g_amec->wof
-Purge some unused debug commands

Change-Id: Ib738f804863e9ab59625fe95569d76a6bcb0ecab
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/40655
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Martha Broyles <mbroyles@us.ibm.com>
Reviewed-by: William A. Bryan <wilbryan@us.ibm.com>
  • Loading branch information
aalugore authored and wilbryan committed May 31, 2017
1 parent c48de6f commit 2f8acbd
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 145 deletions.
4 changes: 4 additions & 0 deletions src/occ_405/amec/amec_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,10 @@ void amec_init_gamec_struct(void)
// Initialize the current_mem_pwr_ctl to indicate that memory power control is not supported
// update memory control registers only if new ips/default memory power control is different
g_amec->sys.current_mem_pwr_ctl = MEM_PWR_CTL_NO_SUPPORT;

// Initialize wof_disabled
g_amec->wof.wof_disabled = WOF_RC_DRIVER_WOF_DISABLED;

}

// Function Specification
Expand Down
8 changes: 1 addition & 7 deletions src/occ_405/cmdh/cmdh_dbug_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER OnChipController Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2015,2016 */
/* Contributors Listed Below - COPYRIGHT 2015,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -281,8 +281,6 @@ errlHndl_t cmdhDbugCmd(void * i_arg)
dbug_proc_data_dump(l_cmd_ptr, l_rsp_ptr);
break;

case DBUG_READ_SCOM: // Obsolete
case DBUG_PUT_SCOM: // Obsolete
case DBUG_POKE: // Can't allow in trusted
case DBUG_GET_TRACE:
case DBUG_CLEAR_TRACE:
Expand All @@ -292,10 +290,6 @@ errlHndl_t cmdhDbugCmd(void * i_arg)
case DBUG_MEM_PWR_CTL:
case DBUG_PERFCOUNT:
case DBUG_TEST_INTF:
case DBUG_SET_BUS_SPEED: // Obsolete
case DBUG_FAN_CONTROL: // Obsolete
case DBUG_IIC_READ: // Obsolete
case DBUG_IIC_WRITE: // Obsolete
case DBUG_GPIO_READ:
case DBUG_CALCULATE_MAX_DIFF:
case DBUG_FORCE_ELOG:
Expand Down
97 changes: 89 additions & 8 deletions src/occ_405/cmdh/cmdh_fsp_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#include "homer.h"
#include <centaur_data.h>
#include "cmdh_dbug_cmd.h"

#include "wof.h"
extern dimm_sensor_flags_t G_dimm_temp_expired_bitmap;
extern bool G_vrm_thermal_monitoring;

Expand Down Expand Up @@ -1087,6 +1087,85 @@ void cmdh_dbug_dump_ame_sensor(const cmdh_fsp_cmd_t * i_cmd_ptr,
G_rsp_status = l_rc;
}

// Function Specification
//
// Name: cmdh_dbug_wof_control
//
// Description: Sets the specified bit or clears all of them of wof_disabled
//
// End Function Specification
void cmdh_dbug_wof_control( const cmdh_fsp_cmd_t * i_cmd_ptr,
cmdh_fsp_rsp_t * o_rsp_ptr )
{
const cmdh_dbug_wof_control_cmd_t * l_cmd_ptr = (cmdh_dbug_wof_control_cmd_t*) i_cmd_ptr;
cmdh_dbug_wof_control_rsp_t * l_rsp_ptr = (cmdh_dbug_wof_control_rsp_t*) o_rsp_ptr;
uint8_t l_rc = ERRL_RC_SUCCESS;
uint16_t l_resp_data_length = sizeof(g_amec->wof.wof_disabled);

// Do sanity check on the function inputs
if ((NULL == l_cmd_ptr) || (NULL == l_rsp_ptr))
{
l_rc = ERRL_RC_INTERNAL_FAIL;
}
else
{
// Process action
if( l_cmd_ptr->action == SET )
{
g_amec->wof.wof_disabled |= l_cmd_ptr->wof_rc;
}
else if( l_cmd_ptr->action == CLEAR )
{
if(g_amec->wof.wof_disabled & WOF_RC_NO_WOF_HEADER_MASK)
{
TRAC_INFO("DEBUG - No WOF header present in memory."
" Cannot enable WOF!");
g_amec->wof.wof_disabled = WOF_RC_NO_WOF_HEADER_MASK;
}
else
{
g_amec->wof.wof_disabled = 0x00000000;
}
}
// Fill in response data
l_rsp_ptr->wof_disabled = g_amec->wof.wof_disabled;
}

TRAC_INFO("DEBUG - wof_disabled: 0x%08x", g_amec->wof.wof_disabled);

// Fill in response data length
if( l_rsp_ptr != NULL )
{
l_rsp_ptr->data_length[0] = CONVERT_UINT16_UINT8_HIGH(l_resp_data_length);
l_rsp_ptr->data_length[1] = CONVERT_UINT16_UINT8_LOW(l_resp_data_length);
}
G_rsp_status = l_rc;
return;
}

// Function Specification
//
// Name: cmdh_dbug_dump_wof_data
//
// Description: Dumps out the contents of g_amec_sys.wof
//
// End Function Specification
void cmdh_dbug_dump_wof_data( const cmdh_fsp_cmd_t * i_cmd_ptr,
cmdh_fsp_rsp_t * o_rsp_ptr)
{
uint16_t l_datalen = sizeof(amec_wof_t);

// Fill in response data
memcpy((void*)&(o_rsp_ptr->data[0]),
(void*)&(g_amec->wof),
l_datalen);

// Fill in response data length
o_rsp_ptr->data_length[0] = CONVERT_UINT16_UINT8_HIGH(l_datalen);
o_rsp_ptr->data_length[1] = CONVERT_UINT16_UINT8_LOW(l_datalen);
G_rsp_status = ERRL_RC_SUCCESS;
return;
}

// Function Specification
//
Expand Down Expand Up @@ -1138,7 +1217,6 @@ void cmdh_dbug_clear_ame_sensor(const cmdh_fsp_cmd_t * i_cmd_ptr,
G_rsp_status = l_rc;
}


// Function Specification
//
// Name: dbug_parse_cmd
Expand Down Expand Up @@ -1174,6 +1252,7 @@ void cmdh_dbug_cmd (const cmdh_fsp_cmd_t * i_cmd_ptr,
default:
// Trace the rest of the debug commands.
TRAC_INFO("Debug Command: Sub:0x%02x\n", l_sub_cmd);

break;
}

Expand Down Expand Up @@ -1210,8 +1289,14 @@ void cmdh_dbug_cmd (const cmdh_fsp_cmd_t * i_cmd_ptr,
chom_force_gen_log();
break;

case DBUG_READ_SCOM:
case DBUG_PUT_SCOM:
case DBUG_WOF_CONTROL:
cmdh_dbug_wof_control(i_cmd_ptr, o_rsp_ptr);
break;

case DBUG_DUMP_WOF_DATA:
cmdh_dbug_dump_wof_data(i_cmd_ptr, o_rsp_ptr);
break;

case DBUG_POKE:
case DBUG_SET_PEXE_EVENT:
case DBUG_DUMP_THEMAL:
Expand All @@ -1220,11 +1305,7 @@ void cmdh_dbug_cmd (const cmdh_fsp_cmd_t * i_cmd_ptr,
case DBUG_MEM_PWR_CTL:
case DBUG_PERFCOUNT:
case DBUG_TEST_INTF:
case DBUG_SET_BUS_SPEED:
case DBUG_FAN_CONTROL:
case DBUG_INJECT_ERRL:
case DBUG_IIC_READ:
case DBUG_IIC_WRITE:
case DBUG_GPIO_READ:
case DBUG_CALCULATE_MAX_DIFF:
case DBUG_FORCE_ELOG:
Expand Down
26 changes: 19 additions & 7 deletions src/occ_405/cmdh/cmdh_fsp_cmds.h
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,7 @@ typedef struct __attribute__ ((packed)) cmdh_reset_prep
// over the TMGT<->OCC interface.
typedef enum
{
DBUG_READ_SCOM = 0x01,
DBUG_PUT_SCOM = 0x02,
DBUG_DUMP_WOF_DATA = 0x01,
DBUG_GET_TRACE = 0x03,
DBUG_CLEAR_TRACE = 0x04,
// free = 0x05
Expand All @@ -364,11 +363,7 @@ typedef enum
DBUG_MEM_PWR_CTL = 0x0F,
DBUG_PERFCOUNT = 0x10,
DBUG_TEST_INTF = 0x11,
DBUG_SET_BUS_SPEED = 0x12,
DBUG_FAN_CONTROL = 0x13,
DBUG_INJECT_ERRL = 0x14,
DBUG_IIC_READ = 0x15,
DBUG_IIC_WRITE = 0x16,
DBUG_GPIO_READ = 0x17,
DBUG_FSP_ATTN = 0x18,
DBUG_CALCULATE_MAX_DIFF = 0x19,
Expand All @@ -385,7 +380,8 @@ typedef enum
DBUG_GEN_CHOM_LOG = 0x24,
DBUG_DUMP_APSS_DATA = 0x25,
DBUG_DUMP_AME_SENSOR = 0x26,
DBUG_CLEAR_AME_SENSOR = 0x27
DBUG_CLEAR_AME_SENSOR = 0x27,
DBUG_WOF_CONTROL = 0x28
} DBUG_CMD;

// Used by OCC tool to get trace, version 0.
Expand Down Expand Up @@ -536,6 +532,22 @@ typedef struct __attribute__ ((packed))
uint8_t checksum[CMDH_FSP_CHECKSUM_SIZE]; // Checksum
} cmdh_dbug_clear_ame_sensor_rsp_t;

// DBUG_WOF_CONTROL command struct
typedef struct __attribute__ ((packed))
{
struct cmdh_fsp_cmd_header; // Standard command header
uint8_t sub_cmd; // Debug sub-command
uint8_t action; // CLEAR(0) or SET(1)
uint32_t wof_rc; // Bit to set
} cmdh_dbug_wof_control_cmd_t;

// DBUG_WOF_CONTROL response struct
typedef struct __attribute__ ((packed))
{
struct cmdh_fsp_rsp_header;
uint32_t wof_disabled;
uint8_t checksum[CMDH_FSP_CHECKSUM_SIZE];
} cmdh_dbug_wof_control_rsp_t;
//---------------------------------------------------------
// Tunable Parameter Command
//---------------------------------------------------------
Expand Down

0 comments on commit 2f8acbd

Please sign in to comment.