From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web10.2210.1571676142669923000 for ; Mon, 21 Oct 2019 09:42:22 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: michael.d.kinney@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Oct 2019 09:42:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,324,1566889200"; d="scan'208";a="196859641" Received: from orsmsx101.amr.corp.intel.com ([10.22.225.128]) by fmsmga007.fm.intel.com with ESMTP; 21 Oct 2019 09:42:21 -0700 Received: from orsmsx113.amr.corp.intel.com ([169.254.9.28]) by ORSMSX101.amr.corp.intel.com ([169.254.8.212]) with mapi id 14.03.0439.000; Mon, 21 Oct 2019 09:42:21 -0700 From: "Michael D Kinney" To: "devel@edk2.groups.io" , "Fu, Siyuan" , "Rabeda, Maciej" , "Kinney, Michael D" CC: "Wu, Jiaxin" Subject: Re: [edk2-devel] [PATCH v2 1/1] NetworkPkg/SnpDxe: Remove ExitBootServices event Thread-Topic: [edk2-devel] [PATCH v2 1/1] NetworkPkg/SnpDxe: Remove ExitBootServices event Thread-Index: AQHVgowtsQuDhVu9WkicsV3PW5O1Xadk4mIAgAB0gPA= Date: Mon, 21 Oct 2019 16:42:20 +0000 Message-ID: References: <20191014123728.14252-1-maciej.rabeda@intel.com> <20191014123728.14252-2-maciej.rabeda@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.22.254.139] MIME-Version: 1.0 Content-Language: en-US Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable Siyuan, One comment on this patch is that the C code is using FixedPcdGetPool() instead of PcdGetBool(). The FixedPcdGetBool() is only recommended when the PCD type is guaranteed to be FixedAtBuild and the PCD value must be known at compile, with a constant value, usually to initialize fields in data structures or when the PCD value is used in assembly code. Since this PCD supports both Fixed and Patchable and is used in if statements, I recommend PcdGetBool() be used. Thanks, Mike > -----Original Message----- > From: devel@edk2.groups.io On > Behalf Of Siyuan, Fu > Sent: Sunday, October 20, 2019 7:42 PM > To: Rabeda, Maciej ; > devel@edk2.groups.io > Cc: Wu, Jiaxin > Subject: Re: [edk2-devel] [PATCH v2 1/1] > NetworkPkg/SnpDxe: Remove ExitBootServices event >=20 > Reviewed-by: Siyuan Fu >=20 > > -----Original Message----- > > From: Rabeda, Maciej > > Sent: 2019=1B$BG/=1B(B10=1B$B7n=1B(B14=1B$BF|=1B(B 20:37 > > To: devel@edk2.groups.io > > Cc: Fu, Siyuan ; Wu, Jiaxin > > > Subject: [PATCH v2 1/1] NetworkPkg/SnpDxe: Remove > ExitBootServices > > event > > > > Patch addresses Bugzilla #1972. > > During ExitBootServices stage, drivers should not > call any functions > > known to use Memory Allocation Services. One of such > functions (as per > > UEFI spec) is UNDI->Shutdown(). > > > > Since UNDI drivers during ExitBootServices phase are > expected to put > > the adapter to such a state that it will not perform > any DMA > > operations, there is no need to interface UNDI by SNP > driver during > > that phase. > > > > Finally, since ExitBootServices event notification > function in SNP > > only calls UNDI->Shutdown() and Stop() functions, > there is no need to > > create this event at all. Adding PCD to control > creation of event > > reacting to ExitBootServices() call so that systems > with UNDIs relying > > on SNP to call their Shutdown() and Stop() can still > work. > > > > Signed-off-by: Maciej Rabeda > > > Cc: Siyuan Fu > > Cc: Jiaxin Wu > > --- > > > > Notes: > > v2: > > - modified commit message > > - added PCD to control ExitBootServices() > creation event in SnpDxe > > > > NetworkPkg/SnpDxe/Snp.c | 38 +++++++++++------- > -- > > NetworkPkg/NetworkPkg.dec | 7 ++++ > > NetworkPkg/SnpDxe/Snp.h | 1 + > > NetworkPkg/SnpDxe/SnpDxe.inf | 3 ++ > > 4 files changed, 32 insertions(+), 17 deletions(-) > > > > diff --git a/NetworkPkg/SnpDxe/Snp.c > b/NetworkPkg/SnpDxe/Snp.c index > > a23af05078bc..03317ffa26f1 100644 > > --- a/NetworkPkg/SnpDxe/Snp.c > > +++ b/NetworkPkg/SnpDxe/Snp.c > > @@ -647,19 +647,21 @@ SimpleNetworkDriverStart ( > > PxeShutdown (Snp); > > PxeStop (Snp); > > > > - // > > - // Create EXIT_BOOT_SERIVES Event > > - // > > - Status =3D gBS->CreateEventEx ( > > - EVT_NOTIFY_SIGNAL, > > - TPL_NOTIFY, > > - SnpNotifyExitBootServices, > > - Snp, > > - &gEfiEventExitBootServicesGuid, > > - &Snp->ExitBootServicesEvent > > - ); > > - if (EFI_ERROR (Status)) { > > - goto Error_DeleteSNP; > > + if (FixedPcdGetBool > (PcdSnpCreateExitBootServicesEvent)) { > > + // > > + // Create EXIT_BOOT_SERIVES Event > > + // > > + Status =3D gBS->CreateEventEx ( > > + EVT_NOTIFY_SIGNAL, > > + TPL_NOTIFY, > > + SnpNotifyExitBootServices, > > + Snp, > > + &gEfiEventExitBootServicesGuid, > > + &Snp->ExitBootServicesEvent > > + ); > > + if (EFI_ERROR (Status)) { > > + goto Error_DeleteSNP; > > + } > > } > > > > // > > @@ -778,10 +780,12 @@ SimpleNetworkDriverStop ( > > return Status; > > } > > > > - // > > - // Close EXIT_BOOT_SERIVES Event > > - // > > - gBS->CloseEvent (Snp->ExitBootServicesEvent); > > + if (FixedPcdGetBool > (PcdSnpCreateExitBootServicesEvent)) { > > + // > > + // Close EXIT_BOOT_SERIVES Event > > + // > > + gBS->CloseEvent (Snp->ExitBootServicesEvent); } > > > > Status =3D gBS->CloseProtocol ( > > Controller, > > diff --git a/NetworkPkg/NetworkPkg.dec > b/NetworkPkg/NetworkPkg.dec > > index 944b1d1501c0..66e500cbeaf7 100644 > > --- a/NetworkPkg/NetworkPkg.dec > > +++ b/NetworkPkg/NetworkPkg.dec > > @@ -109,6 +109,13 @@ > > # @Prompt TFTP block size. > > > > > gEfiNetworkPkgTokenSpaceGuid.PcdTftpBlockSize|0x0|UINT6 > 4|0x1000000B > > > > + ## Indicates whether SnpDxe driver will create an > event that will > > + be > > notified > > + # upon gBS->ExitBootServices() call. > > + # TRUE - Event being triggered upon > ExitBootServices call will be > > + created # FALSE - Event being triggered upon > ExitBootServices call > > + will NOT be > > created > > + # @Prompt Indicates whether SnpDxe creates event > for > > + ExitBootServices() > > call. > > + > > > gEfiNetworkPkgTokenSpaceGuid.PcdSnpCreateExitBootServic > esEvent|TRUE| > > BOOLEAN|0x1000000C > > + > > [PcdsFixedAtBuild, PcdsPatchableInModule, > PcdsDynamic, PcdsDynamicEx] > > ## IPv6 DHCP Unique Identifier (DUID) Type > configuration (From RFCs > > 3315 and 6355). > > # 01 =3D DUID Based on Link-layer Address Plus Time > [DUID-LLT] diff > > --git a/NetworkPkg/SnpDxe/Snp.h > b/NetworkPkg/SnpDxe/Snp.h index > > e6b62930397d..4f64c525e357 100644 > > --- a/NetworkPkg/SnpDxe/Snp.h > > +++ b/NetworkPkg/SnpDxe/Snp.h > > @@ -26,6 +26,7 @@ SPDX-License-Identifier: BSD-2- > Clause-Patent > > #include #include > > > #include > > +#include > > > > #include > > #include > > diff --git a/NetworkPkg/SnpDxe/SnpDxe.inf > > b/NetworkPkg/SnpDxe/SnpDxe.inf index > afeb1526cc10..79ea789c0837 100644 > > --- a/NetworkPkg/SnpDxe/SnpDxe.inf > > +++ b/NetworkPkg/SnpDxe/SnpDxe.inf > > @@ -73,5 +73,8 @@ > > gEfiNetworkInterfaceIdentifierProtocolGuid_31 ## > TO_START > > gEfiPciIoProtocolGuid ## > TO_START > > > > +[Pcd] > > + > gEfiNetworkPkgTokenSpaceGuid.PcdSnpCreateExitBootServic > esEvent ## > > CONSUMES > > + > > [UserExtensions.TianoCore."ExtraFiles"] > > SnpDxeExtra.uni > > -- > > 2.17.0.windows.1 >=20 >=20 >=20