From 97426a94d4d583a7ae6dca406462d52b2aff7660 Mon Sep 17 00:00:00 2001 From: William Bryan Date: Wed, 14 Sep 2016 17:06:18 -0500 Subject: Collect Nest DTS Average RTC:133842 Change-Id: I565a6f2e848652b7eddd3b319f9c3a411913074a Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/29804 Tested-by: FSP CI Jenkins Reviewed-by: Martha Broyles Reviewed-by: William A. Bryan --- src/gpe_err.h | 5 +- src/include/proc_shared.h | 13 ++- src/ipc_func_ids.h | 1 + src/occ_405/amec/amec_init.c | 2 +- src/occ_405/amec/amec_sys.h | 1 + src/occ_405/cmdh/cmdh_fsp_cmds.c | 4 +- src/occ_405/incl/occ_common.h | 1 + src/occ_405/main.c | 9 +- src/occ_405/occLinkInputFile | 1 + src/occ_405/occ_service_codes.h | 1 + src/occ_405/proc/proc_data.c | 182 ++++++++++++++++++++++++++++- src/occ_405/proc/proc_data.h | 10 +- src/occ_405/proc/proc_data_service_codes.h | 4 +- src/occ_405/rtls/rtls.h | 15 +-- src/occ_405/rtls/rtls_tables.c | 8 +- src/occ_405/sensor/sensor_enum.h | 1 + src/occ_405/sensor/sensor_info.c | 8 +- src/occ_405/sensor/sensor_query_list.c | 16 +-- src/occ_405/sensor/sensor_table.c | 5 +- src/occ_405/topfiles.mk | 1 + src/occ_gpe0/gpe_core_data.c | 50 +++++++- src/occ_gpe0/ipc_func_tables.c | 5 +- 22 files changed, 294 insertions(+), 49 deletions(-) diff --git a/src/gpe_err.h b/src/gpe_err.h index 292e2d5..c759993 100644 --- a/src/gpe_err.h +++ b/src/gpe_err.h @@ -1,11 +1,11 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: gpe_err.h $ */ +/* $Source: src/gpe_err.h $ */ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* Contributors Listed Below - COPYRIGHT 2011,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -45,5 +45,6 @@ // Core Data Errors #define GPE_RC_GET_CORE_DATA_FAILED 0x60 // Failed to collect core data +#define GPE_RC_GET_NEST_DTS_FAILED 0x61 // Failed to collect nest DTS temperatures #endif //_GPE_ERR_H diff --git a/src/include/proc_shared.h b/src/include/proc_shared.h index 1c66f25..ecee9c0 100644 --- a/src/include/proc_shared.h +++ b/src/include/proc_shared.h @@ -1,11 +1,11 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/include/proc_shared.h $ */ +/* $Source: src/include/proc_shared.h $ */ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* Contributors Listed Below - COPYRIGHT 2011,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -26,8 +26,9 @@ #ifndef _PROC_SHARED_H #define _PROC_SHARED_H -#include "gpe_export.h" #include "core_data.h" +#include "nest_dts.h" +#include "gpe_export.h" // Paramaters for gpe_get_core_data() @@ -38,4 +39,10 @@ typedef struct ipc_core_data_parms uint32_t core_num; } ipc_core_data_parms_t; +typedef struct ipc_nest_dts_parms +{ + GpeErrorStruct error; + NestDts_t data; +} ipc_nest_dts_parms_t; + #endif // _PROC_SHARED_H diff --git a/src/ipc_func_ids.h b/src/ipc_func_ids.h index b5d446f..733f22b 100644 --- a/src/ipc_func_ids.h +++ b/src/ipc_func_ids.h @@ -58,6 +58,7 @@ IPC_FUNCIDS_TABLE_START IPC_FUNC_ID(IPC_ST_GET_CORE_DATA_FUNCID) IPC_FUNC_ID(IPC_ST_SCOM_OPERATION) IPC_FUNC_ID(IPC_ST_GPE0_NOP) + IPC_FUNC_ID(IPC_ST_GET_NEST_DTS_FUNCID) IPC_FUNCIDS_ST_END(OCCHW_INST_ID_GPE0) //Functions that are only supported by GPE1 should be defined here diff --git a/src/occ_405/amec/amec_init.c b/src/occ_405/amec/amec_init.c index b89f038..f7b2005 100644 --- a/src/occ_405/amec/amec_init.c +++ b/src/occ_405/amec/amec_init.c @@ -254,7 +254,7 @@ void amec_init_gamec_struct(void) /* Code */ /*------------------------------------------------------------------------*/ - // Defaul the frequency range to something safe + // Default the frequency range to something safe g_amec->sys.fmin = 2000; g_amec->sys.fmax = 2000; g_amec->sys.max_speed = 1000; diff --git a/src/occ_405/amec/amec_sys.h b/src/occ_405/amec/amec_sys.h index 3a8f634..861410a 100755 --- a/src/occ_405/amec/amec_sys.h +++ b/src/occ_405/amec/amec_sys.h @@ -458,6 +458,7 @@ typedef struct sensor_t temp4mspeak; vectorSensor_t temp4mspeak_vector; sensor_t util4ms; + sensor_t tempnest; vectorSensor_t util4ms_vector; // Memory Summary Sensors diff --git a/src/occ_405/cmdh/cmdh_fsp_cmds.c b/src/occ_405/cmdh/cmdh_fsp_cmds.c index aff6c3d..f246046 100755 --- a/src/occ_405/cmdh/cmdh_fsp_cmds.c +++ b/src/occ_405/cmdh/cmdh_fsp_cmds.c @@ -1268,8 +1268,6 @@ errlHndl_t cmdh_amec_pass_through(const cmdh_fsp_cmd_t * i_cmd_ptr, cmdh_fsp_rsp_t * o_rsp_ptr) { errlHndl_t l_errlHndl = NULL; -/* TEMP -- NOT YET SUPPORTED (NEED AMEC) */ -#if 0 IPMIMsg_t l_IPMImsg; uint8_t l_rc = 0; uint16_t l_rsp_data_length = CMDH_FSP_RSP_DATA_SIZE; @@ -1361,7 +1359,7 @@ errlHndl_t cmdh_amec_pass_through(const cmdh_fsp_cmd_t * i_cmd_ptr, l_err_resp_ptr->log_id = 0; } } -#endif + return l_errlHndl; } diff --git a/src/occ_405/incl/occ_common.h b/src/occ_405/incl/occ_common.h index 978104f..2d22d61 100755 --- a/src/occ_405/incl/occ_common.h +++ b/src/occ_405/incl/occ_common.h @@ -258,6 +258,7 @@ enum ROLES_INITIALIZED = 0x04ff, SENSORS_INITIALIZED = 0x05ff, PROC_CORE_INITIALIZED = 0x06ff, + NEST_DTS_INITIALIZED = 0x0700, CENTAUR_INITIALIZED = 0x07ff, SLAVE_OCC_INITIALIZED = 0x08ff, WATCHDOG_INITIALIZED = 0x09ff, diff --git a/src/occ_405/main.c b/src/occ_405/main.c index 8c26e8f..594ba2e 100755 --- a/src/occ_405/main.c +++ b/src/occ_405/main.c @@ -779,11 +779,16 @@ void Main_thread_routine(void *private) // All SPIVID inits are done by Hostboot, remove this section. //Initialize structures for collecting core data. - //It needs to run before RTLoop start as pore initialization needs to be - // done before task to collect core data starts. + //It needs to run before RTLoop starts, as gpe request initialization + //needs to be done before task to collect core data starts. proc_core_init(); CHECKPOINT(PROC_CORE_INITIALIZED); + // Initialize structures for collecting nest dts data. + // Needs to run before RTL to initialize the gpe request + nest_dts_init(); + CHECKPOINT(NEST_DTS_INITIALIZED); + // Run slave OCC init on all OCCs. Master-only initialization will be // done after determining actual role. By default all OCCs are slave. slave_occ_init(); diff --git a/src/occ_405/occLinkInputFile b/src/occ_405/occLinkInputFile index 5322089..ec8e9c2 100644 --- a/src/occ_405/occLinkInputFile +++ b/src/occ_405/occLinkInputFile @@ -74,6 +74,7 @@ INPUT ( amec_amester.o rtls_tables.o rtls.o scom.o + sensor_info.o sensor_query_list.o sensor_table.o sensor.o diff --git a/src/occ_405/occ_service_codes.h b/src/occ_405/occ_service_codes.h index a4633b2..3556de5 100644 --- a/src/occ_405/occ_service_codes.h +++ b/src/occ_405/occ_service_codes.h @@ -194,6 +194,7 @@ enum occExtReasonCode ERC_PROC_CONTROL_INIT_FAILURE = 0x0064, ERC_PROC_PSTATE_INSTALL_FAILURE = 0x0065, ERC_PROC_CORE_DATA_EMPATH_ERROR = 0x0066, + ERC_NEST_DTS_GPE_REQUEST_CREATE_FAILURE = 0x0067, ERC_BCE_REQ_CREATE_READ_FAILURE = 0x0070, ERC_BCE_REQ_SCHED_READ_FAILURE = 0x0071, diff --git a/src/occ_405/proc/proc_data.c b/src/occ_405/proc/proc_data.c index 5d15805..0a0b528 100755 --- a/src/occ_405/proc/proc_data.c +++ b/src/occ_405/proc/proc_data.c @@ -36,6 +36,7 @@ #include "state.h" #include "proc_data_control.h" #include "cmdh_fsp.h" +#include "sensor.h" //Global array of core data buffers GPE_BUFFER(CoreData G_core_data[MAX_NUM_FW_CORES+NUM_CORE_DATA_DOUBLE_BUF+NUM_CORE_DATA_EMPTY_BUF]) = {{{0}}}; @@ -51,6 +52,12 @@ GPE_BUFFER(ipc_scom_op_t G_core_stat_scom_op); GPE_BUFFER(ipc_core_data_parms_t G_low_cores_data_parms); GPE_BUFFER(ipc_core_data_parms_t G_high_cores_data_parms); +// IPC Gpe request structure for gathering nest dts temps +GpeRequest G_nest_dts_gpe_req; + +// Global structure for nest dts temp collection +GPE_BUFFER(ipc_nest_dts_parms_t G_nest_dts_parms); + //We will have separate bulk core data structure for low and high cores. //Global low and high cores structures used for task data pointers. bulk_core_data_task_t G_low_cores = { @@ -65,6 +72,9 @@ bulk_core_data_task_t G_high_cores = { MAX_NUM_FW_CORES - 1, // High core to end with &G_core_data[MAX_NUM_FW_CORES+1] }; // Pointer to holding area for high coredata +//Keeps track of if Nest DTS data has been collected in last 4ms +bool G_nest_dts_data_valid = FALSE; + //AMEC needs to know when data for a core has been collected. uint32_t G_updated_core_mask = 0; @@ -292,10 +302,10 @@ void task_core_data( task_t * i_task ) // End Function Specification void proc_core_init( void ) { - errlHndl_t l_err = NULL; // Error handler - int l_rc = 0; // Return code - const trace_descriptor_array_t *l_trace = NULL; // Temporary trace descriptor - uint8_t i = 0; + errlHndl_t l_err = NULL; // Error handler + int l_rc = 0; // Return code + const trace_descriptor_array_t *l_trace = NULL; // Temporary trace descriptor + uint8_t i = 0; // Setup the array of CoreData pointers for( i = 0; i < MAX_NUM_FW_CORES; i++ ) @@ -430,6 +440,170 @@ CoreData * proc_get_bulk_core_data_ptr( const uint8_t i_occ_core_id ) } } +// Function Specification +// +// Name: task_nest_dts +// +// Description: Collect nest DTS readings and save off the average. +// +// End Function Specification +void task_nest_dts( task_t * i_task ) +{ + errlHndl_t l_err = NULL; // Error handler + int l_rc = 0; // Return code + ipc_nest_dts_parms_t * l_parms = (ipc_nest_dts_parms_t*)(G_nest_dts_gpe_req.cmd_data); + uint16_t l_avg = 0; + static bool L_scheduled = FALSE; + static bool L_idle_trace = FALSE; + static bool L_incomplete_trace = FALSE; + + do + { + //First, check to see if the previous GPE request still running + //A request is considered idle if it is not attached to any of the + //asynchronous request queues + if( !(async_request_is_idle(&G_nest_dts_gpe_req.request)) ) + { + //This should not happen unless there's a timing problem, trace once + if( !L_idle_trace ) + { + INTR_TRAC_ERR("task_nest_dts: request is not idle"); + L_idle_trace = TRUE; + } + break; + } + + // Don't update the dts temp sensor until we've run at least once + if (L_scheduled) + { + // Check that the previous request has finished and an error did not occur + if ((ASYNC_REQUEST_STATE_COMPLETE == G_nest_dts_gpe_req.request.completion_state) && + (0 == G_nest_dts_parms.error.error)) + { + if (l_parms->data.sensor0.fields.valid && + l_parms->data.sensor1.fields.valid && + l_parms->data.sensor2.fields.valid) + { + // Calculate the average of the 3 Nest DTS temps + l_avg = l_parms->data.sensor0.fields.reading + + l_parms->data.sensor1.fields.reading + + l_parms->data.sensor2.fields.reading; + l_avg = l_avg / 3; + + // Mark the data as valid and update sensor + G_nest_dts_data_valid = TRUE; + sensor_update(AMECSENSOR_PTR(TEMPNEST), l_avg); + } + else + { + // Mark the data as invalid + G_nest_dts_data_valid = FALSE; + } + } + else + { + // Async request not finished, mark data invalid + G_nest_dts_data_valid = FALSE; + + // Trace only once + if (!L_incomplete_trace) + { + INTR_TRAC_ERR("task_nest_dts: task did not complete in time or an error occurred [rc=0x%08X]", + G_nest_dts_parms.error.rc); + L_incomplete_trace = TRUE; + } + } + } + + // Schedule the nest DTS task + l_rc = gpe_request_schedule( &G_nest_dts_gpe_req ); + if( l_rc != 0 ) + { + // Error scheduling nest DTS task + INTR_TRAC_ERR("Failed to schedule nest DTS task [RC:0x%08X]", l_rc); + + /* + * @errortype + * @moduleid PROC_TASK_NEST_DTS_MOD + * @reasoncode SSX_GENERIC_FAILURE + * @userdata1 gpe_request_schedule return code + * @userdata4 OCC_NO_EXTENDED_RC + * @devdesc SSX IPC related failure + */ + l_err = createErrl( + PROC_TASK_NEST_DTS_MOD, //modId + SSX_GENERIC_FAILURE, //reasoncode + OCC_NO_EXTENDED_RC, //Extended reason code + ERRL_SEV_PREDICTIVE, //Severity + NULL, //Trace Buf + DEFAULT_TRACE_SIZE, //Trace Size + l_rc, //userdata1 + 0 //userdata2 + ); + + // commit error log + REQUEST_RESET(l_err); + break; + } + else + { + L_scheduled = TRUE; + } + + } while(0); +} + +// Function Specification +// +// Name: nest_dts_init +// +// Description: Setup the GpeRequest object for collecting nest DTS readings. +// +// End Function Specification +void nest_dts_init(void) +{ + errlHndl_t l_err = NULL; // Error handler + int l_rc = 0; // Return code + + //Initializes the GpeRequest object for nest dts temp collection + l_rc = gpe_request_create(&G_nest_dts_gpe_req, // GpeRequest for the task + &G_async_gpe_queue0, // Queue + IPC_ST_GET_NEST_DTS_FUNCID, // Function ID + &G_nest_dts_parms, // Task parameters + SSX_WAIT_FOREVER, // Timeout (none) + NULL, // Callback + NULL, // Callback arguments + 0 ); // Options + + + if( l_rc ) + { + // If we failed to create the GpeRequest then there is a serious problem. + MAIN_TRAC_ERR("nest_dts_init: Failure creating the nest dts GpeRequest. [RC=0x%08x]", l_rc ); + + /* + * @errortype + * @moduleid PROC_NEST_DTS_INIT_MOD + * @reasoncode SSX_GENERIC_FAILURE + * @userdata1 gpe_request_create return code + * @userdata4 ERC_NEST_DTS_GPE_REQUEST_CREATE_FAILURE + * @devdesc Failure to create nest dts GpeRequest object + */ + l_err = createErrl( + PROC_NEST_DTS_INIT_MOD, //ModId + SSX_GENERIC_FAILURE, //Reasoncode + ERC_NEST_DTS_GPE_REQUEST_CREATE_FAILURE, //Extended reason code + ERRL_SEV_PREDICTIVE, //Severity + NULL, //Trace Buf + DEFAULT_TRACE_SIZE, //Trace Size + l_rc, //Userdata1 + 0 //Userdata2 + ); + + CHECKPOINT_FAIL_AND_HALT(l_err); + } +} + #ifdef PROC_DEBUG // Function Specification // diff --git a/src/occ_405/proc/proc_data.h b/src/occ_405/proc/proc_data.h index e362267..796ed9b 100755 --- a/src/occ_405/proc/proc_data.h +++ b/src/occ_405/proc/proc_data.h @@ -5,7 +5,7 @@ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* Contributors Listed Below - COPYRIGHT 2011,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -106,6 +106,8 @@ extern uint32_t G_updated_core_mask; // External reference to empath error mask extern uint32_t G_empath_error_core_mask; +extern bool G_nest_dts_data_valid; + //Returns 0 if the specified core is not updated. Otherwise, returns none-zero. #define CORE_UPDATED(occ_core_id) \ ((CORE0_PRESENT_MASK >> occ_core_id) & G_updated_core_mask) @@ -124,6 +126,12 @@ void task_core_data( task_t * i_task ); //Initialize structures for collecting core data. void proc_core_init( void ) INIT_SECTION; +// Collect nest dts temperature sensors +void task_nest_dts( task_t * i_task ); + +// Initialize structures for collecting nest dts temps +void nest_dts_init( void ) INIT_SECTION; + //Returns a pointer to the most up-to-date bulk core data for the core //associated with the specified OCC core id. CoreData * proc_get_bulk_core_data_ptr( const uint8_t i_occ_core_id ); diff --git a/src/occ_405/proc/proc_data_service_codes.h b/src/occ_405/proc/proc_data_service_codes.h index 82c5e51..b9e0806 100755 --- a/src/occ_405/proc/proc_data_service_codes.h +++ b/src/occ_405/proc/proc_data_service_codes.h @@ -5,7 +5,7 @@ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* Contributors Listed Below - COPYRIGHT 2011,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -36,6 +36,8 @@ enum procModuleId PROC_GPST_INIT_FAILURE_MOD = PROC_COMP_ID | 0x03, PROC_ENABLE_PSTATES_SMH_MOD = PROC_COMP_ID | 0x04, PROC_PSTATE_KVM_SETUP_MOD = PROC_COMP_ID | 0x05, + PROC_TASK_NEST_DTS_MOD = PROC_COMP_ID | 0x06, + PROC_NEST_DTS_INIT_MOD = PROC_COMP_ID | 0x07, }; #endif /* #ifndef _PROC_DATA_SERVICE_CODES_H_ */ diff --git a/src/occ_405/rtls/rtls.h b/src/occ_405/rtls/rtls.h index 56849fb..a408b19 100755 --- a/src/occ_405/rtls/rtls.h +++ b/src/occ_405/rtls/rtls.h @@ -5,7 +5,7 @@ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* Contributors Listed Below - COPYRIGHT 2011,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -53,13 +53,14 @@ typedef enum { TASK_ID_DCOM_TX_OUTBX, TASK_ID_MISC_405_CHECKS, // Miscellaneous checks to be done by 405 TASK_ID_DCOM_PARSE_FW_MSG, - TASK_ID_AMEC_SLAVE, // AMEC SMH tasks - TASK_ID_AMEC_MASTER, // AMEC SMH tasks -// TASK_ID_CORE_DATA_CONTROL, -// TASK_ID_GPU_SM, // GPU State Machine - TASK_ID_DIMM_SM, // DIMM State Machine -// TASK_ID_MEM_DEADMAN, // Memory deadman timer + TASK_ID_AMEC_SLAVE, // AMEC SMH tasks + TASK_ID_AMEC_MASTER, // AMEC SMH tasks +// TASK_ID_CORE_DATA_CONTROL, +// TASK_ID_GPU_SM, // GPU State Machine + TASK_ID_DIMM_SM, // DIMM State Machine +// TASK_ID_MEM_DEADMAN, // Memory deadman timer TASK_ID_MEMORY_CONTROL, // Memory (centaur/dimm) control task + TASK_ID_NEST_DTS, TASK_END // This must always be the last enum in this list, // so that TASK_END always equals the last task ID + 1. } task_id_t; diff --git a/src/occ_405/rtls/rtls_tables.c b/src/occ_405/rtls/rtls_tables.c index 00ccf3d..ef42d90 100755 --- a/src/occ_405/rtls/rtls_tables.c +++ b/src/occ_405/rtls/rtls_tables.c @@ -1,11 +1,11 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/occ/rtls/rtls_tables.c $ */ +/* $Source: src/occ_405/rtls/rtls_tables.c $ */ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* Contributors Listed Below - COPYRIGHT 2011,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -50,6 +50,8 @@ #define FLAGS_LOW_CORES_DATA RTL_FLAG_MSTR | RTL_FLAG_NOTMSTR | RTL_FLAG_OBS | RTL_FLAG_ACTIVE | RTL_FLAG_MSTR_READY | RTL_FLAG_NO_APSS | RTL_FLAG_RUN | RTL_FLAG_APSS_NOT_INITD #define FLAGS_HIGH_CORES_DATA RTL_FLAG_MSTR | RTL_FLAG_NOTMSTR | RTL_FLAG_OBS | RTL_FLAG_ACTIVE | RTL_FLAG_MSTR_READY | RTL_FLAG_NO_APSS | RTL_FLAG_RUN | RTL_FLAG_APSS_NOT_INITD +#define FLAGS_NEST_DTS RTL_FLAG_MSTR | RTL_FLAG_NOTMSTR | RTL_FLAG_OBS | RTL_FLAG_ACTIVE | RTL_FLAG_MSTR_READY | RTL_FLAG_NO_APSS | RTL_FLAG_RUN | RTL_FLAG_APSS_NOT_INITD + // Start out with memory tasks not running, then start during transition to observation in memory_init() #define FLAGS_MEMORY_DATA RTL_FLAG_NONE #define FLAGS_MEMORY_CONTROL RTL_FLAG_NONE @@ -119,6 +121,7 @@ task_t G_task_table[TASK_END] = { // TEMP -- NOT YET IMPLEMENTED // { FLAGS_MEM_DEADMAN, task_mem_deadman, NULL }, // TASK_ID_MEM_DEADMAN { FLAGS_MEMORY_CONTROL, task_memory_control, (void *) &G_memory_control_task }, // TASK_ID_MEMORY_CONTROL + { FLAGS_NEST_DTS, task_nest_dts, NULL }, }; const uint8_t G_tick0_seq[] = { @@ -184,6 +187,7 @@ const uint8_t G_tick2_seq[] = { const uint8_t G_tick3_seq[] = { TASK_ID_APSS_START, + TASK_ID_NEST_DTS, //TASK_ID_GPU_SM, TASK_ID_APSS_CONT, TASK_ID_CORE_DATA_HIGH, diff --git a/src/occ_405/sensor/sensor_enum.h b/src/occ_405/sensor/sensor_enum.h index 9c9a1ba..3305cd3 100755 --- a/src/occ_405/sensor/sensor_enum.h +++ b/src/occ_405/sensor/sensor_enum.h @@ -125,6 +125,7 @@ enum e_gsid TEMP4MSP0, TEMP4MSP0PEAK, UTIL4MSP0, + TEMPNEST, VRFAN250USPROC, VRHOT250USPROC, diff --git a/src/occ_405/sensor/sensor_info.c b/src/occ_405/sensor/sensor_info.c index 6e4838d..82ab29b 100755 --- a/src/occ_405/sensor/sensor_info.c +++ b/src/occ_405/sensor/sensor_info.c @@ -26,9 +26,10 @@ #include // STATIC_ASSERT macro #include // For Sensor defines -#define AMEEFP_2MS_IN_HZ AMEFP(5,2) // 500 Hz -#define AMEEFP_250US_IN_HZ AMEFP(4,3) // 4000 Hz -#define AMEEFP_3S_IN_HZ AMEFP(333,-3) // 0.333 Hz +#define AMEEFP_2MS_IN_HZ AMEFP(5,2) // 500 Hz +#define AMEEFP_4MS_IN_HZ AMEFP(25,1) // 250 Hz +#define AMEEFP_250US_IN_HZ AMEFP(4,3) // 4000 Hz +#define AMEEFP_3S_IN_HZ AMEFP(333,-3) // 0.333 Hz #define AMEFP_SCALE_0_16384 AMEFP(610352,-8) // scalar so that digital 16384=100% // This will get the string when given the GSID @@ -230,6 +231,7 @@ const sensor_info_t G_sensor_info[] = SENSOR_INFO_T_ENTRY( TEMP4MSP0, "C\0", AMEC_SENSOR_TYPE_TEMP, AMEC_SENSOR_LOC_PROC, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), SENSOR_INFO_T_ENTRY( TEMP4MSP0PEAK, "C\0", AMEC_SENSOR_TYPE_TEMP, AMEC_SENSOR_LOC_PROC, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), SENSOR_INFO_T_ENTRY( UTIL4MSP0, "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_PROC, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1,-2) ), + SENSOR_INFO_T_ENTRY( TEMPNEST, "C\0", AMEC_SENSOR_TYPE_TEMP, AMEC_SENSOR_LOC_PROC, AMEC_SENSOR_NONUM, AMEEFP_4MS_IN_HZ, AMEFP( 1, 0) ), SENSOR_INFO_T_ENTRY( VRFAN250USPROC, "pin\0", AMEC_SENSOR_TYPE_TEMP, AMEC_SENSOR_LOC_VRM, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), SENSOR_INFO_T_ENTRY( VRHOT250USPROC, "pin\0", AMEC_SENSOR_TYPE_TEMP, AMEC_SENSOR_LOC_VRM, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), diff --git a/src/occ_405/sensor/sensor_query_list.c b/src/occ_405/sensor/sensor_query_list.c index b7cede7..ab3d0d7 100755 --- a/src/occ_405/sensor/sensor_query_list.c +++ b/src/occ_405/sensor/sensor_query_list.c @@ -5,7 +5,7 @@ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015 */ +/* Contributors Listed Below - COPYRIGHT 2015,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -36,12 +36,6 @@ #include // For Sensor defines #include // For args to command -/*****************************************************************************/ -// C Source File Includes -// Must be done to give access to the G_sensor_info sensor list -/*****************************************************************************/ -#include "sensor_info.c" - //*************************************************************************/ // Externs //*************************************************************************/ @@ -79,8 +73,6 @@ // End Function Specification void printSensorInfo(uint16_t i_gsid) { -/* TEMP -- NOT SUPPORTED (NEED AMEC/DCOM) */ -#if 0 // Initialize variable j and k with NULL and then // point to sensor to avoid compilation error when SNSR_DEBUG is not // defined. j and k are only used with SNSR_DBG which is no-op statement @@ -112,7 +104,6 @@ void printSensorInfo(uint16_t i_gsid) (uint32_t)k->mini_sensor, (NULL != j) ? *j : 0 ); -#endif } // Function Specification @@ -147,8 +138,7 @@ void printAllSensors(void) errlHndl_t querySensorList(const querySensorListArg_t * i_argPtr) { errlHndl_t l_err = NULL; -/* TEMP -- NOT SUPPORTED ( NEED AMEC/DCOM ) */ -#if 0 + if (i_argPtr != NULL) { uint16_t i_startGsid = i_argPtr->i_startGsid; @@ -276,6 +266,6 @@ errlHndl_t querySensorList(const querySensorListArg_t * i_argPtr) 0 // UserData 2 ); } -#endif + return l_err; } diff --git a/src/occ_405/sensor/sensor_table.c b/src/occ_405/sensor/sensor_table.c index f8fe271..6b8ed5a 100755 --- a/src/occ_405/sensor/sensor_table.c +++ b/src/occ_405/sensor/sensor_table.c @@ -315,6 +315,7 @@ const sensor_ptr_t G_amec_sensor_list[] = SENSOR_PTR( TEMP4MSP0, &g_amec_sys.proc[0].temp4ms), SENSOR_PTR( TEMP4MSP0PEAK, &g_amec_sys.proc[0].temp4mspeak), SENSOR_PTR( UTIL4MSP0, &g_amec_sys.proc[0].util4ms), + SENSOR_PTR( TEMPNEST, &g_amec_sys.proc[0].tempnest), SENSOR_PTR( VRFAN250USPROC, &g_amec_sys.sys.vrfan250usproc), SENSOR_PTR( VRHOT250USPROC, &g_amec_sys.sys.vrhot250usproc), @@ -396,7 +397,8 @@ STATIC_ASSERT( (MAX_AMEC_SENSORS < (sizeof(G_amec_sensor_list)/sizeof(sensor_p // Mini-Sensor Pointer Table // ---------------------- // - Indexed by GSID -// - Resident in initSection of SRAM, and will be deleted after sensor init +// - If an initSection is utilized, this will reside there and will be +// deleted after sensor init // - Must contain every sensor in enum, or STATIC_ASSERT will give compile // failure. // - Pointers to mini-sensors can be NULL, but they must still be in array. @@ -465,6 +467,7 @@ const minisensor_ptr_t G_amec_mini_sensor_list[] INIT_SECTION = MINI_SENSOR_PTR( TEMP4MSP0, &G_dcom_slv_outbox_tx.temp4msp0), MINI_SENSOR_PTR( TEMP4MSP0PEAK, &G_dcom_slv_outbox_tx.temp4msp0peak), MINI_SENSOR_PTR( UTIL4MSP0, &G_dcom_slv_outbox_tx.util4msp0), + MINI_SENSOR_PTR( TEMPNEST, NULL), MINI_SENSOR_PTR( VRFAN250USPROC, &G_dcom_slv_outbox_tx.vrfan250usproc), MINI_SENSOR_PTR( VRHOT250USPROC, NULL), diff --git a/src/occ_405/topfiles.mk b/src/occ_405/topfiles.mk index 54a09fd..aa397de 100644 --- a/src/occ_405/topfiles.mk +++ b/src/occ_405/topfiles.mk @@ -80,6 +80,7 @@ TOP-C-SOURCES = amec/amec_analytics.c \ rtls/rtls_tables.c \ rtls/rtls.c \ scom.c \ + sensor/sensor_info.c \ sensor/sensor_query_list.c \ sensor/sensor_table.c \ sensor/sensor.c \ diff --git a/src/occ_gpe0/gpe_core_data.c b/src/occ_gpe0/gpe_core_data.c index d4b56c5..d8f6983 100644 --- a/src/occ_gpe0/gpe_core_data.c +++ b/src/occ_gpe0/gpe_core_data.c @@ -1,11 +1,11 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/occ_gpe0/core_data.c $ */ +/* $Source: src/occ_gpe0/gpe_core_data.c $ */ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015 */ +/* Contributors Listed Below - COPYRIGHT 2015,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -28,6 +28,7 @@ #include "gpe_err.h" #include "gpe_util.h" #include "proc_shared.h" +#include "nest_dts.h" /* * Function Specifications: @@ -44,8 +45,6 @@ * * End Function Specification */ - - void gpe_get_core_data(ipc_msg_t* cmd, void* arg) { uint32_t rc; // return code @@ -74,3 +73,46 @@ void gpe_get_core_data(ipc_msg_t* cmd, void* arg) } } + + +/* + * Function Specifications: + * + * Name: gpe_get_nest_dts + * + * Description: Get the 3 NEST DTS sensor readings + * + * Inputs: cmd is a pointer to IPC msg's cmd and cmd_data struct + * + * Outputs: error: sets rc, address, and ffdc in the cmd_data's + * GpeErrorStruct + * + * End Function Specification + */ +void gpe_get_nest_dts(ipc_msg_t* cmd, void* arg) +{ + uint32_t rc; // return code + ipc_async_cmd_t *async_cmd = (ipc_async_cmd_t*)cmd; + ipc_nest_dts_parms_t *args = (ipc_nest_dts_parms_t*) async_cmd->cmd_data; + + args->error.error = 0; + args->error.ffdc = 0; + + rc = get_nest_dts(&args->data); // NestDts_t* + + if(rc) + { + PK_TRACE("gpe_get_nest_dts: get_nest_dts failed, rc = 0x%08x", rc); + gpe_set_ffdc(&(args->error), 0x00, + GPE_RC_GET_NEST_DTS_FAILED, rc); + } + + // send back a response, IPC success even if ffdc/rc are non zeros + rc = ipc_send_rsp(cmd, IPC_RC_SUCCESS); + if(rc) + { + PK_TRACE("gpe_get_nest_dts: Failed to send response back. Halting GPE0", rc); + gpe_set_ffdc(&(args->error), 0x00, GPE_RC_IPC_SEND_FAILED, rc); + pk_halt(); + } +} diff --git a/src/occ_gpe0/ipc_func_tables.c b/src/occ_gpe0/ipc_func_tables.c index 7b4c8a1..d5085ff 100644 --- a/src/occ_gpe0/ipc_func_tables.c +++ b/src/occ_gpe0/ipc_func_tables.c @@ -5,7 +5,7 @@ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015 */ +/* Contributors Listed Below - COPYRIGHT 2015,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -33,6 +33,7 @@ void apss_start_pwr_meas_read(ipc_msg_t* cmd, void* arg); void apss_continue_pwr_meas_read(ipc_msg_t* cmd, void* arg); void apss_complete_pwr_meas_read(ipc_msg_t* cmd, void* arg); void gpe_get_core_data(ipc_msg_t* cmd, void* arg); +void gpe_get_nest_dts(ipc_msg_t* cmd, void* arg); void ipc_scom_operation(ipc_msg_t* cmd, void* arg); @@ -69,7 +70,7 @@ IPC_HANDLER(apss_complete_pwr_meas_read, 0) // 5 - IPC_ST_APSS_COMPLETE_PWR_MEA IPC_HANDLER(gpe_get_core_data, 0) // 6 - IPC_ST_GET_CORE_DATA_FUNCID IPC_HANDLER(ipc_scom_operation, 0) // 7 - IPC_ST_SCOM_OPERATION IPC_HANDLER(gpe0_nop, 0) // 8 - IPC_ST_GPE0_NOP -IPC_HANDLER_DEFAULT // 9 +IPC_HANDLER(gpe_get_nest_dts, 0) // 9 - IPC_ST_GET_NEST_DTS_FUNCID IPC_HANDLER_DEFAULT // 10 IPC_HANDLER_DEFAULT // 11 IPC_HANDLER_DEFAULT // 12 -- cgit v1.2.1