summaryrefslogtreecommitdiffstats
path: root/src/occ_405/proc/proc_data.h
blob: ad404a7e0da7a82d8b5b110e25f3921a41627f17 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/occ_405/proc/proc_data.h $                                */
/*                                                                        */
/* OpenPOWER OnChipController Project                                     */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2011,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 _PROC_DATA_H
#define _PROC_DATA_H

#include <occ_common.h>
#include <ssx.h>
#include "rtls.h"
#include "core_data.h"

//Returns 0 if the specified core is not present. Otherwise, returns none-zero.
#define CORE_PRESENT(occ_core_id) \
         ((CORE0_PRESENT_MASK >> occ_core_id) & G_present_cores)

//Takes an OCC core id and converts it to a core id that
//can be used by the hardware. The caller needs to send in
//a valid core id. Since type is uchar so there is no need to check for
//case less than 0. If core id is invalid then returns unconfigured core 24.
#define CORE_OCC2HW(occ_core_id) \
        ((occ_core_id <= 23) ? G_occ2hw_core_id[occ_core_id] : 24)

//Takes a hardware core id and returns a OCC core id.
//The caller needs to send in a valid core id. Since type is uchar so
//there is no need to check for case less than 0. If core id
//is invalid then returns unconfigured core 24.
#define CORE_HW2OCC(hw_core_id) \
    ((hw_core_id <= 23) ? G_hw2occ_core_id[hw_core_id] : 24)

#define ALL_CORES_MASK          0xffffff00
#define CORE0_PRESENT_MASK      0x80000000ul
#define CORE0_PRESENT_MASK_GPE  0x8000000000000000ull

#define MAX_NUM_HW_CORES    24
#define MAX_NUM_FW_CORES    24

#define CORE_MID_POINT (MAX_NUM_FW_CORES / 2)

#define THREADS_PER_CORE    4

#define NUM_CORE_DATA_BUFF       7
#define NUM_CORE_DATA_DOUBLE_BUF 2
#define NUM_CORE_DATA_EMPTY_BUF  1

#define LO_CORES_MASK       0xfff00000
#define HI_CORES_MASK       0x000fff00
#define HW_CORES_MASK       0xffffff00

enum eOccProcCores
{
  CORE_0  = 0,
  CORE_1  = 1,
  CORE_2  = 2,
  CORE_3  = 3,
  CORE_4  = 4,
  CORE_5  = 5,
  CORE_6  = 6,
  CORE_7  = 7,
  CORE_8  = 8,
  CORE_9  = 9,
  CORE_10 = 10,
  CORE_11 = 11,
  CORE_12 = 12,
  CORE_13 = 13,
  CORE_14 = 14,
  CORE_15 = 15,
  CORE_16 = 16,
  CORE_17 = 17,
  CORE_18 = 18,
  CORE_19 = 19,
  CORE_20 = 20,
  CORE_21 = 21,
  CORE_22 = 22,
  CORE_23 = 23,
};

//Processor data collect structures used for task data pointers
//gpe_req.request.parameter points to GpeGetCoreDataParms
struct bulk_core_data_task {
        uint8_t start_core;
        uint8_t current_core;
        uint8_t end_core;
        CoreData * core_data_ptr;
        GpeRequest gpe_req;
} __attribute__ ((__packed__));
typedef struct bulk_core_data_task bulk_core_data_task_t;

//Global low and high cores structures used for task data pointers
// TEMP -- CoreData / PoreFlex objects no longer exist
extern bulk_core_data_task_t G_low_cores;
extern bulk_core_data_task_t G_high_cores;

//Global G_present_cores is bitmask of all OCC core numbering
extern uint32_t G_present_cores;

//Global G_present_hw_cores is bitmask of all hardware cores
extern uint32_t G_present_hw_cores;
extern uint8_t G_occ2hw_core_id[MAX_NUM_HW_CORES];
extern uint8_t G_hw2occ_core_id[MAX_NUM_HW_CORES];

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

// External reference to empath error mask
extern uint32_t G_empath_error_core_mask;

//Returns 0 if the specified core is not present. Otherwise, returns none-zero.
#define CORE_PRESENT(occ_core_id) \
         ((CORE0_PRESENT_MASK >> occ_core_id) & G_present_cores)

//Returns 0 if the specified core is not updated. Otherwise, returns none-zero.
#define CORE_UPDATED(occ_core_id) \
         ((CORE0_PRESENT_MASK >> occ_core_id) & G_updated_core_mask)

//Returns 0 if the specified core is not updated. Otherwise, returns none-zero.
#define CLEAR_CORE_UPDATED(occ_core_id) \
         G_updated_core_mask &= ~(CORE0_PRESENT_MASK >> occ_core_id)

// Evaluates to true if an empath collection error has occurred on a core
#define CORE_EMPATH_ERROR(occ_core_id) \
        ((CORE0_PRESENT_MASK >> occ_core_id) & G_empath_error_core_mask)

//Collect bulk core data for all cores in specified range
void task_core_data( task_t * i_task );

//Initialize structures for collecting core data.
void proc_core_init( void ) INIT_SECTION;

//Collect fast core data for all configured cores on every tick
void task_fast_core_data( task_t * i_task );

//Returns a pointer to the most up-to-date bulk core data for the core
//associated with the specified OCC core id.
CoreData * proc_get_bulk_core_data_ptr( const uint8_t i_occ_core_id );

#endif //_PROC_DATA_H
OpenPOWER on IntegriCloud