Reviewed by: [email protected]
> -----Original Message----- > From: edk2-devel [mailto:[email protected]] On Behalf Of > Samer El-Haj-Mahmoud > Sent: Friday, April 29, 2016 5:08 AM > To: [email protected] > Cc: Samer El-Haj-Mahmoud <[email protected]>; Zhang, Chao B > <[email protected]> > Subject: [edk2] [PATCH] SecurityPkg: Reduce TPM debug verbosity > > Reduce several DEBUG messages verbosity in TPM, especially when no TPM > HW is present > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Samer El-Haj-Mahmoud <[email protected]> > --- > SecurityPkg/Tcg/TcgPei/TcgPei.c | 3 ++- > SecurityPkg/Tcg/TcgSmm/TcgSmm.c | 3 ++- > SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c | 43 > ++++++++++++++++++++------------------- > SecurityPkg/Tcg/TrEEPei/TrEEPei.c | 5 +++-- > 4 files changed, 29 insertions(+), 25 deletions(-) > > diff --git a/SecurityPkg/Tcg/TcgPei/TcgPei.c > b/SecurityPkg/Tcg/TcgPei/TcgPei.c > index 25724a6..69eb728 100644 > --- a/SecurityPkg/Tcg/TcgPei/TcgPei.c > +++ b/SecurityPkg/Tcg/TcgPei/TcgPei.c > @@ -2,6 +2,7 @@ > Initialize TPM device and measure FVs before handing off control to DXE. > > Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.<BR> > +(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR> > This program and the accompanying materials > are licensed and made available under the terms and conditions of the BSD > License > which accompanies this distribution. The full text of the license may be > found at > @@ -753,7 +754,7 @@ PeimEntryMA ( > EFI_BOOT_MODE BootMode; > > if (!CompareGuid (PcdGetPtr(PcdTpmInstanceGuid), > &gEfiTpmDeviceInstanceTpm12Guid)){ > - DEBUG ((EFI_D_ERROR, "No TPM12 instance required!\n")); > + DEBUG ((EFI_D_INFO, "No TPM12 instance required!\n")); > return EFI_UNSUPPORTED; > } > > diff --git a/SecurityPkg/Tcg/TcgSmm/TcgSmm.c > b/SecurityPkg/Tcg/TcgSmm/TcgSmm.c > index 96fb456..981db1c 100644 > --- a/SecurityPkg/Tcg/TcgSmm/TcgSmm.c > +++ b/SecurityPkg/Tcg/TcgSmm/TcgSmm.c > @@ -9,6 +9,7 @@ > PhysicalPresenceCallback() and MemoryClearCallback() will receive > untrusted input and do some check. > > Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR> > +(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR> > This program and the accompanying materials > are licensed and made available under the terms and conditions of the BSD > License > which accompanies this distribution. The full text of the license may be > found at > @@ -426,7 +427,7 @@ InitializeTcgSmm ( > EFI_HANDLE SwHandle; > > if (!CompareGuid (PcdGetPtr(PcdTpmInstanceGuid), > &gEfiTpmDeviceInstanceTpm12Guid)){ > - DEBUG ((EFI_D_ERROR, "No TPM12 instance required!\n")); > + DEBUG ((EFI_D_INFO, "No TPM12 instance required!\n")); > return EFI_UNSUPPORTED; > } > > diff --git a/SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c > b/SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c > index dfdee04..f93c6d2 100644 > --- a/SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c > +++ b/SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c > @@ -2,6 +2,7 @@ > This module implements TrEE Protocol. > > Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.<BR> > +(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR> > This program and the accompanying materials > are licensed and made available under the terms and conditions of the BSD > License > which accompanies this distribution. The full text of the license may be > found at > @@ -212,7 +213,7 @@ InternalDumpData ( > { > UINTN Index; > for (Index = 0; Index < Size; Index++) { > - DEBUG ((EFI_D_INFO, "%02x", (UINTN)Data[Index])); > + DEBUG ((DEBUG_VERBOSE, "%02x", (UINTN)Data[Index])); > } > } > > @@ -239,15 +240,15 @@ InternalDumpHex ( > Count = Size / COLUME_SIZE; > Left = Size % COLUME_SIZE; > for (Index = 0; Index < Count; Index++) { > - DEBUG ((EFI_D_INFO, "%04x: ", Index * COLUME_SIZE)); > + DEBUG ((DEBUG_VERBOSE, "%04x: ", Index * COLUME_SIZE)); > InternalDumpData (Data + Index * COLUME_SIZE, COLUME_SIZE); > - DEBUG ((EFI_D_INFO, "\n")); > + DEBUG ((DEBUG_VERBOSE, "\n")); > } > > if (Left != 0) { > - DEBUG ((EFI_D_INFO, "%04x: ", Index * COLUME_SIZE)); > + DEBUG ((DEBUG_VERBOSE, "%04x: ", Index * COLUME_SIZE)); > InternalDumpData (Data + Index * COLUME_SIZE, Left); > - DEBUG ((EFI_D_INFO, "\n")); > + DEBUG ((DEBUG_VERBOSE, "\n")); > } > } > > @@ -392,21 +393,21 @@ DumpEventLog ( > TCG_PCR_EVENT_HDR *EventHdr; > UINTN Index; > > - DEBUG ((EFI_D_INFO, "EventLogFormat: (0x%x)\n", EventLogFormat)); > + DEBUG ((DEBUG_VERBOSE, "EventLogFormat: (0x%x)\n", > EventLogFormat)); > > switch (EventLogFormat) { > case TREE_EVENT_LOG_FORMAT_TCG_1_2: > EventHdr = (TCG_PCR_EVENT_HDR *)(UINTN)EventLogLocation; > while ((UINTN)EventHdr <= EventLogLastEntry) { > - DEBUG ((EFI_D_INFO, " Event:\n")); > - DEBUG ((EFI_D_INFO, " PCRIndex - %d\n", > EventHdr->PCRIndex)); > - DEBUG ((EFI_D_INFO, " EventType - 0x%08x\n", > EventHdr->EventType)); > - DEBUG ((EFI_D_INFO, " Digest - ")); > + DEBUG ((DEBUG_VERBOSE, " Event:\n")); > + DEBUG ((DEBUG_VERBOSE, " PCRIndex - %d\n", > EventHdr->PCRIndex)); > + DEBUG ((DEBUG_VERBOSE, " EventType - 0x%08x\n", > EventHdr->EventType)); > + DEBUG ((DEBUG_VERBOSE, " Digest - ")); > for (Index = 0; Index < sizeof(TCG_DIGEST); Index++) { > - DEBUG ((EFI_D_INFO, "%02x ", EventHdr->Digest.digest[Index])); > + DEBUG ((DEBUG_VERBOSE, "%02x ", > EventHdr->Digest.digest[Index])); > } > - DEBUG ((EFI_D_INFO, "\n")); > - DEBUG ((EFI_D_INFO, " EventSize - 0x%08x\n", > EventHdr->EventSize)); > + DEBUG ((DEBUG_VERBOSE, "\n")); > + DEBUG ((DEBUG_VERBOSE, " EventSize - 0x%08x\n", > EventHdr->EventSize)); > InternalDumpHex ((UINT8 *)(EventHdr + 1), EventHdr->EventSize); > EventHdr = (TCG_PCR_EVENT_HDR *)((UINTN)EventHdr + > sizeof(TCG_PCR_EVENT_HDR) + EventHdr->EventSize); > } > @@ -542,10 +543,10 @@ TcgCommLogEvent ( > } > > if (NewLogSize + *LogSize > MaxSize) { > - DEBUG ((EFI_D_INFO, " MaxSize - 0x%x\n", MaxSize)); > - DEBUG ((EFI_D_INFO, " NewLogSize - 0x%x\n", NewLogSize)); > - DEBUG ((EFI_D_INFO, " LogSize - 0x%x\n", *LogSize)); > - DEBUG ((EFI_D_INFO, "TcgCommLogEvent - %r\n", > EFI_OUT_OF_RESOURCES)); > + DEBUG ((DEBUG_VERBOSE, " MaxSize - 0x%x\n", MaxSize)); > + DEBUG ((DEBUG_VERBOSE, " NewLogSize - 0x%x\n", NewLogSize)); > + DEBUG ((DEBUG_VERBOSE, " LogSize - 0x%x\n", *LogSize)); > + DEBUG ((DEBUG_VERBOSE, "TcgCommLogEvent - %r\n", > EFI_OUT_OF_RESOURCES)); > return EFI_OUT_OF_RESOURCES; > } > > @@ -681,7 +682,7 @@ TcgDxeLogHashEvent ( > > RetStatus = EFI_SUCCESS; > for (Index = 0; Index < sizeof(mTreeEventInfo)/sizeof(mTreeEventInfo[0]); > Index++) { > - DEBUG ((EFI_D_INFO, " LogFormat - 0x%08x\n", > mTreeEventInfo[Index].LogFormat)); > + DEBUG ((DEBUG_VERBOSE, " LogFormat - 0x%08x\n", > mTreeEventInfo[Index].LogFormat)); > switch (mTreeEventInfo[Index].LogFormat) { > case TREE_EVENT_LOG_FORMAT_TCG_1_2: > Status = Tpm2GetDigestFromDigestList (TPM_ALG_SHA1, > DigestList, &NewEventHdr->Digest); > @@ -936,7 +937,7 @@ SetupEventLog ( > EFI_PHYSICAL_ADDRESS Lasa; > UINTN Index; > > - DEBUG ((EFI_D_INFO, "SetupEventLog\n")); > + DEBUG ((DEBUG_VERBOSE, "SetupEventLog\n")); > > // > // 1. Create Log Area > @@ -1560,7 +1561,7 @@ OnReadyToBoot ( > } > } > > - DEBUG ((EFI_D_INFO, "TPM2 TrEEDxe Measure Data when > ReadyToBoot\n")); > + DEBUG ((DEBUG_VERBOSE, "TPM2 TrEEDxe Measure Data when > ReadyToBoot\n")); > // > // Increase boot attempt counter. > // > @@ -1766,7 +1767,7 @@ DriverEntry ( > > if (CompareGuid (PcdGetPtr(PcdTpmInstanceGuid), > &gEfiTpmDeviceInstanceNoneGuid) || > CompareGuid (PcdGetPtr(PcdTpmInstanceGuid), > &gEfiTpmDeviceInstanceTpm12Guid)){ > - DEBUG ((EFI_D_ERROR, "No TPM2 instance required!\n")); > + DEBUG ((EFI_D_INFO, "No TPM2 instance required!\n")); > return EFI_UNSUPPORTED; > } > > diff --git a/SecurityPkg/Tcg/TrEEPei/TrEEPei.c > b/SecurityPkg/Tcg/TrEEPei/TrEEPei.c > index 7a17b0a..946a065 100644 > --- a/SecurityPkg/Tcg/TrEEPei/TrEEPei.c > +++ b/SecurityPkg/Tcg/TrEEPei/TrEEPei.c > @@ -2,6 +2,7 @@ > Initialize TPM2 device and measure FVs before handing off control to > DXE. > > Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR> > +(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR> > This program and the accompanying materials > are licensed and made available under the terms and conditions of the BSD > License > which accompanies this distribution. The full text of the license may be > found at > @@ -246,7 +247,7 @@ LogHashEvent ( > > RetStatus = EFI_SUCCESS; > for (Index = 0; Index < sizeof(mTreeEventInfo)/sizeof(mTreeEventInfo[0]); > Index++) { > - DEBUG ((EFI_D_INFO, " LogFormat - 0x%08x\n", > mTreeEventInfo[Index].LogFormat)); > + DEBUG ((DEBUG_VERBOSE, " LogFormat - 0x%08x\n", > mTreeEventInfo[Index].LogFormat)); > switch (mTreeEventInfo[Index].LogFormat) { > case TREE_EVENT_LOG_FORMAT_TCG_1_2: > Status = Tpm2GetDigestFromDigestList (TPM_ALG_SHA1, > DigestList, &NewEventHdr->Digest); > @@ -632,7 +633,7 @@ PeimEntryMA ( > > if (CompareGuid (PcdGetPtr(PcdTpmInstanceGuid), > &gEfiTpmDeviceInstanceNoneGuid) || > CompareGuid (PcdGetPtr(PcdTpmInstanceGuid), > &gEfiTpmDeviceInstanceTpm12Guid)){ > - DEBUG ((EFI_D_ERROR, "No TPM2 instance required!\n")); > + DEBUG ((EFI_D_INFO, "No TPM2 instance required!\n")); > return EFI_UNSUPPORTED; > } > > -- > 2.6.3.windows.1 > > _______________________________________________ > edk2-devel mailing list > [email protected] > https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

