From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) by mx.groups.io with SMTP id smtpd.web09.903.1664579199497912173 for ; Fri, 30 Sep 2022 16:06:39 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@google.com header.s=20210112 header.b=CHUXnLc7; spf=pass (domain: flex--dionnaglaze.bounces.google.com, ip: 209.85.215.201, mailfrom: 3fny3ywskbwkkpvuuhnshglnvvnsl.jvtklclslkrj.nyvbwz.pv@flex--dionnaglaze.bounces.google.com) Received: by mail-pg1-f201.google.com with SMTP id 126-20020a630284000000b0043942ef3ac7so3617908pgc.11 for ; Fri, 30 Sep 2022 16:06:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date; bh=ONsFOJXJa2VVxfJuDJ6yPIfui4AgT9sxWKLp6lepoUk=; b=CHUXnLc7RNDdtLbBB9gVLF57N2uF2aRGvvJIIV+kryh9PZlyo1SE4Kz/KM7ynaDHrz TVFo1Des0kv+vpFRMQYDSPGY4yK3/L+hTnlU9MfPNuOuUQ9TQX0IZCOtWnUWKth3A3F7 Pspjue3zvlkPBZU8tMfXKVkso54zgz+NNQc3somENofqR8JWzXQiUxp12tMLqeHjmVWD 3p2qzS5WuMZggDvFxmGVLSTWoPrHzDVUN3zlzkMardWd/bSaggStZW4CmBaRdc6dxWF1 7TfVWQa+eXfl+L0AUs55CAhcGEdvTBM1Mg8LLpX9EmMXQGqpf+m7n78OB4v7kFhtwHPk PpYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date; bh=ONsFOJXJa2VVxfJuDJ6yPIfui4AgT9sxWKLp6lepoUk=; b=uXeMOfBLlerODewugXiTiva4minN/Bw0mvNb8TqGls6BcAlCK3n/qCITVBR3fTsSAE MT9UJnm7wlsbFqcW/RZ4oOEyVyXvSBfNWsqB2JTwUt12SMemcMtfB1uHCFdNuv7XuEzi nbptL7wGYFB16I1K3uOr8JQKYxRB33b9jWyUnCj0UPcah256NKU1H32TGqPdiN2eXPBE wr0557v71kpmlpGQvzwB5fuMWdYot+XXRChtkG9PjuJBjPmpjitWFkdQsQy9r/MJOhDL cNmpjQ1mnaExI2oVR8uT6wSkQvFB2zTU6m7K5n+tOznaUOjVcpgfkcWrrNf2bKW37gj0 MTww== X-Gm-Message-State: ACrzQf2+oTq1Tn3MIWwjvMrXx8GyeLYKI+oztvx7ZQQQxQuPUMdqzE4U odsBdnZ2ZTcYK3bKocH4OA58PzhTNkmz164ixt/Do2ZBS30jRHOWaPJFDhj2+g2asbF2L5HAgIN k8ZfowiVxT8x8zAGJN4SG4ReAYkDfTxjoKSmdik2EFzW52CU9BNgOnHT2mAv2JzgqAAygC+IM X-Google-Smtp-Source: AMsMyM71UQMqDiB7KkkCcT+kq/JE+p5blswd47QBijS4bx1mcRUyTvbn0e/qpfyyPFdR4yxPr+twNy4TttCCwu4EzA== X-Received: from dionnaglaze.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2ee6]) (user=dionnaglaze job=sendgmr) by 2002:a17:902:ce81:b0:179:f3fe:7fef with SMTP id f1-20020a170902ce8100b00179f3fe7fefmr11389841plg.119.1664579198981; Fri, 30 Sep 2022 16:06:38 -0700 (PDT) Date: Fri, 30 Sep 2022 23:06:25 +0000 In-Reply-To: <20220930230627.3371754-1-dionnaglaze@google.com> Mime-Version: 1.0 References: <20220930230627.3371754-1-dionnaglaze@google.com> X-Mailer: git-send-email 2.38.0.rc1.362.ged0d419d3c-goog Message-ID: <20220930230627.3371754-6-dionnaglaze@google.com> Subject: [PATCH v5 5/7] MdePkg: Introduce the AcceptAllUnacceptedMemory protocol From: "Dionna Glaze" To: devel@edk2.groups.io Cc: Dionna Glaze , Gerd Hoffmann , James Bottomley , Jiewen Yao , Tom Lendacky , Ard Biesheuvel , "Min M. Xu" , Andrew Fish , "Michael D. Kinney" Content-Type: text/plain; charset="UTF-8" The default behavior for unaccepted memory is to accept all memory when ExitBootServices is called. An OS loader can use this protocol to Disable this behavior to assume responsibility for memory acceptance and to affirm that the OS can handle the unaccepted memory type. This is a candidate for standardization. Cc: Gerd Hoffmann Cc: James Bottomley Cc: Jiewen Yao Cc: Tom Lendacky Cc: Ard Biesheuvel Cc: "Min M. Xu" Cc: Andrew Fish Cc: "Michael D. Kinney" Signed-off-by: Dionna Glaze --- MdePkg/Include/Protocol/AcceptAllUnacceptedMemory.h | 40 ++++++++++++++++++++ MdePkg/MdePkg.dec | 5 ++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/MdePkg/Include/Protocol/AcceptAllUnacceptedMemory.h b/MdePkg/Include/Protocol/AcceptAllUnacceptedMemory.h new file mode 100644 index 0000000000..e50831836c --- /dev/null +++ b/MdePkg/Include/Protocol/AcceptAllUnacceptedMemory.h @@ -0,0 +1,40 @@ +/** @file + The file provides the protocol that disables the behavior that all memory + gets accepted at ExitBootServices(). This protocol is only meant to be called + by the OS loader, and not EDK2 itself. + + Copyright (c) 2022, Google LLC. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent +**/ +#ifndef _ACCEPT_ALL_UNACCEPTED_MEMORY_H_ +#define _ACCEPT_ALL_UNACCEPTED_MEMORY_H_ + +#define BZ3987_ACCEPT_ALL_UNACCEPTED_MEMORY_PROTOCOL_GUID \ + {0xc5a010fe, \ + 0x38a7, \ + 0x4531, \ + {0x8a, 0x4a, 0x05, 0x00, 0xd2, 0xfd, 0x16, 0x49}} + +typedef struct _BZ3987_ACCEPT_ALL_UNACCEPTED_MEMORY_PROTOCOL + BZ3987_ACCEPT_ALL_UNACCEPTED_MEMORY_PROTOCOL; + +/** + @param This A pointer to a BZ3987_ACCEPT_ALL_UNACCEPTED_MEMORY_PROTOCOL. +**/ +typedef +EFI_STATUS +(EFIAPI *BZ3987_DISABLE_ACCEPT_ALL_UNACCEPTED_MEMORY)( + IN BZ3987_ACCEPT_ALL_UNACCEPTED_MEMORY_PROTOCOL *This + ); + +/// +/// The BZ3987_ACCEPT_ALL_UNACCEPTED_MEMORY_PROTOCOL allows the OS loader to +/// indicate to EDK2 that ExitBootServices should not accept all memory. +/// +struct _BZ3987_ACCEPT_ALL_UNACCEPTED_MEMORY_PROTOCOL { + BZ3987_DISABLE_ACCEPT_ALL_UNACCEPTED_MEMORY Disable; +}; + +extern EFI_GUID gBz3987AcceptAllUnacceptedMemoryProtocolGuid; + +#endif diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index 43b099b396..452c40683e 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -1019,8 +1019,11 @@ gEfiPeiDelayedDispatchPpiGuid = { 0x869c711d, 0x649c, 0x44fe, { 0x8b, 0x9e, 0x2c, 0xbb, 0x29, 0x11, 0xc3, 0xe6 }} [Protocols] + ## Include/Protocol/AcceptAllUnacceptedMemory.h + gBz3987AcceptAllUnacceptedMemoryProtocolGuid = { 0xc5a010fe, 0x38a7, 0x4531, {0x8a, 0x4a, 0x05, 0x00, 0xd2, 0xfd, 0x16, 0x49 }} + ## Include/Protocol/ExitBootServicesCallback.h - gEdkiiExitBootServicesCallbackProtocolGuid = { 0xf5684799, 0x9a33, 0x40f7, {0xa1, 0x5c, 0x10, 0x8e, 0x0e, 0x6b, 0x45, 0x25 }} + gEdkiiExitBootServicesCallbackProtocolGuid = { 0xf5684799, 0x9a33, 0x40f7, {0xa1, 0x5c, 0x10, 0x8e, 0x0e, 0x6b, 0x45, 0x25 }} ## Include/Protocol/MemoryAccept.h gEfiMemoryAcceptProtocolGuid = { 0x38c74800, 0x5590, 0x4db4, { 0xa0, 0xf3, 0x67, 0x5d, 0x9b, 0x8e, 0x80, 0x26 }} -- 2.38.0.rc1.362.ged0d419d3c-goog