summaryrefslogtreecommitdiffstats
path: root/src/sbefw
diff options
context:
space:
mode:
Diffstat (limited to 'src/sbefw')
-rw-r--r--src/sbefw/sbeSecureMemRegionManager.C49
-rw-r--r--src/sbefw/sbecmdiplcontrol.C6
-rw-r--r--src/sbefw/sbeglobals.H5
3 files changed, 36 insertions, 24 deletions
diff --git a/src/sbefw/sbeSecureMemRegionManager.C b/src/sbefw/sbeSecureMemRegionManager.C
index 189ee56b..27bd0f66 100644
--- a/src/sbefw/sbeSecureMemRegionManager.C
+++ b/src/sbefw/sbeSecureMemRegionManager.C
@@ -6,6 +6,7 @@
/* OpenPOWER sbe Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2017 */
+/* [+] International Business Machines Corp. */
/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
@@ -24,6 +25,7 @@
#include "sbeSecureMemRegionManager.H"
#include "sbetrace.H"
#include "sbeutil.H"
+#include "sbeglobals.H"
#ifndef __SBEFW_SEEPROM__
@@ -154,30 +156,33 @@ sbeSecondaryResponse SBESecureMemRegionManager::isAccessAllowed(
{
#define SBE_FUNC "SBESecureMemRegionManager::isAccessAllowed"
sbeSecondaryResponse rc = SBE_SEC_OPERATION_SUCCESSFUL;
- while(i_region.size > 0)
+ if(SBE_GLOBAL->sbeFWSecurityEnabled)
{
- secureMemRegion_t foundregion = getPartialRegionSize(i_region);
- // Check if the found region has allowable access level
- // and that the region overlap is from the beginning itself
- if((i_region.mode & foundregion.mode) &&
- (i_region.startAddress == foundregion.startAddress))
+ while(i_region.size > 0)
{
- SBE_INFO(SBE_FUNC" foundRegion Mem[0x%08X%08X], size[0x%08X]",
- SBE::higher32BWord(foundregion.startAddress),
- SBE::lower32BWord(foundregion.startAddress),
- foundregion.size);
- i_region.size -= foundregion.size;
- i_region.startAddress += foundregion.size;
- }
- else
- {
- SBE_ERROR(SBE_FUNC" Non secure access to memory blocked "
- "Addr[0x%08X%08X] Size[0x%08X]",
- SBE::higher32BWord(i_region.startAddress),
- SBE::lower32BWord(i_region.startAddress),
- i_region.size);
- rc = SBE_SEC_BLACKLISTED_MEM_ACCESS;
- break;
+ secureMemRegion_t foundregion = getPartialRegionSize(i_region);
+ // Check if the found region has allowable access level
+ // and that the region overlap is from the beginning itself
+ if((i_region.mode & foundregion.mode) &&
+ (i_region.startAddress == foundregion.startAddress))
+ {
+ SBE_INFO(SBE_FUNC" foundRegion Mem[0x%08X%08X], size[0x%08X]",
+ SBE::higher32BWord(foundregion.startAddress),
+ SBE::lower32BWord(foundregion.startAddress),
+ foundregion.size);
+ i_region.size -= foundregion.size;
+ i_region.startAddress += foundregion.size;
+ }
+ else
+ {
+ SBE_ERROR(SBE_FUNC" Non secure access to memory blocked "
+ "Addr[0x%08X%08X] Size[0x%08X]",
+ SBE::higher32BWord(i_region.startAddress),
+ SBE::lower32BWord(i_region.startAddress),
+ i_region.size);
+ rc = SBE_SEC_BLACKLISTED_MEM_ACCESS;
+ break;
+ }
}
}
return rc;
diff --git a/src/sbefw/sbecmdiplcontrol.C b/src/sbefw/sbecmdiplcontrol.C
index e82713f1..28a705f3 100644
--- a/src/sbefw/sbecmdiplcontrol.C
+++ b/src/sbefw/sbecmdiplcontrol.C
@@ -39,7 +39,6 @@
#include "sbestates.H"
#include "sbecmdcntrldmt.H"
#include "sbeglobals.H"
-
// TODO Workaround
#include "plat_target_parms.H"
@@ -644,6 +643,11 @@ ReturnCode performAttrSetup( )
}
// Apply the gard records
rc = plat_ApplyGards();
+
+ // Fetch FW security status
+ FAPI_ATTR_GET(fapi2::ATTR_SECURITY_ENABLE,
+ fapi2::Target<fapi2::TARGET_TYPE_SYSTEM>(),
+ SBE_GLOBAL->sbeFWSecurityEnabled);
}while(0);
SBE_EXIT(SBE_FUNC);
return rc;
diff --git a/src/sbefw/sbeglobals.H b/src/sbefw/sbeglobals.H
index 25eac836..d7583d6f 100644
--- a/src/sbefw/sbeglobals.H
+++ b/src/sbefw/sbeglobals.H
@@ -82,6 +82,8 @@ class SBEGlobalsSingleton
sbeHostAddr_t hostFFDCAddr;
// Key Addr Pair
sbeStashMemoryPair_t sbeKeyAddrPair;
+ // SBE FW security enabled; 0 - disabled; 1 - enabled
+ uint8_t sbeFWSecurityEnabled;
////////////////////////////////////////////////////////////////
//// @brief PkThread structure for SBE Command Receiver thread
@@ -109,7 +111,8 @@ class SBEGlobalsSingleton
sbeSemCmdRecv(),
sbeSemCmdProcess(),
SBERole(SBE_ROLE_MASTER),
- sbefreq(( 133 * 1000 * 1000)/SBE::SBE_TO_NEST_FREQ_FACTOR)
+ sbefreq(( 133 * 1000 * 1000)/SBE::SBE_TO_NEST_FREQ_FACTOR),
+ sbeFWSecurityEnabled(1)
{
}
};
OpenPOWER on IntegriCloud