summaryrefslogtreecommitdiffstats
path: root/src/occ_405/amec/amec_slave_smh.c
blob: 5293f2f60c808bc05b04fd9e38705a7fd5ae0c14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/occ_405/amec/amec_slave_smh.c $                           */
/*                                                                        */
/* OpenPOWER OnChipController Project                                     */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2011,2019                        */
/* [+] 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                                                     */

//*************************************************************************/
// Includes
//*************************************************************************/
#include <occ_common.h>
#include <ssx.h>
#include <errl.h>               // Error logging
#include "sensor.h"
#include "rtls.h"
#include "occ_sys_config.h"
#include "occ_service_codes.h"  // for SSX_GENERIC_FAILURE
#include "dcom.h"
#include "proc_data.h"
#include "proc_data_control.h"
#include "amec_smh.h"
#include "amec_slave_smh.h"
#include <trac.h>
#include "amec_sys.h"
#include "sensor_enum.h"
#include "amec_service_codes.h"
#include <amec_sensors_core.h>
#include <amec_sensors_power.h>
#include <memory.h>
#include <amec_sensors_centaur.h>
#include <amec_sensors_ocmb.h>
#include <amec_sensors_fw.h>
#include <amec_freq.h>
#include <amec_data.h>
#include <centaur_data.h>
#include <amec_amester.h>
#include <amec_oversub.h>
#include <amec_health.h>
#include <common.h>
#include <occhw_async.h>
#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_*()
#include <sensor_inband_cmd.h>          // For inband_command_*()

//*************************************************************************/
// Externs
//*************************************************************************/
extern dcom_slv_inbox_t G_dcom_slv_inbox_rx;
extern opal_proc_voting_reason_t G_amec_opal_proc_throt_reason;
extern uint16_t G_proc_fmax_mhz;
extern GpeRequest G_wof_vfrt_req;
extern bool G_pgpe_shared_sram_V_I_readings;

//*************************************************************************
// Macros
//*************************************************************************/

//*************************************************************************/
// Defines/Enums
//*************************************************************************/
smh_state_t G_amec_slv_state = {AMEC_INITIAL_STATE,
                                AMEC_INITIAL_STATE,
                                AMEC_INITIAL_STATE};

// This table presents the core data sensors collection pattern.
// This pattern is not completely rbitrary, and it must always
// follow track the GPE request pattern for the data collection.
// The choice made here is for 3 cores data collection every 2 tick,
// with a maximum latency of 2 ticks (counting the dispatch tick).
#define CORES_PER_STATE 3

const uint8_t G_sensor_update_pattern[AMEC_SMH_STATES_PER_LVL][CORES_PER_STATE] =
{
    { 23,  0, 12 },    // Group 0
    {  1,  2, 13 },    // Group 1
    { 14,  3, 15 },    // Group 2
    {  4,  5, 16 },    // Group 3
    { 17,  6, 18 },    // Group 4
    {  7,  8, 19 },    // Group 5
    { 20,  9, 21 },    // Group 6
    { 10, 11, 22 }     // Group 7
};

// --------------------------------------------------------
// AMEC Slave State 1 Substate Table
// --------------------------------------------------------
// Each substate runs every 64th tick time = 64 * MICS_PER_TICK
//
// No Substates
//
const smh_tbl_t amec_slv_state_1_substate_table[AMEC_SMH_STATES_PER_LVL] =
{
  {amec_slv_substate_1_0, NULL},
  {amec_slv_substate_1_1, NULL},
  {amec_slv_substate_1_2, NULL},
  {amec_slv_substate_1_3, NULL},
  {amec_slv_substate_1_4, NULL},
  {amec_slv_substate_1_5, NULL},
  {amec_slv_substate_1_6, NULL},
  {amec_slv_substate_1_7, NULL},
};

