2 * HMP commands related to TPM
4 * This work is licensed under the terms of the GNU GPL, version 2 or
5 * (at your option) any later version.
8 #include "qemu/osdep.h"
9 #include "qapi/qapi-commands-tpm.h"
10 #include "monitor/monitor.h"
11 #include "monitor/hmp.h"
12 #include "qapi/error.h"
14 void hmp_info_tpm(Monitor
*mon
, const QDict
*qdict
)
17 TPMInfoList
*info_list
, *info
;
20 TPMPassthroughOptions
*tpo
;
21 TPMEmulatorOptions
*teo
;
23 info_list
= qmp_query_tpm(&err
);
25 monitor_printf(mon
, "TPM device not supported\n");
31 monitor_printf(mon
, "TPM device:\n");
34 for (info
= info_list
; info
; info
= info
->next
) {
35 TPMInfo
*ti
= info
->value
;
36 monitor_printf(mon
, " tpm%d: model=%s\n",
37 c
, TpmModel_str(ti
->model
));
39 monitor_printf(mon
, " \\ %s: type=%s",
40 ti
->id
, TpmType_str(ti
->options
->type
));
42 switch (ti
->options
->type
) {
43 case TPM_TYPE_PASSTHROUGH
:
44 tpo
= ti
->options
->u
.passthrough
.data
;
45 monitor_printf(mon
, "%s%s%s%s",
46 tpo
->path
? ",path=" : "",
48 tpo
->cancel_path
? ",cancel-path=" : "",
49 tpo
->cancel_path
?: "");
51 case TPM_TYPE_EMULATOR
:
52 teo
= ti
->options
->u
.emulator
.data
;
53 monitor_printf(mon
, ",chardev=%s", teo
->chardev
);
58 monitor_printf(mon
, "\n");
61 qapi_free_TPMInfoList(info_list
);
63 monitor_printf(mon
, "TPM device not supported\n");
64 #endif /* CONFIG_TPM */