summaryrefslogtreecommitdiffstats
path: root/src/occ_405/cent/centaur_data.h
blob: 17831e420b4c14216ba11c76be008d6205a64fe7 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/occ/cent/centaur_data.h $                                 */
/*                                                                        */
/* OpenPOWER OnChipController Project                                     */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2014,2015                        */
/* [+] International Business Machines Corp.                              */
/*                                                                        */
/*                                                                        */
/* Licensed under the Apache License, Version 2.0 (the "License");        */
/* you may not use this file except in compliance with the License.       */
/* You may obtain a copy of the License at                                */
/*                                                                        */
/*     http://www.apache.org/licenses/LICENSE-2.0                         */
/*                                                                        */
/* Unless required by applicable law or agreed to in writing, software    */
/* distributed under the License is distributed on an "AS IS" BASIS,      */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        */
/* implied. See the License for the specific language governing           */
/* permissions and limitations under the License.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */

#ifndef _CENTAUR_DATA_H
#define _CENTAUR_DATA_H

//*************************************************************************
// Includes
//*************************************************************************
#include <occ_common.h>
#include <ssx.h>
#include "rtls.h"
//#include "gpe_data.h"
#include "occ_sys_config.h"
#include "memory.h"

//*************************************************************************
// Externs
//*************************************************************************

//*************************************************************************
// Defines/Enums
//*************************************************************************

// Mask that is used by procedure to specify which centaurs are present
#define ALL_CENTAURS_MASK          0x000000ff
#define ALL_CENTAURS_MASK_GPE      0x000000ff00000000ull
// Centaur0, used by OCC
#define CENTAUR0_PRESENT_MASK      0x00000080ul
#define CENTAUR0_PRESENT_MASK_GPE  0x0000008000000000ull

// Used for specifing buffer allocations
#define NUM_CENTAUR_DATA_BUFF       MAX_NUM_CENTAURS
#define NUM_CENTAUR_DOUBLE_BUF      1
#define NUM_CENTAUR_DATA_EMPTY_BUF  1

// Specify a command BAR addresses for all centaur operations
#define CENTAUR_MEM_DATA_BAR        MEM_DATA_BAR_SELECT_1

// Enum for specifying each Centaur
enum eOccCentaurs
{
  CENTAUR_0  = 0,
  CENTAUR_1  = 1,
  CENTAUR_2  = 2,
  CENTAUR_3  = 3,
  CENTAUR_4  = 4,
  CENTAUR_5  = 5,
  CENTAUR_6  = 6,
  CENTAUR_7  = 7,
};

//*************************************************************************
// Macros
//*************************************************************************
//Returns 0 if the specified centaur is not present. Otherwise, returns none-zero.
#define CENTAUR_PRESENT(occ_cent_id) \
         ((CENTAUR0_PRESENT_MASK >> occ_cent_id) & G_present_centaurs)

//Returns 0 if the specified centaur is not updated. Otherwise, returns none-zero.
#define CENTAUR_UPDATED(occ_cent_id) \
         ((CENTAUR0_PRESENT_MASK >> occ_cent_id) & G_updated_centaur_mask)

//Returns 0 if the specified centaur is not updated. Otherwise, returns none-zero.
#define CLEAR_CENTAUR_UPDATED(occ_cent_id) \
         G_updated_centaur_mask &= ~(CENTAUR0_PRESENT_MASK >> occ_cent_id)

//Returns the bitmask for the passed in Centaur (uint32_t)
#define CENTAUR_BY_MASK(occ_cent_id) \
         ((CENTAUR0_PRESENT_MASK >> occ_cent_id) & ALL_CENTAURS_MASK)

//Returns the bitmask for the passed in Centaur (uint64_t)
#define CENTAUR_BY_MASK_GPE(occ_cent_id) \
         (((uint64_t) CENTAUR0_PRESENT_MASK_GPE >> occ_cent_id) & ALL_CENTAURS_MASK_GPE)

#define DIMM_SENSOR0 0x80

#define CENTAUR_SENSOR_ENABLED(occ_cent_id, sensor_num) \
        (G_dimm_enabled_sensors.bytes[occ_cent_id] & (DIMM_SENSOR0 >> (sensor_num)))

#define MBA_CONFIGURED(occ_cent_id, mba_num) \
        (G_configured_mbas & (1 << ((occ_cent_id * 2) + mba_num)))
//*************************************************************************
// Structures
//*************************************************************************

//Centaur data collect structures used for task data pointers
// TEMP -- PORE ISSUES
/*
struct centaur_data_task {
        uint8_t start_centaur;
        uint8_t current_centaur;
        uint8_t end_centaur;
        uint8_t prev_centaur;
        MemData * centaur_data_ptr;
        PoreFlex gpe_req;
} __attribute__ ((__packed__));
typedef struct centaur_data_task centaur_data_task_t;
*/

//*************************************************************************
// Globals
//*************************************************************************

//Global centaur structures used for task data pointers
// TEMP -- COMMENTED OUT DUE TO PORE ISSUES
//extern centaur_data_task_t G_centaur_data_task;

//Global is bitmask of centaurs
extern uint32_t G_present_centaurs;

//AMEC needs to know when data for a centaur has been collected.
extern uint32_t G_updated_centaur_mask;

//global bitmap of enabled dimm sensors
extern dimm_sensor_flags_t G_dimm_enabled_sensors;
extern dimm_sensor_flags_t G_dimm_present_sensors;

//global bitmap of dimms that have ever gone over the error temperature
extern dimm_sensor_flags_t G_dimm_overtemp_bitmap;

//global bitmap of dimms temps that have been updated
extern dimm_sensor_flags_t G_dimm_temp_updated_bitmap;

//global bitmap flagging the dimms which we already calledout due to timeout (bitmap of dimms)
extern dimm_sensor_flags_t G_dimm_timeout_logged_bitmap;

//global bitmap flagging the centaurs which we already calledout due to timeout (bitmap of centaurs)
extern uint8_t G_cent_timeout_logged_bitmap;

//global bitmap of centaurs that have ever gone over the error temperature
extern uint8_t G_cent_overtemp_bitmap;

//global bitmap of centaur temperatures that have been updated
extern uint8_t G_cent_temp_updated_bitmap;

//bitmap of configured MBA's (2 per centaur, lsb is centaur0/mba0)
extern uint16_t G_configured_mbas;

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

//Collect centaur data for all centaur in specified range
void task_centaur_data( task_t * i_task );

//Initialize structures for collecting centaur data.
//void centaur_init( void ) INIT_SECTION;
void centaur_init( void );

//handles centaur i2c recovery and other workarounds
void cent_recovery(uint32_t i_cent);

//Determines if a centaur has a channel checkstop (returns TRUE is it has a
//channel checkstop, FALSE otherwise)
bool cent_chan_checkstop(const uint8_t i_cent);

//Returns a pointer to the most up-to-date centaur data for the centaur
//associated with the specified OCC centaur id.
// TEMP -- WHERE IS MemData ??
//MemData * cent_get_centaur_data_ptr( const uint8_t i_centaur_id );

#endif //_CENTAUR_DATA_H

OpenPOWER on IntegriCloud