From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Glass Date: Fri, 10 Jan 2020 22:39:28 +1300 Subject: [PATCH V2 2/2] cmd: tpm: add a subcommand device In-Reply-To: <1578579928-21160-2-git-send-email-philippe.reynes@softathome.com> References: <1578579928-21160-1-git-send-email-philippe.reynes@softathome.com> <1578579928-21160-2-git-send-email-philippe.reynes@softathome.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Fri, 10 Jan 2020 at 03:25, Philippe Reynes wrote: > > The command tpm (and tpm2) search the tpm and use it. > On sandbox, there are two tpm (tpm 1.x and tpm 2.0). > So the command tpm and tpm2 are always executed with > the first tpm (tpm 1.x), and the command tpm2 always > fails. > > This add a subcommand device to command tpm and > command tpm2. Then the command tpm and tpm2 use > the device selected with the subcommand device. > > To be compatible with previous behaviour, if the > subcommand device is not used before a tpm (or tpm2) > command, the device 0 is selected. > > Signed-off-by: Philippe Reynes > --- > cmd/tpm-common.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++--- > cmd/tpm-user-utils.h | 1 + > cmd/tpm-v1.c | 3 ++ > cmd/tpm-v2.c | 3 ++ > 4 files changed, 80 insertions(+), 4 deletions(-) > > Changelog: > v2: > - use helper for tpm device (idea from Miquel) > - don't set tpm in the look (feedback from Miquel) > - add a comment to explain the backward code (feedback from Miquel) > Reviewed-by: Simon Glass