// --------------------------------------------------------
// AMEC Slave State 2 Substate Table
// --------------------------------------------------------
// Each substate runs every 64th tick time = 64 * MICS_PER_TICK
//
// No Substates
//
const smh_tbl_t amec_slv_state_2_substate_table[AMEC_SMH_STATES_PER_LVL] =
{
  {amec_slv_substate_2_even, NULL}, // Substate 2.0
  {NULL,                     NULL}, // Substate 2.1 (not used)
  {amec_slv_substate_2_even, NULL}, // Substate 2.2
  {NULL,                     NULL}, // Substate 2.3 (not used)
  {amec_slv_substate_2_even, NULL}, // Substate 2.4
  {NULL,                     NULL}, // Substate 2.5 (not used)
  {amec_slv_substate_2_even, NULL}, // Substate 2.6
  {NULL,                     NULL}, // Substate 2.7 (not used)
};

// --------------------------------------------------------
// AMEC Slave State 3 Substate Table
// --------------------------------------------------------
// Each substate runs every 64th tick time = 64 * MICS_PER_TICK
//
// No Substates
//
const smh_tbl_t amec_slv_state_3_substate_table[AMEC_SMH_STATES_PER_LVL] =
{
  {amec_slv_substate_3_0, NULL},
  {amec_slv_substate_3_1, NULL},
  {amec_slv_substate_3_2, NULL},
  {amec_slv_substate_3_3, NULL},
  {amec_slv_substate_3_4, NULL},
  {amec_slv_substate_3_5, NULL},
  {amec_slv_substate_3_6, NULL},
  {amec_slv_substate_3_7, NULL},
};

// --------------------------------------------------------
// AMEC Slave State 5 Substate Table
// --------------------------------------------------------
// Each substate runs every 64th tick time = 64 * MICS_PER_TICK
//
// No Substates
//
const smh_tbl_t amec_slv_state_5_substate_table[AMEC_SMH_STATES_PER_LVL] =
{
  {amec_slv_substate_5_0, NULL},
  {amec_slv_substate_5_1, NULL},
  {amec_slv_substate_5_2, NULL},
  {amec_slv_substate_5_3, NULL},
  {amec_slv_substate_5_4, NULL},
  {amec_slv_substate_5_5, NULL},
  {amec_slv_substate_5_6, NULL},
  {amec_slv_substate_5_7, NULL},
};

// --------------------------------------------------------
// AMEC Slave State 6 Substate Table
// --------------------------------------------------------
// Each substate runs every 64th tick time = 64 * MICS_PER_TICK
//
// No Substates
//
const smh_tbl_t amec_slv_state_6_substate_table[AMEC_SMH_STATES_PER_LVL] =
{
  {amec_slv_substate_6_all, NULL},  // Substate 6.0
  {amec_slv_substate_6_all, NULL},  // Substate 6.1
  {amec_slv_substate_6_all, NULL},  // Substate 6.2
  {amec_slv_substate_6_all, NULL},  // Substate 6.3
  {amec_slv_substate_6_all, NULL},  // Substate 6.4
  {amec_slv_substate_6_all, NULL},  // Substate 6.5
  {amec_slv_substate_6_all, NULL},  // Substate 6.6
  {amec_slv_substate_6_all, NULL},  // Substate 6.7
};

// --------------------------------------------------------
// AMEC Slave State 7 Substate Table
// --------------------------------------------------------
// Each substate runs every 64th tick time = 64 * MICS_PER_TICK
//
// No Substates
//
const smh_tbl_t amec_slv_state_7_substate_table[AMEC_SMH_STATES_PER_LVL] =
{
  {amec_slv_substate_7_0, NULL},
  {amec_slv_substate_7_1, NULL},
  {amec_slv_substate_7_2, NULL},
  {amec_slv_substate_7_3, NULL},
  {amec_slv_substate_7_4, NULL},
  {amec_slv_substate_7_5, NULL},
  {amec_slv_substate_7_6, NULL},
  {amec_slv_substate_7_7, NULL},
};


