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
|
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/occ_405/state.h $ */
/* */
/* OpenPOWER OnChipController Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2011,2016 */
/* [+] 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 _state_h
#define _state_h
#include <occ_common.h>
#include <common_types.h>
#include "rtls.h"
#include "errl.h"
#include "mode.h"
extern uint32_t G_smgr_validate_data_active_mask;
extern uint32_t G_smgr_validate_data_observation_mask;
enum eResetStates
{
RESET_NOT_REQUESTED = 0,
NOMINAL_REQUESTED_DUE_TO_ERROR,
RESET_REQUESTED_DUE_TO_ERROR,
};
/**
* @enum OCC_STATE
* @brief Typedef of the various states that TMGT can put OCC into.
*/
typedef enum
{
OCC_STATE_NOCHANGE = 0x00,
OCC_STATE_STANDBY = 0x01,
OCC_STATE_OBSERVATION = 0x02,
OCC_STATE_ACTIVE = 0x03,
OCC_STATE_SAFE = 0x04,
// Make sure this is after the last valid state
OCC_STATE_COUNT,
// These are used for state transition table, and are not
// a valid state in and of itself.
OCC_STATE_ALL = 0xFE,
OCC_STATE_INVALID = 0xFF,
} OCC_STATE;
// These are the only states that TMGT/HTMGT can send
#define OCC_STATE_IS_VALID(state) ((state == OCC_STATE_NOCHANGE) || \
(state == OCC_STATE_OBSERVATION) || \
(state == OCC_STATE_ACTIVE))
/**
* @brief TMGT Poll contains a byte that indicates status based on this
* bitmask
*/
#define SMGR_MASK_MASTER_OCC 0x80 ///This is the master OCC
#define SMGR_MASK_RESERVED_6 0x40 ///Reserved
#define SMGR_MASK_RESERVED_5 0x20 ///Reserved
#define SMGR_MASK_STATUS_REG_CHANGE 0x10 ///Change in status register
#define SMGR_MASK_ATTN_ENABLED 0x08 ///Attentions to FSP are enabled
#define SMGR_MASK_RESERVED_2 0x04 ///Reserved
#define SMGR_MASK_OBSERVATION_READY 0x02 ///Observation Ready
#define SMGR_MASK_ACTIVE_READY 0x01 ///Active Ready
/**
* @enum SMGR_VALIDATE_STATES
* @brief Config Data Formats needed from TMGT to trans. between states
*
*/
#define SMGR_VALIDATE_DATA_OBSERVATION_MASK_HARDCODES \
(DATA_MASK_SYS_CNFG | \
DATA_MASK_APSS_CONFIG | \
DATA_MASK_SET_ROLE | \
DATA_MASK_MEM_CFG | \
DATA_MASK_THRM_THRESHOLDS | \
DATA_MASK_AVSBUS_CONFIG )
#define SMGR_VALIDATE_DATA_ACTIVE_MASK G_smgr_validate_data_active_mask
#define SMGR_VALIDATE_DATA_OBSERVATION_MASK G_smgr_validate_data_observation_mask
#define SMGR_VALIDATE_DATA_ACTIVE_MASK_HARDCODES \
(SMGR_VALIDATE_DATA_OBSERVATION_MASK_HARDCODES | \
DATA_MASK_FREQ_PRESENT | \
DATA_MASK_PCAP_PRESENT )
// Used by OCC FW to request an OCC Reset because of an error.
// It's the action flag that actually requests the reset.
// Severity will be set to UNRECOVERABLE if it is INFORMATIONAL.
#define REQUEST_RESET(error_log) \
{\
reset_state_request(RESET_REQUESTED_DUE_TO_ERROR);\
setErrlActions(error_log, ERRL_ACTIONS_RESET_REQUIRED);\
commitErrl(&error_log);\
}
#define REQUEST_SAFE_MODE(error_log) \
{\
reset_state_request(RESET_REQUESTED_DUE_TO_ERROR);\
setErrlActions(error_log, ERRL_ACTIONS_SAFE_MODE_REQUIRED);\
commitErrl(&error_log);\
}
// Used by OCC FW to request that OCC go to Nominal because of an error
#define REQUEST_NOMINAL() reset_state_request(NOMINAL_REQUESTED_DUE_TO_ERROR);
// Used by OCC FW to signify that OCC can leave Nominal state because the
// error that caused OCC to go to Nominal has cleared.
#define CLEAR_NOMINAL() reset_state_request(RESET_NOT_REQUESTED);
// Used to indicate that OCC has established TMGT Comm, and should no longer
// halt() on a reset request.
#define DISABLE_HALT_ON_RESET_REQUEST() reset_disable_halt();
// Returns the current OCC State
#define CURRENT_STATE() G_occ_internal_state
// Returns the 'OCC Requested' OCC State
#define REQUESTED_STATE() G_occ_internal_req_state
// Returns true if OCC State is active
#define IS_OCC_STATE_ACTIVE() ( (OCC_STATE_ACTIVE == G_occ_internal_state)? 1 : 0 )
// Returns true if OCC State is observation
#define IS_OCC_STATE_OBSERVATION() ( (OCC_STATE_OBSERVATION == G_occ_internal_state)? 1 : 0 )
/**
* @struct smgr_state_trans_t
* @brief Used by the "Set State" command to call the correct transition
* function, based on the current & new states.
*/
typedef struct
{
uint8_t old_state;
uint8_t new_state;
errlHndl_t (*trans_func_ptr)(void);
} smgr_state_trans_t;
extern OCC_STATE G_occ_internal_state;
extern OCC_STATE G_occ_internal_req_state;
extern OCC_STATE G_occ_master_state;
extern OCC_STATE G_occ_external_req_state;
// Used by macro above to clear flag indicating to not halt OCC when a reset
// is requested.
inline void reset_disable_halt(void);
// Used to see if anyone has requested reset/safe state
bool isSafeStateRequested(void);
// Used by macros to request reset states extenally
void reset_state_request(uint8_t i_request);
// Task that will check for checkstop
void task_check_for_checkstop(task_t *i_self);
// Used to set OCC State
errlHndl_t SMGR_set_state(OCC_STATE i_state);
// Used to indicate which OCC States are valid, given the config data/system
// parms we currently know.
uint8_t SMGR_validate_get_valid_states(void);
#endif
|