public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gao, Liming" <liming.gao@intel.com>
To: "Zeng, Star" <star.zeng@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [PATCH] MdeModulePkg: Enhance the debug message for InstallProtocolInterface
Date: Wed, 21 Jun 2017 12:12:16 +0000	[thread overview]
Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14D74CDEE@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <1498023293-145392-1-git-send-email-star.zeng@intel.com>

Reviewed-by: Liming Gao <liming.gao@intel.com>

> -----Original Message-----
> From: Zeng, Star
> Sent: Wednesday, June 21, 2017 1:35 PM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star <star.zeng@intel.com>; Gao, Liming <liming.gao@intel.com>
> Subject: [PATCH] MdeModulePkg: Enhance the debug message for InstallProtocolInterface
> 
> Current code is using debug message like below for
> InstallProtocolInterface.
> InstallProtocolInterface: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX XXX
> 
> User could not know whether the installation is failed or not by the
> debug message, for example, the code below does not initialize Handle
> before calling InstallProtocolInterface, EFI_INVALID_PARAMETER will be
> returned.
>   EFI_HANDLE Handle;
>   Status = gBS->InstallProtocolInterface (
>                   &Handle,
>                   &XXX,
>                   EFI_NATIVE_INTERFACE,
>                   XXX
>                   );
> 
> This patch is to add additional debug message if the installation
> is failed and specific debug message for the case that the input
> handle is invalid.
> 
> Cc: Liming Gao <liming.gao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
>  MdeModulePkg/Core/Dxe/Hand/Handle.c  | 14 ++++++++------
>  MdeModulePkg/Core/PiSmmCore/Handle.c | 14 ++++++++------
>  2 files changed, 16 insertions(+), 12 deletions(-)
> 
> diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c b/MdeModulePkg/Core/Dxe/Hand/Handle.c
> index 1c25521672ba..59b89148c8f0 100644
> --- a/MdeModulePkg/Core/Dxe/Hand/Handle.c
> +++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c
> @@ -1,7 +1,7 @@
>  /** @file
>    UEFI handle & protocol handling.
> 
> -Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<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
> @@ -428,11 +428,12 @@ CoreInstallProtocolInterfaceNotify (
>      // in the system
>      //
>      InsertTailList (&gHandleList, &Handle->AllHandles);
> -  }
> -
> -  Status = CoreValidateHandle (Handle);
> -  if (EFI_ERROR (Status)) {
> -    goto Done;
> +  } else {
> +    Status = CoreValidateHandle (Handle);
> +    if (EFI_ERROR (Status)) {
> +      DEBUG((DEBUG_ERROR, "InstallProtocolInterface: input handle at 0x%x is invalid\n", Handle));
> +      goto Done;
> +    }
>    }
> 
>    //
> @@ -491,6 +492,7 @@ Done:
>      if (Prot != NULL) {
>        CoreFreePool (Prot);
>      }
> +    DEBUG((DEBUG_ERROR, "InstallProtocolInterface: %g %p failed with %r\n", Protocol, Interface, Status));
>    }
> 
>    return Status;
> diff --git a/MdeModulePkg/Core/PiSmmCore/Handle.c b/MdeModulePkg/Core/PiSmmCore/Handle.c
> index 9cedb2aeb5ee..19faac844414 100644
> --- a/MdeModulePkg/Core/PiSmmCore/Handle.c
> +++ b/MdeModulePkg/Core/PiSmmCore/Handle.c
> @@ -1,7 +1,7 @@
>  /** @file
>    SMM handle & protocol handling.
> 
> -  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<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
> @@ -287,11 +287,12 @@ SmmInstallProtocolInterfaceNotify (
>      // in the system
>      //
>      InsertTailList (&gHandleList, &Handle->AllHandles);
> -  }
> -
> -  Status = SmmValidateHandle (Handle);
> -  if (EFI_ERROR (Status)) {
> -    goto Done;
> +  } else {
> +    Status = SmmValidateHandle (Handle);
> +    if (EFI_ERROR (Status)) {
> +      DEBUG((DEBUG_ERROR, "SmmInstallProtocolInterface: input handle at 0x%x is invalid\n", Handle));
> +      goto Done;
> +    }
>    }
> 
>    //
> @@ -340,6 +341,7 @@ Done:
>      if (Prot != NULL) {
>        FreePool (Prot);
>      }
> +    DEBUG((DEBUG_ERROR, "SmmInstallProtocolInterface: %g %p failed with %r\n", Protocol, Interface, Status));
>    }
>    return Status;
>  }
> --
> 2.7.0.windows.1



      reply	other threads:[~2017-06-21 12:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-21  5:34 [PATCH] MdeModulePkg: Enhance the debug message for InstallProtocolInterface Star Zeng
2017-06-21 12:12 ` Gao, Liming [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A89E2EF3DFEDB4C8BFDE51014F606A14D74CDEE@shsmsx102.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox