summaryrefslogtreecommitdiffstats
path: root/UefiPayloadPkg/Library
diff options
context:
space:
mode:
authorGuo Dong <guo.dong@intel.com>2021-10-15 12:10:11 -0700
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-10-19 04:27:41 +0000
commit6ef57974472de604cf436ce904a88f0667cee8bd (patch)
tree175db3ec47711ae8ffdf71feab8e51c6282c7aed /UefiPayloadPkg/Library
parent91a978ce7e0c7a327cff1d9411b0e1c9dae8824a (diff)
downloadedk2-6ef57974472de604cf436ce904a88f0667cee8bd.tar.gz
edk2-6ef57974472de604cf436ce904a88f0667cee8bd.tar.bz2
edk2-6ef57974472de604cf436ce904a88f0667cee8bd.zip
UefiPayloadPkg: Fix ECC reported issues
V2: Fix more header files on #ifdef variable ECC reported some issues on UefiPayloadPkg, this patch fixed most of them except several files including ElfLib\Elf32.h, coreboot.h, CbParseLib.c, etc. It also removed unused functions in ResetSystemLib and Hob.c. Signed-off-by: Guo Dong <guo.dong@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Maurice Ma <maurice.ma@intel.com> Cc: Benjamin You <benjamin.you@intel.com> Reviewed-by: Maurice Ma <maurice.ma@intel.com>
Diffstat (limited to 'UefiPayloadPkg/Library')
-rw-r--r--UefiPayloadPkg/Library/CbParseLib/CbParseLib.c22
-rw-r--r--UefiPayloadPkg/Library/DxeHobListLibNull/DxeHobListLibNull.c6
-rw-r--r--UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c28
-rw-r--r--UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridge.h4
-rw-r--r--UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c4
-rw-r--r--UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c15
-rw-r--r--UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c4
-rw-r--r--UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.h6
-rw-r--r--UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformConsole.h4
-rw-r--r--UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformData.c2
-rw-r--r--UefiPayloadPkg/Library/ResetSystemLib/ResetSystemLib.c16
-rw-r--r--UefiPayloadPkg/Library/SblParseLib/SblParseLib.c2
12 files changed, 44 insertions, 69 deletions
diff --git a/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c b/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c
index 57e1cadc34..46314e5566 100644
--- a/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c
+++ b/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c
@@ -322,7 +322,7 @@ ParseCbMemTable (
)
{
EFI_STATUS Status;
- struct cb_memory *rec;
+ CB_MEMORY *Rec;
struct cb_memory_range *Range;
UINT64 Start;
UINT64 Size;
@@ -339,13 +339,13 @@ ParseCbMemTable (
//
// Get the coreboot memory table
//
- rec = (struct cb_memory *)FindCbTag (CB_TAG_MEMORY);
- if (rec == NULL) {
+ Rec = (CB_MEMORY *)FindCbTag (CB_TAG_MEMORY);
+ if (Rec == NULL) {
return Status;
}
- for (Index = 0; Index < MEM_RANGE_COUNT(rec); Index++) {
- Range = MEM_RANGE_PTR(rec, Index);
+ for (Index = 0; Index < MEM_RANGE_COUNT(Rec); Index++) {
+ Range = MEM_RANGE_PTR(Rec, Index);
Start = cb_unpack64(Range->start);
Size = cb_unpack64(Range->size);
@@ -380,7 +380,7 @@ ParseMemoryInfo (
IN VOID *Params
)
{
- struct cb_memory *rec;
+ CB_MEMORY *Rec;
struct cb_memory_range *Range;
UINTN Index;
MEMORY_MAP_ENTRY MemoryMap;
@@ -388,13 +388,13 @@ ParseMemoryInfo (
//
// Get the coreboot memory table
//
- rec = (struct cb_memory *)FindCbTag (CB_TAG_MEMORY);
- if (rec == NULL) {
+ Rec = (CB_MEMORY *)FindCbTag (CB_TAG_MEMORY);
+ if (Rec == NULL) {
return RETURN_NOT_FOUND;
}
- for (Index = 0; Index < MEM_RANGE_COUNT(rec); Index++) {
- Range = MEM_RANGE_PTR(rec, Index);
+ for (Index = 0; Index < MEM_RANGE_COUNT(Rec); Index++) {
+ Range = MEM_RANGE_PTR(Rec, Index);
MemoryMap.Base = cb_unpack64(Range->start);
MemoryMap.Size = cb_unpack64(Range->size);
MemoryMap.Type = (UINT8)Range->type;
@@ -449,7 +449,7 @@ ParseSystemTable (
/**
Find the serial port information
- @param SERIAL_PORT_INFO Pointer to serial port info structure
+ @param SerialPortInfo Pointer to serial port info structure
@retval RETURN_SUCCESS Successfully find the serial port information.
@retval RETURN_NOT_FOUND Failed to find the serial port information .
diff --git a/UefiPayloadPkg/Library/DxeHobListLibNull/DxeHobListLibNull.c b/UefiPayloadPkg/Library/DxeHobListLibNull/DxeHobListLibNull.c
index 92d3e17ef0..6c69f9879e 100644
--- a/UefiPayloadPkg/Library/DxeHobListLibNull/DxeHobListLibNull.c
+++ b/UefiPayloadPkg/Library/DxeHobListLibNull/DxeHobListLibNull.c
@@ -10,6 +10,12 @@
#include <Uefi.h>
+/**
+ The dummy constructor for DxeHobListLib.
+
+ @retval EFI_SUCCESS
+
+**/
EFI_STATUS
EFIAPI
DxeHobListLibNullConstructor (
diff --git a/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c b/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c
index dd25ac2682..61cd11ba03 100644
--- a/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c
+++ b/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c
@@ -168,31 +168,6 @@ BuildResourceDescriptorHob (
Hob->ResourceLength = NumberOfBytes;
}
-VOID
-EFIAPI
-BuildFvHobs (
- IN EFI_PHYSICAL_ADDRESS PhysicalStart,
- IN UINT64 NumberOfBytes,
- IN EFI_RESOURCE_ATTRIBUTE_TYPE *ResourceAttribute
- )
-{
-
- EFI_RESOURCE_ATTRIBUTE_TYPE Resource;
-
- BuildFvHob (PhysicalStart, NumberOfBytes);
-
- if (ResourceAttribute == NULL) {
- Resource = (EFI_RESOURCE_ATTRIBUTE_PRESENT |
- EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
- EFI_RESOURCE_ATTRIBUTE_TESTED |
- EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE);
- } else {
- Resource = *ResourceAttribute;
- }
-
- BuildResourceDescriptorHob (EFI_RESOURCE_FIRMWARE_DEVICE, Resource, PhysicalStart, NumberOfBytes);
-}
-
/**
Returns the next instance of a HOB type from the starting HOB.
@@ -283,7 +258,8 @@ EFIAPI
GetNextGuidHob (
IN CONST EFI_GUID *Guid,
IN CONST VOID *HobStart
- ){
+ )
+{
EFI_PEI_HOB_POINTERS GuidHob;
GuidHob.Raw = (UINT8 *) HobStart;
diff --git a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridge.h b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridge.h
index 3eee1fbeac..2848da5ce6 100644
--- a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridge.h
+++ b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridge.h
@@ -8,8 +8,8 @@
**/
-#ifndef _PCI_HOST_BRIDGE_H
-#define _PCI_HOST_BRIDGE_H
+#ifndef PCI_HOST_BRIDGE_H_
+#define PCI_HOST_BRIDGE_H_
#include <UniversalPayload/PciRootBridges.h>
diff --git a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
index a0d7cdc306..0eddebe229 100644
--- a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
+++ b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
@@ -210,8 +210,8 @@ PciHostBridgeGetRootBridges (
Free the root bridge instances array returned from
PciHostBridgeGetRootBridges().
- @param The root bridge instances array.
- @param The count of the array.
+ @param Bridges The root bridge instances array.
+ @param Count The count of the array.
**/
VOID
EFIAPI
diff --git a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c
index b0268f0506..eb28d48b3b 100644
--- a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c
+++ b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c
@@ -205,7 +205,7 @@ PcatPciRootBridgeParseBars (
//
// IO Bar
//
- if (Command & EFI_PCI_COMMAND_IO_SPACE) {
+ if ((Command & EFI_PCI_COMMAND_IO_SPACE) != 0) {
Mask = 0xfffffffc;
Base = OriginalValue & Mask;
Length = ((~(Value & Mask)) & Mask) + 0x04;
@@ -227,7 +227,7 @@ PcatPciRootBridgeParseBars (
//
// Mem Bar
//
- if (Command & EFI_PCI_COMMAND_MEMORY_SPACE) {
+ if ((Command & EFI_PCI_COMMAND_MEMORY_SPACE) != 0) {
Mask = 0xfffffff0;
Base = OriginalValue & Mask;
@@ -306,9 +306,14 @@ ScanForRootBridges (
UINT64 Base;
UINT64 Limit;
UINT64 Value;
- PCI_ROOT_BRIDGE_APERTURE Io, Mem, MemAbove4G, PMem, PMemAbove4G, *MemAperture;
- PCI_ROOT_BRIDGE *RootBridges;
- UINTN BarOffsetEnd;
+ PCI_ROOT_BRIDGE_APERTURE Io;
+ PCI_ROOT_BRIDGE_APERTURE Mem;
+ PCI_ROOT_BRIDGE_APERTURE MemAbove4G;
+ PCI_ROOT_BRIDGE_APERTURE PMem;
+ PCI_ROOT_BRIDGE_APERTURE PMemAbove4G;
+ PCI_ROOT_BRIDGE_APERTURE *MemAperture;
+ PCI_ROOT_BRIDGE *RootBridges;
+ UINTN BarOffsetEnd;
*NumberOfRootBridges = 0;
diff --git a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
index c4d317fa9e..dd91fcb29d 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
@@ -15,6 +15,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_PROTOCOL *mUniversalPayloadPlatformBootManagerOverrideInstance = NULL;
+/**
+ Signal EndOfDxe event and install SMM Ready to lock protocol.
+
+**/
VOID
InstallReadyToLock (
VOID
diff --git a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.h b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.h
index 2f600c796f..c781610c6c 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.h
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.h
@@ -1,12 +1,12 @@
-/**@file
+/** @file
Head file for BDS Platform specific code
Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-#ifndef _PLATFORM_BOOT_MANAGER_H
-#define _PLATFORM_BOOT_MANAGER_H
+#ifndef PLATFORM_BOOT_MANAGER_H_
+#define PLATFORM_BOOT_MANAGER_H_
#include <PiDxe.h>
#include <Protocol/LoadedImage.h>
diff --git a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformConsole.h b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformConsole.h
index 68bdf5e555..e9d0eb00ee 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformConsole.h
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformConsole.h
@@ -5,8 +5,8 @@ Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-#ifndef _PLATFORM_CONSOLE_H
-#define _PLATFORM_CONSOLE_H
+#ifndef PLATFORM_CONSOLE_H_
+#define PLATFORM_CONSOLE_H_
#include <PiDxe.h>
#include <IndustryStandard/Pci.h>
diff --git a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformData.c b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformData.c
index d17e660e0f..892a7f01be 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformData.c
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformData.c
@@ -1,4 +1,4 @@
-/**@file
+/** @file
Defined the platform specific device path which will be filled to
ConIn/ConOut variables.
diff --git a/UefiPayloadPkg/Library/ResetSystemLib/ResetSystemLib.c b/UefiPayloadPkg/Library/ResetSystemLib/ResetSystemLib.c
index 2e4b7fe592..b35a4cc1d9 100644
--- a/UefiPayloadPkg/Library/ResetSystemLib/ResetSystemLib.c
+++ b/UefiPayloadPkg/Library/ResetSystemLib/ResetSystemLib.c
@@ -43,22 +43,6 @@ ResetSystemLibConstructor (
return EFI_SUCCESS;
}
-
-VOID
-AcpiPmControl (
- UINTN SuspendType
- )
-{
- UINTN PmCtrlReg;
-
- ASSERT (SuspendType <= 7);
-
- PmCtrlReg = (UINTN)mAcpiBoardInfo.PmCtrlRegBase;
- IoAndThenOr16 (PmCtrlReg, (UINT16) ~0x3c00, (UINT16) (SuspendType << 10));
- IoOr16 (PmCtrlReg, BIT13);
- CpuDeadLoop ();
-}
-
/**
Calling this function causes a system-wide reset. This sets
all circuitry within the system to its initial state. This type of reset
diff --git a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c
index 6904529925..eeb0dfe74a 100644
--- a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c
+++ b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c
@@ -141,7 +141,7 @@ ParseSystemTable (
/**
Find the serial port information
- @param SERIAL_PORT_INFO Pointer to serial port info structure
+ @param[out] SerialPortInfo Pointer to serial port info structure
@retval RETURN_SUCCESS Successfully find the serial port information.
@retval RETURN_NOT_FOUND Failed to find the serial port information .