Skip to content

Commit 3596466

Browse files
mabaiocchiNicholas E Bofferding
authored andcommitted
Add Physical Presence Check and Window Open Features
This commit does the following: - Adds an interface to detect if physical presence has been asserted -- This happens in istep 6 -- If the window is open to detect this, it is then closed here - Adds an interface to possibly open the window to look for physical presence -- This happens in istep 10 -- It first checks to see if the window should be opened -- If the window is opened then the system shuts down to wait for physical presence to be asserted on the next power on - Adds the necessary attributes to support and test this functionality RTC:211220 Change-Id: I05a26ebad581875a4b9f2a51eb1ca3062f36c5fb Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/84656 Reviewed-by: Ilya Smirnov <ismirno@us.ibm.com> Reviewed-by: Christopher J Engel <cjengel@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Nicholas E Bofferding <bofferdn@us.ibm.com>
1 parent eace166 commit 3596466

File tree

13 files changed

+700
-13
lines changed

13 files changed

+700
-13
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/* IBM_PROLOG_BEGIN_TAG */
2+
/* This is an automatically generated prolog. */
3+
/* */
4+
/* $Source: src/include/usr/secureboot/phys_presence_if.H $ */
5+
/* */
6+
/* OpenPOWER HostBoot Project */
7+
/* */
8+
/* Contributors Listed Below - COPYRIGHT 2019 */
9+
/* [+] International Business Machines Corp. */
10+
/* */
11+
/* */
12+
/* Licensed under the Apache License, Version 2.0 (the "License"); */
13+
/* you may not use this file except in compliance with the License. */
14+
/* You may obtain a copy of the License at */
15+
/* */
16+
/* http://www.apache.org/licenses/LICENSE-2.0 */
17+
/* */
18+
/* Unless required by applicable law or agreed to in writing, software */
19+
/* distributed under the License is distributed on an "AS IS" BASIS, */
20+
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
21+
/* implied. See the License for the specific language governing */
22+
/* permissions and limitations under the License. */
23+
/* */
24+
/* IBM_PROLOG_END_TAG */
25+
/**
26+
* @file phys_presence_if.H
27+
*
28+
* @brief Interfaces to Detect and Open Physical Presence Windows
29+
*
30+
*/
31+
#ifndef __PHYS_PRESENCE_H
32+
#define __PHYS_PRESENCE_H
33+
// -----------------------------------------------
34+
// Includes
35+
// -----------------------------------------------
36+
37+
#include <errl/errlentry.H>
38+
#include <targeting/common/commontargeting.H>
39+
#include <config.h>
40+
41+
namespace SECUREBOOT
42+
{
43+
/**
44+
* @brief Checks if the Physical Presence Window was opened and if
45+
* Physical Presence was asserted.
46+
*
47+
* @post Will ensure the window is closed at the end of the function
48+
*
49+
* @return errlHndl_t nullptr on success; non-nullptr on error.
50+
*/
51+
errlHndl_t detectPhysPresence(void);
52+
53+
/**
54+
* @brief Handle Physical Presence Window first checks to see if a physical
55+
* presence window should be opened. Then, if necessary, it sets up
56+
* the physical presence detect circuit and then shuts down the
57+
* system.
58+
*
59+
* @post If successful, this function will shutdown the system
60+
*
61+
* @return errlHndl_t nullptr on success; non-nullptr on error.
62+
*/
63+
errlHndl_t handlePhysPresenceWindow(void);
64+
65+
} // namespace SECUREBOOT
66+
67+
68+
#endif // __PHYS_PRESENCE_H

src/include/usr/secureboot/secure_reasoncodes.H

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ namespace SECUREBOOT
5353
MOD_CHECK_RISK_LEVEL_FOR_SMF = 0x13,
5454
MOD_SMF_SPLIT_SMF_MEM = 0x14,
5555

56-
// Use 0x20-0x2F range for Node Communications
56+
// Use 0x20-0x3F range for Node Communications
5757
MOD_NCDD_CHECK_FOR_ERRORS = 0x20,
5858
MOD_NCDD_WAIT_FOR_CMD_COMP = 0x21,
5959
MOD_NC_XBUS_TEST = 0x22,
@@ -70,7 +70,12 @@ namespace SECUREBOOT
7070
MOD_NC_PROCESS_SLAVE_QUOTE = 0x2D,
7171
MOD_NCT_SEND = 0x2E,
7272
MOD_NCT_RECEIVE = 0x2F,
73-
};
73+
74+
// Use 0x40-0x4F range for Physical Presence Detection
75+
MOD_PHYS_PRES_DETECT = 0x40,
76+
MOD_PHYS_PRES_OPEN_WINDOW = 0x41,
77+
78+
};
7479

