summaryrefslogtreecommitdiffstats
path: root/src/sbefw
diff options
context:
space:
mode:
authorSachin Gupta <sgupta2m@in.ibm.com>2018-06-15 06:25:01 -0500
committerSachin Gupta <sgupta2m@in.ibm.com>2018-06-19 01:07:39 -0400
commit5d80e1109dd59bbf00f5fd58dc5e7a960cac6346 (patch)
treef8d8d609caa7105a46d43c36d6f7f099c29ccc97 /src/sbefw
parentc7e17788930d3432f1aed55f419fc05001b9c9ad (diff)
downloadtalos-sbe-5d80e1109dd59bbf00f5fd58dc5e7a960cac6346.tar.gz
talos-sbe-5d80e1109dd59bbf00f5fd58dc5e7a960cac6346.zip
Support for greylist
In this commit support is added to parse bit mask and create data structure in sbe. Change-Id: Ia7a532de138dbd879d2bf5d54ce5d315884d0469 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/60761 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: RAJA DAS <rajadas2@in.ibm.com> Reviewed-by: Shakeeb A. Pasha B K <shakeebbk@in.ibm.com> Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com> (cherry picked from commit a2139de912b1513f0a1f0c5967aa1e6b413961b2) Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/60675
Diffstat (limited to 'src/sbefw')
-rw-r--r--src/sbefw/core/sbeSecurity.C27
-rw-r--r--src/sbefw/core/sbeSecurity.H13
2 files changed, 39 insertions, 1 deletions
diff --git a/src/sbefw/core/sbeSecurity.C b/src/sbefw/core/sbeSecurity.C
index 3e0090df..af083337 100644
--- a/src/sbefw/core/sbeSecurity.C
+++ b/src/sbefw/core/sbeSecurity.C
@@ -5,7 +5,8 @@
/* */
/* OpenPOWER sbe Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2017 */
+/* Contributors Listed Below - COPYRIGHT 2017,2018 */
+/* [+] International Business Machines Corp. */
/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
@@ -139,6 +140,30 @@ bool _is_present(const table< map_t< range_t<M1_T>, M1_U > > &table1,
#undef SBE_FUNC
}
+template <typename T1, typename T2 >
+bool _is_present(const table< map_t< T1, T2 > > &table1,
+ const T1 i_addr,
+ const T2 i_mask)
+{
+#define SBE_FUNC "SBE_SECURITY::_is_present "
+ SBE_ENTER(SBE_FUNC"Searching address/mask table");
+ bool ret = false;
+ for(size_t i = 0; i < table1.size; i++)
+ {
+ // Not using mask in table for search
+ if((table1.table[i].key == i_addr) &&
+ (( i_mask & (~table1.table[i].value)) == 0 ))
+ {
+ SBE_DEBUG(SBE_FUNC" table1:found addr[0x%x] table index[%d]",
+ i_addr, i);
+ ret = true;
+ break;
+ }
+ }
+ SBE_EXIT(SBE_FUNC);
+ return ret;
+#undef SBE_FUNC
+}
bool isAllowed(const uint32_t i_addr, accessType type)
{
bool ret = true;
diff --git a/src/sbefw/core/sbeSecurity.H b/src/sbefw/core/sbeSecurity.H
index f9aa627f..6312aefe 100644
--- a/src/sbefw/core/sbeSecurity.H
+++ b/src/sbefw/core/sbeSecurity.H
@@ -88,5 +88,18 @@ namespace SBE_SECURITY
const table< map_t<M2_T, M2_U> > &table2,
const table< T3 > &table3,
const uint32_t i_addr);
+
+ /* @brief _is_present - Look up tables to find if the given
+ * address with mask is present
+ * @param[in] table1 - table 1 - map with a range and running count
+ * @param[in] i_addr - given address to look up
+ * @param[in] mask - mask to look up
+ *
+ * @return - boolean to denote if the address in present
+ */
+ template <typename T1, typename T2 >
+ bool _is_present(const table< map_t< T1, T2 > > &table1,
+ const T1 i_addr,
+ const T2 i_mask);
}
#endif //__SBE_SECURITY_H
OpenPOWER on IntegriCloud