diff options
author | Ilya Smirnov <ismirno@us.ibm.com> | 2018-11-12 08:51:33 -0600 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2019-03-01 15:20:41 -0600 |
commit | ed35e3da7c2606f6fe0930725892deae85df33b7 (patch) | |
tree | cb63a99beed07dcac836b2ce574ca07a27ce58bf /src/include/usr/secureboot/smf.H | |
parent | 8ee01af225a0ac2a6de48624dfd56a3095fb9920 (diff) | |
download | talos-hostboot-ed35e3da7c2606f6fe0930725892deae85df33b7.tar.gz talos-hostboot-ed35e3da7c2606f6fe0930725892deae85df33b7.zip |
Unit Tests For SMF Secure Mem Distribution
This change introduces the unit tests (and helper functions)
to test the SMF memory distribution algorithm.
Change-Id: I0084f869d582e96354f06ec76c3de416c9838701
RTC: 192411
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/68679
Reviewed-by: Nicholas E. Bofferding <bofferdn@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: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: Michael Baiocchi <mbaiocch@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/include/usr/secureboot/smf.H')
-rw-r--r-- | src/include/usr/secureboot/smf.H | 57 |
1 files changed, 45 insertions, 12 deletions
diff --git a/src/include/usr/secureboot/smf.H b/src/include/usr/secureboot/smf.H index c77688585..990bce09b 100644 --- a/src/include/usr/secureboot/smf.H +++ b/src/include/usr/secureboot/smf.H @@ -39,26 +39,59 @@ namespace SMF { /** - * @brief A function that destributes the requested amount of secure + * @brief A function that distributes the requested amount of secure * memory between the functional procs with memory on the system. * The memory is distributed in power-of-two chunks of 256MB * until either all memory is distributed or there are no procs - * remaining with memory available. The function returns predictive - * or informational errors in the following cases: there is no - * available memory behind the procs on the system (predictive error), - * the exact amount of secure mem allocated did not match the requested - * amount (informational error). If 0 is passed in to the function, no - * attempt at distribution occurs and the SMF mode is turned off. + * remaining with memory available. If the requested amount is not + * a power-of-two factor of 256MB, the amount of memory will be rounded + * up accordingly. The function returns predictive or informational + * errors in the following cases: there is no available memory behind the + * procs on the system (predictive error), the exact amount of secure mem + * allocated did not match the requested amount (informational error). If + * 0 is passed in to the function, no attempt at distribution occurs and + * the SMF mode is turned off. * * @param[in] i_requestedSmfMemAmtInBytes the amount of secure memory to be - * distributed (in bytes) - * among the procs on the system + * distributed (in bytes) among the procs on the system * * @return nullptr: the memory was successfully distributed as requested - * non-nullptr: a distribution error occurred (this error is never - * unrecoverable) + * non-nullptr: a distribution error occurred (the error type will + * never be unrecoverable) */ -errlHndl_t distributeSmfMem(uint64_t i_requestedSmfMemAmtInBytes); +errlHndl_t distributeSmfMem(const uint64_t i_requestedSmfMemAmtInBytes); + +/** + * @brief Function to distribute the requested amount of SMF memory between + * passed in procs with available memory. If 0 is passed in to the + * function, no attempt at distribution occurs and the SMF mode is turned + * off. Amount that are not power-of-two factors of 256MB are rounded up + * accordingly. + * + * @param[in] i_requestedSmfMemAmtInBytes the requested amount of secure memory + * to distribute between the procs (in bytes) + * + * @param[in] i_procToMemVec the vector of available procs on the system and + * the amount of memory attached to each + * + * @return nullptr: distribution was successful + * non-nullptr: an error occurred during distribution (the error type + * will never be unrecoverable) + */ +errlHndl_t distributeSmfMem(const uint64_t i_requestedSmfMemAmtInBytes, + std::vector<struct ProcToMemAssoc>& i_procToMemVec); + +/** + * @brief Helper function to return the total amount of memory available behind + * the given proc + * + * @param[in] i_proc the proc target to calculate the total memory for + * + * @pre the target must not be nullptr or the funtion will assert + * + * @return the total amount of memory, in bytes, available behind the input proc + */ +uint64_t getTotalProcMemSize(const TARGETING::Target* const i_proc); } // namespace SMF } // namespace SECUREBOOT |