[edk2-devel] [Patch v2 1/4] MdePkg/Include: Allow CPU specific defines to be predefined

Michael D Kinney posted 4 patches 4 years, 9 months ago
[edk2-devel] [Patch v2 1/4] MdePkg/Include: Allow CPU specific defines to be predefined
Posted by Michael D Kinney 4 years, 9 months ago
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3308

The EDK II Build Specifications do not restrict the set of
CPU architectures that can be supported.  Remove places in
the EDK II that assumes a fixed set of CPU architectures.

Update EFI_REMOVABLE_MEDIA_FILE_NAME to allow it to be
predefined in tools_def.txt or a DSC file [BuildOptions]
section using a *_*_*_CC_FLAGS statement.

Add support for the following two defines.  If neither are
defines, then preserve the current behavior.  If either is
defined, then compare these 16-bit values to Machine in the
EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) and
EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) macros.

* EFI_IMAGE_MACHINE_TYPE_VALUE
* EFI_IMAGE_MACHINE_CROSS_TYPE_VALUE

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Abner Chang <abner.chang@hpe.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 MdePkg/Include/Uefi/UefiBaseType.h | 15 ++++++++++++++-
 MdePkg/Include/Uefi/UefiSpec.h     |  4 +++-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/MdePkg/Include/Uefi/UefiBaseType.h b/MdePkg/Include/Uefi/UefiBaseType.h
