@@ -363,11 +363,20 @@ log-base LOG-SIZE tpm-set-log-parameters
THEN
;
+: vtpm20-menu
+ tpm-is-working IF
+ tpm20-menu
+ THEN
+;
+
: vtpm-menu
tpm-get-tpm-version CASE
1 OF
vtpm12-menu
ENDOF
+ 2 OF
+ vtpm20-menu
+ ENDOF
ENDCASE
;
@@ -1547,3 +1547,38 @@ uint32_t tpm_get_tpm_version(void)
{
return TPM_version;
}
+
+void tpm20_menu(void)
+{
+ int key_code;
+ int waitkey;
+ tpm_ppi_op msgCode;
+
+ for (;;) {
+ printf("1. Clear TPM\n");
+
+ printf("\nIf not change is desired or if this menu was reached by "
+ "mistake, press ESC to\ncontinue the boot.\n");
+
+ msgCode = TPM_PPI_OP_NOOP;
+
+ waitkey = 1;
+
+ while (waitkey) {
+ key_code = SLOF_get_keystroke();
+ switch (key_code) {
+ case 27:
+ // ESC
+ return;
+ case '1':
+ msgCode = TPM_PPI_OP_CLEAR;
+ break;
+ default:
+ continue;
+ }
+
+ tpm20_process_cfg(msgCode, 0);
+ waitkey = 0;
+ }
+ }
+}
@@ -40,6 +40,7 @@ uint32_t tpm_driver_get_state(void);
uint32_t tpm_driver_get_failure_reason(void);
void tpm_driver_set_failure_reason(uint32_t errcode);
uint32_t tpm_get_tpm_version(void);
+void tpm20_menu(void);
/* flags returned by tpm_get_state */
#define TPM_STATE_ENABLED 1
@@ -223,3 +223,12 @@ PRIM(tpm_X2d_get_X2d_tpm_X2d_version)
PUSH;
TOS.n = tpm_get_tpm_version();
MIRP
+
+/*******************************************************************/
+/* Firmware API */
+/* SLOF: tpm20-menu ( -- tpm-version ) */
+/* LIBTPM: tpm20_menu() */
+/*******************************************************************/
+PRIM(tpm20_X2d_menu)
+ tpm20_menu();
+MIRP
@@ -33,3 +33,4 @@ cod(tpm-driver-get-state)
cod(tpm-driver-get-failure-reason)
cod(tpm-driver-set-failure-reason)
cod(tpm-get-tpm-version)
+cod(tpm20-menu)
Implement a TPM 2 menu with one item to be able to clear the TPM. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> --- board-qemu/slof/vtpm-sml.fs | 9 +++++++++ lib/libtpm/tcgbios.c | 35 +++++++++++++++++++++++++++++++++++ lib/libtpm/tcgbios.h | 1 + lib/libtpm/tpm.code | 9 +++++++++ lib/libtpm/tpm.in | 1 + 5 files changed, 55 insertions(+)