From f3c45d2f0cb67dababcdf3b5041881d6cef1ed87 Mon Sep 17 00:00:00 2001 From: Michael Kubacki Date: Tue, 3 Feb 2026 14:34:16 -0500 Subject: [PATCH] UefiPayloadPkg: Replace include guards with #pragma once Replace traditional `#ifndef`/`#define`/`#endif` include guards with `#pragma` once. `#pragma once` is a widely supported preprocessor directive that prevents header files from being included multiple times. It is supported by all toolchains used to build edk2: GCC, Clang/LLVM, and MSVC. Compared to macro-based include guards, `#pragma once`: - Eliminates the risk of macro name collisions or copy/paste errors where two headers inadvertently use the same guard macro. - Eliminate inconsistency in the way include guard macros are named (e.g., some files use `__FILE_H__`, others use `FILE_H_`, etc.). - Reduces boilerplate (three lines replaced by one). - Avoids polluting the macro namespace with guard symbols. - Can improve build times as the preprocessor can skip re-opening the file entirely, rather than re-reading it to find the matching `#endif` ("multiple-include optimization"). - Note that some compilers may already optimize traditional include guards, by recognzining the idiomatic pattern. This change is made acknowledging that overall portability of the code will technically be reduced, as `#pragma once` is not part of the C/C++ standards. However, this is considered acceptable given: 1. edk2 already defines a subset of supported compilers in BaseTools/Conf/tools_def.template, all of which have supported `#pragma once` for over two decades. 2. There have been concerns raised to the project about inconsistent include guard naming and potential macro collisions. Approximate compiler support dates: - MSVC: Supported since Visual C++ 4.2 (1996) - GCC: Supported since 3.4 (2004) (http://gnu.ist.utl.pt/software/gcc/gcc-3.4/changes.html) - Clang (LLVM based): Since initial release in 2007 Signed-off-by: Michael Kubacki --- UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h | 5 +---- UefiPayloadPkg/BlSupportSmm/BlSupportSmm.h | 5 +---- UefiPayloadPkg/FvbRuntimeDxe/FvbService.h | 5 +---- UefiPayloadPkg/FvbRuntimeDxe/FvbSmmCommon.h | 5 +---- UefiPayloadPkg/GraphicsOutputDxe/GraphicsOutput.h | 5 ++--- UefiPayloadPkg/Include/Guid/AcpiBoardInfoGuid.h | 5 +---- UefiPayloadPkg/Include/Guid/BootManagerMenu.h | 4 +--- UefiPayloadPkg/Include/Guid/DebugPrintErrorLevel.h | 4 +--- UefiPayloadPkg/Include/Guid/FirmwareInfoGuid.h | 5 +---- UefiPayloadPkg/Include/Guid/MemoryMapInfoGuid.h | 5 +---- UefiPayloadPkg/Include/Guid/NvVariableInfoGuid.h | 5 +---- UefiPayloadPkg/Include/Guid/PayloadCommandLine.h | 4 +--- UefiPayloadPkg/Include/Guid/PciSegmentInfoGuid.h | 5 +---- UefiPayloadPkg/Include/Guid/SerialPortInfoGuid.h | 5 +---- UefiPayloadPkg/Include/Guid/SmmRegisterInfoGuid.h | 5 +---- UefiPayloadPkg/Include/Guid/SmmS3CommunicationInfoGuid.h | 5 +---- UefiPayloadPkg/Include/Guid/SmmStoreInfoGuid.h | 5 +---- UefiPayloadPkg/Include/Guid/SpiFlashInfoGuid.h | 5 +---- UefiPayloadPkg/Include/Guid/UniversalPayloadBase.h | 5 +---- .../Guid/UniversalPayloadSerialPortDeviceParentInfo.h | 5 +---- UefiPayloadPkg/Include/Library/BlParseLib.h | 5 +---- UefiPayloadPkg/Include/Library/BuildFdtLib.h | 5 +---- UefiPayloadPkg/Include/Library/DxeHobListLib.h | 5 +---- UefiPayloadPkg/Include/Library/FdtParserLib.h | 5 +---- UefiPayloadPkg/Include/Library/FlashDeviceLib.h | 5 +---- UefiPayloadPkg/Include/Library/HobParserLib.h | 5 +---- UefiPayloadPkg/Include/Library/PayloadEntryHelperLib.h | 5 +---- UefiPayloadPkg/Include/Library/PlatformSupportLib.h | 5 +---- UefiPayloadPkg/Include/Library/SmmStoreLib.h | 5 +---- UefiPayloadPkg/Include/Library/SmmStoreParseLib.h | 5 +---- UefiPayloadPkg/Include/Library/SpiFlashLib.h | 5 +---- UefiPayloadPkg/Include/UniversalPayload/DeviceTree.h | 5 +---- UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridge.h | 5 +---- .../Library/PlatformBootManagerLib/PlatformBootManager.h | 5 +---- .../Library/PlatformBootManagerLib/PlatformConsole.h | 5 +---- UefiPayloadPkg/Library/SmmStoreLib/SmmStore.h | 5 +---- UefiPayloadPkg/Library/SpiFlashLib/RegsSpi.h | 5 +---- UefiPayloadPkg/Library/SpiFlashLib/SpiCommon.h | 5 +---- UefiPayloadPkg/PayloadLoaderPeim/ElfLib.h | 5 +---- UefiPayloadPkg/PayloadLoaderPeim/ElfLib/ElfLibInternal.h | 5 +---- UefiPayloadPkg/PayloadLoaderPeim/FitLib.h | 5 +---- UefiPayloadPkg/PchSmiDispatchSmm/PchSmiDispatchSmm.h | 5 +---- UefiPayloadPkg/PciPlatformDxe/PciPlatformDxe.h | 6 ++---- UefiPayloadPkg/SmmAccessDxe/SmmAccessDxe.h | 5 +---- UefiPayloadPkg/SmmStoreFvb/SmmStoreFvbRuntime.h | 5 +---- UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h | 5 +---- UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.h | 5 +---- 47 files changed, 49 insertions(+), 184 deletions(-) diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h index 2a235475f2..2359adf0ec 100644 --- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h +++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h @@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef __DXE_BOOTLOADER_SUPPORT_H__ -#define __DXE_BOOTLOADER_SUPPORT_H__ +#pragma once #include @@ -29,5 +28,3 @@ BlArchAdditionalOps ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ); - -#endif diff --git a/UefiPayloadPkg/BlSupportSmm/BlSupportSmm.h b/UefiPayloadPkg/BlSupportSmm/BlSupportSmm.h index b82f632556..1e5fcc90ae 100644 --- a/UefiPayloadPkg/BlSupportSmm/BlSupportSmm.h +++ b/UefiPayloadPkg/BlSupportSmm/BlSupportSmm.h @@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef BL_SUPPORT_SMM_H_ -#define BL_SUPPORT_SMM_H_ +#pragma once #include #include @@ -37,5 +36,3 @@ typedef struct { UINT32 Base; UINT32 Mask; } SMRR_BASE_MASK; - -#endif diff --git a/UefiPayloadPkg/FvbRuntimeDxe/FvbService.h b/UefiPayloadPkg/FvbRuntimeDxe/FvbService.h index 54428d8391..e2e5c82889 100644 --- a/UefiPayloadPkg/FvbRuntimeDxe/FvbService.h +++ b/UefiPayloadPkg/FvbRuntimeDxe/FvbService.h @@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef FW_BLOCK_SERVICE_H_ -#define FW_BLOCK_SERVICE_H_ +#pragma once #include #include @@ -181,5 +180,3 @@ extern FWB_GLOBAL mFvbModuleGlobal; extern EFI_FW_VOL_BLOCK_DEVICE mFvbDeviceTemplate; extern FV_MEMMAP_DEVICE_PATH mFvMemmapDevicePathTemplate; extern FV_PIWG_DEVICE_PATH mFvPIWGDevicePathTemplate; - -#endif diff --git a/UefiPayloadPkg/FvbRuntimeDxe/FvbSmmCommon.h b/UefiPayloadPkg/FvbRuntimeDxe/FvbSmmCommon.h index 0eadabe13f..64a24b26c5 100644 --- a/UefiPayloadPkg/FvbRuntimeDxe/FvbSmmCommon.h +++ b/UefiPayloadPkg/FvbRuntimeDxe/FvbSmmCommon.h @@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef SMM_FVB_COMMON_H_ -#define SMM_FVB_COMMON_H_ +#pragma once #include @@ -64,5 +63,3 @@ typedef struct { EFI_LBA StartLba; UINTN NumOfLba; } SMM_FVB_BLOCKS_HEADER; - -#endif diff --git a/UefiPayloadPkg/GraphicsOutputDxe/GraphicsOutput.h b/UefiPayloadPkg/GraphicsOutputDxe/GraphicsOutput.h index b8a46df586..da14d50e65 100644 --- a/UefiPayloadPkg/GraphicsOutputDxe/GraphicsOutput.h +++ b/UefiPayloadPkg/GraphicsOutputDxe/GraphicsOutput.h @@ -7,8 +7,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef _GRAPHICS_OUTPUT_DXE_H_ -#define _GRAPHICS_OUTPUT_DXE_H_ +#pragma once + #include #include @@ -51,4 +51,3 @@ typedef struct { extern EFI_COMPONENT_NAME_PROTOCOL mGraphicsOutputComponentName; extern EFI_COMPONENT_NAME2_PROTOCOL mGraphicsOutputComponentName2; -#endif diff --git a/UefiPayloadPkg/Include/Guid/AcpiBoardInfoGuid.h b/UefiPayloadPkg/Include/Guid/AcpiBoardInfoGuid.h index 2f79c10f51..04d2774356 100644 --- a/UefiPayloadPkg/Include/Guid/AcpiBoardInfoGuid.h +++ b/UefiPayloadPkg/Include/Guid/AcpiBoardInfoGuid.h @@ -6,8 +6,7 @@ **/ -#ifndef ACPI_BOARD_INFO_GUID_H_ -#define ACPI_BOARD_INFO_GUID_H_ +#pragma once /// /// Board information GUID @@ -26,5 +25,3 @@ typedef struct { UINT64 PcieBaseAddress; UINT64 PcieBaseSize; } ACPI_BOARD_INFO; - -#endif diff --git a/UefiPayloadPkg/Include/Guid/BootManagerMenu.h b/UefiPayloadPkg/Include/Guid/BootManagerMenu.h index 36ea451989..93aaa6e40d 100644 --- a/UefiPayloadPkg/Include/Guid/BootManagerMenu.h +++ b/UefiPayloadPkg/Include/Guid/BootManagerMenu.h @@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU_H_ -#define UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU_H_ +#pragma once #include #include @@ -24,4 +23,3 @@ typedef struct { #define UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU_REVISION 1 extern GUID gEdkiiBootManagerMenuFileGuid; -#endif diff --git a/UefiPayloadPkg/Include/Guid/DebugPrintErrorLevel.h b/UefiPayloadPkg/Include/Guid/DebugPrintErrorLevel.h index 164d57944a..59c973015f 100644 --- a/UefiPayloadPkg/Include/Guid/DebugPrintErrorLevel.h +++ b/UefiPayloadPkg/Include/Guid/DebugPrintErrorLevel.h @@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef UEFI_PAYLOAD_DEBUG_PRINT_ERROR_LEVEL_H_ -#define UEFI_PAYLOAD_DEBUG_PRINT_ERROR_LEVEL_H_ +#pragma once #include #include @@ -28,4 +27,3 @@ typedef struct { #define UEFI_PAYLOAD_DEBUG_PRINT_ERROR_LEVEL_REVISION 1 extern GUID gEdkiiDebugPrintErrorLevelGuid; -#endif diff --git a/UefiPayloadPkg/Include/Guid/FirmwareInfoGuid.h b/UefiPayloadPkg/Include/Guid/FirmwareInfoGuid.h index fa1d0649e2..820b217b67 100644 --- a/UefiPayloadPkg/Include/Guid/FirmwareInfoGuid.h +++ b/UefiPayloadPkg/Include/Guid/FirmwareInfoGuid.h @@ -7,8 +7,7 @@ **/ -#ifndef FIRMWARE_INFO_GUID_H_ -#define FIRMWARE_INFO_GUID_H_ +#pragma once /// /// Firmware information GUID @@ -22,5 +21,3 @@ typedef struct { UINT32 LowestSupportedVersion; UINT32 ImageSize; } FIRMWARE_INFO; - -#endif // FIRMWARE_INFO_GUID_H_ diff --git a/UefiPayloadPkg/Include/Guid/MemoryMapInfoGuid.h b/UefiPayloadPkg/Include/Guid/MemoryMapInfoGuid.h index 1b9b2b7fbc..64ab60d665 100644 --- a/UefiPayloadPkg/Include/Guid/MemoryMapInfoGuid.h +++ b/UefiPayloadPkg/Include/Guid/MemoryMapInfoGuid.h @@ -6,8 +6,7 @@ **/ -#ifndef MEMORY_MAP_INFO_GUID_H_ -#define MEMORY_MAP_INFO_GUID_H_ +#pragma once #include @@ -32,5 +31,3 @@ typedef struct { MEMORY_MAP_ENTRY Entry[0]; } MEMORY_MAP_INFO; #pragma pack() - -#endif diff --git a/UefiPayloadPkg/Include/Guid/NvVariableInfoGuid.h b/UefiPayloadPkg/Include/Guid/NvVariableInfoGuid.h index fd0bd73529..bb56359284 100644 --- a/UefiPayloadPkg/Include/Guid/NvVariableInfoGuid.h +++ b/UefiPayloadPkg/Include/Guid/NvVariableInfoGuid.h @@ -6,8 +6,7 @@ **/ -#ifndef NV_VARIABLE_INFO_GUID_H_ -#define NV_VARIABLE_INFO_GUID_H_ +#pragma once // // NV variable hob info GUID @@ -20,5 +19,3 @@ typedef struct { UINT32 VariableStoreBase; UINT32 VariableStoreSize; } NV_VARIABLE_INFO; - -#endif diff --git a/UefiPayloadPkg/Include/Guid/PayloadCommandLine.h b/UefiPayloadPkg/Include/Guid/PayloadCommandLine.h index 845a30efe1..832f7f7d33 100644 --- a/UefiPayloadPkg/Include/Guid/PayloadCommandLine.h +++ b/UefiPayloadPkg/Include/Guid/PayloadCommandLine.h @@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef PAYLOAD_COMMAND_LINE_H_ -#define PAYLOAD_COMMAND_LINE_H_ +#pragma once #include #include @@ -25,4 +24,3 @@ typedef struct { #define UNIVERSAL_PAYLOAD_COMMAND_LINE_REVISION 1 extern GUID gEdkiiPayloadCommandLineGuid; -#endif diff --git a/UefiPayloadPkg/Include/Guid/PciSegmentInfoGuid.h b/UefiPayloadPkg/Include/Guid/PciSegmentInfoGuid.h index 57872baa06..549506beb1 100644 --- a/UefiPayloadPkg/Include/Guid/PciSegmentInfoGuid.h +++ b/UefiPayloadPkg/Include/Guid/PciSegmentInfoGuid.h @@ -6,8 +6,7 @@ **/ -#ifndef UPL_PCI_SEGMENT_INFO_GUID_H_ -#define UPL_PCI_SEGMENT_INFO_GUID_H_ +#pragma once /// /// UPL Pcie Segment Information Hob GUID @@ -28,5 +27,3 @@ typedef struct { #pragma pack() #define UNIVERSAL_PAYLOAD_PCI_SEGMENT_INFO_REVISION 1 - -#endif diff --git a/UefiPayloadPkg/Include/Guid/SerialPortInfoGuid.h b/UefiPayloadPkg/Include/Guid/SerialPortInfoGuid.h index 1553e0ddc9..3ddc23af32 100644 --- a/UefiPayloadPkg/Include/Guid/SerialPortInfoGuid.h +++ b/UefiPayloadPkg/Include/Guid/SerialPortInfoGuid.h @@ -6,8 +6,7 @@ **/ -#ifndef SERIAL_PORT_INFO_GUID_H_ -#define SERIAL_PORT_INFO_GUID_H_ +#pragma once /// /// Serial Port Information GUID @@ -27,5 +26,3 @@ typedef struct { UINT32 InputHertz; UINT32 UartPciAddr; } SERIAL_PORT_INFO; - -#endif diff --git a/UefiPayloadPkg/Include/Guid/SmmRegisterInfoGuid.h b/UefiPayloadPkg/Include/Guid/SmmRegisterInfoGuid.h index 665eaa7e77..7f39bdd6e3 100644 --- a/UefiPayloadPkg/Include/Guid/SmmRegisterInfoGuid.h +++ b/UefiPayloadPkg/Include/Guid/SmmRegisterInfoGuid.h @@ -6,8 +6,7 @@ **/ -#ifndef PAYLOAD_SMM_REGISTER_INFO_GUID_H_ -#define PAYLOAD_SMM_REGISTER_INFO_GUID_H_ +#pragma once #include @@ -43,5 +42,3 @@ typedef struct { } PLD_SMM_REGISTERS; #pragma pack() - -#endif diff --git a/UefiPayloadPkg/Include/Guid/SmmS3CommunicationInfoGuid.h b/UefiPayloadPkg/Include/Guid/SmmS3CommunicationInfoGuid.h index 0f7006a5f4..a2f24c7943 100644 --- a/UefiPayloadPkg/Include/Guid/SmmS3CommunicationInfoGuid.h +++ b/UefiPayloadPkg/Include/Guid/SmmS3CommunicationInfoGuid.h @@ -6,8 +6,7 @@ **/ -#ifndef PAYLOAD_S3_COMMUNICATION_GUID_H_ -#define PAYLOAD_S3_COMMUNICATION_GUID_H_ +#pragma once extern EFI_GUID gS3CommunicationGuid; @@ -50,5 +49,3 @@ typedef struct { } PLD_TO_BL_SMM_INFO; #pragma pack() - -#endif diff --git a/UefiPayloadPkg/Include/Guid/SmmStoreInfoGuid.h b/UefiPayloadPkg/Include/Guid/SmmStoreInfoGuid.h index 19b4bdc3f4..46c41bd3f4 100644 --- a/UefiPayloadPkg/Include/Guid/SmmStoreInfoGuid.h +++ b/UefiPayloadPkg/Include/Guid/SmmStoreInfoGuid.h @@ -6,8 +6,7 @@ **/ -#ifndef SMMSTORE_GUID_H_ -#define SMMSTORE_GUID_H_ +#pragma once /// /// System Table Information GUID @@ -22,5 +21,3 @@ typedef struct { UINT64 MmioAddress; UINT8 ApmCmd; } SMMSTORE_INFO; - -#endif // SMMSTORE_GUID_H_ diff --git a/UefiPayloadPkg/Include/Guid/SpiFlashInfoGuid.h b/UefiPayloadPkg/Include/Guid/SpiFlashInfoGuid.h index 59b81851d5..713283a928 100644 --- a/UefiPayloadPkg/Include/Guid/SpiFlashInfoGuid.h +++ b/UefiPayloadPkg/Include/Guid/SpiFlashInfoGuid.h @@ -6,8 +6,7 @@ **/ -#ifndef SPI_FLASH_INFO_GUID_H_ -#define SPI_FLASH_INFO_GUID_H_ +#pragma once #include // @@ -34,5 +33,3 @@ typedef struct { UINT16 Flags; PLD_GENERIC_ADDRESS SpiAddress; } SPI_FLASH_INFO; - -#endif diff --git a/UefiPayloadPkg/Include/Guid/UniversalPayloadBase.h b/UefiPayloadPkg/Include/Guid/UniversalPayloadBase.h index 26a999df8d..c79cb5ce90 100644 --- a/UefiPayloadPkg/Include/Guid/UniversalPayloadBase.h +++ b/UefiPayloadPkg/Include/Guid/UniversalPayloadBase.h @@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef UNIVERSAL_PAYLOAD_BASE_H_ -#define UNIVERSAL_PAYLOAD_BASE_H_ +#pragma once extern GUID gUniversalPayloadBaseGuid; @@ -25,5 +24,3 @@ typedef struct { #define SS_32BIT_MEMORY_SPACE BIT25 #define SS_64BIT_MEMORY_SPACE BIT24+BIT25 #define DWORDS_TO_NEXT_ADDR_TYPE 7 - -#endif // UNIVERSAL_PAYLOAD_BASE_H_ diff --git a/UefiPayloadPkg/Include/Guid/UniversalPayloadSerialPortDeviceParentInfo.h b/UefiPayloadPkg/Include/Guid/UniversalPayloadSerialPortDeviceParentInfo.h index 969befe2cb..391af5b4d8 100644 --- a/UefiPayloadPkg/Include/Guid/UniversalPayloadSerialPortDeviceParentInfo.h +++ b/UefiPayloadPkg/Include/Guid/UniversalPayloadSerialPortDeviceParentInfo.h @@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef UNIVERSAL_PAYLOAD_SERIAL_PORT_PARENT_DEVICE_INFO_ -#define UNIVERSAL_PAYLOAD_SERIAL_PORT_PARENT_DEVICE_INFO_ +#pragma once extern GUID gUniversalPayloadSerialPortParentDeviceInfoGuid; @@ -24,5 +23,3 @@ typedef struct { #pragma pack() #define UNIVERSAL_PAYLOAD_SERIAL_PORT_PARENT_DEVICE_INFO_REVISION 1 - -#endif // UNIVERSAL_PAYLOAD_SERIAL_PORT_PARENT_DEVICE_INFO_ diff --git a/UefiPayloadPkg/Include/Library/BlParseLib.h b/UefiPayloadPkg/Include/Library/BlParseLib.h index 7269910215..365a0f34d8 100644 --- a/UefiPayloadPkg/Include/Library/BlParseLib.h +++ b/UefiPayloadPkg/Include/Library/BlParseLib.h @@ -7,8 +7,7 @@ **/ -#ifndef BOOTLOADER_PARSE_LIB_ -#define BOOTLOADER_PARSE_LIB_ +#pragma once #include #include @@ -183,5 +182,3 @@ EFIAPI ParseCapsules ( IN BL_CAPSULE_CALLBACK CapsuleCallback ); - -#endif diff --git a/UefiPayloadPkg/Include/Library/BuildFdtLib.h b/UefiPayloadPkg/Include/Library/BuildFdtLib.h index b674a6cab2..f00866578f 100644 --- a/UefiPayloadPkg/Include/Library/BuildFdtLib.h +++ b/UefiPayloadPkg/Include/Library/BuildFdtLib.h @@ -5,8 +5,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef BUILD_FDT_LIB_H_ -#define BUILD_FDT_LIB_H_ +#pragma once /** It will build FDT for UPL consumed. @@ -18,5 +17,3 @@ EFI_STATUS BuildFdtForUPL ( IN VOID *FdtBase ); - -#endif diff --git a/UefiPayloadPkg/Include/Library/DxeHobListLib.h b/UefiPayloadPkg/Include/Library/DxeHobListLib.h index bac2621886..19ed1fd566 100644 --- a/UefiPayloadPkg/Include/Library/DxeHobListLib.h +++ b/UefiPayloadPkg/Include/Library/DxeHobListLib.h @@ -15,12 +15,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef DXE_HOB_LIST_LIB_H_ -#define DXE_HOB_LIST_LIB_H_ +#pragma once /// /// Cache copy of the start of HOB list /// extern VOID *gHobList; - -#endif diff --git a/UefiPayloadPkg/Include/Library/FdtParserLib.h b/UefiPayloadPkg/Include/Library/FdtParserLib.h index 87109f1190..23aad568c5 100644 --- a/UefiPayloadPkg/Include/Library/FdtParserLib.h +++ b/UefiPayloadPkg/Include/Library/FdtParserLib.h @@ -5,8 +5,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef FDT_PARSER_LIB_H_ -#define FDT_PARSER_LIB_H_ +#pragma once /** It will parse FDT based on DTB. @@ -60,5 +59,3 @@ EFIAPI UplInitHob ( IN VOID *FdtBase ); - -#endif diff --git a/UefiPayloadPkg/Include/Library/FlashDeviceLib.h b/UefiPayloadPkg/Include/Library/FlashDeviceLib.h index b5e8be225e..13b99c1bd0 100644 --- a/UefiPayloadPkg/Include/Library/FlashDeviceLib.h +++ b/UefiPayloadPkg/Include/Library/FlashDeviceLib.h @@ -6,8 +6,7 @@ **/ -#ifndef FLASHDEVICE_LIB_H_ -#define FLASHDEVICE_LIB_H_ +#pragma once /** Read NumBytes bytes of data from the address specified by @@ -100,5 +99,3 @@ PHYSICAL_ADDRESS EFIAPI LibFvbFlashDeviceMemoryMap ( ); - -#endif diff --git a/UefiPayloadPkg/Include/Library/HobParserLib.h b/UefiPayloadPkg/Include/Library/HobParserLib.h index 98a64b8097..21a01f3d86 100644 --- a/UefiPayloadPkg/Include/Library/HobParserLib.h +++ b/UefiPayloadPkg/Include/Library/HobParserLib.h @@ -5,8 +5,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef HOB_PARSER_LIB_H_ -#define HOB_PARSER_LIB_H_ +#pragma once /** * @@ -66,5 +65,3 @@ BOOLEAN IsHobNeed ( EFI_PEI_HOB_POINTERS Hob ); - -#endif diff --git a/UefiPayloadPkg/Include/Library/PayloadEntryHelperLib.h b/UefiPayloadPkg/Include/Library/PayloadEntryHelperLib.h index d8d6a65326..983441890c 100644 --- a/UefiPayloadPkg/Include/Library/PayloadEntryHelperLib.h +++ b/UefiPayloadPkg/Include/Library/PayloadEntryHelperLib.h @@ -8,8 +8,7 @@ **/ -#ifndef PAYLOAD_ENTRY_HELPER_LIB_H_ -#define PAYLOAD_ENTRY_HELPER_LIB_H_ +#pragma once /** Add a new HOB to the HOB List. @@ -27,5 +26,3 @@ CreateHob ( IN UINT16 HobType, IN UINT16 HobLength ); - -#endif // PAYLOAD_ENTRY_HELPER_LIB_H_ diff --git a/UefiPayloadPkg/Include/Library/PlatformSupportLib.h b/UefiPayloadPkg/Include/Library/PlatformSupportLib.h index 7cf07190aa..f3785535ec 100644 --- a/UefiPayloadPkg/Include/Library/PlatformSupportLib.h +++ b/UefiPayloadPkg/Include/Library/PlatformSupportLib.h @@ -8,8 +8,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef BOOTLOADER_PLATFORM_SUPPORT_LIB_ -#define BOOTLOADER_PLATFORM_SUPPORT_LIB_ +#pragma once /** Parse platform specific information from bootloader @@ -23,5 +22,3 @@ EFIAPI ParsePlatformInfo ( VOID ); - -#endif // __BOOTLOADER_PLATFORM_SUPPORT_LIB__ diff --git a/UefiPayloadPkg/Include/Library/SmmStoreLib.h b/UefiPayloadPkg/Include/Library/SmmStoreLib.h index 13b51ee63c..282823f2fb 100644 --- a/UefiPayloadPkg/Include/Library/SmmStoreLib.h +++ b/UefiPayloadPkg/Include/Library/SmmStoreLib.h @@ -7,8 +7,7 @@ **/ -#ifndef SMM_STORE_LIB_H_ -#define SMM_STORE_LIB_H_ +#pragma once #include #include @@ -193,5 +192,3 @@ EFIAPI SmmStoreLibDeinitialize ( VOID ); - -#endif /* SMM_STORE_LIB_H_ */ diff --git a/UefiPayloadPkg/Include/Library/SmmStoreParseLib.h b/UefiPayloadPkg/Include/Library/SmmStoreParseLib.h index ec84aef7a5..ef650839de 100644 --- a/UefiPayloadPkg/Include/Library/SmmStoreParseLib.h +++ b/UefiPayloadPkg/Include/Library/SmmStoreParseLib.h @@ -7,8 +7,7 @@ **/ -#ifndef SMM_STORE_PARSE_LIB_H_ -#define SMM_STORE_PARSE_LIB_H_ +#pragma once #include @@ -25,5 +24,3 @@ EFIAPI ParseSmmStoreInfo ( OUT SMMSTORE_INFO *SmmStoreInfo ); - -#endif // SMM_STORE_PARSE_LIB_H_ diff --git a/UefiPayloadPkg/Include/Library/SpiFlashLib.h b/UefiPayloadPkg/Include/Library/SpiFlashLib.h index 07f40502f2..38c6da6b61 100644 --- a/UefiPayloadPkg/Include/Library/SpiFlashLib.h +++ b/UefiPayloadPkg/Include/Library/SpiFlashLib.h @@ -6,8 +6,7 @@ **/ -#ifndef SPI_FLASH_LIB_H_ -#define SPI_FLASH_LIB_H_ +#pragma once /** Flash Region Type @@ -209,5 +208,3 @@ SpiGetRegionAddress ( OUT UINT32 *BaseAddress OPTIONAL, OUT UINT32 *RegionSize OPTIONAL ); - -#endif diff --git a/UefiPayloadPkg/Include/UniversalPayload/DeviceTree.h b/UefiPayloadPkg/Include/UniversalPayload/DeviceTree.h index b7c2163e1e..cfffe5a4de 100644 --- a/UefiPayloadPkg/Include/UniversalPayload/DeviceTree.h +++ b/UefiPayloadPkg/Include/UniversalPayload/DeviceTree.h @@ -8,8 +8,7 @@ - Universal Payload Specification 0.8 (https://universalpayload.github.io/spec/) **/ -#ifndef UNIVERSAL_PAYLOAD_DEVICE_TREE_H_ -#define UNIVERSAL_PAYLOAD_DEVICE_TREE_H_ +#pragma once #include #include @@ -26,5 +25,3 @@ typedef struct { #define UNIVERSAL_PAYLOAD_DEVICE_TREE_REVISION 1 extern GUID gUniversalPayloadDeviceTreeGuid; - -#endif // UNIVERSAL_PAYLOAD_SMBIOS_TABLE_H_ diff --git a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridge.h b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridge.h index 431ccab9b9..7c1b4edc74 100644 --- a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridge.h +++ b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridge.h @@ -8,8 +8,7 @@ **/ -#ifndef PCI_HOST_BRIDGE_H_ -#define PCI_HOST_BRIDGE_H_ +#pragma once #include @@ -113,5 +112,3 @@ CreateRootBridgeDevicePath ( IN UINT32 HID, IN UINT32 UID ); - -#endif diff --git a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.h b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.h index 88a83af047..9f54b38d6d 100644 --- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.h +++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.h @@ -5,8 +5,7 @@ Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef PLATFORM_BOOT_MANAGER_H_ -#define PLATFORM_BOOT_MANAGER_H_ +#pragma once #include #include @@ -130,5 +129,3 @@ PlatformBootManagerShowProgress ( IN UINTN Progress, IN UINTN PreviousValue ); - -#endif // _PLATFORM_BOOT_MANAGER_H diff --git a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformConsole.h b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformConsole.h index 6889c897ad..eaaf4e3ae9 100644 --- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformConsole.h +++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformConsole.h @@ -5,8 +5,7 @@ Copyright (c) 2016, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef PLATFORM_CONSOLE_H_ -#define PLATFORM_CONSOLE_H_ +#pragma once #include #include @@ -64,5 +63,3 @@ EFIAPI PlatformConsoleInit ( VOID ); - -#endif diff --git a/UefiPayloadPkg/Library/SmmStoreLib/SmmStore.h b/UefiPayloadPkg/Library/SmmStoreLib/SmmStore.h index 11a42a7289..6d776756cf 100644 --- a/UefiPayloadPkg/Library/SmmStoreLib/SmmStore.h +++ b/UefiPayloadPkg/Library/SmmStoreLib/SmmStore.h @@ -7,8 +7,7 @@ **/ -#ifndef COREBOOT_SMMSTORE_H_ -#define COREBOOT_SMMSTORE_H_ +#pragma once #define SMMSTORE_RET_SUCCESS 0 #define SMMSTORE_RET_FAILURE 1 @@ -82,5 +81,3 @@ TriggerSmi ( IN UINTN Arg, IN UINTN Retry ); - -#endif // COREBOOT_SMMSTORE_H_ diff --git a/UefiPayloadPkg/Library/SpiFlashLib/RegsSpi.h b/UefiPayloadPkg/Library/SpiFlashLib/RegsSpi.h index dd6d382c6c..49f10661be 100644 --- a/UefiPayloadPkg/Library/SpiFlashLib/RegsSpi.h +++ b/UefiPayloadPkg/Library/SpiFlashLib/RegsSpi.h @@ -6,8 +6,7 @@ **/ -#ifndef REGS_SPI_H_ -#define REGS_SPI_H_ +#pragma once #define R_SPI_BASE 0x10 ///< 32-bit Memory Base Address Register #define B_SPI_BAR0_MASK 0x0FFF @@ -117,5 +116,3 @@ // #define R_SPI_FCBA_FLCOMP 0x00 ///< Flash Components Register #define B_SPI_FLCOMP_COMP1_MASK 0x0F ///< Flash Component 1 Density - -#endif diff --git a/UefiPayloadPkg/Library/SpiFlashLib/SpiCommon.h b/UefiPayloadPkg/Library/SpiFlashLib/SpiCommon.h index 95e9b9b1e7..eea8d5bb32 100644 --- a/UefiPayloadPkg/Library/SpiFlashLib/SpiCommon.h +++ b/UefiPayloadPkg/Library/SpiFlashLib/SpiCommon.h @@ -6,8 +6,7 @@ **/ -#ifndef SPI_COMMON_LIB_H_ -#define SPI_COMMON_LIB_H_ +#pragma once #include #include @@ -199,5 +198,3 @@ WaitForSpiCycleComplete ( IN UINT32 PchSpiBar0, IN BOOLEAN ErrorCheck ); - -#endif diff --git a/UefiPayloadPkg/PayloadLoaderPeim/ElfLib.h b/UefiPayloadPkg/PayloadLoaderPeim/ElfLib.h index f8460edb36..4a5277ddfb 100644 --- a/UefiPayloadPkg/PayloadLoaderPeim/ElfLib.h +++ b/UefiPayloadPkg/PayloadLoaderPeim/ElfLib.h @@ -6,8 +6,7 @@ **/ -#ifndef ELF_LIB_H_ -#define ELF_LIB_H_ +#pragma once #include @@ -118,5 +117,3 @@ GetElfSectionPos ( OUT UINTN *Offset, OUT UINTN *Size ); - -#endif /* ELF_LIB_H_ */ diff --git a/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/ElfLibInternal.h b/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/ElfLibInternal.h index d753f6e492..a7219a8c7a 100644 --- a/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/ElfLibInternal.h +++ b/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/ElfLibInternal.h @@ -6,8 +6,7 @@ **/ -#ifndef EFI_LIB_INTERNAL_H_ -#define EFI_LIB_INTERNAL_H_ +#pragma once #include #include @@ -104,5 +103,3 @@ EFI_STATUS LoadElf64Image ( IN ELF_IMAGE_CONTEXT *ElfCt ); - -#endif diff --git a/UefiPayloadPkg/PayloadLoaderPeim/FitLib.h b/UefiPayloadPkg/PayloadLoaderPeim/FitLib.h index 05b790b42e..a9f9cb6f2b 100644 --- a/UefiPayloadPkg/PayloadLoaderPeim/FitLib.h +++ b/UefiPayloadPkg/PayloadLoaderPeim/FitLib.h @@ -4,8 +4,7 @@ Copyright (c) 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef FIT_LIB_H_ -#define FIT_LIB_H_ +#pragma once #include #include @@ -56,5 +55,3 @@ ParseFitImage ( IN VOID *ImageBase, OUT FIT_IMAGE_CONTEXT *Context ); - -#endif diff --git a/UefiPayloadPkg/PchSmiDispatchSmm/PchSmiDispatchSmm.h b/UefiPayloadPkg/PchSmiDispatchSmm/PchSmiDispatchSmm.h index c14fe99929..5fd1ae345c 100644 --- a/UefiPayloadPkg/PchSmiDispatchSmm/PchSmiDispatchSmm.h +++ b/UefiPayloadPkg/PchSmiDispatchSmm/PchSmiDispatchSmm.h @@ -6,8 +6,7 @@ **/ -#ifndef SMM_SW_DISPATCH2_H_ -#define SMM_SW_DISPATCH2_H_ +#pragma once #include #include @@ -32,5 +31,3 @@ typedef struct { UINTN SwSmiInputValue; UINTN DispatchFunction; } EFI_SMM_SW_DISPATCH2_CONTEXT; - -#endif diff --git a/UefiPayloadPkg/PciPlatformDxe/PciPlatformDxe.h b/UefiPayloadPkg/PciPlatformDxe/PciPlatformDxe.h index 322fc5f8db..a80a1e4d93 100644 --- a/UefiPayloadPkg/PciPlatformDxe/PciPlatformDxe.h +++ b/UefiPayloadPkg/PciPlatformDxe/PciPlatformDxe.h @@ -7,8 +7,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef _PCI_PLATFORM_DXE_H_ -#define _PCI_PLATFORM_DXE_H_ +#pragma once + #include #include @@ -16,5 +16,3 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include - -#endif diff --git a/UefiPayloadPkg/SmmAccessDxe/SmmAccessDxe.h b/UefiPayloadPkg/SmmAccessDxe/SmmAccessDxe.h index 51a3cac8c5..c16c12434e 100644 --- a/UefiPayloadPkg/SmmAccessDxe/SmmAccessDxe.h +++ b/UefiPayloadPkg/SmmAccessDxe/SmmAccessDxe.h @@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef SMM_ACCESS_DRIVER_H_ -#define SMM_ACCESS_DRIVER_H_ +#pragma once #include #include @@ -32,5 +31,3 @@ typedef struct { UINT32 NumberRegions; EFI_SMRAM_DESCRIPTOR *SmramDesc; } SMM_ACCESS_PRIVATE_DATA; - -#endif diff --git a/UefiPayloadPkg/SmmStoreFvb/SmmStoreFvbRuntime.h b/UefiPayloadPkg/SmmStoreFvb/SmmStoreFvbRuntime.h index 8015d12d13..fba44444f4 100644 --- a/UefiPayloadPkg/SmmStoreFvb/SmmStoreFvbRuntime.h +++ b/UefiPayloadPkg/SmmStoreFvb/SmmStoreFvbRuntime.h @@ -6,8 +6,7 @@ **/ -#ifndef SMM_STORE_DXE_H_ -#define SMM_STORE_DXE_H_ +#pragma once #include #include @@ -107,5 +106,3 @@ FvbEraseBlocks ( IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This, ... ); - -#endif // SMM_STORE_DXE_H_ diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h index 87e1564798..f314ffb490 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h @@ -6,8 +6,7 @@ **/ -#ifndef __UEFI_PAYLOAD_ENTRY_H__ -#define __UEFI_PAYLOAD_ENTRY_H__ +#pragma once #include @@ -282,5 +281,3 @@ EFIAPI InitializeFloatingPointUnits ( VOID ); - -#endif diff --git a/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.h b/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.h index e0352844d7..c11fa14e48 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.h +++ b/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.h @@ -14,8 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef _VIRTUAL_MEMORY_H_ -#define _VIRTUAL_MEMORY_H_ +#pragma once #define SYS_CODE64_SEL 0x38 @@ -326,5 +325,3 @@ VOID * AllocatePageTableMemory ( IN UINTN Pages ); - -#endif