From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by mx.groups.io with SMTP id smtpd.web12.1561.1664823243571460287 for ; Mon, 03 Oct 2022 11:54:03 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@google.com header.s=20210112 header.b=eGXW1MuG; spf=pass (domain: flex--dionnaglaze.bounces.google.com, ip: 209.85.219.202, mailfrom: 3yi87ywskbtcwbhggtzetsxzhhzex.vhfwxoxexwdv.zkhnil.bh@flex--dionnaglaze.bounces.google.com) Received: by mail-yb1-f202.google.com with SMTP id d8-20020a25bc48000000b00680651cf051so11094010ybk.23 for ; Mon, 03 Oct 2022 11:54:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date; bh=blUbv/uZ38IgPREzoVeovnaoldAGzOc5pnUQTuh/e9s=; b=eGXW1MuGk3A3JD/NkOMM6FHSmRZQZZoklegGwlZX9ghI/cTCtFa9UrBSXSS9x60VE0 LIMSDOEBxTOQ5SbUHvKhM70Zg+FtIzSVSGZD7iWQk/8wNla5lBGqlomG2SyS4u2WQSFq HmTl7tIeGH+ZJFWw2OPWIB0QKDTfkMYqx7Hb76gcVu1anMMrUxlffSRGxftxeMZsqmJH OYKAHNg9PjrMCMX0VQsJqEGXGK5gE09lZykJt9Baop7JOdjCmCBzDgZMnfM0LDUiMcHy HZGgkQMwzSUzYE+/uOwhVOqj63rQvKxsXLCURVtXqFaqub4dN1NfNWOyPN2Y7JEvk8Bh wkPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date; bh=blUbv/uZ38IgPREzoVeovnaoldAGzOc5pnUQTuh/e9s=; b=H6o58KBZyMf7vATm2ROFG59Qnpvqcm+l+OuvSDQwuBV8UWBxW87LqxUiA5Q10AUQ5f puhnj8XsxxBN5ws4ucmqCcR5I539rPoED9O9vHsYPTIqbtzFuPo45ekuyYIWzqlRuy/l qX9NpR1fHIoio+Tm+JBh5DwYj+xAkPKGE0cJToTLPYu1ZWtcOelzjbJpciSPVTgt/D7y MLgLQDnk9ixcbXhMi7AGZqYhyLx10qtb1gZQ5p+BT+dVBEIVWpfJuMiPambkZsEV+MDI kSS/GllgrKHAFBk/arm94PoKqUUS4X2SvL5L563dBJipPlo1wAOq2EArPRNDI8dH6ynD 2NdQ== X-Gm-Message-State: ACrzQf23zT7M1QZPdNE+/dPgWrNQO1BNsiYDJGRrget0PGFzzolDUyRw +dFpcTTiwgeNj1clG+KU/fJbB6wxj7iytcW/A4+dwO1Xoal/NnNUkRAFI1GFPTX5gR+Pg543XKH DIelWRCswttitDxC5+ZvrdSPMMtVj6GeYh2J30VvNk/3nbT2QS1WgOc5J0XNoHMv/jMpIQIEz X-Google-Smtp-Source: AMsMyM7cXo1GTjzqGigueFlkVuO99fK8jbW8DWQP3/Pa9n7pY7K5IymMb5YwslLDxg4BZI3GgV+CnMwrG+AIMQ0f+A== X-Received: from dionnaglaze.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2ee6]) (user=dionnaglaze job=sendgmr) by 2002:a25:bbcc:0:b0:6a8:e269:5eec with SMTP id c12-20020a25bbcc000000b006a8e2695eecmr22255868ybk.219.1664823242747; Mon, 03 Oct 2022 11:54:02 -0700 (PDT) Date: Mon, 3 Oct 2022 18:53:47 +0000 In-Reply-To: <20221003185352.3969999-1-dionnaglaze@google.com> Mime-Version: 1.0 References: <20221003185352.3969999-1-dionnaglaze@google.com> X-Mailer: git-send-email 2.38.0.rc1.362.ged0d419d3c-goog Message-ID: <20221003185352.3969999-3-dionnaglaze@google.com> Subject: [PATCH v6 2/7] MdeModulePkg: Introduce ExitBootServicesCallbackProtocol From: "Dionna Glaze" To: devel@edk2.groups.io Cc: Dionna Glaze , Gerd Hoffmann , "Min M. Xu" , James Bottomley , Jiewen Yao , Tom Lendacky , Ard Biesheuvel , Andrew Fish , "Michael D. Kinney" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable This introduces a callback after the time that the timer is disabled and be= fore the MemoryMap is finalized. This callback is useful to make final changes to the memory map due to prot= ocols initiated (or not initiated) by the OS loader. Cc: Gerd Hoffmann Cc: "Min M. Xu" Cc: James Bottomley Cc: Jiewen Yao Cc: Tom Lendacky Cc: Ard Biesheuvel Cc: Andrew Fish Cc: "Michael D. Kinney" Signed-off-by: Dionna Glaze --- MdeModulePkg/Include/Protocol/ExitBootServicesCallback.h | 40 ++++++++++++= ++++++++ MdeModulePkg/MdeModulePkg.dec | 3 ++ 2 files changed, 43 insertions(+) diff --git a/MdeModulePkg/Include/Protocol/ExitBootServicesCallback.h b/Mde= ModulePkg/Include/Protocol/ExitBootServicesCallback.h new file mode 100644 index 0000000000..5c9f973b79 --- /dev/null +++ b/MdeModulePkg/Include/Protocol/ExitBootServicesCallback.h @@ -0,0 +1,40 @@ +/** @file + The file provides the protocol that allows callbacks in ExitBootServices + immediately before TerminateMemoryMap. + + Copyright (c) 2022, Google LLC. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent +**/ +#ifndef EXIT_BOOT_SERVICES_CALLBACK_H_ +#define EXIT_BOOT_SERVICES_CALLBACK_H_ + +/* This protocol is internal to EDK2 only */ + +#define EDKII_EXIT_BOOT_SERVICES_CALLBACK_PROTOCOL_GUID {0xf5684799, = 0x9a33, = 0x40f7, = {0xa1, 0x5c, 0x10, 0x8e, 0x0e, 0x6b, 0x45, 0x25}} + +typedef struct _EDKII_EXIT_BOOT_SERVICES_CALLBACK_PROTOCOL + EDKII_EXIT_BOOT_SERVICES_CALLBACK_PROTOCOL; + +/** + @param This A pointer to a EDKII_EXIT_BOOT_SERVICES_CALLBACK_PROTOCOL. + + The returned status may only be EFI_SUCCESS or EFI_INVALID_PARAMETER. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_TERMINATE_MEMORY_MAP_PREHOOK)( + IN EDKII_EXIT_BOOT_SERVICES_CALLBACK_PROTOCOL *This + ); + +/// +/// The EDKII_EXIT_BOOT_SERVICES_CALLBACK_PROTOCOL allows callbacks in +/// ExitBootServices immediately before TerminateMemoryMap. +/// +struct _EDKII_EXIT_BOOT_SERVICES_CALLBACK_PROTOCOL { + EDKII_TERMINATE_MEMORY_MAP_PREHOOK TerminateMemoryMapPrehook; + BOOLEAN Disabled; +}; + +extern EFI_GUID gEdkiiExitBootServicesCallbackProtocolGuid; + +#endif diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 58e6ab0048..add4e304ca 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -677,6 +677,9 @@ ## Include/Protocol/VariablePolicy.h gEdkiiVariablePolicyProtocolGuid =3D { 0x81D1675C, 0x86F6, 0x48DF, { 0xB= D, 0x95, 0x9A, 0x6E, 0x4F, 0x09, 0x25, 0xC3 } } =20 + ## Include/Protocol/ExitBootServicesCallback.h + gEdkiiExitBootServicesCallbackProtocolGuid =3D { 0xf5684799, 0x9a33, 0x4= 0f7, {0xa1, 0x5c, 0x10, 0x8e, 0x0e, 0x6b, 0x45, 0x25 }} + [PcdsFeatureFlag] ## Indicates if the platform can support update capsule across a system = reset.

# TRUE - Supports update capsule across a system reset.
--=20 2.38.0.rc1.362.ged0d419d3c-goog