// --------------------------------------------------------
// Main AMEC Slave State Table
// --------------------------------------------------------
// Each function inside this state table runs once every 8th tick
//
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, 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},
  {amec_slv_state_6, amec_slv_state_6_substate_table},
  {amec_slv_state_7, amec_slv_state_7_substate_table},
};


// This sets up the function pointer that will be called to update the
// fw timings when the AMEC Slave State Machine finishes.
smh_state_timing_t G_amec_slv_state_timings = {amec_slv_update_smh_sensors};

//*************************************************************************/
// Structures
//*************************************************************************/

//*************************************************************************/
// Globals
//*************************************************************************/
extern bool G_gpu_config_done;

//*************************************************************************/
// Function Prototypes
//*************************************************************************/

//*************************************************************************/
// Functions
//*************************************************************************/


// Function Specification
//
// Name: amec_slv_check_apss_fail
//
// Description: This function checks if there are APSS failures and takes
// action accordingly. If there are APSS failures, it will lower the Pmax_rail
// to nominal. Else, if will release the Pmax_rail.
//
// End Function Specification
void amec_slv_check_apss_fail(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/
    uint32_t    l_pmax_rail_freq = g_amec->proc[0].pwr_votes.apss_pmax_clip_freq;
    static bool L_lower_pmax_rail = FALSE;
    static bool L_raise_pmax_rail = TRUE;

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/

    do
    {
        // Don't do this during a state transition
        if( SMGR_is_state_transitioning() )
        {
            break;
        }

        if (G_apss_lower_pmax_rail == TRUE)
        {
            if (L_lower_pmax_rail == FALSE)
            {
                // Lower the Pmax_rail to nominal
                l_pmax_rail_freq = G_sysConfigData.sys_mode_freq.table[OCC_MODE_NOMINAL];

                // Let the slave voting box handle the clip
                // to take in account all reasons for clip changes
                TRAC_INFO("amec_slv_check_apss_fail: Updating apss pmax clip freq to nominal");

                L_lower_pmax_rail = TRUE;
                L_raise_pmax_rail = FALSE;
            }
        }
        else
        {
            if (L_raise_pmax_rail == FALSE)
            {
                // Raise the Pmax rail back
                l_pmax_rail_freq = G_proc_fmax_mhz;

                // Let the slave voting box handle the clip
                // to take in account all reasons for clip changes
                TRAC_INFO("amec_slv_check_apss_fail: Updating apss pmax clip freq to fmax");

                L_lower_pmax_rail = FALSE;
                L_raise_pmax_rail = TRUE;
            }
        }

        // Store the frequency vote for the voting box
        g_amec->proc[0].pwr_votes.apss_pmax_clip_freq = l_pmax_rail_freq;

    } while(0);
}


// 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
//              This function will run every tick.
//
// Thread: RealTime Loop
//
// End Function Specification
void amec_slv_common_tasks_pre(void)
{
    AMEC_DBG("\tAMEC Slave Pre-State Common\n");

    // Update the FW Worst Case sensors every tick
    amec_update_fw_sensors();

    // Update the sensors that come from the APSS every tick
    // If sensors were not updated due to EPOW event, skip remaining tasks
    if (amec_update_apss_sensors())
    {
        // Read the AVS Bus sensors (Vdd / Vdn)
        amec_update_avsbus_sensors();

        // Over-subscription check
        amec_oversub_check();
    }
}

