summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/test/prdfsimFspSyncSvc.C
blob: 06b4d9d1885cc746365f67fdde6bdc49e0083555 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/diag/prdf/test/prdfsimFspSyncSvc.C $                  */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2013,2015                        */
/* [+] 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                                                     */

#include <prdfsimFspSyncSvc.H>
#include <prdfMfgThresholdMgr.H>
#include <prdfsimFspMfgThresholdFile.H>
#include <prdfAssert.h>
#include <prdfEnums.H>
#include <prdfErrlUtil.H>
#include <prdfPfa5Data.h>

namespace PRDF
{

/****************************/
// SimFspSyncSvc begin
/****************************/

SimFspSyncSvc& getSyncSvc()
{
    return PRDF_GET_SINGLETON(theSyncSvc);
}

void SimFspSyncSvc::processRequestMsg(msg_t * i_msg)
{
    #define FUNC "[SimFspSyncSvc::processRequestMsg]"
    PRDF_ENTER(FUNC);

    PRDF_ASSERT(NULL != i_msg);

    errlHndl_t pError = NULL;

    switch(i_msg->type)
    {
        case MFG_TRACE_SYNC_TO_FSP:
            pError = processMfgTrace(i_msg);
            if(NULL != pError)
            {
                PRDF_ERR(FUNC" processMfgTrace returned error");
                PRDF_COMMIT_ERRL(pError, ERRL_ACTION_REPORT);
            }
            break;

        default:
            PRDF_ERR(FUNC" Invalid Message Type received from HB :"
                 "[0x%08X]", i_msg->type);
    }

    PRDF_EXIT(FUNC);
    #undef FUNC
}

errlHndl_t SimFspSyncSvc::processMfgTrace(msg_t *i_msg) const
{
    #define PRDF_FUNC "[SimFspSyncSvc::processMfgTrace]"
    PRDF_ENTER(PRDF_FUNC);

    errlHndl_t l_errLog = NULL;
    uint8_t l_mruListCount = 0;
    uint8_t  *l_extraData = NULL;

    do
    {
        l_extraData = reinterpret_cast <uint8_t *> (i_msg->extra_data);

        l_mruListCount = (i_msg->data[1] / sizeof(PfaMruListStruct));

        if(l_mruListCount > MruListLIMIT)
        {
            PRDF_ERR(PRDF_FUNC "Invalid MRU count: %d received from Hostboot"
                               " max expected count is: %d",
                               l_mruListCount, MruListLIMIT);

            /*@
             * @errortype
             * @refcode    LIC_REFCODE
             * @subsys     EPUB_FIRMWARE_SP
             * @reasoncode PRDF_INVALID_CONFIG
             *
             * @moduleid   PRDF_SYNC_SVC
             * @userdata1  MRU List Count
             * @userdata2  Max MRU Count
             * @userdata3  Line number in file
             * @devdesc    Received invalid MRU count in
             *             MnfgTrace message from Hostboot
             */
            PRDF_CREATE_ERRL(l_errLog,
                             ERRL_SEV_INFORMATIONAL,
                             ERRL_ETYPE_NOT_APPLICABLE,
                             SRCI_ERR_INFO,
                             SRCI_NO_ATTR,
                             PRDF_SYNC_SVC,
                             LIC_REFCODE,
                             PRDF_INVALID_CONFIG,
                             l_mruListCount,
                             MruListLIMIT,
                             __LINE__, 0);
            break;
        }

        if(NULL != l_extraData)
        {
            free(l_extraData);
        }

    }while(0);

    return l_errLog;
    #undef PRDF_FUNC
}

/****************************/
// SimFspSyncSvc end
/****************************/

} // end namespace PRDF

OpenPOWER on IntegriCloud