7580
enum SECUREReasonCode
7681
{
@@ -123,6 +128,16 @@ namespace SECUREBOOT
123128
RC_NCT_INITIATION_MISMATCH = SECURE_COMP_ID | 0x33,
124129
RC_NCEX_NO_FUNCTIONAL_PRIMARY_TPM = SECURE_COMP_ID | 0x34,
125130

131+
// Use 0x20-0x3F range for Node Communications
132+
133+
// RC_PHYS_PRES_WINDOW_OPENED_SHUTDOWN Must have one unique use
134+
// for Shutdown path since FSP relies on it.
135+
// termination_rc
136+
RC_PHYS_PRES_WINDOW_OPENED_SHUTDOWN = SECURE_COMP_ID | 0x40,
137+
RC_PHYS_PRES_ATTR_NOT_FOUND = SECURE_COMP_ID | 0x41,
138+
RC_PHYS_PRES_WINDOW_NOT_CLOSED = SECURE_COMP_ID | 0x42,
139+
RC_PHYS_PRES_WINDOW_NOT_OPENED = SECURE_COMP_ID | 0x43,
140+
126141
// Reason codes 0xA0 - 0xEF reserved for trustedboot_reasoncodes.H
127142
};
128143

src/usr/gpio/gpio_pca9551.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848
extern trace_desc_t* g_trac_gpio;
4949

50-
// Set to TRACFCOMP to enble unit race
50+
// Set to TRACFCOMP to enable unit trace
5151
#define TRACUCOMP(args...) TRACDCOMP(args)
5252

5353
using namespace DeviceFW;

src/usr/gpio/gpiodd.C

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ errlHndl_t gpioPerformOp(DeviceFW::OperationType i_opType,
7777
gpioInfo.deviceType = va_arg( i_args, uint64_t );
7878
gpioInfo.portAddr = va_arg( i_args, uint64_t );
7979

80-
//MAB make TRACD
81-
TRACFCOMP(g_trac_gpio, ENTER_MRK"gpioPerformOp(): "
80+
TRACDCOMP(g_trac_gpio, ENTER_MRK"gpioPerformOp(): "
8281
"optype %d deviceType %d portAddr %d",
8382
i_opType, gpioInfo.deviceType, gpioInfo.portAddr);
8483

src/usr/isteps/istep06/call_host_update_master_tpm.C

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/* */
66
/* OpenPOWER HostBoot Project */
77
/* */
8-
/* Contributors Listed Below - COPYRIGHT 2015,2018 */
8+
/* Contributors Listed Below - COPYRIGHT 2015,2019 */
99
/* [+] International Business Machines Corp. */
1010
/* */
1111
/* */
@@ -31,6 +31,8 @@
3131
#include <trustedbootif.H>
3232
#include <initservice/isteps_trace.H>
3333
#include <secureboot/service.H>
34+
#include <secureboot/phys_presence_if.H>
35+
#include <config.h>
3436

3537
namespace ISTEP_06
3638
{
@@ -39,7 +41,7 @@ void* call_host_update_master_tpm( void *io_pArgs )
3941
{
4042
ISTEP_ERROR::IStepError l_stepError;
4143

42-
TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
44+
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
4345
"call_host_update_master_tpm entry" );
4446

4547
errlHndl_t l_err = nullptr;
@@ -67,10 +69,28 @@ void* call_host_update_master_tpm( void *io_pArgs )
6769
ERRORLOG::errlCommit( l_err, SECURE_COMP_ID );
6870
}
6971

70-
TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
71-
"call_host_update_master_tpm exit" );
72+
// Check for Physical Presence
73+
#ifdef CONFIG_PHYS_PRES_PWR_BUTTON
74+
l_err = SECUREBOOT::detectPhysPresence();
75+
if (l_err)
76+
{
77+
// @TODO RTC 210301 - Handle Error Log Correctly, but for now
78+
// just delete it
79+
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
80+
"call_host_update_master_tpm: Error back from "
81+
"SECUREBOOT::detectPhysPresence: rc=0x%X, plid=0x%X. "
82+
"Deleting error for now",
83+
ERRL_GETRC_SAFE(l_err), ERRL_GETPLID_SAFE(l_err));
84+
delete l_err;
85+
l_err = nullptr;
86+
}
87+
#endif
7288

89+
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
90+
"call_host_update_master_tpm exit" );
7391
return l_stepError.getErrorHandle();
92+
93+
7494
}
7595

7696
};

src/usr/isteps/istep10/call_host_update_redundant_tpm.C

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/* */
66
/* OpenPOWER HostBoot Project */
77
/* */
8-
/* Contributors Listed Below - COPYRIGHT 2015,2018 */
8+
/* Contributors Listed Below - COPYRIGHT 2015,2019 */
99
/* [+] International Business Machines Corp. */
1010
/* */
1111
/* */
@@ -40,6 +40,7 @@
4040
#include <util/algorithm.H>
4141
#include <istepHelperFuncs.H>
4242
#include <secureboot/trustedbootif.H>
43+
#include <secureboot/phys_presence_if.H>
4344

