[SeaBIOS] [PATCH v2 5/6] Remove usage of PP_CMD_ENABLE from all but one place

Kevin O'Connor kevin at koconnor.net
Thu Jan 7 17:22:39 CET 2016


On Thu, Jan 07, 2016 at 07:55:40AM -0500, Stefan Berger wrote:
> From: Stefan Berger <stefanb at linux.vnet.ibm.com>
> 
> Remove the usage of PhysicalPresence_CMD_ENABLE from all but
> the assert_physical_presence function.
> 
> Signed-off-by: Stefan Berger <stefanb at linux.vnet.ibm.com>
> ---
>  src/tcgbios.c | 36 +++++++++---------------------------
>  1 file changed, 9 insertions(+), 27 deletions(-)
> 
> diff --git a/src/tcgbios.c b/src/tcgbios.c
> index d14468e..ccf5486 100644
> --- a/src/tcgbios.c
> +++ b/src/tcgbios.c
> @@ -38,7 +38,6 @@ static const u8 CommandFlag_TRUE[1]  = { 0x01 };
>  
>  typedef u8 tpm_ppi_code;
>  
> -
>  /****************************************************************
>   * ACPI TCPA table interface
>   ****************************************************************/
> @@ -213,16 +212,10 @@ tpm_set_failure(void)
>  {
>      dprintf(DEBUG_tcg, "TCGBIOS: TPM malfunctioning.\n");
>  
> -    /* we will try to deactivate the TPM now - ignoring all errors */
> -    tpm_send_cmd(0, TPM_ORD_PhysicalPresence,
> -                 PhysicalPresence_CMD_ENABLE,
> -                 sizeof(PhysicalPresence_CMD_ENABLE),
> -                 TPM_DURATION_TYPE_SHORT);
> -
> -    tpm_send_cmd(0, TPM_ORD_PhysicalPresence,
> -                 PhysicalPresence_PRESENT,
> -                 sizeof(PhysicalPresence_PRESENT),
> -                 TPM_DURATION_TYPE_SHORT);
> +    /*
> +     * We will try to deactivate the TPM now - ignoring all errors
> +     * Physical presence is asserted.
> +     */
>  
>      tpm_send_cmd(0, TPM_ORD_SetTempDeactivated,
>                   NULL, 0, TPM_DURATION_TYPE_SHORT);
> @@ -545,22 +538,11 @@ tpm_setup(void)
>  void
>  tpm_prepboot(void)
>  {
> -    if (!tpm_is_working())
> -        return;
> -
> -    int ret = tpm_send_check_cmd(0, TPM_ORD_PhysicalPresence,
> -                                 PhysicalPresence_CMD_ENABLE,
> -                                 sizeof(PhysicalPresence_CMD_ENABLE),
> -                                 TPM_DURATION_TYPE_SHORT);
> -    if (ret)
> -        return;
> -
> -    ret = tpm_send_check_cmd(0, TPM_ORD_PhysicalPresence,
> -                             PhysicalPresence_NOT_PRESENT_LOCK,
> -                             sizeof(PhysicalPresence_NOT_PRESENT_LOCK),
> -                             TPM_DURATION_TYPE_SHORT);
> -    if (ret)
> -        return;
> +    if (TPM_has_physical_presence)
> +        tpm_send_cmd(0, TPM_ORD_PhysicalPresence,
> +                     PhysicalPresence_NOT_PRESENT_LOCK,
> +                     sizeof(PhysicalPresence_NOT_PRESENT_LOCK),
> +                     TPM_DURATION_TYPE_SHORT);
>  
>      tpm_add_action(4, "Calling INT 19h");
>      tpm_add_event_separators();

If the call to tpm_is_working() is removed from tpm_prepboot(), then a
check for CONFIG_TCGBIOS still needs to be present (or the build may
not weed out the code on !CONFIG_TCGBIOS).

-Kevin



More information about the SeaBIOS mailing list