[Skiboot] [PATCH v5 05/20] secvar: change backend hook interface to take in bank references
Eric Richter
erichte at linux.ibm.com
Sat Jun 13 06:24:59 AEST 2020
From: Nayna Jain <nayna at linux.ibm.com>
Previously, backends were implicitly expected to operate on global
references to the variable and update banks. This patch changes the
interface for this driver to instead take the banks in as an argument.
This removes the implict dependency on these references, makes the
design consistent with the storage driver, and also will simplify unit
testing of these functions.
Signed-off-by: Nayna Jain <nayna at linux.ibm.com>
Signed-off-by: Eric Richter <erichte at linux.ibm.com>
---
V5:
- adjusted comments so they don't blow way past the column limit
include/secvar.h | 22 +++++++++++++++++-----
libstb/secvar/secvar_main.c | 6 +++---
2 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/include/secvar.h b/include/secvar.h
index 76525534..db103953 100644
--- a/include/secvar.h
+++ b/include/secvar.h
@@ -17,11 +17,23 @@ struct secvar_storage_driver {
};
struct secvar_backend_driver {
- int (*pre_process)(void); // Perform any pre-processing stuff (e.g. determine secure boot state)
- int (*process)(void); // Process all updates
- int (*post_process)(void); // Perform any post-processing stuff (e.g. derive/update variables)
- int (*validate)(struct secvar *var); // Validate a single variable, return boolean
- const char *compatible; // String to use for compatible in secvar node
+ /* Perform any pre-processing stuff (e.g. determine secure boot state) */
+ int (*pre_process)(struct list_head *variable_bank,
+ struct list_head *update_bank);
+
+ /* Process all updates */
+ int (*process)(struct list_head *variable_bank,
+ struct list_head *update_bank);
+
+ /* Perform any post-processing stuff (e.g. derive/update variables)*/
+ int (*post_process)(struct list_head *variable_bank,
+ struct list_head *update_bank);
+
+ /* Validate a single variable, return boolean */
+ int (*validate)(struct secvar *var);
+
+ /* String to use for compatible in secvar node */
+ const char *compatible;
};
diff --git a/libstb/secvar/secvar_main.c b/libstb/secvar/secvar_main.c
index d8737621..759d8ef4 100644
--- a/libstb/secvar/secvar_main.c
+++ b/libstb/secvar/secvar_main.c
@@ -65,7 +65,7 @@ int secvar_main(struct secvar_storage_driver storage_driver,
secvar_set_status("okay");
if (secvar_backend.pre_process) {
- rc = secvar_backend.pre_process();
+ rc = secvar_backend.pre_process(&variable_bank, &update_bank);
if (rc) {
prlog(PR_ERR, "Error in backend pre_process = %d\n", rc);
/* Early failure state, lock the storage */
@@ -79,7 +79,7 @@ int secvar_main(struct secvar_storage_driver storage_driver,
goto soft_fail;
/* Process variable updates from the update bank. */
- rc = secvar_backend.process();
+ rc = secvar_backend.process(&variable_bank, &update_bank);
/* Create and set the update-status device tree property */
secvar_set_update_status(rc);
@@ -109,7 +109,7 @@ int secvar_main(struct secvar_storage_driver storage_driver,
secvar_storage.lockdown();
if (secvar_backend.post_process) {
- rc = secvar_backend.post_process();
+ rc = secvar_backend.post_process(&variable_bank, &update_bank);
if (rc) {
prlog(PR_ERR, "Error in backend post_process = %d\n", rc);
goto soft_fail;
--
2.27.0
More information about the Skiboot
mailing list