summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Bryan <wilbryan@us.ibm.com>2014-12-09 13:44:50 -0600
committerStephan Broyles <sbroyles@us.ibm.com>2014-12-09 14:38:11 -0600
commitc96c284b24525b44e3e58dc55d9c33842094af25 (patch)
treef337300ffd36df8476722640cbfa7b8b35c10861
parentc2211aac6efc6b045e94a40ace0eb0ef061b13ae (diff)
downloadtalos-occ-c96c284b24525b44e3e58dc55d9c33842094af25.tar.gz
talos-occ-c96c284b24525b44e3e58dc55d9c33842094af25.zip
Cleaned up occ/thread
Change-Id: I3cc40c40e1903703ddfca27307251cfc0df4ffba Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/14809 Reviewed-by: Stephan Broyles <sbroyles@us.ibm.com> Tested-by: Stephan Broyles <sbroyles@us.ibm.com>
-rwxr-xr-xsrc/occ/thread/chom.c188
-rwxr-xr-xsrc/occ/thread/chom.h108
-rwxr-xr-xsrc/occ/thread/test/Makefile35
-rwxr-xr-xsrc/occ/thread/test/app.mk54
-rwxr-xr-xsrc/occ/thread/test/threadtest.c199
-rwxr-xr-xsrc/occ/thread/thread.h127
-rwxr-xr-xsrc/occ/thread/threadSch.c268
-rwxr-xr-xsrc/occ/thread/threadSch.h90
-rwxr-xr-xsrc/occ/thread/thread_service_codes.h99
-rwxr-xr-xsrc/occ/thread/thrm_thread.c175
-rwxr-xr-xsrc/occ/thread/thrm_thread.h58
11 files changed, 484 insertions, 917 deletions
diff --git a/src/occ/thread/chom.c b/src/occ/thread/chom.c
index 2e32c02..8141569 100755
--- a/src/occ/thread/chom.c
+++ b/src/occ/thread/chom.c
@@ -1,29 +1,28 @@
-/******************************************************************************
-// @file chom.c
-// @brief OCC thread Component
-*/
-/******************************************************************************
- *
- * @page ChangeLogs Change Logs
- * @section _chom_c chom.c
- * @verbatim
- *
- * Flag Def/Fea Userid Date Description
- * ------- ---------- -------- ---------- ----------------------------------
- * @jh005 894560 joshych 08/14/2013 Create call home data logs every 24 hours
- * @jh007 897706 joshych 09/17/2013 Updates to call-home data interface
- * @fk002 905632 fmkassem 11/05/2013 Remove CriticalPathMonitor code
- * @gm016 909061 milesg 12/10/2013 Changed trace from error to info
- * @fk006 914801 fmkassem 02/05/2014 Modify reasoncode list
- * @gs027 918066 gjsilva 03/12/2014 Misc functions from ARL
- *
- * @endverbatim
- *
- *///*************************************************************************/
-
-//*************************************************************************
-// Includes
-//*************************************************************************
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/occ/thread/chom.c $ */
+/* */
+/* OpenPOWER OnChipController Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2011,2014 */
+/* [+] Google Inc. */
+/* [+] 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 <occ_common.h>
#include <comp_ids.h>
#include <sensor.h>
@@ -35,51 +34,34 @@
#include <occ_service_codes.h>
#include <thread_service_codes.h>
-//*************************************************************************
-// Externs
-//*************************************************************************
extern amec_sys_t g_amec_sys;
-//*************************************************************************
-// Macros
-//*************************************************************************
#define CHOM_SENSOR_DATA(index,data) [index] = data
-//*************************************************************************
-// Defines/Enums
-//*************************************************************************
-
-//*************************************************************************
-// Structures
-//*************************************************************************
-
-//*************************************************************************
-// Globals
-//*************************************************************************
-/* chom timer */
+// chom timer
uint32_t g_chom_gen_periodic_log_timer;
-/* track which power mode has been during the polling period */
+// track which power mode has been during the polling period
uint8_t g_chom_pwr_modes[OCC_INTERNAL_MODE_MAX_NUM]; // Nominal, SPS, DPS, DPS-MP, FFO
-/* force immediate chom log flag*/
+// force immediate chom log flag
uint8_t g_chom_force;
-/* chom data log */
+// chom data log
ChomLogData_t g_chom_log;
ChomLogData_t * g_chom = &g_chom_log;
-// Make sure that the size of chom log is less than 3kB
+// Make sure that the size of chom log is less than 3kB
// otherwise cause error on the compile.
STATIC_ASSERT( sizeof(ChomLogData_t) > CHOM_LOG_DATA_MAX );
-/* chom sensors table
- * some of the chom sensors need multiple mini-sensor to calculate
- * the max, summstion of temperature or bandwidth
- * mark those mini-sensor "NULL" and will be updated
- * from "chom_update_sensors()"
- */
+// Chom Sensors Table
+// Some of the chom sensors need multiple mini-sensor to calculate
+// the max, summstion of temperature or bandwidth
+// mark those mini-sensor "NULL" and will be updated
+// from "chom_update_sensors()"
+
const uint16_t * g_chom_sensor_table[CHOM_NUM_OF_SENSORS] =
-{ /* Node total power (DC) */
+{ // Node total power (DC)
&g_amec_sys.sys.pwr250us.sample,
- /* Socket power */ // This is only for tuleta 2S @jh007c
+ // Socket power
&g_amec_sys.proc[0].pwr250us.sample,
&G_dcom_slv_outbox_rx[2].pwr250usp0,
NULL,
@@ -88,7 +70,7 @@ const uint16_t * g_chom_sensor_table[CHOM_NUM_OF_SENSORS] =
NULL,
NULL,
NULL,
- /* Memory power */
+ // Memory power
&G_dcom_slv_outbox_rx[0].pwr250usmemp0,
&G_dcom_slv_outbox_rx[1].pwr250usmemp0,
&G_dcom_slv_outbox_rx[2].pwr250usmemp0,
@@ -97,9 +79,9 @@ const uint16_t * g_chom_sensor_table[CHOM_NUM_OF_SENSORS] =
&G_dcom_slv_outbox_rx[5].pwr250usmemp0,
&G_dcom_slv_outbox_rx[6].pwr250usmemp0,
&G_dcom_slv_outbox_rx[7].pwr250usmemp0,
- /* Fan power */
- &g_amec_sys.fan.pwr250usfan.sample, // @jh007a
- /* Processor frequency */ // @mw624
+ // Fan power
+ &g_amec_sys.fan.pwr250usfan.sample,
+ // Processor frequency
&G_dcom_slv_outbox_rx[0].freqa2msp0,
&G_dcom_slv_outbox_rx[1].freqa2msp0,
&G_dcom_slv_outbox_rx[2].freqa2msp0,
@@ -108,7 +90,7 @@ const uint16_t * g_chom_sensor_table[CHOM_NUM_OF_SENSORS] =
&G_dcom_slv_outbox_rx[5].freqa2msp0,
&G_dcom_slv_outbox_rx[6].freqa2msp0,
&G_dcom_slv_outbox_rx[7].freqa2msp0,
- /* Processor utilization sensor */
+ // Processor utilization sensor
&G_dcom_slv_outbox_rx[0].util2msp0,
&G_dcom_slv_outbox_rx[1].util2msp0,
&G_dcom_slv_outbox_rx[2].util2msp0,
@@ -117,41 +99,33 @@ const uint16_t * g_chom_sensor_table[CHOM_NUM_OF_SENSORS] =
&G_dcom_slv_outbox_rx[5].util2msp0,
&G_dcom_slv_outbox_rx[6].util2msp0,
&G_dcom_slv_outbox_rx[7].util2msp0,
- /* Max Core temperature for all processors in the node */
+ // Max Core temperature for all processors in the node
NULL,
- /* Max Centaur temperature for all Centaurs in the node */
+ // Max Centaur temperature for all Centaurs in the node
NULL,
- /* Max Dimm temperature for all Dimms in the node */
+ // Max Dimm temperature for all Dimms in the node
NULL,
- /* Instructions per second sensor */
+ // Instructions per second sensor
NULL,
- /* Memory bandwidth for process memory controller */
- /* P0M0 ~ P0M7 */
+ // Memory bandwidth for process memory controller
+ // P0M0 ~ P0M7
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- /* P1M0 ~ P1M7 */
+ // P1M0 ~ P1M7
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- /* P2M0 ~ P2M7 */
+ // P2M0 ~ P2M7
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- /* P3M0 ~ P3M7 */
+ // P3M0 ~ P3M7
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- /* P4M0 ~ P4M7 */
+ // P4M0 ~ P4M7
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- /* P5M0 ~ P5M7 */
+ // P5M0 ~ P5M7
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- /* P6M0 ~ P6M7 */
+ // P6M0 ~ P6M7
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- /* P7M0 ~ P7M7 */
+ // P7M0 ~ P7M7
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
};
-//*************************************************************************
-// Function Prototypes
-//*************************************************************************
-
-
-//*************************************************************************
-// Functions
-//*************************************************************************
// Function Specification
//
// Name: chom_data_init
@@ -161,13 +135,6 @@ const uint16_t * g_chom_sensor_table[CHOM_NUM_OF_SENSORS] =
// End Function Specification
void chom_data_init()
{
- /*------------------------------------------------------------------------*/
- /* Local Variables */
- /*------------------------------------------------------------------------*/
-
- /*------------------------------------------------------------------------*/
- /* Code */
- /*------------------------------------------------------------------------*/
// chom data reset
chom_data_reset();
// update eyecatcher
@@ -188,13 +155,6 @@ void chom_data_init()
// End Function Specification
void chom_data_reset()
{
- /*------------------------------------------------------------------------*/
- /* Local Variables */
- /*------------------------------------------------------------------------*/
-
- /*------------------------------------------------------------------------*/
- /* Code */
- /*------------------------------------------------------------------------*/
// reset chom data log
memset(g_chom, 0x00, sizeof(*g_chom));
// reset chom modes in log
@@ -213,27 +173,17 @@ void chom_data_reset()
//
// Description: Update chom sensor data
//
-// Flow: 8-12-13 FN:chom_update_sensors.odg
-//
// End Function Specification
void chom_update_sensors()
{
- /*------------------------------------------------------------------------*/
- /* Local Variables */
- /*------------------------------------------------------------------------*/
uint16_t l_max_core_temp = 0;
uint16_t l_max_cent_temp = 0;
uint16_t l_max_dimm_temp = 0;
uint16_t l_mips = 0;
uint16_t l_mem_rw = 0;
uint16_t l_sample = 0;
- uint16_t i = 0;
- uint16_t j = 0;
- uint16_t k = 0;
+ uint16_t i = 0, j = 0, k = 0;
- /*------------------------------------------------------------------------*/
- /* Code */
- /*------------------------------------------------------------------------*/
// Is the current mode different than previous poll
if (g_chom->nodeData.curPwrMode != CURRENT_MODE())
{
@@ -383,16 +333,9 @@ void chom_collect_cpi_data(void)
// End Function Specification
void chom_gen_periodic_log()
{
- /*------------------------------------------------------------------------*/
- /* Local Variables */
- /*------------------------------------------------------------------------*/
uint8_t i = 0;
errlHndl_t l_errlHndl = NULL;
- /*------------------------------------------------------------------------*/
- /* Code */
- /*------------------------------------------------------------------------*/
-
TRAC_INFO("Enter chom_gen_periodic_log");
// update total time
@@ -454,13 +397,6 @@ void chom_gen_periodic_log()
// End Function Specification
void chom_force_gen_log()
{
- /*------------------------------------------------------------------------*/
- /* Local Variables */
- /*------------------------------------------------------------------------*/
-
- /*------------------------------------------------------------------------*/
- /* Code */
- /*------------------------------------------------------------------------*/
g_chom_force = TRUE;
}
@@ -471,19 +407,9 @@ void chom_force_gen_log()
//
// Description: Call home data routine
//
-// Flow: 8-12-13 FN=chom_main.odg
-//
// End Function Specification
void chom_main()
{
- /*------------------------------------------------------------------------*/
- /* Local Variables */
- /*------------------------------------------------------------------------*/
-
- /*------------------------------------------------------------------------*/
- /* Code */
- /*------------------------------------------------------------------------*/
- // @rc001m - Modified to use MAIN debug traces
MAIN_DBG("CHOM routine processing...");
// check if this is the first time we run
diff --git a/src/occ/thread/chom.h b/src/occ/thread/chom.h
index e8da6da..a324209 100755
--- a/src/occ/thread/chom.h
+++ b/src/occ/thread/chom.h
@@ -1,54 +1,45 @@
-/******************************************************************************
-// @file chom.h
-// @brief OCC thread Component header file
-*/
-/******************************************************************************
- *
- * @page ChangeLogs Change Logs
- * @section _chom_h chom.h
- * @verbatim
- *
- * Flag Def/Fea Userid Date Description
- * ------- ---------- -------- ---------- ----------------------------------
- * @jh005 894560 joshych 08/14/2013 Create call home data logs every 24 hours
- * @jh007 897706 joshych 09/17/2013 Updates to call-home data interface
- * @fk002 905632 fmkassem 11/05/2013 Remove CriticalPathMonitor code
- *
- * @endverbatim
- *
- *///*************************************************************************/
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/occ/thread/chom.h $ */
+/* */
+/* OpenPOWER OnChipController Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2011,2014 */
+/* [+] Google Inc. */
+/* [+] 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 _CHOM_H
#define _CHOM_H
-/** \defgroup OCC thread Component
- *
- */
-
-//*************************************************************************
-// Includes
-//*************************************************************************
#include <occ_common.h>
#include <trac_interface.h>
-//*************************************************************************
-// Macros
-//*************************************************************************
-
-//*************************************************************************
-// Defines/Enums
-//*************************************************************************
-#define CHOM_GEN_LOG_PERIODIC_TIME 86400 // of seconds in a day
+#define CHOM_GEN_LOG_PERIODIC_TIME 86400 // seconds in a day
#define CHOM_VERSION 0x00
-/* max size of chom data log */
+// Max size of chom data log
#define CHOM_LOG_DATA_MAX 3072
// List of call home sensors
enum
{
- /* Node total power (DC) */
+ // Node total power (DC)
CHOMPWR = 0,
- /* Socket power */ // @jh007c
+ // Socket power
CHOMPWRP0,
CHOMPWRP1,
CHOMPWRP2,
@@ -57,7 +48,7 @@ enum
CHOMPWRP5,
CHOMPWRP6,
CHOMPWRP7,
- /* Memory power */
+ // Memory power
CHOMPWRM0,
CHOMPWRM1,
CHOMPWRM2,
@@ -66,9 +57,9 @@ enum
CHOMPWRM5,
CHOMPWRM6,
CHOMPWRM7,
- /* Fan power */
- CHOMPWRFAN, // @jh007a
- /* Processor frequency */
+ // Fan power
+ CHOMPWRFAN,
+ // Processor frequency
CHOMFREQP0,
CHOMFREQP1,
CHOMFREQP2,
@@ -77,7 +68,7 @@ enum
CHOMFREQP5,
CHOMFREQP6,
CHOMFREQP7,
- /* Processor utilization sensor */
+ // Processor utilization sensor
CHOMUTILP0,
CHOMUTILP1,
CHOMUTILP2,
@@ -86,15 +77,15 @@ enum
CHOMUTILP5,
CHOMUTILP6,
CHOMUTILP7,
- /* Max core temperature for all processors in the node */
+ // Max core temperature for all processors in the node
CHOMTEMPPROC,
- /* Max Centaur temperature for all Centaurs in the node */
+ // Max Centaur temperature for all Centaurs in the node
CHOMTEMPCENT,
- /* Max Dimm temperature for all Dimms in the node */
+ // Max Dimm temperature for all Dimms in the node
CHOMTEMPDIMM,
- /* Instructions per second sensor */
+ // Instructions per second sensor
CHOMIPS,
- /* Memory bandwidth for process memory controller */
+ // Memory bandwidth for process memory controller
CHOMBWP0M0,
CHOMBWP0M1,
CHOMBWP0M2,
@@ -160,14 +151,11 @@ enum
CHOMBWP7M6,
CHOMBWP7M7,
- /* The number of chom sensors reported*/
+ // The number of chom sensors reported
CHOM_NUM_OF_SENSORS
};
-//*************************************************************************
-// Structures
-//*************************************************************************
-/* Call home sensor Structure */
+// Call home sensor Structure
struct ChomSensor
{
uint16_t sample; // last sample value during the polling period
@@ -179,7 +167,7 @@ struct ChomSensor
typedef struct ChomSensor ChomSensor_t;
-/* CPI data structure */
+// CPI data structure
struct ChomCpiData
{
uint8_t proc;
@@ -188,7 +176,7 @@ struct ChomCpiData
typedef struct ChomCpiData ChomCpiData_t;
-/* Power mode structure */
+// Power mode structure
struct ChomPwrMode
{
uint8_t mode; // OCC power mode
@@ -197,7 +185,7 @@ struct ChomPwrMode
typedef struct ChomPwrMode ChomPwrMode_t;
-/* Call home data Structure */
+// Call home data structure
struct ChomNodeData
{
uint32_t eyecatcher; // "CHOM" will mark the beginning of the data
@@ -211,7 +199,7 @@ struct ChomNodeData
typedef struct ChomNodeData ChomNodeData_t;
-/* Call home sensor data */
+// Call home sensor data
struct ChomSensorData
{
ChomPwrMode_t pwrMode;
@@ -220,7 +208,7 @@ struct ChomSensorData
typedef struct ChomSensorData ChomSensorData_t;
-/* Call home log data */
+// Call home log data
struct ChomLogData
{
ChomNodeData_t nodeData; // general node data
@@ -229,16 +217,10 @@ struct ChomLogData
typedef struct ChomLogData ChomLogData_t;
-//*************************************************************************
-// Externs
-//*************************************************************************
extern uint32_t g_chom_gen_periodic_log_timer;
extern ChomLogData_t * g_chom;
extern uint8_t g_chom_force;
-//*************************************************************************
-// Functions
-//*************************************************************************
void chom_data_init();
void chom_update_sensors();
void chom_gen_periodic_log();
diff --git a/src/occ/thread/test/Makefile b/src/occ/thread/test/Makefile
index 2a4133b..19671d8 100755
--- a/src/occ/thread/test/Makefile
+++ b/src/occ/thread/test/Makefile
@@ -1,29 +1,34 @@
-# $Id$
-
-# @file Makefile
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
#
-# @brief Makefile occ application
+# $Source: src/occ/thread/test/Makefile $
#
-
-# @page ChangeLogs Change Logs
-# @section Makefile
-# @verbatim
+# OpenPOWER OnChipController Project
#
+# Contributors Listed Below - COPYRIGHT 2011,2014
+# [+] Google Inc.
+# [+] International Business Machines Corp.
#
-# Change Log ******************************************************************
-# Flag Defect/Feature User Date Description
-# ------ -------------- ---------- ------------ -----------
-# @rc003 rickylie 02/03/2012 Verify & Clean Up OCC Headers & Comments
#
-# @endverbatim
+# 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
threadtest_CFILES = \
../../common.c \
../../errl/errl.c \
../threadSch.c \
- threadtest.c
+ threadtest.c
all_cfiles = ${threadtest_CFILES}
diff --git a/src/occ/thread/test/app.mk b/src/occ/thread/test/app.mk
index c50c029..d04b65b 100755
--- a/src/occ/thread/test/app.mk
+++ b/src/occ/thread/test/app.mk
@@ -1,49 +1,29 @@
-# $Id$
-
-# @file app.mk
-#
-# @brief mk occ application
-#
-# This Makefile is included-ed into application Makefiles and
-# encapsulates the steps necessary to create application images.
-#
-# The application Makefile (user) must define the following variables:
-#
-# APP - The name of the application
-# SOURCES - The list of local source files that implement the
-# application.
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
#
-# The application Makefile (user) may optionally define the following
-# variables:
+# $Source: src/occ/thread/test/app.mk $
#
-# D - The value of $(D) is appended to DEFS defined by ssx.mk
#
-# MODE - The following modes are recognized:
+# OpenPOWER OnChipController Project
#
-# validation - (Default) An application that requires all SSX
-# services.
+# Contributors Listed Below - COPYRIGHT 2011,2014
+# [+] Google Inc.
+# [+] International Business Machines Corp.
#
-# firmware - An interrupt only configuration.
#
-# The make process creates the following files:
+# 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
#
-# $(APP).out - The PowerPC-ELF version of the application
-# $(APP).bin - A binary SRAM image of the application
-# $(APP).map - The linker map of the application
+# http://www.apache.org/licenses/LICENSE-2.0
#
-# @page ChangeLogs Change Logs
-# @section app.mk
-# @verbatim
+# 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.
#
-#
-# Change Log ******************************************************************
-# Flag Defect/Feature User Date Description
-# ------ -------------- ---------- ------------ -----------
-# @rc003 rickylie 02/03/2012 Verify & Clean Up OCC Headers & Comments
-#
-# @endverbatim
-#
-
+# IBM_PROLOG_END_TAG
OCC = ../../
SSX = ../../../ssx
diff --git a/src/occ/thread/test/threadtest.c b/src/occ/thread/test/threadtest.c
index abf09b5..bebc8d2 100755
--- a/src/occ/thread/test/threadtest.c
+++ b/src/occ/thread/test/threadtest.c
@@ -1,25 +1,28 @@
-/******************************************************************************
-// @file threadtest.c
-// @brief OCC THREAD TEST MAIN FUNCTION
-*/
-/******************************************************************************
- *
- * @page ChangeLogs Change Logs
- * @section threadtest.c THREADTEST.C
- * @verbatim
- *
- * Flag Def/Fea Userid Date Description
- * ------- ---------- -------- ---------- ----------------------------------
- * @dw000 dwoodham 12/12/2011 Update call to IMAGE_HEADER; Added change log
- * @rc003 rickylie 02/03/2012 Verify & Clean Up OCC Headers & Comments
- *
- * @endverbatim
- *
- *///*************************************************************************/
-
-//*************************************************************************
-// Includes
-//*************************************************************************
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/occ/thread/test/threadtest.c $ */
+/* */
+/* OpenPOWER OnChipController Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2011,2014 */
+/* [+] Google Inc. */
+/* [+] 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 "ssx.h"
#include "ssx_io.h"
#include "simics_stdio.h"
@@ -27,51 +30,17 @@
#include <rand.h>
#include <thread.h>
#include <threadSch.h>
-#include <appletId.h> // @dw000a
-
+#include <appletId.h>
-/** \mainpage OCC Overview
- *
- * Some general info.
- *
- * This manual is divided in the following sections:
- * - \subpage Timer
- */
-
-//*************************************************************************
-// Externs
-//*************************************************************************
extern void __ssx_boot;
-//*************************************************************************
-// Image Header
-//*************************************************************************
-// @dw000c
IMAGE_HEADER (G_mainAppImageHdr,__ssx_boot,MAIN_APP_ID,OCC_APLT_TEST);
-//*************************************************************************
-// Macros
-//*************************************************************************
-
-//*************************************************************************
-// Defines/Enums
-//*************************************************************************
-/// Period in which to run #timer_routine
-#define TIMER_INTERVAL (SsxInterval) SSX_MICROSECONDS(5000)
+// Period in which to run timer_routine
+#define TIMER_INTERVAL (SsxInterval) SSX_MICROSECONDS(5000)
-
-/*----------------------------------------------------------------------------*/
-/* SsxSemaphore Declarations */
-/*----------------------------------------------------------------------------*/
SsxSemaphore prcd_sem;
-//*************************************************************************
-// Structures
-//*************************************************************************
-
-//*************************************************************************
-// Globals
-//*************************************************************************
int g_j = 0;
int g_k = 0;
/*----------------------------------------------------------------------------*/
@@ -84,24 +53,16 @@ SimicsStdio simics_stderr;
SsxTimer G_test_timer;
-//*************************************************************************
-// Function Prototypes
-//*************************************************************************
extern void timer_routine(void *private);
extern void rtloop_ocb_init(void);
-//*************************************************************************
-// Functions
-//*************************************************************************
// Function Specification
//
// Name: pgp_validation_ssx_main_hook
//
-// Description:
+// Description: TODO Add description
//
-// Flow: FN=None
-//
// End Function Specification
void pgp_validation_ssx_main_hook(void)
{
@@ -112,10 +73,8 @@ void pgp_validation_ssx_main_hook(void)
//
// Name: Cmd_Hndl_thread_routine
//
-// Description:
+// Description: TODO Add description
//
-// Flow: FN=None
-//
// End Function Specification
//TODO placeholder
void Cmd_Hndl_thread_routine(void *arg)
@@ -127,7 +86,6 @@ void Cmd_Hndl_thread_routine(void *arg)
{
}
- //printf("Thread A running");
}while(1);
}
@@ -136,10 +94,8 @@ void Cmd_Hndl_thread_routine(void *arg)
//
// Name: App_thread_routine
//
-// Description:
+// Description: TODO Add description
//
-// Flow: FN=None
-//
// End Function Specification
void App_thread_routine(void *arg)
{
@@ -151,7 +107,6 @@ void App_thread_routine(void *arg)
{
z++;
}
- //printf("Thread A running");
}while(1);
}
@@ -160,10 +115,8 @@ void App_thread_routine(void *arg)
//
// Name: Thermal_Monitor_thread_routine
//
-// Description:
+// Description: TODO Add description
//
-// Flow: FN=None
-//
// End Function Specification
void Thermal_Monitor_thread_routine(void *arg)
{
@@ -175,19 +128,16 @@ void Thermal_Monitor_thread_routine(void *arg)
{
z++;
}
- //printf("Thread A running");
}while(1);
-
+
}
// Function Specification
//
// Name: Hlth_Monitor_thread_routine
//
-// Description:
+// Description: TODO Add description
//
-// Flow: FN=None
-//
// End Function Specification
void Hlth_Monitor_thread_routine(void *arg)
{
@@ -199,7 +149,6 @@ void Hlth_Monitor_thread_routine(void *arg)
{
z++;
}
- //printf("Thread A running");
}while(1);
}
@@ -208,10 +157,8 @@ void Hlth_Monitor_thread_routine(void *arg)
//
// Name: FFDC_thread_routine
//
-// Description:
+// Description: TODO Add description
//
-// Flow: FN=None
-//
// End Function Specification
void FFDC_thread_routine(void *arg)
{
@@ -223,26 +170,17 @@ void FFDC_thread_routine(void *arg)
{
z++;
}
- //printf("Thread A running");
}while(1);
}
-
-/** Main Thread
- *
- * This thread currently just loops as the lowest priority thread, handling
- * the lowest priority tasks.
- *
- */
// Function Specification
//
// Name: main_thread_routine
//
-// Description:
+// Description: This thread currently just looks as the lowest priority thread,
+// handling the lowest priority tasks.
//
-// Flow: FN=None
-//
// End Function Specification
void main_thread_routine(void *private)
{
@@ -268,10 +206,8 @@ void main_thread_routine(void *private)
//
// Name: timer_routine
//
-// Description:
+// Description: TODO Add description
//
-// Flow: FN=None
-//
// End Function Specification
void timer_routine (void *arg)
{
@@ -282,14 +218,12 @@ void timer_routine (void *arg)
//
// Name: dump_thread_info
//
-// Description:
+// Description: TODO Add description
//
-// Flow: FN=None
-//
// End Function Specification
void dump_thread_info(void *arg)
{
-
+
printf("dumping thread info--------------------------\n");
int l_rc = 0;
SsxThreadState l_state = 0;
@@ -308,34 +242,27 @@ void dump_thread_info(void *arg)
l_pri,
l_runnable,
l_rc,
- G_threadSchedulerIndex);
+ G_threadSchedulerIndex);
}
}
-/** Entry point for OCC execution
- *
- * main() currently initalizes our trace buffer along with creating threads
- * and timers for execution. Note that once main runs ssx_start_threads, we
- * never return as the SSX kernel takes over.
- *
- */
// Function Specification
//
// Name: main
//
-// Description:
+// Description: Initializes the trace buffer, along with creating threads and timers
+// for execution. Note that once main runs with ssx_start_threads, we
+// never return as the SSX kernel takes over.
//
-// Flow: FN=None
-//
// End Function Specification
int main(int argc, char **argv)
{
- //locals
+ // Locals
errlHndl_t l_errl = INVALID_ERR_HNDL;
- // Initialize Trace Buffers immediately, so they can be used
+ // Initialize Trace Buffers immediately, so they can be used
// from this point on.
// Initialize stdout so we can do printf from within simics env
@@ -346,46 +273,38 @@ int main(int argc, char **argv)
// Initialize SSX Stacks (note that this also reinitializes the time base to 0)
ssx_initialize((SsxAddress)noncritical_stack, NONCRITICAL_STACK_SIZE,
- (SsxAddress)critical_stack, CRITICAL_STACK_SIZE,
- 0);
-
-
+ (SsxAddress)critical_stack, CRITICAL_STACK_SIZE, 0);
// Create Global Semaphores
ssx_semaphore_create(&prcd_sem, 0, 13);
ssx_timer_create(&timer, timer_routine, 0);
-// //create thread with already mapped priority
-// // Create Threads
- ssx_thread_create(&main_thread,
- main_thread_routine,
- (void *)0,
- (SsxAddress)main_thread_stack,
- THREAD_STACK_SIZE,
- 0);
-
+ // Create thread with already mapped priority
+ // Create Threads
+ ssx_thread_create(&main_thread,
+ main_thread_routine,
+ (void *)0,
+ (SsxAddress)main_thread_stack,
+ THREAD_STACK_SIZE,
+ 0);
// Make Threads runnable
ssx_thread_resume(&main_thread);
-
//Initialize the thread scheduler
l_errl = initThreadScheduler();
if(l_errl)
{
- // Trace and commit error
+ // TODO Trace the error
- // TODO add trace
-
- // commit log
+ // Commit log
// NOTE: log should be deleted by reader mechanism
- commitErrl( &l_errl );
+ commitErrl( &l_errl );
}
-
- //kick off timer
+ // Kick off timer
ssx_timer_create(&G_test_timer, dump_thread_info, 0);
ssx_timer_schedule(&G_test_timer, 1, 500000000);
diff --git a/src/occ/thread/thread.h b/src/occ/thread/thread.h
index 2a28107..90d051f 100755
--- a/src/occ/thread/thread.h
+++ b/src/occ/thread/thread.h
@@ -1,52 +1,39 @@
-/******************************************************************************
-// @file thread.h
-// @brief OCC THREAD COMPONENT header file
-*/
-/******************************************************************************
- *
- * @page ChangeLogs Change Logs
- * @section _thread_h thread.h
- * @verbatim
- *
- * Flag Def/Fea Userid Date Description
- * ------- ---------- -------- ---------- ----------------------------------
- * abagepa 07/15/2011 Created Threads definition header
- * @pb004 pbavari 09/12/2011 Test applet thread support
- * @pb009 pbavari 10/20/2011 Removed unused thread related data
- * @rc003 rickylie 02/03/2012 Verify & Clean Up OCC Headers & Comments
- * @pb00E pbavari 03/11/2012 Added correct include file
- * @th022 thallet 10/03/2012 Changes to allow DCOM State/Mode setting
- *
- * @endverbatim
- *
- *///*************************************************************************/
-
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/occ/thread/thread.h $ */
+/* */
+/* OpenPOWER OnChipController Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2011,2014 */
+/* [+] Google Inc. */
+/* [+] 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 _THREAD_H
#define _THREAD_H
-//*************************************************************************
-// Includes
-//*************************************************************************
-//@pb00Ec - changed from common.h to occ_common.h for ODE support
#include <occ_common.h>
#include "ssx.h"
-//*************************************************************************
-// Externs
-//*************************************************************************
-
-//*************************************************************************
-// Macros
-//*************************************************************************
-
-//*************************************************************************
-// Defines/Enums
-//*************************************************************************
// Thread priorities for Thread creation.
typedef enum
{
- THREAD_PRIORITY_0, //reserved for high priority
- THREAD_PRIORITY_1, //reserved for high priority
+ THREAD_PRIORITY_0, // Reserved for high priority
+ THREAD_PRIORITY_1, // Reserved for high priority
THREAD_PRIORITY_2,
THREAD_PRIORITY_3,
THREAD_PRIORITY_4,
@@ -56,65 +43,38 @@ typedef enum
THREAD_PRIORITY_8,
}THREAD_PRIORITY;
-/*----------------------------------------------------------------------------*/
-/* Stack Size and Declaration */
-/*----------------------------------------------------------------------------*/
-
-/** \defgroup Stack Stack Information
- * Stack sizes are defined by entity
- * - Non-Critical Stack used by non-critical interrupt handlers, including timer callbacks
- * - Critical Stack used for critical interrupts
- * - Stacks for each thread
- */
-
+// NOTE: Stack sizes are defined by entity
+// - Non-Critical Stack used by non-critical interrupt handlers, including timer callbacks
+// - Critical Stack used for critical interrupts
+// - Stacks for each thread
#define NONCRITICAL_STACK_SIZE 8192 // 8kB
#define CRITICAL_STACK_SIZE 4096 // 4kB
#define THREAD_STACK_SIZE 4096 // 4kB
-//*************************************************************************
-// Structures
-//*************************************************************************
-
-//*************************************************************************
-// Globals
-//*************************************************************************
-/*@{*/
extern uint8_t main_thread_stack[THREAD_STACK_SIZE];
extern uint8_t Cmd_hndl_thread_stack[THREAD_STACK_SIZE];
extern uint8_t App_thread_stack[THREAD_STACK_SIZE];
-//@pb004a - added
extern uint8_t testAppletThreadStack[THREAD_STACK_SIZE];
-/*@}*/ // Ending tag for stack module in doxygen
-
-/*----------------------------------------------------------------------------*/
-/*SsxTimer and SsxThread Declarations */
-/*----------------------------------------------------------------------------*/
-/** \defgroup TimersAndThreads Timer and Thread Information */ /*@{*/
-
-/// Our timer based on TIMER_INTERVAL that kicks off most of the work. See #timer_routine
-//SsxTimer timer; // @tgh001 -- unused
+/*----------------------------------------------------------*/
+/* SsxThread Declaration */
+/*----------------------------------------------------------*/
-/// Our idle thread. See #main_thread_routine
+// Our idle thread. See main_thread_routine
extern SsxThread Main_thread;
-//Command handler thread
+// Command handler thread
extern SsxThread Cmd_Hndl_thread;
-//Application manager thread
-extern SsxThread App_thread;
+// Application manager thread
+extern SsxThread App_thread;
-//@pb004a - Test applet thread
+// Test applet thread
extern SsxThread TestAppletThread;
-//Application manager thread
-extern SsxThread Dcom_thread;
+// Application manager thread
+extern SsxThread Dcom_thread;
-/*@}*/ // Ending tag for TimersAndThreads module in doxygen
-
-//*************************************************************************
-// Function Prototypes
-//*************************************************************************
void Main_thread_routine(void *private);
void Cmd_Hndl_thread_routine(void *arg);
@@ -123,11 +83,6 @@ void App_thread_routine(void *arg);
void Dcom_thread_routine(void *arg);
-//@pb004a -added
void testAppletThreadRoutine(void *arg);
-//*************************************************************************
-// Functions
-//*************************************************************************
-
#endif //_THREAD_H
diff --git a/src/occ/thread/threadSch.c b/src/occ/thread/threadSch.c
index e593747..f72fd94 100755
--- a/src/occ/thread/threadSch.c
+++ b/src/occ/thread/threadSch.c
@@ -1,34 +1,28 @@
-/******************************************************************************
-// @file threadSch.c
-// @brief OCC THREAD COMPONENT Thread Scheduler methods
-*/
-/******************************************************************************
- *
- * @page ChangeLogs Change Logs
- * @section _threadSch_c threadSch.c
- * @verbatim
- *
- * Flag Def/Fea Userid Date Description
- * ------- ---------- -------- ---------- ----------------------------------
- * abagepa 07/15/2011 Created Thread Scheduler methods
- * @pb004 pbavari 09/02/2011 Test applet thread support
- * @pb009 pbavari 10/20/2011 Main thread support
- * @th006 thallet 11/21/2011 RESET_REQUEST substituted for todo's
- * @rc003 rickylie 02/03/2012 Verify & Clean Up OCC Headers & Comments
- * @pb00E pbavari 03/11/2012 Added correct include file
- * @nh001 neilhsu 05/23/2012 Add missing error log tags
- * @th022 thallet 10/03/2012 Added DCOM Thread for State/Mode setting
- * @gm006 SW224414 milesg 09/16/2013 Reset and FFDC improvements
- * @fk004 907588 fmkassem 11/25/2013 Snapshot buffer support.
- *
- * @endverbatim
- *
- *///*************************************************************************/
-
-//*************************************************************************
-// Includes
-//*************************************************************************
-//@pb00Ec - changed from common.h to occ_common.h for ODE support
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/occ/thread/threadSch.c $ */
+/* */
+/* OpenPOWER OnChipController Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2011,2014 */
+/* [+] Google Inc. */
+/* [+] 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 <occ_common.h>
#include <threadSch.h>
#include "ssx.h"
@@ -37,42 +31,20 @@
#include <appletManager.h>
#include <trac.h>
#include <state.h>
-#include "cmdh_snapshot.h" // @fk004a
-
-
-//*************************************************************************
-// Externs
-//*************************************************************************
+#include "cmdh_snapshot.h"
-//*************************************************************************
-// Macros
-//*************************************************************************
-
-//*************************************************************************
-// Defines/Enums
-//*************************************************************************
-//Numbers of threads to schedule
-//@pb009c - Changed to use dynamic calculation
+// Numbers of threads to schedule
#define THREADS_TO_SCHEDULE (sizeof(G_scheduledThreads)/sizeof(SsxThread*))
-//10 ms
-#define THREAD_TIME_SLICE (SsxInterval) SSX_MILLISECONDS(10)
-
-//*************************************************************************
-// Structures
-//*************************************************************************
+#define THREAD_TIME_SLICE (SsxInterval) SSX_MILLISECONDS(10) // 10ms
-//*************************************************************************
-// Globals
-//*************************************************************************
-/* Thread Timer to reprioritize the threads */
+// Thread Timer to reprioritize the threads
SsxTimer G_threadSchTimer;
-//Index of highest priority thread in G_scheduledThreads
+// Index of highest priority thread in G_scheduledThreads
uint16_t G_threadSchedulerIndex = 0;
-/* Array that holds the threads that need scheduling */
-//@pb009c - Removed not needed threads
+// Array that holds the threads that need scheduling
SsxThread* G_scheduledThreads[] =
{
&Main_thread,
@@ -82,8 +54,7 @@ SsxThread* G_scheduledThreads[] =
&Dcom_thread,
};
-//Error log counter for the callback
-// so that only 1 error log is created
+// Error log counter for the callback so that only 1 error log is created
uint8_t G_threadSwapErrlCounter = 0;
// Global for the parameter to the applet thread routine
@@ -97,37 +68,27 @@ uint8_t App_thread_stack[THREAD_STACK_SIZE];
uint8_t testAppletThreadStack[THREAD_STACK_SIZE];
uint8_t dcomThreadStack[THREAD_STACK_SIZE];
-/// Our idle thread. See #main_thread_routine
+// Our idle thread. See main_thread_routine
SsxThread Main_thread;
-//Command handler thread
+// Command handler thread
SsxThread Cmd_Hndl_thread;
-//Application manager thread
-SsxThread App_thread;
+// Application manager thread
+SsxThread App_thread;
-//@pb004a - Test applet thread
+// Test applet thread
SsxThread TestAppletThread;
-//@thXXXa - Dcom thread
+// Dcom thread
SsxThread Dcom_thread;
-//*************************************************************************
-// Function Prototypes
-//*************************************************************************
-
-//*************************************************************************
-// Functions
-//*************************************************************************
-
// Function Specification
//
// Name: createAndResumeThreadHelper
//
-// Description: create and resume thread helper
+// Description: create and resume thread helper
//
-// Flow: FN=None
-//
// End Function Specification
int createAndResumeThreadHelper(SsxThread *io_thread,
SsxThreadRoutine i_thread_routine,
@@ -137,18 +98,18 @@ int createAndResumeThreadHelper(SsxThread *io_thread,
THREAD_PRIORITY i_priority)
{
- //locals
+ // Locals
int l_rc = SSX_OK;
- //Thread creation
- l_rc = ssx_thread_create(io_thread,
- i_thread_routine,
+ // Thread creation
+ l_rc = ssx_thread_create(io_thread,
+ i_thread_routine,
io_arg,
i_stack,
i_stack_size,
(SsxThreadPriority)i_priority);
- //check for errors creating a thread
+ //check for errors creating a thread
if(l_rc != SSX_OK)
{
TRAC_ERR("Failure creating thread. rc: 0x%x", -l_rc);
@@ -159,11 +120,10 @@ int createAndResumeThreadHelper(SsxThread *io_thread,
l_rc = ssx_thread_resume(io_thread);
}
-
+
return l_rc;
}
-
// Function Specification
//
// Name: initThreadScheduler
@@ -171,13 +131,10 @@ int createAndResumeThreadHelper(SsxThread *io_thread,
// Description: Init the threads in the scheduler and start the
// timer.
//
-// Flow: 10/31/11 FN=initThreadScheduler
-//
// End Function Specification
-// @pb009c - Removed not needed threads from the initialization
void initThreadScheduler(void)
{
- //locals
+ // Locals
int l_appThreadRc = SSX_OK;
int l_cmdThreadRc = SSX_OK;
int l_timerRc = SSX_OK;
@@ -185,10 +142,10 @@ void initThreadScheduler(void)
int l_dcomThreadRc = SSX_OK;
int l_snapshotTimerRc = SSX_OK;
- //Creating threads that need to be scheduled
- //Thread priority range should match scheduled
- // threads in G_scheduledThreads ie highest priority thread should be
- // index 0 of G_scheduledThreads
+ // Creating threads that need to be scheduled
+ // Thread priority range should match scheduled
+ // threads in G_scheduledThreads ie highest priority thread should be
+ // index 0 of G_scheduledThreads
l_cmdThreadRc = createAndResumeThreadHelper(&Cmd_Hndl_thread,
Cmd_Hndl_thread_routine,
@@ -198,7 +155,7 @@ void initThreadScheduler(void)
THREAD_PRIORITY_3);
l_appThreadRc = createAndResumeThreadHelper(&App_thread,
- App_thread_routine,
+ App_thread_routine,
(void *)&G_apltPdtType,
(SsxAddress)App_thread_stack,
THREAD_STACK_SIZE,
@@ -218,10 +175,10 @@ void initThreadScheduler(void)
THREAD_STACK_SIZE,
THREAD_PRIORITY_6);
- //create the thread scheduler timer
+ // Create the thread scheduler timer
l_timerRc = ssx_timer_create(&G_threadSchTimer, threadSwapcallback, 0);
-
- //check for errors creating the timer
+
+ // Check for errors creating the timer
if(l_timerRc == SSX_OK)
{
TRAC_INFO("timer created and scheduled");
@@ -233,65 +190,62 @@ void initThreadScheduler(void)
TRAC_INFO("Error creating timer: RC: %d", l_timerRc);
}
- //Create snapshot timer
+ // Create snapshot timer
l_snapshotTimerRc = ssx_timer_create(&G_snapshotTimer, cmdh_snapshot_callback, 0);
-
- //check for errors creating the timer
+
+ // Check for errors creating the timer
if(l_snapshotTimerRc == SSX_OK)
{
- //TRAC_INFO("snapshot buffer timer created and scheduled every 30 seconds");
- //schedule the timer so that it runs every 30 seconds.
- l_snapshotTimerRc = ssx_timer_schedule(&G_snapshotTimer, 0, SSX_SECONDS(30));
+ // Schedule the timer so that it runs every 30 seconds.
+ l_snapshotTimerRc = ssx_timer_schedule(&G_snapshotTimer, 0, SSX_SECONDS(30));
if (l_snapshotTimerRc != SSX_OK)
{
TRAC_ERR("cmdh_snapshot_sync: reseting the snapshot timer failed.");
-
- }
+ }
}
else
{
TRAC_INFO("Error creating timer: RC: %d", l_snapshotTimerRc);
}
-
- //If there are any errors creating the threads or starting the
- //timer create an error log to pass back.
- if( l_appThreadRc
- || l_testAppletThreadRc
- || l_cmdThreadRc
+ // If there are any errors creating the threads or starting the
+ // timer create an error log to pass back.
+ if( l_appThreadRc
+ || l_testAppletThreadRc
+ || l_cmdThreadRc
|| l_dcomThreadRc
|| l_timerRc
- || l_snapshotTimerRc )
+ || l_snapshotTimerRc )
{
TRAC_ERR("Error creating thread: l_appThreadRc: %d, "
"l_testAppletThreadRc: %d, l_cmdThreadRc: %d, "
"l_dcomThreadRc: %d", l_appThreadRc,l_testAppletThreadRc,
- l_timerRc,l_cmdThreadRc,l_dcomThreadRc);
- TRAC_ERR("Error starting timers: timerRc: %d, snapshotTimerRc: %d.",
- l_timerRc, l_snapshotTimerRc);
+ l_timerRc,l_cmdThreadRc,l_dcomThreadRc);
+ TRAC_ERR("Error starting timers: timerRc: %d, snapshotTimerRc: %d.",
+ l_timerRc, l_snapshotTimerRc);
// Create error log and log it
// TODO use correct trace
- tracDesc_t l_trace = NULL;
+ tracDesc_t l_trace = NULL;
/* @
* @errortype
* @moduleid THRD_MID_INIT_THREAD_SCHDLR
* @reasoncode SSX_GENERIC_FAILURE
* @userdata1 Schedule timer return code
- * @userdata2 Snapshot timer return code
+ * @userdata2 Snapshot timer return code
* @userdata4 OCC_NO_EXTENDED_RC
* @devdesc SSX thread related failure
*/
- errlHndl_t l_rc = createErrl(THRD_MID_INIT_THREAD_SCHDLR, //modId
- SSX_GENERIC_FAILURE, //reasoncode
- OCC_NO_EXTENDED_RC, //Extended reason code
- ERRL_SEV_UNRECOVERABLE, //Severity
- l_trace, //Trace Buf
- DEFAULT_TRACE_SIZE, //Trace Size
- l_timerRc, //userdata1
- l_snapshotTimerRc); //userdata2
-
- REQUEST_RESET(l_rc); // @gm006
+ errlHndl_t l_rc = createErrl(THRD_MID_INIT_THREAD_SCHDLR, // ModId
+ SSX_GENERIC_FAILURE, // Reasoncode
+ OCC_NO_EXTENDED_RC, // Extended reasoncode
+ ERRL_SEV_UNRECOVERABLE, // Severity
+ l_trace, // Trace Buf
+ DEFAULT_TRACE_SIZE, // Trace Size
+ l_timerRc, // Userdata1
+ l_snapshotTimerRc); // Userdata2
+
+ REQUEST_RESET(l_rc);
}
}
@@ -300,70 +254,68 @@ void initThreadScheduler(void)
//
// Name: threadSwapcallback
//
-// Description: a periodic timer callback to swap prorities of scheduled threads
-//
-// Flow: 07/16/11 FN=threadSwapcallback
+// Description: a periodic timer callback to swap prorities of scheduled threads
//
// End Function Specification
void threadSwapcallback(void * arg)
{
- //locals
+ // Locals
int l_rc = SSX_OK;
- //current location of index in scheduled thread array
+ // Current location of index in scheduled thread array
int l_threadAIndex = G_threadSchedulerIndex;
- //if global index == last item swap priorities with 1st
+ // If global index == last item swap priorities with 1st
int l_threadBIndex = (G_threadSchedulerIndex == (THREADS_TO_SCHEDULE-1)) ? 0 : ++G_threadSchedulerIndex;
-
- //swap priorities with global index +1
+
+ // Swap priorities with global index +1
l_rc = ssx_thread_priority_swap(G_scheduledThreads[l_threadAIndex],G_scheduledThreads[l_threadBIndex]);
- if(l_rc != SSX_OK)
+ if(l_rc != SSX_OK)
{
- //TODO trace error
+ // TODO trace error
- //create and commit error log
+ // Create and commit error log
if(G_threadSwapErrlCounter == 0)
- {
+ {
// TODO use correct trace
- tracDesc_t l_trace = NULL;
+ tracDesc_t l_trace = NULL;
/*
* @errortype
* @moduleid THRD_MID_THREAD_SWAP_CALLBACK
* @reasoncode SSX_GENERIC_FAILURE
* @userdata1 Return code of thread priority swap
- * @userdata2 Current location of index in scheduled thread array
+ * @userdata2 Current location of index in scheduled thread array
* @userdata4 OCC_NO_EXTENDED_RC
* @devdesc SSX thread related failure
*/
errlHndl_t l_err = createErrl(
- THRD_MID_THREAD_SWAP_CALLBACK, //modId
- SSX_GENERIC_FAILURE, //reasoncode
- OCC_NO_EXTENDED_RC, //Extended reason code
- ERRL_SEV_PREDICTIVE, //Severity
- l_trace, //Trace Buf
- DEFAULT_TRACE_SIZE, //Trace Size
- l_rc, //userdata1
- l_threadAIndex //userdata2
+ THRD_MID_THREAD_SWAP_CALLBACK, // ModId
+ SSX_GENERIC_FAILURE, // Reasoncode
+ OCC_NO_EXTENDED_RC, // Extended reasoncode
+ ERRL_SEV_PREDICTIVE, // Severity
+ l_trace, // Trace Buf
+ DEFAULT_TRACE_SIZE, // Trace Size
+ l_rc, // Userdata1
+ l_threadAIndex // Userdata2
);
-
- // commit log
- // NOTE: log should be deleted by reader mechanism
- commitErrl( &l_err );
-
- //Increment errl counter
+
+ // Commit log
+ // NOTE: Log should be deleted by reader mechanism
+ commitErrl( &l_err );
+
+ // Increment errl counter
G_threadSwapErrlCounter++;
- }//end thread swap counter if
+ }// End thread swap counter if
}
else
{
- //reset counter since it started working again
+ // Reset counter since it started working again
G_threadSwapErrlCounter = 0;
- //set the global to the new location of the highest priority thread
+ // Set the global to the new location of the highest priority thread
G_threadSchedulerIndex = l_threadBIndex;
}
}
diff --git a/src/occ/thread/threadSch.h b/src/occ/thread/threadSch.h
index c457646..6359a82 100755
--- a/src/occ/thread/threadSch.h
+++ b/src/occ/thread/threadSch.h
@@ -1,83 +1,49 @@
-/******************************************************************************
-// @file threadSch.h
-// @brief OCC THREAD COMPONENT Thread Scheduler header file
-*/
-/******************************************************************************
- *
- * @page ChangeLogs Change Logs
- * @section _threadSch_h threadSch.h
- * @verbatim
- *
- * Flag Def/Fea Userid Date Description
- * ------- ---------- -------- ---------- ----------------------------------
- * abagepa 07/15/2011 Created Thread scheduler methods
- * @01 tapiar 08/05/2011 Moved define to common.h
- * @pb004 pbavari 09/02/2011 Initialize section support
- * @pb009 pbavari 10/20/2011 Main thread support
- * @rc003 rickylie 02/03/2012 Verify & Clean Up OCC Headers & Comments
- * @pb00E pbavari 03/11/2012 Added correct include file
- *
- * @endverbatim
- *
- *///*************************************************************************/
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/occ/thread/threadSch.h $ */
+/* */
+/* OpenPOWER OnChipController Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2011,2014 */
+/* [+] Google Inc. */
+/* [+] 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 _THREADSCH_H
#define _THREADSCH_H
-//*************************************************************************
-// Includes
-//*************************************************************************
-//@pb00Ec - changed from common.h to occ_common.h for ODE support
#include <occ_common.h>
#include <thread.h>
#include "ssx.h"
#include <errl.h>
-//*************************************************************************
-// Externs
-//*************************************************************************
-
-//*************************************************************************
-// Macros
-//*************************************************************************
-
-//*************************************************************************
-// Defines/Enums
-//*************************************************************************
-
-//*************************************************************************
-// Structures
-//*************************************************************************
-
-//*************************************************************************
-// Globals
-//*************************************************************************
-
-//*************************************************************************
-// Function Prototypes
-//*************************************************************************
-/* Function to reprioritize the threads in the array */
+// Function to reprioritize the threads in the array
void threadSwapcallback(void * arg);
-/* Function to initilize the threads and the thread schedule timer */
-//@pb009c - Changed to return void and handle error internally similar to other
-// calls from main thread
+// Function to initilize the threads and the thread schedule timer
void initThreadScheduler(void) INIT_SECTION;
-//@pb009a - Made function available to used by other components (used by main)
-/* Function to create and resume thread. Externalizing as it is used to
- * create main thread
- */
+// Function to create and resume thread. Externalizing as it is used to
+// create main thread
int createAndResumeThreadHelper(SsxThread *io_thread,
SsxThreadRoutine i_thread_routine,
void *io_arg,
SsxAddress i_stack,
size_t i_stack_size,
THREAD_PRIORITY i_priority);
-
-//*************************************************************************
-// Functions
-//*************************************************************************
-
#endif //_THREADSCH_H
diff --git a/src/occ/thread/thread_service_codes.h b/src/occ/thread/thread_service_codes.h
index 1569fb7..b855b15 100755
--- a/src/occ/thread/thread_service_codes.h
+++ b/src/occ/thread/thread_service_codes.h
@@ -1,79 +1,48 @@
-/******************************************************************************
-// @file thread_service_codes.h
-// @brief Error codes for thread component.
-*
-* Note that the thread component will not actually generate errors
-* using the thread component. This is due to the fact that will
-* use trace so therefore we can induce non-ending recursion if trace
-* were to use ERRL.
-*
-* A trace failure is not a system critical failure which is why we
-* can get away with it not reporting errors.
-*
-*/
-/******************************************************************************
- *
- * @page ChangeLogs Change Logs
- * @section _thread_service_codes_h thread_service_codes.h
- * @verbatim
- *
- * Flag Def/Fea Userid Date Description
- * ------- ---------- -------- ---------- ----------------------------------
- * TEAM 06/16/2010 Port
- * @rc003 rickylie 02/03/2012 Verify & Clean Up OCC Headers & Comments
- * @pb00E pbavari 03/11/2012 Added correct include file
- * @jh005 894560 joshych 08/14/2013 Create call home data logs every 24 hours
- * @gs020 909320 gjsilva 12/12/2013 Support for VR_FAN thermal control
- * @gs021 909855 gjsilva 12/18/2013 Support for processor OT condition
- * @at023 910877 alvinwan 01/09/2014 Excessive fan increase requests error for mfg
- * @fk006 914801 fmkassem 02/05/2014 Remove reason code list and merge with occ_service_codes list
- *
- * @endverbatim
- *
- *///*************************************************************************/
-
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/occ/thread/thread_service_codes.h $ */
+/* */
+/* OpenPOWER OnChipController Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2011,2014 */
+/* [+] Google Inc. */
+/* [+] 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 */
+
+// NOTE: The thread component will not actually generate errors
+// using the thread component. This is due to the fact that will
+// use trace so therefore we can induce non-ending recursion if trace
+// were to use ERRL.
+
+// A trace failure is not a system critical failure which is why we
+// can get away with it not reporting errors.
+
#ifndef _THREAD_SERVICE_CODES_H_
#define _THREAD_SERVICE_CODES_H_
-//*************************************************************************
-// Includes
-//*************************************************************************
#include <comp_ids.h>
-//*************************************************************************
-// Externs
-//*************************************************************************
-
-//*************************************************************************
-// Macros
-//*************************************************************************
-
-//*************************************************************************
-// Defines/Enums
-//*************************************************************************
enum thrdModuleId
{
THRD_MID_INIT_THREAD_SCHDLR = THRD_COMP_ID | 0x00,
THRD_MID_THREAD_SWAP_CALLBACK = THRD_COMP_ID | 0x01,
THRD_MID_GEN_CALLHOME_LOG = THRD_COMP_ID | 0x02,
THRD_THERMAL_VRM_FAN_CONTROL = THRD_COMP_ID | 0x03,
- THRD_THERMAL_MAIN = THRD_COMP_ID | 0x04, // @at023a
+ THRD_THERMAL_MAIN = THRD_COMP_ID | 0x04,
};
-//*************************************************************************
-// Structures
-//*************************************************************************
-
-//*************************************************************************
-// Globals
-//*************************************************************************
-
-//*************************************************************************
-// Function Prototypes
-//*************************************************************************
-
-//*************************************************************************
-// Functions
-//*************************************************************************
-
#endif /* #ifndef _THREAD_SERVICE_CODES_H_ */
diff --git a/src/occ/thread/thrm_thread.c b/src/occ/thread/thrm_thread.c
index 5db89f9..408672d 100755
--- a/src/occ/thread/thrm_thread.c
+++ b/src/occ/thread/thrm_thread.c
@@ -1,49 +1,35 @@
-/******************************************************************************
-// @file thrm_thread.c
-// @brief OCC thermal thread firmware.
-*/
-/******************************************************************************
- *
- * @page ChangeLogs Change Logs
- * @section _thrm_thread_c thrm_thread.c
- * @verbatim
- *
- * Flag Def/Fea Userid Date Description
- * ------- ---------- -------- ---------- ----------------------------------
- * @gs019 gjsilva 11/21/2013 Created
- * @gs020 909320 gjsilva 12/12/2013 Support for VR_FAN thermal control
- * @gm017 909636 milesg 12/17/2013 Memory fan control
- * @gs021 909855 gjsilva 12/18/2013 Support for processor OT condition
- * @at023 910877 alvinwan 01/09/2014 Excessive fan increase requests error for mfg
- * @gs025 913663 gjsilva 01/30/2014 Full fupport for soft frequency boundaries
- * @gm026 916029 milesg 02/17/2014 revert back to auto2 mode without reading GPIO's
- *
- * @endverbatim
- *
- *///*************************************************************************/
-
-//*************************************************************************
-// Includes
-//*************************************************************************
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/occ/thread/thrm_thread.c $ */
+/* */
+/* OpenPOWER OnChipController Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2011,2014 */
+/* [+] Google Inc. */
+/* [+] 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> // @at023a
-
-//*************************************************************************
-// Externs
-//*************************************************************************
-
-//*************************************************************************
-// Defines/Enums
-//*************************************************************************
-
-//*************************************************************************
-// Globals
-//*************************************************************************
+#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)
@@ -61,22 +47,12 @@ 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 Declarations
-//*************************************************************************
-
-//*************************************************************************
-// Functions
-//*************************************************************************
-
// Function Specification
//
// Name: THRM_thread_update_thresholds
//
// Description: Notify thermal thread to update its local copy of the
-// thermal threshold data packet.
-//
-// Flow: xx/xx/xx FN=
+// thermal threshold data packet.
//
// End Function Specification
void THRM_thread_update_thresholds()
@@ -91,8 +67,6 @@ void THRM_thread_update_thresholds()
// Description: Get the status of the cooling request from the thermal
// thread.
//
-// Flow: xx/xx/xx FN=
-//
// End Function Specification
uint8_t THRM_thread_get_cooling_request()
{
@@ -106,22 +80,13 @@ uint8_t THRM_thread_get_cooling_request()
// Description: Read thermal thresholds sent by TMGT (data format 0x13)
// and store them for thermal thread consumption.
//
-// Flow: xx/xx/xx FN=
-//
// End Function Specification
errlHndl_t thrm_thread_load_thresholds()
{
- /*------------------------------------------------------------------------*/
- /* Local Variables */
- /*------------------------------------------------------------------------*/
errlHndl_t l_err = NULL;
cmdh_thrm_thresholds_t *l_data = NULL;
uint8_t i = 0;
- /*------------------------------------------------------------------------*/
- /* Code */
- /*------------------------------------------------------------------------*/
-
do
{
// Get thermal threshold data sent by TMGT
@@ -160,7 +125,7 @@ errlHndl_t thrm_thread_load_thresholds()
// Load data that depends on the system mode
// Acoustic mode takes priority
- if (0) // FIXME: Need to implement acoustic mode
+ 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;
@@ -182,14 +147,6 @@ errlHndl_t thrm_thread_load_thresholds()
G_thrm_fru_control[i].t_control,
G_thrm_fru_control[i].error,
i);
-
- // For debug only...
- //TRAC_INFO("DBUG: Zone1[%u] Zone2[%u] Zone3[%u] Zone4[%u] Zone5[%u]",
- // G_thrm_fru_control[i].t_inc_zone[0],
- // G_thrm_fru_control[i].t_inc_zone[1],
- // G_thrm_fru_control[i].t_inc_zone[2],
- // G_thrm_fru_control[i].t_inc_zone[3],
- // G_thrm_fru_control[i].t_inc_zone[4]);
}
}while(0);
@@ -206,25 +163,16 @@ errlHndl_t thrm_thread_load_thresholds()
// Returns TRUE or FALSE depending whether we need to increase fan speeds
// or not.
//
-// Flow: xx/xx/xx FN=
-//
// End Function Specification
BOOLEAN thrm_thread_fan_control(const uint8_t i_fru_type,
const uint16_t i_fru_temperature)
{
- /*------------------------------------------------------------------------*/
- /* Local Variables */
- /*------------------------------------------------------------------------*/
eConfigDataFruType k = i_fru_type;
BOOLEAN l_IncreaseFans = FALSE;
uint8_t i = 0;
uint16_t l_delta_temp = 0;
- /*------------------------------------------------------------------------*/
- /* Code */
- /*------------------------------------------------------------------------*/
-
- //If there's a read error, assume temperature is t_control + 1 -- gm017
+ //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;
@@ -272,7 +220,7 @@ BOOLEAN thrm_thread_fan_control(const uint8_t i_fru_type,
if (l_IncreaseFans == TRUE)
{
- for (i = 0; i < THRM_MAX_NUM_ZONES; i++)
+ 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];
@@ -280,7 +228,7 @@ BOOLEAN thrm_thread_fan_control(const uint8_t i_fru_type,
}
else
{
- for (i = 0; i < THRM_MAX_NUM_ZONES; i++)
+ for (i = 0; i < THRM_MAX_NUM_ZONES; i++)
{
G_thrm_fru_data[k].FanIncZone[i] = 0;
}
@@ -301,32 +249,23 @@ BOOLEAN thrm_thread_fan_control(const uint8_t i_fru_type,
// VR_FAN signal. Returns TRUE or FALSE depending whether we need to increase
// fan speeds or not.
//
-// Flow: xx/xx/xx FN=
-//
// End Function Specification
BOOLEAN thrm_thread_vrm_fan_control(const uint16_t i_vrfan)
{
- /*------------------------------------------------------------------------*/
- /* Local Variables */
- /*------------------------------------------------------------------------*/
BOOLEAN l_IncreaseFans = FALSE;
static BOOLEAN L_error_logged = FALSE;
uint8_t i = 0;
errlHndl_t l_err = NULL;
- /*------------------------------------------------------------------------*/
- /* Code */
- /*------------------------------------------------------------------------*/
-
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++)
+ for (i = 0; i < THRM_MAX_NUM_ZONES; i++)
{
- G_thrm_fru_data[DATA_FRU_VRM].FanIncZone[i] =
+ G_thrm_fru_data[DATA_FRU_VRM].FanIncZone[i] =
G_thrm_fru_control[DATA_FRU_VRM].t_inc_zone[i];
}
@@ -343,12 +282,12 @@ BOOLEAN thrm_thread_vrm_fan_control(const uint16_t i_vrfan)
/* @
* @errortype
* @moduleid THRD_THERMAL_VRM_FAN_CONTROL
- * @reasoncode VRM_VRFAN_ASSERTED
+ * @reasoncode VRM_VRFAN_ASSERTED
* @userdata1 state of VR_FAN signal
* @userdata2 0
- * @userdata4 OCC_NO_EXTENDED_RC
+ * @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
@@ -372,7 +311,7 @@ BOOLEAN thrm_thread_vrm_fan_control(const uint16_t i_vrfan)
// If VR_FAN is de-asserted, don't send any cooling requests
l_IncreaseFans = FALSE;
- for (i = 0; i < THRM_MAX_NUM_ZONES; i++)
+ for (i = 0; i < THRM_MAX_NUM_ZONES; i++)
{
G_thrm_fru_data[DATA_FRU_VRM].FanIncZone[i] = 0;
}
@@ -386,26 +325,15 @@ BOOLEAN thrm_thread_vrm_fan_control(const uint16_t i_vrfan)
// Name: thrm_thread_main
//
// Description: Main thermal thread routine
-//
-//
-// Flow: OCC Fan Control Loop (TMGT to OCC Interface Architecture, Version 2.0,
-// Section 4.2)
//
// End Function Specification
void thrm_thread_main()
{
- /*------------------------------------------------------------------------*/
- /* Local Variables */
- /*------------------------------------------------------------------------*/
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; // @at023a
-
- /*------------------------------------------------------------------------*/
- /* Code */
- /*------------------------------------------------------------------------*/
+ 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
@@ -446,7 +374,7 @@ void thrm_thread_main()
}
// Is it time to execute the fan control loop?
- if (L_counter == G_thrm_loop_time)
+ if (L_counter == G_thrm_loop_time)
{
// Reset our counter
L_counter = 0;
@@ -461,22 +389,16 @@ void thrm_thread_main()
l_IncreaseFans |= thrm_thread_fan_control(DATA_FRU_PROC,
l_sensor->sample);
- // Determine if additional cooling is required for centaurs -- gm017
+ // 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 -- gm017
+ // Determine if additional cooling is required for dimms
l_sensor = getSensorByGsid(TEMP2MSDIMM);
l_IncreaseFans |= thrm_thread_fan_control(DATA_FRU_DIMM,
l_sensor->sample);
- //For debug only...
- //TRAC_INFO("DBUG: Cooling requests Zone1[%u] Zone2[%u] Zone3[%u]",
- // G_thrm_fru_data[0].FanIncZone[0],
- // G_thrm_fru_data[0].FanIncZone[1],
- // G_thrm_fru_data[0].FanIncZone[2]);
-
// Do we need to request a fan increase?
if (l_IncreaseFans == TRUE)
{
@@ -487,19 +409,18 @@ void thrm_thread_main()
// command
cmdh_fsp_attention(OCC_ALERT_FSP_SERVICE_REQD);
- // @at023a - start
// 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 -- gm026
- uint8_t l_full_speed = 1; //low active
- //uint8_t l_full_speed_pin = G_sysConfigData.apss_gpio_map.fans_full_speed; //gm026
+ // ** 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) ) //gm026
+ 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 IPLL
+ 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");
/* @
@@ -512,7 +433,7 @@ void thrm_thread_main()
* @devdesc Request a fan increase and fan is already in full speed
*
*/
- l_err = createErrl(THRD_THERMAL_MAIN, //modId
+ l_err = createErrl(THRD_THERMAL_MAIN, //modId
FAN_FULL_SPEED, //reasoncode
OCC_NO_EXTENDED_RC, //Extended reason code
ERRL_SEV_INFORMATIONAL, //Severity
@@ -526,7 +447,7 @@ void thrm_thread_main()
commitErrl(&l_err);
}
}
- // @at023a - end
+ //
}
else
{
diff --git a/src/occ/thread/thrm_thread.h b/src/occ/thread/thrm_thread.h
index 55eff7f..da44abd 100755
--- a/src/occ/thread/thrm_thread.h
+++ b/src/occ/thread/thrm_thread.h
@@ -1,37 +1,33 @@
-/**
- * @file thrm_thread.h
- * @brief Header file for thermal thread.
- *
- *
-*/
-/**
- * @page ChangeLogs Change Logs
- * @section _thrm_thread_h thrm_thread.h
- * @verbatim
- *
- * Flag Def/Fea Userid Date Description
- * ------- ---------- -------- --------- ----------------------------------
- * @gs019 gjsilva 11/21/2013 Created
- * @gs020 909320 gjsilva 12/12/2013 Support for VR_FAN thermal control
- *
- * @endverbatim
- */
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/occ/thread/thrm_thread.h $ */
+/* */
+/* OpenPOWER OnChipController Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2011,2014 */
+/* [+] Google Inc. */
+/* [+] 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
-//*************************************************************************
-// Includes
-//*************************************************************************
-
-//*************************************************************************
-// Defines/Enums
-//*************************************************************************
#define THRM_MAX_NUM_ZONES 8
-//*************************************************************************
-// Structures
-//*************************************************************************
-
typedef struct thrm_fru_control
{
uint8_t t_control;
@@ -55,10 +51,6 @@ typedef struct thrm_fru_data
BOOLEAN temp_increasing;
}thrm_fru_data_t;
-/*******************************************************************/
-/* Function Definitions */
-/*******************************************************************/
-
errlHndl_t thrm_thread_load_thresholds();
void THRM_thread_update_thresholds();
uint8_t THRM_thread_get_cooling_request();
OpenPOWER on IntegriCloud