summaryrefslogtreecommitdiffstats
path: root/src/usr/sbeio/runtime/sbeio_attr_override.C
blob: ee5770001a7746cf08b3effc91196d773e5f9086 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/sbeio/runtime/sbeio_attr_override.C $                 */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 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                                                     */
#include <sbeio/runtime/sbeio_attr_override.H>

#include <runtime/interface.h>
#include <sbeio/sbeioreasoncodes.H>

extern trace_desc_t* g_trac_sbeio;

using namespace ERRORLOG;

namespace SBE_MSG
{

//-------------------------------------------------------------------------
errlHndl_t sbeApplyAttrOverrides(
                                 TARGETING::TargetHandle_t i_procTgt,
                                 uint32_t   i_reqDataSize,
                                 uint8_t  * i_reqData,
                                 uint32_t * o_rspStatus,
                                 uint32_t * o_rspDataSize,
                                 uint8_t  * o_rspData
                                )
{
    errlHndl_t errl{};

    do
    {
        *o_rspDataSize = 0; //No return data

        runtimeInterfaces_t *rt_intf = getRuntimeInterfaces();

        if(nullptr == rt_intf)
        {
           TRACFCOMP( g_trac_sbeio,
                      ERR_MRK"sbeApplyAttrOverrides: "
                      "Unable to get runtime interfaces."
                    );

           /*@
            * @errortype
            * @moduleid     SBEIO::SBEIO_RUNTIME_ATTR_OVERRIDE
            * @reasoncode   SBEIO::SBEIO_RT_NO_INTERFACE_POINTER
            * @userdata1    Processor HUID
            * @userdata2    Reserved
            *
            * @devdesc      SBEIO RT Process Pass-through command RuntimeRT
            *                Interface pointer not set.
            * @custdesc     Firmware error communicating with boot device
            */
            errl = new ErrlEntry(ERRL_SEV_INFORMATIONAL,
                                 SBEIO::SBEIO_RUNTIME_ATTR_OVERRIDE,
                                 SBEIO::SBEIO_RT_NO_INTERFACE_POINTER,
                                 get_huid(i_procTgt),
                                 0
                                 );

            errl->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE,
                                      HWAS::SRCI_PRIORITY_HIGH);

            errl->collectTrace(SBEIO_COMP_NAME);
            break;
        }
        else if(nullptr == rt_intf->apply_attr_override)
        {
            TRACFCOMP( g_trac_sbeio,
                       ERR_MRK"sbeApplyAttrOverrides: "
                       "Function pointer to apply_attr_override not set."
                     );
            /*@
            * @errortype
            * @moduleid     SBEIO::SBEIO_RUNTIME_ATTR_OVERRIDE
            * @reasoncode   SBEIO::SBEIO_RT_NO_APPLY_ATTR_FUNCTION
            * @userdata1    Processor HUID
            * @userdata2    Reserved
            *
            * @devdesc      SBEIO RT Process Pass-through command RuntimeRT
            *               Interface pointer for apply_attr_override not set.
            * @custdesc     Firmware error communicating with boot device
            */
            errl = new ErrlEntry(ERRL_SEV_INFORMATIONAL,
                                 SBEIO::SBEIO_RUNTIME_ATTR_OVERRIDE,
                                 SBEIO::SBEIO_RT_NO_APPLY_ATTR_FUNCTION,
                                 get_huid(i_procTgt),
                                 0
                                 );

            errl->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE,
                                     HWAS::SRCI_PRIORITY_HIGH);

            errl->collectTrace(SBEIO_COMP_NAME);
            break;
        }

        //apply_attr_override will take care of handling errors it encounters.
        *o_rspStatus = rt_intf->apply_attr_override(i_reqData, i_reqDataSize);
    }
    while(0);

    return errl;
}

}//End namespace
OpenPOWER on IntegriCloud