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 3C320941AFD for ; Tue, 30 Jul 2024 15:08:23 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=rJ42m9Os/rdRLsZfR+lWVGpAN37iZ+HGwQN3atvWWk4=; 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=1722352103; v=1; b=mgFQ1uXZEShjfmlbV1x2XgGJl2gs7S+1dZw+kzUYpOqXi2T2xcJT83E2T3Aws+KzIZC/Ymxi kV3iVStRukuuAsF7QrYQ7SKm1R242oVdcfwF3OHqxGZZF+WzuSRglGhb2hz5uTng3Hm3dKvN3FF vhy+XbVx77BsthX+hOyVH8blnDq9Iglrr6B0LdY2/9yu8Gp5a4UNvMSlTBZ6TKlD4hSlXVAHc4e Pw4VMy+8u+wjL5CB5NuNsdC7AVIlLSp87FtzCMz0+K3QhyFO0mLoTKsbzZ+GMcx1zxFpTcLZRt1 BFgKoWiPo7fBsmGNKLlDs5xGht/vTYfW77O6cwmHpoClg== X-Received: by 127.0.0.2 with SMTP id ci5nYY7687511xfyEsq2cydh; Tue, 30 Jul 2024 08:08:21 -0700 X-Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) by mx.groups.io with SMTP id smtpd.web10.42103.1722199494022853611 for ; Sun, 28 Jul 2024 13:44:54 -0700 X-Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-4280b4a34c8so12649525e9.1 for ; Sun, 28 Jul 2024 13:44:53 -0700 (PDT) X-Gm-Message-State: ReelaexWEeIkXp53SML2ydu0x7686176AA= X-Google-Smtp-Source: AGHT+IHUcsS+Clla1BjD5Ur4xOYwhK+gxcYqOTekQ5J9SmEYIXuZV0hW6KjkXLbuUfBDBvm0r627oGjI X-Received: from palermo.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:118a]) (user=ardb job=sendgmr) by 2002:a05:600c:4e54:b0:426:67e0:38b with SMTP id 5b1f17b1804b1-42811e0bba1mr121965e9.3.1722199492108; Sun, 28 Jul 2024 13:44:52 -0700 (PDT) Date: Sun, 28 Jul 2024 22:44:32 +0200 In-Reply-To: <20240728204437.4064847-1-ardb+git@google.com> Mime-Version: 1.0 References: <20240728204437.4064847-1-ardb+git@google.com> Message-ID: <20240728204437.4064847-6-ardb+git@google.com> Subject: [edk2-devel] [PATCH edk2-platforms v2 5/8] 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:08:18 -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=mgFQ1uXZ; 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 Reviewed-by: Leif Lindholm --- 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 9cf5e8b0d01f..f1ecc47c7f5d 100644 --- a/Platform/RaspberryPi/Drivers/VarBlockServiceDxe/VarBlockServiceDxe.in= f +++ b/Platform/RaspberryPi/Drivers/VarBlockServiceDxe/VarBlockServiceDxe.in= f @@ -63,6 +63,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 006d4ded15e9..b18121155c01 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 @@ -211,6 +213,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, @@ -248,9 +263,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, @@ -271,6 +287,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 (#120105): https://edk2.groups.io/g/devel/message/120105 Mute This Topic: https://groups.io/mt/107628979/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-