4445
namespace ISTEP_10
4546
{
@@ -50,6 +51,7 @@ void* call_host_update_redundant_tpm (void *io_pArgs)
5051
ENTER_MRK"call_host_update_redundant_tpm");
5152

5253
ISTEP_ERROR::IStepError l_istepError;
54+
5355
#ifdef CONFIG_TPMDD
5456
TARGETING::Target* l_backupTpm = nullptr;
5557

@@ -67,6 +69,26 @@ void* call_host_update_redundant_tpm (void *io_pArgs)
6769
} while(0);
6870
#endif
6971

72+
#ifdef CONFIG_PHYS_PRES_PWR_BUTTON
73+
// Check to see if a Physical Presence Window should be opened,
74+
// and if so, open it. This could result in the system being shutdown
75+
// to allow the system administrator to assert physical presence
76+
errlHndl_t l_err = nullptr;
77+
l_err = SECUREBOOT::handlePhysPresenceWindow();
78+
if (l_err)
79+
{
80+
// @TODO RTC 210301 - Handle Error Log Correctly, but for now
81+
// just delete it
82+
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
83+
"call_host_update_redundant_tpm: Error back from "
84+
"SECUREBOOT::handlePhysPresence: rc=0x%X, plid=0x%X. "
85+
"Deleting error for now",
86+
ERRL_GETRC_SAFE(l_err), ERRL_GETPLID_SAFE(l_err));
87+
delete l_err;
88+
l_err = nullptr;
89+
}
90+
#endif
91+
7092
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
7193
EXIT_MRK"call_host_update_redundant_tpm");
7294

src/usr/runtime/hdatstructs.H

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/* */
66
/* OpenPOWER HostBoot Project */
77
/* */
8-
/* Contributors Listed Below - COPYRIGHT 2012,2018 */
8+
/* Contributors Listed Below - COPYRIGHT 2012,2019 */
99
/* [+] International Business Machines Corp. */
1010
/* */
1111
/* */
@@ -453,7 +453,10 @@ typedef struct sysSecSets
453453
// NOTE: This bit is labeled "Platform Security Overrides Allowed"
454454
// in the section 6.1.1 of HDAT spec.
455455
uint16_t sbeSecBackdoor : 1;
456-
uint16_t reserved : 13;
456+
457+
// bit 3: "System Physical Presence has been asserted"
458+
uint16_t physicalPresenceAsserted : 1;
459+
uint16_t reserved : 12;
457460
} SysSecSets;
458461

459462
#endif

src/usr/runtime/populate_hbruntime.C

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1879,6 +1879,13 @@ errlHndl_t populate_hbSecurebootData ( void )
18791879
// populate security override setting
18801880
l_sysSecSets->sbeSecBackdoor = SECUREBOOT::getSbeSecurityBackdoor();
18811881

1882+
// populate "System Physical Presence has been asserted"
1883+
TARGETING::Target* sys = nullptr;
1884+
TARGETING::targetService().getTopLevelTarget( sys );
1885+
assert(sys != nullptr, "populate_hbSecurebootData() - Could not obtain top level target");
1886+
l_sysSecSets->physicalPresenceAsserted =
1887+
sys->getAttr<TARGETING::ATTR_PHYS_PRES_ASSERTED>();
1888+
18821889
// populate TPM config bits in hdat
18831890
bool tpmRequired = false;
18841891
#ifdef CONFIG_TPMDD

src/usr/secureboot/HBconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,17 @@ config TPM_NVIDX_VALIDATE
2222
depends on TPMDD
2323
help
2424
Validate TPM MFG NV Index Provisioning during IPL
25+
26+
config PHYS_PRES_PWR_BUTTON
27+
default n
28+
depends on !PHYS_PRES_JUMPER
29+
help
30+
Support asserting Physical Presence via pushing the Power Button
31+
on the system
32+
33+
config PHYS_PRES_JUMPER
34+
default n
35+
depends on !PHYS_PRES_PRW_BUTTON
36+
help
37+
Support asserting Physical Presence via a jumper on the TPM Card
38+
Currently not supported.

src/usr/secureboot/ext/makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
# OpenPOWER HostBoot Project
77
#
8-
# Contributors Listed Below - COPYRIGHT 2013,2018
8+
# Contributors Listed Below - COPYRIGHT 2013,2019
99
# [+] International Business Machines Corp.
1010
#
1111
#
@@ -30,6 +30,7 @@ PERV_HWP_PATH = $(ROOTPATH)/src/import/chips/p9/procedures/hwp/perv
3030

3131
OBJS += $(if $(CONFIG_DRTM),drtm.o)
3232
OBJS += $(if $(CONFIG_SECUREBOOT), service_ext.o)
33+
OBJS += $(if $(CONFIG_PHYS_PRES_PWR_BUTTON), phys_presence.o)
3334

3435
VPATH += $(PERV_HWP_PATH)
3536

0 commit comments

Comments
 (0)