@@ -57,6 +57,14 @@ LOG-SIZE BUFFER: log-base
THEN
;
+\ firmware API call
+: get-maximum-cmd-size ( -- max-size )
+ vtpm-debug? IF
+ ." Call to get-maximum-cmd-size" cr
+ THEN
+ tpm-get-maximum-cmd-size ( max-size )
+;
+
0 0 s" ibm,sml-efi-reformat-supported" property
\ firmware API call
@@ -967,6 +967,11 @@ uint32_t tpm_2hash_ext_log(uint32_t pcrindex,
return 0; // FALSE
}
+uint32_t tpm_get_maximum_cmd_size(void)
+{
+ return PAPR_VTPM_MAX_BUFFER_SIZE;
+}
+
/*
* Add an EV_ACTION measurement to the list of measurements
*/
@@ -41,5 +41,6 @@ uint32_t tpm_2hash_ext_log(uint32_t pcrindex,
uint32_t eventtype,
const char *info, uint32_t infolen,
const void *data, uint64_t datalen);
+uint32_t tpm_get_maximum_cmd_size(void);
#endif /* TCGBIOS_H */
@@ -206,3 +206,13 @@ PRIM(tpm_X2d_2hash_X2d_ext_X2d_log)
info, infolen,
data, datalen);
MIRP
+
+/****************************************************************************************/
+/* Firmware API */
+/* SLOF: tpm-get-maximum-cmd-size ( -- max-size ) */
+/* LIBTPM: maxsize = tpm-get-maximum-cmd-size */
+/****************************************************************************************/
+PRIM(tpm_X2d_get_X2d_maximum_X2d_cmd_X2d_size)
+ PUSH;
+ TOS.u = tpm_get_maximum_cmd_size();
+MIRP
@@ -30,3 +30,4 @@ cod(tpm-gpt-add-entry)
cod(tpm-measure-gpt)
cod(tpm-hash-log-extend-event-buffer)
cod(tpm-2hash-ext-log)
+cod(tpm-get-maximum-cmd-size)
Implement the firmware API call get-maximum-cmd-size that returns a TPM's maximum command size. The caller should use the size returned by this function to allocate a buffer large enough for TPM commands and also responses. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> --- board-qemu/slof/vio-vtpm-cdriver.fs | 8 ++++++++ lib/libtpm/tcgbios.c | 5 +++++ lib/libtpm/tcgbios.h | 1 + lib/libtpm/tpm.code | 10 ++++++++++ lib/libtpm/tpm.in | 1 + 5 files changed, 25 insertions(+)