UefiPayloadPkg: Fix the issue detected by Uncrustify

Signed-off-by: Guo Dong <guo.dong@intel.com>
This commit is contained in:
Guo Dong 2024-12-18 15:30:55 -07:00 committed by mergify[bot]
parent c5811ef1b3
commit 4af5849556

View File

@ -48,7 +48,7 @@ typedef enum {
EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE | \ EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE | \
EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE | \ EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE | \
EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE | \ EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE | \
EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE ) EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE)
#define ROOT_BRIDGE_SUPPORTS_DEFAULT (EFI_PCI_IO_ATTRIBUTE_VGA_IO_16 | \ #define ROOT_BRIDGE_SUPPORTS_DEFAULT (EFI_PCI_IO_ATTRIBUTE_VGA_IO_16 | \
EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16 | \ EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16 | \
@ -58,7 +58,7 @@ typedef enum {
EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY | \ EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY | \
EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO | \ EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO | \
EFI_PCI_IO_ATTRIBUTE_ISA_IO | \ EFI_PCI_IO_ATTRIBUTE_ISA_IO | \
EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO ) EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO)
extern VOID *mHobList; extern VOID *mHobList;
UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES *mPciRootBridgeInfo = NULL; UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES *mPciRootBridgeInfo = NULL;
@ -69,7 +69,7 @@ UPL_PCI_SEGMENT_INFO_HOB *mUplPciSegmentInfoHob;
/** /**
Build a Handoff Information Table HOB Build a Handoff Information Table HOB
This function initialize a HOB region from EfiMemoryBegin to This function initializes a HOB region from EfiMemoryBegin to
EfiMemoryTop. And EfiFreeMemoryBottom and EfiFreeMemoryTop should EfiMemoryTop. And EfiFreeMemoryBottom and EfiFreeMemoryTop should
be inside the HOB region. be inside the HOB region.
@ -93,7 +93,7 @@ HobConstructor (
/** /**
It will record the memory node initialized. It will record the memory node initialized.
@param[in] Node memory node is going to parsing.. @param[in] Node memory node is going to parsing.
**/ **/
VOID VOID
RecordMemoryNode ( RecordMemoryNode (
@ -108,10 +108,10 @@ RecordMemoryNode (
/** /**
Check the memory node if initialized. Check the memory node if initialized.
@param[in] Node memory node is going to parsing.. @param[in] Node memory node is going to parsing.
@return TRUE memory node was initialized. don't parse it again. @return TRUE memory node was initialized. don't parse it again.
@return FALSE memory node wasn't initialized , go to parse it. @return FALSE memory node wasn't initialized, go to parse it.
**/ **/
BOOLEAN BOOLEAN
CheckMemoryNodeIfInit ( CheckMemoryNodeIfInit (
@ -133,7 +133,7 @@ CheckMemoryNodeIfInit (
It will check device node from FDT. It will check device node from FDT.
@param[in] NodeString Device node name string. @param[in] NodeString Device node name string.
@param[in] Depth Check layer of Device node , only parse the 1st layer @param[in] Depth Check layer of Device node, only parse the 1st layer
@return FDT_NODE_TYPE what type of the device node. @return FDT_NODE_TYPE what type of the device node.
**/ **/
@ -144,15 +144,15 @@ CheckNodeType (
) )
{ {
DEBUG ((DEBUG_INFO, "\n CheckNodeType %a \n", NodeString)); DEBUG ((DEBUG_INFO, "\n CheckNodeType %a \n", NodeString));
if (AsciiStrnCmp (NodeString, "serial@", AsciiStrLen ("serial@")) == 0 ) { if (AsciiStrnCmp (NodeString, "serial@", AsciiStrLen ("serial@")) == 0) {
return SerialPort; return SerialPort;
} else if (AsciiStrnCmp (NodeString, "reserved-memory", AsciiStrLen ("reserved-memory")) == 0 ) { } else if (AsciiStrnCmp (NodeString, "reserved-memory", AsciiStrLen ("reserved-memory")) == 0) {
return ReservedMemory; return ReservedMemory;
} else if (AsciiStrnCmp (NodeString, "memory@", AsciiStrLen ("memory@")) == 0 ) { } else if (AsciiStrnCmp (NodeString, "memory@", AsciiStrLen ("memory@")) == 0) {
return Memory; return Memory;
} else if (AsciiStrnCmp (NodeString, "framebuffer@", AsciiStrLen ("framebuffer@")) == 0) { } else if (AsciiStrnCmp (NodeString, "framebuffer@", AsciiStrLen ("framebuffer@")) == 0) {
return FrameBuffer; return FrameBuffer;
} else if (AsciiStrnCmp (NodeString, "pci-rb", AsciiStrLen ("pci-rb")) == 0 ) { } else if (AsciiStrnCmp (NodeString, "pci-rb", AsciiStrLen ("pci-rb")) == 0) {
return PciRootBridge; return PciRootBridge;
} else if (AsciiStrCmp (NodeString, "options") == 0) { } else if (AsciiStrCmp (NodeString, "options") == 0) {
return Options; return Options;
@ -606,7 +606,7 @@ ParseSerialPort (
PropertyPtr = FdtGetProperty (Fdt, SubNode, "reg-shift", &TempLen); PropertyPtr = FdtGetProperty (Fdt, SubNode, "reg-shift", &TempLen);
if (TempLen > 0) { if (TempLen > 0) {
Data32 = (UINT32 *)(PropertyPtr->Data); Data32 = (UINT32 *)(PropertyPtr->Data);
Serial->RegisterStride = (UINT8) (1 << Fdt32ToCpu (*Data32)); Serial->RegisterStride = (UINT8)(1 << Fdt32ToCpu (*Data32));
} }
PropertyPtr = FdtGetProperty (Fdt, SubNode, "reg", &TempLen); PropertyPtr = FdtGetProperty (Fdt, SubNode, "reg", &TempLen);
@ -620,6 +620,7 @@ ParseSerialPort (
if (Value32 < SIZE_64KB) { if (Value32 < SIZE_64KB) {
Serial->UseMmio = FALSE; Serial->UseMmio = FALSE;
} }
break; break;
case 2: case 2:
Serial->RegisterBase = Fdt32ToCpu (Data32[1]); Serial->RegisterBase = Fdt32ToCpu (Data32[1]);
@ -629,12 +630,14 @@ ParseSerialPort (
} else { } else {
Serial->RegisterBase |= LShiftU64 (Value32, 32); Serial->RegisterBase |= LShiftU64 (Value32, 32);
} }
break; break;
case 3: case 3:
// First U32 format: npt000ss bbbbbbbb dddddfff rrrrrrrr // First U32 format: npt000ss bbbbbbbb dddddfff rrrrrrrr
if ((Value32 & 0x03000000) == 0x01000000) { if ((Value32 & 0x03000000) == 0x01000000) {
Serial->UseMmio = FALSE; Serial->UseMmio = FALSE;
} }
Serial->RegisterBase = LShiftU64 ((UINT64)Fdt32ToCpu (Data32[1]), 32) | Fdt32ToCpu (Data32[2]); Serial->RegisterBase = LShiftU64 ((UINT64)Fdt32ToCpu (Data32[1]), 32) | Fdt32ToCpu (Data32[2]);
break; break;
default: default:
@ -642,6 +645,7 @@ ParseSerialPort (
break; break;
} }
} }
DEBUG ((DEBUG_INFO, "Serial->UseMmio = %x\n", Serial->UseMmio)); DEBUG ((DEBUG_INFO, "Serial->UseMmio = %x\n", Serial->UseMmio));
DEBUG ((DEBUG_INFO, "Serial->RegisterBase = 0x%x\n", Serial->RegisterBase)); DEBUG ((DEBUG_INFO, "Serial->RegisterBase = 0x%x\n", Serial->RegisterBase));
DEBUG ((DEBUG_INFO, "Serial->BaudRate = %d\n", Serial->BaudRate)); DEBUG ((DEBUG_INFO, "Serial->BaudRate = %d\n", Serial->BaudRate));
@ -750,7 +754,7 @@ ParsePciRootBridge (
TempStr = FdtGetString (Fdt, Fdt32ToCpu (PropertyPtr->NameOffset), NULL); TempStr = FdtGetString (Fdt, Fdt32ToCpu (PropertyPtr->NameOffset), NULL);
if (AsciiStrCmp (TempStr, "ranges") == 0) { if (AsciiStrCmp (TempStr, "ranges") == 0) {
DEBUG ((DEBUG_INFO, " Found ranges Property TempLen (%08X), limit %x\n", TempLen, TempLen/sizeof (UINT32))); DEBUG ((DEBUG_INFO, " Found ranges Property TempLen (%08X), limit %x\n", TempLen, TempLen / sizeof (UINT32)));
mPciRootBridgeInfo->RootBridge[RbIndex].AllocationAttributes = EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM | EFI_PCI_HOST_BRIDGE_MEM64_DECODE; mPciRootBridgeInfo->RootBridge[RbIndex].AllocationAttributes = EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM | EFI_PCI_HOST_BRIDGE_MEM64_DECODE;
mPciRootBridgeInfo->RootBridge[RbIndex].Supports = ROOT_BRIDGE_SUPPORTS_DEFAULT; mPciRootBridgeInfo->RootBridge[RbIndex].Supports = ROOT_BRIDGE_SUPPORTS_DEFAULT;
@ -762,18 +766,18 @@ ParsePciRootBridge (
mPciRootBridgeInfo->RootBridge[RbIndex].HID = EISA_PNP_ID (0x0A03); mPciRootBridgeInfo->RootBridge[RbIndex].HID = EISA_PNP_ID (0x0A03);
Data32 = (UINT32 *)(PropertyPtr->Data); Data32 = (UINT32 *)(PropertyPtr->Data);
for (Base = 0; Base < TempLen/sizeof (UINT32); Base = Base + DWORDS_TO_NEXT_ADDR_TYPE) { for (Base = 0; Base < TempLen / sizeof (UINT32); Base = Base + DWORDS_TO_NEXT_ADDR_TYPE) {
DEBUG ((DEBUG_INFO, " Base :%x \n", Base)); DEBUG ((DEBUG_INFO, " Base :%x \n", Base));
MemType = Fdt32ToCpu (*(Data32 + Base)); MemType = Fdt32ToCpu (*(Data32 + Base));
if (((MemType) & (SS_64BIT_MEMORY_SPACE)) == SS_64BIT_MEMORY_SPACE) { if (((MemType) & (SS_64BIT_MEMORY_SPACE)) == SS_64BIT_MEMORY_SPACE) {
mPciRootBridgeInfo->RootBridge[RbIndex].MemAbove4G.Base = Fdt32ToCpu (*(Data32 + Base + 2)) + LShiftU64 (Fdt32ToCpu (*(Data32 + Base + 1)), 32); mPciRootBridgeInfo->RootBridge[RbIndex].MemAbove4G.Base = Fdt32ToCpu (*(Data32 + Base + 2)) + LShiftU64 (Fdt32ToCpu (*(Data32 + Base + 1)), 32);
mPciRootBridgeInfo->RootBridge[RbIndex].MemAbove4G.Limit = mPciRootBridgeInfo->RootBridge[RbIndex].MemAbove4G.Base + LShiftU64 (Fdt32ToCpu (*(Data32 + Base + 5)), 32) + Fdt32ToCpu (*(Data32 + Base + 6)) -1; mPciRootBridgeInfo->RootBridge[RbIndex].MemAbove4G.Limit = mPciRootBridgeInfo->RootBridge[RbIndex].MemAbove4G.Base + LShiftU64 (Fdt32ToCpu (*(Data32 + Base + 5)), 32) + Fdt32ToCpu (*(Data32 + Base + 6)) - 1;
} else if (((MemType) & (SS_32BIT_MEMORY_SPACE)) == SS_32BIT_MEMORY_SPACE) { } else if (((MemType) & (SS_32BIT_MEMORY_SPACE)) == SS_32BIT_MEMORY_SPACE) {
mPciRootBridgeInfo->RootBridge[RbIndex].Mem.Base = Fdt32ToCpu (*(Data32 + Base + 2)); mPciRootBridgeInfo->RootBridge[RbIndex].Mem.Base = Fdt32ToCpu (*(Data32 + Base + 2));
mPciRootBridgeInfo->RootBridge[RbIndex].Mem.Limit = mPciRootBridgeInfo->RootBridge[RbIndex].Mem.Base + Fdt32ToCpu (*(Data32 + Base + 6)) -1; mPciRootBridgeInfo->RootBridge[RbIndex].Mem.Limit = mPciRootBridgeInfo->RootBridge[RbIndex].Mem.Base + Fdt32ToCpu (*(Data32 + Base + 6)) - 1;
} else if (((MemType) & (SS_IO_SPACE)) == SS_IO_SPACE) { } else if (((MemType) & (SS_IO_SPACE)) == SS_IO_SPACE) {
mPciRootBridgeInfo->RootBridge[RbIndex].Io.Base = Fdt32ToCpu (*(Data32 + Base + 2)); mPciRootBridgeInfo->RootBridge[RbIndex].Io.Base = Fdt32ToCpu (*(Data32 + Base + 2));
mPciRootBridgeInfo->RootBridge[RbIndex].Io.Limit = mPciRootBridgeInfo->RootBridge[RbIndex].Io.Base + Fdt32ToCpu (*(Data32 + Base + 6)) -1; mPciRootBridgeInfo->RootBridge[RbIndex].Io.Limit = mPciRootBridgeInfo->RootBridge[RbIndex].Io.Base + Fdt32ToCpu (*(Data32 + Base + 6)) - 1;
} }
} }
@ -917,8 +921,7 @@ ParseDtb (
} }
} }
} }
} // end of memory node } else {
else {
PropertyPtr = FdtGetProperty (Fdt, Node, "compatible", &TempLen); PropertyPtr = FdtGetProperty (Fdt, Node, "compatible", &TempLen);
if (PropertyPtr == NULL) { if (PropertyPtr == NULL) {
continue; continue;
@ -1037,9 +1040,10 @@ ParseDtb (
/** /**
It will Parse FDT -node based on information from bootloaders. It will Parse FDT -node based on information from bootloaders.
@param[in] FdtBase The starting memory address of FdtBase
@retval HobList The base address of Hoblist.
@param[in] FdtBase The starting memory address of FdtBase
@retval HobList The base address of Hoblist.
**/ **/
UINTN UINTN
EFIAPI EFIAPI
@ -1068,7 +1072,7 @@ UplInitHob (
NHobAddress = 0; NHobAddress = 0;
// //
// Check parameter type( // Check parameter type
// //
if (FdtCheckHeader (FdtBase) == 0) { if (FdtCheckHeader (FdtBase) == 0) {
DEBUG ((DEBUG_INFO, "%a() FDT blob\n", __func__)); DEBUG ((DEBUG_INFO, "%a() FDT blob\n", __func__));