// Function Specification
//
// Name: amec_slv_common_tasks_post
//
// Description: Runs all the functions that need to run post-AMEC-State-Machine
//              This function will run every tick.
//
// Thread: RealTime Loop
//
// End Function Specification
void amec_slv_common_tasks_post(void)
{
  static bool L_active_1tick = FALSE;

  AMEC_DBG("\tAMEC Slave Post-State Common\n");

  // Only execute if OCC is in the active state
  if ( IS_OCC_STATE_ACTIVE() )
  {
      // wait 1 tick after going active to allow pwr sensors to be updated
      if(L_active_1tick)
      {
        // Check if we need to change Pmax_clip register setting due to not
        // getting any APSS data from Master
        amec_slv_check_apss_fail();

        // Call amec_power_control
        amec_power_control();

        if (MEM_TYPE_NIMBUS == G_sysConfigData.mem_type)
        {
            // Nimbus only
            // Apply memory power control, if needed.
            amec_mem_power_control();
        }

        // Call the OCC slave's processor voting box
        amec_slv_proc_voting_box();

        // Call the frequency state machine
        amec_slv_freq_smh();

        // Call the OCC slave's memory voting box
        amec_slv_mem_voting_box();

        // Call the OCC slave's performance check
        amec_slv_check_perf();

        //-------------------------------------------------------
        // Run WOF Algorithm if we are getting readings from PGPE
        // Else WOF will run in slave state 4
        //-------------------------------------------------------
        if(G_pgpe_shared_sram_V_I_readings)
        {
            call_wof_main();
        }

        // Check to see if a VFRT IPC request needs to be sent to the PGPE
        schedule_vfrt_request();

        // Call the every tick trace recording if it has been configured via Amester.
        // If not configured, this call will return immediately.
        amec_tb_record(AMEC_TB_EVERY_TICK);
      }
      else
      {
         L_active_1tick = TRUE;
      }

  }
  // if an OPAL system & just transitioned to CHAR or OBS state, set proc mnfg override
  else if ( (IS_OCC_STATE_CHARACTERIZATION() || IS_OCC_STATE_OBSERVATION()) &&
            (MANUFACTURING_OVERRIDE != G_amec_opal_proc_throt_reason)       &&
            (G_sysConfigData.system_type.kvm == true) )
  {
      G_amec_opal_proc_throt_reason = MANUFACTURING_OVERRIDE;
      ssx_semaphore_post(&G_dcomThreadWakeupSem);
  }
  // Check if an inband command is being processed
  if(G_inband_occ_cmd_state != INBAND_OCC_CMD_NONE)
  {
      // call inband command handler if in active, char or obs state
      if ( IS_OCC_STATE_ACTIVE() || IS_OCC_STATE_OBSERVATION() ||
           IS_OCC_STATE_CHARACTERIZATION() )
      {
         inband_command_handler();
      }
  }
}

// Function Specification
//
// Name: amec_slv_state_0
//
// Description: AMEC Slave State Machine State
//
// End Function Specification
void amec_slv_state_0(void)
{
  AMEC_DBG("\tAMEC Slave State 0\n");

  //-------------------------------------------------------
  // Update Centaur sensors (for this tick)
  //-------------------------------------------------------
  if(MEM_TYPE_CUMULUS == G_sysConfigData.mem_type)
  {
      amec_update_centaur_sensors(CENTAUR_0);
  }
  else if(MEM_TYPE_OCM == G_sysConfigData.mem_type)
  {
      amec_update_ocmb_sensors(CENTAUR_0);
  }

  //-------------------------------------------------------
  // Update vector sensors
  //-------------------------------------------------------
  sensor_vector_update(AMECSENSOR_PTR(TEMPPROCAVG),  1);
  sensor_vector_update(AMECSENSOR_PTR(TEMPPROCTHRM), 1);
  sensor_vector_update(AMECSENSOR_PTR(FREQA),        1);
  sensor_vector_update(AMECSENSOR_PTR(IPS),     1);
  sensor_vector_update(AMECSENSOR_PTR(UTIL),         1);

  // Call the trace function for every 8th tick tracing if it has been configured via
  // Amester. If not configured, this call will return immediately.
  amec_tb_record(AMEC_TB_EVERY_8TH_TICK);
}


