@@ -25,6 +25,9 @@ LOG-SIZE BUFFER: log-base
\ create /ibm,vtpm
s" ibm,vtpm" 2dup device-name device-type
+\ convey logbase and size to the C driver
+log-base LOG-SIZE tpm-set-log-parameters
+
: sml-get-allocated-size ( -- buffer-size)
vtpm-debug? IF
." Call to sml-get-allocated-size; size = 0x" LOG-SIZE . cr
@@ -39,6 +39,12 @@ struct tpm_state {
unsigned tpm_found:1;
unsigned tpm_working:1;
unsigned has_physical_presence:1;
+
+ /* base address of the log area */
+ uint8_t *log_base;
+
+ /* size of the logging area */
+ uint32_t log_area_size;
};
static struct tpm_state tpm_state;
@@ -269,3 +275,15 @@ uint32_t tpm_unassert_physical_presence(void)
return 0;
}
+
+/****************************************************************
+ * Forth interface
+ ****************************************************************/
+
+void tpm_set_log_parameters(void *addr, unsigned int size)
+{
+ dprintf("Log is at 0x%llx; size is %u bytes\n",
+ (uint64_t)addr, size);
+ tpm_state.log_base = addr;
+ tpm_state.log_area_size = size;
+}
@@ -18,5 +18,6 @@
uint32_t tpm_start(void);
void tpm_finalize(void);
uint32_t tpm_unassert_physical_presence(void);
+void tpm_set_log_parameters(void *address, unsigned int size);
#endif /* TCGBIOS_H */
@@ -44,3 +44,14 @@ PRIM(tpm_X2d_unassert_X2d_physical_X2d_presence)
PUSH;
TOS.n = tpm_unassert_physical_presence();
MIRP
+
+/*************************************************************/
+/* Convey log address and size */
+/* SLOF: tpm-set-log-parameters ( addr size -- ) */
+/* LIBTPM: tpm_set_log_parameters(void *addr, uint64_t size) */
+/*************************************************************/
+PRIM(tpm_X2d_set_X2d_log_X2d_parameters)
+ int size = TOS.u; POP;
+ void *addr = TOS.a; POP;
+ tpm_set_log_parameters(addr, size);
+MIRP
@@ -16,3 +16,4 @@
cod(tpm-start)
cod(tpm-finalize)
cod(tpm-unassert-physical-presence)
+cod(tpm-set-log-parameters)