summaryrefslogtreecommitdiffstats
path: root/src/occ_405/amec/amec_slave_smh.c
diff options
context:
space:
mode:
authorShawn McCarney <shawnmm@us.ibm.com>2017-05-15 09:11:32 -0500
committerMartha Broyles <mbroyles@us.ibm.com>2017-06-28 10:05:28 -0400
commit2f3dd9e14af82d8c7bcc0f154d6fc06fa96d279a (patch)
treeb74dddf3ee05db9af97a0e75c0027404421f9926 /src/occ_405/amec/amec_slave_smh.c
parent8a97adf89847fa21d4ed3117d2a4150baf527bfe (diff)
downloadtalos-occ-2f3dd9e14af82d8c7bcc0f154d6fc06fa96d279a.tar.gz
talos-occ-2f3dd9e14af82d8c7bcc0f154d6fc06fa96d279a.zip
OCC: Non-GPU Sensors to main memory: Phase 3
A subset of OCC sensors are now copied to main memory. Includes sensors using both the full and counter sensor readings structures. Also made the following changes to the sensor system: * Added timestamp field to sensor_t Change-Id: Ibd3044a1be09160c2d6bdb06ac3c291f874f714b RTC: 153674 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/42016 Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Christopher J. Cain <cjcain@us.ibm.com> Reviewed-by: Martha Broyles <mbroyles@us.ibm.com>
Diffstat (limited to 'src/occ_405/amec/amec_slave_smh.c')
-rwxr-xr-xsrc/occ_405/amec/amec_slave_smh.c93
1 files changed, 90 insertions, 3 deletions
diff --git a/src/occ_405/amec/amec_slave_smh.c b/src/occ_405/amec/amec_slave_smh.c
index 841c699..b37ab45 100755
--- a/src/occ_405/amec/amec_slave_smh.c
+++ b/src/occ_405/amec/amec_slave_smh.c
@@ -59,6 +59,9 @@
#include <wof.h>
#include <pgpe_interface.h>
#include <memory_power_control.h>
+#include <state.h> // For CURRENT_STATE(), OCC_STATE_*
+#include <cmdh_fsp_cmds_datacnfg.h> // For DATA_get_present_cnfgdata()
+#include <sensor_main_memory.h> // For main_mem_sensors_*()
//*************************************************************************/
// Externs
@@ -121,6 +124,25 @@ const smh_tbl_t amec_slv_state_1_substate_table[AMEC_SMH_STATES_PER_LVL] =
};
// --------------------------------------------------------
+// AMEC Slave State 2 Substate Table
+// --------------------------------------------------------
+// Each function inside this state table runs once every 16ms.
+//
+// No Substates
+//
+const smh_tbl_t amec_slv_state_2_substate_table[AMEC_SMH_STATES_PER_LVL] =
+{
+ {amec_slv_substate_2_0, NULL}, // Substate 2.0
+ {NULL, NULL}, // Substate 2.1 (not used)
+ {NULL, NULL}, // Substate 2.2 (not used)
+ {NULL, NULL}, // Substate 2.3 (not used)
+ {amec_slv_substate_2_4, NULL}, // Substate 2.4
+ {NULL, NULL}, // Substate 2.5 (not used)
+ {NULL, NULL}, // Substate 2.6 (not used)
+ {NULL, NULL}, // Substate 2.7 (not used)
+};
+
+// --------------------------------------------------------
// AMEC Slave State 3 Substate Table
// --------------------------------------------------------
// Each function inside this state table runs once every 16ms.
@@ -183,13 +205,11 @@ const smh_tbl_t amec_slv_state_7_substate_table[AMEC_SMH_STATES_PER_LVL] =
// --------------------------------------------------------
// Each function inside this state table runs once every 2ms.
//
-// No Substates
-//
const smh_tbl_t amec_slv_state_table[AMEC_SMH_STATES_PER_LVL] =
{
{amec_slv_state_0, NULL},
{amec_slv_state_1, amec_slv_state_1_substate_table},
- {amec_slv_state_2, NULL},
+ {amec_slv_state_2, amec_slv_state_2_substate_table},
{amec_slv_state_3, amec_slv_state_3_substate_table},
{amec_slv_state_4, NULL},
{amec_slv_state_5, amec_slv_state_5_substate_table},
@@ -291,6 +311,50 @@ void amec_slv_check_apss_fail(void)
// Function Specification
//
+// Name: amec_slv_update_main_mem_sensors
+//
+// Description: Initializes and updates the main memory sensors.
+//
+// End Function Specification
+void amec_slv_update_main_mem_sensors(void)
+{
+ // Don't initialize/update main memory sensors during a state transition
+ if (SMGR_is_state_transitioning())
+ {
+ return;
+ }
+
+ // If main memory sensors have not been initialized
+ if (!G_main_mem_sensors_initialized)
+ {
+ // Make sure OCC role has been set. Role required for initialization.
+ if (DATA_get_present_cnfgdata() & DATA_MASK_SET_ROLE)
+ {
+ // Initialize main memory sensors. Write static sensor data to main
+ // memory. Must call multiple times due to BCE copy size
+ // limitations. Sets G_main_mem_sensors_initialized to true when
+ // all initialization is done.
+ main_mem_sensors_init();
+ }
+ }
+ else
+ {
+ // Main memory sensors have been initialized. Check if the OCC is in
+ // the proper state to update the sensor readings in main memory.
+ if ((CURRENT_STATE() == OCC_STATE_OBSERVATION) ||
+ (CURRENT_STATE() == OCC_STATE_ACTIVE) ||
+ (CURRENT_STATE() == OCC_STATE_CHARACTERIZATION))
+ {
+ // Update main memory sensors. Write dynamic sensor readings data
+ // to main memory.
+ main_mem_sensors_update();
+ }
+ }
+}
+
+
+// Function Specification
+//
// Name: amec_slv_common_tasks_pre
//
// Description: Runs all the functions that need to run pre-AMEC-State-Machine
@@ -771,6 +835,29 @@ void amec_slv_substate_1_7(void)
// Function Specification
//
+// Name: amec_slv_substate_2_0
+// amec_slv_substate_2_4
+//
+// Description: slave substate amec_slv_substate_2_0
+// slave substate amec_slv_substate_2_4
+// other substates of state 2 are not currently used
+//
+// End Function Specification
+void amec_slv_substate_2_0(void)
+{
+ AMEC_DBG("\tAMEC Slave State 2.0\n");
+ amec_slv_update_main_mem_sensors();
+}
+
+void amec_slv_substate_2_4(void)
+{
+ AMEC_DBG("\tAMEC Slave State 2.4\n");
+ amec_slv_update_main_mem_sensors();
+}
+
+
+// Function Specification
+//
// Name: amec_slv_substate_3_0
// amec_slv_substate_3_1
// amec_slv_substate_3_2
OpenPOWER on IntegriCloud