// Function Specification
//
// Name: amec_slv_state_1
//
// Description: AMEC Slave State Machine State
//
// Thread: RealTime Loop
//
// End Function Specification
void amec_slv_state_1(void)
{
    AMEC_DBG("\tAMEC Slave State 1\n");
    if(MEM_TYPE_CUMULUS == G_sysConfigData.mem_type)
    {
        //-------------------------------------------------------
        // Update Centaur sensors (for this tick)
        //-------------------------------------------------------
        amec_update_centaur_sensors(CENTAUR_1);

        //-------------------------------------------------------
        // Update Proc Level Centaur/DIMM Temperature sensors
        //-------------------------------------------------------
        amec_update_centaur_temp_sensors();
    }
    else if(MEM_TYPE_OCM == G_sysConfigData.mem_type)
    {
        amec_update_ocmb_sensors(CENTAUR_1);
        amec_update_ocmb_temp_sensors();
    }
}


// Function Specification
//
// Name: amec_slv_state_2
//
// Description: AMEC Slave State Machine State
//
// End Function Specification
void amec_slv_state_2(void)
{
  AMEC_DBG("\tAMEC Slave State 2\n");

  //-------------------------------------------------------
  // Update Centaur sensors (for this tick)
  //-------------------------------------------------------
  if(MEM_TYPE_CUMULUS == G_sysConfigData.mem_type)
  {
      amec_update_centaur_sensors(CENTAUR_2);
  }
  else if(MEM_TYPE_OCM == G_sysConfigData.mem_type)
  {
      amec_update_ocmb_sensors(CENTAUR_2);
  }

  // Call VRM Vdd thermal controller
  amec_controller_vrm_vdd_thermal();
}


// Function Specification
//
// Name: amec_slv_state_3
//
// Description: AMEC Slave State Machine State
//
// Thread: RealTime Loop
//
// End Function Specification
void amec_slv_state_3(void)
{
  AMEC_DBG("\tAMEC Slave State 3\n");

  //-------------------------------------------------------
  // Update Centaur sensors (for this tick)
  //-------------------------------------------------------
  if(MEM_TYPE_CUMULUS == G_sysConfigData.mem_type)
  {
      amec_update_centaur_sensors(CENTAUR_3);
  }
  else if(MEM_TYPE_OCM == G_sysConfigData.mem_type)
  {
      amec_update_ocmb_sensors(CENTAUR_3);
  }
}


// Function Specification
//
// Name: amec_slv_state_4
//
// Description: AMEC Slave State Machine State
//
// Thread: RealTime Loop
//
// End Function Specification
void amec_slv_state_4(void)
{
  AMEC_DBG("\tAMEC Slave State 4\n");

  //-------------------------------------------------------
  // Update Centaur sensors (for this tick)
  //-------------------------------------------------------
  if(MEM_TYPE_CUMULUS == G_sysConfigData.mem_type)
  {
      amec_update_centaur_sensors(CENTAUR_4);
  }
  else if(MEM_TYPE_OCM == G_sysConfigData.mem_type)
  {
      amec_update_ocmb_sensors(CENTAUR_4);
  }

  //-------------------------------------------------------
  // Run WOF Algorithm if we are NOT getting readings from PGPE
  // Else WOF will run every tick with new PGPE readings
  //-------------------------------------------------------
  if(!G_pgpe_shared_sram_V_I_readings)
  {
      call_wof_main();
  }

}


// Function Specification
//
// Name: amec_slv_state_5
//
// Description: AMEC Slave State Machine State
//
// Thread: RealTime Loop
//
// End Function Specification
void amec_slv_state_5(void)
{
  AMEC_DBG("\tAMEC Slave State 5\n");

  //-------------------------------------------------------
  // Update Centaur sensors (for this tick)
  //-------------------------------------------------------
  if(MEM_TYPE_CUMULUS == G_sysConfigData.mem_type)
  {
      amec_update_centaur_sensors(CENTAUR_5);
  }
  else if(MEM_TYPE_OCM == G_sysConfigData.mem_type)
  {
      amec_update_ocmb_sensors(CENTAUR_5);
  }

  //-------------------------------------------------------
  // Update partition sensors for DPS algorithms (for this tick)
  //-------------------------------------------------------
  amec_dps_main();

}


