summaryrefslogtreecommitdiffstats
path: root/src/occ_gpe1/gpe_membuf.h
blob: 39a4f53e142f80471e6dd90b56b6a9c789874374 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/occ_gpe1/gpe_membuf.h $                                   */
/*                                                                        */
/* OpenPOWER OnChipController Project                                     */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2015,2018                        */
/* [+] 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                                                     */
#if !defined(_GPE_MEMBUF_H)
#define _GPE_MEMBUF_H

#include "ipc_structs.h"
#include "membuf_structs.h"


// Which GPE controls the PBASLAVE
#define OCI_MASTER_ID_GPE1 1


#define INBAND_ACCESS_READ 1
#define INBAND_ACCESS_WRITE 2


// IPC interface
void gpe_membuf_scom(ipc_msg_t* i_cmd, void* i_arg);
void gpe_membuf_data(ipc_msg_t* i_cmd, void* i_arg);
void gpe_membuf_init(ipc_msg_t* i_cmd, void* i_arg);

// HCODE interfaces
/**
 * Reset the PBA slave controller
 * @param[in] pba_parms
 */
void pbaslvctl_reset(GpePbaParms* i_pba_parms);

/**
 * Configure the PBA Slave
 * @param[in] pba_parms
 */
uint64_t pbaslvctl_setup(GpePbaParms* i_pba_parms);


/**
 * Access the MEMBUF mmio over the PBA slave.
 * @param[in] Memory buffer configuration
 * @param[in] The membuf ordinal number
 * @param[in] The OCI mapped address
 * @param[io] The data to move
 * @param[in] The operation to perform
 */
int inband_access(MemBufConfiguration_t* i_config,
                   uint32_t i_instance,
                   uint32_t i_oci_addr,
                   uint64_t * io_data,
                   int      i_read_write);

/**
 * Populate the MemBufConfiguration object for Centaur
 * @param[out] 8 byte aligned pointer to the CentaurConfiguration object.
 * @return  [0 | return code]
 * @note  The CentaurConfiguration object is shared with the 405 so
 * it needs to be in non-cacheable sram.
 */
int gpe_centaur_configuration_create(MemBufConfiguration_t * o_config);

/**
 * Scom all of the membufs with the same SCOM address.
 * @param[in] The CentaurConfig object
 * @param[in] The SCOM address
 * @param[out] The array of data collected. Must be large enough to hold
 *             uint64_t data from each membuf.
 * @return [0 | return code]
 */
int membuf_get_scom_vector(MemBufConfiguration_t* i_config,
                            uint32_t i_scom_address,
                            uint64_t* o_data);

/**
 * Scom one or more membuf modules
 * @param[in] The MemBufConfiguration object
 * @param[in/out] The Scom Parms object
 * @return The return code is part of the MemBufScomParms object
 */
void gpe_inband_scom(MemBufConfiguration_t* i_config,
                     MemBufScomParms_t* i_parms);


/**
 * Collect the centaur thermal data
 * @param[in] The CentaurConfig object
 * @param[in/out] The Centaur data parm object
 * @return [0 | return code]
 */
int get_centaur_sensorcache(MemBufConfiguration_t* i_config,
                            MemBufGetMemDataParms_t* i_parms);

/**
 * Check for channel checkstop
 * @param[in] The ordinal centaur number
 * @return [0 | return code]
 */
int check_centaur_channel_chkstp(unsigned int i_centaur);

/**
 * Send SYNC to centaur to effectuate the thottle values
 * @param[in] the membuf configuration
 */
int centaur_throttle_sync(MemBufConfiguration_t* i_config);

/**
 * Create PBA slave configuration parameters.
 * @param[in] ptr tor param data area to be filled out.
 * @param[in] PBA slave to use.
 * @param[in] write ttype (@see occhw_pba_common.h)
 * @param[in] write tsize (@see occhw_pba_common.h)
 * @param[in] read_ttype  (@see occhw_pba_common.h)
 * @return [SUCCESS | return code]
 */
int gpe_pba_parms_create(GpePbaParms* parms,
                         int slave,
                         int write_ttype,
                         int write_tsize,
                         int read_ttype);

/**
 * Configure the PBABAR for inband access
 * @param[in] Configuration information
 */
int configure_pba_bar_for_inband_access(MemBufConfiguration_t * i_config);


extern uint32_t g_inband_access_state;

/**
 * Populate a CentaurConfiguration object for ocmb
 * @param[out] 8 byte aligned pointer to the CentaurConfiguration object.
 * @return  [0 | return code]
 * @note  The CentaurConfiguration object is shared with the 405 so
 * it needs to be in non-cacheable sram.
 */
int gpe_ocmb_configuration_create(MemBufConfiguration_t * o_config);

/**
 * Check for OCMBr sensor errors
 * @param[in] Configuration information
 * @param[in] The ordinal membuf number
 * @return [0 | return code]
 */
int check_and_reset_mmio_fir(MemBufConfiguration_t * i_config,unsigned int i_membuf);

/**
 * Send SYNC to ocmb to effectuate the thottle values
 * @param[in] the membuf configuration
 */
int ocmb_throttle_sync(MemBufConfiguration_t* i_config);

int get_ocmb_sensorcache(MemBufConfiguration_t* i_config,
                             MemBufGetMemDataParms_t* i_parms);


#endif
OpenPOWER on IntegriCloud