From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from loongson.cn (loongson.cn [114.242.206.163]) by mx.groups.io with SMTP id smtpd.web11.71855.1679577473601714023 for ; Thu, 23 Mar 2023 06:17:54 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: loongson.cn, ip: 114.242.206.163, mailfrom: lichao@loongson.cn) Received: from loongson.cn (unknown [10.40.24.149]) by gateway (Coremail) with SMTP id _____8AxEk5+URxkfVQQAA--.13159S3; Thu, 23 Mar 2023 21:17:50 +0800 (CST) Received: from [10.40.24.149] (unknown [10.40.24.149]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxLL59URxkv10KAA--.3803S3; Thu, 23 Mar 2023 21:17:49 +0800 (CST) Message-ID: Date: Thu, 23 Mar 2023 21:17:49 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [edk2-devel] [PATCH 2/8] BaseTools: remove duplicate includes: /ProcessorBind.h To: devel@edk2.groups.io, kraxel@redhat.com Cc: Leif Lindholm , Pawel Polawski , Bob Feng , Sunil V L , =?UTF-8?Q?Marvin_H=c3=a4user?= , Dongyan Qian , Michael D Kinney , Zhiguang Liu , Yuwei Chen , Liming Gao , Ard Biesheuvel , Baoqi Zhang , Oliver Steffen , Daniel Schaefer References: <20230323111733.690211-1-kraxel@redhat.com> <20230323111733.690211-3-kraxel@redhat.com> From: "Chao Li" In-Reply-To: <20230323111733.690211-3-kraxel@redhat.com> X-CM-TRANSID: AQAAf8BxLL59URxkv10KAA--.3803S3 X-CM-SenderInfo: xolfxt3r6o00pqjv00gofq/1tbiAQATCGQcQXYCGgAAsN X-Coremail-Antispam: 1Uk129KBjvAXoWftw43ArWUCw13ZFy8XF4rGrg_yoW5GrWfto WIy347Ga18K34fAa98uw1rXrWDCr18Can3Wr4FvF98C3ZYyrs8CrZ7Aw1xWry3JFy0gryk Wr9rX34DArnxJFs5n29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7ZEXasCq-sGcSsGvf J3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnRJUUUkEb4IE77IF4wAFF20E14v26r1j 6r4UM7CY07I20VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r106r15M28lY4 IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l 84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1l84ACjcxK6I8E87Iv67AKxVWxJr0_Gc Wl84ACjcxK6I8E87Iv6xkF7I0E14v26F4UJVW0owAS0I0E0xvYzxvE52x082IY62kv0487 Mc804VCY07AIYIkI8VC2zVCFFI0UMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67 AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IY64vIr41l7480Y4vEI4kI2Ix0 rVAqx4xJMxk0xIA0c2IEe2xFo4CEbIxvr21l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x 0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUGVWUWwC20s026x8GjcxK67AKxVWUGVWUWwC2 zVAF1VAY17CE14v26r4a6rW5MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF 4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWU CwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r1j6r4UYxBIda VFxhVjvjDU0xZFpf9x07UEFAJUUUUU= Content-Type: multipart/alternative; boundary="------------MKNlyVeama5Pg7Hp04Dm3NvF" --------------MKNlyVeama5Pg7Hp04Dm3NvF Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Reviewed-by: Chao Li Thanks, Chao 在 2023/3/23 19:17, Gerd Hoffmann 写道: > Use the MdePkg version instead of maintaining a copy in BaseTools. > > Signed-off-by: Gerd Hoffmann > --- > .../Source/C/Include/AArch64/ProcessorBind.h | 148 -------------- > .../Source/C/Include/Arm/ProcessorBind.h | 147 -------------- > .../Source/C/Include/Ia32/ProcessorBind.h | 155 --------------- > .../C/Include/LoongArch64/ProcessorBind.h | 80 -------- > .../Source/C/Include/RiscV64/ProcessorBind.h | 85 -------- > .../Source/C/Include/X64/ProcessorBind.h | 183 ------------------ > BaseTools/Source/C/Common/Decompress.c | 1 + > BaseTools/Source/C/Makefiles/header.makefile | 14 +- > BaseTools/Source/C/Makefiles/ms.common | 12 +- > 9 files changed, 19 insertions(+), 806 deletions(-) > delete mode 100644 BaseTools/Source/C/Include/AArch64/ProcessorBind.h > delete mode 100644 BaseTools/Source/C/Include/Arm/ProcessorBind.h > delete mode 100644 BaseTools/Source/C/Include/Ia32/ProcessorBind.h > delete mode 100644 BaseTools/Source/C/Include/LoongArch64/ProcessorBind.h > delete mode 100644 BaseTools/Source/C/Include/RiscV64/ProcessorBind.h > delete mode 100644 BaseTools/Source/C/Include/X64/ProcessorBind.h > > diff --git a/BaseTools/Source/C/Include/AArch64/ProcessorBind.h b/BaseTools/Source/C/Include/AArch64/ProcessorBind.h > deleted file mode 100644 > index dfa725b2e363..000000000000 > --- a/BaseTools/Source/C/Include/AArch64/ProcessorBind.h > +++ /dev/null > @@ -1,148 +0,0 @@ > -/** @file > - Processor or Compiler specific defines and types for AArch64. > - > - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> - Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
> - Portions copyright (c) 2013, ARM Ltd. All rights reserved.
> - > - SPDX-License-Identifier: BSD-2-Clause-Patent > - > -**/ > - > -#ifndef __PROCESSOR_BIND_H__ > -#define __PROCESSOR_BIND_H__ > - > -/// > -/// Define the processor type so other code can make processor based choices > -/// > -#define MDE_CPU_AARCH64 > - > -// > -// Make sure we are using the correct packing rules per EFI specification > -// > -#ifndef __GNUC__ > -#pragma pack() > -#endif > - > -#if _MSC_EXTENSIONS > - // > - // use Microsoft* C compiler dependent integer width types > - // > - typedef unsigned __int64 UINT64; > - typedef __int64 INT64; > - typedef unsigned __int32 UINT32; > - typedef __int32 INT32; > - typedef unsigned short UINT16; > - typedef unsigned short CHAR16; > - typedef short INT16; > - typedef unsigned char BOOLEAN; > - typedef unsigned char UINT8; > - typedef char CHAR8; > - typedef signed char INT8; > -#else > - // > - // Use ANSI C 2000 stdint.h integer width declarations > - // > - #include > - typedef uint8_t BOOLEAN; > - typedef int8_t INT8; > - typedef uint8_t UINT8; > - typedef int16_t INT16; > - typedef uint16_t UINT16; > - typedef int32_t INT32; > - typedef uint32_t UINT32; > - typedef int64_t INT64; > - typedef uint64_t UINT64; > - typedef char CHAR8; > - typedef uint16_t CHAR16; > - > -#endif > - > -/// > -/// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions, > -/// 8 bytes on supported 64-bit processor instructions) > -/// > -typedef UINT64 UINTN; > - > -/// > -/// Signed value of native width. (4 bytes on supported 32-bit processor instructions, > -/// 8 bytes on supported 64-bit processor instructions) > -/// > -typedef INT64 INTN; > - > -// > -// Processor specific defines > -// > - > -/// > -/// A value of native width with the highest bit set. > -/// > -#define MAX_BIT 0x8000000000000000 > - > -/// > -/// A value of native width with the two highest bits set. > -/// > -#define MAX_2_BITS 0xC000000000000000 > - > -/// > -/// The stack alignment required for AARCH64 > -/// > -#define CPU_STACK_ALIGNMENT 16 > - > -// > -// Modifier to ensure that all protocol member functions and EFI intrinsics > -// use the correct C calling convention. All protocol member functions and > -// EFI intrinsics are required to modify their member functions with EFIAPI. > -// > -#define EFIAPI > - > -#if defined(__GNUC__) > - /// > - /// For GNU assembly code, .global or .globl can declare global symbols. > - /// Define this macro to unify the usage. > - /// > - #define ASM_GLOBAL .globl > - > - #if !defined(__APPLE__) > - /// > - /// ARM EABI defines that the linker should not manipulate call relocations > - /// (do bl/blx conversion) unless the target symbol has function type. > - /// CodeSourcery 2010.09 started requiring the .type to function properly > - /// > - #define INTERWORK_FUNC(func__) .type ASM_PFX(func__), %function > - > - #define GCC_ASM_EXPORT(func__) \ > - .global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\ > - .type ASM_PFX(func__), %function > - > - #define GCC_ASM_IMPORT(func__) \ > - .extern _CONCATENATE (__USER_LABEL_PREFIX__, func__) > - > - #else > - // > - // .type not supported by Apple Xcode tools > - // > - #define INTERWORK_FUNC(func__) > - > - #define GCC_ASM_EXPORT(func__) \ > - .globl _CONCATENATE (__USER_LABEL_PREFIX__, func__) \ > - > - #define GCC_ASM_IMPORT(name) > - > - #endif > -#endif > - > -/** > - Return the pointer to the first instruction of a function given a function pointer. > - On ARM CPU architectures, these two pointer values are the same, > - so the implementation of this macro is very simple. > - > - @param FunctionPointer A pointer to a function. > - > - @return The pointer to the first instruction of a function given a function pointer. > - > -**/ > -#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer) > - > -#endif > - > diff --git a/BaseTools/Source/C/Include/Arm/ProcessorBind.h b/BaseTools/Source/C/Include/Arm/ProcessorBind.h > deleted file mode 100644 > index 8fe4d5f1626a..000000000000 > --- a/BaseTools/Source/C/Include/Arm/ProcessorBind.h > +++ /dev/null > @@ -1,147 +0,0 @@ > -/** @file > - Processor or Compiler specific defines and types for ARM. > - > - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> - Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
> - SPDX-License-Identifier: BSD-2-Clause-Patent > - > -**/ > - > -#ifndef __PROCESSOR_BIND_H__ > -#define __PROCESSOR_BIND_H__ > - > -/// > -/// Define the processor type so other code can make processor based choices > -/// > -#define MDE_CPU_ARM > - > -// > -// Make sure we are using the correct packing rules per EFI specification > -// > -#ifndef __GNUC__ > -#pragma pack() > -#endif > - > -#if _MSC_EXTENSIONS > - // > - // use Microsoft* C compiler dependent integer width types > - // > - typedef unsigned __int64 UINT64; > - typedef __int64 INT64; > - typedef unsigned __int32 UINT32; > - typedef __int32 INT32; > - typedef unsigned short UINT16; > - typedef unsigned short CHAR16; > - typedef short INT16; > - typedef unsigned char BOOLEAN; > - typedef unsigned char UINT8; > - typedef char CHAR8; > - typedef signed char INT8; > -#else > - // > - // Assume standard ARM alignment. > - // > - typedef unsigned long long UINT64; > - typedef long long INT64; > - typedef unsigned int UINT32; > - typedef int INT32; > - typedef unsigned short UINT16; > - typedef unsigned short CHAR16; > - typedef short INT16; > - typedef unsigned char BOOLEAN; > - typedef unsigned char UINT8; > - typedef char CHAR8; > - typedef signed char INT8; > - > - #define UINT8_MAX 0xff > -#endif > - > -/// > -/// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions, > -/// 8 bytes on supported 64-bit processor instructions) > -/// > -typedef UINT32 UINTN; > - > -/// > -/// Signed value of native width. (4 bytes on supported 32-bit processor instructions, > -/// 8 bytes on supported 64-bit processor instructions) > -/// > -typedef INT32 INTN; > - > -// > -// Processor specific defines > -// > - > -/// > -/// A value of native width with the highest bit set. > -/// > -#define MAX_BIT 0x80000000 > - > -/// > -/// A value of native width with the two highest bits set. > -/// > -#define MAX_2_BITS 0xC0000000 > - > -/// > -/// The stack alignment required for ARM > -/// > -#define CPU_STACK_ALIGNMENT sizeof(UINT64) > - > -// > -// Modifier to ensure that all protocol member functions and EFI intrinsics > -// use the correct C calling convention. All protocol member functions and > -// EFI intrinsics are required to modify their member functions with EFIAPI. > -// > -#define EFIAPI > - > -#if defined(__GNUC__) > - /// > - /// For GNU assembly code, .global or .globl can declare global symbols. > - /// Define this macro to unify the usage. > - /// > - #define ASM_GLOBAL .globl > - > - #if !defined(__APPLE__) > - /// > - /// ARM EABI defines that the linker should not manipulate call relocations > - /// (do bl/blx conversion) unless the target symbol has function type. > - /// CodeSourcery 2010.09 started requiring the .type to function properly > - /// > - #define INTERWORK_FUNC(func__) .type ASM_PFX(func__), %function > - > - #define GCC_ASM_EXPORT(func__) \ > - .global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\ > - .type ASM_PFX(func__), %function > - > - #define GCC_ASM_IMPORT(func__) \ > - .extern _CONCATENATE (__USER_LABEL_PREFIX__, func__) > - > - #else > - // > - // .type not supported by Apple Xcode tools > - // > - #define INTERWORK_FUNC(func__) > - > - #define GCC_ASM_EXPORT(func__) \ > - .globl _CONCATENATE (__USER_LABEL_PREFIX__, func__) \ > - > - #define GCC_ASM_IMPORT(name) > - > - #endif > -#endif > - > -/** > - Return the pointer to the first instruction of a function given a function pointer. > - On ARM CPU architectures, these two pointer values are the same, > - so the implementation of this macro is very simple. > - > - @param FunctionPointer A pointer to a function. > - > - @return The pointer to the first instruction of a function given a function pointer. > - > -**/ > -#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer) > - > -#endif > - > - > diff --git a/BaseTools/Source/C/Include/Ia32/ProcessorBind.h b/BaseTools/Source/C/Include/Ia32/ProcessorBind.h > deleted file mode 100644 > index d1b77ad04a8b..000000000000 > --- a/BaseTools/Source/C/Include/Ia32/ProcessorBind.h > +++ /dev/null > @@ -1,155 +0,0 @@ > -/** @file > - Processor or Compiler specific defines and types for x64. > - > - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> - > - SPDX-License-Identifier: BSD-2-Clause-Patent > - > -**/ > - > -#ifndef __PROCESSOR_BIND_H__ > -#define __PROCESSOR_BIND_H__ > - > -// > -// Define the processor type so other code can make processor based choices > -// > -#define MDE_CPU_IA32 > - > -// > -// Make sure we are useing the correct packing rules per EFI specification > -// > -#ifndef __GNUC__ > -#pragma pack() > -#endif > - > -#if _MSC_EXTENSIONS > - > -// > -// Disable warning that make it impossible to compile at /W4 > -// This only works for Microsoft* tools > -// > - > -// > -// Disabling bitfield type checking warnings. > -// > -#pragma warning ( disable : 4214 ) > - > -// > -// Disabling the unreferenced formal parameter warnings. > -// > -#pragma warning ( disable : 4100 ) > - > -// > -// Disable slightly different base types warning as CHAR8 * can not be set > -// to a constant string. > -// > -#pragma warning ( disable : 4057 ) > - > -// > -// ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning > -// > -#pragma warning ( disable : 4127 ) > - > - > -#endif > - > - > -#if !defined(__GNUC__) && (__STDC_VERSION__ < 199901L) > - // > - // No ANSI C 2000 stdint.h integer width declarations, so define equivalents > - // > - > - #if _MSC_EXTENSIONS > - > - // > - // use Microsoft* C compiler dependent integer width types > - // > - typedef unsigned __int64 UINT64; > - typedef __int64 INT64; > - typedef unsigned __int32 UINT32; > - typedef __int32 INT32; > - typedef unsigned short UINT16; > - typedef unsigned short CHAR16; > - typedef short INT16; > - typedef unsigned char BOOLEAN; > - typedef unsigned char UINT8; > - typedef char CHAR8; > - typedef char INT8; > - #else > - > - // > - // Assume standard IA-32 alignment. > - // BugBug: Need to check portability of long long > - // > - typedef unsigned long long UINT64; > - typedef long long INT64; > - typedef unsigned int UINT32; > - typedef int INT32; > - typedef unsigned short UINT16; > - typedef unsigned short CHAR16; > - typedef short INT16; > - typedef unsigned char BOOLEAN; > - typedef unsigned char UINT8; > - typedef char CHAR8; > - typedef char INT8; > - #endif > - > - #define UINT8_MAX 0xff > - > -#else > - // > - // Use ANSI C 2000 stdint.h integer width declarations > - // > - #include "stdint.h" > - typedef uint8_t BOOLEAN; > - typedef int8_t INT8; > - typedef uint8_t UINT8; > - typedef int16_t INT16; > - typedef uint16_t UINT16; > - typedef int32_t INT32; > - typedef uint32_t UINT32; > - typedef int64_t INT64; > - typedef uint64_t UINT64; > - typedef char CHAR8; > - typedef uint16_t CHAR16; > - > -#endif > - > -typedef UINT32 UINTN; > -typedef INT32 INTN; > - > - > -// > -// Processor specific defines > -// > -#define MAX_BIT 0x80000000 > -#define MAX_2_BITS 0xC0000000 > - > -// > -// Modifier to ensure that all protocol member functions and EFI intrinsics > -// use the correct C calling convention. All protocol member functions and > -// EFI intrinsics are required to modify their member functions with EFIAPI. > -// > -#if _MSC_EXTENSIONS > - // > - // Microsoft* compiler requires _EFIAPI usage, __cdecl is Microsoft* specific C. > - // > - #define EFIAPI __cdecl > -#endif > - > -#if __GNUC__ > - #define EFIAPI __attribute__((cdecl)) > -#endif > - > -// > -// The Microsoft* C compiler can removed references to unreferenced data items > -// if the /OPT:REF linker option is used. We defined a macro as this is a > -// a non standard extension > -// > -#if _MSC_EXTENSIONS > - #define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany) > -#else > - #define GLOBAL_REMOVE_IF_UNREFERENCED > -#endif > - > -#endif > diff --git a/BaseTools/Source/C/Include/LoongArch64/ProcessorBind.h b/BaseTools/Source/C/Include/LoongArch64/ProcessorBind.h > deleted file mode 100644 > index 0267859deece..000000000000 > --- a/BaseTools/Source/C/Include/LoongArch64/ProcessorBind.h > +++ /dev/null > @@ -1,80 +0,0 @@ > -/** @file > - Processor or Compiler specific defines and types for LoongArch > - > - Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.
> - > - SPDX-License-Identifier: BSD-2-Clause-Patent > - > -**/ > -#ifndef PROCESSOR_BIND_H_ > -#define PROCESSOR_BIND_H_ > - > -// > -// Define the processor type so other code can make processor based choices > -// > -#define MDE_CPU_LOONGARCH64 > - > -#define EFIAPI > - > -// > -// Make sure we are using the correct packing rules per EFI specification > -// > -#ifndef __GNUC__ > -#pragma pack() > -#endif > - > -// > -// Use ANSI C 2000 stdint.h integer width declarations > -// > -#include > -typedef uint8_t BOOLEAN; > -typedef int8_t INT8; > -typedef uint8_t UINT8; > -typedef int16_t INT16; > -typedef uint16_t UINT16; > -typedef int32_t INT32; > -typedef uint32_t UINT32; > -typedef int64_t INT64; > -typedef uint64_t UINT64; > -typedef char CHAR8; > -typedef uint16_t CHAR16; > - > -// > -// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions, > -// 8 bytes on supported 64-bit processor instructions) > -// > -typedef UINT64 UINTN; > - > -// > -// Signed value of native width. (4 bytes on supported 32-bit processor instructions, > -// 8 bytes on supported 64-bit processor instructions) > -// > -typedef INT64 INTN; > - > -// > -// Processor specific defines > -// > - > -// > -// A value of native width with the highest bit set. > -// > -#define MAX_BIT 0x8000000000000000ULL > -// > -// A value of native width with the two highest bits set. > -// > -#define MAX_2_BITS 0xC000000000000000ULL > - > -#if defined (__GNUC__) > -// > -// For GNU assembly code, .global or .globl can declare global symbols. > -// Define this macro to unify the usage. > -// > -#define ASM_GLOBAL .globl > -#endif > - > -// > -// The stack alignment required for LoongArch > -// > -#define CPU_STACK_ALIGNMENT 16 > - > -#endif > diff --git a/BaseTools/Source/C/Include/RiscV64/ProcessorBind.h b/BaseTools/Source/C/Include/RiscV64/ProcessorBind.h > deleted file mode 100644 > index 1612d6ea7f16..000000000000 > --- a/BaseTools/Source/C/Include/RiscV64/ProcessorBind.h > +++ /dev/null > @@ -1,85 +0,0 @@ > -/** @file > - Processor or Compiler specific defines and types for RISC-V. > - > - SPDX-License-Identifier: BSD-2-Clause-Patent > - > -**/ > - > -#ifndef __PROCESSOR_BIND_H__ > -#define __PROCESSOR_BIND_H__ > - > -// > -// Define the processor type so other code can make processor based choices > -// > -#define MDE_CPU_RISCV64 > - > -// > -// Make sure we are using the correct packing rules per EFI specification > -// > -#ifndef __GNUC__ > -#pragma pack() > -#endif > - > -// > -// Use ANSI C 2000 stdint.h integer width declarations > -// > -#include > -typedef uint8_t BOOLEAN; > -typedef int8_t INT8; > -typedef uint8_t UINT8; > -typedef int16_t INT16; > -typedef uint16_t UINT16; > -typedef int32_t INT32; > -typedef uint32_t UINT32; > -typedef int64_t INT64; > -typedef uint64_t UINT64; > -typedef char CHAR8; > -typedef uint16_t CHAR16; > - > -// > -// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions, > -// 8 bytes on supported 64-bit processor instructions) > -// > -typedef UINT64 UINTN; > - > -// > -// Signed value of native width. (4 bytes on supported 32-bit processor instructions, > -// 8 bytes on supported 64-bit processor instructions) > -// > -typedef INT64 INTN; > - > -// > -// Processor specific defines > -// > - > -// > -// A value of native width with the highest bit set. > -// > -#define MAX_BIT 0x8000000000000000 > - > -// > -// A value of native width with the two highest bits set. > -// > -#define MAX_2_BITS 0xC000000000000000 > - > -// > -// The stack alignment required for RISC-V > -// > -#define CPU_STACK_ALIGNMENT 16 > - > -// > -// Modifier to ensure that all protocol member functions and EFI intrinsics > -// use the correct C calling convention. All protocol member functions and > -// EFI intrinsics are required to modify their member functions with EFIAPI. > -// > -#define EFIAPI > - > -#if defined(__GNUC__) > - // > - // For GNU assembly code, .global or .globl can declare global symbols. > - // Define this macro to unify the usage. > - // > - #define ASM_GLOBAL .globl > -#endif > - > -#endif > diff --git a/BaseTools/Source/C/Include/X64/ProcessorBind.h b/BaseTools/Source/C/Include/X64/ProcessorBind.h > deleted file mode 100644 > index fce179fe7e3a..000000000000 > --- a/BaseTools/Source/C/Include/X64/ProcessorBind.h > +++ /dev/null > @@ -1,183 +0,0 @@ > -/** @file > - Processor or Compiler specific defines and types x64 (Intel(r) EM64T, AMD64). > - > - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> - > - SPDX-License-Identifier: BSD-2-Clause-Patent > - > -**/ > - > -#ifndef __PROCESSOR_BIND_H__ > -#define __PROCESSOR_BIND_H__ > - > -// > -// Define the processor type so other code can make processor based choices > -// > -#define MDE_CPU_X64 > - > - > -// > -// Make sure we are useing the correct packing rules per EFI specification > -// > -#ifndef __GNUC__ > -#pragma pack() > -#endif > - > - > -#if _MSC_EXTENSIONS > - > -// > -// Disable warning that make it impossible to compile at /W4 > -// This only works for Microsoft* tools > -// > - > -// > -// Disabling bitfield type checking warnings. > -// > -#pragma warning ( disable : 4214 ) > - > -// > -// Disabling the unreferenced formal parameter warnings. > -// > -#pragma warning ( disable : 4100 ) > - > -// > -// Disable slightly different base types warning as CHAR8 * can not be set > -// to a constant string. > -// > -#pragma warning ( disable : 4057 ) > - > -// > -// ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning > -// > -#pragma warning ( disable : 4127 ) > - > - > -#endif > - > - > -#if !defined(__GNUC__) && (__STDC_VERSION__ < 199901L) > - // > - // No ANSI C 2000 stdint.h integer width declarations, so define equivalents > - // > - > - #if _MSC_EXTENSIONS > - > - > - // > - // use Microsoft C compiler dependent integer width types > - // > - typedef unsigned __int64 UINT64; > - typedef __int64 INT64; > - typedef unsigned __int32 UINT32; > - typedef __int32 INT32; > - typedef unsigned short UINT16; > - typedef unsigned short CHAR16; > - typedef short INT16; > - typedef unsigned char BOOLEAN; > - typedef unsigned char UINT8; > - typedef char CHAR8; > - typedef char INT8; > - #else > - #ifdef _EFI_P64 > - // > - // P64 - is Intel Itanium(TM) speak for pointers being 64-bit and longs and ints > - // are 32-bits > - // > - typedef unsigned long long UINT64; > - typedef long long INT64; > - typedef unsigned int UINT32; > - typedef int INT32; > - typedef unsigned short CHAR16; > - typedef unsigned short UINT16; > - typedef short INT16; > - typedef unsigned char BOOLEAN; > - typedef unsigned char UINT8; > - typedef char CHAR8; > - typedef char INT8; > - #else > - // > - // Assume LP64 - longs and pointers are 64-bit. Ints are 32-bit. > - // > - typedef unsigned long UINT64; > - typedef long INT64; > - typedef unsigned int UINT32; > - typedef int INT32; > - typedef unsigned short UINT16; > - typedef unsigned short CHAR16; > - typedef short INT16; > - typedef unsigned char BOOLEAN; > - typedef unsigned char UINT8; > - typedef char CHAR8; > - typedef char INT8; > - #endif > - #endif > - > - #define UINT8_MAX 0xff > - > -#else > - // > - // Use ANSI C 2000 stdint.h integer width declarations > - // > - #include > - typedef uint8_t BOOLEAN; > - typedef int8_t INT8; > - typedef uint8_t UINT8; > - typedef int16_t INT16; > - typedef uint16_t UINT16; > - typedef int32_t INT32; > - typedef uint32_t UINT32; > - typedef int64_t INT64; > - typedef uint64_t UINT64; > - typedef char CHAR8; > - typedef uint16_t CHAR16; > - > -#endif > - > -typedef UINT64 UINTN; > -typedef INT64 INTN; > - > - > -// > -// Processor specific defines > -// > -#define MAX_BIT 0x8000000000000000ULL > -#define MAX_2_BITS 0xC000000000000000ULL > - > -// > -// Modifier to ensure that all protocol member functions and EFI intrinsics > -// use the correct C calling convention. All protocol member functions and > -// EFI intrinsics are required to modify their member functions with EFIAPI. > -// > -#if _MSC_EXTENSIONS > - /// > - /// Define the standard calling convention regardless of optimization level. > - /// __cdecl is Microsoft* specific C extension. > - /// > - #define EFIAPI __cdecl > -#elif __GNUC__ > - /// > - /// Define the standard calling convention regardless of optimization level. > - /// efidecl is an extension to GCC that supports the differnece between x64 > - /// GCC ABI and x64 Microsoft* ABI. EFI is closer to the Microsoft* ABI and > - /// EFIAPI makes sure the right ABI is used for public interfaces. > - /// eficecl is a work in progress and we do not yet have the compiler > - /// > - #define EFIAPI > -#else > - #define EFIAPI > -#endif > - > -// > -// The Microsoft* C compiler can removed references to unreferenced data items > -// if the /OPT:REF linker option is used. We defined a macro as this is a > -// a non standard extension > -// > -#if _MSC_EXTENSIONS > - #define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany) > -#else > - #define GLOBAL_REMOVE_IF_UNREFERENCED > -#endif > - > -#endif > - > diff --git a/BaseTools/Source/C/Common/Decompress.c b/BaseTools/Source/C/Common/Decompress.c > index d85098f13140..8625ccd03618 100644 > --- a/BaseTools/Source/C/Common/Decompress.c > +++ b/BaseTools/Source/C/Common/Decompress.c > @@ -15,6 +15,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > // > // Decompression algorithm begins here > // > +#define UINT8_MAX 0xff > #define BITBUFSIZ 32 > #define MAXMATCH 256 > #define THRESHOLD 3 > diff --git a/BaseTools/Source/C/Makefiles/header.makefile b/BaseTools/Source/C/Makefiles/header.makefile > index 4e88a4fbd86b..cecca2c27462 100644 > --- a/BaseTools/Source/C/Makefiles/header.makefile > +++ b/BaseTools/Source/C/Makefiles/header.makefile > @@ -8,6 +8,8 @@ > # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
> # SPDX-License-Identifier: BSD-2-Clause-Patent > > +EDK2_PATH ?= $(MAKEROOT)/../../.. > + > ifndef HOST_ARCH > # > # If HOST_ARCH is not defined, then we use 'uname -m' to attempt > @@ -59,22 +61,22 @@ BUILD_LD ?= ld > endif > LINKER ?= $(BUILD_CC) > ifeq ($(HOST_ARCH), IA32) > -ARCH_INCLUDE = -I $(MAKEROOT)/Include/Ia32/ > +ARCH_INCLUDE = -I $(EDK2_PATH)/MdePkg/Include/Ia32/ > > else ifeq ($(HOST_ARCH), X64) > -ARCH_INCLUDE = -I $(MAKEROOT)/Include/X64/ > +ARCH_INCLUDE = -I $(EDK2_PATH)/MdePkg/Include/X64/ > > else ifeq ($(HOST_ARCH), ARM) > -ARCH_INCLUDE = -I $(MAKEROOT)/Include/Arm/ > +ARCH_INCLUDE = -I $(EDK2_PATH)/MdePkg/Include/Arm/ > > else ifeq ($(HOST_ARCH), AARCH64) > -ARCH_INCLUDE = -I $(MAKEROOT)/Include/AArch64/ > +ARCH_INCLUDE = -I $(EDK2_PATH)/MdePkg/Include/AArch64/ > > else ifeq ($(HOST_ARCH), RISCV64) > -ARCH_INCLUDE = -I $(MAKEROOT)/Include/RiscV64/ > +ARCH_INCLUDE = -I $(EDK2_PATH)/MdePkg/Include/RiscV64/ > > else ifeq ($(HOST_ARCH), LOONGARCH64) > -ARCH_INCLUDE = -I $(MAKEROOT)/Include/LoongArch64/ > +ARCH_INCLUDE = -I $(EDK2_PATH)/MdePkg/Include/LoongArch64/ > > else > $(error Bad HOST_ARCH) > diff --git a/BaseTools/Source/C/Makefiles/ms.common b/BaseTools/Source/C/Makefiles/ms.common > index 8391f10d5dd2..985d9498ccb8 100644 > --- a/BaseTools/Source/C/Makefiles/ms.common > +++ b/BaseTools/Source/C/Makefiles/ms.common > @@ -17,6 +17,14 @@ > HOST_ARCH = IA32 > !ENDIF > > +!IFNDEF MAKEROOT > +MAKEROOT = $(SOURCE_PATH) > +!ENDIF > + > +!IFNDEF EDK2_PATH > +EDK2_PATH = $(MAKEROOT)\..\..\.. > +!ENDIF > + > MAKE = nmake -nologo > > # DOS del command doesn't support ":\\" in the file path, such as j:\\BaseTools. Convert ":\\" to ":\" > @@ -31,14 +39,14 @@ SYS_BIN_PATH=$(EDK_TOOLS_PATH)\Bin > SYS_LIB_PATH=$(EDK_TOOLS_PATH)\Lib > > !IF "$(HOST_ARCH)"=="IA32" > -ARCH_INCLUDE = $(SOURCE_PATH)\Include\Ia32 > +ARCH_INCLUDE = $(EDK2_PATH)\MdePkg\Include\Ia32 > BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win32 > LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win32 > SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win32 > SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win32 > > !ELSEIF "$(HOST_ARCH)"=="X64" > -ARCH_INCLUDE = $(SOURCE_PATH)\Include\X64 > +ARCH_INCLUDE = $(EDK2_PATH)\MdePkg\Include\X64 > BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win64 > LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win64 > SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win64 --------------MKNlyVeama5Pg7Hp04Dm3NvF Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Reviewed-by: Chao Li <lichao@loongson.cn>


Thanks,
Chao
在 2023/3/23 19:17, Gerd Hoffmann 写道:
Use the MdePkg version instead of maintaining a copy in BaseTools.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 .../Source/C/Include/AArch64/ProcessorBind.h  | 148 --------------
 .../Source/C/Include/Arm/ProcessorBind.h      | 147 --------------
 .../Source/C/Include/Ia32/ProcessorBind.h     | 155 ---------------
 .../C/Include/LoongArch64/ProcessorBind.h     |  80 --------
 .../Source/C/Include/RiscV64/ProcessorBind.h  |  85 --------
 .../Source/C/Include/X64/ProcessorBind.h      | 183 ------------------
 BaseTools/Source/C/Common/Decompress.c        |   1 +
 BaseTools/Source/C/Makefiles/header.makefile  |  14 +-
 BaseTools/Source/C/Makefiles/ms.common        |  12 +-
 9 files changed, 19 insertions(+), 806 deletions(-)
 delete mode 100644 BaseTools/Source/C/Include/AArch64/ProcessorBind.h
 delete mode 100644 BaseTools/Source/C/Include/Arm/ProcessorBind.h
 delete mode 100644 BaseTools/Source/C/Include/Ia32/ProcessorBind.h
 delete mode 100644 BaseTools/Source/C/Include/LoongArch64/ProcessorBind.h
 delete mode 100644 BaseTools/Source/C/Include/RiscV64/ProcessorBind.h
 delete mode 100644 BaseTools/Source/C/Include/X64/ProcessorBind.h

diff --git a/BaseTools/Source/C/Include/AArch64/ProcessorBind.h b/BaseTools/Source/C/Include/AArch64/ProcessorBind.h
deleted file mode 100644
index dfa725b2e363..000000000000
--- a/BaseTools/Source/C/Include/AArch64/ProcessorBind.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/** @file
-  Processor or Compiler specific defines and types for AArch64.
-
-  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-  Portions copyright (c) 2013, ARM Ltd. All rights reserved.<BR>
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __PROCESSOR_BIND_H__
-#define __PROCESSOR_BIND_H__
-
-///
-/// Define the processor type so other code can make processor based choices
-///
-#define MDE_CPU_AARCH64
-
-//
-// Make sure we are using the correct packing rules per EFI specification
-//
-#ifndef __GNUC__
-#pragma pack()
-#endif
-
-#if _MSC_EXTENSIONS
-  //
-  // use Microsoft* C compiler dependent integer width types
-  //
-  typedef unsigned __int64    UINT64;
-  typedef __int64             INT64;
-  typedef unsigned __int32    UINT32;
-  typedef __int32             INT32;
-  typedef unsigned short      UINT16;
-  typedef unsigned short      CHAR16;
-  typedef short               INT16;
-  typedef unsigned char       BOOLEAN;
-  typedef unsigned char       UINT8;
-  typedef char                CHAR8;
-  typedef signed char         INT8;
-#else
-  //
-  // Use ANSI C 2000 stdint.h integer width declarations
-  //
-  #include <stdint.h>
-  typedef uint8_t   BOOLEAN;
-  typedef int8_t    INT8;
-  typedef uint8_t   UINT8;
-  typedef int16_t   INT16;
-  typedef uint16_t  UINT16;
-  typedef int32_t   INT32;
-  typedef uint32_t  UINT32;
-  typedef int64_t   INT64;
-  typedef uint64_t  UINT64;
-  typedef char      CHAR8;
-  typedef uint16_t  CHAR16;
-
-#endif
-
-///
-/// Unsigned value of native width.  (4 bytes on supported 32-bit processor instructions,
-/// 8 bytes on supported 64-bit processor instructions)
-///
-typedef UINT64  UINTN;
-
-///
-/// Signed value of native width.  (4 bytes on supported 32-bit processor instructions,
-/// 8 bytes on supported 64-bit processor instructions)
-///
-typedef INT64   INTN;
-
-//
-// Processor specific defines
-//
-
-///
-/// A value of native width with the highest bit set.
-///
-#define MAX_BIT      0x8000000000000000
-
-///
-/// A value of native width with the two highest bits set.
-///
-#define MAX_2_BITS   0xC000000000000000
-
-///
-/// The stack alignment required for AARCH64
-///
-#define CPU_STACK_ALIGNMENT  16
-
-//
-// Modifier to ensure that all protocol member functions and EFI intrinsics
-// use the correct C calling convention. All protocol member functions and
-// EFI intrinsics are required to modify their member functions with EFIAPI.
-//
-#define EFIAPI
-
-#if defined(__GNUC__)
-  ///
-  /// For GNU assembly code, .global or .globl can declare global symbols.
-  /// Define this macro to unify the usage.
-  ///
-  #define ASM_GLOBAL .globl
-
-  #if !defined(__APPLE__)
-    ///
-    /// ARM EABI defines that the linker should not manipulate call relocations
-    /// (do bl/blx conversion) unless the target symbol has function type.
-    /// CodeSourcery 2010.09 started requiring the .type to function properly
-    ///
-    #define INTERWORK_FUNC(func__)   .type ASM_PFX(func__), %function
-
-    #define GCC_ASM_EXPORT(func__)  \
-             .global  _CONCATENATE (__USER_LABEL_PREFIX__, func__)    ;\
-             .type ASM_PFX(func__), %function
-
-    #define GCC_ASM_IMPORT(func__)  \
-             .extern  _CONCATENATE (__USER_LABEL_PREFIX__, func__)
-
-  #else
-    //
-    // .type not supported by Apple Xcode tools
-    //
-    #define INTERWORK_FUNC(func__)
-
-    #define GCC_ASM_EXPORT(func__)  \
-             .globl  _CONCATENATE (__USER_LABEL_PREFIX__, func__)    \
-
-    #define GCC_ASM_IMPORT(name)
-
-  #endif
-#endif
-
-/**
-  Return the pointer to the first instruction of a function given a function pointer.
-  On ARM CPU architectures, these two pointer values are the same,
-  so the implementation of this macro is very simple.
-
-  @param  FunctionPointer   A pointer to a function.
-
-  @return The pointer to the first instruction of a function given a function pointer.
-
-**/
-#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
-
-#endif
-
diff --git a/BaseTools/Source/C/Include/Arm/ProcessorBind.h b/BaseTools/Source/C/Include/Arm/ProcessorBind.h
deleted file mode 100644
index 8fe4d5f1626a..000000000000
--- a/BaseTools/Source/C/Include/Arm/ProcessorBind.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/** @file
-  Processor or Compiler specific defines and types for ARM.
-
-  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __PROCESSOR_BIND_H__
-#define __PROCESSOR_BIND_H__
-
-///
-/// Define the processor type so other code can make processor based choices
-///
-#define MDE_CPU_ARM
-
-//
-// Make sure we are using the correct packing rules per EFI specification
-//
-#ifndef __GNUC__
-#pragma pack()
-#endif
-
-#if _MSC_EXTENSIONS
-  //
-  // use Microsoft* C compiler dependent integer width types
-  //
-  typedef unsigned __int64    UINT64;
-  typedef __int64             INT64;
-  typedef unsigned __int32    UINT32;
-  typedef __int32             INT32;
-  typedef unsigned short      UINT16;
-  typedef unsigned short      CHAR16;
-  typedef short               INT16;
-  typedef unsigned char       BOOLEAN;
-  typedef unsigned char       UINT8;
-  typedef char                CHAR8;
-  typedef signed char         INT8;
-#else
-  //
-  // Assume standard ARM alignment.
-  //
-  typedef unsigned long long  UINT64;
-  typedef long long           INT64;
-  typedef unsigned int        UINT32;
-  typedef int                 INT32;
-  typedef unsigned short      UINT16;
-  typedef unsigned short      CHAR16;
-  typedef short               INT16;
-  typedef unsigned char       BOOLEAN;
-  typedef unsigned char       UINT8;
-  typedef char                CHAR8;
-  typedef signed char         INT8;
-
-  #define UINT8_MAX 0xff
-#endif
-
-///
-/// Unsigned value of native width.  (4 bytes on supported 32-bit processor instructions,
-/// 8 bytes on supported 64-bit processor instructions)
-///
-typedef UINT32  UINTN;
-
-///
-/// Signed value of native width.  (4 bytes on supported 32-bit processor instructions,
-/// 8 bytes on supported 64-bit processor instructions)
-///
-typedef INT32   INTN;
-
-//
-// Processor specific defines
-//
-
-///
-/// A value of native width with the highest bit set.
-///
-#define MAX_BIT      0x80000000
-
-///
-/// A value of native width with the two highest bits set.
-///
-#define MAX_2_BITS   0xC0000000
-
-///
-/// The stack alignment required for ARM
-///
-#define CPU_STACK_ALIGNMENT  sizeof(UINT64)
-
-//
-// Modifier to ensure that all protocol member functions and EFI intrinsics
-// use the correct C calling convention. All protocol member functions and
-// EFI intrinsics are required to modify their member functions with EFIAPI.
-//
-#define EFIAPI
-
-#if defined(__GNUC__)
-  ///
-  /// For GNU assembly code, .global or .globl can declare global symbols.
-  /// Define this macro to unify the usage.
-  ///
-  #define ASM_GLOBAL .globl
-
-  #if !defined(__APPLE__)
-    ///
-    /// ARM EABI defines that the linker should not manipulate call relocations
-    /// (do bl/blx conversion) unless the target symbol has function type.
-    /// CodeSourcery 2010.09 started requiring the .type to function properly
-    ///
-    #define INTERWORK_FUNC(func__)   .type ASM_PFX(func__), %function
-
-    #define GCC_ASM_EXPORT(func__)  \
-             .global  _CONCATENATE (__USER_LABEL_PREFIX__, func__)    ;\
-             .type ASM_PFX(func__), %function
-
-    #define GCC_ASM_IMPORT(func__)  \
-             .extern  _CONCATENATE (__USER_LABEL_PREFIX__, func__)
-
-  #else
-    //
-    // .type not supported by Apple Xcode tools
-    //
-    #define INTERWORK_FUNC(func__)
-
-    #define GCC_ASM_EXPORT(func__)  \
-             .globl  _CONCATENATE (__USER_LABEL_PREFIX__, func__)    \
-
-    #define GCC_ASM_IMPORT(name)
-
-  #endif
-#endif
-
-/**
-  Return the pointer to the first instruction of a function given a function pointer.
-  On ARM CPU architectures, these two pointer values are the same,
-  so the implementation of this macro is very simple.
-
-  @param  FunctionPointer   A pointer to a function.
-
-  @return The pointer to the first instruction of a function given a function pointer.
-
-**/
-#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
-
-#endif
-
-
diff --git a/BaseTools/Source/C/Include/Ia32/ProcessorBind.h b/BaseTools/Source/C/Include/Ia32/ProcessorBind.h
deleted file mode 100644
index d1b77ad04a8b..000000000000
--- a/BaseTools/Source/C/Include/Ia32/ProcessorBind.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/** @file
-  Processor or Compiler specific defines and types for x64.
-
-  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __PROCESSOR_BIND_H__
-#define __PROCESSOR_BIND_H__
-
-//
-// Define the processor type so other code can make processor based choices
-//
-#define MDE_CPU_IA32
-
-//
-// Make sure we are useing the correct packing rules per EFI specification
-//
-#ifndef __GNUC__
-#pragma pack()
-#endif
-
-#if _MSC_EXTENSIONS
-
-//
-// Disable warning that make it impossible to compile at /W4
-// This only works for Microsoft* tools
-//
-
-//
-// Disabling bitfield type checking warnings.
-//
-#pragma warning ( disable : 4214 )
-
-//
-// Disabling the unreferenced formal parameter warnings.
-//
-#pragma warning ( disable : 4100 )
-
-//
-// Disable slightly different base types warning as CHAR8 * can not be set
-// to a constant string.
-//
-#pragma warning ( disable : 4057 )
-
-//
-// ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning
-//
-#pragma warning ( disable : 4127 )
-
-
-#endif
-
-
-#if !defined(__GNUC__) && (__STDC_VERSION__ < 199901L)
-  //
-  // No ANSI C 2000 stdint.h integer width declarations, so define equivalents
-  //
-
-  #if _MSC_EXTENSIONS
-
-    //
-    // use Microsoft* C compiler dependent integer width types
-    //
-    typedef unsigned __int64    UINT64;
-    typedef __int64             INT64;
-    typedef unsigned __int32    UINT32;
-    typedef __int32             INT32;
-    typedef unsigned short      UINT16;
-    typedef unsigned short      CHAR16;
-    typedef short               INT16;
-    typedef unsigned char       BOOLEAN;
-    typedef unsigned char       UINT8;
-    typedef char                CHAR8;
-    typedef char                INT8;
-  #else
-
-    //
-    // Assume standard IA-32 alignment.
-    // BugBug: Need to check portability of long long
-    //
-    typedef unsigned long long  UINT64;
-    typedef long long           INT64;
-    typedef unsigned int        UINT32;
-    typedef int                 INT32;
-    typedef unsigned short      UINT16;
-    typedef unsigned short      CHAR16;
-    typedef short               INT16;
-    typedef unsigned char       BOOLEAN;
-    typedef unsigned char       UINT8;
-    typedef char                CHAR8;
-    typedef char                INT8;
-  #endif
-
-  #define UINT8_MAX 0xff
-
-#else
-  //
-  // Use ANSI C 2000 stdint.h integer width declarations
-  //
-  #include "stdint.h"
-  typedef uint8_t   BOOLEAN;
-  typedef int8_t    INT8;
-  typedef uint8_t   UINT8;
-  typedef int16_t   INT16;
-  typedef uint16_t  UINT16;
-  typedef int32_t   INT32;
-  typedef uint32_t  UINT32;
-  typedef int64_t   INT64;
-  typedef uint64_t  UINT64;
-  typedef char      CHAR8;
-  typedef uint16_t  CHAR16;
-
-#endif
-
-typedef UINT32  UINTN;
-typedef INT32   INTN;
-
-
-//
-// Processor specific defines
-//
-#define MAX_BIT     0x80000000
-#define MAX_2_BITS  0xC0000000
-
-//
-// Modifier to ensure that all protocol member functions and EFI intrinsics
-// use the correct C calling convention. All protocol member functions and
-// EFI intrinsics are required to modify their member functions with EFIAPI.
-//
-#if _MSC_EXTENSIONS
-  //
-  // Microsoft* compiler requires _EFIAPI usage, __cdecl is Microsoft* specific C.
-  //
-  #define EFIAPI __cdecl
-#endif
-
-#if __GNUC__
-  #define EFIAPI __attribute__((cdecl))
-#endif
-
-//
-// The Microsoft* C compiler can removed references to unreferenced data items
-//  if the /OPT:REF linker option is used. We defined a macro as this is a
-//  a non standard extension
-//
-#if _MSC_EXTENSIONS
-  #define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany)
-#else
-  #define GLOBAL_REMOVE_IF_UNREFERENCED
-#endif
-
-#endif
diff --git a/BaseTools/Source/C/Include/LoongArch64/ProcessorBind.h b/BaseTools/Source/C/Include/LoongArch64/ProcessorBind.h
deleted file mode 100644
index 0267859deece..000000000000
--- a/BaseTools/Source/C/Include/LoongArch64/ProcessorBind.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/** @file
-  Processor or Compiler specific defines and types for LoongArch
-
-  Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-#ifndef PROCESSOR_BIND_H_
-#define PROCESSOR_BIND_H_
-
-//
-// Define the processor type so other code can make processor based choices
-//
-#define MDE_CPU_LOONGARCH64
-
-#define EFIAPI
-
-//
-// Make sure we are using the correct packing rules per EFI specification
-//
-#ifndef __GNUC__
-#pragma pack()
-#endif
-
-//
-// Use ANSI C 2000 stdint.h integer width declarations
-//
-#include <stdint.h>
-typedef uint8_t   BOOLEAN;
-typedef int8_t    INT8;
-typedef uint8_t   UINT8;
-typedef int16_t   INT16;
-typedef uint16_t  UINT16;
-typedef int32_t   INT32;
-typedef uint32_t  UINT32;
-typedef int64_t   INT64;
-typedef uint64_t  UINT64;
-typedef char      CHAR8;
-typedef uint16_t  CHAR16;
-
-//
-// Unsigned value of native width.  (4 bytes on supported 32-bit processor instructions,
-// 8 bytes on supported 64-bit processor instructions)
-//
-typedef UINT64 UINTN;
-
-//
-// Signed value of native width.  (4 bytes on supported 32-bit processor instructions,
-// 8 bytes on supported 64-bit processor instructions)
-//
-typedef INT64 INTN;
-
-//
-// Processor specific defines
-//
-
-//
-// A value of native width with the highest bit set.
-//
-#define MAX_BIT  0x8000000000000000ULL
-//
-// A value of native width with the two highest bits set.
-//
-#define MAX_2_BITS  0xC000000000000000ULL
-
-#if defined (__GNUC__)
-//
-// For GNU assembly code, .global or .globl can declare global symbols.
-// Define this macro to unify the usage.
-//
-#define ASM_GLOBAL  .globl
-#endif
-
-//
-// The stack alignment required for LoongArch
-//
-#define CPU_STACK_ALIGNMENT  16
-
-#endif
diff --git a/BaseTools/Source/C/Include/RiscV64/ProcessorBind.h b/BaseTools/Source/C/Include/RiscV64/ProcessorBind.h
deleted file mode 100644
index 1612d6ea7f16..000000000000
--- a/BaseTools/Source/C/Include/RiscV64/ProcessorBind.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/** @file
-  Processor or Compiler specific defines and types for RISC-V.
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __PROCESSOR_BIND_H__
-#define __PROCESSOR_BIND_H__
-
-//
-// Define the processor type so other code can make processor based choices
-//
-#define MDE_CPU_RISCV64
-
-//
-// Make sure we are using the correct packing rules per EFI specification
-//
-#ifndef __GNUC__
-#pragma pack()
-#endif
-
-//
-// Use ANSI C 2000 stdint.h integer width declarations
-//
-#include <stdint.h>
-typedef uint8_t   BOOLEAN;
-typedef int8_t    INT8;
-typedef uint8_t   UINT8;
-typedef int16_t   INT16;
-typedef uint16_t  UINT16;
-typedef int32_t   INT32;
-typedef uint32_t  UINT32;
-typedef int64_t   INT64;
-typedef uint64_t  UINT64;
-typedef char      CHAR8;
-typedef uint16_t  CHAR16;
-
-//
-// Unsigned value of native width.  (4 bytes on supported 32-bit processor instructions,
-// 8 bytes on supported 64-bit processor instructions)
-//
-typedef UINT64  UINTN;
-
-//
-// Signed value of native width.  (4 bytes on supported 32-bit processor instructions,
-// 8 bytes on supported 64-bit processor instructions)
-//
-typedef INT64   INTN;
-
-//
-// Processor specific defines
-//
-
-//
-// A value of native width with the highest bit set.
-//
-#define MAX_BIT      0x8000000000000000
-
-//
-// A value of native width with the two highest bits set.
-//
-#define MAX_2_BITS   0xC000000000000000
-
-//
-// The stack alignment required for RISC-V
-//
-#define CPU_STACK_ALIGNMENT  16
-
-//
-// Modifier to ensure that all protocol member functions and EFI intrinsics
-// use the correct C calling convention. All protocol member functions and
-// EFI intrinsics are required to modify their member functions with EFIAPI.
-//
-#define EFIAPI
-
-#if defined(__GNUC__)
-  //
-  // For GNU assembly code, .global or .globl can declare global symbols.
-  // Define this macro to unify the usage.
-  //
-  #define ASM_GLOBAL .globl
-#endif
-
-#endif
diff --git a/BaseTools/Source/C/Include/X64/ProcessorBind.h b/BaseTools/Source/C/Include/X64/ProcessorBind.h
deleted file mode 100644
index fce179fe7e3a..000000000000
--- a/BaseTools/Source/C/Include/X64/ProcessorBind.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/** @file
-  Processor or Compiler specific defines and types x64 (Intel(r) EM64T, AMD64).
-
-  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __PROCESSOR_BIND_H__
-#define __PROCESSOR_BIND_H__
-
-//
-// Define the processor type so other code can make processor based choices
-//
-#define MDE_CPU_X64
-
-
-//
-// Make sure we are useing the correct packing rules per EFI specification
-//
-#ifndef __GNUC__
-#pragma pack()
-#endif
-
-
-#if _MSC_EXTENSIONS
-
-//
-// Disable warning that make it impossible to compile at /W4
-// This only works for Microsoft* tools
-//
-
-//
-// Disabling bitfield type checking warnings.
-//
-#pragma warning ( disable : 4214 )
-
-//
-// Disabling the unreferenced formal parameter warnings.
-//
-#pragma warning ( disable : 4100 )
-
-//
-// Disable slightly different base types warning as CHAR8 * can not be set
-// to a constant string.
-//
-#pragma warning ( disable : 4057 )
-
-//
-// ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning
-//
-#pragma warning ( disable : 4127 )
-
-
-#endif
-
-
-#if !defined(__GNUC__) && (__STDC_VERSION__ < 199901L)
-  //
-  // No ANSI C 2000 stdint.h integer width declarations, so define equivalents
-  //
-
-  #if _MSC_EXTENSIONS
-
-
-    //
-    // use Microsoft C compiler dependent integer width types
-    //
-    typedef unsigned __int64    UINT64;
-    typedef __int64             INT64;
-    typedef unsigned __int32    UINT32;
-    typedef __int32             INT32;
-    typedef unsigned short      UINT16;
-    typedef unsigned short      CHAR16;
-    typedef short               INT16;
-    typedef unsigned char       BOOLEAN;
-    typedef unsigned char       UINT8;
-    typedef char                CHAR8;
-    typedef char                INT8;
-  #else
-    #ifdef _EFI_P64
-      //
-      // P64 - is Intel Itanium(TM) speak for pointers being 64-bit and longs and ints
-      //  are 32-bits
-      //
-      typedef unsigned long long  UINT64;
-      typedef long long           INT64;
-      typedef unsigned int        UINT32;
-      typedef int                 INT32;
-      typedef unsigned short      CHAR16;
-      typedef unsigned short      UINT16;
-      typedef short               INT16;
-      typedef unsigned char       BOOLEAN;
-      typedef unsigned char       UINT8;
-      typedef char                CHAR8;
-      typedef char                INT8;
-    #else
-      //
-      // Assume LP64 - longs and pointers are 64-bit. Ints are 32-bit.
-      //
-      typedef unsigned long   UINT64;
-      typedef long            INT64;
-      typedef unsigned int    UINT32;
-      typedef int             INT32;
-      typedef unsigned short  UINT16;
-      typedef unsigned short  CHAR16;
-      typedef short           INT16;
-      typedef unsigned char   BOOLEAN;
-      typedef unsigned char   UINT8;
-      typedef char            CHAR8;
-      typedef char            INT8;
-    #endif
-  #endif
-
-  #define UINT8_MAX 0xff
-
-#else
-  //
-  // Use ANSI C 2000 stdint.h integer width declarations
-  //
-  #include <stdint.h>
-  typedef uint8_t   BOOLEAN;
-  typedef int8_t    INT8;
-  typedef uint8_t   UINT8;
-  typedef int16_t   INT16;
-  typedef uint16_t  UINT16;
-  typedef int32_t   INT32;
-  typedef uint32_t  UINT32;
-  typedef int64_t   INT64;
-  typedef uint64_t  UINT64;
-  typedef char      CHAR8;
-  typedef uint16_t  CHAR16;
-
-#endif
-
-typedef UINT64  UINTN;
-typedef INT64   INTN;
-
-
-//
-// Processor specific defines
-//
-#define MAX_BIT     0x8000000000000000ULL
-#define MAX_2_BITS  0xC000000000000000ULL
-
-//
-// Modifier to ensure that all protocol member functions and EFI intrinsics
-// use the correct C calling convention. All protocol member functions and
-// EFI intrinsics are required to modify their member functions with EFIAPI.
-//
-#if _MSC_EXTENSIONS
-  ///
-  /// Define the standard calling convention regardless of optimization level.
-  /// __cdecl is Microsoft* specific C extension.
-  ///
-  #define EFIAPI __cdecl
-#elif __GNUC__
-  ///
-  /// Define the standard calling convention regardless of optimization level.
-  /// efidecl is an extension to GCC that supports the differnece between x64
-  /// GCC ABI and x64 Microsoft* ABI. EFI is closer to the Microsoft* ABI and
-  /// EFIAPI makes sure the right ABI is used for public interfaces.
-  /// eficecl is a work in progress and we do not yet have the compiler
-  ///
-  #define EFIAPI
-#else
-  #define EFIAPI
-#endif
-
-//
-// The Microsoft* C compiler can removed references to unreferenced data items
-//  if the /OPT:REF linker option is used. We defined a macro as this is a
-//  a non standard extension
-//
-#if _MSC_EXTENSIONS
-  #define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany)
-#else
-  #define GLOBAL_REMOVE_IF_UNREFERENCED
-#endif
-
-#endif
-
diff --git a/BaseTools/Source/C/Common/Decompress.c b/BaseTools/Source/C/Common/Decompress.c
index d85098f13140..8625ccd03618 100644
--- a/BaseTools/Source/C/Common/Decompress.c
+++ b/BaseTools/Source/C/Common/Decompress.c
@@ -15,6 +15,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 //
 // Decompression algorithm begins here
 //
+#define UINT8_MAX 0xff
 #define BITBUFSIZ 32
 #define MAXMATCH  256
 #define THRESHOLD 3
diff --git a/BaseTools/Source/C/Makefiles/header.makefile b/BaseTools/Source/C/Makefiles/header.makefile
index 4e88a4fbd86b..cecca2c27462 100644
--- a/BaseTools/Source/C/Makefiles/header.makefile
+++ b/BaseTools/Source/C/Makefiles/header.makefile
@@ -8,6 +8,8 @@
 # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 
+EDK2_PATH ?= $(MAKEROOT)/../../..
+
 ifndef HOST_ARCH
   #
   # If HOST_ARCH is not defined, then we use 'uname -m' to attempt
@@ -59,22 +61,22 @@ BUILD_LD ?= ld
 endif
 LINKER ?= $(BUILD_CC)
 ifeq ($(HOST_ARCH), IA32)
-ARCH_INCLUDE = -I $(MAKEROOT)/Include/Ia32/
+ARCH_INCLUDE = -I $(EDK2_PATH)/MdePkg/Include/Ia32/
 
 else ifeq ($(HOST_ARCH), X64)
-ARCH_INCLUDE = -I $(MAKEROOT)/Include/X64/
+ARCH_INCLUDE = -I $(EDK2_PATH)/MdePkg/Include/X64/
 
 else ifeq ($(HOST_ARCH), ARM)
-ARCH_INCLUDE = -I $(MAKEROOT)/Include/Arm/
+ARCH_INCLUDE = -I $(EDK2_PATH)/MdePkg/Include/Arm/
 
 else ifeq ($(HOST_ARCH), AARCH64)
-ARCH_INCLUDE = -I $(MAKEROOT)/Include/AArch64/
+ARCH_INCLUDE = -I $(EDK2_PATH)/MdePkg/Include/AArch64/
 
 else ifeq ($(HOST_ARCH), RISCV64)
-ARCH_INCLUDE = -I $(MAKEROOT)/Include/RiscV64/
+ARCH_INCLUDE = -I $(EDK2_PATH)/MdePkg/Include/RiscV64/
 
 else ifeq ($(HOST_ARCH), LOONGARCH64)
-ARCH_INCLUDE = -I $(MAKEROOT)/Include/LoongArch64/
+ARCH_INCLUDE = -I $(EDK2_PATH)/MdePkg/Include/LoongArch64/
 
 else
 $(error Bad HOST_ARCH)
diff --git a/BaseTools/Source/C/Makefiles/ms.common b/BaseTools/Source/C/Makefiles/ms.common
index 8391f10d5dd2..985d9498ccb8 100644
--- a/BaseTools/Source/C/Makefiles/ms.common
+++ b/BaseTools/Source/C/Makefiles/ms.common
@@ -17,6 +17,14 @@
 HOST_ARCH = IA32
 !ENDIF
 
+!IFNDEF MAKEROOT
+MAKEROOT = $(SOURCE_PATH)
+!ENDIF
+
+!IFNDEF EDK2_PATH
+EDK2_PATH = $(MAKEROOT)\..\..\..
+!ENDIF
+
 MAKE        = nmake -nologo
 
 # DOS del command doesn't support ":\\" in the file path, such as j:\\BaseTools. Convert ":\\" to ":\"
@@ -31,14 +39,14 @@ SYS_BIN_PATH=$(EDK_TOOLS_PATH)\Bin
 SYS_LIB_PATH=$(EDK_TOOLS_PATH)\Lib
 
 !IF "$(HOST_ARCH)"=="IA32"
-ARCH_INCLUDE = $(SOURCE_PATH)\Include\Ia32
+ARCH_INCLUDE = $(EDK2_PATH)\MdePkg\Include\Ia32
 BIN_PATH     = $(BASE_TOOLS_PATH)\Bin\Win32
 LIB_PATH     = $(BASE_TOOLS_PATH)\Lib\Win32
 SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win32
 SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win32
 
 !ELSEIF "$(HOST_ARCH)"=="X64"
-ARCH_INCLUDE = $(SOURCE_PATH)\Include\X64
+ARCH_INCLUDE = $(EDK2_PATH)\MdePkg\Include\X64
 BIN_PATH     = $(BASE_TOOLS_PATH)\Bin\Win64
 LIB_PATH     = $(BASE_TOOLS_PATH)\Lib\Win64
 SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win64
--------------MKNlyVeama5Pg7Hp04Dm3NvF--