diff options
-rwxr-xr-x | src/occ_405/amec/amec_data.c | 6 | ||||
-rwxr-xr-x | src/occ_405/amec/amec_health.c | 4 | ||||
-rwxr-xr-x | src/occ_405/amec/amec_sensors_core.c | 89 | ||||
-rwxr-xr-x | src/occ_405/amec/amec_sensors_power.c | 45 | ||||
-rwxr-xr-x | src/occ_405/amec/amec_service_codes.h | 3 | ||||
-rwxr-xr-x | src/occ_405/amec/amec_sys.h | 3 | ||||
-rwxr-xr-x | src/occ_405/cmdh/cmdh_fsp.c | 4 | ||||
-rwxr-xr-x | src/occ_405/cmdh/cmdh_fsp_cmds.c | 77 | ||||
-rwxr-xr-x | src/occ_405/cmdh/cmdh_fsp_cmds.h | 37 | ||||
-rwxr-xr-x | src/occ_405/cmdh/cmdh_fsp_cmds_datacnfg.c | 175 | ||||
-rwxr-xr-x | src/occ_405/cmdh/cmdh_fsp_cmds_datacnfg.h | 48 | ||||
-rwxr-xr-x | src/occ_405/main.c | 49 | ||||
-rw-r--r-- | src/occ_405/occLinkInputFile | 1 | ||||
-rw-r--r-- | src/occ_405/occ_service_codes.h | 2 | ||||
-rwxr-xr-x | src/occ_405/thread/thrm_thread.c | 465 | ||||
-rwxr-xr-x | src/occ_405/thread/thrm_thread.h | 62 | ||||
-rw-r--r-- | src/occ_405/topfiles.mk | 3 |
17 files changed, 164 insertions, 909 deletions
diff --git a/src/occ_405/amec/amec_data.c b/src/occ_405/amec/amec_data.c index 33142e1..97aa8a7 100755 --- a/src/occ_405/amec/amec_data.c +++ b/src/occ_405/amec/amec_data.c @@ -47,7 +47,6 @@ #include <amec_sensors_fw.h> #include <amec_data.h> #include <amec_freq.h> -#include <thrm_thread.h> //************************************************************************* // Externs @@ -163,9 +162,6 @@ errlHndl_t AMEC_data_write_thrm_thresholds(const OCC_MODE i_mode) break; } - // Notify thermal thread to update its local copy of the thermal thresholds - THRM_thread_update_thresholds(); - l_frudata = l_data->data; // TODO: Need to check if acoustic mode has been enabled (ITE-only mode) @@ -258,8 +254,6 @@ errlHndl_t AMEC_data_write_thrm_thresholds(const OCC_MODE i_mode) TRAC_INFO("AMEC_data_write_thrm_thresholds: Setting %u as DVFS setpoint for DIMM", l_dvfs_temp); - // Store the VRM thermal data - g_amec->proc[0].vrfan_error_count = l_frudata[DATA_FRU_VRM].sample_error_count; g_amec->vrhotproc.setpoint = l_frudata[DATA_FRU_VRM].error_count; TRAC_INFO("AMEC_data_write_thrm_thresholds: Setting %u as DVFS setpoint for VRHOT", diff --git a/src/occ_405/amec/amec_health.c b/src/occ_405/amec/amec_health.c index 58092fc..b461583 100755 --- a/src/occ_405/amec/amec_health.c +++ b/src/occ_405/amec/amec_health.c @@ -31,13 +31,11 @@ #include "amec_service_codes.h" #include "occ_service_codes.h" #include <centaur_data.h> -#include <thrm_thread.h> #include <proc_data.h> //************************************************************************* // Externs //************************************************************************* -extern thrm_fru_data_t G_thrm_fru_data[DATA_FRU_MAX]; //************************************************************************* // Defines/Enums @@ -546,7 +544,6 @@ void amec_health_check_dimm_timeout() }//iterate over all centaurs }while(0); L_ran_once = TRUE; - G_thrm_fru_data[DATA_FRU_DIMM].read_failure = G_dimm_temp_expired_bitmap; } void amec_health_check_cent_timeout() @@ -732,7 +729,6 @@ void amec_health_check_cent_timeout() }//iterate over all centaurs }while(0); L_ran_once = TRUE; - G_thrm_fru_data[DATA_FRU_CENTAUR].read_failure = G_cent_temp_expired_bitmap; } diff --git a/src/occ_405/amec/amec_sensors_core.c b/src/occ_405/amec/amec_sensors_core.c index 7527e44..3182250 100755 --- a/src/occ_405/amec/amec_sensors_core.c +++ b/src/occ_405/amec/amec_sensors_core.c @@ -48,6 +48,7 @@ /******************************************************************************/ /* Globals */ /******************************************************************************/ +extern data_cnfg_t * G_data_cnfg; /******************************************************************************/ /* Forward Declarations */ @@ -158,14 +159,6 @@ void amec_update_proc_core_sensors(uint8_t i_core) } } - -// Core Weight - Weight factor for core DTS used to calculate a core temp -// TODO - fmk - to be changed once we have TMGT config data with weights. -// Suggest adding core weight to g_amec struct -// TEMP - Using the same weight for all cores. -uint8_t G_coreWeight = 2; -uint8_t G_quadWeight = 1; - // Function Specification // // Name: amec_calc_dts_sensors @@ -192,6 +185,11 @@ void amec_calc_dts_sensors(CoreData * i_core_data_ptr, uint8_t i_core) uint16_t l_core_hot = 0; uint8_t l_dtsCnt = 0; //Number of valid Core DTSs + uint8_t cWt = 0; // core weight: zero unless at least one valid core dts reading + uint8_t qWt = 0; // quad weight: zero unless we have a valid quad dts reading + + errlHndl_t l_err = NULL; + //Clear DTS array. for (k = 0; k < DTS_PER_CORE; k++) { @@ -231,35 +229,80 @@ void amec_calc_dts_sensors(CoreData * i_core_data_ptr, uint8_t i_core) //The core DTSs are considered only if we have at least 1 valid core DTS and //a non-zero G_coreWeight. - if (l_dtsCnt && G_coreWeight) + if (l_dtsCnt && G_data_cnfg->thrm_thresh.proc_core_weight) { l_update_sensor = TRUE; + cWt = G_data_cnfg->thrm_thresh.proc_core_weight; } //The Quad DTS value is considered only if we have a valid Quad DTS and //a non-zero quad weight. - if (i_core_data_ptr->dts.cache.fields.valid && G_quadWeight) + if (i_core_data_ptr->dts.cache.fields.valid && + G_data_cnfg->thrm_thresh.proc_quad_weight) { l_quadDts = i_core_data_ptr->dts.cache.fields.reading; l_update_sensor = TRUE; + qWt = G_data_cnfg->thrm_thresh.proc_quad_weight; } // Update the thermal sensor associated with this core if(l_update_sensor) { - //Formula: - // (Cwt(CoreDTS1 + CoreDTS2) + (Qwt*QuadDTS)) - // ------------------------------------------ - // (2*Cwt + Qwt) - if ((G_coreWeight && l_dtsCnt) || G_quadWeight) - { - l_coreTemp = ((G_coreWeight *(l_dts[0] + l_dts[1])) + (G_quadWeight * l_quadDts)) - / ((l_dtsCnt * G_coreWeight) + G_quadWeight); - } - - // Update sensors & Interim Data - sensor_update( AMECSENSOR_ARRAY_PTR(TEMP4MSP0C0,i_core), l_coreTemp); - g_amec->proc[0].core[i_core].dts_hottest = l_core_hot; + do + { + if (!((cWt && l_dtsCnt) || qWt)) + { + TRAC_ERR("amec_calc_dts_sensors:l_update_sensor Firmware Corrupted! ", + "core Weight: %d, valid core DTSs: %d, quad weight: %d", + cWt, l_dtsCnt, qWt); + + /* @ + * @errortype + * @moduleid AMEC_CALC_DTS_SENSORS + * @reasoncode INTERNAL_FW_FAILURE + * @userdata1 core ID for which the assertion failed. + * @userdata2 0 + * @userdata4 OCC_NO_EXTENDED_RC + * @devdesc VRHOT signal has been asserted long enough to + * exceed its error threshold. + * + */ + l_err = createErrl(AMEC_CALC_DTS_SENSORS, + INTERNAL_FW_FAILURE, + OCC_NO_EXTENDED_RC, + ERRL_SEV_PREDICTIVE, + NULL, + DEFAULT_TRACE_SIZE, + i_core, // core ID for which assertion failed. + cWt<<16|l_dtsCnt<<8|qWt); // parameters caused assertion failure. + + // Callout firmware + addCalloutToErrl(l_err, + ERRL_CALLOUT_TYPE_COMPONENT_ID, + ERRL_COMPONENT_ID_FIRMWARE, + ERRL_CALLOUT_PRIORITY_HIGH); + + // Commit error log and request reset + REQUEST_RESET(l_err); + + + // Commit Error + commitErrl(&l_err); + break; // avoid potential divide by zero + } + + //Formula: + // (cWt(CoreDTS1 + CoreDTS2) + (qWt*QuadDTS)) + // ------------------------------------------ + // (2*cWt + qWt) + + l_coreTemp = ((cWt * (l_dts[0] + l_dts[1])) + (qWt * l_quadDts)) + / ((l_dtsCnt * cWt) + qWt); + + // Update sensors & Interim Data + sensor_update( AMECSENSOR_ARRAY_PTR(TEMP4MSP0C0,i_core), l_coreTemp); + g_amec->proc[0].core[i_core].dts_hottest = l_core_hot; + } while(0); } } } diff --git a/src/occ_405/amec/amec_sensors_power.c b/src/occ_405/amec/amec_sensors_power.c index 3369a5e..1778a9e 100755 --- a/src/occ_405/amec/amec_sensors_power.c +++ b/src/occ_405/amec/amec_sensors_power.c @@ -53,8 +53,6 @@ // This holds the converted ADC Reads uint32_t G_lastValidAdcValue[MAX_APSS_ADC_CHANNELS] = {0}; -extern thrm_fru_data_t G_thrm_fru_data[DATA_FRU_MAX]; - // There are only MAX_APSS_ADC_CHANNELS channels. Therefore if the channel value // is greater then the MAX, then there was no channel associated with the function id. #define ADC_CONVERTED_VALUE(i_chan) \ @@ -484,10 +482,8 @@ void amec_update_vrm_sensors(void) // Update the VR_FAN sensor sensor_update( AMECSENSOR_PTR(VRFAN250USPROC), (uint16_t)l_vrfan ); - // Clear our error count and the 'read failure' flag (since we can - // read VR_FAN signal) + // Clear our error count L_error_count = 0; - G_thrm_fru_data[DATA_FRU_VRM].read_failure = 0; // No longer reading gpio from APSS in GA1 due to instability in // APSS composite mode @@ -525,45 +521,6 @@ void amec_update_vrm_sensors(void) { L_error_count = 0xFF; } - - // Log an error if we exceeded our number of fail-to-read sensor - if ((L_error_count == g_amec->proc[0].vrfan_error_count) && - (g_amec->proc[0].vrfan_error_count != 0xFF)) - { - TRAC_ERR("amec_update_vrm_sensors: Failed to read VR_FAN for %u consecutive times!", - L_error_count); - - // Also, inform the thermal thread to send a cooling request - G_thrm_fru_data[DATA_FRU_VRM].read_failure = 1; - - /* @ - * @errortype - * @moduleid AMEC_HEALTH_CHECK_VRFAN_TIMEOUT - * @reasoncode VRM_VRFAN_TIMEOUT - * @userdata1 timeout value - * @userdata2 0 - * @userdata4 OCC_NO_EXTENDED_RC - * @devdesc Failed to read VR_FAN signal from regulator. - * - */ - l_err = createErrl(AMEC_HEALTH_CHECK_VRFAN_TIMEOUT, //modId - VRM_VRFAN_TIMEOUT, //reasoncode - OCC_NO_EXTENDED_RC, //Extended reason code - ERRL_SEV_PREDICTIVE, //Severity - NULL, //Trace Buf - DEFAULT_TRACE_SIZE, //Trace Size - g_amec->thermaldimm.temp_timeout, //userdata1 - 0); //userdata2 - - // Callout backplane for this VRM error - addCalloutToErrl(l_err, - ERRL_CALLOUT_TYPE_HUID, - G_sysConfigData.backplane_huid, - ERRL_CALLOUT_PRIORITY_MED); - - // Commit the error - commitErrl(&l_err); - } } } diff --git a/src/occ_405/amec/amec_service_codes.h b/src/occ_405/amec/amec_service_codes.h index c93cc25..73146a2 100755 --- a/src/occ_405/amec/amec_service_codes.h +++ b/src/occ_405/amec/amec_service_codes.h @@ -54,7 +54,7 @@ enum occAmecModuleId AMEC_AMESTER_INTERFACE = AMEC_COMP_ID | 0x03, AMEC_PCAP_CONN_OC_CONTROLLER = AMEC_COMP_ID | 0x04, AMEC_MST_CHECK_PCAPS_MATCH = AMEC_COMP_ID | 0x05, - AMEC_MST_CHECK_UNDER_PCAP = AMEC_COMP_ID | 0x06, + AMEC_MST_CHECK_UNDER_PCAP = AMEC_COMP_ID | 0x06, AMEC_SLAVE_CHECK_PERFORMANCE = AMEC_COMP_ID | 0x07, AMEC_HEALTH_CHECK_PROC_TEMP = AMEC_COMP_ID | 0x08, AMEC_HEALTH_CHECK_DIMM_TEMP = AMEC_COMP_ID | 0x09, @@ -64,6 +64,7 @@ enum occAmecModuleId AMEC_HEALTH_CHECK_VRFAN_TIMEOUT = AMEC_COMP_ID | 0x13, AMEC_HEALTH_CHECK_PROC_TIMEOUT = AMEC_COMP_ID | 0x14, AMEC_HEALTH_CHECK_PROC_VRHOT = AMEC_COMP_ID | 0x15, + AMEC_CALC_DTS_SENSORS = AMEC_COMP_ID | 0x16, }; /*----------------------------------------------------------------------------*/ diff --git a/src/occ_405/amec/amec_sys.h b/src/occ_405/amec/amec_sys.h index a79f242..9e920cb 100755 --- a/src/occ_405/amec/amec_sys.h +++ b/src/occ_405/amec/amec_sys.h @@ -466,9 +466,6 @@ typedef struct sensor_t temp2msdimm; sensor_t memsp2ms_tls; - // Error count for failing to read VR_FAN signal - uint8_t vrfan_error_count; - // Calculations & Interim Data uint16_t sleep_cnt; uint16_t winkle_cnt; diff --git a/src/occ_405/cmdh/cmdh_fsp.c b/src/occ_405/cmdh/cmdh_fsp.c index 76b777f..2944f61 100755 --- a/src/occ_405/cmdh/cmdh_fsp.c +++ b/src/occ_405/cmdh/cmdh_fsp.c @@ -1304,10 +1304,6 @@ errlHndl_t cmdh_processTmgtRequest (const cmdh_fsp_cmd_t * i_cmd_ptr, l_err = cmdh_reset_prep(i_cmd_ptr,i_rsp_ptr); break; - case CMDH_GET_COOLING_REQUEST: - l_err = cmdh_get_cooling_request(i_cmd_ptr,i_rsp_ptr); - break; - case CMDH_MFG_TEST_CMD: cmdh_mnfg_test_parse(i_cmd_ptr,i_rsp_ptr); break; diff --git a/src/occ_405/cmdh/cmdh_fsp_cmds.c b/src/occ_405/cmdh/cmdh_fsp_cmds.c index 03dae96..e34b86c 100755 --- a/src/occ_405/cmdh/cmdh_fsp_cmds.c +++ b/src/occ_405/cmdh/cmdh_fsp_cmds.c @@ -47,7 +47,6 @@ #include "sensor_query_list.h" #include "chom.h" #include "amec_master_smh.h" -#include "thrm_thread.h" #include <proc_data.h> // This table contains tunable parameter information that can be exposed to @@ -87,8 +86,6 @@ uint8_t G_mst_tunable_parameter_overwrite = 0; //Reverse association of channel to function. uint8_t G_apss_ch_to_function[MAX_APSS_ADC_CHANNELS] = {0}; -extern thrm_fru_data_t G_thrm_fru_data[DATA_FRU_MAX]; - // Function Specification // // Name: cmdh_tmgt_poll @@ -115,7 +112,6 @@ errlHndl_t cmdh_tmgt_poll (const cmdh_fsp_cmd_t * i_cmd_ptr, l_poll_rsp->status.word = SMGR_validate_get_valid_states(); l_poll_rsp->ext_status.word = 0; - l_poll_rsp->ext_status.cooling_request = THRM_thread_get_cooling_request(); l_poll_rsp->occ_pres_mask = G_sysConfigData.is_occ_present; l_poll_rsp->config_data = DATA_request_cnfgdata(); @@ -1585,79 +1581,6 @@ errlHndl_t cmdh_tmgt_get_field_debug_data(const cmdh_fsp_cmd_t * i_cmd_ptr, // Function Specification // -// Name: cmdh_get_cooling_request -// -// Description: TODO Add description -// -// End Function Specification -errlHndl_t cmdh_get_cooling_request(const cmdh_fsp_cmd_t * i_cmd_ptr, - cmdh_fsp_rsp_t * o_rsp_ptr) -{ - errlHndl_t l_errlHndl = NULL; - cmdh_get_cooling_resp_t *l_resp_ptr = (cmdh_get_cooling_resp_t*) o_rsp_ptr; - ERRL_RC l_rc = ERRL_RC_SUCCESS; - uint16_t l_rsp_data_length = 0; - uint16_t l_max_increment = 0; - uint8_t l_fru_winner = DATA_FRU_MAX; - uint8_t i = 0; - uint8_t j = 0; - - do - { - // Command Length Check - make sure we at least have a version number - if( CMDH_DATALEN_FIELD_UINT16(i_cmd_ptr) < CMDH_GET_COOLING_MIN_DATALEN) - { - l_rc = ERRL_RC_INVALID_CMD_LEN; - break; - } - - // Version Number Check - if(i_cmd_ptr->data[0] != CMDH_GET_COOLING_VERSION) - { - l_rc = ERRL_RC_INVALID_DATA; - break; - } - - // Loop through all Zones - for (i=0; i<THRM_MAX_NUM_ZONES; i++) - { - // For each Zone, determine which FRU is requesting the maximum - // increment value - l_max_increment = 0; - l_fru_winner = DATA_FRU_MAX; - for (j=0; j<DATA_FRU_MAX; j++) - { - if (G_thrm_fru_data[j].FanIncZone[i] > l_max_increment) - { - l_max_increment = G_thrm_fru_data[j].FanIncZone[i]; - l_fru_winner = j; - } - } - l_resp_ptr->zone_data[i].increment_value = l_max_increment; - l_resp_ptr->zone_data[i].comp_type = l_fru_winner; - l_resp_ptr->zone_data[i].reason = 0x00; // Always hardcoded to 0x00 - } - - // Populate the response data header - l_rsp_data_length = (sizeof(cmdh_get_cooling_resp_t) - CMDH_DBUG_FSP_RESP_LEN); - l_resp_ptr->data_length[0] = ((uint8_t *)&l_rsp_data_length)[0]; - l_resp_ptr->data_length[1] = ((uint8_t *)&l_rsp_data_length)[1]; - l_resp_ptr->rc = l_rc; - - }while(0); - - if(ERRL_RC_SUCCESS != l_rc) - { - // Build Error Response packet - cmdh_build_errl_rsp(i_cmd_ptr, o_rsp_ptr, l_rc, &l_errlHndl); - } - - return l_errlHndl; -} - - -// Function Specification -// // Name: cmdh_set_user_pcap // // Description: Implements the Set Use Power Cap command. diff --git a/src/occ_405/cmdh/cmdh_fsp_cmds.h b/src/occ_405/cmdh/cmdh_fsp_cmds.h index f31b210..cb3593b 100755 --- a/src/occ_405/cmdh/cmdh_fsp_cmds.h +++ b/src/occ_405/cmdh/cmdh_fsp_cmds.h @@ -38,7 +38,6 @@ //#include "pstates.h" #include "cmdh_fsp_cmds_datacnfg.h" #include "sensor.h" -#include "thrm_thread.h" #include "apss.h" // Enum of the various commands that TMGT may send to OCC @@ -57,7 +56,6 @@ typedef enum CMDH_READ_STATUS_REG = 0x31, CMDH_GET_THROTTLE_VALUE = 0x32, CMDH_GET_CPU_TEMPS = 0x33, - CMDH_GET_COOLING_REQUEST = 0x34, CMDH_GET_SNAPSHOT_BUFFER = 0x35, CMDH_DEBUGPT = 0x40, CMDH_AME_PASS_THROUGH = 0x41, @@ -125,7 +123,7 @@ typedef struct __attribute__ ((packed)) cmdh_poll_resp_v0 uint8_t _reserved_3 : 1; uint8_t sync_request : 1; // In TMGT to TPMF interface spec, but not needed yet uint8_t _reserved_1 : 1; - uint8_t cooling_request : 1; // 1:new fan speed, 0:no new fan speed + uint8_t _reserved_0 : 1; }; uint8_t word; } ext_status; @@ -385,36 +383,6 @@ typedef struct __attribute__ ((packed)) cmdh_reset_prep }cmdh_reset_prep_t; //--------------------------------------------------------- -// Get Cooling Request -//--------------------------------------------------------- - -// Minimum Data Length for Get Cooling Request Command -#define CMDH_GET_COOLING_MIN_DATALEN 1 - -// Version 0 -#define CMDH_GET_COOLING_VERSION 0 - -typedef struct cmdh_get_cooling_data -{ - // Maximum increment value for this zone - uint16_t increment_value; - // Component type that is driving the increment for this zone - uint8_t comp_type; - // Currently not used, hardcode to 0x00 (see TMGT-OCC Interface Spec v2.0) - uint8_t reason; -}cmdh_get_cooling_data_t; - -// Used by OCC to respond to "GET_COOLING_REQUEST" cmd -typedef struct __attribute__ ((packed)) -{ - struct cmdh_fsp_rsp_header; - // Zone data array - cmdh_get_cooling_data_t zone_data[THRM_MAX_NUM_ZONES]; - // Checksum - uint8_t checksum[2]; -}cmdh_get_cooling_resp_t; - -//--------------------------------------------------------- // Debug Command //--------------------------------------------------------- @@ -643,9 +611,6 @@ errlHndl_t cmdh_reset_prep(const cmdh_fsp_cmd_t * i_cmd_ptr, errlHndl_t cmdh_tmgt_get_field_debug_data(const cmdh_fsp_cmd_t * i_cmd_ptr, cmdh_fsp_rsp_t * i_rsp_ptr); -errlHndl_t cmdh_get_cooling_request(const cmdh_fsp_cmd_t * i_cmd_ptr, - cmdh_fsp_rsp_t * o_rsp_ptr); - errlHndl_t cmdh_set_user_pcap(const cmdh_fsp_cmd_t * i_cmd_ptr, cmdh_fsp_rsp_t * o_rsp_ptr); diff --git a/src/occ_405/cmdh/cmdh_fsp_cmds_datacnfg.c b/src/occ_405/cmdh/cmdh_fsp_cmds_datacnfg.c index b492a41..2abebc0 100755 --- a/src/occ_405/cmdh/cmdh_fsp_cmds_datacnfg.c +++ b/src/occ_405/cmdh/cmdh_fsp_cmds_datacnfg.c @@ -59,10 +59,8 @@ #define DATA_APSS_VERSION20 0x20 -#define DATA_THRM_THRES_VERSION_1 1 -#define DATA_THRM_THRES_VERSION_10 0x10 -#define THRM_THRES_BASE_DATA_SZ_1 4 -#define THRM_THRES_BASE_DATA_SZ_10 3 +#define DATA_THRM_THRES_VERSION_20 0x20 +#define THRM_THRES_BASE_DATA_SZ_20 5 #define DATA_IPS_VERSION 0 @@ -1345,12 +1343,11 @@ errlHndl_t data_store_thrm_thresholds(const cmdh_fsp_cmd_t * i_cmd_ptr, cmdh_fsp_rsp_t * o_rsp_ptr) { errlHndl_t l_err = NULL; - cmdh_thrm_thresholds_t* l_cmd_ptr = (cmdh_thrm_thresholds_t*)i_cmd_ptr; uint16_t i = 0; uint16_t l_data_length = 0; uint16_t l_exp_data_length = 0; uint8_t l_frutype = 0; - cmdh_thrm_thresholds_v10_t* l_cmd2_ptr = (cmdh_thrm_thresholds_v10_t*)i_cmd_ptr; + cmdh_thrm_thresholds_v20_t* l_cmd_ptr = (cmdh_thrm_thresholds_v20_t*)i_cmd_ptr; uint8_t l_num_data_sets = 0; bool l_invalid_input = TRUE; //Assume bad input bool l_vrm_frutype = FALSE; @@ -1362,27 +1359,17 @@ errlHndl_t data_store_thrm_thresholds(const cmdh_fsp_cmd_t * i_cmd_ptr, // Sanity checks on input data, break if: // * data packet is smaller than the base size, OR // * the version doesn't match what we expect, OR - // * the actual data length does not match the expected data length. - if(l_cmd_ptr->version == DATA_THRM_THRES_VERSION_1) + // * the actual data length does not match the expected data length, OR + // * the core and quad weights are both zero. + if(l_cmd_ptr->version == DATA_THRM_THRES_VERSION_20) { l_num_data_sets = l_cmd_ptr->num_data_sets; - l_exp_data_length = THRM_THRES_BASE_DATA_SZ_1 + - (l_num_data_sets * sizeof(cmdh_thrm_thresholds_set_t)); + l_exp_data_length = THRM_THRES_BASE_DATA_SZ_20 + + (l_num_data_sets * sizeof(cmdh_thrm_thresholds_set_v20_t)); if((l_exp_data_length == l_data_length) && - (l_data_length >= THRM_THRES_BASE_DATA_SZ_1)) - { - l_invalid_input = FALSE; - } - } - else if(l_cmd_ptr->version == DATA_THRM_THRES_VERSION_10) - { - l_num_data_sets = l_cmd2_ptr->num_data_sets; - l_exp_data_length = THRM_THRES_BASE_DATA_SZ_10 + - (l_num_data_sets * sizeof(cmdh_thrm_thresholds_set_v10_t)); - - if((l_exp_data_length == l_data_length) && - (l_data_length >= THRM_THRES_BASE_DATA_SZ_10)) + (l_data_length >= THRM_THRES_BASE_DATA_SZ_20) && + (l_cmd_ptr->proc_core_weight || l_cmd_ptr->proc_quad_weight)) { l_invalid_input = FALSE; } @@ -1398,109 +1385,70 @@ errlHndl_t data_store_thrm_thresholds(const cmdh_fsp_cmd_t * i_cmd_ptr, break; } - if(l_cmd_ptr->version == DATA_THRM_THRES_VERSION_1) + // Store the base data + G_data_cnfg->thrm_thresh.version = l_cmd_ptr->version; + G_data_cnfg->thrm_thresh.proc_core_weight = l_cmd_ptr->proc_core_weight; + G_data_cnfg->thrm_thresh.proc_quad_weight = l_cmd_ptr->proc_quad_weight; + G_data_cnfg->thrm_thresh.num_data_sets = l_cmd_ptr->num_data_sets; + + // Store the FRU related data + for(i=0; i<l_cmd_ptr->num_data_sets; i++) { - // Store the base data - G_data_cnfg->thrm_thresh.version = l_cmd_ptr->version; - G_data_cnfg->thrm_thresh.fan_control_loop_time = l_cmd_ptr->fan_control_loop_time; - G_data_cnfg->thrm_thresh.num_data_sets = l_cmd_ptr->num_data_sets; + // Get the FRU type + l_frutype = l_cmd_ptr->data[i].fru_type; - // Store the FRU related data - for(i=0; i<l_cmd_ptr->num_data_sets; i++) + if((l_frutype >= 0) && (l_frutype < DATA_FRU_MAX)) { - // Get the FRU type - l_frutype = l_cmd_ptr->data[i].fru_type; - - if((l_frutype >= 0) && (l_frutype < DATA_FRU_MAX)) + // Copy FRU data + G_data_cnfg->thrm_thresh.data[l_frutype].fru_type = l_frutype; + G_data_cnfg->thrm_thresh.data[l_frutype].dvfs = l_cmd_ptr->data[i].dvfs; + G_data_cnfg->thrm_thresh.data[l_frutype].error = l_cmd_ptr->data[i].error; + G_data_cnfg->thrm_thresh.data[l_frutype].pm_dvfs = l_cmd_ptr->data[i].pm_dvfs; + G_data_cnfg->thrm_thresh.data[l_frutype].pm_error = l_cmd_ptr->data[i].pm_error; + G_data_cnfg->thrm_thresh.data[l_frutype].max_read_timeout = + l_cmd_ptr->data[i].max_read_timeout; + + // Set a local flag if we get data for VRM FRU type + if(l_frutype == DATA_FRU_VRM) { - // Copy FRU data - memcpy((void *)&G_data_cnfg->thrm_thresh.data[l_frutype], - (void *)&l_cmd_ptr->data[i], - sizeof(cmdh_thrm_thresholds_set_t)); + l_vrm_frutype = TRUE; + } // Useful trace for debugging - //CMDH_TRAC_INFO("data_store_thrm_thresholds: FRU_type[0x%.2X] T_control[%u] DVFS[%u]", + //CMDH_TRAC_INFO("data_store_thrm_thresholds: FRU_type[0x%.2X] T_control[%u] DVFS[%u] Error[%u]", // G_data_cnfg->thrm_thresh.data[l_frutype].fru_type, // G_data_cnfg->thrm_thresh.data[l_frutype].t_control, - // G_data_cnfg->thrm_thresh.data[l_frutype].dvfs); - } - else - { - // We got an invalid FRU type - CMDH_TRAC_ERR("data_store_thrm_thresholds: Received an invalid FRU type[0x%.2X] max_FRU_number[0x%.2X]", - l_frutype, - DATA_FRU_MAX); - cmdh_build_errl_rsp(i_cmd_ptr, o_rsp_ptr, ERRL_RC_INVALID_DATA, &l_err); - break; - } - } - } - else if(l_cmd_ptr->version == DATA_THRM_THRES_VERSION_10) - { - // Store the base data - G_data_cnfg->thrm_thresh.version = l_cmd2_ptr->version; - G_data_cnfg->thrm_thresh.fan_control_loop_time = 0; //Indicates not to run fan control loop - G_data_cnfg->thrm_thresh.num_data_sets = l_cmd2_ptr->num_data_sets; - - // Store the FRU related data - for(i=0; i<l_cmd2_ptr->num_data_sets; i++) - { - // Get the FRU type - l_frutype = l_cmd2_ptr->data[i].fru_type; - - if((l_frutype >= 0) && (l_frutype < DATA_FRU_MAX)) - { - // Copy FRU data - G_data_cnfg->thrm_thresh.data[l_frutype].fru_type = l_frutype; - G_data_cnfg->thrm_thresh.data[l_frutype].dvfs = l_cmd2_ptr->data[i].dvfs; - G_data_cnfg->thrm_thresh.data[l_frutype].error = l_cmd2_ptr->data[i].error; - G_data_cnfg->thrm_thresh.data[l_frutype].pm_dvfs = l_cmd2_ptr->data[i].dvfs; - G_data_cnfg->thrm_thresh.data[l_frutype].pm_error = l_cmd2_ptr->data[i].error; - G_data_cnfg->thrm_thresh.data[l_frutype].max_read_timeout = l_cmd2_ptr->data[i].max_read_timeout; - - // Set a local flag if we get data for VRM FRU type - if(l_frutype == DATA_FRU_VRM) - { - l_vrm_frutype = TRUE; - } - - // Useful trace for debugging - //CMDH_TRAC_INFO("data_store_thrm_thresholds: FRU_type[0x%.2X] T_control[%u] DVFS[%u] Error[%u]", - // G_data_cnfg->thrm_thresh.data[l_frutype].fru_type, - // G_data_cnfg->thrm_thresh.data[l_frutype].t_control, - // G_data_cnfg->thrm_thresh.data[l_frutype].dvfs, - // G_data_cnfg->thrm_thresh.data[l_frutype].error); - } - else - { - // We got an invalid FRU type - CMDH_TRAC_ERR("data_store_thrm_thresholds: Received an invalid FRU type[0x%.2X] max_FRU_number[0x%.2X]", - l_frutype, - DATA_FRU_MAX); - cmdh_build_errl_rsp(i_cmd_ptr, o_rsp_ptr, ERRL_RC_INVALID_DATA, &l_err); - break; - } - } - - // Did we get data for VRM FRU type? - if(l_vrm_frutype) - { - // Then, set a global variable so that OCC attempts to talk to - // the VRMs - G_vrm_present = 1; + // G_data_cnfg->thrm_thresh.data[l_frutype].dvfs, + // G_data_cnfg->thrm_thresh.data[l_frutype].error); } else { - // No VRM data was received, so do not attempt to talk to the VRMs. - // Also, make the error count very high so that the health - // monitor doesn't complain about VRHOT being asserted. - G_vrm_present = 0; - G_data_cnfg->thrm_thresh.data[DATA_FRU_VRM].error_count = 0xFF; - - CMDH_TRAC_IMP("data_store_thrm_thresholds: No VRM data was received! OCC won't attempt to talk to VRMs."); + // We got an invalid FRU type + CMDH_TRAC_ERR("data_store_thrm_thresholds: Received an invalid FRU type[0x%.2X] max_FRU_number[0x%.2X]", + l_frutype, + DATA_FRU_MAX); + cmdh_build_errl_rsp(i_cmd_ptr, o_rsp_ptr, ERRL_RC_INVALID_DATA, &l_err); + break; } } + // Did we get data for VRM FRU type? + if(l_vrm_frutype) + { + // Then, set a global variable so that OCC attempts to talk to + // the VRMs + G_vrm_present = 1; + } + else + { + // No VRM data was received, so do not attempt to talk to the VRMs. + // Also, make the error count very high so that the health + // monitor doesn't complain about VRHOT being asserted. + G_vrm_present = 0; + G_data_cnfg->thrm_thresh.data[DATA_FRU_VRM].error_count = 0xFF; + CMDH_TRAC_IMP("data_store_thrm_thresholds: No VRM data was received! OCC won't attempt to talk to VRMs."); + } + } while(0); if(!l_err) @@ -1508,9 +1456,6 @@ errlHndl_t data_store_thrm_thresholds(const cmdh_fsp_cmd_t * i_cmd_ptr, // If there were no errors, indicate that we got this data G_data_cnfg->data_mask |= DATA_MASK_THRM_THRESHOLDS; CMDH_TRAC_IMP("data_store_thrm_thresholds: Got valid Thermal Control Threshold data packet"); - - // Notify thermal thread to update its local copy of the thermal thresholds - THRM_thread_update_thresholds(); } return l_err; diff --git a/src/occ_405/cmdh/cmdh_fsp_cmds_datacnfg.h b/src/occ_405/cmdh/cmdh_fsp_cmds_datacnfg.h index 661eeb1..06b3ef4 100755 --- a/src/occ_405/cmdh/cmdh_fsp_cmds_datacnfg.h +++ b/src/occ_405/cmdh/cmdh_fsp_cmds_datacnfg.h @@ -222,29 +222,12 @@ extern cmdh_ips_config_data_t G_ips_config_data; typedef struct __attribute__ ((packed)) { uint8_t fru_type; - uint8_t t_control; uint8_t dvfs; uint8_t error; - uint8_t pm_t_control; uint8_t pm_dvfs; uint8_t pm_error; - uint8_t acoustic_t_control; - uint8_t acoustic_dvfs; - uint8_t acoustic_error; - uint8_t warning; - uint8_t warning_reset; uint8_t error_count; - uint8_t sample_time; - uint8_t sample_error_count; uint8_t max_read_timeout; - uint16_t t_inc_zone1; - uint16_t t_inc_zone2; - uint16_t t_inc_zone3; - uint16_t t_inc_zone4; - uint16_t t_inc_zone5; - uint16_t t_inc_zone6; - uint16_t t_inc_zone7; - uint16_t t_inc_zone8; }cmdh_thrm_thresholds_set_t; // Used by TMGT to send OCC thermal control thresholds @@ -253,27 +236,40 @@ typedef struct __attribute__ ((packed)) struct cmdh_fsp_cmd_header; uint8_t format; uint8_t version; - uint8_t fan_control_loop_time; + + // Weight factor for core DTS used to calculate a core temp + uint8_t proc_core_weight; + uint8_t proc_quad_weight; + uint8_t num_data_sets; cmdh_thrm_thresholds_set_t data[DATA_FRU_MAX]; }cmdh_thrm_thresholds_t; + typedef struct __attribute__ ((packed)) { - uint8_t fru_type; - uint8_t dvfs; - uint8_t error; + uint8_t fru_type; // 0: proc, 1: centaur, 2: dimm, 3: vrm +// dvfs/pm_dvfs and error/pm_error fields define the temperature trigger +// points for DVFS/Throttling and error/FRU callouts, respectively. +// a 0xFF entry indicates that the coresponding temperature trigger +// point is undefined. + uint8_t dvfs; // OS Controlled sys/PowerVM nominal + uint8_t error; // OS Controlled sys/PowerVM nominal + uint8_t pm_dvfs; // powerVM sys + uint8_t pm_error; // powerVM sys uint8_t max_read_timeout; -}cmdh_thrm_thresholds_set_v10_t; +}cmdh_thrm_thresholds_set_v20_t; typedef struct __attribute__ ((packed)) { struct cmdh_fsp_cmd_header; uint8_t format; uint8_t version; + uint8_t proc_core_weight; + uint8_t proc_quad_weight; uint8_t num_data_sets; - cmdh_thrm_thresholds_set_v10_t data[DATA_FRU_MAX]; -}cmdh_thrm_thresholds_v10_t; + cmdh_thrm_thresholds_set_v20_t data[DATA_FRU_MAX]; +}cmdh_thrm_thresholds_v20_t; // Header data for mem cfg packet @@ -357,8 +353,8 @@ typedef struct __attribute__ ((packed)) // Used to mark present the config data TMGT has sent us. typedef struct data_cnfg { - uint32_t data_mask; - cmdh_thrm_thresholds_t thrm_thresh; + uint32_t data_mask; + cmdh_thrm_thresholds_t thrm_thresh; } data_cnfg_t; // Used by TMGT to send OCC the Vdd and Vcs uplift values diff --git a/src/occ_405/main.c b/src/occ_405/main.c index 1821676..b7bd4fb 100755 --- a/src/occ_405/main.c +++ b/src/occ_405/main.c @@ -53,7 +53,6 @@ #include <homer.h> //#include <amec_health.h> //#include <amec_freq.h> -#include <thrm_thread.h> #include "scom.h" //#include <fir_data_collect.h> #include <pss_service_codes.h> @@ -87,15 +86,13 @@ uint8_t G_noncritical_stack[NONCRITICAL_STACK_SIZE]; uint8_t G_critical_stack[CRITICAL_STACK_SIZE]; //NOTE: Three semaphores are used so that if in future it is decided -// to move thermal, health monitor and FFDC into it's own threads, then +// to move health monitor and FFDC into it's own threads, then // it can be done easily without more changes. -// Semaphores for the thermal functions -SsxSemaphore G_thrmSem; // Semaphores for the health monitor functions SsxSemaphore G_hmonSem; // Semaphores for the FFDC functions SsxSemaphore G_ffdcSem; -// Timer for posting thermal, health monitor and FFDC semaphore +// Timer for posting health monitor and FFDC semaphore SsxTimer G_mainThrdTimer; // Variable holding main thread loop count @@ -625,17 +622,6 @@ void mainThrdTimerCallback(void * i_argPtr) int l_rc = SSX_OK; do { - // Post Thermal semaphore - l_rc = ssx_semaphore_post( &G_thrmSem ); - - if ( l_rc != SSX_OK ) - { - MAIN_TRAC_ERR("Failure posting thermal semaphore: rc: 0x%x", l_rc); - break; - } - - MAIN_DBG("posted thrmSem"); - // Post health monitor semaphore l_rc = ssx_semaphore_post( &G_hmonSem ); @@ -667,7 +653,7 @@ void mainThrdTimerCallback(void * i_argPtr) * @errortype * @moduleid MAIN_THRD_TIMER_MID * @reasoncode SSX_GENERIC_FAILURE - * @userdata1 Create thermal semaphore rc + * @userdata1 Create hmon and ffdc semaphore rc * @userdata4 OCC_NO_EXTENDED_RC * @devdesc SSX semaphore related failure */ @@ -700,10 +686,6 @@ void mainThrdTimerCallback(void * i_argPtr) */ void initMainThrdSemAndTimer() { - // create the thermal Semaphore, starting at 0 with a max count of 0 - // NOTE: Max count of 0 is used becuase there is possibility that - // semaphore can be posted more than once without any semaphore activity - int l_thrmSemRc = ssx_semaphore_create(&G_thrmSem, 0, 0); // create the health monitor Semaphore, starting at 0 with a max count of 0 // NOTE: Max count of 0 is used becuase there is possibility that // semaphore can be posted more than once without any semaphore activity @@ -730,20 +712,19 @@ void initMainThrdSemAndTimer() // Failure creating semaphore or creating/scheduling timer, create // and log error. - if (( l_thrmSemRc != SSX_OK ) || - ( l_hmonSemRc != SSX_OK ) || + if (( l_hmonSemRc != SSX_OK ) || ( l_ffdcSemRc != SSX_OK ) || ( l_timerRc != SSX_OK)) { - MAIN_TRAC_ERR("Semaphore/timer create failure: thrmSemRc: 0x%08x, " + MAIN_TRAC_ERR("Semaphore/timer create failure: " "hmonSemRc: 0x08%x, ffdcSemRc: 0x%08x, l_timerRc: 0x%08x", - -l_thrmSemRc,-l_hmonSemRc,-l_ffdcSemRc, l_timerRc ); + -l_hmonSemRc,-l_ffdcSemRc, l_timerRc ); /* @ * @errortype * @moduleid MAIN_THRD_SEM_INIT_MID * @reasoncode SSX_GENERIC_FAILURE - * @userdata1 Create thermal semaphore rc + * @userdata1 Create health monitor semaphore rc * @userdata2 Timer create/schedule rc * @userdata4 OCC_NO_EXTENDED_RC * @devdesc SSX semaphore related failure @@ -755,7 +736,7 @@ void initMainThrdSemAndTimer() ERRL_SEV_UNRECOVERABLE, //Severity NULL, //Trace Buf DEFAULT_TRACE_SIZE, //Trace Size - l_thrmSemRc, //userdata1 + l_hmonSemRc, //userdata1 l_timerRc); //userdata2 REQUEST_RESET(l_err); @@ -831,7 +812,7 @@ void Main_thread_routine(void *private) rtl_ocb_init(); CHECKPOINT(RTL_TIMER_INITIALIZED); - // Initialize semaphores and timer for handling thermal, health monitor and + // Initialize semaphores and timer for handling health monitor and // FFDC functions. initMainThrdSemAndTimer(); CHECKPOINT(SEMS_AND_TIMERS_INITIALIZED); @@ -869,8 +850,6 @@ void Main_thread_routine(void *private) dcache_flush(g_trac_imp_buffer, TRACE_BUFFER_SIZE); dcache_flush(g_trac_err_buffer, TRACE_BUFFER_SIZE); - // Wait for thermal semaphore - l_ssxrc = ssx_semaphore_pend(&G_thrmSem,SSX_WAIT_FOREVER); /* TEMP -- FIR DATA IS NOT SUPPORTED IN PHASE1 static bool L_fir_collection_completed = FALSE; // Look for FIR collection flag and status @@ -901,16 +880,6 @@ void Main_thread_routine(void *private) } } */ - if ( l_ssxrc != SSX_OK ) - { - MAIN_TRAC_ERR("thermal Semaphore pending failure RC[0x%08X]", -l_ssxrc ); - } - else - { - // For Simics phase 1, we don't want to call the thermal thread - // Call thermal routine that executes fan control - //thrm_thread_main(); - } if( l_ssxrc == SSX_OK) { diff --git a/src/occ_405/occLinkInputFile b/src/occ_405/occLinkInputFile index 7995f7e..e885751 100644 --- a/src/occ_405/occLinkInputFile +++ b/src/occ_405/occLinkInputFile @@ -69,6 +69,5 @@ INPUT ( amec_data.o ssx_timer_init.o state.o threadSch.o - thrm_thread.o timer.o trac_interface.o) diff --git a/src/occ_405/occ_service_codes.h b/src/occ_405/occ_service_codes.h index 08918e6..c48872b 100644 --- a/src/occ_405/occ_service_codes.h +++ b/src/occ_405/occ_service_codes.h @@ -75,6 +75,8 @@ enum occReasonCode CENT_LFIR_ERROR = 0x42, /// Throttle in nominal or turbo mode due to the bulk power limit being reached with both power supplies good PCAP_THROTTLE_POWER_LIMIT = 0x61, + /// Firmware Failure: equivalent to assertion failures + INTERNAL_FW_FAILURE = 0xA0, /// Failure within the OCC Complex of the processor INTERNAL_HW_FAILURE = 0xB0, /// OCC GPE halted due to checkstop diff --git a/src/occ_405/thread/thrm_thread.c b/src/occ_405/thread/thrm_thread.c deleted file mode 100755 index c64c30f..0000000 --- a/src/occ_405/thread/thrm_thread.c +++ /dev/null @@ -1,465 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/occ_405/thread/thrm_thread.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 <cmdh_fsp_cmds_datacnfg.h> -#include <thrm_thread.h> -#include <trac.h> -#include <state.h> -#include <occ_service_codes.h> -#include <thread_service_codes.h> -#include <occ_sys_config.h> - -// Global for notifying the thermal thread if it needs to update its copy -// of the thermal threshold data packet (format 0x13) -BOOLEAN G_thrm_parms_need_update = FALSE; - -// Fan control loop time in seconds sent by TMGT (format 0x13) -uint8_t G_thrm_loop_time = 0; - -// Cooling request status (0=no request; 1=send request) -uint8_t G_thrm_cooling_request = 0; - -// Local copy of thermal thresholds sent by TMGT (format 0x13) -thrm_fru_control_t G_thrm_fru_control[DATA_FRU_MAX]; - -// Global array to store dynamic information for each FRU -thrm_fru_data_t G_thrm_fru_data[DATA_FRU_MAX]; - -// Function Specification -// -// Name: THRM_thread_update_thresholds -// -// Description: Notify thermal thread to update its local copy of the -// thermal threshold data packet. -// -// End Function Specification -void THRM_thread_update_thresholds() -{ - G_thrm_parms_need_update = TRUE; -} - -// Function Specification -// -// Name: THRM_thread_get_cooling_request -// -// Description: Get the status of the cooling request from the thermal -// thread. -// -// End Function Specification -uint8_t THRM_thread_get_cooling_request() -{ - return G_thrm_cooling_request; -} - -// Function Specification -// -// Name: thrm_thread_load_thresholds -// -// Description: Read thermal thresholds sent by TMGT (data format 0x13) -// and store them for thermal thread consumption. -// -// End Function Specification -errlHndl_t thrm_thread_load_thresholds() -{ - errlHndl_t l_err = NULL; - -/* TEMP -- THRM THREAD NOT YET ENABLED (NEED SENSOR / AMEC) */ -#if 0 - cmdh_thrm_thresholds_t *l_data = NULL; - uint8_t i = 0; - - do - { - // Get thermal threshold data sent by TMGT - l_err = DATA_get_thrm_thresholds(&l_data); - if(l_err) - { - TRAC_ERR("thrm_thread_load_thresholds: Thermal control thresholds not available!"); - - // This is a critical failure since we can't run the fan control - // without the thermal thresholds. Make the fan control loop time - // zero so that we don't execute any fan control - G_thrm_loop_time = 0; - break; - } - - // Load fan control loop time - G_thrm_loop_time = l_data->fan_control_loop_time; - - TRAC_INFO("thrm_thread_load_thresholds: Fan Control loop time[%u]", - G_thrm_loop_time); - - // Load FRU data - for (i=0; i<DATA_FRU_MAX; i++) - { - // Load data that is not dependant on the system mode - G_thrm_fru_control[i].warning = l_data->data[i].warning; - G_thrm_fru_control[i].warning_reset = l_data->data[i].warning_reset; - G_thrm_fru_control[i].t_inc_zone[0] = l_data->data[i].t_inc_zone1; - G_thrm_fru_control[i].t_inc_zone[1] = l_data->data[i].t_inc_zone2; - G_thrm_fru_control[i].t_inc_zone[2] = l_data->data[i].t_inc_zone3; - G_thrm_fru_control[i].t_inc_zone[3] = l_data->data[i].t_inc_zone4; - G_thrm_fru_control[i].t_inc_zone[4] = l_data->data[i].t_inc_zone5; - G_thrm_fru_control[i].t_inc_zone[5] = l_data->data[i].t_inc_zone6; - G_thrm_fru_control[i].t_inc_zone[6] = l_data->data[i].t_inc_zone7; - G_thrm_fru_control[i].t_inc_zone[7] = l_data->data[i].t_inc_zone8; - - // Load data that depends on the system mode - // Acoustic mode takes priority - if (0) // TODO: Need to implement acoustic mode - { - G_thrm_fru_control[i].t_control = l_data->data[i].acoustic_t_control; - G_thrm_fru_control[i].error = l_data->data[i].acoustic_error; - } - // ...then nominal mode - else if (CURRENT_MODE() == OCC_MODE_NOMINAL) - { - G_thrm_fru_control[i].t_control = l_data->data[i].t_control; - G_thrm_fru_control[i].error = l_data->data[i].error; - } - // ...then any other power management mode - else - { - G_thrm_fru_control[i].t_control = l_data->data[i].pm_t_control; - G_thrm_fru_control[i].error = l_data->data[i].pm_error; - } - - TRAC_INFO("thrm_thread_load_thresholds: Using t_control[%u] error[%u] for FRU[0x%02X]", - G_thrm_fru_control[i].t_control, - G_thrm_fru_control[i].error, - i); - } - }while(0); -#endif - - return l_err; -} - - -// Function Specification -// -// Name: thrm_thread_fan_control -// -// Description: Execute the fan control algorithm for the specified FRU. -// Returns TRUE or FALSE depending whether we need to increase fan speeds -// or not. -// -// End Function Specification -BOOLEAN thrm_thread_fan_control(const uint8_t i_fru_type, - const uint16_t i_fru_temperature) -{ - eConfigDataFruType k = i_fru_type; - BOOLEAN l_IncreaseFans = FALSE; - uint8_t i = 0; - uint16_t l_delta_temp = 0; - - //If there's a read error, assume temperature is t_control + 1 - if(G_thrm_fru_data[k].read_failure) - { - G_thrm_fru_data[k].Tcurrent = G_thrm_fru_control[k].t_control + 1; - } - else - { - // Collect the current FRU temperature - G_thrm_fru_data[k].Tcurrent = i_fru_temperature; - } - - // Is the current FRU temperature bigger than the FRU T_control? - if (G_thrm_fru_data[k].Tcurrent > G_thrm_fru_control[k].t_control) - { - // Is the current temperature below the previous temperature? - if (G_thrm_fru_data[k].Tcurrent < G_thrm_fru_data[k].Tprevious) - { - // Temperature is decreasing so we don't need to request any - // additional cooling - G_thrm_fru_data[k].temp_increasing = FALSE; - } - else if (G_thrm_fru_data[k].Tcurrent > G_thrm_fru_data[k].Tprevious) - { - // Temperature is increasing and we need to request more cooling - G_thrm_fru_data[k].temp_increasing = TRUE; - l_IncreaseFans = TRUE; - } - else - { - // Temperature is the same as previous iteration. Check the trend - // to see whether is increasing or decreasing - if (G_thrm_fru_data[k].temp_increasing == TRUE) - { - // Need to request additional cooling - l_IncreaseFans = TRUE; - } - else - { - // No need to request additional cooling - } - } - } - - // Prepare the cooling requests for all Zones - l_delta_temp = G_thrm_fru_data[k].Tcurrent - G_thrm_fru_control[k].t_control; - - if (l_IncreaseFans == TRUE) - { - for (i = 0; i < THRM_MAX_NUM_ZONES; i++) - { - G_thrm_fru_data[k].FanIncZone[i] = l_delta_temp * - G_thrm_fru_control[k].t_inc_zone[i]; - } - } - else - { - for (i = 0; i < THRM_MAX_NUM_ZONES; i++) - { - G_thrm_fru_data[k].FanIncZone[i] = 0; - } - } - - // Store the current temperature for next iteration - G_thrm_fru_data[k].Tprevious = G_thrm_fru_data[k].Tcurrent; - - return(l_IncreaseFans); -} - - -// Function Specification -// -// Name: thrm_thread_vrm_fan_control -// -// Description: Execute the fan control algorithm for VRM based on the -// VR_FAN signal. Returns TRUE or FALSE depending whether we need to increase -// fan speeds or not. -// -// End Function Specification -BOOLEAN thrm_thread_vrm_fan_control(const uint16_t i_vrfan) -{ - BOOLEAN l_IncreaseFans = FALSE; - static BOOLEAN L_error_logged = FALSE; - uint8_t i = 0; - errlHndl_t l_err = NULL; - - if ((i_vrfan == 1) || (G_thrm_fru_data[DATA_FRU_VRM].read_failure == 1)) - { - // If VR_FAN has been asserted or we cannot read it, request one T_INC - // for each zone to be controlled - l_IncreaseFans = TRUE; - - for (i = 0; i < THRM_MAX_NUM_ZONES; i++) - { - G_thrm_fru_data[DATA_FRU_VRM].FanIncZone[i] = - G_thrm_fru_control[DATA_FRU_VRM].t_inc_zone[i]; - } - - // Log an informational error the first time VR_FAN was asserted (this - // is for manufacturing mode IPLs) - if (i_vrfan == 1) - { - if (!L_error_logged) - { - L_error_logged = TRUE; - - TRAC_ERR("thrm_thread_vrm_fan_control: VR_FAN for this regulator has been asserted!"); - - /* @ - * @errortype - * @moduleid THRD_THERMAL_VRM_FAN_CONTROL - * @reasoncode VRM_VRFAN_ASSERTED - * @userdata1 state of VR_FAN signal - * @userdata2 0 - * @userdata4 OCC_NO_EXTENDED_RC - * @devdesc VR_FAN signal from regulator has been asserted. - * - */ - l_err = createErrl(THRD_THERMAL_VRM_FAN_CONTROL, //modId - VRM_VRFAN_ASSERTED, //reasoncode - OCC_NO_EXTENDED_RC, //Extended reason code - ERRL_SEV_INFORMATIONAL, //Severity - NULL, //Trace Buf - DEFAULT_TRACE_SIZE, //Trace Size - i_vrfan, //userdata1 - 0); //userdata2 - - // Set the manufacturing error flag in the log - setErrlActions(l_err, ERRL_ACTIONS_MANUFACTURING_ERROR); - - // Commit the error - commitErrl(&l_err); - } - } - } - else - { - // If VR_FAN is de-asserted, don't send any cooling requests - l_IncreaseFans = FALSE; - - for (i = 0; i < THRM_MAX_NUM_ZONES; i++) - { - G_thrm_fru_data[DATA_FRU_VRM].FanIncZone[i] = 0; - } - } - - return(l_IncreaseFans); -} - -// Function Specification -// -// Name: thrm_thread_main -// -// Description: Main thermal thread routine -// -// End Function Specification -void thrm_thread_main() -{ -/* TEMP -- THRM THREAD NOT ENABLED YET (NEED SENSOR / AMEC) */ -#if 0 - errlHndl_t l_err = NULL; - BOOLEAN l_IncreaseFans = FALSE; - sensor_t *l_sensor = NULL; - static uint8_t L_counter = 0; - static BOOLEAN L_full_speed_log = FALSE; - - // Execute fan control loop if OCC is in observation state or active state - // AND if we have received the thermal threshold data packet - if (((CURRENT_STATE() == OCC_STATE_OBSERVATION) || - (CURRENT_STATE() == OCC_STATE_ACTIVE)) && - (DATA_get_present_cnfgdata() & DATA_MASK_THRM_THRESHOLDS)) - { - // Check if we need to update our local copy of the thermal threshold - // data packet - if (G_thrm_parms_need_update) - { - // Clear this flag now that we are going to update our local copy - G_thrm_parms_need_update = FALSE; - - // Update our local copy of the thermal thresholds - l_err = thrm_thread_load_thresholds(); - - if (l_err) - { - // Commit error log for failing to load thermal thresholds - commitErrl(&l_err); - } - else - { - // Clear our counter that determines when to run the fan - // control loop - L_counter = 0; - } - } - - // Increment our counter and make sure it doesn't wrap - L_counter++; - // The fan control loop time is only 1-byte long. A loop time of 0 - // indicates that we shouldn't run the fan control loop. - if (L_counter == 0) - { - L_counter = 0xFF; - } - - // Is it time to execute the fan control loop? - if (L_counter == G_thrm_loop_time) - { - // Reset our counter - L_counter = 0; - - // Determine if additional cooling is required for VRMs - l_sensor = getSensorByGsid(VRFAN250USPROC); - l_IncreaseFans |= thrm_thread_vrm_fan_control(l_sensor->sample); - - // Determine if additional cooling is required for processors - // For processors, use the hottest of the core averages - l_sensor = getSensorByGsid(TEMP4MSP0PEAK); - l_IncreaseFans |= thrm_thread_fan_control(DATA_FRU_PROC, - l_sensor->sample); - - // Determine if additional cooling is required for centaurs - l_sensor = getSensorByGsid(TEMP2MSCENT); - l_IncreaseFans |= thrm_thread_fan_control(DATA_FRU_CENTAUR, - l_sensor->sample); - - // Determine if additional cooling is required for dimms - l_sensor = getSensorByGsid(TEMP2MSDIMM); - l_IncreaseFans |= thrm_thread_fan_control(DATA_FRU_DIMM, - l_sensor->sample); - - // Do we need to request a fan increase? - if (l_IncreaseFans == TRUE) - { - // Set 'Cooling Request' for the poll response - G_thrm_cooling_request = 1; - - // Send 'Service' attention to FSP to force TMGT to send poll - // command - cmdh_fsp_attention(OCC_ALERT_FSP_SERVICE_REQD); - - // Check if fans are currently already at max (known from APSS) - // log informational B1812A08 and have the "Manufacturing error" - // bit in the actions field set so that TMGT will flag this in manufacturing. - // ** No longer reading gpio from APSS in GA1 due to instability in APSS composite mode - uint8_t l_full_speed = 1; // low active - // TODO: Should we continue to not read gpio from APSS? - if( (L_full_speed_log == FALSE) && - FALSE) //apss_gpio_get(l_full_speed_pin,&l_full_speed) ) - { - if(l_full_speed == 0) //low active - { - L_full_speed_log = TRUE; // log this error ONLY ONCE per IPL - TRAC_ERR("thrm_thread_main: Request a fan increase and fan is already in full speed"); - - /* @ - * @errortype - * @moduleid THRD_THERMAL_MAIN - * @reasoncode FAN_FULL_SPEED - * @userdata1 0 - * @userdata2 0 - * @userdata4 OCC_NO_EXTENDED_RC - * @devdesc Request a fan increase and fan is already in full speed - * - */ - l_err = createErrl(THRD_THERMAL_MAIN, //modId - FAN_FULL_SPEED, //reasoncode - OCC_NO_EXTENDED_RC, //Extended reason code - ERRL_SEV_INFORMATIONAL, //Severity - NULL, //Trace Buf - DEFAULT_TRACE_SIZE, //Trace Size - 0, //userdata1 - 0); //userdata2 - - // Set the manufacturing error flag in the log - setErrlActions(l_err, ERRL_ACTIONS_MANUFACTURING_ERROR); - commitErrl(&l_err); - } - } - // - } - else - { - // Reset the 'Cooling Request' since we don't need a fan increase - G_thrm_cooling_request = 0; - } - } - } -#endif -} diff --git a/src/occ_405/thread/thrm_thread.h b/src/occ_405/thread/thrm_thread.h deleted file mode 100755 index 21a8b8e..0000000 --- a/src/occ_405/thread/thrm_thread.h +++ /dev/null @@ -1,62 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/occ_405/thread/thrm_thread.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 THRM_THREAD_H -#define THRM_THREAD_H - -#define THRM_MAX_NUM_ZONES 8 - -typedef struct thrm_fru_control -{ - uint8_t t_control; - uint8_t error; - uint8_t warning; - uint8_t warning_reset; - uint16_t t_inc_zone[THRM_MAX_NUM_ZONES]; -}thrm_fru_control_t; - -typedef struct thrm_fru_data -{ - // Flag to indicate that we have timed out trying to read this thermal sensor - uint8_t read_failure; - // Current temperature of this FRU - uint16_t Tcurrent; - // Previous temperature of this FRU - uint16_t Tprevious; - // Coooling requests to be sent back to TMGT - uint16_t FanIncZone[THRM_MAX_NUM_ZONES]; - // Flag to indicate if the temperature for this FRU is increasing or not - BOOLEAN temp_increasing; -}thrm_fru_data_t; - -errlHndl_t thrm_thread_load_thresholds(); -void THRM_thread_update_thresholds(); -uint8_t THRM_thread_get_cooling_request(); -BOOLEAN thrm_thread_fan_control(const uint8_t i_frutype, - const uint16_t i_fru_temperature); -BOOLEAN thrm_thread_vrm_fan_control(const uint16_t i_vrfan); -void thrm_thread_main(); - -#endif diff --git a/src/occ_405/topfiles.mk b/src/occ_405/topfiles.mk index 1ff4b8a..bfa0c87 100644 --- a/src/occ_405/topfiles.mk +++ b/src/occ_405/topfiles.mk @@ -65,9 +65,8 @@ TOP-C-SOURCES = amec/amec_data.c \ sensor/sensor.c \ state.c \ thread/threadSch.c \ - thread/thrm_thread.c \ timer/timer.c \ - trac/trac_interface.c + trac/trac_interface.c TOP-S-SOURCES = cmdh/ll_ffdc.S \ |