X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=cmd%2Ftpm-v2.c;h=e6742656f5788d7146f10b799b419e96ef29bd0e;hb=07672c478e3a6aa0ac2ddb5b05a181b1025fd759;hp=459a955d2907394cfec1df03a8c86d12af2c8f39;hpb=0cd35f392000fb0783149d9b5f66c5f2e01bcbf1;p=oweals%2Fu-boot.git diff --git a/cmd/tpm-v2.c b/cmd/tpm-v2.c index 459a955d29..e6742656f5 100644 --- a/cmd/tpm-v2.c +++ b/cmd/tpm-v2.c @@ -5,6 +5,7 @@ */ #include +#include #include #include #include @@ -12,8 +13,8 @@ #include #include "tpm-user-utils.h" -static int do_tpm2_startup(cmd_tbl_t *cmdtp, int flag, int argc, - char * const argv[]) +static int do_tpm2_startup(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) { enum tpm2_startup_types mode; struct udevice *dev; @@ -37,8 +38,8 @@ static int do_tpm2_startup(cmd_tbl_t *cmdtp, int flag, int argc, return report_return_code(tpm2_startup(dev, mode)); } -static int do_tpm2_self_test(cmd_tbl_t *cmdtp, int flag, int argc, - char * const argv[]) +static int do_tpm2_self_test(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) { enum tpm2_yes_no full_test; struct udevice *dev; @@ -62,8 +63,8 @@ static int do_tpm2_self_test(cmd_tbl_t *cmdtp, int flag, int argc, return report_return_code(tpm2_self_test(dev, full_test)); } -static int do_tpm2_clear(cmd_tbl_t *cmdtp, int flag, int argc, - char * const argv[]) +static int do_tpm2_clear(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) { u32 handle = 0; const char *pw = (argc < 3) ? NULL : argv[2]; @@ -91,8 +92,8 @@ static int do_tpm2_clear(cmd_tbl_t *cmdtp, int flag, int argc, return report_return_code(tpm2_clear(dev, handle, pw, pw_sz)); } -static int do_tpm2_pcr_extend(cmd_tbl_t *cmdtp, int flag, int argc, - char * const argv[]) +static int do_tpm2_pcr_extend(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) { struct udevice *dev; struct tpm_chip_priv *priv; @@ -122,8 +123,8 @@ static int do_tpm2_pcr_extend(cmd_tbl_t *cmdtp, int flag, int argc, return report_return_code(rc); } -static int do_tpm_pcr_read(cmd_tbl_t *cmdtp, int flag, int argc, - char * const argv[]) +static int do_tpm_pcr_read(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) { struct udevice *dev; struct tpm_chip_priv *priv; @@ -160,8 +161,8 @@ static int do_tpm_pcr_read(cmd_tbl_t *cmdtp, int flag, int argc, return report_return_code(rc); } -static int do_tpm_get_capability(cmd_tbl_t *cmdtp, int flag, int argc, - char * const argv[]) +static int do_tpm_get_capability(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) { u32 capability, property, rc; u8 *data; @@ -203,7 +204,7 @@ unmap_data: return report_return_code(rc); } -static int do_tpm_dam_reset(cmd_tbl_t *cmdtp, int flag, int argc, +static int do_tpm_dam_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { const char *pw = (argc < 2) ? NULL : argv[1]; @@ -224,7 +225,7 @@ static int do_tpm_dam_reset(cmd_tbl_t *cmdtp, int flag, int argc, return report_return_code(tpm2_dam_reset(dev, pw, pw_sz)); } -static int do_tpm_dam_parameters(cmd_tbl_t *cmdtp, int flag, int argc, +static int do_tpm_dam_parameters(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { const char *pw = (argc < 5) ? NULL : argv[4]; @@ -268,7 +269,7 @@ static int do_tpm_dam_parameters(cmd_tbl_t *cmdtp, int flag, int argc, lockout_recovery)); } -static int do_tpm_change_auth(cmd_tbl_t *cmdtp, int flag, int argc, +static int do_tpm_change_auth(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { u32 handle; @@ -304,8 +305,8 @@ static int do_tpm_change_auth(cmd_tbl_t *cmdtp, int flag, int argc, oldpw, oldpw_sz)); } -static int do_tpm_pcr_setauthpolicy(cmd_tbl_t *cmdtp, int flag, int argc, - char * const argv[]) +static int do_tpm_pcr_setauthpolicy(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) { u32 index = simple_strtoul(argv[1], NULL, 0); char *key = argv[2]; @@ -328,8 +329,8 @@ static int do_tpm_pcr_setauthpolicy(cmd_tbl_t *cmdtp, int flag, int argc, key)); } -static int do_tpm_pcr_setauthvalue(cmd_tbl_t *cmdtp, int flag, - int argc, char * const argv[]) +static int do_tpm_pcr_setauthvalue(struct cmd_tbl *cmdtp, int flag, + int argc, char *const argv[]) { u32 index = simple_strtoul(argv[1], NULL, 0); char *key = argv[2]; @@ -353,7 +354,8 @@ static int do_tpm_pcr_setauthvalue(cmd_tbl_t *cmdtp, int flag, key, key_sz)); } -static cmd_tbl_t tpm2_commands[] = { +static struct cmd_tbl tpm2_commands[] = { + U_BOOT_CMD_MKENT(device, 0, 1, do_tpm_device, "", ""), U_BOOT_CMD_MKENT(info, 0, 1, do_tpm_info, "", ""), U_BOOT_CMD_MKENT(init, 0, 1, do_tpm_init, "", ""), U_BOOT_CMD_MKENT(startup, 0, 1, do_tpm2_startup, "", ""), @@ -371,7 +373,7 @@ static cmd_tbl_t tpm2_commands[] = { do_tpm_pcr_setauthvalue, "", ""), }; -cmd_tbl_t *get_tpm2_commands(unsigned int *size) +struct cmd_tbl *get_tpm2_commands(unsigned int *size) { *size = ARRAY_SIZE(tpm2_commands); @@ -381,6 +383,8 @@ cmd_tbl_t *get_tpm2_commands(unsigned int *size) U_BOOT_CMD(tpm2, CONFIG_SYS_MAXARGS, 1, do_tpm, "Issue a TPMv2.x command", " []\n" "\n" +"device [num device]\n" +" Show all devices or set the specified device\n" "info\n" " Show information about the TPM.\n" "init\n"