summaryrefslogtreecommitdiffstats
path: root/src/usr/vpd/test/dvpdtest.H
blob: c5fe0bc97145c95a21b10638e25c0f7108ac0248 (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
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
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/vpd/test/dvpdtest.H $                                 */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2013,2019                        */
/* [+] 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 __DVPDTEST_H
#define __DVPDTEST_H

/**
 *  @file dvpdtest.H
 *
 *  @brief Test cases for DVPD code
 */
#include <sys/time.h>

#include <cxxtest/TestSuite.H>
#include <errl/errlmanager.H>
#include <errl/errlentry.H>
#include <devicefw/driverif.H>
#include <targeting/common/predicates/predicatectm.H>
#include <config.h>

#include <vpd/dvpdenums.H>
#include <vpd/vpdreasoncodes.H>
#include "../dvpd.H"
#include "../ipvpd.H"

extern trace_desc_t* g_trac_vpd;

using namespace TARGETING;

//Use this keyword for general testing where just some keyword is needed.
constexpr uint64_t TSTKEYWD = DVPD::J4;

/**
 * @brief Structure to define record/keyword pairs for DVPD tests.
 */
struct dvpdTestData
{
    VPD::vpdRecord record;
    VPD::vpdRecord keyword;
};

/**
 * @brief Data sample to be used for DVPD testing.
 */
dvpdTestData dvpdData[] =
{
    { DVPD::MEMD, DVPD::MR },
    { DVPD::MEMD, DVPD::MT },
    { DVPD::MEMD, DVPD::Q0 },
    { DVPD::MEMD, DVPD::Q1 },
    { DVPD::MEMD, DVPD::Q8 },
    { DVPD::MEMD, DVPD::CK },
};

TARGETING::Target* getFunctionalMcsTarget()
{
    TARGETING::Target * theTarget = NULL;
    TRACDCOMP( g_trac_vpd,
               "getFunctionalMcsTarget() - Finding a functional MCS" );

    // Get a list of functional MCS targets
    TargetHandleList mcsList;
    getAllChiplets(mcsList,TARGETING::TYPE_MCS);

    if( mcsList.size() )
    {
        theTarget = mcsList[0];
    }

    return theTarget;
}

class DVPDTest: public CxxTest::TestSuite
{
    public:

        /**
         * @brief This function will test DVPD reads.
         */
        void testDvpdRead ( void )
        {
            errlHndl_t err = NULL;
            uint64_t cmds = 0x0;
            uint64_t fails = 0x0;
            uint64_t theRecord = 0x0;
            uint64_t theKeyword = 0x0;

            TRACFCOMP( g_trac_vpd,
                       ENTER_MRK"testDvpdRead()" );

            do
            {
                TARGETING::Target * theTarget = getFunctionalMcsTarget();
                if(theTarget == NULL)
                {
                    TRACFCOMP(g_trac_vpd,
                              "testDvpdRead() - No Functional Targets found!");
                    break;
                }

                uint8_t * theData = NULL;
                size_t theSize = 0;
                const uint32_t numCmds = sizeof(dvpdData)/sizeof(dvpdData[0]);
                for( uint32_t curCmd = 0; curCmd < numCmds; curCmd++ )
                {
                    cmds++;
                    theRecord = (uint64_t)dvpdData[curCmd].record;
                    theKeyword = (uint64_t)dvpdData[curCmd].keyword;
                    err = deviceRead( theTarget,
                                      NULL,
                                      theSize,
                                      DEVICE_DVPD_ADDRESS( theRecord,
                                                           theKeyword ) );

                    if( err )
                    {
                        fails++;
                        TRACFCOMP( g_trac_vpd,
                                   ERR_MRK"testDvpdRead() - failure reading "
                                   "keyword size!!  rec: 0x%04x, kwd: 0x%04x",
                                   theRecord,
                                   theKeyword );
                        TS_FAIL( "testDvpdRead() - "
                                 "Failure reading keyword size!" );
                        errlCommit( err,
                                    VPD_COMP_ID );
                        continue;
                    }

                    theData = static_cast<uint8_t*>(malloc( theSize ));

                    // Read record/keyword pair
                    err = deviceRead( theTarget,
                                      theData,
                                      theSize,
                                      DEVICE_DVPD_ADDRESS( theRecord,
                                                           theKeyword ) );

                    if( err )
                    {
                        fails++;
                        TRACFCOMP( g_trac_vpd,
                                   ERR_MRK"testDvpdRead() - Failure on Record: "
                                   "0x%04x, keyword: 0x%04x, of size: 0x%04x "
                                   "- test %d",
                                   theRecord,
                                   theKeyword,
                                   theSize, curCmd );
                        TS_FAIL( "testDvpdRead() - Failure during DVPD read!" );
                        errlCommit( err,
                                    VPD_COMP_ID );

                        // Free the data
                        if( NULL != theData )
                        {
                            free( theData );
                            theData = NULL;
                        }
                        continue;
                    }

                    TRACDCOMP( g_trac_vpd,
                               INFO_MRK"testDvpdRead Results:" );
                    for( uint32_t i = 0; i < theSize; i++ )
                    {
                        TRACDCOMP( g_trac_vpd,
                                   INFO_MRK"   Byte[%d]: 0x%02x",
                                   i, theData[i] );
                    }

                    // Free the data
                    if( NULL != theData )
                    {
                        free( theData );
                        theData = NULL;
                    }
                }
            } while( 0 );

            TRACFCOMP( g_trac_vpd,
                       "testDvpdRead - %d/%d fails",
                       fails, cmds );
        }

        /**
         * @brief This function will test DVPD writes.
         *    Note: this forces the path to not use the FW override
         */
        void testDvpdWrite ( void )
        {
#ifndef __HOSTBOOT_RUNTIME
            errlHndl_t err = NULL;
            uint64_t cmds = 0x0;
            uint64_t fails = 0x0;
            uint8_t* testData = NULL;
            uint8_t* origData = NULL;
            uint8_t* verifyData = NULL;

            TRACFCOMP( g_trac_vpd,
                       ENTER_MRK"testDvpdWrite()" );

            do
            {
                TARGETING::Target * theTarget = getFunctionalMcsTarget();
                if(theTarget == NULL)
                {
                    TRACFCOMP(g_trac_vpd,
                            "testDvpdWrite() - No Functional Targets found!");
                    break;
                }

                // first figure out how big the keyword is
                cmds++;
                size_t theSize = 0;
                err = deviceRead( theTarget,
                                  testData,
                                  theSize,
                                  DEVICE_DVPD_FORCE_ADDRESS(DVPD::MEMD,
                                                            TSTKEYWD,
                                                            VPD::USEVPD) );
                if( err )
                {
                    fails++;
                    TRACFCOMP( g_trac_vpd,
                               ERR_MRK"testDvpdWrite() - "
                                     "failure getting size of MEMD/J4, RC=%.4X",
                               err->reasonCode() );
                    TS_FAIL( "testDvpdWrite() - Failure calling deviceRead!" );
                    errlCommit( err,
                                VPD_COMP_ID );
                    continue;
                }

                // save off the original data
                origData = new uint8_t[theSize];
                cmds++;
                err = deviceRead( theTarget,
                                  origData,
                                  theSize,
                                  DEVICE_DVPD_FORCE_ADDRESS(DVPD::MEMD,
                                                            TSTKEYWD,
                                                            VPD::USEVPD) );
                if( err )
                {
                    fails++;
                    TRACFCOMP( g_trac_vpd,
                               ERR_MRK"testDvpdWrite() - "
                                      "failure reading MEMD/J4, RC=%.4X",
                               err->reasonCode() );
                    TS_FAIL( "testDvpdWrite() - Failure calling deviceRead!" );
                    errlCommit( err,
                                VPD_COMP_ID );
                    continue;
                }
                TRACFBIN( g_trac_vpd, "testDvpdWrite() - orig=",
                          origData, theSize );

                // fill it up with some dummy data
                testData = new uint8_t[theSize];
                for( size_t x=0; x<theSize; x++ )
                {
                    testData[x] = x;
                }

                // write the new data in
                cmds++;
                err = deviceWrite( theTarget,
                                   testData,
                                   theSize,
                                   DEVICE_DVPD_FORCE_ADDRESS(DVPD::MEMD,
                                                             TSTKEYWD,
                                                             VPD::USEVPD) );
                if( err )
                {
                    fails++;
                    TRACFCOMP( g_trac_vpd,
                               ERR_MRK"testDvpdWrite() - "
                                      "failure writing MEMD/J4, RC=%.4X",
                               err->reasonCode() );
                    TS_FAIL( "testDvpdWrite() - Failure calling deviceWrite!" );
                    errlCommit( err,
                                VPD_COMP_ID );
                    continue;
                }

                // verify the data got written
                cmds++;
                verifyData = new uint8_t[theSize];
                err = deviceRead( theTarget,
                                  verifyData,
                                  theSize,
                                  DEVICE_DVPD_FORCE_ADDRESS(DVPD::MEMD,
                                                            TSTKEYWD,
                                                            VPD::USEVPD) );
                if( err )
                {
                    fails++;
                    TRACFCOMP( g_trac_vpd,
                               ERR_MRK"testDvpdWrite() - "
                                   "failure reading MEMD/J4 to verify, RC=%.4X",
                               err->reasonCode() );
                    TS_FAIL( "testDvpdWrite() - Failure calling deviceRead!" );
                    errlCommit( err,
                                VPD_COMP_ID );
                    continue;
                }
                TRACFBIN( g_trac_vpd, "testDvpdWrite() - verif=",
                          verifyData, theSize );

                // compare what we read to what we wrote
                if( memcmp( testData, verifyData, theSize ) )
                {
                    fails++;
                    TRACFBIN( g_trac_vpd, "testDvpdWrite() - wrote=",
                              testData, theSize );
                    TRACFBIN( g_trac_vpd, "testDvpdWrite() - read=",
                              verifyData, theSize );
                    TS_FAIL( "testDvpdWrite - Data mismatch!" );
                }

                // put the original data back to be a good citizen
                cmds++;
                err = deviceWrite( theTarget,
                                   origData,
                                   theSize,
                                   DEVICE_DVPD_FORCE_ADDRESS(DVPD::MEMD,
                                                             TSTKEYWD,
                                                             VPD::USEVPD) );
                if( err )
                {
                    fails++;
                    TRACFCOMP( g_trac_vpd,
                               ERR_MRK"testDvpdWrite() - "
                     "failure writing original data back into MEMD/J4, RC=%.4X",
                               err->reasonCode() );
                    TS_FAIL( "testDvpdWrite() - Failure calling deviceRead!" );
                    errlCommit( err,
                                VPD_COMP_ID );
                    continue;
                }

            } while( 0 );

            if( NULL != testData )
            {
                delete[] testData;
                testData = NULL;
            }

            if( NULL != origData )
            {
                delete[] origData;
                origData = NULL;
            }

            if( NULL != verifyData )
            {
                delete[] verifyData;
                verifyData = NULL;
            }

            if( cmds == 0 )
            {
                TRACFCOMP(g_trac_vpd, "testDvpdWrite - No tests ran, something is wrong...");
            }

            TRACFCOMP( g_trac_vpd,
                       "testDvpdWrite - %d/%d fails",
                       fails, cmds );
#endif
        }

        /**
         * @brief This function will test that an error is generated when a
         *      record is passed in that cannot be found in the structure
         *      that defines the Records string representation.
         */
        void testDvpdInvalidRecord ( void )
        {
            errlHndl_t err = NULL;
            uint64_t cmds = 0x0;
            uint64_t fails = 0x0;

            TRACFCOMP( g_trac_vpd,
                       ENTER_MRK"testDvpdInvalidRecord()" );

            do
            {
                TARGETING::Target * theTarget = getFunctionalMcsTarget();
                if(theTarget == NULL)
                {
                    TRACFCOMP(g_trac_vpd, "testDvpdInvalidRecord() No Functional Targets found!");
                    break;
                }


                size_t theSize = 1;
                uint8_t * theData = new uint8_t[theSize];

                cmds++;
                err = deviceRead( theTarget,
                                  theData,
                                  theSize,
                                  DEVICE_DVPD_ADDRESS( DVPD::DVPD_LAST_RECORD,
                                                       TSTKEYWD ) );

                if( NULL == err )
                {
                    fails++;
                    TS_FAIL( "testDvpdInvalidRecord() - Error expected with "
                             "record of type DVPD_LAST_RECORD (0x%04x), but "
                             "no error returned!",
                             DVPD::DVPD_LAST_RECORD );
                }
                else
                {
                    delete err;
                    err = NULL;
                }

                if( NULL != theData )
                {
                    delete theData;
                    theData = NULL;
                }
            } while( 0 );

            TRACFCOMP( g_trac_vpd,
                       "testDvpdInvalidRecord - %d/%d fails",
                       fails, cmds );
        }

        /**
         * @brief This function will test for a record which is not in the TOC
         *      of the DVPD area.
         */
        void testDvpdMissingRecord ( void )
        {
            errlHndl_t err = NULL;
            uint64_t cmds = 0x0;
            uint64_t fails = 0x0;

            TRACFCOMP( g_trac_vpd,
                       ENTER_MRK"testDvpdMissingRecord()" );

            do
            {
                TARGETING::Target * theTarget = getFunctionalMcsTarget();
                if(theTarget == NULL)
                {
                    TRACFCOMP(g_trac_vpd, "testDvpdMissingRecord() - No Functional Targets found!");
                    break;
                }

                size_t theSize = 1;
                uint8_t * theData = new uint8_t[theSize];

                cmds++;
                err = deviceRead( theTarget,
                                  theData,
                                  theSize,
                                  DEVICE_DVPD_ADDRESS( DVPD::DVPD_TEST_RECORD,
                                                       TSTKEYWD ) );

                if( NULL == err )
                {
                    fails++;
                    TS_FAIL( "testDvpdMissingRecord() - ");
                }
                else
                {
                    delete err;
                    err = NULL;
                }

                if( NULL != theData )
                {
                    delete theData;
                    theData = NULL;
                }
            } while( 0 );
            TRACFCOMP( g_trac_vpd,
                       "testDvpdMissingRecord - %d/%d fails",
                       fails, cmds );
        }

        /**
         * @brief This function will test for a keyword that cannot be found
         *      in the expected record
         */
        void testDvpdMissingKeyword ( void )
        {
            errlHndl_t err = NULL;
            uint64_t cmds = 0x0;
            uint64_t fails = 0x0;

            TRACFCOMP( g_trac_vpd,
                       ENTER_MRK"testDvpdMissingKeyword()" );

            do
            {
                TARGETING::Target * theTarget = getFunctionalMcsTarget();
                if(theTarget == NULL)
                {
                    TRACFCOMP(g_trac_vpd, "testDvpdMissingKeyword() - No Functional Targets found!");
                    break;
                }

                size_t theSize = 1;
                uint8_t * theData = new uint8_t[theSize];

                cmds++;
                err = deviceRead(theTarget,
                                 theData,
                                 theSize,
                                 DEVICE_DVPD_ADDRESS(DVPD::DVPD_FIRST_RECORD,
                                                     DVPD::DVPD_TEST_KEYWORD));

                if( NULL == err )
                {
                    fails++;
                    TS_FAIL("testDvpdMissingKeyword() - Expected error from "
                            "invalid Keyword missing from associated record!");
                }
                else
                {
                    delete err;
                    err = NULL;
                }

                if( NULL != theData )
                {
                    delete theData;
                    theData = NULL;
                }
            } while( 0 );

            TRACFCOMP( g_trac_vpd,
                       "testDvpdMissingKeyword - %d/%d fails",
                       fails, cmds );
        }

        /**
         * @brief This function will test that an error is generated when a
         *      keyword is passed in that cannot be found in the structure
         *      that defines the Keywords string representation.
         */
        void testDvpdInvalidKeyword ( void )
        {
            errlHndl_t err = NULL;
            uint64_t cmds = 0x0;
            uint64_t fails = 0x0;

            TRACFCOMP( g_trac_vpd,
                       ENTER_MRK"testDvpdInvalidKeyword()" );
            do
            {
                TARGETING::Target * theTarget = getFunctionalMcsTarget();
                if(theTarget == NULL)
                {
                    TRACFCOMP(g_trac_vpd, "testDvpdInvalidKeyword() - No Functional Targets found!");
                    break;
                }

                size_t theSize = 1;
                uint8_t * theData = new uint8_t[theSize];

                cmds++;
                err = deviceRead(theTarget,
                                 theData,
                                 theSize,
                                 DEVICE_DVPD_ADDRESS(DVPD::MEMD,
                                                     DVPD::DVPD_LAST_KEYWORD));

                if( NULL == err )
                {
                    fails++;
                    TS_FAIL( "testDvpdInvalidKeyword() - Error expected with "
                             "keyword of type DVPD_LAST_KEYWORD (0x%04x), but "
                             "no error returned!",
                             DVPD::DVPD_LAST_KEYWORD );
                }
                else
                {
                    delete err;
                    err = NULL;
                }

                if( NULL != theData )
                {
                    delete theData;
                    theData = NULL;
                }
            } while( 0 );

            TRACFCOMP( g_trac_vpd,
                       "testDvpdInvalidKeyword - %d/%d fails",
                       fails, cmds );
        }

        /**
         * @brief This function will test that an error is generated when a
         *      buffer that has an insufficient size is passed in to read a
         *      record/keyword.
         */
        void testDvpdInvalidBufferSize ( void )
        {
           errlHndl_t err = NULL;
            uint64_t cmds = 0x0;
            uint64_t fails = 0x0;

            TRACFCOMP( g_trac_vpd,
                       ENTER_MRK"testDvpdInvalidBufferSize()" );

            do
            {
                TARGETING::Target * theTarget = getFunctionalMcsTarget();
                if(theTarget == NULL)
                {
                    TRACFCOMP(g_trac_vpd, "testDvpdInvalidBufferSize() - No Functional Targets found!");
                    break;
                }

                uint8_t * theData = new uint8_t[1];
                size_t theSize = 0;

                cmds++;
                err = deviceRead( theTarget,
                                  theData,
                                  theSize,
                                  DEVICE_DVPD_ADDRESS( DVPD::MEMD,
                                                       TSTKEYWD ) );

                if( NULL == err )
                {
                    fails++;
                    TS_FAIL( "testDvpdInvalidBufferSize() - Error was expected "
                             "for an invalid size of 0x0 for a DVPD read!" );
                }
                else
                {
                    delete err;
                    err = NULL;
                }

                if( NULL != theData )
                {
                    delete theData;
                    theData = NULL;
                }
            } while( 0 );

            TRACFCOMP( g_trac_vpd,
                       "testDvpdInvalidBufferSize - %d/%d fails",
                       fails, cmds );
        }

        /**
         * @brief This function will test the numerical order of the dvpdRecords
         *      and dvpdKeywords structures.
         */
        void testDvpdCheckStructOrder ( void )
        {
            uint64_t fails = 0x0;
            VPD::vpdRecord prevRecord = DVPD::DVPD_FIRST_RECORD;
            VPD::vpdKeyword prevKeyword = DVPD::DVPD_FIRST_KEYWORD;

            TRACFCOMP( g_trac_vpd,
                       ENTER_MRK"testDvpdCheckStructOrder()" );

            // Check the dvpdRecords structure for proper order
            uint32_t entry = 0x0;
            for( entry = 0;
                 entry < (sizeof(DVPD::dvpdRecords)/
                          sizeof(DVPD::dvpdRecords[0]));
                 entry++ )
            {
                if( !(DVPD::dvpdRecords[entry].record >= prevRecord) )
                {
                    fails++;
                    TS_FAIL( "testDvpdCheckStructOrder() - Record table out of "
                             "order! Cur Record: 0x%04x, Prev Record: 0x%04x",
                             DVPD::dvpdRecords[entry].record,
                             prevRecord );
                }
                prevRecord = DVPD::dvpdRecords[entry].record;
            }

            // Check the dvpdKeywords structure for proper order
            for( entry = 0;
                 entry < (sizeof(DVPD::dvpdKeywords)/
                          sizeof(DVPD::dvpdKeywords[0]));
                 entry++ )
            {
                if( !(DVPD::dvpdKeywords[entry].keyword >= prevKeyword) )
                {
                    fails++;
                    TS_FAIL( "testDvpdCheckStructOrder() - "
       "Keyword table out of order! Cur Keyword: 0x%04x, Prev Keyword: 0x%04x",
                             DVPD::dvpdKeywords[entry].keyword,
                             prevKeyword );
                }
                prevKeyword = DVPD::dvpdKeywords[entry].keyword;
            }

            TRACFCOMP( g_trac_vpd,
                       "testDvpdCheckStructOrder - %d fails",
                       fails );
        }

        DVPDTest() : CxxTest::TestSuite()
        {
            TRACFCOMP( g_trac_vpd, "Starting DVPDTest" );
#if (defined CONFIG_SECUREBOOT && ! defined CONFIG_AXONE)
#ifndef __HOSTBOOT_RUNTIME
            errlHndl_t l_err = loadSecureSection(PNOR::MEMD);
            if(l_err)
            {
                TS_FAIL( "DVPDTest : loadSecureSection" );
                delete l_err;
            }
#endif
#endif
        }

        ~DVPDTest()
        {
#if (defined CONFIG_SECUREBOOT && ! defined CONFIG_AXONE)
#ifndef __HOSTBOOT_RUNTIME
            errlHndl_t l_err = unloadSecureSection(PNOR::MEMD);
            TRACFCOMP( g_trac_vpd, "Ending DVPDTest" );
            if(l_err)
            {
                TS_FAIL( "DVPDTest : unloadSecureSection" );
                delete l_err;
            }
#endif
#endif
        }
};

#endif
OpenPOWER on IntegriCloud