diff options
Diffstat (limited to 'src/occ_405/sensor')
-rw-r--r-- | src/occ_405/sensor/sensor_main_memory.c | 31 | ||||
-rw-r--r-- | src/occ_405/sensor/sensor_main_memory.h | 30 | ||||
-rwxr-xr-x | src/occ_405/sensor/sensor_query_list.c | 25 |
3 files changed, 54 insertions, 32 deletions
diff --git a/src/occ_405/sensor/sensor_main_memory.c b/src/occ_405/sensor/sensor_main_memory.c index 458c2dc..c0abbe2 100644 --- a/src/occ_405/sensor/sensor_main_memory.c +++ b/src/occ_405/sensor/sensor_main_memory.c @@ -5,7 +5,7 @@ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2017,2018 */ +/* Contributors Listed Below - COPYRIGHT 2017,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -52,19 +52,6 @@ // Main Memory Sensors - Private Defines/Structs/Globals //******************************************************************************/ -/** - * Main memory sensor struct. Represents one OCC sensor that should be copied - * to main memory. Uses bit fields to reduce memory usage. - */ -typedef struct __attribute__ ((packed)) -{ - uint16_t gsid; ///< Global Sensor ID - uint8_t smf_mode : 1; ///< Is sensor copied when SMF mode enabled? - uint8_t master_only : 1; ///< Is sensor only available from master OCC? - uint8_t valid : 1; ///< Is sensor valid (able to be copied)? - uint8_t enabled : 1; ///< Is sensor enabled (chosen to be copied)? - uint8_t struct_ver : 2; ///< See MM_SENSOR_NAMES_STRUCT_VERSION_VALUES -} main_mem_sensor_t; /** * Macro to build one main_mem_sensor_t instance. @@ -242,14 +229,6 @@ main_mem_sensor_t G_main_mem_sensors[] = MAIN_MEM_MEMORY_SENSORS (MEMSPM, false, false), }; -/** - * Number of main memory sensors (in G_main_mem_sensors). - * - * Note that some sensors might not be valid or enabled, and as a result they - * will not be copied to main memory. - */ -#define MAIN_MEM_SENSOR_COUNT (sizeof(G_main_mem_sensors) / sizeof(G_main_mem_sensors[0])) - /* * Check if Sensor Names Block is too small to hold all of the main memory * sensors. If so generate a compile-time error. @@ -455,14 +434,12 @@ uint32_t G_mm_sensor_readings_buf_addr; //****************************************************************************** -// Public Globals +// Public Globals (see description in header file) //****************************************************************************** -// See description in header file bool G_main_mem_sensors_initialized = false; -// See description in header file -bool G_main_mem_sensors_smf_mode_enabled = false; +bool G_smf_mode = false; //****************************************************************************** @@ -486,7 +463,7 @@ void mm_sensors_init_internals(void) main_mem_sensor_t * l_mm_sensor = &G_main_mem_sensors[l_index]; // Set valid field based on SMF mode and OCC role - if (G_main_mem_sensors_smf_mode_enabled && !l_mm_sensor->smf_mode) + if (G_smf_mode && !l_mm_sensor->smf_mode) { // SMF mode is enabled and sensor is not copied when in SMF mode l_mm_sensor->valid = false; diff --git a/src/occ_405/sensor/sensor_main_memory.h b/src/occ_405/sensor/sensor_main_memory.h index f989e13..8befbb0 100644 --- a/src/occ_405/sensor/sensor_main_memory.h +++ b/src/occ_405/sensor/sensor_main_memory.h @@ -5,7 +5,7 @@ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2017,2017 */ +/* Contributors Listed Below - COPYRIGHT 2017,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -60,7 +60,7 @@ * These buffers contain the dynamic sensor data, such as the current sample, * timestamp, and maximum value. The OCC alternates between the two buffers so * that one buffer is always complete and readable by OPAL. - * + * * For more information see the OCC Firmware Interface Specification document. */ @@ -235,6 +235,20 @@ typedef struct __attribute__ ((packed)) sizeof(mm_sensor_readings_full_t) : \ sizeof(mm_sensor_readings_counter_t)) +/** + * Main memory sensor struct. Represents one OCC sensor that should be copied + * to main memory. Uses bit fields to reduce memory usage. + */ +typedef struct __attribute__ ((packed)) +{ + uint16_t gsid; ///< Global Sensor ID + uint8_t smf_mode : 1; ///< Is sensor copied when SMF mode enabled? + uint8_t master_only : 1; ///< Is sensor only available from master OCC? + uint8_t valid : 1; ///< Is sensor valid (able to be copied)? + uint8_t enabled : 1; ///< Is sensor enabled (chosen to be copied)? + uint8_t struct_ver : 2; ///< See MM_SENSOR_NAMES_STRUCT_VERSION_VALUES +} main_mem_sensor_t; + //****************************************************************************** // Globals @@ -251,7 +265,17 @@ extern bool G_main_mem_sensors_initialized; * enabled only a subset of sensors will be copied to main memory. Default * value is false (not enabled). */ -extern bool G_main_mem_sensors_smf_mode_enabled; +extern bool G_smf_mode; + +extern main_mem_sensor_t G_main_mem_sensors[337]; + +/** + * Number of main memory sensors (in G_main_mem_sensors). + * + * Note that some sensors might not be valid or enabled, and as a result they + * will not be copied to main memory. + */ +#define MAIN_MEM_SENSOR_COUNT (sizeof(G_main_mem_sensors) / sizeof(G_main_mem_sensors[0])) //****************************************************************************** diff --git a/src/occ_405/sensor/sensor_query_list.c b/src/occ_405/sensor/sensor_query_list.c index 2cae2c7..3ac38d0 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,2016 */ +/* Contributors Listed Below - COPYRIGHT 2015,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -34,7 +34,8 @@ #include <sensor_service_codes.h> // sensor module ids #include <occ_service_codes.h> // sensor module ids #include <sensor.h> // For Sensor defines -#include <sensor_query_list.h> // For args to command +#include <sensor_query_list.h> // For args to command +#include <sensor_main_memory.h> //*************************************************************************/ // Externs @@ -55,6 +56,7 @@ //*************************************************************************/ // Globals //*************************************************************************/ +extern bool G_smf_mode; //*************************************************************************/ // Function Prototypes @@ -228,6 +230,25 @@ errlHndl_t querySensorList(const querySensorListArg_t * i_argPtr) continue; } + if (G_smf_mode) + { + // Prevent adding sensors that are not supported in SMF mode + uint16_t l_index; + bool l_skip = FALSE; + for (l_index = 0; l_index < MAIN_MEM_SENSOR_COUNT; ++l_index) + { + if (G_main_mem_sensors[l_index].gsid == l_cnt) + { + if (G_main_mem_sensors[l_index].smf_mode == 0) + { + l_skip = TRUE; + } + break; + } + } + if (l_skip) continue; + } + if (o_sensors != NULL) { // All conditions match. Include current sensor in the query list |