From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by mx.groups.io with SMTP id smtpd.web10.73512.1673568887825865822 for ; Thu, 12 Jan 2023 16:14:47 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@google.com header.s=20210112 header.b=eUdbErtg; spf=pass (domain: flex--dionnaglaze.bounces.google.com, ip: 209.85.219.201, mailfrom: 3d6laywskbeihmsrrekpediksskpi.gsqhizipihog.kvsytw.ms@flex--dionnaglaze.bounces.google.com) Received: by mail-yb1-f201.google.com with SMTP id n203-20020a2572d4000000b0078f09db9888so21056968ybc.18 for ; Thu, 12 Jan 2023 16:14:47 -0800 (PST) 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:message-id:reply-to; bh=YI4L8+DrY4iYapM+dmSEQ129Xv4N//KxrCXWBoA8Ve4=; b=eUdbErtgZoFbUVcRqk3vFmDH9cdXoglp02NWDoKBFwySB6I3m0+KmgHirVCqpiJr+O ilA4drj4wr+LFBWbpOdm+ct8AKBUnlxjZRTP1ZBHkVyGcrp733AyMWlwym6KNgNC32od VGikYDDs072XpBKoKh62HHwRD+0DY8Nd7uwI03mdsSCg+zofaaY6W5Kug0r3L/mAWOsq 7PV2djVdYKX7y+OaKxrGX/gvyw93rI1aehRe3tiwMAhge0zbRm/rhPo+TA/AyEHku7qY Lj/bkxtpJgzwlB4JmqF5c1ueqrQjt7q6qF+zAoHRDcZg5gMg4h/5FWQW3GmW3jgyj3a1 ForA== 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:message-id:reply-to; bh=YI4L8+DrY4iYapM+dmSEQ129Xv4N//KxrCXWBoA8Ve4=; b=rNNlNdGOGJQ21wJkC+rnXDbBm4VWH66wBKh9Qd3xGbREJd97im6kpnERIgYbHfBcsB ybyyVrNTWYhb4Znhf2IFt5lbJXVeJdsWvkGDq1+0p7U5ncJ8NWRkHo7+NLF/EW7Ry7c4 gpTh0mGzZJQ6/0iCz5D0KOgh99giaKpDGSopDh4HlwUzaClZmDzK9jX54I2q+Hm9sr3n LujUL8rk7ZY3ypz2OzGd1y2J8HncweETHwabmwcQjqVqg66TtZMTRoxzkNNt658VJ/0N RIi133bM2zVZMMfd8+WOXXoSZH4A+JVUCHlikojJMOcqgCCxglK6wSdO3fGzK9Ogsmja EeVg== X-Gm-Message-State: AFqh2kqUua5aF2vIoq51MnUUXl6WUWeY73z8qUx6uHlCyuHQvGCtTc5s 3xwKjcIF70ZoCnvi3Y9v8/LqlKS0kNartH7LHuFgCH5ioFaTfiN88AOjDqhZiH/AkNYMPfrwXkK uVsY8NTtkEfmCZJkPrpcLhPTF6uh9MF9BOQmGyu2bad5BdW1jUT1782GUDaMf3lFpF19V/ka7 X-Google-Smtp-Source: AMrXdXsZux/wW9iKD0rDS1Scj73klVryYIAcUUDzmyZ5T27pePthrVrUZul7zIkySUUdNVeleqt7J6rp64aVAYy5AQ== X-Received: from dionnaglaze.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2ee6]) (user=dionnaglaze job=sendgmr) by 2002:a05:6902:11c6:b0:6fe:3d7f:d04a with SMTP id n6-20020a05690211c600b006fe3d7fd04amr8202121ybu.617.1673568887042; Thu, 12 Jan 2023 16:14:47 -0800 (PST) Date: Fri, 13 Jan 2023 00:14:17 +0000 In-Reply-To: <20230113001419.2519031-1-dionnaglaze@google.com> Mime-Version: 1.0 References: <20230113001419.2519031-1-dionnaglaze@google.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Message-ID: <20230113001419.2519031-3-dionnaglaze@google.com> Subject: [PATCH v9 2/4] MdePkg: Introduce the MemoryAcceptance 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/MemoryAcceptance.h | 40 ++++++++++++++++++++++ MdePkg/MdePkg.dec | 3 ++ 2 files changed, 43 insertions(+) create mode 100644 MdePkg/Include/Protocol/MemoryAcceptance.h diff --git a/MdePkg/Include/Protocol/MemoryAcceptance.h b/MdePkg/Include/Protocol/MemoryAcceptance.h new file mode 100644 index 0000000000..0b305b016f --- /dev/null +++ b/MdePkg/Include/Protocol/MemoryAcceptance.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 MEMORY_ACCEPTANCE_H_ +#define MEMORY_ACCEPTANCE_H_ + +#define BZ3987_MEMORY_ACCEPTANCE_PROTOCOL_GUID \ + {0xc5a010fe, \ + 0x38a7, \ + 0x4531, \ + {0x8a, 0x4a, 0x05, 0x00, 0xd2, 0xfd, 0x16, 0x49}} + +typedef struct _BZ3987_MEMORY_ACCEPTANCE_PROTOCOL BZ3987_MEMORY_ACCEPTANCE_PROTOCOL; + +/** + @param This A pointer to a BZ3987_MEMORY_ACCEPTANCE_PROTOCOL. +**/ +typedef + EFI_STATUS +(EFIAPI *BZ3987_ALLOW_UNACCEPTED_MEMORY)( + IN BZ3987_MEMORY_ACCEPTANCE_PROTOCOL *This + ); + +/// +/// The BZ3987_MEMORY_ACCEPTANCE_PROTOCOL allows the OS loader to +/// indicate to EDK2 that ExitBootServices should not accept all memory. +/// +struct _BZ3987_MEMORY_ACCEPTANCE_PROTOCOL { + BZ3987_ALLOW_UNACCEPTED_MEMORY AllowUnacceptedMemory; +}; + +extern EFI_GUID gBz3987MemoryAcceptanceProtocolGuid; + +#endif diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index 3d08f20d15..bc3d897248 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -1031,6 +1031,9 @@ gEfiPeiDelayedDispatchPpiGuid = { 0x869c711d, 0x649c, 0x44fe, { 0x8b, 0x9e, 0x2c, 0xbb, 0x29, 0x11, 0xc3, 0xe6 }} [Protocols] + ## Include/Protocol/Bz3987MemoryAcceptance.h + gBz3987MemoryAcceptanceProtocolGuid = { 0xc5a010fe, 0x38a7, 0x4531, {0x8a, 0x4a, 0x05, 0x00, 0xd2, 0xfd, 0x16, 0x49 }} + ## Include/Protocol/MemoryAccept.h gEdkiiMemoryAcceptProtocolGuid = { 0x38c74800, 0x5590, 0x4db4, { 0xa0, 0xf3, 0x67, 0x5d, 0x9b, 0x8e, 0x80, 0x26 }} -- 2.39.0.314.g84b9a713c41-goog