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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
|
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/usr/hwpf/hwp/dram_initialization/host_mpipl_service/proc_mpipl_ex_cleanup.C $ */
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2012,2014 */
/* [+] 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 */
// $Id: proc_mpipl_ex_cleanup.C,v 1.6 2013/08/20 17:31:41 stillgs Exp $
// $Source: /afs/awd/projects/eclipz/KnowledgeBase/.cvsroot/eclipz/chips/p8/working/procedures/ipl/fapi/proc_mpipl_ex_cleanup.C,v $
//------------------------------------------------------------------------------
// *|
// *! (C) Copyright International Business Machines Corp. 2012
// *! All Rights Reserved -- Property of IBM
// *! *** ***
// *|
// *! TITLE : proc_mpipl_ex_cleanup.C
// *! DESCRIPTION : Undo step that prepared fast-winkled cores for scanning and set up deep winkle mode
// *!
// *! OWNER NAME : Dion Bell Email: belldi@us.ibm.com
// *! BACKUP NAME : Dion Bell Email: belldi@us.ibm.com
// *!
// *!
// *!
// *!
// *! Additional Note(s):
// *!
// *!
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Includes
//------------------------------------------------------------------------------
#include "proc_mpipl_ex_cleanup.H"
#include "p8_scom_addresses.H"
extern "C"
{
//------------------------------------------------------------------------------
// name: proc_mpipl_ex_cleanup
//------------------------------------------------------------------------------
// purpose:
// Undo step that prepared fast-winkled cores for scanning and set up deep winkle mode
// SCOM regs:
// 1) GP3 Register (NA in PERV CPLT)
//
// bit 27 (TP_LVLTRANS_FENCE): Electrical winkel fence. Mainly used by power management.
//
// 2) PowerManagement GP0 reg
//
// bit 22 (TP_TC_PERVASIVE_ECO_FENCE): Pervasive ECO fence
//
// bit 39 (PM_SLV_WINKLE_FENCE): Fence off the powered off chiplet in winkle. - Logical fence/hold for pcb_slave and pcb_slave_pm. For electrical fence see bit 23.
//
// 3) PowerManagement GP1
//
// Bit 5: WINKLE_POWER_OFF_SEL: Winkle Power Off Select:
// Selects which voltage level to place the Core and ECO domain PFETs upon Winkle entry. 0 = Vret (Fast Winkle Mode), 1 = Voff (Deep Winkle Mode). Depending on the setting of pmicr_latency_en, this bit is controlled with a PCB-write (0) or by the PMICR in the core (1).
//
// Bit 15: PMICR_LATENCY_EN: Selects how the sleep/winkle latency (which is deep/fast) is controlled. If asserted the PMICR controls the winkle/sleep_power_off_sel in PMGP1, otherwise those bits are controlled via SCOM by OCC.
// parameters:
// 'i_target' is chip target
//
// returns:
// FAPI_RC_SUCCESS (success, EX chiplets entered fast winkle)
//
// getscom/putscom/getattribute fapi errors
// fapi error assigned from eCMD function failure
//
//------------------------------------------------------------------------------
fapi::ReturnCode proc_mpipl_ex_cleanup(const fapi::Target & i_target) {
const char *procedureName = "proc_mpipl_ex_cleanup";
fapi::ReturnCode rc; //fapi return code
uint32_t rc_ecmd = 0; //ecmd return code value
ecmdDataBufferBase fsi_data(64); //64-bit data buffer
uint8_t attr_chip_unit_pos; //EX chiplet's unit offset within chip with respect to similar EX units
const uint64_t EX_OFFSET_MULT = 0x01000000; //Multiplier used to calculate offset for respective EX chiplet
uint64_t address; // Varible for computed addresses
uint64_t offset;
char reg_name[32]; // Character array for register names
// Relevant PMGP0 bits
// const uint32_t PM_DISABLE = 0;
const uint32_t BLOCK_REG_WKUP_SOURCE = 53;
// Relevant PMGP1 bits
const uint32_t WINKLE_POWER_OFF_SEL = 5;
std::vector<fapi::Target> v_ex_chiplets; //Vector of EX chiplets
do
{
//Entering fapi function
FAPI_INF("Entering %s", procedureName);
//Get vector of EX chiplets
rc = fapiGetChildChiplets( i_target,
fapi::TARGET_TYPE_EX_CHIPLET,
v_ex_chiplets,
fapi::TARGET_STATE_FUNCTIONAL);
if (rc)
{
FAPI_ERR("%s: fapiGetChildChiplets error", procedureName);
break;
}
FAPI_INF("Processing target %s", i_target.toEcmdString());
//Parse thru EX chiplets and prepare fast-winkled cores for deep operations
//Loop thru EX chiplets in vector
for (uint32_t counter = 0; counter < v_ex_chiplets.size(); counter++)
{
// Get EX chiplet number
rc = FAPI_ATTR_GET( ATTR_CHIP_UNIT_POS,
&(v_ex_chiplets[counter]),
attr_chip_unit_pos);
if (rc)
{
FAPI_ERR("%s: fapiGetAttribute error (ATTR_CHIP_UNIT_POS)", procedureName);
break;
}
FAPI_INF("EX chiplet pos = 0x%02X", attr_chip_unit_pos);
// Calculate the address offset based on chiplet number
offset = EX_OFFSET_MULT * attr_chip_unit_pos;
// -----------------------------------------------------------------
FAPI_DBG("\tOriginal register contents");
address = EX_GP3_0x100F0012 + offset;
strcpy(reg_name, "GP3");
rc = fapiGetScom( i_target, address, fsi_data );
if (rc)
{
FAPI_ERR("fapiGetScom error (addr: 0x%08llX)", address);
break;
}
FAPI_DBG("\t%s (addr: 0x%08llX), val=0x%016llX", reg_name, address, fsi_data.getDoubleWord(0));
address = EX_PMGP0_0x100F0100 + offset;
strcpy(reg_name, "PMGP0");
rc = fapiGetScom( i_target, address, fsi_data );
if (rc)
{
FAPI_ERR("fapiGetScom error (addr: 0x%08llX)", address);
break;
}
FAPI_DBG("\t%s (addr: 0x%08llX), val=0x%016llX", reg_name, address, fsi_data.getDoubleWord(0));
address = EX_PMGP1_0x100F0103 + offset;
strcpy(reg_name, "PMGP1");
rc = fapiGetScom( i_target, address, fsi_data );
if (rc)
{
FAPI_ERR("fapiGetScom error (addr: 0x%08llX)", address);
break;
}
FAPI_DBG("\t%s (addr: 0x%08llX), val=0x%016llX", reg_name, address, fsi_data.getDoubleWord(0));
// -----------------------------------------------------------------
// Clean up configuration remnants of the fast-winkle configuration
// that was used to flush the chiplets after checkstop. EX chiplets
// will have been through SBE EX Init with certain step skippled due
// to MPIPL.
FAPI_INF("Re-establish Deep Winkle mode default");
address = EX_PMGP1_OR_0x100F0105 + offset;
strcpy(reg_name, "PMGP1 OR");
rc_ecmd |= fsi_data.flushTo0();
rc_ecmd |= fsi_data.setBit(WINKLE_POWER_OFF_SEL);
if(rc_ecmd)
{
FAPI_ERR("ecmdDatatBuffer error preparing %s reg (addr: 0x%08llX) with rc %x", reg_name, address, rc_ecmd);
rc.setEcmdError(rc_ecmd);
break;
}
rc = fapiPutScom(i_target, address, fsi_data);
if (rc)
{
FAPI_ERR("fapiPutScom error (addr: 0x%08llX)", address);
break;
}
FAPI_INF("Clear block wakeup sources to PM logic. PM is NOT re-enabled");
// (eg clear Block Interrrupt Sources)
address = EX_PMGP0_AND_0x100F0101 + offset;
strcpy(reg_name, "PMGP0 AND");
rc_ecmd |= fsi_data.flushTo1();
// rc_ecmd |= fsi_data.clearBit(PM_DISABLE);
rc_ecmd |= fsi_data.clearBit(BLOCK_REG_WKUP_SOURCE);
if(rc_ecmd)
{
FAPI_ERR("ecmdDatatBuffer error preparing %s reg (addr: 0x%08llX)", reg_name, address);
rc.setEcmdError(rc_ecmd);
break;
}
rc = fapiPutScom(i_target, address, fsi_data);
if (rc)
{
FAPI_ERR("fapiPutScom error (addr: 0x%08llX)", address);
break;
}
// -----------------------------------------------------------------
FAPI_DBG("\tUpdated register contents");
address = EX_GP3_0x100F0012 + offset;
strcpy(reg_name, "GP3");
rc = fapiGetScom( i_target, address, fsi_data );
if (rc)
{
FAPI_ERR("fapiGetScom error (addr: 0x%08llX)", address);
break;
}
FAPI_DBG("\t%s (addr: 0x%08llX), val=0x%016llX", reg_name, address, fsi_data.getDoubleWord(0));
address = EX_PMGP0_0x100F0100 + offset;
strcpy(reg_name, "PMGP0");
rc = fapiGetScom( i_target, address, fsi_data );
if (rc)
{
FAPI_ERR("fapiGetScom error (addr: 0x%08llX)", address);
break;
}
FAPI_DBG("\t%s (addr: 0x%08llX), val=0x%016llX", reg_name, address, fsi_data.getDoubleWord(0));
address = EX_PMGP1_0x100F0103 + offset;
strcpy(reg_name, "PMGP1");
rc = fapiGetScom( i_target, address, fsi_data );
if (rc)
{
FAPI_ERR("fapiGetScom error (addr: 0x%08llX)", address);
break;
}
FAPI_DBG("\t%s (addr: 0x%08llX), val=0x%016llX", reg_name, address, fsi_data.getDoubleWord(0));
// -----------------------------------------------------------------
} // chiplet loop
// Error exit from above loop
// Not really needed as outer while(0) is next but here for consistent structure
if (!rc.ok())
{
break;
}
} while (0);
//Exiting fapi function
FAPI_INF("Exiting %s", procedureName);
return rc;
}
} // extern "C"
|