From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 196E8AC1732 for ; Tue, 30 Jul 2024 15:08:10 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=ul/h3+xfSwgEcGJ/n9HjMFGhHIx8hc0KXY3z3gmr02M=; c=relaxed/simple; d=groups.io; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20240206; t=1722352090; v=1; b=rQ84DbxcxhX5Oosn7n8TOiR1mhHrKa8l9Oo6cmMI3PE04ic/rNTPPq4O5SMIcQ3r8K7dQ5+t 1nnj29Ee8XViRrFLyfk2s661oJvaEfQ3oI1FLPajYlGtigivimzkFxZQbrukizq65u5p4ckYrpq fLKK5D2NTRr2vO3AkzZHFzv39FH03CL9GYdUzXX1dGTH0LbtHIhRjEX2jvYIk8F4GzjtlOsLV5A +NR2T9rCzNPnZc1pXxh1HMbqOT2hEYU7LaJtbVSucqed5QpNLs47krWLxV8SbwGNHsvwJP8F0Nu WHQdFH5CYn+5wVNApthxVY8aJrtsFioRiEOQSWMdF006A== X-Received: by 127.0.0.2 with SMTP id H64tYY7687511xT9eZevNFkL; Tue, 30 Jul 2024 08:08:09 -0700 X-Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by mx.groups.io with SMTP id smtpd.web11.33579.1721904223385506603 for ; Thu, 25 Jul 2024 03:43:43 -0700 X-Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-668e964ffd9so24032257b3.3 for ; Thu, 25 Jul 2024 03:43:43 -0700 (PDT) X-Gm-Message-State: NbCdvRGT3JWxuGdKdCKBaXHtx7686176AA= X-Google-Smtp-Source: AGHT+IGct+oLrhkO2vrkyL33BLNKsAhlGc/Noez1fuyvEW6jAGhTa1x4e6+LO74yZmos6tSD0MethdwP X-Received: from palermo.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:118a]) (user=ardb job=sendgmr) by 2002:a05:6902:10c3:b0:e03:9d57:57ee with SMTP id 3f1490d57ef6-e0b2ca7171bmr14181276.4.1721904222529; Thu, 25 Jul 2024 03:43:42 -0700 (PDT) Date: Thu, 25 Jul 2024 12:43:27 +0200 In-Reply-To: <20240725104332.1675625-1-ardb+git@google.com> Mime-Version: 1.0 References: <20240725104332.1675625-1-ardb+git@google.com> Message-ID: <20240725104332.1675625-3-ardb+git@google.com> Subject: [edk2-devel] [PATCH edk2-platforms 2/5] Platform/RaspberryPi/VarBlockServiceDxe: Register for reset notification From: "Ard Biesheuvel via groups.io" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Jeremy Linton Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Tue, 30 Jul 2024 08:07:57 -0700 Resent-From: ardb+git@google.com Reply-To: devel@edk2.groups.io,ardb+git@google.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=rQ84Dbxc; dmarc=pass (policy=none) header.from=groups.io; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io From: Ard Biesheuvel In addition to setting up the home grown reset notification, register with the generic EFI protocol that does the same. This event is triggered from the reset runtime implemented in MdeModulePkg, to which we will be switching the RPi platforms in a subsequent patch. Signed-off-by: Ard Biesheuvel --- Platform/RaspberryPi/Drivers/VarBlockServiceDxe/VarBlockServiceDxe.inf | = 1 + Platform/RaspberryPi/Drivers/VarBlockServiceDxe/VarBlockServiceDxe.c | 3= 5 ++++++++++++++++++-- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/Platform/RaspberryPi/Drivers/VarBlockServiceDxe/VarBlockServic= eDxe.inf b/Platform/RaspberryPi/Drivers/VarBlockServiceDxe/VarBlockServiceD= xe.inf index c2edb25bd41d..43a2b06022c8 100644 --- a/Platform/RaspberryPi/Drivers/VarBlockServiceDxe/VarBlockServiceDxe.in= f +++ b/Platform/RaspberryPi/Drivers/VarBlockServiceDxe/VarBlockServiceDxe.in= f @@ -61,6 +61,7 @@ [Protocols] gEfiBlockIoProtocolGuid gEfiFirmwareVolumeBlockProtocolGuid # PROTOCOL SOMETIMES_PRODU= CED gEfiDevicePathProtocolGuid # PROTOCOL SOMETIMES_PRODU= CED + gEfiResetNotificationProtocolGuid =20 [FixedPcd] gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize diff --git a/Platform/RaspberryPi/Drivers/VarBlockServiceDxe/VarBlockServic= eDxe.c b/Platform/RaspberryPi/Drivers/VarBlockServiceDxe/VarBlockServiceDxe= .c index 6bd026a7b763..3aa2ec76cae7 100644 --- a/Platform/RaspberryPi/Drivers/VarBlockServiceDxe/VarBlockServiceDxe.c +++ b/Platform/RaspberryPi/Drivers/VarBlockServiceDxe/VarBlockServiceDxe.c @@ -10,6 +10,8 @@ =20 #include "VarBlockService.h" =20 +#include + // // Minimum delay to enact before reset, when variables are dirty (in =CE= =BCs). // Needed to ensure that SSD-based USB 3.0 devices have time to flush thei= r @@ -209,6 +211,19 @@ DumpVarsOnEvent ( DumpVars (); } =20 +STATIC +VOID +EFIAPI +DumpVarsOnReset ( + IN EFI_RESET_TYPE ResetType, + IN EFI_STATUS ResetStatus, + IN UINTN DataSize, + IN VOID *ResetData OPTIONAL + ) +{ + DumpVars (); +} + VOID ReadyToBootHandler ( IN EFI_EVENT Event, @@ -246,9 +261,10 @@ InstallDumpVarEventHandlers ( VOID ) { - EFI_STATUS Status; - EFI_EVENT ResetEvent; - EFI_EVENT ReadyToBootEvent; + EFI_STATUS Status; + EFI_EVENT ResetEvent; + EFI_EVENT ReadyToBootEvent; + EFI_RESET_NOTIFICATION_PROTOCOL *ResetNotify; =20 Status =3D gBS->CreateEventEx ( EVT_NOTIFY_SIGNAL, @@ -269,6 +285,19 @@ InstallDumpVarEventHandlers ( &ReadyToBootEvent ); ASSERT_EFI_ERROR (Status); + + Status =3D gBS->LocateProtocol ( + &gEfiResetNotificationProtocolGuid, + NULL, + (VOID **)&ResetNotify + ); + if (!EFI_ERROR (Status)) { + Status =3D ResetNotify->RegisterResetNotify ( + ResetNotify, + DumpVarsOnReset + ); + ASSERT_EFI_ERROR (Status); + } } =20 =20 --=20 2.46.0.rc1.232.g9752f9e123-goog -=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 (#120096): https://edk2.groups.io/g/devel/message/120096 Mute This Topic: https://groups.io/mt/107628960/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-