public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Sachin Ganesh via groups.io" <sachinganesh=ami.com@groups.io>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "gaoliming@byosoft.com.cn" <gaoliming@byosoft.com.cn>,
	"michael.d.kinney@intel.com" <michael.d.kinney@intel.com>,
	"zhiguang.liu@intel.com" <zhiguang.liu@intel.com>,
	Felix Polyudov <Felixp@ami.com>, Dhanaraj V <vdhanaraj@ami.com>,
	Sachin Ganesh <sachinganesh@ami.com>
Subject: [edk2-devel] [PATCH 3/5] MdePkg: Use newly defined Unaccepted Memory Type
Date: Mon, 15 Apr 2024 16:47:26 +0000	[thread overview]
Message-ID: <20240415164627.2464-4-sachinganesh@ami.com> (raw)
In-Reply-To: <20240415164627.2464-1-sachinganesh@ami.com>

EFI_RESOURCE_MEMORY_UNACCEPTED has been officially defined in the PI
1.8 specification. So all temporary solutions have been replaced with
the actual definition.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Felix Polyudov <felixp@ami.com>
Cc: Dhanaraj V <vdhanaraj@ami.com>
Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
---
 MdeModulePkg/Core/Dxe/Gcd/Gcd.c       | 10 +++----
 MdeModulePkg/Core/Dxe/Mem/Page.c      | 38 +++++++++++++--------------
 MdeModulePkg/Include/Pi/PrePiDxeCis.h | 25 ------------------
 MdeModulePkg/Include/Pi/PrePiHob.h    | 20 --------------
 MdePkg/Include/Pi/PiDxeCis.h          | 13 ++++-----
 MdePkg/Include/Pi/PiHob.h             | 12 ++-------
 6 files changed, 31 insertions(+), 87 deletions(-)
 delete mode 100644 MdeModulePkg/Include/Pi/PrePiDxeCis.h
 delete mode 100644 MdeModulePkg/Include/Pi/PrePiHob.h

diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
index c450d1bf25..fe1bbd6974 100644
--- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
+++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
@@ -8,8 +8,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent


 **/



-#include <Pi/PrePiDxeCis.h>

-#include <Pi/PrePiHob.h>

+#include <Pi/PiDxeCis.h>

+#include <Pi/PiHob.h>

 #include "DxeMain.h"

 #include "Gcd.h"

 #include "Mem/HeapGuard.h"

@@ -105,7 +105,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8  *mGcdMemoryTypeNames[] = {
   "MMIO     ",  // EfiGcdMemoryTypeMemoryMappedIo

   "PersisMem",  // EfiGcdMemoryTypePersistent

   "MoreRelia",  // EfiGcdMemoryTypeMoreReliable

-  "Unaccepte",  // EFI_GCD_MEMORY_TYPE_UNACCEPTED

+  "Unaccepte",  // EfiGcdMemoryTypeUnaccepted

   "Unknown  "   // EfiGcdMemoryTypeMaximum

 };



