<tt><font size=2>"Kevin O'Connor" <kevin@koconnor.net>
wrote on 02/01/2016 04:54:53 PM:<br><br>> From: "Kevin O'Connor" <kevin@koconnor.net></font></tt><br><tt><font size=2>> To: Stefan Berger/Watson/IBM@IBMUS</font></tt><br><tt><font size=2>> Cc: seabios@seabios.org, Stefan Berger <stefanb@linux.vnet.ibm.com></font></tt><br><tt><font size=2>> Date: 02/01/2016 04:55 PM</font></tt><br><tt><font size=2>> Subject: Re: [PATCH v2 03/10] tpm: Prepare code
for TPM 2 functions</font></tt><br><tt><font size=2>> <br>> On Fri, Jan 22, 2016 at 05:47:13PM -0500, Stefan Berger wrote:<br>> > From: Stefan Berger <stefanb@linux.vnet.ibm.com><br>> > <br>> > This patch prepares the tcgbios.c file for extension with TPM
2<br>> > specific code by:<br>> > <br>> > o prefixing all TPM 1.2 specific functions with tpm12_<br>> > o where necessary, introduce switch statements in tpm_
- prefixedfunctions;<br>> > here we branch into TPM versions specific code<br>> > o introduce tpm_ - prefixed functions where necessary;
mostly in those<br>> > cases where tpm12_ functions are too large and where
the tpm_ function<br>> > then only holds the switch statement<br>> > o leave FIXMEs where we need to write TPM 2 specific code;
<br>> subsequent patches<br>> > will replace those FIXMEs<br>> > <br>> > Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com><br>> > ---<br>> > src/tcgbios.c | 311 ++++++++++++++++++++++++++++++++++++<br>> +---------------------<br>> > 1 file changed, 199 insertions(+), 112 deletions(-)<br>> > <br>> > diff --git a/src/tcgbios.c b/src/tcgbios.c<br>> > index 799a8bf..7f314b7 100644<br>> > --- a/src/tcgbios.c<br>> > +++ b/src/tcgbios.c<br>> > @@ -171,7 +171,15 @@ tpm_is_working(void)<br>> > int<br>> > tpm_can_show_menu(void)<br>> > {<br>> > - return tpm_is_working() && TPM_has_physical_presence;<br>> > + switch (TPM_version) {<br>> > + case TPM_VERSION_NONE:<br>> > + return 0;<br>> <br>> I find these "case TPM_VERSION_NONE:" clauses to be a little<br>> confusing, both in this patches and the later patches, because I don't<br>> think any of these additional code paths are reachable. I think
it<br>> would be better to just have the branches that are active (ie, v1.2<br>> and v2).</font></tt><br><br><br><tt><font size=2>I know. The 'enum' forced this. So I'll remove these
then and make TPM_VERSION_NONE etc. individual #define's.</font></tt><br><br><tt><font size=2> Stefan</font></tt><br><BR>