summaryrefslogtreecommitdiffstats
path: root/src/usr/isteps/istep06/call_host_update_master_tpm.C
blob: fa374f279adc672a8d21fd5f12ad2e9f3877f3f1 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/isteps/istep06/call_host_update_master_tpm.C $        */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2015,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                                                     */

#include <stdint.h>
#include <trace/interface.H>
#include <errl/errlentry.H>
#include <errl/errlmanager.H>
#include <isteps/hwpisteperror.H>
#include <trustedbootif.H>
#include <initservice/isteps_trace.H>
#include <secureboot/service.H>
#include <secureboot/phys_presence_if.H>
#include <config.h>

namespace ISTEP_06
{

void* call_host_update_master_tpm( void *io_pArgs )
{
    ISTEP_ERROR::IStepError l_stepError;

    TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
               "call_host_update_master_tpm entry" );

    errlHndl_t l_err = nullptr;

    (void)SECUREBOOT::logPlatformSecurityConfiguration();

#ifdef CONFIG_TPMDD
    // Initialize the master TPM
    l_err = (errlHndl_t)TRUSTEDBOOT::host_update_master_tpm(io_pArgs);
    if (l_err)
    {
        l_stepError.addErrorDetails(l_err);
        ERRORLOG::errlCommit( l_err, TRBOOT_COMP_ID );
    }
#endif

    l_err = SECUREBOOT::traceSecuritySettings(true);
    if (l_err)
    {
        TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
                   "call_host_update_master_tpm: Error back from "
                   "SECUREBOOT::traceSecuritySettings: rc=0x%X, plid=0x%X",
                   ERRL_GETRC_SAFE(l_err), ERRL_GETPLID_SAFE(l_err));
        l_stepError.addErrorDetails(l_err);
        ERRORLOG::errlCommit( l_err, SECURE_COMP_ID );
    }

    // Check for Physical Presence
#ifdef CONFIG_PHYS_PRES_PWR_BUTTON
    l_err = SECUREBOOT::detectPhysPresence();
    if (l_err)
    {
        // @TODO RTC 210301 - Handle Error Log Correctly, but for now
        // just delete it
        TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
                   "call_host_update_master_tpm: Error back from "
                   "SECUREBOOT::detectPhysPresence: rc=0x%X, plid=0x%X. "
                   "Deleting error for now",
                   ERRL_GETRC_SAFE(l_err), ERRL_GETPLID_SAFE(l_err));
        delete l_err;
        l_err = nullptr;
    }
#endif

    TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
               "call_host_update_master_tpm exit" );
    return l_stepError.getErrorHandle();


}

};
OpenPOWER on IntegriCloud