From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: devel@edk2.groups.io, wei6.xu@intel.com
Cc: Michael D Kinney <michael.d.kinney@intel.com>,
Liming Gao <liming.gao@intel.com>
Subject: Re: [edk2-devel][Patch 1/3] MdePkg/UefiDebugLibConOut: Add destructor to CloseEvent
Date: Mon, 29 Jul 2019 16:38:59 +0200 [thread overview]
Message-ID: <a73d8c7b-3201-e9b8-9eb1-e0abfabbe738@redhat.com> (raw)
In-Reply-To: <20190726031055.10020-2-wei6.xu@intel.com>
Hi,
On 7/26/19 5:10 AM, Xu, Wei6 wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2012
>
> When driver is unloaded, the ExitBootSerivesEvent must be closed at
> the same time. Otherwise exception will occur when ExitBootServices.
>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
> ---
> .../UefiDebugLibConOut/DebugLibConstructor.c | 23 ++++++++++++++++++++++
> .../UefiDebugLibConOut/UefiDebugLibConOut.inf | 1 +
> 2 files changed, 24 insertions(+)
>
> diff --git a/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c b/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c
> index 8005370372..ed73f92818 100644
> --- a/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c
> +++ b/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c
> @@ -73,5 +73,28 @@ DxeDebugLibConstructor(
> &mExitBootServicesEvent
> );
>
> return EFI_SUCCESS;
> }
> +
> +/**
> + The destructor closes Exit Boot Services Event.
> +
> + @param ImageHandle The firmware allocated handle for the EFI image.
> + @param SystemTable A pointer to the EFI System Table.
> +
> + @retval EFI_SUCCESS The destructor always returns EFI_SUCCESS.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +DxeDebugLibDestructor(
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE *SystemTable
> + )
> +{
> + if (mExitBootServicesEvent != NULL) {
> + SystemTable->BootServices->CloseEvent (mExitBootServicesEvent);
> + }
Is it OK to let mDebugST (pointer to SystemTable) initialized?
> +
> + return EFI_SUCCESS;
> +}
> diff --git a/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf b/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
> index 4c279a5bf2..b577d52ac6 100644
> --- a/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
> +++ b/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
> @@ -20,10 +20,11 @@
> MODULE_TYPE = UEFI_DRIVER
> VERSION_STRING = 1.0
> LIBRARY_CLASS = DebugLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_APPLICATION UEFI_DRIVER
>
> CONSTRUCTOR = DxeDebugLibConstructor
> + DESTRUCTOR = DxeDebugLibDestructor
>
> #
> # VALID_ARCHITECTURES = IA32 X64 EBC
> #
>
>
next prev parent reply other threads:[~2019-07-29 14:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-26 3:10 [edk2-devel][Patch 0/3] Add destructor to CloseEvent Xu, Wei6
2019-07-26 3:10 ` [edk2-devel][Patch 1/3] MdePkg/UefiDebugLibConOut: " Xu, Wei6
2019-07-29 14:38 ` Philippe Mathieu-Daudé [this message]
2019-07-29 16:09 ` Laszlo Ersek
2019-07-29 17:48 ` Philippe Mathieu-Daudé
2019-07-30 1:17 ` Liming Gao
2019-07-26 3:10 ` [edk2-devel][Patch 2/3] MdePkg/UefiDebugLibDebugPortProtocol: " Xu, Wei6
2019-07-26 3:10 ` [edk2-devel][Patch 3/3] MdePkg/UefiDebugLibStdErr: " Xu, Wei6
2019-07-26 8:28 ` [edk2-devel][Patch 0/3] " Liming Gao
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=a73d8c7b-3201-e9b8-9eb1-e0abfabbe738@redhat.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