@@ -2669,8 +2669,8 @@ CoreInitializeGcdServices (
         case EFI_RESOURCE_MEMORY_RESERVED:

           GcdMemoryType = EfiGcdMemoryTypeReserved;

           break;

-        case BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED:

-          GcdMemoryType = EFI_GCD_MEMORY_TYPE_UNACCEPTED;

+        case EFI_RESOURCE_MEMORY_UNACCEPTED:

+          GcdMemoryType = EfiGcdMemoryTypeUnaccepted;

           break;

         case EFI_RESOURCE_IO:

           GcdIoType = EfiGcdIoTypeIo;

diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c
index 26584648c2..5a51d9df1a 100644
--- a/MdeModulePkg/Core/Dxe/Mem/Page.c
+++ b/MdeModulePkg/Core/Dxe/Mem/Page.c
@@ -9,7 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include "DxeMain.h"

 #include "Imem.h"

 #include "HeapGuard.h"

-#include <Pi/PrePiDxeCis.h>

+#include <Pi/PiDxeCis.h>



 //

 // Entry for tracking the memory regions for each memory type to coalesce similar memory types

@@ -70,23 +70,23 @@ EFI_PHYSICAL_ADDRESS  mDefaultMaximumAddress = MAX_ALLOC_ADDRESS;
 EFI_PHYSICAL_ADDRESS  mDefaultBaseAddress    = MAX_ALLOC_ADDRESS;



 EFI_MEMORY_TYPE_INFORMATION  gMemoryTypeInformation[EfiMaxMemoryType + 1] = {

-  { EfiReservedMemoryType,          0 },

-  { EfiLoaderCode,                  0 },

-  { EfiLoaderData,                  0 },

-  { EfiBootServicesCode,            0 },

-  { EfiBootServicesData,            0 },

-  { EfiRuntimeServicesCode,         0 },

-  { EfiRuntimeServicesData,         0 },

-  { EfiConventionalMemory,          0 },

-  { EfiUnusableMemory,              0 },

-  { EfiACPIReclaimMemory,           0 },

-  { EfiACPIMemoryNVS,               0 },

-  { EfiMemoryMappedIO,              0 },

-  { EfiMemoryMappedIOPortSpace,     0 },

-  { EfiPalCode,                     0 },

-  { EfiPersistentMemory,            0 },

-  { EFI_GCD_MEMORY_TYPE_UNACCEPTED, 0 },

-  { EfiMaxMemoryType,               0 }

+  { EfiReservedMemoryType,      0 },

+  { EfiLoaderCode,              0 },

+  { EfiLoaderData,              0 },

+  { EfiBootServicesCode,        0 },

+  { EfiBootServicesData,        0 },

+  { EfiRuntimeServicesCode,     0 },

+  { EfiRuntimeServicesData,     0 },

+  { EfiConventionalMemory,      0 },

+  { EfiUnusableMemory,          0 },

+  { EfiACPIReclaimMemory,       0 },

+  { EfiACPIMemoryNVS,           0 },

+  { EfiMemoryMappedIO,          0 },

+  { EfiMemoryMappedIOPortSpace, 0 },

+  { EfiPalCode,                 0 },

+  { EfiPersistentMemory,        0 },

+  { EfiGcdMemoryTypeUnaccepted, 0 },

+  { EfiMaxMemoryType,           0 }

 };

 //

 // Only used when load module at fixed address feature is enabled. True means the memory is alreay successfully allocated

@@ -2083,7 +2083,7 @@ CoreGetMemoryMap (
       MemoryMap = MergeMemoryMapDescriptor (MemoryMapStart, MemoryMap, Size);

     }



-    if (MergeGcdMapEntry.GcdMemoryType == EFI_GCD_MEMORY_TYPE_UNACCEPTED) {

+    if (MergeGcdMapEntry.GcdMemoryType == EfiGcdMemoryTypeUnaccepted) {

       //

       // Page Align GCD range is required. When it is converted to EFI_MEMORY_DESCRIPTOR,

       // it will be recorded as page PhysicalStart and NumberOfPages.

diff --git a/MdeModulePkg/Include/Pi/PrePiDxeCis.h b/MdeModulePkg/Include/Pi/PrePiDxeCis.h
deleted file mode 100644
index 9be71d2618..0000000000
--- a/MdeModulePkg/Include/Pi/PrePiDxeCis.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/** @file

-  Include file matches things in PI.

-

-Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>

-SPDX-License-Identifier: BSD-2-Clause-Patent

-

-**/

-

-#ifndef MDE_MODULEPKG_PRE_PI_DXE_CIS_H_

-#define MDE_MODULEPKG_PRE_PI_DXE_CIS_H_

-

-///

-/// A memory region that describes system memory that has not been accepted

-/// by a corresponding call to the underlying isolation architecture.

-///

-/// This memory region has not been defined in PI spec, so it is defined in

-/// PrePiDxeCis.h. And it is defined in the format of captial letters

-/// because only capital letters are allowed to be used for #define declarations.

-///

-/// After this memory region is defined in PI spec, it should be a value in

-/// EFI_GCD_MEMORY_TYPE in PiDxeCis.h.

-///

-#define  EFI_GCD_MEMORY_TYPE_UNACCEPTED  6

-

-#endif

diff --git a/MdeModulePkg/Include/Pi/PrePiHob.h b/MdeModulePkg/Include/Pi/PrePiHob.h
deleted file mode 100644
index ac575e5972..0000000000
--- a/MdeModulePkg/Include/Pi/PrePiHob.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/** @file

-  HOB related definitions which has not been officially published in PI.

-

-Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>

-SPDX-License-Identifier: BSD-2-Clause-Patent

-

-**/

-

-#ifndef MDE_MODULEPKG_PRE_PI_HOB_H_

-#define MDE_MODULEPKG_PRE_PI_HOB_H_

-

-//

-// BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED is defined for unaccepted memory.

-// But this defitinion has not been officially in the PI spec. Base

-// on the code-first we define BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED at

-// MdeModulePkg/Include/Pi/PrePiHob.h.

-//

-#define BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED  0x00000007

-

-#endif

diff --git a/MdePkg/Include/Pi/PiDxeCis.h b/MdePkg/Include/Pi/PiDxeCis.h
index bb7fb2c38a..04410c5a1a 100644
--- a/MdePkg/Include/Pi/PiDxeCis.h
+++ b/MdePkg/Include/Pi/PiDxeCis.h
@@ -56,14 +56,11 @@ typedef enum {
   /// system. If all memory has the same reliability, then this bit is not used.

   ///

   EfiGcdMemoryTypeMoreReliable,

-  // ///

-  // /// A memory region that describes system memory that has not been accepted

-  // /// by a corresponding call to the underlying isolation architecture.

-  // ///

-  // /// Please be noted:

-  // /// EfiGcdMemoryTypeUnaccepted is defined in PrePiDxeCis.h because it has not been

-  // /// defined in PI spec.

-  // EfiGcdMemoryTypeUnaccepted,

+  ///

+  /// A memory region that describes system memory that has not been accepted

+  /// by a corresponding call to the underlying isolation architecture.

+  ///

+  EfiGcdMemoryTypeUnaccepted,

   EfiGcdMemoryTypeMaximum = 7

 } EFI_GCD_MEMORY_TYPE;



diff --git a/MdePkg/Include/Pi/PiHob.h b/MdePkg/Include/Pi/PiHob.h
index f730520e8c..9e49421afa 100644
--- a/MdePkg/Include/Pi/PiHob.h
+++ b/MdePkg/Include/Pi/PiHob.h
@@ -232,16 +232,8 @@ typedef UINT32 EFI_RESOURCE_TYPE;
 #define EFI_RESOURCE_MEMORY_MAPPED_IO_PORT  0x00000004

 #define EFI_RESOURCE_MEMORY_RESERVED        0x00000005

 #define EFI_RESOURCE_IO_RESERVED            0x00000006

-//

-// BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED is defined for unaccepted memory.

-// But this defitinion has not been officially in the PI spec. Base

-// on the code-first we define BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED at

-// MdeModulePkg/Include/Pi/PrePiHob.h and update EFI_RESOURCE_MAX_MEMORY_TYPE

-// to 8. After BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED is officially published

-// in PI spec, we will re-visit here.

-//

-// #define BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED      0x00000007

-#define EFI_RESOURCE_MAX_MEMORY_TYPE  0x00000008

+#define EFI_RESOURCE_MEMORY_UNACCEPTED      0x00000007

+#define EFI_RESOURCE_MAX_MEMORY_TYPE        0x00000008



 ///

 /// A type of recount attribute type.

--
2.24.1.windows.2
-The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117797): https://edk2.groups.io/g/devel/message/117797
Mute This Topic: https://groups.io/mt/105540405/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  parent reply	other threads:[~2024-04-15 16:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-15 16:47 [edk2-devel] [PATCH 0/5] General Updates based on UEFI 2.10 and PI 1.8 Specifications Sachin Ganesh via groups.io
2024-04-15 16:47 ` [edk2-devel] [PATCH 1/5] MdePkg: Add definition for NVMe Over Fabric Device Path Sachin Ganesh via groups.io
2024-04-15 17:33   ` Felix Polyudov via groups.io
2024-04-15 19:59     ` Sachin Ganesh via groups.io
2024-04-15 16:47 ` [edk2-devel] [PATCH 2/5] MdePkg: Add new Resource Attributes defined in PI 1.8 Spec Sachin Ganesh via groups.io
2024-04-15 16:47 ` Sachin Ganesh via groups.io [this message]
2024-04-15 16:47 ` [edk2-devel] [PATCH 4/5] MdePkg: Update Delayed Dispatch PPI as per " Sachin Ganesh via groups.io
2024-04-15 16:47 ` [edk2-devel] [PATCH 5/5] MdePkg: Update to PI 1.8 Revision Sachin Ganesh via groups.io
  -- strict thread matches above, loose matches on Subject: below --
2024-04-01 22:40 [edk2-devel] [PATCH 0/5] General Updates based on UEFI 2.10 and PI 1.8 Specifications Sachin Ganesh via groups.io
2024-04-01 22:40 ` [edk2-devel] [PATCH 3/5] MdePkg: Use newly defined Unaccepted Memory Type Sachin Ganesh via groups.io

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240415164627.2464-4-sachinganesh@ami.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox