summaryrefslogtreecommitdiffstats
path: root/src/occ_405/sensor
diff options
context:
space:
mode:
authorShawn McCarney <shawnmm@us.ibm.com>2017-05-03 17:33:41 -0500
committerWilliam A. Bryan <wilbryan@us.ibm.com>2017-05-09 14:54:59 -0400
commitff3b5a1c08389bf766de21adcd033e3c7b86af87 (patch)
treed1083cd7e4b6a7b32287b78d3bf08fe49d2745f7 /src/occ_405/sensor
parentcc9a1d2f9e8b6f59265944657ab75b7999725210 (diff)
downloadtalos-occ-ff3b5a1c08389bf766de21adcd033e3c7b86af87.tar.gz
talos-occ-ff3b5a1c08389bf766de21adcd033e3c7b86af87.zip
OCC: Non-GPU Sensors to main memory: Phase 2
Added the following new min/max fields to the sensor_t struct: * CSM_sample_min * CSM_sample_max * profiler_sample_min * profiler_sample_max * job_s_sample_min * job_s_sample_max Also added the following new debug pass-through commands: * DBUG_DUMP_AME_SENSOR - Dumps all fields (dynamic & static) for 1 sensor * DBUG_CLEAR_AME_SENSOR - Clears min/max fields and returns updated fields Change-Id: I95353417da73cdb67e23fcda1a03c4af6993c658 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/40161 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/occ_405/sensor')
-rwxr-xr-xsrc/occ_405/sensor/sensor.c113
-rwxr-xr-xsrc/occ_405/sensor/sensor.h58
2 files changed, 129 insertions, 42 deletions
diff --git a/src/occ_405/sensor/sensor.c b/src/occ_405/sensor/sensor.c
index e63d34d..9aedc9f 100755
--- a/src/occ_405/sensor/sensor.c
+++ b/src/occ_405/sensor/sensor.c
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER OnChipController Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2011,2015 */
+/* Contributors Listed Below - COPYRIGHT 2011,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -91,20 +91,44 @@ void sensor_init(sensor_t * io_sensor_ptr,
// Name: sensor_clear_minmax
//
// Description: Clears minimum and maximum fields in the sensor structure.
+// i_clear_type contains one or more values OR'd together from the
+// AMEC_SENSOR_CLEAR_TYPE enumeration.
//
// End Function Specification
-void sensor_clear_minmax( sensor_t * io_sensor_ptr)
+void sensor_clear_minmax(sensor_t * io_sensor_ptr,
+ AMEC_SENSOR_CLEAR_TYPE i_clear_type)
{
- if( io_sensor_ptr != NULL)
+ if (io_sensor_ptr != NULL)
{
- io_sensor_ptr->sample_min = UINT16_MAX;
- io_sensor_ptr->sample_max = UINT16_MIN;
+ if (i_clear_type & AMEC_SENSOR_CLEAR_SAMPLE_MINMAX)
+ {
+ io_sensor_ptr->sample_min = UINT16_MAX;
+ io_sensor_ptr->sample_max = UINT16_MIN;
- // If it has vector sensor, clear max and min position
- if( io_sensor_ptr->vector != NULL)
+ // If it has vector sensor, clear max and min position
+ if (io_sensor_ptr->vector != NULL)
+ {
+ io_sensor_ptr->vector->max_pos = VECTOR_SENSOR_DEFAULT_VAL;
+ io_sensor_ptr->vector->min_pos = VECTOR_SENSOR_DEFAULT_VAL;
+ }
+ }
+
+ if (i_clear_type & AMEC_SENSOR_CLEAR_CSM_SAMPLE_MINMAX)
+ {
+ io_sensor_ptr->csm_sample_min = UINT16_MAX;
+ io_sensor_ptr->csm_sample_max = UINT16_MIN;
+ }
+
+ if (i_clear_type & AMEC_SENSOR_CLEAR_PROFILER_SAMPLE_MINMAX)
+ {
+ io_sensor_ptr->profiler_sample_min = UINT16_MAX;
+ io_sensor_ptr->profiler_sample_max = UINT16_MIN;
+ }
+
+ if (i_clear_type & AMEC_SENSOR_CLEAR_JOB_S_SAMPLE_MINMAX)
{
- io_sensor_ptr->vector->max_pos = VECTOR_SENSOR_DEFAULT_VAL;
- io_sensor_ptr->vector->min_pos = VECTOR_SENSOR_DEFAULT_VAL;
+ io_sensor_ptr->job_s_sample_min = UINT16_MAX;
+ io_sensor_ptr->job_s_sample_max = UINT16_MIN;
}
}
else
@@ -134,7 +158,7 @@ void sensor_reset( sensor_t * io_sensor_ptr)
*(io_sensor_ptr->mini_sensor) = 0x0;
}
- sensor_clear_minmax(io_sensor_ptr);
+ sensor_clear_minmax(io_sensor_ptr, AMEC_SENSOR_CLEAR_ALL_MINMAX);
io_sensor_ptr->status.reset = 0;
}
@@ -173,6 +197,60 @@ void sensor_vectorize( sensor_t * io_sensor_ptr,
// Function Specification
//
+// Name: sensor_update_minmax
+//
+// Description: Updates minimum and maximum fields in the sensor structure.
+//
+// Implementation Notes:
+// * This is an internal function so we don't validate parameters
+//
+// End Function Specification
+void sensor_update_minmax(sensor_t * io_sensor_ptr, uint16_t i_sensor_value)
+{
+ // Update sample min/max fields if needed
+ if (i_sensor_value < io_sensor_ptr->sample_min)
+ {
+ io_sensor_ptr->sample_min = i_sensor_value;
+ }
+ if (i_sensor_value > io_sensor_ptr->sample_max)
+ {
+ io_sensor_ptr->sample_max = i_sensor_value;
+ }
+
+ // Update CSM sample min/max fields if needed
+ if (i_sensor_value < io_sensor_ptr->csm_sample_min)
+ {
+ io_sensor_ptr->csm_sample_min = i_sensor_value;
+ }
+ if (i_sensor_value > io_sensor_ptr->csm_sample_max)
+ {
+ io_sensor_ptr->csm_sample_max = i_sensor_value;
+ }
+
+ // Update profiler sample min/max fields if needed
+ if (i_sensor_value < io_sensor_ptr->profiler_sample_min)
+ {
+ io_sensor_ptr->profiler_sample_min = i_sensor_value;
+ }
+ if (i_sensor_value > io_sensor_ptr->profiler_sample_max)
+ {
+ io_sensor_ptr->profiler_sample_max = i_sensor_value;
+ }
+
+ // Update job scheduler sample min/max fields if needed
+ if (i_sensor_value < io_sensor_ptr->job_s_sample_min)
+ {
+ io_sensor_ptr->job_s_sample_min = i_sensor_value;
+ }
+ if (i_sensor_value > io_sensor_ptr->job_s_sample_max)
+ {
+ io_sensor_ptr->job_s_sample_max = i_sensor_value;
+ }
+}
+
+
+// Function Specification
+//
// Name: sensor_update
//
// Description: Update sensor
@@ -191,19 +269,8 @@ void sensor_update( sensor_t * io_sensor_ptr, const uint16_t i_sensor_value)
// update sample value
io_sensor_ptr->sample = i_sensor_value;
- // update sample min value if input sample value is lower than
- // sample_min
- if( i_sensor_value < io_sensor_ptr->sample_min)
- {
- io_sensor_ptr->sample_min = i_sensor_value;
- }
-
- // update sample max value if input sample value is greater than
- // sample_max
- if( i_sensor_value > io_sensor_ptr->sample_max)
- {
- io_sensor_ptr->sample_max = i_sensor_value;
- }
+ // update min/max values if needed
+ sensor_update_minmax(io_sensor_ptr, i_sensor_value);
// If this sensor has mini sensor, update it's value
if( io_sensor_ptr->mini_sensor != NULL)
diff --git a/src/occ_405/sensor/sensor.h b/src/occ_405/sensor/sensor.h
index 9f823a3..535b434 100755
--- a/src/occ_405/sensor/sensor.h
+++ b/src/occ_405/sensor/sensor.h
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER OnChipController Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2011,2015 */
+/* Contributors Listed Below - COPYRIGHT 2011,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -106,6 +106,19 @@ typedef enum
} VECTOR_SENSOR_OP;
+// This enumeration specifies which sample minimum/maximum values to clear when
+// calling sensor_clear_minmax(). The enumeration values can be OR'd together,
+// so each value must be a different power of 2. Specifying
+// AMEC_SENSOR_CLEAR_ALL_MINMAX clears all min/max values in the sensor.
+typedef enum
+{
+ AMEC_SENSOR_CLEAR_SAMPLE_MINMAX = 0x0001,
+ AMEC_SENSOR_CLEAR_CSM_SAMPLE_MINMAX = 0x0002,
+ AMEC_SENSOR_CLEAR_PROFILER_SAMPLE_MINMAX = 0x0004,
+ AMEC_SENSOR_CLEAR_JOB_S_SAMPLE_MINMAX = 0x0008,
+ AMEC_SENSOR_CLEAR_ALL_MINMAX = 0xffff,
+} AMEC_SENSOR_CLEAR_TYPE;
+
/*****************************************************************************/
// Forward declaration as used in vectorSensor
struct sensor;
@@ -156,22 +169,28 @@ typedef struct sensorStatus sensorStatus_t;
// Sensor structure
struct sensor
{
- uint16_t gsid; // Global Sensor ID
- uint16_t sample; // Latest sample of this sensor
- uint16_t sample_min; // Minimum value since last reset
- uint16_t sample_max; // Maximum Value since last reset
- uint64_t accumulator; // Accumulator register for this sensor
- uint32_t src_accum_snapshot; // Copy of the source sensor's accumulator
- // used for time-derived sensors
- uint32_t update_tag; // Count of the number of 'ticks' that have passed
- // between updates to this sensor (used for time-
- // derived sensor)
- uint32_t ipmi_sid; // Ipmi sensor id obtained from mrw
- vectorSensor_t * vector; // Pointer to vector control structure. NULL if
- // this is not a vector sensor.
- uint16_t * mini_sensor; // Pointer to entry in mini-sensor table. NULL if
- // this sensor does not have a mini-sensor
- sensorStatus_t status; // Status and control register
+ uint16_t gsid; // Global Sensor ID
+ uint16_t sample; // Latest sample of this sensor
+ uint16_t sample_min; // Minimum value since last OCC reset
+ uint16_t sample_max; // Maximum value since last OCC reset
+ uint16_t csm_sample_min; // Minimum value since last reset request by CSM
+ uint16_t csm_sample_max; // Maximum value since last reset request by CSM
+ uint16_t profiler_sample_min; // Minimum value since last reset request by profiler
+ uint16_t profiler_sample_max; // Maximum value since last reset request by profiler
+ uint16_t job_s_sample_min; // Minimum value since last reset by job scheduler
+ uint16_t job_s_sample_max; // Maximum value since last reset by job scheduler
+ uint64_t accumulator; // Accumulator register for this sensor
+ uint32_t src_accum_snapshot; // Copy of the source sensor's accumulator
+ // used for time-derived sensors
+ uint32_t update_tag; // Count of the number of 'ticks' that have passed
+ // between updates to this sensor (used for time-
+ // derived sensor)
+ uint32_t ipmi_sid; // Ipmi sensor id obtained from mrw
+ vectorSensor_t * vector; // Pointer to vector control structure. NULL if
+ // this is not a vector sensor.
+ uint16_t * mini_sensor; // Pointer to entry in mini-sensor table. NULL if
+ // this sensor does not have a mini-sensor
+ sensorStatus_t status; // Status and control register
} __attribute__ ((__packed__));
@@ -215,8 +234,9 @@ void sensor_init(sensor_t * io_sensor_ptr,
const uint16_t * i_miniSnsrPtr
);
-// Clear minmax value
-void sensor_clear_minmax( sensor_t * io_sensor_ptr);
+// Clear mininum/maximum sample values in sensor
+void sensor_clear_minmax(sensor_t * io_sensor_ptr,
+ AMEC_SENSOR_CLEAR_TYPE i_clear_type);
// Sensor reset
void sensor_reset( sensor_t * io_sensor_ptr);
OpenPOWER on IntegriCloud