index 934fc07285d9..45e2aa63bb34 100644
--- a/MdePkg/Include/Uefi/UefiBaseType.h
+++ b/MdePkg/Include/Uefi/UefiBaseType.h
@@ -1,7 +1,7 @@
 /** @file
   Defines data types and constants introduced in UEFI.
 
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
 Portions copyright (c) 2011 - 2016, ARM Ltd. All rights reserved.<BR>
 Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
 
@@ -248,6 +248,7 @@ typedef union {
 #define EFI_IMAGE_MACHINE_RISCV64   0x5064
 #define EFI_IMAGE_MACHINE_RISCV128  0x5128
 
+#if !defined(EFI_IMAGE_MACHINE_TYPE_VALUE) && !defined(EFI_IMAGE_MACHINE_CROSS_TYPE_VALUE)
 #if   defined (MDE_CPU_IA32)
 
 #define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
@@ -294,5 +295,17 @@ typedef union {
 #else
 #error Unknown Processor Type
 #endif
+#else
+#if defined (EFI_IMAGE_MACHINE_TYPE_VALUE)
+#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_TYPE_VALUE)
+#else
+#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) (FALSE)
+#endif
+#if defined (EFI_IMAGE_MACHINE_CROSS_TYPE_VALUE)
+#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_CROSS_TYPE_VALUE)
+#else
+#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
+#endif
+#endif
 
 #endif
diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.h
index 2b1b72d86286..8aeaebc44fd8 100644
--- a/MdePkg/Include/Uefi/UefiSpec.h
+++ b/MdePkg/Include/Uefi/UefiSpec.h
@@ -5,7 +5,7 @@
   If a code construct is defined in the UEFI 2.7 specification it must be included
   by this include file.
 
-Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
 Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
 
 SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -2211,6 +2211,7 @@ typedef struct {
 #define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 L"\\EFI\\BOOT\\BOOTAA64.EFI"
 #define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64 L"\\EFI\\BOOT\\BOOTRISCV64.EFI"
 
+#if !defined(EFI_REMOVABLE_MEDIA_FILE_NAME)
 #if   defined (MDE_CPU_IA32)
   #define EFI_REMOVABLE_MEDIA_FILE_NAME   EFI_REMOVABLE_MEDIA_FILE_NAME_IA32
 #elif defined (MDE_CPU_X64)
@@ -2225,6 +2226,7 @@ typedef struct {
 #else
   #error Unknown Processor Type
 #endif
+#endif
 
 //
 // The directory within the active EFI System Partition defined for delivery of capsule to firmware
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#74082): https://edk2.groups.io/g/devel/message/74082
Mute This Topic: https://groups.io/mt/82083397/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [Patch v2 1/4] MdePkg/Include: Allow CPU specific defines to be predefined
Posted by Abner Chang 4 years, 9 months ago
Reviewed-by: Abner Chang <abner.chang@hpe.com>

> -----Original Message-----
> From: Michael D Kinney [mailto:michael.d.kinney@intel.com]
> Sent: Wednesday, April 14, 2021 11:28 AM
> To: devel@edk2.groups.io
> Cc: Liming Gao <gaoliming@byosoft.com.cn>; Zhiguang Liu
> <zhiguang.liu@intel.com>; Andrew Fish <afish@apple.com>; Chang, Abner
> (HPS SW/FW Technologist) <abner.chang@hpe.com>
> Subject: [Patch v2 1/4] MdePkg/Include: Allow CPU specific defines to be
> predefined
> 
> REF:
> INVALID URI REMOVED
> d=3308__;!!NpxR!1Qj2WKf6yVi0SVvkJR8sf50oGmisS2iAsV7eybhBjfs_lt0-
> 3X4rfKLfGiwvv78$
> 
> The EDK II Build Specifications do not restrict the set of
> CPU architectures that can be supported.  Remove places in
> the EDK II that assumes a fixed set of CPU architectures.
> 
> Update EFI_REMOVABLE_MEDIA_FILE_NAME to allow it to be
> predefined in tools_def.txt or a DSC file [BuildOptions]
> section using a *_*_*_CC_FLAGS statement.
> 
> Add support for the following two defines.  If neither are
> defines, then preserve the current behavior.  If either is
> defined, then compare these 16-bit values to Machine in the
> EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) and
> EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) macros.
> 
> * EFI_IMAGE_MACHINE_TYPE_VALUE
> * EFI_IMAGE_MACHINE_CROSS_TYPE_VALUE
> 
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> Cc: Andrew Fish <afish@apple.com>
> Cc: Abner Chang <abner.chang@hpe.com>
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
>  MdePkg/Include/Uefi/UefiBaseType.h | 15 ++++++++++++++-
>  MdePkg/Include/Uefi/UefiSpec.h     |  4 +++-
>  2 files changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/MdePkg/Include/Uefi/UefiBaseType.h
> b/MdePkg/Include/Uefi/UefiBaseType.h
> index 934fc07285d9..45e2aa63bb34 100644
> --- a/MdePkg/Include/Uefi/UefiBaseType.h
> +++ b/MdePkg/Include/Uefi/UefiBaseType.h
> @@ -1,7 +1,7 @@
>  /** @file
>    Defines data types and constants introduced in UEFI.
> 
> -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
>  Portions copyright (c) 2011 - 2016, ARM Ltd. All rights reserved.<BR>
>  Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights
> reserved.<BR>
> 
> @@ -248,6 +248,7 @@ typedef union {
>  #define EFI_IMAGE_MACHINE_RISCV64   0x5064
>  #define EFI_IMAGE_MACHINE_RISCV128  0x5128
> 
> +#if !defined(EFI_IMAGE_MACHINE_TYPE_VALUE)
> && !defined(EFI_IMAGE_MACHINE_CROSS_TYPE_VALUE)
>  #if   defined (MDE_CPU_IA32)
> 
>  #define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
> @@ -294,5 +295,17 @@ typedef union {
>  #else
>  #error Unknown Processor Type
>  #endif
> +#else
> +#if defined (EFI_IMAGE_MACHINE_TYPE_VALUE)
> +#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) ((Machine) ==
> EFI_IMAGE_MACHINE_TYPE_VALUE)
> +#else
> +#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) (FALSE)
> +#endif
> +#if defined (EFI_IMAGE_MACHINE_CROSS_TYPE_VALUE)
> +#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine)
> ((Machine) == EFI_IMAGE_MACHINE_CROSS_TYPE_VALUE)
> +#else
> +#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
> +#endif
> +#endif
> 
>  #endif
> diff --git a/MdePkg/Include/Uefi/UefiSpec.h
> b/MdePkg/Include/Uefi/UefiSpec.h
> index 2b1b72d86286..8aeaebc44fd8 100644
> --- a/MdePkg/Include/Uefi/UefiSpec.h
> +++ b/MdePkg/Include/Uefi/UefiSpec.h
> @@ -5,7 +5,7 @@
>    If a code construct is defined in the UEFI 2.7 specification it must be
> included
>    by this include file.
> 
> -Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
>  Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All
> rights reserved.<BR>
> 
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> @@ -2211,6 +2211,7 @@ typedef struct {
>  #define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64
> L"\\EFI\\BOOT\\BOOTAA64.EFI"
>  #define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64
> L"\\EFI\\BOOT\\BOOTRISCV64.EFI"
> 
> +#if !defined(EFI_REMOVABLE_MEDIA_FILE_NAME)
>  #if   defined (MDE_CPU_IA32)
>    #define EFI_REMOVABLE_MEDIA_FILE_NAME
> EFI_REMOVABLE_MEDIA_FILE_NAME_IA32
>  #elif defined (MDE_CPU_X64)
> @@ -2225,6 +2226,7 @@ typedef struct {
>  #else
>    #error Unknown Processor Type
>  #endif
> +#endif
> 
>  //
>  // The directory within the active EFI System Partition defined for delivery of
> capsule to firmware
> --
> 2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#74091): https://edk2.groups.io/g/devel/message/74091
Mute This Topic: https://groups.io/mt/82083397/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


[edk2-devel] 回复: [Patch v2 1/4] MdePkg/Include: Allow CPU specific defines to be predefined
Posted by gaoliming 4 years, 9 months ago
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>

> -----邮件原件-----
> 发件人: Michael D Kinney <michael.d.kinney@intel.com>
> 发送时间: 2021年4月14日 11:28
> 收件人: devel@edk2.groups.io
> 抄送: Liming Gao <gaoliming@byosoft.com.cn>; Zhiguang Liu
> <zhiguang.liu@intel.com>; Andrew Fish <afish@apple.com>; Abner Chang
> <abner.chang@hpe.com>
> 主题: [Patch v2 1/4] MdePkg/Include: Allow CPU specific defines to be
> predefined
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3308
> 
> The EDK II Build Specifications do not restrict the set of
> CPU architectures that can be supported.  Remove places in
> the EDK II that assumes a fixed set of CPU architectures.
> 
> Update EFI_REMOVABLE_MEDIA_FILE_NAME to allow it to be
> predefined in tools_def.txt or a DSC file [BuildOptions]
> section using a *_*_*_CC_FLAGS statement.
> 
> Add support for the following two defines.  If neither are
> defines, then preserve the current behavior.  If either is
> defined, then compare these 16-bit values to Machine in the
> EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) and
> EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) macros.
> 
> * EFI_IMAGE_MACHINE_TYPE_VALUE
> * EFI_IMAGE_MACHINE_CROSS_TYPE_VALUE
> 
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> Cc: Andrew Fish <afish@apple.com>
> Cc: Abner Chang <abner.chang@hpe.com>
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
>  MdePkg/Include/Uefi/UefiBaseType.h | 15 ++++++++++++++-
>  MdePkg/Include/Uefi/UefiSpec.h     |  4 +++-
>  2 files changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/MdePkg/Include/Uefi/UefiBaseType.h
> b/MdePkg/Include/Uefi/UefiBaseType.h
> index 934fc07285d9..45e2aa63bb34 100644
> --- a/MdePkg/Include/Uefi/UefiBaseType.h
> +++ b/MdePkg/Include/Uefi/UefiBaseType.h
> @@ -1,7 +1,7 @@
>  /** @file
>    Defines data types and constants introduced in UEFI.
> 
> -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
>  Portions copyright (c) 2011 - 2016, ARM Ltd. All rights reserved.<BR>
>  Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights
> reserved.<BR>
> 
> @@ -248,6 +248,7 @@ typedef union {
>  #define EFI_IMAGE_MACHINE_RISCV64   0x5064
>  #define EFI_IMAGE_MACHINE_RISCV128  0x5128
> 
> +#if !defined(EFI_IMAGE_MACHINE_TYPE_VALUE)
> && !defined(EFI_IMAGE_MACHINE_CROSS_TYPE_VALUE)
>  #if   defined (MDE_CPU_IA32)
> 
>  #define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
> @@ -294,5 +295,17 @@ typedef union {
>  #else
>  #error Unknown Processor Type
>  #endif
> +#else
> +#if defined (EFI_IMAGE_MACHINE_TYPE_VALUE)
> +#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) ((Machine) ==
> EFI_IMAGE_MACHINE_TYPE_VALUE)
> +#else
> +#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) (FALSE)
> +#endif
> +#if defined (EFI_IMAGE_MACHINE_CROSS_TYPE_VALUE)
> +#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine)
> ((Machine) == EFI_IMAGE_MACHINE_CROSS_TYPE_VALUE)
> +#else
> +#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
> +#endif
> +#endif
> 
>  #endif
> diff --git a/MdePkg/Include/Uefi/UefiSpec.h
> b/MdePkg/Include/Uefi/UefiSpec.h
> index 2b1b72d86286..8aeaebc44fd8 100644
> --- a/MdePkg/Include/Uefi/UefiSpec.h
> +++ b/MdePkg/Include/Uefi/UefiSpec.h
> @@ -5,7 +5,7 @@
>    If a code construct is defined in the UEFI 2.7 specification it must be
> included
>    by this include file.
> 
> -Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
>  Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP.
All
> rights reserved.<BR>
> 
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> @@ -2211,6 +2211,7 @@ typedef struct {
>  #define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64
> L"\\EFI\\BOOT\\BOOTAA64.EFI"
>  #define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64
> L"\\EFI\\BOOT\\BOOTRISCV64.EFI"
> 
> +#if !defined(EFI_REMOVABLE_MEDIA_FILE_NAME)
>  #if   defined (MDE_CPU_IA32)
>    #define EFI_REMOVABLE_MEDIA_FILE_NAME
> EFI_REMOVABLE_MEDIA_FILE_NAME_IA32
>  #elif defined (MDE_CPU_X64)
> @@ -2225,6 +2226,7 @@ typedef struct {
>  #else
>    #error Unknown Processor Type
>  #endif
> +#endif
> 
>  //
>  // The directory within the active EFI System Partition defined for
delivery of
> capsule to firmware
> --
> 2.31.1.windows.1





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#74107): https://edk2.groups.io/g/devel/message/74107
Mute This Topic: https://groups.io/mt/82107669/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-