// Function Specification
//
// Name: amec_slv_state_6
//
// Description: AMEC Slave State Machine State
//
// Thread: RealTime Loop
//
// End Function Specification
void amec_slv_state_6(void)
{
  AMEC_DBG("\tAMEC Slave State 6\n");

  //-------------------------------------------------------
  // Update Centaur sensors (for this tick)
  //-------------------------------------------------------
  if(MEM_TYPE_CUMULUS == G_sysConfigData.mem_type)
  {
      amec_update_centaur_sensors(CENTAUR_6);
  }
  else if(MEM_TYPE_OCM == G_sysConfigData.mem_type)
  {
      amec_update_ocmb_sensors(CENTAUR_6);
  }
}


// Function Specification
//
// Name: amec_slv_state_7
//
// Description: AMEC Slave State Machine State
//
// End Function Specification
void amec_slv_state_7(void)
{
  AMEC_DBG("\tAMEC Slave State 7\n");

  //-------------------------------------------------------
  // Update Centaur sensors (for this tick)
  //-------------------------------------------------------
  if(MEM_TYPE_CUMULUS == G_sysConfigData.mem_type)
  {
      amec_update_centaur_sensors(CENTAUR_7);
  }
  else if(MEM_TYPE_OCM == G_sysConfigData.mem_type)
  {
      amec_update_ocmb_sensors(CENTAUR_7);
  }
}

