summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf/hwp/tod_init/proc_tod_setup/proc_tod_setup.H
blob: dd377d9904e43db14b040295696d069618e64de4 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/hwpf/hwp/tod_init/proc_tod_setup/proc_tod_setup.H $   */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2013,2014              */
/*                                                                        */
/* 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                                                     */
// $Id: proc_tod_setup.H,v 1.6 2013/03/05 23:21:17 jklazyns Exp $
//------------------------------------------------------------------------------
// *! (C) Copyright International Business Machines Corp. 2012
// *! All Rights Reserved -- Property of IBM
// *! *** IBM Confidential ***
// *!
// *! TITLE : proc_tod_setup.H
// *!
// *! DESCRIPTION : Header for proc_tod_setup.C
// *!
// *! OWNER NAME  : Nick Klazynski  Email: jklazyns@us.ibm.com
// *! BACKUP NAME :                 Email:
// *!
// *! ADDITIONAL COMMENTS :
// *!
//------------------------------------------------------------------------------

#ifndef PROC_TOD_SETUP_H_
#define PROC_TOD_SETUP_H_

//------------------------------------------------------------------------------
// Includes
//------------------------------------------------------------------------------

#include "proc_tod_utils.H"

//------------------------------------------------------------------------------
// Constant definitions
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
// Structure definitions
//------------------------------------------------------------------------------

// function pointer typedef definition for HWP call support
typedef fapi::ReturnCode
(*proc_tod_setup_FP_t) (tod_topology_node*,
                        const proc_tod_setup_tod_sel,
                        const proc_tod_setup_osc_sel);

// function pointer which allows HWSV to calculate TOD_CHIP_CTRL_REG_00040010's value
// (Does not set the register)
typedef fapi::ReturnCode
(*init_chip_ctrl_reg_FP_t) (ecmdDataBufferBase&);

//------------------------------------------------------------------------------
// Function prototypes
//------------------------------------------------------------------------------

extern "C"
{

/**
 * @brief Configures the TOD topology
 *
 * @param[in] i_tod_node  Reference to TOD topology (FAPI targets included within)
 *            i_tod_sel   Specifies the topology to configure
 *            i_osc_sel   Specifies the oscillator to use for the master
 *
 * @return FAPI_RC_SUCCESS if TOD topology is successfully configured
 *         else FAPI or ECMD error is sent through
 */
fapi::ReturnCode proc_tod_setup(tod_topology_node*           i_tod_node,
                                const proc_tod_setup_tod_sel i_tod_sel,
                                const proc_tod_setup_osc_sel i_osc_sel);

/**
 * @brief Helper function for proc_tod_setup
 *
 * @param[in] i_tod_node  Reference to TOD topology (FAPI targets included within)
 *            i_tod_sel   Specifies the topology to configure
 *            i_osc_sel   Specifies the oscillator to use for the master
 *
 * @return FAPI_RC_SUCCESS if TOD topology is successfully configured
 *         else FAPI or ECMD error is sent through
 */
fapi::ReturnCode configure_tod_node(tod_topology_node*           i_tod_node,
                                    const proc_tod_setup_tod_sel i_tod_sel,
                                    const proc_tod_setup_osc_sel i_osc_sel);

/**
 * @brief Calculates TOD_CHIP_CTRL_REG_00040010 value; will be called
 * while configuring the TOD node
 * 
 * @param[out] o_chic_ctrlReg_val => ecmdDataBuffer containing the 
 * Chip Control Status Register configuration
 *        
 * @return FAPI_RC_SUCCESS if TOD_CHIP_CTRL_REG_00040010's value was successfully
 *         calculated else ECMD error is sent back
 */
fapi::ReturnCode init_chip_ctrl_reg(ecmdDataBufferBase& o_chic_ctrlReg_val); 

/**
 * @brief Displays the TOD topology
 *
 * @param[in] i_tod_node  Reference to TOD topology
 *
 * @return void
 */
void display_tod_nodes(const tod_topology_node* i_tod_node, const uint32_t depth);

/**
 * @brief Calculates and populates the topology delays
 *
 * @param[in] i_tod_node  Reference to TOD topology
 *
 * @return FAPI_RC_SUCCESS if TOD topology is successfully configured with delays
 *         else FAPI or ECMD error is sent through
 */
fapi::ReturnCode calculate_node_delays(tod_topology_node* i_tod_node);

/**
 * @brief Finds the longest delay in the topology (additionally sets each node delay)
 *
 * @param[in]  i_tod_node      Reference to TOD topology
 * @param[in]  i_freq_x        XBUS frequency in MHz
 * @param[in]  i_freq_a        ABUS frequency in MHz
 *
 * @param[out] o_longest_delay Longest delay in TOD-grid-cycles
 *
 * @return FAPI_RC_SUCCESS if a longest TOD delay was found in topology
 *         else FAPI or ECMD error is sent through
 */
fapi::ReturnCode calculate_longest_topolopy_delay(tod_topology_node* i_tod_node,
                                                  const uint32_t     i_freq_x,
                                                  const uint32_t     i_freq_a,
                                                  uint32_t*          o_longest_delay);

/**
 * @brief Calculates the delay for a node in TOD-grid-cycles
 *
 * @param[in]  i_tod_node      Reference to TOD topology
 * @param[in]  i_freq_x        XBUS frequency in MHz
 * @param[in]  i_freq_a        ABUS frequency in MHz
 *
 * @param[out] o_node_delay    Delay of a single node in TOD-grid-cycles
 *
 * @return FAPI_RC_SUCCESS if TOD node delay is successfully calculated
 *         else FAPI or ECMD error is sent through
 */
fapi::ReturnCode calculate_node_link_delay(tod_topology_node* i_tod_node,
                                           const uint32_t     i_freq_x,
                                           const uint32_t     i_freq_a,
                                           uint32_t*          o_node_delay);

/**
 * @brief Updates the topology struct with the final delay values
 *
 * @param[in]  i_tod_node      Reference to TOD topology
 * @param[in]  i_freq_x        XBUS frequency in MHz
 * @param[in]  i_freq_a        ABUS frequency in MHz
 * @param[in]  i_longest_delay Longest delay in the topology
 *
 * @return FAPI_RC_SUCCESS if o_int_path_delay was set for every node in the topology
 *         else FAPI or ECMD error is sent through
 */
fapi::ReturnCode set_topology_delays(tod_topology_node* i_tod_node,
                                     const uint32_t     i_freq_x,
                                     const uint32_t     i_freq_a,
                                     const uint32_t     i_longest_delay);
} // extern "C"

#endif // PROC_TOD_SETUP_H_
OpenPOWER on IntegriCloud