diff options
author | William Bryan <wilbryan@us.ibm.com> | 2015-08-03 12:38:58 -0500 |
---|---|---|
committer | William A. Bryan <wilbryan@us.ibm.com> | 2015-08-03 15:32:27 -0500 |
commit | 420e6d248cc6d2b3c39bc3970e3bb6747b3bddc3 (patch) | |
tree | c9f6691eddba39193e39aa769367e1267fb9fc86 /src/occ_405/sensor | |
parent | adade8c8ef30ed519322674c762d95663009c5d4 (diff) | |
download | talos-occ-420e6d248cc6d2b3c39bc3970e3bb6747b3bddc3.tar.gz talos-occ-420e6d248cc6d2b3c39bc3970e3bb6747b3bddc3.zip |
new ssx and lib files
Change-Id: I2328b1e86d59e3788910687d762fb70ec680058f
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/19503
Reviewed-by: William A. Bryan <wilbryan@us.ibm.com>
Tested-by: William A. Bryan <wilbryan@us.ibm.com>
Diffstat (limited to 'src/occ_405/sensor')
-rwxr-xr-x | src/occ_405/sensor/sensor.c | 568 | ||||
-rwxr-xr-x | src/occ_405/sensor/sensor.h | 239 | ||||
-rwxr-xr-x | src/occ_405/sensor/sensor_enum.h | 582 | ||||
-rwxr-xr-x | src/occ_405/sensor/sensor_info.c | 308 | ||||
-rwxr-xr-x | src/occ_405/sensor/sensor_service_codes.h | 37 | ||||
-rwxr-xr-x | src/occ_405/sensor/sensor_table.c | 508 |
6 files changed, 2242 insertions, 0 deletions
diff --git a/src/occ_405/sensor/sensor.c b/src/occ_405/sensor/sensor.c new file mode 100755 index 0000000..e63d34d --- /dev/null +++ b/src/occ_405/sensor/sensor.c @@ -0,0 +1,568 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/occ_405/sensor/sensor.c $ */ +/* */ +/* OpenPOWER OnChipController Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ + + + +#include <sensor.h> // sensor structure and other defines +#include <occ_common.h> // For size_t needed by memset +#include <string.h> // For memset +#include "ssx_io.h" // For sprintf +#include <occ_service_codes.h> // OCC reason codes +#include <sensor_service_codes.h> // sensor module ids +#include <trac.h> // Trace macros + +#define UINT16_MIN 0 + +// Global sensor counter +uint32_t G_amec_sensor_count = 0; + + +void sensor_init(sensor_t * io_sensor_ptr, + const uint16_t i_gsid, + const uint16_t * i_miniSnsrPtr + ) INIT_SECTION; + +void sensor_init_all(void) INIT_SECTION; + +// Function Specification +// +// Name: sensor_init +// +// Description: Initialize global sensor list. +// +// End Function Specification +void sensor_init(sensor_t * io_sensor_ptr, + const uint16_t i_gsid, + const uint16_t * i_miniSnsrPtr + ) +{ + // check if input pointers are valid and global sensor count is + // within range. + // Note: Don't need to check i_miniSnsrPtr here as it can be NULL + if(( io_sensor_ptr != NULL) && + (G_amec_sensor_count < MAX_AMEC_SENSORS)) + { + // zero out sensor pointer + memset(io_sensor_ptr,0x0,sizeof(sensor_t)); + + io_sensor_ptr->gsid = i_gsid; + + io_sensor_ptr->status.reset = 1; + + // set mini sensor pointer to point to i_miniSnsrPtr. i_miniSnsrPtr can + // be NULL + io_sensor_ptr->mini_sensor = (uint16_t*)i_miniSnsrPtr; + + G_amec_sensor_count++; + + } // end valid input and max sensor count check + else + { + TRAC_ERR("Invalid input parameters OR Number of " + "sensor is out of range. Current sensor count: 0x%x, " + "max allowed: 0x%x",G_amec_sensor_count,MAX_AMEC_SENSORS); + } +} + +// Function Specification +// +// Name: sensor_clear_minmax +// +// Description: Clears minimum and maximum fields in the sensor structure. +// +// End Function Specification +void sensor_clear_minmax( sensor_t * io_sensor_ptr) +{ + if( io_sensor_ptr != NULL) + { + 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) + { + io_sensor_ptr->vector->max_pos = VECTOR_SENSOR_DEFAULT_VAL; + io_sensor_ptr->vector->min_pos = VECTOR_SENSOR_DEFAULT_VAL; + } + } + else + { + TRAC_ERR("Invalid input parameters "); + } +} + + +// Function Specification +// +// Name: sensor_reset +// +// Description: Reset sensor fields +// +// End Function Specification +void sensor_reset( sensor_t * io_sensor_ptr) +{ + if( io_sensor_ptr != NULL) + { + io_sensor_ptr->accumulator = 0x0; + io_sensor_ptr->sample = 0x0; + + // clear mini sensor value + if( io_sensor_ptr->mini_sensor != NULL) + { + *(io_sensor_ptr->mini_sensor) = 0x0; + } + + sensor_clear_minmax(io_sensor_ptr); + + io_sensor_ptr->status.reset = 0; + } + else + { + TRAC_ERR("Invalid input parameters "); + } +} + + +// Function Specification +// +// Name: sensor_vectorize +// +// Description: vectorize sensor +// +// End Function Specification +void sensor_vectorize( sensor_t * io_sensor_ptr, + vectorSensor_t * io_vec_sensor_ptr, + const VECTOR_SENSOR_OP i_op) +{ + if( (io_vec_sensor_ptr != NULL) && (io_sensor_ptr != NULL)) + { + // assign to sensor vector pointer + io_sensor_ptr->vector = io_vec_sensor_ptr; + // zero out vector sensor and set operation + memset(io_vec_sensor_ptr,0x0,sizeof(vectorSensor_t)); + io_vec_sensor_ptr->operation = i_op; + } + else + { + TRAC_ERR("Invalid input sensor pointer"); + } +} + + +// Function Specification +// +// Name: sensor_update +// +// Description: Update sensor +// +// End Function Specification +void sensor_update( sensor_t * io_sensor_ptr, const uint16_t i_sensor_value) +{ + if( io_sensor_ptr != NULL) + { + // reset sensors if requested + if( io_sensor_ptr->status.reset == 1) + { + sensor_reset(io_sensor_ptr); + } + + // 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; + } + + // If this sensor has mini sensor, update it's value + if( io_sensor_ptr->mini_sensor != NULL) + { + *(io_sensor_ptr->mini_sensor) = i_sensor_value; + } + + // add sample value to accumulator + io_sensor_ptr->accumulator += i_sensor_value; + // increment update tag + io_sensor_ptr->update_tag += 1; + } + else + { + TRAC_ERR("Invalid sensor pointer"); + } +} + + +// Function Specification +// +// Name: sensor_op_min +// +// Description: Perform min operation on vector sensor +// +// End Function Specification +uint16_t sensor_op_min(const vectorSensor_t * i_vecSensorPtr, + uint8_t * o_position) +{ + uint16_t l_value = UINT16_MAX; + uint16_t i = 0; + + // Internal function so not checking for input NULL pointers + + // traverse through enabled vector sensors to find the minimum value + for(; i < i_vecSensorPtr->size; i++) + { + // check if sensor is enabled + if( i_vecSensorPtr->elem_enabled[i] == 1) + { + if( i_vecSensorPtr->source_ptr[i]->sample < l_value) + { + l_value = i_vecSensorPtr->source_ptr[i]->sample; + *o_position = i; + } + } // end element enabled check + + } // end for loop + + return l_value; + +} + + +// Function Specification +// +// Name: sensor_op_max +// +// Description: Perform max operation for vector sensor +// +// End Function Specification +uint16_t sensor_op_max(const vectorSensor_t * i_vecSensorPtr, + uint8_t * o_position) +{ + uint16_t l_value = UINT16_MIN; + uint16_t i = 0; + + // Internal function so not checking for input NULL pointers + + // traverse through enabled vector sensors to find the maximum value + for(; i < i_vecSensorPtr->size; i++) + { + // Check if element is enabled + if( i_vecSensorPtr->elem_enabled[i] == 1) + { + if( i_vecSensorPtr->source_ptr[i]->sample > l_value) + { + l_value = i_vecSensorPtr->source_ptr[i]->sample; + *o_position = i; + } + }// end element enabled check + + } // end for loop + + return l_value; + +} + + +// Function Specification +// +// Name: sensor_op_avg +// +// Description: Perform average operation for vector sensor +// +// End Function Specification +uint16_t sensor_op_avg(const vectorSensor_t * i_vecSensorPtr, + const uint16_t i_threshold) +{ + uint32_t l_sum = 0; + uint16_t i = 0; + uint16_t l_number = 0; + + // Internal function so not checking for input NULL pointers + + // traverse through enabled vector sensors to get sum of sensor sample + for(; i < i_vecSensorPtr->size; i++) + { + // check if element is enabled + if( i_vecSensorPtr->elem_enabled[i] == 1) + { + // Include sample only if it is higher than threshold + if( i_vecSensorPtr->source_ptr[i]->sample > i_threshold) + { + l_number++; + l_sum += i_vecSensorPtr->source_ptr[i]->sample; + } + } // end element enabled check + + } // end for loop + + // Calculate average + if( l_number != 0) + { + l_sum = l_sum / l_number; + } + + return l_sum; +} + + +// Function Specification +// +// Name: sensor_vector_update +// +// Description: Update Vector Sensor +// +// End Function Specification +void sensor_vector_update( sensor_t * io_sensor_ptr,const uint32_t i_threshold) +{ + if( io_sensor_ptr != NULL) + { + // Reset sensor if requested + if( io_sensor_ptr->status.reset == 1) + { + sensor_reset(io_sensor_ptr); + } + + // Perform vector sensor operation and update sensor + if( io_sensor_ptr->vector != NULL) + { + uint16_t l_value = 0; + uint8_t l_position = 0; + + // Min operation + if( VECTOR_OP_MIN == io_sensor_ptr->vector->operation) + { + // calculate min value and get sensor position holding min value + l_value = sensor_op_min(io_sensor_ptr->vector, &l_position); + // set min position in vector sensor + io_sensor_ptr->vector->min_pos = l_position; + // Update only if needed + if( l_value != UINT16_MAX) + { + // update sensor with new min value + sensor_update(io_sensor_ptr,l_value); + } + } + // Max operation + else if( VECTOR_OP_MAX == io_sensor_ptr->vector->operation) + { + // calculate max value and get sensor position holding max value + l_value = sensor_op_max(io_sensor_ptr->vector, &l_position); + // set max position in vector sensor + io_sensor_ptr->vector->max_pos = l_position; + // Update only if needed + if( l_value != UINT16_MIN) + { + // update sensor with new max value + sensor_update(io_sensor_ptr,l_value); + } + } + // Average operation + else if( VECTOR_OP_AVG == io_sensor_ptr->vector->operation) + { + // Calculate average of the sensor sample + l_value = sensor_op_avg(io_sensor_ptr->vector,i_threshold); + // Update only if needed + if( l_value != 0) + { + // update sensor with new average value + sensor_update(io_sensor_ptr,l_value); + } + } + // Unsupported operation + else + { + TRAC_ERR("Unsupported vector sensor operation: 0x%x", + io_sensor_ptr->vector->operation); + } + + } // end valid vector sensor check + else + { + TRAC_ERR("This sensor does not have vector sensor"); + } + } + else + { + TRAC_ERR("Invalid input sensor pointer"); + } +} + + +// Function Specification +// +// Name: getSensorByGsid +// +// Description: Get sensor data using GSID (Global Sensor ID) +// +// End Function Specification +sensor_t * getSensorByGsid( const uint16_t i_gsid) +{ + sensor_t * l_sensorPtr = NULL; + + // check if input gsid is within range. Return sensor pointer if within + // range. Else return NULL + if( i_gsid < G_amec_sensor_count) + { + l_sensorPtr = G_amec_sensor_list[i_gsid]; + } + + return l_sensorPtr; +} + + +// Function Specification +// +// Name: sensor_vector_elem_enable +// +// Description: Enable/disable vector sensor element. This interface can be +// used at runtime +// +// End Function Specification +void sensor_vector_elem_enable( vectorSensor_t* io_sensor_vector_ptr, + const uint8_t i_loc, + const uint8_t i_enable) +{ + if( io_sensor_vector_ptr != NULL) + { + // check if location of the vector sensor is within range + if( i_loc < io_sensor_vector_ptr->size) + { + // set element enabled + io_sensor_vector_ptr->elem_enabled[i_loc] = i_enable; + } + else + { + TRAC_ERR("Invalid input location: 0x%x, max size: 0x%x", + i_loc,io_sensor_vector_ptr->size); + } + } + else + { + TRAC_ERR("NULL input vector sensor pointer"); + } +} + + +// Function Specification +// +// Name: sensor_vector_elem_add +// +// Description: Add element to the vector sensor. If element at the given +// location is already present, it will be overwritten. +// +// End Function Specification +void sensor_vector_elem_add( vectorSensor_t* io_sensor_vector_ptr, + const uint8_t i_loc, + const sensor_t * i_elemPtr) +{ + if( (io_sensor_vector_ptr == NULL) || + (i_elemPtr == NULL ) || + (i_loc >= MAX_VECTOR_SENSORS)) + { + TRAC_ERR("Invalid input parameters. Either pointers are NULL or " + "location is out of range i_loc: 0x%x,max allowed: 0x%x", + i_loc,MAX_VECTOR_SENSORS); + } + else if( (i_loc > io_sensor_vector_ptr->size)) + { + TRAC_ERR("Invalid location. Location does not make element contiguous " + "i_loc: 0x%x,current vector size: 0x%x",i_loc, + io_sensor_vector_ptr->size); + } + else + { + // Increase size if spot is empty. Else we are overwriting existing + // slot so no need to increment vector size + if(io_sensor_vector_ptr->source_ptr[i_loc] == NULL) + { + io_sensor_vector_ptr->size++; + } + // set element and enable it. + io_sensor_vector_ptr->source_ptr[i_loc] = (sensor_t*)i_elemPtr; + io_sensor_vector_ptr->elem_enabled[i_loc] = 1; + } +} + + + +// Function Specification +// +// Name: sensor_init_all +// +// Description: Initialize all sensors in the global sensor list. +// +// End Function Specification +void sensor_init_all(void) +{ + int i; + int l_num_entries = NUMBER_OF_SENSORS_IN_LIST; + const sensor_ptr_t * l_argPtrSensor = &G_amec_sensor_list[0]; + const minisensor_ptr_t * l_argPtrMiniSensor = &G_amec_mini_sensor_list[0]; + + for(i=0; i < l_num_entries; i++) + { + sensor_init(l_argPtrSensor[i], i, l_argPtrMiniSensor[i]); + } + + // If G_amec_sensor_count doesn't match the number of sensors, we must have + // failed to initialize one or more sensors. + if(NUMBER_OF_SENSORS_IN_LIST != G_amec_sensor_count) + { + TRAC_ERR("Sensor Initialization Failed to initialize all sensors"); + + /* @ + * @errortype + * @moduleid SENSOR_INITIALIZE + * @reasoncode INTERNAL_FAILURE + * @userdata1 G_amec_sensor_count - number of sensors initialized + * @userdata2 NUMBER_OF_SENSORS_IN_LIST - total number of OCC sensors + * @userdata4 OCC_NO_EXTENDED_RC + * @devdesc Firmware internal failure initializing sensors + */ + errlHndl_t l_err = createErrl( + SENSOR_INITIALIZE, // Module ID + INTERNAL_FAILURE, // Reason Code // @wb003 + OCC_NO_EXTENDED_RC, // Extended reason code + ERRL_SEV_PREDICTIVE, // Severity + NULL, // Trace + 0, // Trace Size + G_amec_sensor_count, // UserData 1 + NUMBER_OF_SENSORS_IN_LIST // UserData 2 + ); + + commitErrl(&l_err); + } + + TRAC_IMP("Sensor Initialization Complete"); +} + diff --git a/src/occ_405/sensor/sensor.h b/src/occ_405/sensor/sensor.h new file mode 100755 index 0000000..4459e08 --- /dev/null +++ b/src/occ_405/sensor/sensor.h @@ -0,0 +1,239 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/occ_405/sensor/sensor.h $ */ +/* */ +/* OpenPOWER OnChipController Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef _sensor_h +#define _sensor_h + +#include <common_types.h> // defines for uint8_t,uint3_t..etc +#include <errl.h> // For errlHndl_t +#include <occ_common.h> // Common OCC defines +#include <sensor_enum.h> // For Sensor Enum + +// Macro to get mini sensor value. It gives the mini sensor value for +// the given occId at given the given field. If occId is out of range, it will +// return 0. +#define MINI_SENSOR_VALUE(occId,fieldNm) \ + ( (occId < MAX_OCCS) ? G_dcom_slv_outbox[occId].fieldNm : 0x0) + +// Make a AMEC Number out of mantissa & exponent. +#define AMEFP(mantissa,exp) (((UINT32)mantissa << 8) | (UINT32)((UINT8) 256 + (UINT8)exp)) + +// Get pointer to sensor based on GSID +#define AMECSENSOR_PTR(sensor) G_amec_sensor_list[sensor] +#define AMECSENSOR_ARRAY_PTR(sensor_base,idx) G_amec_sensor_list[sensor_base+idx] +#define AMECSENSOR_2D_ARRAY_PTR(sensor_base,idx,idx2) G_amec_sensor_list[sensor_base+idx+idx2] + +#define AMEC_SENSOR_NONUM 0xFF +#define SENSOR_TYPE_ALL 0xFFFF +#define SENSOR_LOC_ALL 0xFFFF +#define MAX_VECTOR_SENSORS 32 +#define MAX_SENSOR_NAME_SZ 16 // including NULL +#define MAX_SENSOR_UNIT_SZ 4 // including NULL +#define MAX_AMEC_SENSORS 500 +#define VECTOR_SENSOR_DEFAULT_VAL 0xFF + +typedef enum +{ + AMEC_SENSOR_TYPE_UNKNOWN = 0x0000, + AMEC_SENSOR_TYPE_GENERIC = 0x0001, + AMEC_SENSOR_TYPE_CURRENT = 0x0002, + AMEC_SENSOR_TYPE_VOLTAGE = 0x0004, + AMEC_SENSOR_TYPE_TEMP = 0x0008, + AMEC_SENSOR_TYPE_UTIL = 0x0010, + AMEC_SENSOR_TYPE_TIME = 0x0020, + AMEC_SENSOR_TYPE_FREQ = 0x0040, + AMEC_SENSOR_TYPE_POWER = 0x0080, + AMEC_SENSOR_TYPE_PERF = 0x0200, + AMEC_SENSOR_TYPE_ALL = 0xffff, +}AMEC_SENSOR_TYPE; + +typedef enum +{ + AMEC_SENSOR_LOC_UNKNOWN = 0x0000, + AMEC_SENSOR_LOC_SYS = 0x0001, + AMEC_SENSOR_LOC_PROC = 0x0002, + AMEC_SENSOR_LOC_LPAR = 0x0004, + AMEC_SENSOR_LOC_MEM = 0x0008, + AMEC_SENSOR_LOC_VRM = 0x0010, + AMEC_SENSOR_LOC_OCC = 0x0020, + AMEC_SENSOR_LOC_CORE = 0x0040, + AMEC_SENSOR_LOC_ALL = 0xffff, +}AMEC_SENSOR_LOC; + +// Vector Sensor operation enumeration +typedef enum +{ + VECTOR_OP_NONE = 0x00, + VECTOR_OP_MAX = 0x01, + VECTOR_OP_MIN = 0x02, + VECTOR_OP_AVG = 0x03, + +} VECTOR_SENSOR_OP; + +/*****************************************************************************/ +// Forward declaration as used in vectorSensor +struct sensor; +typedef struct sensor sensor_t; + +// Vector Sensor structure +struct vectorSensor +{ + VECTOR_SENSOR_OP operation; //Operation that this vector should execute + uint8_t size; // Number of elements in this vector + uint8_t elem_enabled[MAX_VECTOR_SENSORS]; // indicates if a given element + // is enabled or disabled + sensor_t* source_ptr[MAX_VECTOR_SENSORS]; // Pointer to an array of source + //pointers (source elements of this vector) + uint8_t min_pos; // Minimum val vector position for the latest snapshot + uint8_t max_pos; // Maximum val vector position for the latest snapshot + +} __attribute__ ((__packed__)); + +typedef struct vectorSensor vectorSensor_t; + +typedef struct +{ + char name[MAX_SENSOR_NAME_SZ]; + struct + { + char units[MAX_SENSOR_UNIT_SZ]; + uint16_t type; + uint16_t location; + uint8_t number; + uint32_t freq; + uint32_t scalefactor; + } __attribute__ ((__packed__)) sensor; +} __attribute__ ((__packed__)) sensor_info_t; + +/*****************************************************************************/ +//Sensor status structure +struct sensorStatus +{ + uint8_t buffer_area_type:1, + update_histogram:1, + reset:1, + reserved:5; +}; +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 + uint32_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) + uint16_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__)); + +// Typedef for this structure is part of the forward declaration for the +// vector sensor structure section in this file + +/*****************************************************************************/ +// Sensor Query list structure used for querying sensor data +struct sensorQueryList +{ + uint16_t gsid; // Global Sensor ID + uint16_t sample; // Latest sample of the sensor + char name[MAX_SENSOR_NAME_SZ]; // Sensor Name +}; + +typedef struct sensorQueryList sensorQueryList_t; + +/*****************************************************************************/ +// Sensor List Structures used to build tables of sensor pointers. +// Global sensor list type +typedef sensor_t * sensor_ptr_t; +// Global mini-sensor list type +typedef uint16_t * minisensor_ptr_t; + +/*****************************************************************************/ +// These are used by the sensor init +// Global sensor counter +extern uint32_t G_amec_sensor_count; + +// Contains array of pointers to sensors, indexed by GSID +extern const sensor_ptr_t G_amec_sensor_list[]; + +extern const sensor_info_t G_sensor_info[]; + +// Contains array of pointers to mini-sensors, indexed by GSID +extern const minisensor_ptr_t G_amec_mini_sensor_list[]; + +// sensor_init +void sensor_init(sensor_t * io_sensor_ptr, + const uint16_t i_gsid, + const uint16_t * i_miniSnsrPtr + ); + +// Clear minmax value +void sensor_clear_minmax( sensor_t * io_sensor_ptr); + +// Sensor reset +void sensor_reset( sensor_t * io_sensor_ptr); + +//Vectorize sensor +void sensor_vectorize( sensor_t * io_sensor_ptr, + vectorSensor_t * io_vec_sensor_ptr, + const VECTOR_SENSOR_OP i_op); + +//Update sensor +void sensor_update( sensor_t * io_sensor_ptr, const uint16_t i_sensor_value); + +//Perform operation on vector sensor and update sensor +void sensor_vector_update( sensor_t * io_sensor_ptr,const uint32_t i_threshold); + +// Get sensor by GSID +sensor_t * getSensorByGsid( const uint16_t i_gsid); + +// enable/disable vector sensor element +void sensor_vector_elem_enable( vectorSensor_t* io_sensor_vector_ptr, + const uint8_t i_loc, + const uint8_t i_enable); + +// Add element to the vector sensor +void sensor_vector_elem_add( vectorSensor_t* io_sensor_vector_ptr, + const uint8_t i_loc, + const sensor_t * i_elemPtr); + +// Initialize all sensors +void sensor_init_all(void); + +#endif // _sensor_h + + diff --git a/src/occ_405/sensor/sensor_enum.h b/src/occ_405/sensor/sensor_enum.h new file mode 100755 index 0000000..ec2fd9e --- /dev/null +++ b/src/occ_405/sensor/sensor_enum.h @@ -0,0 +1,582 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/occ_405/sensor/sensor_enum.h $ */ +/* */ +/* OpenPOWER OnChipController Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef _sensor_enum_h +#define _sensor_enum_h + +/***************************************************************************** + * This enum is the list of all the sensors that are used in the system. The + * value of the enum is the GSID of the sensor, and all tables are initialized + * based on this. + * If you add a sensor to this enum: + * - All GSIDs after it will automatically change + * - The number of sensors & size of arrays will automatially change + * - The name of the enum will be turned into a string, and that is the + * string that will be stored as that sensor's name. + * - This means the enum name must match the Sensor Name string + * and will need to follow the rules for that string (max 15 chars) + * - You will need to modify the following files: + * - sensor_table.c - add sensor pointer to G_amec_sensor_list and + * if needed to G_amec_mini_sensor_list + * - sensor_info.c - add sensor information to G_sensor_info + * - amec/amec_sys.h - add sensor_t to system structure so you can + */ + +enum e_gsid +{ + // ------------------------------------------------------ + // Code/Firmware Sensors + // ------------------------------------------------------ + AMEintdur = 0, // Combined duration of the AMEC Master & Slave Tasks + + AMESSdur0, // Combined duration of the AMEC Master & Slave 0 + AMESSdur1, // Combined duration of the AMEC Master & Slave 1 + AMESSdur2, // Combined duration of the AMEC Master & Slave 2 + AMESSdur3, // Combined duration of the AMEC Master & Slave 3 + AMESSdur4, // Combined duration of the AMEC Master & Slave 4 + AMESSdur5, // Combined duration of the AMEC Master & Slave 5 + AMESSdur6, // Combined duration of the AMEC Master & Slave 6 + AMESSdur7, // Combined duration of the AMEC Master & Slave 7 + + PROBE250US0, // Internal Sensor for debug via AMESTER + PROBE250US1, // Internal Sensor for debug via AMESTER + PROBE250US2, // Internal Sensor for debug via AMESTER + PROBE250US3, // Internal Sensor for debug via AMESTER + PROBE250US4, // Internal Sensor for debug via AMESTER + PROBE250US5, // Internal Sensor for debug via AMESTER + PROBE250US6, // Internal Sensor for debug via AMESTER + PROBE250US7, // Internal Sensor for debug via AMESTER + + GPEtickdur0, // Duration on the GPE0 Engine + GPEtickdur1, // Duration on the GPE1 Engine + RTLtickdur, // Duration on the RTL tick interrupt + + // ------------------------------------------------------ + // System Sensors + // ------------------------------------------------------ + TEMPAMBIENT, // Ambient Temp of System (from APSS) + ALTITUDE, // Altitude of System (from APSS) + PWR250US, // System DC Power (from APSS) + PWR250USFAN, // Fan Power (from APSS) + PWR250USIO, // IO Subsystem Power (from APSS) + PWR250USSTORE, // Storage Subsys Power (from APSS) + PWR250USGPU, // GPU Subsystem Power (from APSS) e.g. Nvidia GPU + FANSPEEDAVG, // Average Fan Speed (from DPSS) + PWRAPSSCH0, // These PWRAPSSCH sensors are used to report the power + PWRAPSSCH1, // provided by each of the 16 APSS channels. + PWRAPSSCH2, + PWRAPSSCH3, + PWRAPSSCH4, + PWRAPSSCH5, + PWRAPSSCH6, + PWRAPSSCH7, + PWRAPSSCH8, + PWRAPSSCH9, + PWRAPSSCH10, + PWRAPSSCH11, + PWRAPSSCH12, + PWRAPSSCH13, + PWRAPSSCH14, + PWRAPSSCH15, + + // ------------------------------------------------------ + // Chip Sensors + // ------------------------------------------------------ + TODclock0, // \ . + TODclock1, // => 32 MHz TimeOfDay Clock split into 3 sensors + TODclock2, // / (from Chip SCOM) + + // ------------------------------------------------------ + // Processor Sensors + // ------------------------------------------------------ + FREQA2MSP0, + IPS2MSP0, + MEMSP2MSP0, + PWR250USP0, + PWR250USVDD0, + CUR250USVDD0, + PWR250USVCS0, + PWR250USMEM0, + SLEEPCNT2MSP0, + WINKCNT2MSP0, + SP250USP0, + TEMP2MSP0, + TEMP2MSP0PEAK, + UTIL2MSP0, + VRFAN250USPROC, + VRHOT250USPROC, + + FREQ250USP0C0, + FREQ250USP0C1, + FREQ250USP0C2, + FREQ250USP0C3, + FREQ250USP0C4, + FREQ250USP0C5, + FREQ250USP0C6, + FREQ250USP0C7, + FREQ250USP0C8, + FREQ250USP0C9, + FREQ250USP0C10, + FREQ250USP0C11, + + FREQA2MSP0C0, + FREQA2MSP0C1, + FREQA2MSP0C2, + FREQA2MSP0C3, + FREQA2MSP0C4, + FREQA2MSP0C5, + FREQA2MSP0C6, + FREQA2MSP0C7, + FREQA2MSP0C8, + FREQA2MSP0C9, + FREQA2MSP0C10, + FREQA2MSP0C11, + + IPS2MSP0C0, + IPS2MSP0C1, + IPS2MSP0C2, + IPS2MSP0C3, + IPS2MSP0C4, + IPS2MSP0C5, + IPS2MSP0C6, + IPS2MSP0C7, + IPS2MSP0C8, + IPS2MSP0C9, + IPS2MSP0C10, + IPS2MSP0C11, + + NOTBZE2MSP0C0, + NOTBZE2MSP0C1, + NOTBZE2MSP0C2, + NOTBZE2MSP0C3, + NOTBZE2MSP0C4, + NOTBZE2MSP0C5, + NOTBZE2MSP0C6, + NOTBZE2MSP0C7, + NOTBZE2MSP0C8, + NOTBZE2MSP0C9, + NOTBZE2MSP0C10, + NOTBZE2MSP0C11, + + NOTFIN2MSP0C0, + NOTFIN2MSP0C1, + NOTFIN2MSP0C2, + NOTFIN2MSP0C3, + NOTFIN2MSP0C4, + NOTFIN2MSP0C5, + NOTFIN2MSP0C6, + NOTFIN2MSP0C7, + NOTFIN2MSP0C8, + NOTFIN2MSP0C9, + NOTFIN2MSP0C10, + NOTFIN2MSP0C11, + + SPURR2MSP0C0, + SPURR2MSP0C1, + SPURR2MSP0C2, + SPURR2MSP0C3, + SPURR2MSP0C4, + SPURR2MSP0C5, + SPURR2MSP0C6, + SPURR2MSP0C7, + SPURR2MSP0C8, + SPURR2MSP0C9, + SPURR2MSP0C10, + SPURR2MSP0C11, + + TEMP2MSP0C0, + TEMP2MSP0C1, + TEMP2MSP0C2, + TEMP2MSP0C3, + TEMP2MSP0C4, + TEMP2MSP0C5, + TEMP2MSP0C6, + TEMP2MSP0C7, + TEMP2MSP0C8, + TEMP2MSP0C9, + TEMP2MSP0C10, + TEMP2MSP0C11, + + UTIL2MSP0C0, + UTIL2MSP0C1, + UTIL2MSP0C2, + UTIL2MSP0C3, + UTIL2MSP0C4, + UTIL2MSP0C5, + UTIL2MSP0C6, + UTIL2MSP0C7, + UTIL2MSP0C8, + UTIL2MSP0C9, + UTIL2MSP0C10, + UTIL2MSP0C11, + + NUTIL3SP0C0, + NUTIL3SP0C1, + NUTIL3SP0C2, + NUTIL3SP0C3, + NUTIL3SP0C4, + NUTIL3SP0C5, + NUTIL3SP0C6, + NUTIL3SP0C7, + NUTIL3SP0C8, + NUTIL3SP0C9, + NUTIL3SP0C10, + NUTIL3SP0C11, + + MSTL2MSP0C0, + MSTL2MSP0C1, + MSTL2MSP0C2, + MSTL2MSP0C3, + MSTL2MSP0C4, + MSTL2MSP0C5, + MSTL2MSP0C6, + MSTL2MSP0C7, + MSTL2MSP0C8, + MSTL2MSP0C9, + MSTL2MSP0C10, + MSTL2MSP0C11, + + CMT2MSP0C0, + CMT2MSP0C1, + CMT2MSP0C2, + CMT2MSP0C3, + CMT2MSP0C4, + CMT2MSP0C5, + CMT2MSP0C6, + CMT2MSP0C7, + CMT2MSP0C8, + CMT2MSP0C9, + CMT2MSP0C10, + CMT2MSP0C11, + + + CMBW2MSP0C0, + CMBW2MSP0C1, + CMBW2MSP0C2, + CMBW2MSP0C3, + CMBW2MSP0C4, + CMBW2MSP0C5, + CMBW2MSP0C6, + CMBW2MSP0C7, + CMBW2MSP0C8, + CMBW2MSP0C9, + CMBW2MSP0C10, + CMBW2MSP0C11, + + PPICP0C0, + PPICP0C1, + PPICP0C2, + PPICP0C3, + PPICP0C4, + PPICP0C5, + PPICP0C6, + PPICP0C7, + PPICP0C8, + PPICP0C9, + PPICP0C10, + PPICP0C11, + + PWRPX250USP0C0, + PWRPX250USP0C1, + PWRPX250USP0C2, + PWRPX250USP0C3, + PWRPX250USP0C4, + PWRPX250USP0C5, + PWRPX250USP0C6, + PWRPX250USP0C7, + PWRPX250USP0C8, + PWRPX250USP0C9, + PWRPX250USP0C10, + PWRPX250USP0C11, + + // ------------------------------------------------------ + // Regulator Sensors + // ------------------------------------------------------ + UVOLT250USP0V0, + UVOLT250USP0V1, + VOLT250USP0V0, + VOLT250USP0V1, + + // ------------------------------------------------------ + // Memory Sensors + // ------------------------------------------------------ + VRFAN250USMEM, + VRHOT250USMEM, + + MRD2MSP0M0, + MRD2MSP0M1, + MRD2MSP0M2, + MRD2MSP0M3, + MRD2MSP0M4, + MRD2MSP0M5, + MRD2MSP0M6, + MRD2MSP0M7, + + MWR2MSP0M0, + MWR2MSP0M1, + MWR2MSP0M2, + MWR2MSP0M3, + MWR2MSP0M4, + MWR2MSP0M5, + MWR2MSP0M6, + MWR2MSP0M7, + + TEMPDIMMAXP0M0, + TEMPDIMMAXP0M1, + TEMPDIMMAXP0M2, + TEMPDIMMAXP0M3, + TEMPDIMMAXP0M4, + TEMPDIMMAXP0M5, + TEMPDIMMAXP0M6, + TEMPDIMMAXP0M7, + + LOCDIMMAXP0M0, + LOCDIMMAXP0M1, + LOCDIMMAXP0M2, + LOCDIMMAXP0M3, + LOCDIMMAXP0M4, + LOCDIMMAXP0M5, + LOCDIMMAXP0M6, + LOCDIMMAXP0M7, + + // ------------------------------------------------------ + // Centaur Sensors - 8 MemC/Proc - 1 Cent/MemC - 2 PP/Cent + // ------------------------------------------------------ + MAC2MSP0M0C0P0, + MAC2MSP0M0C0P1, + MAC2MSP0M1C0P0, + MAC2MSP0M1C0P1, + MAC2MSP0M2C0P0, + MAC2MSP0M2C0P1, + MAC2MSP0M3C0P0, + MAC2MSP0M3C0P1, + MAC2MSP0M4C0P0, + MAC2MSP0M4C0P1, + MAC2MSP0M5C0P0, + MAC2MSP0M5C0P1, + MAC2MSP0M6C0P0, + MAC2MSP0M6C0P1, + MAC2MSP0M7C0P0, + MAC2MSP0M7C0P1, + + MPU2MSP0M0C0P0, + MPU2MSP0M0C0P1, + MPU2MSP0M1C0P0, + MPU2MSP0M1C0P1, + MPU2MSP0M2C0P0, + MPU2MSP0M2C0P1, + MPU2MSP0M3C0P0, + MPU2MSP0M3C0P1, + MPU2MSP0M4C0P0, + MPU2MSP0M4C0P1, + MPU2MSP0M5C0P0, + MPU2MSP0M5C0P1, + MPU2MSP0M6C0P0, + MPU2MSP0M6C0P1, + MPU2MSP0M7C0P0, + MPU2MSP0M7C0P1, + + MIRB2MSP0M0C0P0, + MIRB2MSP0M0C0P1, + MIRB2MSP0M1C0P0, + MIRB2MSP0M1C0P1, + MIRB2MSP0M2C0P0, + MIRB2MSP0M2C0P1, + MIRB2MSP0M3C0P0, + MIRB2MSP0M3C0P1, + MIRB2MSP0M4C0P0, + MIRB2MSP0M4C0P1, + MIRB2MSP0M5C0P0, + MIRB2MSP0M5C0P1, + MIRB2MSP0M6C0P0, + MIRB2MSP0M6C0P1, + MIRB2MSP0M7C0P0, + MIRB2MSP0M7C0P1, + + MIRL2MSP0M0C0P0, + MIRL2MSP0M0C0P1, + MIRL2MSP0M1C0P0, + MIRL2MSP0M1C0P1, + MIRL2MSP0M2C0P0, + MIRL2MSP0M2C0P1, + MIRL2MSP0M3C0P0, + MIRL2MSP0M3C0P1, + MIRL2MSP0M4C0P0, + MIRL2MSP0M4C0P1, + MIRL2MSP0M5C0P0, + MIRL2MSP0M5C0P1, + MIRL2MSP0M6C0P0, + MIRL2MSP0M6C0P1, + MIRL2MSP0M7C0P0, + MIRL2MSP0M7C0P1, + + MIRM2MSP0M0C0P0, + MIRM2MSP0M0C0P1, + MIRM2MSP0M1C0P0, + MIRM2MSP0M1C0P1, + MIRM2MSP0M2C0P0, + MIRM2MSP0M2C0P1, + MIRM2MSP0M3C0P0, + MIRM2MSP0M3C0P1, + MIRM2MSP0M4C0P0, + MIRM2MSP0M4C0P1, + MIRM2MSP0M5C0P0, + MIRM2MSP0M5C0P1, + MIRM2MSP0M6C0P0, + MIRM2MSP0M6C0P1, + MIRM2MSP0M7C0P0, + MIRM2MSP0M7C0P1, + + MIRH2MSP0M0C0P0, + MIRH2MSP0M0C0P1, + MIRH2MSP0M1C0P0, + MIRH2MSP0M1C0P1, + MIRH2MSP0M2C0P0, + MIRH2MSP0M2C0P1, + MIRH2MSP0M3C0P0, + MIRH2MSP0M3C0P1, + MIRH2MSP0M4C0P0, + MIRH2MSP0M4C0P1, + MIRH2MSP0M5C0P0, + MIRH2MSP0M5C0P1, + MIRH2MSP0M6C0P0, + MIRH2MSP0M6C0P1, + MIRH2MSP0M7C0P0, + MIRH2MSP0M7C0P1, + + MTS2MSP0M0C0P0, + MTS2MSP0M0C0P1, + MTS2MSP0M1C0P0, + MTS2MSP0M1C0P1, + MTS2MSP0M2C0P0, + MTS2MSP0M2C0P1, + MTS2MSP0M3C0P0, + MTS2MSP0M3C0P1, + MTS2MSP0M4C0P0, + MTS2MSP0M4C0P1, + MTS2MSP0M5C0P0, + MTS2MSP0M5C0P1, + MTS2MSP0M6C0P0, + MTS2MSP0M6C0P1, + MTS2MSP0M7C0P0, + MTS2MSP0M7C0P1, + + MEMSP2MSPM0C0P0, + MEMSP2MSPM0C0P1, + MEMSP2MSPM1C0P0, + MEMSP2MSPM1C0P1, + MEMSP2MSPM2C0P0, + MEMSP2MSPM2C0P1, + MEMSP2MSPM3C0P0, + MEMSP2MSPM3C0P1, + MEMSP2MSPM4C0P0, + MEMSP2MSPM4C0P1, + MEMSP2MSPM5C0P0, + MEMSP2MSPM5C0P1, + MEMSP2MSPM6C0P0, + MEMSP2MSPM6C0P1, + MEMSP2MSPM7C0P0, + MEMSP2MSPM7C0P1, + + M4RD2MSP0M0C0P0, + M4RD2MSP0M0C0P1, + M4RD2MSP0M1C0P0, + M4RD2MSP0M1C0P1, + M4RD2MSP0M2C0P0, + M4RD2MSP0M2C0P1, + M4RD2MSP0M3C0P0, + M4RD2MSP0M3C0P1, + M4RD2MSP0M4C0P0, + M4RD2MSP0M4C0P1, + M4RD2MSP0M5C0P0, + M4RD2MSP0M5C0P1, + M4RD2MSP0M6C0P0, + M4RD2MSP0M6C0P1, + M4RD2MSP0M7C0P0, + M4RD2MSP0M7C0P1, + + M4WR2MSP0M0C0P0, + M4WR2MSP0M0C0P1, + M4WR2MSP0M1C0P0, + M4WR2MSP0M1C0P1, + M4WR2MSP0M2C0P0, + M4WR2MSP0M2C0P1, + M4WR2MSP0M3C0P0, + M4WR2MSP0M3C0P1, + M4WR2MSP0M4C0P0, + M4WR2MSP0M4C0P1, + M4WR2MSP0M5C0P0, + M4WR2MSP0M5C0P1, + M4WR2MSP0M6C0P0, + M4WR2MSP0M6C0P1, + M4WR2MSP0M7C0P0, + M4WR2MSP0M7C0P1, + + MIRC2MSP0M0, + MIRC2MSP0M1, + MIRC2MSP0M2, + MIRC2MSP0M3, + MIRC2MSP0M4, + MIRC2MSP0M5, + MIRC2MSP0M6, + MIRC2MSP0M7, + + MLP2P0M0, + MLP2P0M1, + MLP2P0M2, + MLP2P0M3, + MLP2P0M4, + MLP2P0M5, + MLP2P0M6, + MLP2P0M7, + + TEMP2MSCENT, + TEMP2MSDIMM, + MEMSP2MS, + + // ------------------------------------------------------ + // Partition Sensors + // ------------------------------------------------------ + UTIL2MSSLCG000, + UTIL2MSSLCG001, + UTIL2MSSLCG002, + UTIL2MSSLCG003, + UTIL2MSSLCG004, + UTIL2MSSLCG005, + UTIL2MSSLCG006, + UTIL2MSSLCG007, + UTIL2MSSLCG008, + UTIL2MSSLCG009, + UTIL2MSSLCG010, + UTIL2MSSLCG011, + + // ------------------------------------------------------ + // END of Sensor List (this must be last entry) + // ------------------------------------------------------ + NUMBER_OF_SENSORS_IN_LIST, +}; + +#endif + diff --git a/src/occ_405/sensor/sensor_info.c b/src/occ_405/sensor/sensor_info.c new file mode 100755 index 0000000..d23f2aa --- /dev/null +++ b/src/occ_405/sensor/sensor_info.c @@ -0,0 +1,308 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/occ/sensor/sensor_info.c $ */ +/* */ +/* OpenPOWER OnChipController Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef APPLET_BUILD +#warning "This file is only in OCC App Source Tree for convenience of updating sensors in one place." +#error "This file can only be included and built into an applet due to large table size" +#endif + +#include <occ_common.h> // STATIC_ASSERT macro +#include <sensor.h> // 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 AMEFP_SCALE_0_16384 AMEFP(610352,-8) // scalar so that digital 16384=100% + +// This will get the string when given the GSID +#define SENSOR_GSID_TO_STRING(gsid) G_sensor_list[gsid].name; + +// This will define the fields of the "sensor" member of the sensor_info_t +#define SENSOR_VALUES(units, type, location, number, frequency, scaleFactor) \ + .sensor = { units, type, location, number, frequency, scaleFactor },} + +// This will put a single sensor entry into the sensor list table +#define SENSOR_INFO_T_ENTRY(sensor_name, units, type, location, number, frequency, scaleFactor) \ + [sensor_name] = {.name = #sensor_name, \ + .sensor = { units, type, location, number, frequency, scaleFactor },} + +// This will paste a number onto a sensor name base to create the full enum +// representation of the sensor name +#define SENSOR_W_NUM(sensor_name, num) sensor_name##num + +// This will paste a number onto a sensor name base to create the full enum +// representation of the sensor name +#define SENSOR_W_CENTAUR_NUM_HELPER(sensor_name, memc,centL,cent,ppL,pp) sensor_name##memc##centL##cent##ppL##pp +#define SENSOR_W_CENTAUR_NUM(sensor_name, memc,cent,pp) SENSOR_W_CENTAUR_NUM_HELPER(sensor_name,memc,C,cent,P,pp) + +// This will stringify the enum so to create the sensor name. This will help +// save keystrokes, as well as reduce typos & copy paste errors. +#define SENSOR_STRING(sensor_name) #sensor_name + +// This will stringify the enum so to create the sensor name. This will help +// save keystrokes, as well as reduce typos & copy paste errors. +#define CENTAUR_SENSOR_STRING_HELPER(sensor_name, memc,centL,cent,ppL,pp) SENSOR_STRING(sensor_name##memc##centL##cent##ppL##pp) +#define CENTAUR_SENSOR_STRING(sensor_name,memc,cent,pp) CENTAUR_SENSOR_STRING_HELPER(sensor_name, memc,C,cent,P,pp) + +// This will create a set of 12 sensor entries into the sensor list table. +// (one for each core...) The base name of the sensor enum must be passed +// and this macro will take care of the paste & stringify operations. +#define SENS_CORE_ENTRY_SET(sensor_name, units, type, location, number, frequency, scaleFactor) \ + [SENSOR_W_NUM(sensor_name,0)] = {.name = SENSOR_STRING(sensor_name ## 1), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_NUM(sensor_name,1)] = {.name = SENSOR_STRING(sensor_name ## 2), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_NUM(sensor_name,2)] = {.name = SENSOR_STRING(sensor_name ## 3), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_NUM(sensor_name,3)] = {.name = SENSOR_STRING(sensor_name ## 4), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_NUM(sensor_name,4)] = {.name = SENSOR_STRING(sensor_name ## 5), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_NUM(sensor_name,5)] = {.name = SENSOR_STRING(sensor_name ## 6), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_NUM(sensor_name,6)] = {.name = SENSOR_STRING(sensor_name ## 9), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_NUM(sensor_name,7)] = {.name = SENSOR_STRING(sensor_name ## 10), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_NUM(sensor_name,8)] = {.name = SENSOR_STRING(sensor_name ## 11), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_NUM(sensor_name,9)] = {.name = SENSOR_STRING(sensor_name ## 12), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_NUM(sensor_name,10)] = {.name = SENSOR_STRING(sensor_name ## 13), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_NUM(sensor_name,11)] = {.name = SENSOR_STRING(sensor_name ## 14), \ + .sensor = { units, type, location, number, frequency, scaleFactor },} + +// This will create a set of 8 sensor entries into the sensor list table. +// (one for each memc...) The base name of the sensor enum must be passed +// and this macro will take care of the paste & stringify operations. +#define SENS_MEMC_ENTRY_SET(sensor_name, units, type, location, number, frequency, scaleFactor) \ + [SENSOR_W_NUM(sensor_name,0)] = {.name = SENSOR_STRING(sensor_name ## 0), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_NUM(sensor_name,1)] = {.name = SENSOR_STRING(sensor_name ## 1), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_NUM(sensor_name,2)] = {.name = SENSOR_STRING(sensor_name ## 2), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_NUM(sensor_name,3)] = {.name = SENSOR_STRING(sensor_name ## 3), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_NUM(sensor_name,4)] = {.name = SENSOR_STRING(sensor_name ## 4), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_NUM(sensor_name,5)] = {.name = SENSOR_STRING(sensor_name ## 5), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_NUM(sensor_name,6)] = {.name = SENSOR_STRING(sensor_name ## 6), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_NUM(sensor_name,7)] = {.name = SENSOR_STRING(sensor_name ## 7), \ + .sensor = { units, type, location, number, frequency, scaleFactor },} + + +// This will create a set of 16 sensor entries into the sensor list table. +// (one for each centaur...) The base name of the sensor enum must be passed +// and this macro will take care of the paste & stringify operations. +#define SEN_CENTR_ENTRY_SET(sensor_name, units, type, location, number, frequency, scaleFactor) \ + [SENSOR_W_CENTAUR_NUM(sensor_name,0,0,0)] = {.name = CENTAUR_SENSOR_STRING(sensor_name,0,0,0), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_CENTAUR_NUM(sensor_name,0,0,1)] = {.name = CENTAUR_SENSOR_STRING(sensor_name,0,0,1), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_CENTAUR_NUM(sensor_name,1,0,0)] = {.name = CENTAUR_SENSOR_STRING(sensor_name,1,0,0), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_CENTAUR_NUM(sensor_name,1,0,1)] = {.name = CENTAUR_SENSOR_STRING(sensor_name,1,0,1), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_CENTAUR_NUM(sensor_name,2,0,0)] = {.name = CENTAUR_SENSOR_STRING(sensor_name,2,0,0), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_CENTAUR_NUM(sensor_name,2,0,1)] = {.name = CENTAUR_SENSOR_STRING(sensor_name,2,0,1), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_CENTAUR_NUM(sensor_name,3,0,0)] = {.name = CENTAUR_SENSOR_STRING(sensor_name,3,0,0), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_CENTAUR_NUM(sensor_name,3,0,1)] = {.name = CENTAUR_SENSOR_STRING(sensor_name,3,0,1), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_CENTAUR_NUM(sensor_name,4,0,0)] = {.name = CENTAUR_SENSOR_STRING(sensor_name,4,0,0), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_CENTAUR_NUM(sensor_name,4,0,1)] = {.name = CENTAUR_SENSOR_STRING(sensor_name,4,0,1), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_CENTAUR_NUM(sensor_name,5,0,0)] = {.name = CENTAUR_SENSOR_STRING(sensor_name,5,0,0), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_CENTAUR_NUM(sensor_name,5,0,1)] = {.name = CENTAUR_SENSOR_STRING(sensor_name,5,0,1), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_CENTAUR_NUM(sensor_name,6,0,0)] = {.name = CENTAUR_SENSOR_STRING(sensor_name,6,0,0), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_CENTAUR_NUM(sensor_name,6,0,1)] = {.name = CENTAUR_SENSOR_STRING(sensor_name,6,0,1), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_CENTAUR_NUM(sensor_name,7,0,0)] = {.name = CENTAUR_SENSOR_STRING(sensor_name,7,0,0), \ + .sensor = { units, type, location, number, frequency, scaleFactor },}, \ + [SENSOR_W_CENTAUR_NUM(sensor_name,7,0,1)] = {.name = CENTAUR_SENSOR_STRING(sensor_name,7,0,1), \ + .sensor = { units, type, location, number, frequency, scaleFactor },} + + +// This table takes care of the ordering of the sensors (by GSID) and all parameters needed for AMEC or AMESTER. The order +// that is in the table below doesn't matter because we use designated initializers. +// If anything more than the barebones sensor_t is need, an applet will need to be called in order to gather that data. +// For refernce: +// AMEFP(1, 3); // 1000:1 scale factor +// AMEFP(1, 0); // 1:1 scale factor +// AMEFP(1,-1); // 1:0.1 scale factor +// AMEFP(1,-3); // 1:0.001 scale factor +// +const sensor_info_t G_sensor_info[] = +{ + /* ==FirmwareSensors== NameString Units Type Location Number Freq ScaleFactor */ + SENSOR_INFO_T_ENTRY( AMEintdur, "us\0", AMEC_SENSOR_TYPE_TIME, AMEC_SENSOR_LOC_OCC, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( AMESSdur0, "us\0", AMEC_SENSOR_TYPE_TIME, AMEC_SENSOR_LOC_OCC, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( AMESSdur1, "us\0", AMEC_SENSOR_TYPE_TIME, AMEC_SENSOR_LOC_OCC, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( AMESSdur2, "us\0", AMEC_SENSOR_TYPE_TIME, AMEC_SENSOR_LOC_OCC, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( AMESSdur3, "us\0", AMEC_SENSOR_TYPE_TIME, AMEC_SENSOR_LOC_OCC, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( AMESSdur4, "us\0", AMEC_SENSOR_TYPE_TIME, AMEC_SENSOR_LOC_OCC, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( AMESSdur5, "us\0", AMEC_SENSOR_TYPE_TIME, AMEC_SENSOR_LOC_OCC, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( AMESSdur6, "us\0", AMEC_SENSOR_TYPE_TIME, AMEC_SENSOR_LOC_OCC, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( AMESSdur7, "us\0", AMEC_SENSOR_TYPE_TIME, AMEC_SENSOR_LOC_OCC, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PROBE250US0, "n/a\0", AMEC_SENSOR_TYPE_GENERIC, AMEC_SENSOR_LOC_OCC, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PROBE250US1, "n/a\0", AMEC_SENSOR_TYPE_GENERIC, AMEC_SENSOR_LOC_OCC, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PROBE250US2, "n/a\0", AMEC_SENSOR_TYPE_GENERIC, AMEC_SENSOR_LOC_OCC, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PROBE250US3, "n/a\0", AMEC_SENSOR_TYPE_GENERIC, AMEC_SENSOR_LOC_OCC, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PROBE250US4, "n/a\0", AMEC_SENSOR_TYPE_GENERIC, AMEC_SENSOR_LOC_OCC, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PROBE250US5, "n/a\0", AMEC_SENSOR_TYPE_GENERIC, AMEC_SENSOR_LOC_OCC, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PROBE250US6, "n/a\0", AMEC_SENSOR_TYPE_GENERIC, AMEC_SENSOR_LOC_OCC, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PROBE250US7, "n/a\0", AMEC_SENSOR_TYPE_GENERIC, AMEC_SENSOR_LOC_OCC, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( GPEtickdur0, "us\0", AMEC_SENSOR_TYPE_TIME, AMEC_SENSOR_LOC_OCC, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( GPEtickdur1, "us\0", AMEC_SENSOR_TYPE_TIME, AMEC_SENSOR_LOC_OCC, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( RTLtickdur, "us\0", AMEC_SENSOR_TYPE_TIME, AMEC_SENSOR_LOC_OCC, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + + /* ==SystemSensors== NameString Units Type Location Number Freq ScaleFactor */ + SENSOR_INFO_T_ENTRY( TEMPAMBIENT, "C\0", AMEC_SENSOR_TYPE_TEMP, AMEC_SENSOR_LOC_SYS, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( ALTITUDE, "m\0", AMEC_SENSOR_TYPE_TEMP, AMEC_SENSOR_LOC_SYS, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PWR250US, "W\0", AMEC_SENSOR_TYPE_POWER, AMEC_SENSOR_LOC_SYS, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PWR250USFAN, "W\0", AMEC_SENSOR_TYPE_POWER, AMEC_SENSOR_LOC_SYS, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PWR250USIO, "W\0", AMEC_SENSOR_TYPE_POWER, AMEC_SENSOR_LOC_SYS, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PWR250USSTORE, "W\0", AMEC_SENSOR_TYPE_POWER, AMEC_SENSOR_LOC_SYS, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PWR250USGPU, "W\0", AMEC_SENSOR_TYPE_POWER, AMEC_SENSOR_LOC_SYS, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( FANSPEEDAVG, "RPM\0", AMEC_SENSOR_TYPE_TEMP, AMEC_SENSOR_LOC_SYS, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PWRAPSSCH0, "W\0", AMEC_SENSOR_TYPE_POWER, AMEC_SENSOR_LOC_SYS, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PWRAPSSCH1, "W\0", AMEC_SENSOR_TYPE_POWER, AMEC_SENSOR_LOC_SYS, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PWRAPSSCH2, "W\0", AMEC_SENSOR_TYPE_POWER, AMEC_SENSOR_LOC_SYS, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PWRAPSSCH3, "W\0", AMEC_SENSOR_TYPE_POWER, AMEC_SENSOR_LOC_SYS, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PWRAPSSCH4, "W\0", AMEC_SENSOR_TYPE_POWER, AMEC_SENSOR_LOC_SYS, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PWRAPSSCH5, "W\0", AMEC_SENSOR_TYPE_POWER, AMEC_SENSOR_LOC_SYS, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PWRAPSSCH6, "W\0", AMEC_SENSOR_TYPE_POWER, AMEC_SENSOR_LOC_SYS, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PWRAPSSCH7, "W\0", AMEC_SENSOR_TYPE_POWER, AMEC_SENSOR_LOC_SYS, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PWRAPSSCH8, "W\0", AMEC_SENSOR_TYPE_POWER, AMEC_SENSOR_LOC_SYS, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PWRAPSSCH9, "W\0", AMEC_SENSOR_TYPE_POWER, AMEC_SENSOR_LOC_SYS, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PWRAPSSCH10, "W\0", AMEC_SENSOR_TYPE_POWER, AMEC_SENSOR_LOC_SYS, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PWRAPSSCH11, "W\0", AMEC_SENSOR_TYPE_POWER, AMEC_SENSOR_LOC_SYS, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PWRAPSSCH12, "W\0", AMEC_SENSOR_TYPE_POWER, AMEC_SENSOR_LOC_SYS, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PWRAPSSCH13, "W\0", AMEC_SENSOR_TYPE_POWER, AMEC_SENSOR_LOC_SYS, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PWRAPSSCH14, "W\0", AMEC_SENSOR_TYPE_POWER, AMEC_SENSOR_LOC_SYS, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PWRAPSSCH15, "W\0", AMEC_SENSOR_TYPE_POWER, AMEC_SENSOR_LOC_SYS, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + + + /* ==ChipSensors== NameString Units Type Location Number Freq ScaleFactor */ + SENSOR_INFO_T_ENTRY( TODclock0, "us\0", AMEC_SENSOR_TYPE_TIME, AMEC_SENSOR_LOC_ALL, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 16, 0) ), + SENSOR_INFO_T_ENTRY( TODclock1, "sec\0", AMEC_SENSOR_TYPE_TIME, AMEC_SENSOR_LOC_ALL, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1048576,-6) ), + SENSOR_INFO_T_ENTRY( TODclock2, "day\0", AMEC_SENSOR_TYPE_TIME, AMEC_SENSOR_LOC_ALL, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 795364,-6) ), + + /* ==ProcSensors== NameString Units Type Location Number Freq ScaleFactor */ + SENSOR_INFO_T_ENTRY( FREQA2MSP0, "MHz\0", AMEC_SENSOR_TYPE_FREQ, AMEC_SENSOR_LOC_PROC, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( IPS2MSP0, "MIP\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_PROC, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( MEMSP2MSP0, "%\0", AMEC_SENSOR_TYPE_TIME, AMEC_SENSOR_LOC_PROC, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PWR250USP0, "W\0", AMEC_SENSOR_TYPE_POWER, AMEC_SENSOR_LOC_PROC, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PWR250USVDD0, "W\0", AMEC_SENSOR_TYPE_POWER, AMEC_SENSOR_LOC_PROC, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( CUR250USVDD0, "A\0", AMEC_SENSOR_TYPE_CURRENT, AMEC_SENSOR_LOC_PROC, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1,-2) ), + SENSOR_INFO_T_ENTRY( PWR250USVCS0, "W\0", AMEC_SENSOR_TYPE_POWER, AMEC_SENSOR_LOC_PROC, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( PWR250USMEM0, "W\0", AMEC_SENSOR_TYPE_POWER, AMEC_SENSOR_LOC_PROC, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( SLEEPCNT2MSP0, "#\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_PROC, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( WINKCNT2MSP0, "#\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_PROC, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( SP250USP0, "%\0", AMEC_SENSOR_TYPE_FREQ, AMEC_SENSOR_LOC_PROC, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( TEMP2MSP0, "C\0", AMEC_SENSOR_TYPE_TEMP, AMEC_SENSOR_LOC_PROC, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( TEMP2MSP0PEAK, "C\0", AMEC_SENSOR_TYPE_TEMP, AMEC_SENSOR_LOC_PROC, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( UTIL2MSP0, "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_PROC, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1,-2) ), + 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) ), + + /* ==ReguSensors== NameString Units Type Location Number Freq ScaleFactor */ + SENSOR_INFO_T_ENTRY( UVOLT250USP0V0, "mV\0", AMEC_SENSOR_TYPE_VOLTAGE, AMEC_SENSOR_LOC_VRM, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, -1) ), + SENSOR_INFO_T_ENTRY( UVOLT250USP0V1, "mV\0", AMEC_SENSOR_TYPE_VOLTAGE, AMEC_SENSOR_LOC_VRM, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, -1) ), + SENSOR_INFO_T_ENTRY( VOLT250USP0V0, "mV\0", AMEC_SENSOR_TYPE_VOLTAGE, AMEC_SENSOR_LOC_VRM, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, -1) ), + SENSOR_INFO_T_ENTRY( VOLT250USP0V1, "mV\0", AMEC_SENSOR_TYPE_VOLTAGE, AMEC_SENSOR_LOC_VRM, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, -1) ), + + /* ==CoreSensors== NameString Units Type Location Number Freq ScaleFactor */ + SENS_CORE_ENTRY_SET( FREQ250USP0C , "MHz\0", AMEC_SENSOR_TYPE_FREQ, AMEC_SENSOR_LOC_CORE, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SENS_CORE_ENTRY_SET( FREQA2MSP0C , "MHz\0", AMEC_SENSOR_TYPE_FREQ, AMEC_SENSOR_LOC_CORE, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENS_CORE_ENTRY_SET( IPS2MSP0C , "MIP\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_CORE, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENS_CORE_ENTRY_SET( NOTBZE2MSP0C , "cyc\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_CORE, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENS_CORE_ENTRY_SET( NOTFIN2MSP0C , "cyc\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_CORE, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENS_CORE_ENTRY_SET( SPURR2MSP0C , "%\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_CORE, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENS_CORE_ENTRY_SET( TEMP2MSP0C , "C\0", AMEC_SENSOR_TYPE_TEMP, AMEC_SENSOR_LOC_CORE, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENS_CORE_ENTRY_SET( UTIL2MSP0C , "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_CORE, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1,-2) ), + SENS_CORE_ENTRY_SET( NUTIL3SP0C , "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_CORE, AMEC_SENSOR_NONUM, AMEEFP_3S_IN_HZ, AMEFP( 1,-2) ), + SENS_CORE_ENTRY_SET( MSTL2MSP0C , "cpi\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_CORE, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENS_CORE_ENTRY_SET( CMT2MSP0C , "%\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_CORE, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENS_CORE_ENTRY_SET( CMBW2MSP0C , "GBs\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_CORE, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 256, -5) ), + SENS_CORE_ENTRY_SET( PPICP0C , "%\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_CORE, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENS_CORE_ENTRY_SET( PWRPX250USP0C , "W\0", AMEC_SENSOR_TYPE_POWER, AMEC_SENSOR_LOC_CORE, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + + /* ==MemSensors== NameString Units Type Location Number Freq ScaleFactor */ + SENSOR_INFO_T_ENTRY( VRFAN250USMEM, "pin\0", AMEC_SENSOR_TYPE_TEMP, AMEC_SENSOR_LOC_VRM, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( VRHOT250USMEM, "pin\0", AMEC_SENSOR_TYPE_TEMP, AMEC_SENSOR_LOC_VRM, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SENS_MEMC_ENTRY_SET( MRD2MSP0M, "GBs\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_MEM, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 128, -5) ), + SENS_MEMC_ENTRY_SET( MWR2MSP0M, "GBs\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_MEM, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 128, -5) ), + SENS_MEMC_ENTRY_SET( MIRC2MSP0M, "eps\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_MEM, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SENS_MEMC_ENTRY_SET( MLP2P0M, "eps\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_MEM, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SENS_MEMC_ENTRY_SET( TEMPDIMMAXP0M, "C\0", AMEC_SENSOR_TYPE_TEMP, AMEC_SENSOR_LOC_MEM, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + SENS_MEMC_ENTRY_SET( LOCDIMMAXP0M, "loc\0", AMEC_SENSOR_TYPE_TEMP, AMEC_SENSOR_LOC_MEM, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 1, 0) ), + + /* ==CentaurSensors== NameString Units Type Location Number Freq ScaleFactor */ + SEN_CENTR_ENTRY_SET( MAC2MSP0M, "rps\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_MEM, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SEN_CENTR_ENTRY_SET( MPU2MSP0M, "rps\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_MEM, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SEN_CENTR_ENTRY_SET( MIRB2MSP0M, "eps\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_MEM, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SEN_CENTR_ENTRY_SET( MIRL2MSP0M, "eps\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_MEM, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SEN_CENTR_ENTRY_SET( MIRM2MSP0M, "eps\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_MEM, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SEN_CENTR_ENTRY_SET( MIRH2MSP0M, "eps\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_MEM, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SEN_CENTR_ENTRY_SET( MTS2MSP0M, "cnt\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_MEM, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SEN_CENTR_ENTRY_SET( MEMSP2MSPM, "%\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_MEM, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SEN_CENTR_ENTRY_SET( M4RD2MSP0M, "GBs\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_MEM, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 128, -5) ), + SEN_CENTR_ENTRY_SET( M4WR2MSP0M, "GBs\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_MEM, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP( 128, -5) ), + + + /* ==MemSummarySensors== NameString Units Type Location Number Freq ScaleFactor */ + SENSOR_INFO_T_ENTRY( TEMP2MSCENT, "C\0", AMEC_SENSOR_TYPE_TEMP, AMEC_SENSOR_LOC_MEM, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( TEMP2MSDIMM, "C\0", AMEC_SENSOR_TYPE_TEMP, AMEC_SENSOR_LOC_MEM, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + SENSOR_INFO_T_ENTRY( MEMSP2MS, "%\0", AMEC_SENSOR_TYPE_PERF, AMEC_SENSOR_LOC_MEM, AMEC_SENSOR_NONUM, AMEEFP_250US_IN_HZ, AMEFP( 1, 0) ), + + /* ==PartSummarySensors== NameString Units Type Location Number Freq ScaleFactor */ + SENSOR_INFO_T_ENTRY( UTIL2MSSLCG000, "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_LPAR, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP_SCALE_0_16384), + SENSOR_INFO_T_ENTRY( UTIL2MSSLCG001, "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_LPAR, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP_SCALE_0_16384), + SENSOR_INFO_T_ENTRY( UTIL2MSSLCG002, "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_LPAR, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP_SCALE_0_16384), + SENSOR_INFO_T_ENTRY( UTIL2MSSLCG003, "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_LPAR, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP_SCALE_0_16384), + SENSOR_INFO_T_ENTRY( UTIL2MSSLCG004, "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_LPAR, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP_SCALE_0_16384), + SENSOR_INFO_T_ENTRY( UTIL2MSSLCG005, "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_LPAR, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP_SCALE_0_16384), + SENSOR_INFO_T_ENTRY( UTIL2MSSLCG006, "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_LPAR, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP_SCALE_0_16384), + SENSOR_INFO_T_ENTRY( UTIL2MSSLCG007, "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_LPAR, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP_SCALE_0_16384), + SENSOR_INFO_T_ENTRY( UTIL2MSSLCG008, "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_LPAR, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP_SCALE_0_16384), + SENSOR_INFO_T_ENTRY( UTIL2MSSLCG009, "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_LPAR, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP_SCALE_0_16384), + SENSOR_INFO_T_ENTRY( UTIL2MSSLCG010, "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_LPAR, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP_SCALE_0_16384), + SENSOR_INFO_T_ENTRY( UTIL2MSSLCG011, "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_LPAR, AMEC_SENSOR_NONUM, AMEEFP_2MS_IN_HZ, AMEFP_SCALE_0_16384), +}; + +// Cause a compile error if we don't have all the sensors in the enum in the initialization list. +STATIC_ASSERT( (NUMBER_OF_SENSORS_IN_LIST != (sizeof(G_sensor_info)/sizeof(sensor_info_t))) ); +STATIC_ASSERT( (MAX_AMEC_SENSORS < (sizeof(G_sensor_info)/sizeof(sensor_info_t))) ); diff --git a/src/occ_405/sensor/sensor_service_codes.h b/src/occ_405/sensor/sensor_service_codes.h new file mode 100755 index 0000000..517d9e3 --- /dev/null +++ b/src/occ_405/sensor/sensor_service_codes.h @@ -0,0 +1,37 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/occ_405/sensor/sensor_service_codes.h $ */ +/* */ +/* OpenPOWER OnChipController Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef _SENSOR_SERVICE_CODES_H_ +#define _SENSOR_SERVICE_CODES_H_ + +#include <comp_ids.h> + +enum occSensorModuleId +{ + SENSOR_QUERY_LIST = SNSR_COMP_ID | 0x00, + SENSOR_INITIALIZE = SNSR_COMP_ID | 0x01, +}; + +#endif /* #ifndef _SENSOR_SERVICE_CODES_H_ */ diff --git a/src/occ_405/sensor/sensor_table.c b/src/occ_405/sensor/sensor_table.c new file mode 100755 index 0000000..86786e0 --- /dev/null +++ b/src/occ_405/sensor/sensor_table.c @@ -0,0 +1,508 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/occ_405/sensor/sensor_table.c $ */ +/* */ +/* OpenPOWER OnChipController Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ + + +#include <sensor.h> // sensor structure and other defines +#include <occ_common.h> // For size_t needed by memset +#include <amec_sys.h> // For pointers to amec_sys_t structures +#include <dcom.h> // For mini-sensor pointers + +extern amec_sys_t g_amec_sys; + +// Will create an entry in the G_amec_sensor_list with a pointer at the sensor +// index (gsid) passed in by "sensor" +#define SENSOR_PTR(sensor,ptr) [sensor] = ptr + +// Will paste number onto enum 'sensor base name' +#define SENSOR_W_NUM(sensor,num) sensor##num + +// This will paste a number onto a sensor name base to create the full enum +// representation of the sensor name +#define SENSOR_W_CENTAUR_NUM_HELPER(sensor_name, memc,centL,cent,ppL,pp) sensor_name##memc##centL##cent##ppL##pp +#define SENSOR_W_CENTAUR_NUM(sensor_name, memc,cent,pp) SENSOR_W_CENTAUR_NUM_HELPER(sensor_name,memc,C,cent,P,pp) + +// Will define a set of "core sensor pointers" by passing in base sensor name +// and ptr to [0] entry of array of 12 core sensors +#define CORE_SENSOR_PTRS(sensor,ptrbase,ptrmember) \ + [SENSOR_W_NUM(sensor, 0)] = ptrbase[ 0].ptrmember, \ + [SENSOR_W_NUM(sensor, 1)] = ptrbase[ 1].ptrmember, \ + [SENSOR_W_NUM(sensor, 2)] = ptrbase[ 2].ptrmember, \ + [SENSOR_W_NUM(sensor, 3)] = ptrbase[ 3].ptrmember, \ + [SENSOR_W_NUM(sensor, 4)] = ptrbase[ 4].ptrmember, \ + [SENSOR_W_NUM(sensor, 5)] = ptrbase[ 5].ptrmember, \ + [SENSOR_W_NUM(sensor, 6)] = ptrbase[ 6].ptrmember, \ + [SENSOR_W_NUM(sensor, 7)] = ptrbase[ 7].ptrmember, \ + [SENSOR_W_NUM(sensor, 8)] = ptrbase[ 8].ptrmember, \ + [SENSOR_W_NUM(sensor, 9)] = ptrbase[ 9].ptrmember, \ + [SENSOR_W_NUM(sensor,10)] = ptrbase[10].ptrmember, \ + [SENSOR_W_NUM(sensor,11)] = ptrbase[11].ptrmember + +// Will define a set of "memory controller sensor pointers" by passing in +// base sensor nameand ptr to [0] entry of array of 8 memcontroller sensors +#define MEMCONTROL_SENSOR_PTRS(sensor,ptrbase,ptrmember) \ + [SENSOR_W_NUM(sensor, 0)] = ptrbase[0].ptrmember, \ + [SENSOR_W_NUM(sensor, 1)] = ptrbase[1].ptrmember, \ + [SENSOR_W_NUM(sensor, 2)] = ptrbase[2].ptrmember, \ + [SENSOR_W_NUM(sensor, 3)] = ptrbase[3].ptrmember, \ + [SENSOR_W_NUM(sensor, 4)] = ptrbase[4].ptrmember, \ + [SENSOR_W_NUM(sensor, 5)] = ptrbase[5].ptrmember, \ + [SENSOR_W_NUM(sensor, 6)] = ptrbase[6].ptrmember, \ + [SENSOR_W_NUM(sensor, 7)] = ptrbase[7].ptrmember + +// Will define a set of "centaur_port_pair sensor pointers" by passing in +// base sensor nameand ptr to [0] entry of array of 16 memcontroller sensors +#define PORTPAIR_SENSOR_PTRS(sensor,ptrbase,ptrmember,ptrsnsr) \ + [SENSOR_W_CENTAUR_NUM(sensor, 0, 0, 0)] = ptrbase[0].ptrmember[0].ptrsnsr, \ + [SENSOR_W_CENTAUR_NUM(sensor, 0, 0, 1)] = ptrbase[0].ptrmember[1].ptrsnsr, \ + [SENSOR_W_CENTAUR_NUM(sensor, 1, 0, 0)] = ptrbase[1].ptrmember[0].ptrsnsr, \ + [SENSOR_W_CENTAUR_NUM(sensor, 1, 0, 1)] = ptrbase[1].ptrmember[1].ptrsnsr, \ + [SENSOR_W_CENTAUR_NUM(sensor, 2, 0, 0)] = ptrbase[2].ptrmember[0].ptrsnsr, \ + [SENSOR_W_CENTAUR_NUM(sensor, 2, 0, 1)] = ptrbase[2].ptrmember[1].ptrsnsr, \ + [SENSOR_W_CENTAUR_NUM(sensor, 3, 0, 0)] = ptrbase[3].ptrmember[0].ptrsnsr, \ + [SENSOR_W_CENTAUR_NUM(sensor, 3, 0, 1)] = ptrbase[3].ptrmember[1].ptrsnsr, \ + [SENSOR_W_CENTAUR_NUM(sensor, 4, 0, 0)] = ptrbase[4].ptrmember[0].ptrsnsr, \ + [SENSOR_W_CENTAUR_NUM(sensor, 4, 0, 1)] = ptrbase[4].ptrmember[1].ptrsnsr, \ + [SENSOR_W_CENTAUR_NUM(sensor, 5, 0, 0)] = ptrbase[5].ptrmember[0].ptrsnsr, \ + [SENSOR_W_CENTAUR_NUM(sensor, 5, 0, 1)] = ptrbase[5].ptrmember[1].ptrsnsr, \ + [SENSOR_W_CENTAUR_NUM(sensor, 6, 0, 0)] = ptrbase[6].ptrmember[0].ptrsnsr, \ + [SENSOR_W_CENTAUR_NUM(sensor, 6, 0, 1)] = ptrbase[6].ptrmember[1].ptrsnsr, \ + [SENSOR_W_CENTAUR_NUM(sensor, 7, 0, 0)] = ptrbase[7].ptrmember[0].ptrsnsr, \ + [SENSOR_W_CENTAUR_NUM(sensor, 7, 0, 1)] = ptrbase[7].ptrmember[1].ptrsnsr + + +// Will create an entry in the G_amec_mini_sensor_list with a pointer at +// the sensor index (gsid) passed in by "sensor" +#define MINI_SENSOR_PTR(sensor,ptr) [sensor] = ptr + +// Will define a set of "core mini-sensor pointers" by passing in base +// sensor name and ptr to [0] entry of array of core sensors +#define CORE_MINI_SENSOR_PTRS(sensor,ptr) \ + [SENSOR_W_NUM(sensor, 0)] = ptr[ 0], \ + [SENSOR_W_NUM(sensor, 1)] = ptr[ 1], \ + [SENSOR_W_NUM(sensor, 2)] = ptr[ 2], \ + [SENSOR_W_NUM(sensor, 3)] = ptr[ 3], \ + [SENSOR_W_NUM(sensor, 4)] = ptr[ 4], \ + [SENSOR_W_NUM(sensor, 5)] = ptr[ 5], \ + [SENSOR_W_NUM(sensor, 6)] = ptr[ 6], \ + [SENSOR_W_NUM(sensor, 7)] = ptr[ 7], \ + [SENSOR_W_NUM(sensor, 8)] = ptr[ 8], \ + [SENSOR_W_NUM(sensor, 9)] = ptr[ 9], \ + [SENSOR_W_NUM(sensor,10)] = ptr[10], \ + [SENSOR_W_NUM(sensor,11)] = ptr[11] + +// Will define a set of "core mini-sensor pointers" as NULL, since not +// every sensor must have a mini-sensor. +#define CORE_MINI_SENSOR_PTRS_NULL(sensor) \ + [SENSOR_W_NUM(sensor, 0)] = NULL, \ + [SENSOR_W_NUM(sensor, 1)] = NULL, \ + [SENSOR_W_NUM(sensor, 2)] = NULL, \ + [SENSOR_W_NUM(sensor, 3)] = NULL, \ + [SENSOR_W_NUM(sensor, 4)] = NULL, \ + [SENSOR_W_NUM(sensor, 5)] = NULL, \ + [SENSOR_W_NUM(sensor, 6)] = NULL, \ + [SENSOR_W_NUM(sensor, 7)] = NULL, \ + [SENSOR_W_NUM(sensor, 8)] = NULL, \ + [SENSOR_W_NUM(sensor, 9)] = NULL, \ + [SENSOR_W_NUM(sensor,10)] = NULL, \ + [SENSOR_W_NUM(sensor,11)] = NULL + +// Will define a set of "memory controller mini sensor ptrs" by passing in +// base sensor nameand ptr to [0] entry of array of 8 memcontroller sensors +#define MEMCONTROL_MINI_SENSOR_PTRS(sensor,ptr) \ + [SENSOR_W_NUM(sensor, 0)] = ptr[ 0], \ + [SENSOR_W_NUM(sensor, 1)] = ptr[ 1], \ + [SENSOR_W_NUM(sensor, 2)] = ptr[ 2], \ + [SENSOR_W_NUM(sensor, 3)] = ptr[ 3], \ + [SENSOR_W_NUM(sensor, 4)] = ptr[ 4], \ + [SENSOR_W_NUM(sensor, 5)] = ptr[ 5], \ + [SENSOR_W_NUM(sensor, 6)] = ptr[ 6], \ + [SENSOR_W_NUM(sensor, 7)] = ptr[ 7] + +// Will define a set of "memc mini-sensor pointers" as NULL, since not +// every sensor must have a mini-sensor. +#define MEMCONTROL_MINI_SENSOR_PTRS_NULL(sensor) \ + [SENSOR_W_NUM(sensor, 0)] = NULL, \ + [SENSOR_W_NUM(sensor, 1)] = NULL, \ + [SENSOR_W_NUM(sensor, 2)] = NULL, \ + [SENSOR_W_NUM(sensor, 3)] = NULL, \ + [SENSOR_W_NUM(sensor, 4)] = NULL, \ + [SENSOR_W_NUM(sensor, 5)] = NULL, \ + [SENSOR_W_NUM(sensor, 6)] = NULL, \ + [SENSOR_W_NUM(sensor, 7)] = NULL + +// Will define a set of "memory controller mini sensor ptrs" by passing in +// base sensor nameand ptr to [0] entry of array of 8 memcontroller sensors +#define PORTPAIR_MINI_SENSOR_PTRS(sensor,ptr) \ + [SENSOR_W_CENTAUR_NUM(sensor, 0, 0, 0)] = ptr[ 0], \ + [SENSOR_W_CENTAUR_NUM(sensor, 0, 0, 1)] = ptr[ 1], \ + [SENSOR_W_CENTAUR_NUM(sensor, 1, 0, 0)] = ptr[ 2], \ + [SENSOR_W_CENTAUR_NUM(sensor, 1, 0, 1)] = ptr[ 3], \ + [SENSOR_W_CENTAUR_NUM(sensor, 2, 0, 0)] = ptr[ 4], \ + [SENSOR_W_CENTAUR_NUM(sensor, 2, 0, 1)] = ptr[ 5], \ + [SENSOR_W_CENTAUR_NUM(sensor, 3, 0, 0)] = ptr[ 6], \ + [SENSOR_W_CENTAUR_NUM(sensor, 3, 0, 1)] = ptr[ 7], \ + [SENSOR_W_CENTAUR_NUM(sensor, 4, 0, 0)] = ptr[ 8], \ + [SENSOR_W_CENTAUR_NUM(sensor, 4, 0, 1)] = ptr[ 9], \ + [SENSOR_W_CENTAUR_NUM(sensor, 5, 0, 0)] = ptr[10], \ + [SENSOR_W_CENTAUR_NUM(sensor, 5, 0, 1)] = ptr[11], \ + [SENSOR_W_CENTAUR_NUM(sensor, 6, 0, 0)] = ptr[12], \ + [SENSOR_W_CENTAUR_NUM(sensor, 6, 0, 1)] = ptr[13], \ + [SENSOR_W_CENTAUR_NUM(sensor, 7, 0, 0)] = ptr[14], \ + [SENSOR_W_CENTAUR_NUM(sensor, 7, 0, 1)] = ptr[15] + +// Will define a set of "memc mini-sensor pointers" as NULL, since not +// every sensor must have a mini-sensor. +#define PORTPAIR_MINI_SENSOR_PTRS_NULL(sensor) \ + [SENSOR_W_CENTAUR_NUM(sensor, 0, 0, 0)] = NULL, \ + [SENSOR_W_CENTAUR_NUM(sensor, 0, 0, 1)] = NULL, \ + [SENSOR_W_CENTAUR_NUM(sensor, 1, 0, 0)] = NULL, \ + [SENSOR_W_CENTAUR_NUM(sensor, 1, 0, 1)] = NULL, \ + [SENSOR_W_CENTAUR_NUM(sensor, 2, 0, 0)] = NULL, \ + [SENSOR_W_CENTAUR_NUM(sensor, 2, 0, 1)] = NULL, \ + [SENSOR_W_CENTAUR_NUM(sensor, 3, 0, 0)] = NULL, \ + [SENSOR_W_CENTAUR_NUM(sensor, 3, 0, 1)] = NULL, \ + [SENSOR_W_CENTAUR_NUM(sensor, 4, 0, 0)] = NULL, \ + [SENSOR_W_CENTAUR_NUM(sensor, 4, 0, 1)] = NULL, \ + [SENSOR_W_CENTAUR_NUM(sensor, 5, 0, 0)] = NULL, \ + [SENSOR_W_CENTAUR_NUM(sensor, 5, 0, 1)] = NULL, \ + [SENSOR_W_CENTAUR_NUM(sensor, 6, 0, 0)] = NULL, \ + [SENSOR_W_CENTAUR_NUM(sensor, 6, 0, 1)] = NULL, \ + [SENSOR_W_CENTAUR_NUM(sensor, 7, 0, 0)] = NULL, \ + [SENSOR_W_CENTAUR_NUM(sensor, 7, 0, 1)] = NULL + +//**************************************************************************** +// Sensor Pointer Table +// ---------------------- +// - Indexed by GSID +// - Resident in SRAM +// - Must contain every sensor in enum, or STATIC_ASSERT will give compile +// failure. +//**************************************************************************** +const sensor_ptr_t G_amec_sensor_list[] = +{ + // ------------------------------------------------------ + // Code/Firmware Sensors + // ------------------------------------------------------ + SENSOR_PTR( AMEintdur, &g_amec_sys.fw.ameintdur), + SENSOR_PTR( AMESSdur0, &g_amec_sys.fw.amessdur[0]), + SENSOR_PTR( AMESSdur1, &g_amec_sys.fw.amessdur[1]), + SENSOR_PTR( AMESSdur2, &g_amec_sys.fw.amessdur[2]), + SENSOR_PTR( AMESSdur3, &g_amec_sys.fw.amessdur[3]), + SENSOR_PTR( AMESSdur4, &g_amec_sys.fw.amessdur[4]), + SENSOR_PTR( AMESSdur5, &g_amec_sys.fw.amessdur[5]), + SENSOR_PTR( AMESSdur6, &g_amec_sys.fw.amessdur[6]), + SENSOR_PTR( AMESSdur7, &g_amec_sys.fw.amessdur[7]), + SENSOR_PTR( PROBE250US0, &g_amec_sys.fw.probe250us[0]), + SENSOR_PTR( PROBE250US1, &g_amec_sys.fw.probe250us[1]), + SENSOR_PTR( PROBE250US2, &g_amec_sys.fw.probe250us[2]), + SENSOR_PTR( PROBE250US3, &g_amec_sys.fw.probe250us[3]), + SENSOR_PTR( PROBE250US4, &g_amec_sys.fw.probe250us[4]), + SENSOR_PTR( PROBE250US5, &g_amec_sys.fw.probe250us[5]), + SENSOR_PTR( PROBE250US6, &g_amec_sys.fw.probe250us[6]), + SENSOR_PTR( PROBE250US7, &g_amec_sys.fw.probe250us[7]), + + SENSOR_PTR( GPEtickdur0, &g_amec_sys.fw.gpetickdur[0]), + SENSOR_PTR( GPEtickdur1, &g_amec_sys.fw.gpetickdur[1]), + SENSOR_PTR( RTLtickdur, &g_amec_sys.fw.prcdupdatedur), + + // ------------------------------------------------------ + // System Sensors + // ------------------------------------------------------ + SENSOR_PTR( TEMPAMBIENT, &g_amec_sys.sys.tempambient), + SENSOR_PTR( ALTITUDE, &g_amec_sys.sys.altitude), + SENSOR_PTR( PWR250US, &g_amec_sys.sys.pwr250us), + SENSOR_PTR( PWR250USFAN, &g_amec_sys.fan.pwr250usfan), + SENSOR_PTR( PWR250USIO, &g_amec_sys.io.pwr250usio), + SENSOR_PTR( PWR250USSTORE, &g_amec_sys.storage.pwr250usstore), + SENSOR_PTR( PWR250USGPU, &g_amec_sys.sys.pwr250usgpu), + SENSOR_PTR( FANSPEEDAVG, &g_amec_sys.fan.fanspeedavg), + SENSOR_PTR( PWRAPSSCH0, &g_amec_sys.sys.pwrapssch[0]), + SENSOR_PTR( PWRAPSSCH1, &g_amec_sys.sys.pwrapssch[1]), + SENSOR_PTR( PWRAPSSCH2, &g_amec_sys.sys.pwrapssch[2]), + SENSOR_PTR( PWRAPSSCH3, &g_amec_sys.sys.pwrapssch[3]), + SENSOR_PTR( PWRAPSSCH4, &g_amec_sys.sys.pwrapssch[4]), + SENSOR_PTR( PWRAPSSCH5, &g_amec_sys.sys.pwrapssch[5]), + SENSOR_PTR( PWRAPSSCH6, &g_amec_sys.sys.pwrapssch[6]), + SENSOR_PTR( PWRAPSSCH7, &g_amec_sys.sys.pwrapssch[7]), + SENSOR_PTR( PWRAPSSCH8, &g_amec_sys.sys.pwrapssch[8]), + SENSOR_PTR( PWRAPSSCH9, &g_amec_sys.sys.pwrapssch[9]), + SENSOR_PTR( PWRAPSSCH10, &g_amec_sys.sys.pwrapssch[10]), + SENSOR_PTR( PWRAPSSCH11, &g_amec_sys.sys.pwrapssch[11]), + SENSOR_PTR( PWRAPSSCH12, &g_amec_sys.sys.pwrapssch[12]), + SENSOR_PTR( PWRAPSSCH13, &g_amec_sys.sys.pwrapssch[13]), + SENSOR_PTR( PWRAPSSCH14, &g_amec_sys.sys.pwrapssch[14]), + SENSOR_PTR( PWRAPSSCH15, &g_amec_sys.sys.pwrapssch[15]), + + // ------------------------------------------------------ + // Chip Sensors + // ------------------------------------------------------ + SENSOR_PTR( TODclock0, &g_amec_sys.sys.todclock0 ), + SENSOR_PTR( TODclock1, &g_amec_sys.sys.todclock1 ), + SENSOR_PTR( TODclock2, &g_amec_sys.sys.todclock2 ), + + // ------------------------------------------------------ + // Processor Sensors + // ------------------------------------------------------ + SENSOR_PTR( FREQA2MSP0, &g_amec_sys.proc[0].freqa2ms), + SENSOR_PTR( IPS2MSP0, &g_amec_sys.proc[0].ips2ms), + SENSOR_PTR( MEMSP2MSP0, &g_amec_sys.proc[0].memsp2ms), + SENSOR_PTR( PWR250USP0, &g_amec_sys.proc[0].pwr250us), + SENSOR_PTR( PWR250USVDD0, &g_amec_sys.proc[0].pwr250usvdd), + SENSOR_PTR( CUR250USVDD0, &g_amec_sys.proc[0].cur250usvdd), + SENSOR_PTR( PWR250USVCS0, &g_amec_sys.proc[0].pwr250usvcs), + SENSOR_PTR( PWR250USMEM0, &g_amec_sys.proc[0].pwr250usmem), + SENSOR_PTR( SLEEPCNT2MSP0, &g_amec_sys.proc[0].sleepcnt2ms), + SENSOR_PTR( WINKCNT2MSP0, &g_amec_sys.proc[0].winkcnt2ms), + SENSOR_PTR( SP250USP0, &g_amec_sys.proc[0].sp250us), + SENSOR_PTR( TEMP2MSP0, &g_amec_sys.proc[0].temp2ms), + SENSOR_PTR( TEMP2MSP0PEAK, &g_amec_sys.proc[0].temp2mspeak), + SENSOR_PTR( UTIL2MSP0, &g_amec_sys.proc[0].util2ms), + SENSOR_PTR( VRFAN250USPROC, &g_amec_sys.sys.vrfan250usproc), + SENSOR_PTR( VRHOT250USPROC, &g_amec_sys.sys.vrhot250usproc), + + // ------------------------------------------------------ + // Core Sensors (12 of each) + // ------------------------------------------------------ + CORE_SENSOR_PTRS( FREQ250USP0C , &g_amec_sys.proc[0].core, freq250us), + CORE_SENSOR_PTRS( FREQA2MSP0C , &g_amec_sys.proc[0].core, freqa2ms), + CORE_SENSOR_PTRS( IPS2MSP0C , &g_amec_sys.proc[0].core, ips2ms), + CORE_SENSOR_PTRS( NOTBZE2MSP0C , &g_amec_sys.proc[0].core, mcpifd2ms), + CORE_SENSOR_PTRS( NOTFIN2MSP0C , &g_amec_sys.proc[0].core, mcpifi2ms), + CORE_SENSOR_PTRS( SPURR2MSP0C , &g_amec_sys.proc[0].core, spurr2ms), + CORE_SENSOR_PTRS( TEMP2MSP0C , &g_amec_sys.proc[0].core, temp2ms), + CORE_SENSOR_PTRS( UTIL2MSP0C , &g_amec_sys.proc[0].core, util2ms), + CORE_SENSOR_PTRS( NUTIL3SP0C , &g_amec_sys.proc[0].core, nutil3s), + CORE_SENSOR_PTRS( MSTL2MSP0C , &g_amec_sys.proc[0].core, mstl2ms), + CORE_SENSOR_PTRS( CMT2MSP0C , &g_amec_sys.proc[0].core, cmt2ms), + CORE_SENSOR_PTRS( CMBW2MSP0C , &g_amec_sys.proc[0].core, cmbw2ms), + CORE_SENSOR_PTRS( PPICP0C , &g_amec_sys.proc[0].core, ppic), + CORE_SENSOR_PTRS( PWRPX250USP0C , &g_amec_sys.proc[0].core, pwrpx250us), + + // ------------------------------------------------------ + // Memory Sensors + // ------------------------------------------------------ + SENSOR_PTR( VRFAN250USMEM, &g_amec_sys.sys.vrfan250usmem), + SENSOR_PTR( VRHOT250USMEM, &g_amec_sys.sys.vrhot250usmem), + + MEMCONTROL_SENSOR_PTRS(MRD2MSP0M, &g_amec_sys.proc[0].memctl, mrd2ms), + MEMCONTROL_SENSOR_PTRS(MWR2MSP0M, &g_amec_sys.proc[0].memctl, mwr2ms), + MEMCONTROL_SENSOR_PTRS(MIRC2MSP0M, &g_amec_sys.proc[0].memctl, centaur.mirc2ms), + MEMCONTROL_SENSOR_PTRS(MLP2P0M, &g_amec_sys.proc[0].memctl, centaur.mlp2ms), + MEMCONTROL_SENSOR_PTRS(TEMPDIMMAXP0M, &g_amec_sys.proc[0].memctl, centaur.tempdimmax), + MEMCONTROL_SENSOR_PTRS(LOCDIMMAXP0M, &g_amec_sys.proc[0].memctl, centaur.locdimmax), + + PORTPAIR_SENSOR_PTRS(MAC2MSP0M, &g_amec_sys.proc[0].memctl, centaur.portpair, mac2ms), + PORTPAIR_SENSOR_PTRS(MPU2MSP0M, &g_amec_sys.proc[0].memctl, centaur.portpair, mpu2ms), + PORTPAIR_SENSOR_PTRS(MIRB2MSP0M, &g_amec_sys.proc[0].memctl, centaur.portpair, mirb2ms), + PORTPAIR_SENSOR_PTRS(MIRL2MSP0M, &g_amec_sys.proc[0].memctl, centaur.portpair, mirl2ms), + PORTPAIR_SENSOR_PTRS(MIRM2MSP0M, &g_amec_sys.proc[0].memctl, centaur.portpair, mirm2ms), + PORTPAIR_SENSOR_PTRS(MIRH2MSP0M, &g_amec_sys.proc[0].memctl, centaur.portpair, mirh2ms), + PORTPAIR_SENSOR_PTRS(MTS2MSP0M, &g_amec_sys.proc[0].memctl, centaur.portpair, mts2ms), + PORTPAIR_SENSOR_PTRS(MEMSP2MSPM, &g_amec_sys.proc[0].memctl, centaur.portpair, memsp2ms), + PORTPAIR_SENSOR_PTRS(M4RD2MSP0M, &g_amec_sys.proc[0].memctl, centaur.portpair, m4rd2ms), + PORTPAIR_SENSOR_PTRS(M4WR2MSP0M, &g_amec_sys.proc[0].memctl, centaur.portpair, m4wr2ms), + + + SENSOR_PTR( TEMP2MSCENT, &g_amec_sys.proc[0].temp2mscent), + SENSOR_PTR( TEMP2MSDIMM, &g_amec_sys.proc[0].temp2msdimm), + SENSOR_PTR( MEMSP2MS, &g_amec_sys.proc[0].memsp2ms_tls), + + // ------------------------------------------------------ + // Regulator Sensors + // ------------------------------------------------------ + SENSOR_PTR( UVOLT250USP0V0, &g_amec_sys.proc[0].vrm[0].uvolt250us), + SENSOR_PTR( UVOLT250USP0V1, &g_amec_sys.proc[0].vrm[1].uvolt250us), + SENSOR_PTR( VOLT250USP0V0, &g_amec_sys.proc[0].vrm[0].volt250us), + SENSOR_PTR( VOLT250USP0V1, &g_amec_sys.proc[0].vrm[1].volt250us), + + // ------------------------------------------------------ + // Partition Sensors + // ------------------------------------------------------ + SENSOR_PTR( UTIL2MSSLCG000, &g_amec_sys.part_config.part_list[0].util2msslack), + SENSOR_PTR( UTIL2MSSLCG001, &g_amec_sys.part_config.part_list[1].util2msslack), + SENSOR_PTR( UTIL2MSSLCG002, &g_amec_sys.part_config.part_list[2].util2msslack), + SENSOR_PTR( UTIL2MSSLCG003, &g_amec_sys.part_config.part_list[3].util2msslack), + SENSOR_PTR( UTIL2MSSLCG004, &g_amec_sys.part_config.part_list[4].util2msslack), + SENSOR_PTR( UTIL2MSSLCG005, &g_amec_sys.part_config.part_list[5].util2msslack), + SENSOR_PTR( UTIL2MSSLCG006, &g_amec_sys.part_config.part_list[6].util2msslack), + SENSOR_PTR( UTIL2MSSLCG007, &g_amec_sys.part_config.part_list[7].util2msslack), + SENSOR_PTR( UTIL2MSSLCG008, &g_amec_sys.part_config.part_list[8].util2msslack), + SENSOR_PTR( UTIL2MSSLCG009, &g_amec_sys.part_config.part_list[9].util2msslack), + SENSOR_PTR( UTIL2MSSLCG010, &g_amec_sys.part_config.part_list[10].util2msslack), + SENSOR_PTR( UTIL2MSSLCG011, &g_amec_sys.part_config.part_list[11].util2msslack), + +}; +STATIC_ASSERT( (NUMBER_OF_SENSORS_IN_LIST != (sizeof(G_amec_sensor_list)/sizeof(sensor_ptr_t))) ); +STATIC_ASSERT( (MAX_AMEC_SENSORS < (sizeof(G_amec_sensor_list)/sizeof(sensor_ptr_t))) ); + + +//**************************************************************************** +// Mini-Sensor Pointer Table +// ---------------------- +// - Indexed by GSID +// - Resident in initSection of SRAM, 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. +// - The reason why this is a separate table is so that we can put this +// in the init section and reclaim ~1.5kB of space (# sensors * 4bytes) +//**************************************************************************** +const minisensor_ptr_t G_amec_mini_sensor_list[] INIT_SECTION = +{ + // ------------------------------------------------------ + // Code/Firmware Sensors + // ------------------------------------------------------ + MINI_SENSOR_PTR( AMEintdur, NULL), + MINI_SENSOR_PTR( AMESSdur0, NULL), + MINI_SENSOR_PTR( AMESSdur1, NULL), + MINI_SENSOR_PTR( AMESSdur2, NULL), + MINI_SENSOR_PTR( AMESSdur3, NULL), + MINI_SENSOR_PTR( AMESSdur4, NULL), + MINI_SENSOR_PTR( AMESSdur5, NULL), + MINI_SENSOR_PTR( AMESSdur6, NULL), + MINI_SENSOR_PTR( AMESSdur7, NULL), + MINI_SENSOR_PTR( PROBE250US0, NULL), + MINI_SENSOR_PTR( PROBE250US1, NULL), + MINI_SENSOR_PTR( PROBE250US2, NULL), + MINI_SENSOR_PTR( PROBE250US3, NULL), + MINI_SENSOR_PTR( PROBE250US4, NULL), + MINI_SENSOR_PTR( PROBE250US5, NULL), + MINI_SENSOR_PTR( PROBE250US6, NULL), + MINI_SENSOR_PTR( PROBE250US7, NULL), + MINI_SENSOR_PTR( GPEtickdur0, NULL), + MINI_SENSOR_PTR( GPEtickdur1, NULL), + MINI_SENSOR_PTR( RTLtickdur, NULL), + + // ------------------------------------------------------ + // System Sensors + // ------------------------------------------------------ + MINI_SENSOR_PTR( TEMPAMBIENT, NULL), + MINI_SENSOR_PTR( ALTITUDE, NULL), + MINI_SENSOR_PTR( PWR250US, NULL), + MINI_SENSOR_PTR( PWR250USFAN, NULL), + MINI_SENSOR_PTR( PWR250USIO, NULL), + MINI_SENSOR_PTR( PWR250USSTORE, NULL), + MINI_SENSOR_PTR( PWR250USGPU, NULL), + MINI_SENSOR_PTR( FANSPEEDAVG, NULL), + + // ------------------------------------------------------ + // Chip Sensors + // ------------------------------------------------------ + MINI_SENSOR_PTR( TODclock0, &G_dcom_slv_outbox_tx.todclock[0]), + MINI_SENSOR_PTR( TODclock1, &G_dcom_slv_outbox_tx.todclock[1]), + MINI_SENSOR_PTR( TODclock2, &G_dcom_slv_outbox_tx.todclock[2]), + + // ------------------------------------------------------ + // Processor Sensors + // ------------------------------------------------------ + MINI_SENSOR_PTR( FREQA2MSP0, &G_dcom_slv_outbox_tx.freqa2msp0), + MINI_SENSOR_PTR( IPS2MSP0, &G_dcom_slv_outbox_tx.ips2msp0), + MINI_SENSOR_PTR( MEMSP2MSP0, NULL), + MINI_SENSOR_PTR( PWR250USP0, &G_dcom_slv_outbox_tx.pwr250usp0), + MINI_SENSOR_PTR( PWR250USVDD0, NULL), + MINI_SENSOR_PTR( CUR250USVDD0, NULL), + MINI_SENSOR_PTR( PWR250USVCS0, NULL), + MINI_SENSOR_PTR( PWR250USMEM0, &G_dcom_slv_outbox_tx.pwr250usmemp0), + MINI_SENSOR_PTR( SLEEPCNT2MSP0, &G_dcom_slv_outbox_tx.sleepcnt2msp0), + MINI_SENSOR_PTR( WINKCNT2MSP0, &G_dcom_slv_outbox_tx.winkcnt2msp0), + MINI_SENSOR_PTR( SP250USP0, NULL), + MINI_SENSOR_PTR( TEMP2MSP0, &G_dcom_slv_outbox_tx.temp2msp0), + MINI_SENSOR_PTR( TEMP2MSP0PEAK, &G_dcom_slv_outbox_tx.temp2msp0peak), + MINI_SENSOR_PTR( UTIL2MSP0, &G_dcom_slv_outbox_tx.util2msp0), + MINI_SENSOR_PTR( VRFAN250USPROC, &G_dcom_slv_outbox_tx.vrfan250usproc), + MINI_SENSOR_PTR( VRHOT250USPROC, NULL), + + // ------------------------------------------------------ + // Core Sensors (12 of each) + // ------------------------------------------------------ + CORE_MINI_SENSOR_PTRS_NULL( FREQ250USP0C ), + CORE_MINI_SENSOR_PTRS_NULL( FREQA2MSP0C ), + CORE_MINI_SENSOR_PTRS( IPS2MSP0C, &G_dcom_slv_outbox_tx.ips2msp0cy ), + CORE_MINI_SENSOR_PTRS( NOTBZE2MSP0C, &G_dcom_slv_outbox_tx.mcpifd2msp0cy ), + CORE_MINI_SENSOR_PTRS( NOTFIN2MSP0C, &G_dcom_slv_outbox_tx.mcpifi2msp0cy ), + CORE_MINI_SENSOR_PTRS_NULL( SPURR2MSP0C ), + CORE_MINI_SENSOR_PTRS_NULL( TEMP2MSP0C ), + CORE_MINI_SENSOR_PTRS( UTIL2MSP0C, &G_dcom_slv_outbox_tx.util2msp0cy ), + CORE_MINI_SENSOR_PTRS( NUTIL3SP0C, &G_dcom_slv_outbox_tx.nutil3sp0cy ), + CORE_MINI_SENSOR_PTRS_NULL( MSTL2MSP0C ), + CORE_MINI_SENSOR_PTRS_NULL( CMT2MSP0C ), + CORE_MINI_SENSOR_PTRS_NULL( CMBW2MSP0C ), + CORE_MINI_SENSOR_PTRS_NULL( PPICP0C ), + CORE_MINI_SENSOR_PTRS( PWRPX250USP0C, &G_dcom_slv_outbox_tx.pwrpx250usp0cy), // + + // ------------------------------------------------------ + // Memory Sensors + // ------------------------------------------------------ + MINI_SENSOR_PTR( VRFAN250USMEM, &G_dcom_slv_outbox_tx.vrfan250usmem), + MINI_SENSOR_PTR( VRHOT250USMEM, NULL), + + MEMCONTROL_MINI_SENSOR_PTRS(MRD2MSP0M, &G_dcom_slv_outbox_tx.mrd2msp0mx), // + MEMCONTROL_MINI_SENSOR_PTRS(MWR2MSP0M, &G_dcom_slv_outbox_tx.mwr2msp0mx), // + MEMCONTROL_MINI_SENSOR_PTRS_NULL(MIRC2MSP0M), + MEMCONTROL_MINI_SENSOR_PTRS_NULL(MLP2P0M), + + PORTPAIR_MINI_SENSOR_PTRS_NULL(MAC2MSP0M), + PORTPAIR_MINI_SENSOR_PTRS_NULL(MPU2MSP0M), + PORTPAIR_MINI_SENSOR_PTRS_NULL(MIRB2MSP0M), + PORTPAIR_MINI_SENSOR_PTRS_NULL(MIRL2MSP0M), + PORTPAIR_MINI_SENSOR_PTRS_NULL(MIRM2MSP0M), + PORTPAIR_MINI_SENSOR_PTRS_NULL(MIRH2MSP0M), + PORTPAIR_MINI_SENSOR_PTRS_NULL(MTS2MSP0M), + PORTPAIR_MINI_SENSOR_PTRS_NULL(MEMSP2MSPM), + PORTPAIR_MINI_SENSOR_PTRS_NULL(M4RD2MSP0M), + PORTPAIR_MINI_SENSOR_PTRS_NULL(M4WR2MSP0M), + + MINI_SENSOR_PTR( TEMP2MSCENT, &G_dcom_slv_outbox_tx.temp2mscent), + MINI_SENSOR_PTR( TEMP2MSDIMM, &G_dcom_slv_outbox_tx.temp2msdimm), + MINI_SENSOR_PTR( MEMSP2MS, NULL), + + // ------------------------------------------------------ + // Regulator Sensors + // ------------------------------------------------------ + MINI_SENSOR_PTR( UVOLT250USP0V0, NULL), + MINI_SENSOR_PTR( UVOLT250USP0V1, NULL), + MINI_SENSOR_PTR( VOLT250USP0V0, NULL), + MINI_SENSOR_PTR( VOLT250USP0V1, NULL), + + // ------------------------------------------------------ + // Partition Sensors + // ------------------------------------------------------ + MINI_SENSOR_PTR( UTIL2MSSLCG000, NULL), + MINI_SENSOR_PTR( UTIL2MSSLCG001, NULL), + MINI_SENSOR_PTR( UTIL2MSSLCG002, NULL), + MINI_SENSOR_PTR( UTIL2MSSLCG003, NULL), + MINI_SENSOR_PTR( UTIL2MSSLCG004, NULL), + MINI_SENSOR_PTR( UTIL2MSSLCG005, NULL), + MINI_SENSOR_PTR( UTIL2MSSLCG006, NULL), + MINI_SENSOR_PTR( UTIL2MSSLCG007, NULL), + MINI_SENSOR_PTR( UTIL2MSSLCG008, NULL), + MINI_SENSOR_PTR( UTIL2MSSLCG009, NULL), + MINI_SENSOR_PTR( UTIL2MSSLCG010, NULL), + MINI_SENSOR_PTR( UTIL2MSSLCG011, NULL), +}; +STATIC_ASSERT( (NUMBER_OF_SENSORS_IN_LIST != (sizeof(G_amec_mini_sensor_list)/sizeof(uint16_t *))) ); +STATIC_ASSERT( (MAX_AMEC_SENSORS < (sizeof(G_amec_mini_sensor_list)/sizeof(uint16_t *))) ); + + |