[edk2-devel] [PATCH v1 1/1] NetworkPkg/SnpDxe: Remove ExitBootServices event

Rabeda, Maciej maciej.rabeda at intel.com
Tue Oct 8 16:16:29 UTC 2019


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.

Signed-off-by: Maciej Rabeda <maciej.rabeda at intel.com>
Cc: Siyuan Fu <siyuan.fu at intel.com>
Cc: Jiaxin Wu <jiaxin.wu at intel.com>
---
 NetworkPkg/SnpDxe/Snp.c      | 45 --------------------
 NetworkPkg/SnpDxe/Snp.h      |  2 -
 NetworkPkg/SnpDxe/SnpDxe.inf |  3 --
 3 files changed, 50 deletions(-)

diff --git a/NetworkPkg/SnpDxe/Snp.c b/NetworkPkg/SnpDxe/Snp.c
index a23af05078bc..7646a3ce0293 100644
--- a/NetworkPkg/SnpDxe/Snp.c
+++ b/NetworkPkg/SnpDxe/Snp.c
@@ -8,31 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include "Snp.h"
 
-/**
-  One notified function to stop UNDI device when gBS->ExitBootServices() called.
-
-  @param  Event                   Pointer to this event
-  @param  Context                 Event handler private data
-
-**/
-VOID
-EFIAPI
-SnpNotifyExitBootServices (
-  EFI_EVENT Event,
-  VOID      *Context
-  )
-{
-  SNP_DRIVER             *Snp;
-
-  Snp  = (SNP_DRIVER *)Context;
-
-  //
-  // Shutdown and stop UNDI driver
-  //
-  PxeShutdown (Snp);
-  PxeStop (Snp);
-}
-
 /**
   Send command to UNDI. It does nothing currently.
 
@@ -647,21 +622,6 @@ SimpleNetworkDriverStart (
   PxeShutdown (Snp);
   PxeStop (Snp);
 
-  //
-  // Create EXIT_BOOT_SERIVES Event
-  //
-  Status = gBS->CreateEventEx (
-                  EVT_NOTIFY_SIGNAL,
-                  TPL_NOTIFY,
-                  SnpNotifyExitBootServices,
-                  Snp,
-                  &gEfiEventExitBootServicesGuid,
-                  &Snp->ExitBootServicesEvent
-                  );
-  if (EFI_ERROR (Status)) {
-    goto Error_DeleteSNP;
-  }
-
   //
   //  add SNP to the undi handle
   //
@@ -778,11 +738,6 @@ SimpleNetworkDriverStop (
     return Status;
   }
 
-  //
-  // Close EXIT_BOOT_SERIVES Event
-  //
-  gBS->CloseEvent (Snp->ExitBootServicesEvent);
-
   Status = gBS->CloseProtocol (
                   Controller,
                   &gEfiNetworkInterfaceIdentifierProtocolGuid_31,
diff --git a/NetworkPkg/SnpDxe/Snp.h b/NetworkPkg/SnpDxe/Snp.h
index e6b62930397d..f83a4f075adc 100644
--- a/NetworkPkg/SnpDxe/Snp.h
+++ b/NetworkPkg/SnpDxe/Snp.h
@@ -120,8 +120,6 @@ typedef struct {
     VOID                  *MapCookie;
   } MapList[MAX_MAP_LENGTH];
 
-  EFI_EVENT              ExitBootServicesEvent;
-
   //
   // Whether UNDI support reporting media status from GET_STATUS command,
   // i.e. PXE_STATFLAGS_GET_STATUS_NO_MEDIA_SUPPORTED or
diff --git a/NetworkPkg/SnpDxe/SnpDxe.inf b/NetworkPkg/SnpDxe/SnpDxe.inf
index afeb1526cc10..8d045cfcf4ca 100644
--- a/NetworkPkg/SnpDxe/SnpDxe.inf
+++ b/NetworkPkg/SnpDxe/SnpDxe.inf
@@ -64,9 +64,6 @@
   DebugLib
   NetLib
 
-[Guids]
-  gEfiEventExitBootServicesGuid                 ## SOMETIMES_CONSUMES ## Event
-
 [Protocols]
   gEfiSimpleNetworkProtocolGuid                 ## BY_START
   gEfiDevicePathProtocolGuid                    ## TO_START
-- 
2.17.0.windows.1

--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | 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 wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#48589): https://edk2.groups.io/g/devel/message/48589
Mute This Topic: https://groups.io/mt/34444145/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list