From nobody Sun May 5 06:34:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+48899+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+48899+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1571056652; cv=none; d=zoho.com; s=zohoarc; b=S5NjP4/WMkb/+GfzrYf9j17Y5ewSjxSSclggQN3cTpmlrq18KQ4V+FIKy1iWzWneTuM9YqhDGqbzwlRyeRyp///cxZyuCz+hKYIm6PJWSTtXERMnLPndgdqs/RrKMBjfZL1CD6VEGzuhrAtLesTrse36jgeUk/7aUKKzFGlGWPw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571056652; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=rjSN5DOHYWR7OphQffnwzXaQ9JSIi9IPRLJW7UXozFw=; b=VyNhHFGmH0PKZ4zZm1CUI9pUXB7W1rowxlaxe28hvxw5TMBGo7izszQVFt0t7ETHYxaXfz5OQVKIPg8PtrtFWlWXjDB5i4XFvpT7BfDRJhJytdxIgSOZYip6d7mNae2SK2xjl2gmuHlCVEPaib39npI+4vnMMFswwUXGk/Fo/5o= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+48899+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1571056652497960.9149898589056; Mon, 14 Oct 2019 05:37:32 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id K582YY1788612xl1OhMnJLYz; Mon, 14 Oct 2019 05:37:31 -0700 X-Received: from mga11.intel.com (mga11.intel.com []) by mx.groups.io with SMTP id smtpd.web12.2813.1571056650330826411 for ; Mon, 14 Oct 2019 05:37:31 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Oct 2019 05:37:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,295,1566889200"; d="scan'208";a="207959578" X-Received: from mrabeda-mobl.ger.corp.intel.com ([10.102.8.43]) by fmsmga001.fm.intel.com with ESMTP; 14 Oct 2019 05:37:30 -0700 From: "Rabeda, Maciej" To: devel@edk2.groups.io Cc: Siyuan Fu , Jiaxin Wu Subject: [edk2-devel] [PATCH v2 1/1] NetworkPkg/SnpDxe: Remove ExitBootServices event Date: Mon, 14 Oct 2019 14:37:28 +0200 Message-Id: <20191014123728.14252-2-maciej.rabeda@intel.com> In-Reply-To: <20191014123728.14252-1-maciej.rabeda@intel.com> References: <20191014123728.14252-1-maciej.rabeda@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,maciej.rabeda@intel.com X-Gm-Message-State: sFM4MwCHgGsnDmssJh4YxRzyx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1571056651; bh=INpfycKeZEEfhajIzReOY5CMVT5xqErSg9YTGlb05EI=; h=Cc:Date:From:Reply-To:Subject:To; b=hkjMOYI27aVURSqmTBOLyfh1kkIs/s+pOuhTKs6CQ3g3tx43puDOWBTMSs87+jE4gGt qrgCczsXOEzkyvuvCCs1MT5A0n8idt9zuUXedK9j+gduA+AIONUzAv3mQk9/5SwXp4B5W qQGV/qvuVsgyXTLzycLphQ7p1OBwI/W+zEs= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Siyuan Fu --- 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); =20 - // - // 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; + } } =20 // @@ -778,10 +780,12 @@ SimpleNetworkDriverStop ( return Status; } =20 - // - // Close EXIT_BOOT_SERIVES Event - // - gBS->CloseEvent (Snp->ExitBootServicesEvent); + if (FixedPcdGetBool (PcdSnpCreateExitBootServicesEvent)) { + // + // Close EXIT_BOOT_SERIVES Event + // + gBS->CloseEvent (Snp->ExitBootServicesEvent); + } =20 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|UINT64|0x1000000B =20 + ## Indicates whether SnpDxe driver will create an event that will be not= ified + # upon gBS->ExitBootServices() call. + # TRUE - Event being triggered upon ExitBootServices call will be created + # FALSE - Event being triggered upon ExitBootServices call will NOT be c= reated + # @Prompt Indicates whether SnpDxe creates event for ExitBootServices() = call. + gEfiNetworkPkgTokenSpaceGuid.PcdSnpCreateExitBootServicesEvent|TRUE|BOOL= EAN|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 =20 #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 =20 +[Pcd] + gEfiNetworkPkgTokenSpaceGuid.PcdSnpCreateExitBootServicesEvent ## CONS= UMES + [UserExtensions.TianoCore."ExtraFiles"] SnpDxeExtra.uni --=20 2.17.0.windows.1 -------------------------------------------------------------------- Intel Technology Poland sp. z o.o. ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydz= ial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-31= 6 | Kapital zakladowy 200.000 PLN. Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata= i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wi= adomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiek= olwiek przegladanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the s= ole use of the intended recipient(s). If you are not the intended recipient= , please contact the sender and delete all copies; any review or distributi= on by others is strictly prohibited. -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#48899): https://edk2.groups.io/g/devel/message/48899 Mute This Topic: https://groups.io/mt/34532713/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-