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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
|
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/usr/diag/prdf/test/prdfTest_WriteHomerFir.H $ */
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2015,2017 */
/* [+] 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 __TEST_PRDFWRITEHOMERFIR_H
#define __TEST_PRDFWRITEHOMERFIR_H
/**
* @file prdfTest_WriteHomerFir.H
*
* @brief prdf testing writeHomerFirData()
*/
#ifdef __HOSTBOOT_MODULE
#include <cxxtest/TestSuite.H>
#include <errl/errlentry.H>
#include <errl/errlmanager.H>
#else
#include <cxxtest/TestSuite.h>
#include <fsp/FipsGlobalFixture.H>
#include <errlentry.H>
#endif
#include <prdfTrace.H>
#include <prdfMain.H>
#include "prdfsimMacros.H"
#include <homerData_common.h>
#include <prdfWriteHomerFirData.H>
#include <prdfParserEnums.H>
namespace PRDF
{
// these functions from prdfWriteHomerFirData.C are needed for the
// fakeWriteHomerFirData() function
errlHndl_t getHwConfig( std::vector<HOMER_ChipInfo_t> &io_chipInfVector,
const HwInitialized_t i_curHw );
errlHndl_t writeData( uint8_t * i_hBuf, size_t i_hBufSize,
const HwInitialized_t i_curHw,
std::vector<HOMER_ChipInfo_t> &i_chipVector,
HOMER_Data_t &io_homerData );
};
class WriteHomerFir: public CxxTest::TestSuite
{
private:
//faked getPnorInfo() function to accommodate unsupported getSectioninfo()
void fakeGetPnorInfo( HOMER_Data_t & o_data )
{
o_data.pnorInfo.pnorOffset = 0;
o_data.pnorInfo.pnorSize = 0;
o_data.pnorInfo.mmioOffset = 0;
o_data.pnorInfo.norWorkarounds = 0;
}
//------------------------------------------------------------------------------
// faked writeHomerFirData() function since getSectionInfo() in
// getPnorInfo() is unsupported during CxxTest cases
errlHndl_t fakeWriteHomerFirData( uint8_t * i_hBuf, size_t i_hBufSize,
const PRDF::HwInitialized_t i_curHw )
{
using namespace PRDF;
errlHndl_t errl = NULL;
do
{
HOMER_Data_t data = HOMER_getData(); // Initializes data
// Get the PNOR information, faked function
fakeGetPnorInfo( data );
// Get the hardware configuration
std::vector<HOMER_ChipInfo_t> l_chipInfVector;
errl = getHwConfig( l_chipInfVector, i_curHw );
if ( NULL != errl )
{
TS_FAIL("getHwConfig() failed");
break;
}
// Write the HOMER data
errl = writeData( i_hBuf, i_hBufSize, i_curHw,
l_chipInfVector, data );
if ( NULL != errl )
{
TS_FAIL("writeData() failed");
break;
}
} while (0);
if ( NULL != errl )
{
errl->collectTrace( PRDF_COMP_NAME, 512 );
}
return errl;
}
//------------------------------------------------------------------------------
// check if data exists in HOMER when it should not
void checkHomerData(HOMER_Data_t *d, const PRDF::HwInitialized_t i_curHw)
{
using namespace PRDF;
if (MASTER_PROC_CORE == i_curHw || ALL_PROC_MASTER_CORE == i_curHw)
{
// Should have at least one processor chip
if (0 == d->chipCount)
{
TS_FAIL("ERROR: ChipCount is zero in HOMER data");
} // end if no chips
else
{
uint8_t *l_bytePtr = (reinterpret_cast<uint8_t *>(d)) +
sizeof(HOMER_Data_t);
HOMER_Chip_t *l_chipPtr = NULL;
// Have a chip or more to look thru
for ( uint32_t l_chipNum=0;
(l_chipNum < d->chipCount); l_chipNum++ )
{
l_chipPtr = reinterpret_cast<HOMER_Chip_t *>(l_bytePtr);
l_bytePtr += sizeof(HOMER_Chip_t);
/* 'Existing chiplet area' can vary in size */
if (HOMER_CHIP_NIMBUS == l_chipPtr->chipType)
{
HOMER_ChipNimbus_t *l_nimPtr =
reinterpret_cast<HOMER_ChipNimbus_t *>(l_bytePtr);
// MCBIST
if (l_nimPtr->mcbistMask != 0)
{
TS_FAIL("ERROR: MCBIST should not be available. "
"(MCBIST: 0x%x)", l_nimPtr->mcbistMask);
break;
}
// MCS
if (l_nimPtr->mcsMask != 0)
{
TS_FAIL("ERROR: MCS should not be available. "
"(MCS: 0x%x)", l_nimPtr->mcsMask);
break;
}
// MCA
if (l_nimPtr->mcaMask != 0)
{
TS_FAIL("ERROR: MCA should not be available. "
"(MCA: 0x%x)", l_nimPtr->mcaMask);
break;
}
// prepare for next chip (if any)
l_bytePtr += sizeof(HOMER_ChipNimbus_t);
}
else if (HOMER_CHIP_CUMULUS == l_chipPtr->chipType)
{
HOMER_ChipCumulus_t *l_cumPtr =
reinterpret_cast<HOMER_ChipCumulus_t *>(l_bytePtr);
// MC
if (l_cumPtr->mcMask != 0)
{
TS_FAIL("ERROR: MC should not be available. "
"(MC: 0x%x)", l_cumPtr->mcMask);
break;
}
// MCS
if (l_cumPtr->miMask != 0)
{
TS_FAIL("ERROR: MI should not be available. "
"(MI: 0x%x)", l_cumPtr->miMask);
break;
}
// MCA
if (l_cumPtr->dmiMask != 0)
{
TS_FAIL("ERROR: DMI should not be available. "
"(DMI: 0x%x)", l_cumPtr->dmiMask);
break;
}
// prepare for next chip (if any)
l_bytePtr += sizeof(HOMER_ChipCumulus_t);
}
else if (HOMER_CHIP_CENTAUR == l_chipPtr->chipType)
{
TS_FAIL("ERROR: MEMBUF should not be available ");
break;
}
} // end for loop thru chips
} // end else we have a chip or 2
} // end if proc related
} // end function checkHomerData
//------------------------------------------------------------------------------
public:
uint8_t hBuf[3072];
// called at the beginning of each test
void setUp()
{
memset(hBuf, 0x00, sizeof(hBuf));
}
//------------------------------------------------------------------------------
// test when the master processor and core are the configured hw
void TestWriteHomerMasterProcCore(void)
{
using namespace PRDF;
TS_TRACE("- Write Homer Test 1 - Master Proc Core - Start -");
errlHndl_t errl = fakeWriteHomerFirData(hBuf, sizeof(hBuf),
MASTER_PROC_CORE);
if (NULL != errl)
{
TS_FAIL("ERROR: writeHomerFirData failed.");
}
HOMER_Data_t * d = reinterpret_cast<HOMER_Data_t *>(hBuf);
checkHomerData(d, MASTER_PROC_CORE);
TS_TRACE("- Write Homer Test 1 - Master Proc Core - End-");
}
//------------------------------------------------------------------------------
// test when all processors and the master core are the configured hw
void TestWriteHomerAllProcMasterCore(void)
{
using namespace PRDF;
TS_TRACE("- Write Homer Test 2 - All Proc Master Core - Start -");
errlHndl_t errl = fakeWriteHomerFirData(hBuf, sizeof(hBuf),
ALL_PROC_MASTER_CORE);
if (NULL != errl)
{
TS_FAIL("ERROR: writeHomerFirData failed.");
}
HOMER_Data_t * d = reinterpret_cast<HOMER_Data_t *>(hBuf);
checkHomerData(d, ALL_PROC_MASTER_CORE);
TS_TRACE("- Write Homer Test 2 - All Proc Master Core - End-");
}
//------------------------------------------------------------------------------
// test when all processors, all memory, master core are the configured hw
void TestWriteHomerAllProcMemMasterCore(void)
{
using namespace PRDF;
TS_TRACE("- Write Homer Test 3 - All Proc Mem Master Core - Start -");
errlHndl_t errl = fakeWriteHomerFirData(hBuf, sizeof(hBuf),
ALL_PROC_MEM_MASTER_CORE);
if (NULL != errl)
{
TS_FAIL("ERROR: writeHomerFirData failed.");
}
HOMER_Data_t * d = reinterpret_cast<HOMER_Data_t *>(hBuf);
checkHomerData(d, ALL_PROC_MEM_MASTER_CORE);
TS_TRACE("- Write Homer Test 3 - All Proc Mem Master Core - End-");
}
//------------------------------------------------------------------------------
// test when all hardware is configured
void TestWriteHomerAllHardware(void)
{
using namespace PRDF;
TS_TRACE("- Write Homer Test 4 - All Hardware - Start -");
errlHndl_t errl = fakeWriteHomerFirData(hBuf, sizeof(hBuf),
ALL_HARDWARE);
if (NULL != errl)
{
TS_FAIL("ERROR: writeHomerFirData failed.");
}
HOMER_Data_t * d = reinterpret_cast<HOMER_Data_t *>(hBuf);
checkHomerData(d, ALL_HARDWARE);
TS_TRACE("- Write Homer Test 4 - All Hardware - End-");
}
//------------------------------------------------------------------------------
};
#endif
|