diff options
author | Andres Lugo-Reyes <aalugore@us.ibm.com> | 2017-05-16 16:18:02 -0500 |
---|---|---|
committer | William A. Bryan <wilbryan@us.ibm.com> | 2017-05-31 16:10:07 -0400 |
commit | 2f8acbd71ab64502eba0d67c8b3e0ce9d23be53d (patch) | |
tree | 9093042519a29e002a4e68ed6bba7516f6202fd7 /src | |
parent | c48de6ff1191fa3980b4c873758b9d20a425320e (diff) | |
download | talos-occ-2f8acbd71ab64502eba0d67c8b3e0ce9d23be53d.tar.gz talos-occ-2f8acbd71ab64502eba0d67c8b3e0ce9d23be53d.zip |
WOF: Implement wof debug commands
-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>
Diffstat (limited to 'src')
-rw-r--r-- | src/occ_405/amec/amec_init.c | 4 | ||||
-rwxr-xr-x | src/occ_405/cmdh/cmdh_dbug_cmd.c | 8 | ||||
-rwxr-xr-x | src/occ_405/cmdh/cmdh_fsp_cmds.c | 97 | ||||
-rwxr-xr-x | src/occ_405/cmdh/cmdh_fsp_cmds.h | 26 | ||||
-rwxr-xr-x | src/occ_405/main.c | 136 | ||||
-rw-r--r-- | src/occ_405/wof/wof.c | 3 |
6 files changed, 129 insertions, 145 deletions
diff --git a/src/occ_405/amec/amec_init.c b/src/occ_405/amec/amec_init.c index ab7862e..9e4f623 100644 --- a/src/occ_405/amec/amec_init.c +++ b/src/occ_405/amec/amec_init.c @@ -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 diff --git a/src/occ_405/cmdh/cmdh_dbug_cmd.c b/src/occ_405/cmdh/cmdh_dbug_cmd.c index 7b92a83..2015ac8 100755 --- a/src/occ_405/cmdh/cmdh_dbug_cmd.c +++ b/src/occ_405/cmdh/cmdh_dbug_cmd.c @@ -5,7 +5,7 @@ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2016 */ +/* Contributors Listed Below - COPYRIGHT 2015,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -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: @@ -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: diff --git a/src/occ_405/cmdh/cmdh_fsp_cmds.c b/src/occ_405/cmdh/cmdh_fsp_cmds.c index 1e1da84..d378643 100755 --- a/src/occ_405/cmdh/cmdh_fsp_cmds.c +++ b/src/occ_405/cmdh/cmdh_fsp_cmds.c @@ -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; @@ -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 // @@ -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 @@ -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; } @@ -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: @@ -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: diff --git a/src/occ_405/cmdh/cmdh_fsp_cmds.h b/src/occ_405/cmdh/cmdh_fsp_cmds.h index 14f364d..b7a13cd 100755 --- a/src/occ_405/cmdh/cmdh_fsp_cmds.h +++ b/src/occ_405/cmdh/cmdh_fsp_cmds.h @@ -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 @@ -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, @@ -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. @@ -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 //--------------------------------------------------------- diff --git a/src/occ_405/main.c b/src/occ_405/main.c index da41d9c..9b13641 100755 --- a/src/occ_405/main.c +++ b/src/occ_405/main.c @@ -501,28 +501,13 @@ void create_tlb_entry(uint32_t address, uint32_t size) void read_wof_header(void) { int l_ssxrc = SSX_OK; - uint32_t l_reasonCode = 0; - uint32_t l_extReasonCode = OCC_NO_EXTENDED_RC; - uint32_t userdata1 = 0; - uint32_t userdata2 = 0; - - // Skip reading wof header until WOF is enabled - // TODO RTC: 131186 - remove when WOF is up - g_amec->wof.wof_disabled |= WOF_RC_DRIVER_WOF_DISABLED; - - if( g_amec->wof.wof_disabled ) - { - MAIN_TRAC_INFO("WOF has not been enabled. Skipping read_wof_header"); - return; - } - + bool l_error = false; MAIN_TRAC_INFO("read_wof_header() 0x%08X", G_pgpe_header.wof_tables_addr); -#ifdef WOF_PGPE_SUPPORT // Read active quads address, wof tables address, and wof tables len g_amec->wof.req_active_quads_addr = G_pgpe_header.requested_active_quad_sram_addr; - g_amec->wof.vfrt_tbls_main_mem_addr = G_pgpe_header.wof_tables_addr; + g_amec->wof.vfrt_tbls_main_mem_addr = PPMR_ADDRESS_HOMER+WOF_TABLES_OFFSET; g_amec->wof.vfrt_tbls_len = G_pgpe_header.wof_tables_length; g_amec->wof.pgpe_wof_state_addr = G_pgpe_header.wof_state_address; g_amec->wof.pstate_tbl_sram_addr = G_pgpe_header.occ_pstate_table_sram_addr; @@ -532,20 +517,9 @@ void read_wof_header(void) g_amec->wof.quad_state_1_addr = g_amec->wof.quad_state_0_addr + sizeof(uint64_t); //skip quad state 0 -#else - // No WOF PGPE support. Hard code addresses and externalize to amester - g_amec->wof.quad_state_0_addr = G_pgpe_header.beacon_sram_addr + sizeof(uint32_t); - g_amec->wof.quad_state_1_addr = g_amec->wof.quad_state_0_addr + sizeof(uint64_t); - g_amec->wof.pgpe_wof_state_addr = g_amec->wof.quad_state_1_addr + sizeof(uint64_t); - g_amec->wof.req_active_quads_addr = g_amec->wof.pgpe_wof_state_addr + sizeof(uint64_t)+7; - g_amec->wof.vfrt_tbls_main_mem_addr = PPMR_ADDRESS_HOMER+WOF_TABLES_OFFSET; - g_amec->wof.pstate_tbl_sram_addr = PSTATE_TBL_ADDR; - // Set some of the fields in the pgpe header struct for next set of calcs G_pgpe_header.wof_tables_addr = g_amec->wof.vfrt_tbls_main_mem_addr; -#endif - if (G_pgpe_header.wof_tables_addr != 0 && G_pgpe_header.wof_tables_addr%128 == 0) { @@ -557,27 +531,17 @@ void read_wof_header(void) // Create request l_ssxrc = bce_request_create(&l_wof_header_req, // block copy object &G_pba_bcde_queue, // main to sram copy engine - G_pgpe_header.wof_tables_addr, // mainstore address + g_amec->wof.vfrt_tbls_main_mem_addr,// mainstore address (uint32_t) &G_temp_bce_buff, // SRAM start address - MIN_BCE_REQ_SIZE, // size of copy - SSX_WAIT_FOREVER, // no timeout - NULL, // no call back - NULL, // no call back args - ASYNC_REQUEST_BLOCKING);// blocking request + MIN_BCE_REQ_SIZE, // size of copy + SSX_WAIT_FOREVER, // no timeout + NULL, // no call back + NULL, // no call back args + ASYNC_REQUEST_BLOCKING); // blocking request if(l_ssxrc != SSX_OK) { MAIN_TRAC_ERR("read_wof_header: BCDE request create failure rc=[%08X]", -l_ssxrc); - /* - * @errortype - * @moduleid READ_WOF_HEADER - * @reasoncode SSX_GENERIC_FAILURE - * @userdata1 RC for BCE block-copy engine - * @userdata4 ERC_BCE_REQUEST_CREATE_FAILURE - * @devdesc Failed to create BCDE request - */ - l_reasonCode = SSX_GENERIC_FAILURE; - l_extReasonCode = ERC_BCE_REQUEST_CREATE_FAILURE; - userdata1 = -l_ssxrc; + l_error = TRUE; break; } @@ -586,17 +550,7 @@ void read_wof_header(void) if(l_ssxrc != SSX_OK) { MAIN_TRAC_ERR("read_wof_header: BCE request schedule failure rc=[%08X]", -l_ssxrc); - /* - * @errortype - * @moduleid READ_WOF_HEADER - * @reasoncode SSX_GENERIC_FAILURE - * @userdata1 RC for BCE block-copy engine - * @userdata4 ERC_BCE_REQUEST_SCHEDULE_FAILURE - * @devdesc Failed to read WOF data using BCDE - */ - l_reasonCode = SSX_GENERIC_FAILURE; - l_extReasonCode = ERC_BCE_REQUEST_SCHEDULE_FAILURE; - userdata1 = -l_ssxrc; + l_error = TRUE; break; } @@ -605,29 +559,7 @@ void read_wof_header(void) G_temp_bce_buff.data, sizeof(wof_header_data_t)); -#ifndef WOF_PGPE_SUPPORT - // No WOF_PGPE_SUPPORT. Hard code the values - // Taken from P9_Power_management_HcodeHWP_spec.pdf - // Version 0.50 - g_amec->wof.version = 1; - g_amec->wof.vfrt_block_size = 256; - g_amec->wof.vfrt_blck_hdr_sz = 8; - g_amec->wof.vfrt_data_size = 1; - g_amec->wof.active_quads_size = 6; - g_amec->wof.core_count = 24; - g_amec->wof.vdn_start = 2500; - g_amec->wof.vdn_step = 1000; - g_amec->wof.vdn_size = 8; - g_amec->wof.vdd_start = 0; - g_amec->wof.vdd_step = 500; - g_amec->wof.vdd_size = 21; - g_amec->wof.vratio_start = 409; - g_amec->wof.vratio_step = 417; - g_amec->wof.vratio_size = 24; - g_amec->wof.fratio_start = 10000; - g_amec->wof.fratio_step = 1000; - g_amec->wof.fratio_size = 5; -#else + // verify the validity of the magic number uint32_t magic_number = in32(G_pgpe_header.wof_tables_addr); MAIN_TRAC_INFO("read_wof_header() Magic No: 0x%08X", magic_number); @@ -640,17 +572,7 @@ void read_wof_header(void) MAIN_TRAC_ERR("read_wof_header: Invalid number of active quads!" " Expected: 1 or 6, Actual %d, WOF disabled", G_wof_header.active_quads_size ); - /* - * @errortype - * @moduleid READ_WOF_HEADER - * @reasoncode INVALID_ACTIVE_QUAD_COUNT - * @userdata1 Reported active quad count - * @userdata4 ERC_WOF_QUAD_COUNT_FAILURE - * @devdesc Read an invalid number of active quads - */ - l_reasonCode = INVALID_ACTIVE_QUAD_COUNT; - l_extReasonCode = ERC_WOF_QUAD_COUNT_FAILURE; - userdata1 = G_wof_header.active_quads_size; + l_error = TRUE; break; } } @@ -658,18 +580,7 @@ void read_wof_header(void) { MAIN_TRAC_ERR("read_wof_header: Invalid WOF Magic number. Address[0x%08X], Magic Number[0x%08X], WOF disabled", G_pgpe_header.wof_tables_addr, magic_number); - /* @ - * @errortype - * @moduleid READ_WOF_HEADER - * @reasoncode INVALID_MAGIC_NUMBER - * @userdata1 WOF header sram address - * @userdata2 read WOF magic number - * @userdata4 OCC_NO_EXTENDED_RC - * @devdesc Invalid WOF magic number, WOF disabled - */ - l_reasonCode = INVALID_MAGIC_NUMBER; - userdata1 = G_pgpe_header.wof_tables_addr; - userdata2 = magic_number; + l_error = TRUE; break; } @@ -702,33 +613,14 @@ void read_wof_header(void) g_amec->wof.package_name_hi = G_wof_header.package_name_hi; g_amec->wof.package_name_lo = G_wof_header.package_name_lo; -#endif // Initialize wof init state to zero g_amec->wof.wof_init_state = WOF_DISABLED; }while( 0 ); // Check for errors and log, if any - if (l_reasonCode) + if ( l_error ) { - errlHndl_t l_errl = createErrl(READ_WOF_HEADER, //modId - l_reasonCode, //reasoncode - l_extReasonCode, //Extended reason code - ERRL_SEV_UNRECOVERABLE, //Severity - NULL, //Trace Buf - DEFAULT_TRACE_SIZE, //Trace Size - userdata1, //userdata1 - userdata2); //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 WOF header thus it should not be run. set_clear_wof_disabled( SET, WOF_RC_NO_WOF_HEADER_MASK ); } diff --git a/src/occ_405/wof/wof.c b/src/occ_405/wof/wof.c index db40119..9f759fc 100644 --- a/src/occ_405/wof/wof.c +++ b/src/occ_405/wof/wof.c @@ -1340,7 +1340,8 @@ void set_clear_wof_disabled( uint8_t i_action, static bool trace = true; if(trace) { - INTR_TRAC_INFO("WOF is disabled in the driver."); + INTR_TRAC_INFO("WOF is disabled in the driver. wof_disabled = " + "0x%08x", g_wof->wof_disabled ); trace = false; } break; |