public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH v1 1/1] Add the EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE attribute.
@ 2024-05-16 20:19 Michael Kubacki
  2024-05-17  6:26 ` 回复: " gaoliming via groups.io
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Kubacki @ 2024-05-16 20:19 UTC (permalink / raw)
  To: devel; +Cc: Liming Gao, Michael D Kinney

From: Patrick Payne <patpa@microsoft.com>

Add the EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE resource attribute as
per the PI 1.8 spec. This flag is used to indicate that the memory
should be treated as special purpose memory (SPM).

Also adds GCD code that marks the SPM with the EFI_MEMORY_SP bit and
sets the GCD memory type to EfiGcdMemoryTypeSystemMemory.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Patrick Payne <patpa@microsoft.com>
---
 MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
index fe1bbd6974b7..c941fe941276 100644
--- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
+++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
@@ -26,7 +26,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
                                        EFI_RESOURCE_ATTRIBUTE_16_BIT_IO           | \
                                        EFI_RESOURCE_ATTRIBUTE_32_BIT_IO           | \
                                        EFI_RESOURCE_ATTRIBUTE_64_BIT_IO           | \
-                                       EFI_RESOURCE_ATTRIBUTE_PERSISTENT          )
+                                       EFI_RESOURCE_ATTRIBUTE_PERSISTENT          | \
+                                       EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE     )
 
 #define TESTED_MEMORY_ATTRIBUTES  (EFI_RESOURCE_ATTRIBUTE_PRESENT     |     \
                                        EFI_RESOURCE_ATTRIBUTE_INITIALIZED | \
@@ -92,6 +93,7 @@ GCD_ATTRIBUTE_CONVERSION_ENTRY  mAttributeConversionTable[] = {
   { EFI_RESOURCE_ATTRIBUTE_TESTED,                  EFI_MEMORY_TESTED,        FALSE },
   { EFI_RESOURCE_ATTRIBUTE_PERSISTABLE,             EFI_MEMORY_NV,            TRUE  },
   { EFI_RESOURCE_ATTRIBUTE_MORE_RELIABLE,           EFI_MEMORY_MORE_RELIABLE, TRUE  },
+  { EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE,         EFI_MEMORY_SP,            TRUE  },
   { 0,                                              0,                        FALSE }
 };
 
@@ -691,6 +693,10 @@ ConverToCpuArchAttributes (
     CpuArchAttributes |= EFI_MEMORY_WP;
   }
 
+  if ((Attributes & EFI_MEMORY_SP) == EFI_MEMORY_SP) {
+    CpuArchAttributes |= EFI_MEMORY_SP;
+  }
+
   return CpuArchAttributes;
 }
 
@@ -2660,6 +2666,10 @@ CoreInitializeGcdServices (
             GcdMemoryType = EfiGcdMemoryTypePersistent;
           }
 
+          if ((ResourceHob->ResourceAttribute & EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE) == EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE) {
+            GcdMemoryType = EfiGcdMemoryTypeSystemMemory;
+          }
+
           break;
         case EFI_RESOURCE_MEMORY_MAPPED_IO:
         case EFI_RESOURCE_FIRMWARE_DEVICE:
-- 
2.45.1.windows.1



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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* 回复: [edk2-devel] [PATCH v1 1/1] Add the EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE attribute.
  2024-05-16 20:19 [edk2-devel] [PATCH v1 1/1] Add the EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE attribute Michael Kubacki
@ 2024-05-17  6:26 ` gaoliming via groups.io
  0 siblings, 0 replies; 2+ messages in thread
From: gaoliming via groups.io @ 2024-05-17  6:26 UTC (permalink / raw)
  To: devel, mikuback
  Cc: 'Michael D Kinney', 'Lin, Du', 'Ray Ni'

