summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/test/prdfTest_MfgSync.H
blob: 835c46cb10c4528cbdaab34a81e792bbe19bd691 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/diag/prdf/test/prdfTest_MfgSync.H $                   */
/*                                                                        */
/* IBM CONFIDENTIAL                                                       */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2012,2014              */
/*                                                                        */
/* p1                                                                     */
/*                                                                        */
/* Object Code Only (OCO) source materials                                */
/* Licensed Internal Code Source Materials                                */
/* IBM HostBoot Licensed Internal Code                                    */
/*                                                                        */
/* The source code for this program is not published or otherwise         */
/* divested of its trade secrets, irrespective of what has been           */
/* deposited with the U.S. Copyright Office.                              */
/*                                                                        */
/* Origin: 30                                                             */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */

#ifndef __TEST_PRDFTESTMFGSYNC_H
#define __TEST_PRDFTESTMFGSYNC_H

/**
 *  @file prdfTest_MfgSync.H
 *
 *  @brief prdf unit test
 */

#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 "prdfsimMfgSync.H"
#include <prdfErrlUtil.H>
#include <prdfMain_common.H>
#include <prdfCalloutsData.H>

using namespace PRDF;

class PrdfTest_MfgSync: public CxxTest::TestSuite
{
    public:
    void TestMfgThresSync(void)
    {
        #define PRDF_FUNC "PrdfTest_MfgThresSync"
        PRDF_ENTER(PRDF_FUNC);

        // Test 1: Test with mailbox status disabled
        getSimMfgSync().setMailBoxStatus(false);
        errlHndl_t l_err = getSimMfgSync().syncMfgThresholdFromFsp();
        if (l_err)
        {
            PRDF_ERR(PRDF_FUNC" MfgThresSync test1 failed to sync from FSP");
            PRDF_COMMIT_ERRL(l_err, ERRL_ACTION_REPORT);
            TS_FAIL(PRDF_FUNC" MfgThresSync test1 failed to sync from FSP");
        }
        else
        {
            PRDF_TRAC(PRDF_FUNC" MfgThresSync test1 is a success.");
        }

        // Test 2: Test with mailbox status enabled
        getSimMfgSync().setMailBoxStatus(true);
        l_err = getSimMfgSync().syncMfgThresholdFromFsp();
        if (l_err)
        {
            PRDF_ERR(PRDF_FUNC" MfgThresSync test2 failed to sync from FSP");
            PRDF_COMMIT_ERRL(l_err, ERRL_ACTION_REPORT);
            TS_FAIL(PRDF_FUNC" MfgThresSync test2 failed to sync from FSP");
        }
        else
        {
            PRDF_TRAC(PRDF_FUNC" MfgThresSync test2 is a success.");
        }
        PRDF_EXIT(PRDF_FUNC);
        #undef PRDF_FUNC
    }

    void TestMfgTraceSync(void)
    {
        #define PRDF_FUNC "PrdfTest_MfgTraceSync"

        PRDF_ENTER(PRDF_FUNC);
        ErrorSignature l_errSig;
        PfaData        l_pfaData;
        errlHndl_t     l_err = NULL;

        l_errSig.setChipId(0xffffffff);
        l_errSig.setRegId(0xffff);
        l_errSig.setErrCode((uint16_t)NO_PRD_ANALYSIS);

        l_pfaData.mruListCount = 1;

        l_pfaData.mruList[0].callout  = 0;
        l_pfaData.mruList[0].type     = PRDcalloutData::TYPE_TARGET;
        l_pfaData.mruList[0].priority = SRCI_PRIORITY_LOW;

        // Test 1: Test with mailbox status disabled
        getSimMfgSync().setMailBoxStatus(false);
        l_err = getSimMfgSync().syncMfgTraceToFsp(&l_errSig, l_pfaData);
        if (l_err)
        {
            PRDF_ERR(PRDF_FUNC" MfgTraceSync test1 failed to sync to FSP");
            PRDF_COMMIT_ERRL(l_err, ERRL_ACTION_REPORT);
            TS_FAIL(PRDF_FUNC" MfgTraceSync test1 failed to sync to FSP");
        }
        else
        {
            PRDF_TRAC(PRDF_FUNC" MfgTraceSync test1 is a success.");
        }

        getSimMfgSync().setMailBoxStatus(true);

        // Test 2: Test with mailbox status enabled
        l_err = getSimMfgSync().syncMfgTraceToFsp(&l_errSig, l_pfaData);
        if (l_err)
        {
            PRDF_ERR(PRDF_FUNC" MfgTraceSync test2 failed to sync to FSP");
            PRDF_COMMIT_ERRL(l_err, ERRL_ACTION_REPORT);
            TS_FAIL(PRDF_FUNC" MfgTraceSync test2 failed to sync to FSP");
        }
        else
        {
            PRDF_TRAC(PRDF_FUNC" MfgTraceSync test2 is a success.");
        }

        // Test 3: Test with mailbox status enabled and max MRU List count
        l_pfaData.mruListCount = 8;
        for(uint8_t i = 0; i < l_pfaData.mruListCount; i++)
        {
            l_pfaData.mruList[i].callout  = 0;
            l_pfaData.mruList[i].type     = PRDcalloutData::TYPE_TARGET;
            l_pfaData.mruList[i].priority = SRCI_PRIORITY_LOW;
        }

        l_err = getSimMfgSync().syncMfgTraceToFsp(&l_errSig, l_pfaData);
        if (l_err)
        {
            PRDF_TRAC(PRDF_FUNC" MfgTraceSync test3 failed to sync to FSP.");
            PRDF_COMMIT_ERRL(l_err, ERRL_ACTION_REPORT);
            TS_FAIL(PRDF_FUNC" MfgTraceSync test3 failed to sync to FSP");
        }
        else
        {
            PRDF_TRAC(PRDF_FUNC" MfgTraceSync test3 is a success.");
        }

        // Test 4: Test with mailbox status enabled and zero MRU List count
        l_pfaData.mruListCount = 0;
        l_err = getSimMfgSync().syncMfgTraceToFsp(&l_errSig, l_pfaData);
        if (l_err)
        {
            PRDF_TRAC(PRDF_FUNC" MfgTraceSync test4 failed to sync to FSP.");
            PRDF_COMMIT_ERRL(l_err, ERRL_ACTION_REPORT);
            TS_FAIL(PRDF_FUNC" MfgTraceSync test4 failed to sync to FSP");
        }
        else
        {
            PRDF_TRAC(PRDF_FUNC" MfgTraceSync test4 is a success.");
        }

        getSimMfgSync().setMailBoxStatus(false);

        PRDF_EXIT(PRDF_FUNC);
        #undef PRDF_FUNC
    }
};
#endif

OpenPOWER on IntegriCloud