// Function Specification
//
// Name: amec_slv_substate_1_0
//       amec_slv_substate_1_1
//       amec_slv_substate_1_2
//       amec_slv_substate_1_3
//       amec_slv_substate_1_4
//       amec_slv_substate_1_5
//       amec_slv_substate_1_6
//       amec_slv_substate_1_7
//
// Description: slave substate amec_slv_substate_1_0
//              slave substate amec_slv_substate_1_1
//              slave substate amec_slv_substate_1_2
//              slave substate amec_slv_substate_1_3
//              slave substate amec_slv_substate_1_4
//              slave substate amec_slv_substate_1_5
//              slave substate amec_slv_substate_1_6
//              slave substate amec_slv_substate_1_7
//
// End Function Specification
void amec_slv_substate_1_0(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 1.0: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[0][0],
             G_sensor_update_pattern[0][1],
             G_sensor_update_pattern[0][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(0);
}

void amec_slv_substate_1_1(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 1.1: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[4][0],
             G_sensor_update_pattern[4][1],
             G_sensor_update_pattern[4][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(4);
}


void amec_slv_substate_1_2(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 1.2: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[0][0],
             G_sensor_update_pattern[0][1],
             G_sensor_update_pattern[0][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(0);
}

void amec_slv_substate_1_3(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 1.3: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[4][0],
             G_sensor_update_pattern[4][1],
             G_sensor_update_pattern[4][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(4);
}


void amec_slv_substate_1_4(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 1.4: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[0][0],
             G_sensor_update_pattern[0][1],
             G_sensor_update_pattern[0][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(0);
}

void amec_slv_substate_1_5(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 1.5: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[4][0],
             G_sensor_update_pattern[4][1],
             G_sensor_update_pattern[4][2]);


    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(4);
}


void amec_slv_substate_1_6(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 1.6: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[0][0],
             G_sensor_update_pattern[0][1],
             G_sensor_update_pattern[0][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(0);
}

void amec_slv_substate_1_7(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 1.7: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[4][0],
             G_sensor_update_pattern[4][1],
             G_sensor_update_pattern[4][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(4);
}


// Function Specification
//
// Name: amec_slv_substate_2_even
//
// Description: even numbered slave substates
//              gives state 2 substate function to be called every 16th tick
//              Time = 16 * MICS_PER_TICK
//              odd substates of state 2 are not currently used
//
// End Function Specification
void amec_slv_substate_2_even(void)
{
    AMEC_DBG("\tAMEC Slave State 2 even substate\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
//       amec_slv_substate_3_3
//       amec_slv_substate_3_4
//       amec_slv_substate_3_5
//       amec_slv_substate_3_6
//       amec_slv_substate_3_7
//
// Description: slave substate amec_slv_substate_3_0
//              slave substate amec_slv_substate_3_1
//              slave substate amec_slv_substate_3_2
//              slave substate amec_slv_substate_3_3
//              slave substate amec_slv_substate_3_4
//              slave substate amec_slv_substate_3_5
//              slave substate amec_slv_substate_3_6
//              slave substate amec_slv_substate_3_7
//
// End Function Specification
void amec_slv_substate_3_0(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 3.0: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[1][0],
             G_sensor_update_pattern[1][1],
             G_sensor_update_pattern[1][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(1);
}

void amec_slv_substate_3_1(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 3.1: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[5][0],
             G_sensor_update_pattern[5][1],
             G_sensor_update_pattern[5][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(5);
}

void amec_slv_substate_3_2(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 3.2: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[1][0],
             G_sensor_update_pattern[1][1],
             G_sensor_update_pattern[1][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(1);
}

void amec_slv_substate_3_3(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 3.3: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[5][0],
             G_sensor_update_pattern[5][1],
             G_sensor_update_pattern[5][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(5);
}

void amec_slv_substate_3_4(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 3.4: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[1][0],
             G_sensor_update_pattern[1][1],
             G_sensor_update_pattern[1][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(1);
}

void amec_slv_substate_3_5(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 3.5: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[5][0],
             G_sensor_update_pattern[5][1],
             G_sensor_update_pattern[5][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(5);
}

void amec_slv_substate_3_6(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 3.6: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[1][0],
             G_sensor_update_pattern[1][1],
             G_sensor_update_pattern[1][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(1);
}


void amec_slv_substate_3_7(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 3.7: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[5][0],
             G_sensor_update_pattern[5][1],
             G_sensor_update_pattern[5][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(5);
}


// Function Specification
//
// Name: amec_slv_substate_5_0
//       amec_slv_substate_5_1
//       amec_slv_substate_5_2
//       amec_slv_substate_5_3
//       amec_slv_substate_5_4
//       amec_slv_substate_5_5
//       amec_slv_substate_5_6
//       amec_slv_substate_5_7
//
// Description: slave substate amec_slv_substate_5_0
//              slave substate amec_slv_substate_5_1
//              slave substate amec_slv_substate_5_2
//              slave substate amec_slv_substate_5_3
//              slave substate amec_slv_substate_5_4
//              slave substate amec_slv_substate_5_5
//              slave substate amec_slv_substate_5_6
//              slave substate amec_slv_substate_5_7
//
// End Function Specification
void amec_slv_substate_5_0(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 5.0: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[2][0],
             G_sensor_update_pattern[2][1],
             G_sensor_update_pattern[2][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(2);

    // Call processor-based thermal controller
    amec_controller_proc_thermal();
}

void amec_slv_substate_5_1(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 5.1: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[6][0],
             G_sensor_update_pattern[6][1],
             G_sensor_update_pattern[6][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(6);
}


void amec_slv_substate_5_2(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 5.2: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[2][0],
             G_sensor_update_pattern[2][1],
             G_sensor_update_pattern[2][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(2);
}

void amec_slv_substate_5_3(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 5.3: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[6][0],
             G_sensor_update_pattern[6][1],
             G_sensor_update_pattern[6][2]);


    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(6);
}


void amec_slv_substate_5_4(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 5.4: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[2][0],
             G_sensor_update_pattern[2][1],
             G_sensor_update_pattern[2][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(2);
}

void amec_slv_substate_5_5(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 5.5: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[6][0],
             G_sensor_update_pattern[6][1],
             G_sensor_update_pattern[6][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(6);
}


void amec_slv_substate_5_6(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 5.6: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[2][0],
             G_sensor_update_pattern[2][1],
             G_sensor_update_pattern[2][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(2);
}

void amec_slv_substate_5_7(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 5.7: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[6][0],
             G_sensor_update_pattern[6][1],
             G_sensor_update_pattern[6][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(6);
}

// Function Specification
//
// Name: amec_slv_substate_6_all
//
// Description: Called for every substate of state 6
//              gives state 6 substate function to be called every 8th tick
//              Time = 8 * MICS_PER_TICK
//
// End Function Specification
void amec_slv_substate_6_all(void)
{
    AMEC_DBG("\tAMEC Slave State 6 substate\n");
    inband_command_check();
}

// Function Specification
//
// Name: amec_slv_substate_7_0
//       amec_slv_substate_7_1
//       amec_slv_substate_7_2
//       amec_slv_substate_7_3
//       amec_slv_substate_7_4
//       amec_slv_substate_7_5
//       amec_slv_substate_7_6
//       amec_slv_substate_7_7
//
// Description: slave substate amec_slv_substate_7_0
//              slave substate amec_slv_substate_7_1
//              slave substate amec_slv_substate_7_2
//              slave substate amec_slv_substate_7_3
//              slave substate amec_slv_substate_7_4
//              slave substate amec_slv_substate_7_5
//              slave substate amec_slv_substate_7_6
//              slave substate amec_slv_substate_7_7
//
// End Function Specification
void amec_slv_substate_7_0(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 7.0: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[3][0],
             G_sensor_update_pattern[3][1],
             G_sensor_update_pattern[3][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(3);

    // Call memory thermal controller based on DIMM temperature
    amec_controller_dimm_thermal();

    if (MEM_TYPE_CUMULUS ==  G_sysConfigData.mem_type)
    {
        // Call memory thermal controller based on Centaur temperature
        amec_controller_centaur_thermal();
    }

}

void amec_slv_substate_7_1(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 7.1: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[7][0],
             G_sensor_update_pattern[7][1],
             G_sensor_update_pattern[7][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(7);
}

void amec_slv_substate_7_2(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 7.2: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[3][0],
             G_sensor_update_pattern[3][1],
             G_sensor_update_pattern[3][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(3);
}

void amec_slv_substate_7_3(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 7.3: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[7][0],
             G_sensor_update_pattern[7][1],
             G_sensor_update_pattern[7][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(7);
}

void amec_slv_substate_7_4(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 7.4: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[3][0],
             G_sensor_update_pattern[3][1],
             G_sensor_update_pattern[3][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(3);
}

void amec_slv_substate_7_5(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 7.5: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[7][0],
             G_sensor_update_pattern[7][1],
             G_sensor_update_pattern[7][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(7);
}

void amec_slv_substate_7_6(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 7.6: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[3][0],
             G_sensor_update_pattern[3][1],
             G_sensor_update_pattern[3][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(3);
}


void amec_slv_substate_7_7(void)
{
    /*------------------------------------------------------------------------*/
    /*  Local Variables                                                       */
    /*------------------------------------------------------------------------*/

    /*------------------------------------------------------------------------*/
    /*  Code                                                                  */
    /*------------------------------------------------------------------------*/
    AMEC_DBG("\tAMEC Slave State 7.7: Core Data[%d,      %d, %d]\n",
             G_sensor_update_pattern[7][0],
             G_sensor_update_pattern[7][1],
             G_sensor_update_pattern[7][2]);

    //-------------------------------------------------------
    // Update Proc Core sensors (for this substate)
    //-------------------------------------------------------
    amec_update_proc_core_group(7);

    // Call health monitor to check for processor error temperature conditions
    amec_health_check_proc_temp();
}

void amec_update_proc_core_group(uint8_t group)
{
    int i;
    for(i =0; i < CORES_PER_STATE; i++)
    {
        amec_update_proc_core_sensors(G_sensor_update_pattern[group][i]);
    }
}


/*----------------------------------------------------------------------------*/
/* End                                                                        */
/*----------------------------------------------------------------------------*/
OpenPOWER on IntegriCloud