Patrick:
  Commit message needs package name MdePkg. 

  One comment for the change is below. 

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Michael Kubacki
> 发送时间: 2024年5月17日 4:20
> 收件人: devel@edk2.groups.io
> 抄送: Liming Gao <gaoliming@byosoft.com.cn>; Michael D Kinney
> <michael.d.kinney@intel.com>
> 主题: [edk2-devel] [PATCH v1 1/1] Add the
> EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE attribute.
> 
> From: Patrick Payne <patpa@microsoft.com>
> 
> Add the EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE resource attribute as
> per the PI 1.8 spec. This flag is used to indicate that the memory
> should be treated as special purpose memory (SPM).
> 
> Also adds GCD code that marks the SPM with the EFI_MEMORY_SP bit and
> sets the GCD memory type to EfiGcdMemoryTypeSystemMemory.
> 
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Signed-off-by: Patrick Payne <patpa@microsoft.com>
> ---
>  MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
> b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
> index fe1bbd6974b7..c941fe941276 100644
> --- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
> +++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
> @@ -26,7 +26,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> EFI_RESOURCE_ATTRIBUTE_16_BIT_IO           | \
> 
> EFI_RESOURCE_ATTRIBUTE_32_BIT_IO           | \
> 
> EFI_RESOURCE_ATTRIBUTE_64_BIT_IO           | \
> -
> EFI_RESOURCE_ATTRIBUTE_PERSISTENT          )
> +
> EFI_RESOURCE_ATTRIBUTE_PERSISTENT          | \
> +
> EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE     )
> 
>  #define TESTED_MEMORY_ATTRIBUTES
> (EFI_RESOURCE_ATTRIBUTE_PRESENT     |     \
> 
> EFI_RESOURCE_ATTRIBUTE_INITIALIZED | \
> @@ -92,6 +93,7 @@ GCD_ATTRIBUTE_CONVERSION_ENTRY
> mAttributeConversionTable[] = {
>    { EFI_RESOURCE_ATTRIBUTE_TESTED,
> EFI_MEMORY_TESTED,        FALSE },
>    { EFI_RESOURCE_ATTRIBUTE_PERSISTABLE,             EFI_MEMORY_NV,
> TRUE  },
>    { EFI_RESOURCE_ATTRIBUTE_MORE_RELIABLE,
> EFI_MEMORY_MORE_RELIABLE, TRUE  },
> +  { EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE,         EFI_MEMORY_SP,
> TRUE  },
>    { 0,                                              0,
> FALSE }
>  };
> 
> @@ -691,6 +693,10 @@ ConverToCpuArchAttributes (
>      CpuArchAttributes |= EFI_MEMORY_WP;
>    }
> 
> +  if ((Attributes & EFI_MEMORY_SP) == EFI_MEMORY_SP) {
> +    CpuArchAttributes |= EFI_MEMORY_SP;
> +  }
> +
>    return CpuArchAttributes;
>  }
> 
> @@ -2660,6 +2666,10 @@ CoreInitializeGcdServices (
>              GcdMemoryType = EfiGcdMemoryTypePersistent;
>            }
> 
> +          if ((ResourceHob->ResourceAttribute &
> EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE) ==
> EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE) {
> +            GcdMemoryType = EfiGcdMemoryTypeSystemMemory;
> +          }
> +
[Liming] The type memory is earmarked for specific purposes such as for
specific device drivers or applications. So, its Gcd memory type may be
EfiGcdMemoryTypeReserved. 
Then, this memory range can't be allocated as the normal system memory. 

Thanks
Liming
>            break;
>          case EFI_RESOURCE_MEMORY_MAPPED_IO:
>          case EFI_RESOURCE_FIRMWARE_DEVICE:
> --
> 2.45.1.windows.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#118972): https://edk2.groups.io/g/devel/message/118972
> Mute This Topic: https://groups.io/mt/106142180/4905953
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [gaoliming@byosoft.com.cn]
> -=-=-=-=-=-=
> 





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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-05-17  6:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-16 20:19 [edk2-devel] [PATCH v1 1/1] Add the EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE attribute Michael Kubacki
2024-05-17  6:26 ` 回复: " gaoliming via groups.io

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox