aboutsummaryrefslogtreecommitdiff
path: root/libstb/tpm_chip.c
diff options
context:
space:
mode:
authorClaudio Carvalho <cclaudio@linux.vnet.ibm.com>2017-12-09 02:52:16 -0200
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-12-18 21:30:57 -0600
commit594c7a6ae3cccd4a7eeb5ce2c31d2f958672325c (patch)
treef710a3d8ac4bef339eb8cc23734a92f1a162a1ed /libstb/tpm_chip.c
parent4fb528b394115ff8dd832b980032d7656aece099 (diff)
downloadskiboot-594c7a6ae3cccd4a7eeb5ce2c31d2f958672325c.zip
skiboot-594c7a6ae3cccd4a7eeb5ce2c31d2f958672325c.tar.gz
skiboot-594c7a6ae3cccd4a7eeb5ce2c31d2f958672325c.tar.bz2
libstb: import stb_init() breaking it into multiple files
This imports stb_init() from stb.c, but breaking it into multiple files in order to make the code easier to read and to maintain. New files created: secureboot.c, trustedboot.c and cvc.c. The secureboot_init() in secureboot.c also initializes the hardware key hash and the hardware key hash size, which are used to call the CVC verify wrapper. These variables were initialized in the romcode_probe() function, libstb/drivers/romcode.c. The cvc_init() in cvc.c is slightly modified from what exists in stb_init(). Now it calls cvc_register() and cvc_service_register(). Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'libstb/tpm_chip.c')
-rw-r--r--libstb/tpm_chip.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/libstb/tpm_chip.c b/libstb/tpm_chip.c
index 6791f4c..988e56f 100644
--- a/libstb/tpm_chip.c
+++ b/libstb/tpm_chip.c
@@ -168,32 +168,21 @@ disable:
return STB_ERROR;
}
-void tpm_init(void)
+int tpm_init(void)
{
- if (!list_empty(&tpm_list)) {
- /**
- * @fwts-label TPMAlreadyInitialized
- * @fwts-advice TPM already initialized. Check if tpm is being
- * initialized more than once.
- */
- prlog(PR_WARNING, "TPM: tpm device(s) already initialized\n");
- return;
- }
+ if (!list_empty(&tpm_list))
+ return 0;
list_head_init(&tpm_list);
/* tpm drivers supported */
tpm_i2c_nuvoton_probe();
- if (list_empty(&tpm_list))
- /**
- * @fwts-label NoTPMRegistered
- * @fwts-advice No TPM chip has been initialized. We may not
- * have a compatible tpm driver or there is no tpm node in the
- * device tree with the expected bindings.
- */
- prlog(PR_ERR, "TPM: no tpm chip registered\n");
-
+ if (list_empty(&tpm_list)) {
+ prlog(PR_INFO, "no compatible tpm device found!");
+ return -1;
+ }
+ return 0;
}
void tpm_cleanup(void)