From 38bbd3d91c38481d18c1a7e2049473c951ee98ed Mon Sep 17 00:00:00 2001 From: yshang1 Date: Tue, 8 Jul 2008 09:38:43 +0000 Subject: [PATCH] Code scrub: MdePkg/Library/BaseCacheMaintenanceLib MdePkg/Library/BaseDebugLibNull MdePkg/Library/BaseIoLibIntrinsic MdePkg/Library/BaseLib MdePkg/Library/BaseMemoryLib MdePkg/Library/BaseMemoryLibMmx MdePkg/Library/BaseMemoryLibOptDxe MdePkg/Library/BaseMemoryLibOptPei MdePkg/Library/BaseMemoryLibRepStr MdePkg/Library/BaseMemoryLibSse2 MdePkg/Library/BasePeCoffGetEntryPointLib git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5426 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Include/Library/BaseLib.h | 51 +++++++------- .../BaseCacheMaintenanceLib.inf | 4 +- .../BaseCacheMaintenanceLib/EbcCache.c | 8 +-- .../BaseCacheMaintenanceLib/IpfCache.c | 8 +-- .../BaseCacheMaintenanceLib/x86Cache.c | 11 ++-- MdePkg/Library/BaseDebugLibNull/DebugLib.c | 10 ++- .../BaseIoLibIntrinsicInternal.h | 6 +- .../Library/BaseIoLibIntrinsic/IoHighLevel.c | 24 ++++--- MdePkg/Library/BaseIoLibIntrinsic/IoLib.c | 7 +- MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c | 38 ++++++++--- MdePkg/Library/BaseIoLibIntrinsic/IoLibIcc.c | 44 +++++++++---- MdePkg/Library/BaseIoLibIntrinsic/IoLibIpf.c | 48 +++++++++----- .../BaseIoLibIntrinsic/IoLibMmioBuffer.c | 11 ++-- MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c | 31 ++++++--- MdePkg/Library/BaseLib/BaseLibInternals.h | 6 ++ MdePkg/Library/BaseLib/BitField.c | 3 + MdePkg/Library/BaseLib/CpuDeadLoop.c | 2 +- MdePkg/Library/BaseLib/Ebc/SetJumpLongJump.c | 1 + MdePkg/Library/BaseLib/Ebc/Synchronization.c | 19 ++++++ MdePkg/Library/BaseLib/GetPowerOfTwo32.c | 2 +- .../Library/BaseLib/Ia32/DivS64x64Remainder.c | 1 + MdePkg/Library/BaseLib/LinkedList.c | 3 + MdePkg/Library/BaseLib/LowBitSet32.c | 2 +- MdePkg/Library/BaseLib/Math64.c | 1 + MdePkg/Library/BaseLib/String.c | 66 +++++++++---------- MdePkg/Library/BaseLib/Synchronization.c | 11 ++-- MdePkg/Library/BaseLib/SynchronizationGcc.c | 8 +-- MdePkg/Library/BaseLib/SynchronizationMsc.c | 9 +-- MdePkg/Library/BaseLib/Unaligned.c | 16 ++--- MdePkg/Library/BaseLib/x86FxRestore.c | 4 +- MdePkg/Library/BaseLib/x86FxSave.c | 2 +- MdePkg/Library/BaseLib/x86GetInterruptState.c | 2 +- .../Library/BaseMemoryLib/CompareMemWrapper.c | 2 +- MdePkg/Library/BaseMemoryLib/CopyMemWrapper.c | 2 +- .../Library/BaseMemoryLib/ScanMem16Wrapper.c | 6 +- .../Library/BaseMemoryLib/ScanMem32Wrapper.c | 6 +- .../Library/BaseMemoryLib/ScanMem64Wrapper.c | 6 +- .../Library/BaseMemoryLib/ScanMem8Wrapper.c | 2 +- .../Library/BaseMemoryLib/SetMem16Wrapper.c | 6 +- .../Library/BaseMemoryLib/SetMem32Wrapper.c | 6 +- .../Library/BaseMemoryLib/SetMem64Wrapper.c | 6 +- MdePkg/Library/BaseMemoryLib/SetMemWrapper.c | 2 +- .../BaseMemoryLibMmx/CompareMemWrapper.c | 2 +- .../Library/BaseMemoryLibMmx/CopyMemWrapper.c | 2 +- .../BaseMemoryLibMmx/MemLibInternals.h | 5 +- .../BaseMemoryLibMmx/ScanMem16Wrapper.c | 2 +- .../BaseMemoryLibMmx/ScanMem32Wrapper.c | 2 +- .../BaseMemoryLibMmx/ScanMem64Wrapper.c | 2 +- .../BaseMemoryLibMmx/ScanMem8Wrapper.c | 2 +- .../BaseMemoryLibMmx/SetMem16Wrapper.c | 2 +- .../BaseMemoryLibMmx/SetMem32Wrapper.c | 2 +- .../BaseMemoryLibMmx/SetMem64Wrapper.c | 2 +- .../Library/BaseMemoryLibMmx/SetMemWrapper.c | 2 +- .../Library/BaseMemoryLibMmx/ZeroMemWrapper.c | 2 +- .../BaseMemoryLibOptDxe/CompareMemWrapper.c | 2 +- .../BaseMemoryLibOptDxe/CopyMemWrapper.c | 2 +- .../BaseMemoryLibOptDxe/ScanMem16Wrapper.c | 2 +- .../BaseMemoryLibOptDxe/ScanMem32Wrapper.c | 2 +- .../BaseMemoryLibOptDxe/ScanMem64Wrapper.c | 2 +- .../BaseMemoryLibOptDxe/ScanMem8Wrapper.c | 2 +- .../BaseMemoryLibOptDxe/SetMem16Wrapper.c | 2 +- .../BaseMemoryLibOptDxe/SetMem32Wrapper.c | 2 +- .../BaseMemoryLibOptDxe/SetMem64Wrapper.c | 2 +- .../BaseMemoryLibOptDxe/SetMemWrapper.c | 2 +- .../BaseMemoryLibOptDxe/ZeroMemWrapper.c | 2 +- .../BaseMemoryLibOptPei/CompareMemWrapper.c | 2 +- .../BaseMemoryLibOptPei/CopyMemWrapper.c | 2 +- .../Library/BaseMemoryLibOptPei/MemLibGuid.c | 2 +- .../BaseMemoryLibOptPei/MemLibInternals.h | 4 +- .../BaseMemoryLibOptPei/ScanMem16Wrapper.c | 2 +- .../BaseMemoryLibOptPei/ScanMem32Wrapper.c | 2 +- .../BaseMemoryLibOptPei/ScanMem64Wrapper.c | 2 +- .../BaseMemoryLibOptPei/ScanMem8Wrapper.c | 2 +- .../BaseMemoryLibOptPei/SetMem16Wrapper.c | 2 +- .../BaseMemoryLibOptPei/SetMem32Wrapper.c | 2 +- .../BaseMemoryLibOptPei/SetMem64Wrapper.c | 2 +- .../BaseMemoryLibOptPei/SetMemWrapper.c | 2 +- .../BaseMemoryLibOptPei/ZeroMemWrapper.c | 2 +- .../BaseMemoryLibRepStr/CompareMemWrapper.c | 2 +- .../BaseMemoryLibRepStr/CopyMemWrapper.c | 2 +- .../BaseMemoryLibRepStr/MemLibInternals.h | 4 +- .../BaseMemoryLibRepStr/ScanMem16Wrapper.c | 2 +- .../BaseMemoryLibRepStr/ScanMem32Wrapper.c | 2 +- .../BaseMemoryLibRepStr/ScanMem64Wrapper.c | 2 +- .../BaseMemoryLibRepStr/ScanMem8Wrapper.c | 2 +- .../BaseMemoryLibRepStr/SetMem16Wrapper.c | 2 +- .../BaseMemoryLibRepStr/SetMem32Wrapper.c | 2 +- .../BaseMemoryLibRepStr/SetMem64Wrapper.c | 2 +- .../BaseMemoryLibRepStr/SetMemWrapper.c | 2 +- .../BaseMemoryLibRepStr/ZeroMemWrapper.c | 2 +- .../BaseMemoryLibSse2/CompareMemWrapper.c | 2 +- .../BaseMemoryLibSse2/CopyMemWrapper.c | 2 +- MdePkg/Library/BaseMemoryLibSse2/MemLibGuid.c | 23 +++---- .../BaseMemoryLibSse2/MemLibInternals.h | 4 +- .../BaseMemoryLibSse2/ScanMem16Wrapper.c | 2 +- .../BaseMemoryLibSse2/ScanMem32Wrapper.c | 2 +- .../BaseMemoryLibSse2/ScanMem64Wrapper.c | 2 +- .../BaseMemoryLibSse2/ScanMem8Wrapper.c | 2 +- .../BaseMemoryLibSse2/SetMem16Wrapper.c | 2 +- .../BaseMemoryLibSse2/SetMem32Wrapper.c | 2 +- .../BaseMemoryLibSse2/SetMem64Wrapper.c | 2 +- .../Library/BaseMemoryLibSse2/SetMemWrapper.c | 2 +- .../BaseMemoryLibSse2/ZeroMemWrapper.c | 2 +- .../PeCoffGetEntryPoint.c | 23 ++++--- 104 files changed, 392 insertions(+), 286 deletions(-) diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h index 6961c0a229..95e1b6d314 100644 --- a/MdePkg/Include/Library/BaseLib.h +++ b/MdePkg/Include/Library/BaseLib.h @@ -471,7 +471,7 @@ StrStr ( @param String Pointer to a Null-terminated Unicode string. - @retval UINTN + @retval Value translated from String. **/ UINTN @@ -511,7 +511,7 @@ StrDecimalToUintn ( @param String Pointer to a Null-terminated Unicode string. - @retval UINT64 + @retval Value translated from String. **/ UINT64 @@ -553,7 +553,7 @@ StrDecimalToUint64 ( @param String Pointer to a Null-terminated Unicode string. - @retval UINTN + @retval Value translated from String. **/ UINTN @@ -595,7 +595,7 @@ StrHexToUintn ( @param String Pointer to a Null-terminated Unicode string. - @retval UINT64 + @retval Value translated from String. **/ UINT64 @@ -1127,7 +1127,7 @@ AsciiStrStr ( @param String Pointer to a Null-terminated ASCII string. - @retval UINTN + @retval Value translated from String. **/ UINTN @@ -1164,7 +1164,7 @@ AsciiStrDecimalToUintn ( @param String Pointer to a Null-terminated ASCII string. - @retval UINT64 + @retval Value translated from String. **/ UINT64 @@ -1205,7 +1205,7 @@ AsciiStrDecimalToUint64 ( @param String Pointer to a Null-terminated ASCII string. - @retval UINTN + @retval Value translated from String. **/ UINTN @@ -1246,7 +1246,7 @@ AsciiStrHexToUintn ( @param String Pointer to a Null-terminated ASCII string. - @retval UINT64 + @retval Value translated from String. **/ UINT64 @@ -1595,6 +1595,8 @@ IsNodeAtEnd ( @param FirstEntry A pointer to a node in a linked list. @param SecondEntry A pointer to another node in the same linked list. + + @return SecondEntry **/ LIST_ENTRY * @@ -2237,7 +2239,7 @@ WriteUnaligned16 ( @param Buffer Pointer to a 24-bit value that may be unaligned. - @return The value read. + @return The value read from Buffer. **/ UINT32 @@ -2259,7 +2261,7 @@ ReadUnaligned24 ( @param Buffer Pointer to a 24-bit value that may be unaligned. @param Value 24-bit value to write to Buffer. - @return The value written. + @return The value written to Buffer. **/ UINT32 @@ -2280,7 +2282,7 @@ WriteUnaligned24 ( @param Uint32 Pointer to a 32-bit value that may be unaligned. - @return *Uint32 + @return Value read from Uint32 **/ UINT32 @@ -2302,7 +2304,7 @@ ReadUnaligned32 ( @param Uint32 Pointer to a 32-bit value that may be unaligned. @param Value 32-bit value to write to Buffer. - @return Value + @return Value written to Uint32. **/ UINT32 @@ -2323,7 +2325,7 @@ WriteUnaligned32 ( @param Uint64 Pointer to a 64-bit value that may be unaligned. - @return *Uint64 + @return Value read from Uint64. **/ UINT64 @@ -2345,7 +2347,7 @@ ReadUnaligned64 ( @param Uint64 Pointer to a 64-bit value that may be unaligned. @param Value 64-bit value to write to Buffer. - @return Value + @return Value written to Uint64. **/ UINT64 @@ -3048,7 +3050,7 @@ GetSpinLockProperties ( @param SpinLock A pointer to the spin lock to initialize to the released state. - @return SpinLock + @return SpinLock in release state. **/ SPIN_LOCK * @@ -3075,7 +3077,7 @@ InitializeSpinLock ( @param SpinLock A pointer to the spin lock to place in the acquired state. - @return SpinLock + @return SpinLock accquired lock. **/ SPIN_LOCK * @@ -3120,7 +3122,7 @@ AcquireSpinLockOrFail ( @param SpinLock A pointer to the spin lock to release. - @return SpinLock + @return SpinLock released lock. **/ SPIN_LOCK * @@ -3245,6 +3247,7 @@ InterlockedCompareExchange64 ( @param CompareValue Pointer value used in compare operation. @param ExchangeValue Pointer value used in exchange operation. + @return The original *Value before exchange. **/ VOID * EFIAPI @@ -3552,8 +3555,6 @@ LongJump ( /** Enables CPU interrupts. - Enables CPU interrupts. - **/ VOID EFIAPI @@ -3565,8 +3566,6 @@ EnableInterrupts ( /** Disables CPU interrupts. - Disables CPU interrupts. - **/ VOID EFIAPI @@ -3579,9 +3578,6 @@ DisableInterrupts ( Disables CPU interrupts and returns the interrupt state prior to the disable operation. - Disables CPU interrupts and returns the interrupt state prior to the disable - operation. - @retval TRUE CPU interrupts were enabled on entry to this call. @retval FALSE CPU interrupts were disabled on entry to this call. @@ -3597,9 +3593,6 @@ SaveAndDisableInterrupts ( Enables CPU interrupts for the smallest window required to capture any pending interrupts. - Enables CPU interrupts for the smallest window required to capture any - pending interrupts. - **/ VOID EFIAPI @@ -3611,8 +3604,8 @@ EnableDisableInterrupts ( /** Retrieves the current CPU interrupt state. - Retrieves the current CPU interrupt state. Returns TRUE is interrupts are - currently enabled. Otherwise returns FALSE. + Returns TRUE is interrupts are currently enabled. Otherwise + returns FALSE. @retval TRUE CPU interrupts are enabled. @retval FALSE CPU interrupts are disabled. diff --git a/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf b/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf index 50e8990010..19ae8032d3 100644 --- a/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf +++ b/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf @@ -45,12 +45,10 @@ [Packages] MdePkg/MdePkg.dec -[LibraryClasses] - DebugLib - [LibraryClasses.Ipf] PalCallLib [LibraryClasses.common] BaseLib + DebugLib diff --git a/MdePkg/Library/BaseCacheMaintenanceLib/EbcCache.c b/MdePkg/Library/BaseCacheMaintenanceLib/EbcCache.c index ccb5010fd0..d9605566fd 100644 --- a/MdePkg/Library/BaseCacheMaintenanceLib/EbcCache.c +++ b/MdePkg/Library/BaseCacheMaintenanceLib/EbcCache.c @@ -56,7 +56,7 @@ InvalidateInstructionCache ( @param Length The number of bytes to invalidate from the instruction cache. - @return Address + @return Address of cache invalidation. **/ VOID * @@ -111,7 +111,7 @@ WriteBackInvalidateDataCache ( @param Length The number of bytes to write back and invalidate from the data cache. - @return Address + @return Address of cache invalidation. **/ VOID * @@ -165,7 +165,7 @@ WriteBackDataCache ( mode, then Address is a virtual address. @param Length The number of bytes to write back from the data cache. - @return Address + @return Address of cache wrote in main memory. **/ VOID * @@ -222,7 +222,7 @@ InvalidateDataCache ( then Address is a virtual address. @param Length The number of bytes to invalidate from the data cache. - @return Address + @return Address of cache invalidation. **/ VOID * diff --git a/MdePkg/Library/BaseCacheMaintenanceLib/IpfCache.c b/MdePkg/Library/BaseCacheMaintenanceLib/IpfCache.c index 17ef43d968..a46df59497 100644 --- a/MdePkg/Library/BaseCacheMaintenanceLib/IpfCache.c +++ b/MdePkg/Library/BaseCacheMaintenanceLib/IpfCache.c @@ -61,7 +61,7 @@ InvalidateInstructionCache ( @param Length The number of bytes to invalidate from the instruction cache. - @return Address + @return Address of cahce invalidation. **/ VOID * @@ -116,7 +116,7 @@ WriteBackInvalidateDataCache ( @param Length The number of bytes to write back and invalidate from the data cache. - @return Address + @return Address of cache invalidation. **/ VOID * @@ -172,7 +172,7 @@ WriteBackDataCache ( mode, then Address is a virtual address. @param Length The number of bytes to write back from the data cache. - @return Address + @return Address of cache wrote in main memory. **/ VOID * @@ -231,7 +231,7 @@ InvalidateDataCache ( then Address is a virtual address. @param Length The number of bytes to invalidate from the data cache. - @return Address + @return Address of cache invalidation. **/ VOID * diff --git a/MdePkg/Library/BaseCacheMaintenanceLib/x86Cache.c b/MdePkg/Library/BaseCacheMaintenanceLib/x86Cache.c index 7e744698e3..1fc2b95daa 100644 --- a/MdePkg/Library/BaseCacheMaintenanceLib/x86Cache.c +++ b/MdePkg/Library/BaseCacheMaintenanceLib/x86Cache.c @@ -64,7 +64,7 @@ InvalidateInstructionCache ( @param Length The number of bytes to invalidate from the instruction cache. - @return Address + @return Address of cache invalidation. **/ VOID * @@ -120,7 +120,7 @@ WriteBackInvalidateDataCache ( @param Length The number of bytes to write back and invalidate from the data cache. - @return Address + @return Address of cache invalidation. **/ VOID * @@ -139,6 +139,9 @@ WriteBackInvalidateDataCacheRange ( } Start = (UINTN)Address; + // + // Calculate the cache line alignment + // End = (Start + Length + (CACHE_LINE_SIZE - 1)) & ~(CACHE_LINE_SIZE - 1); Start &= ~(CACHE_LINE_SIZE - 1); @@ -189,7 +192,7 @@ WriteBackDataCache ( mode, then Address is a virtual address. @param Length The number of bytes to write back from the data cache. - @return Address + @return Address of cache wrote in main memory. **/ VOID * @@ -246,7 +249,7 @@ InvalidateDataCache ( then Address is a virtual address. @param Length The number of bytes to invalidate from the data cache. - @return Address + @return Address of cache invalidation. **/ VOID * diff --git a/MdePkg/Library/BaseDebugLibNull/DebugLib.c b/MdePkg/Library/BaseDebugLibNull/DebugLib.c index 5034317d49..73319d729b 100644 --- a/MdePkg/Library/BaseDebugLibNull/DebugLib.c +++ b/MdePkg/Library/BaseDebugLibNull/DebugLib.c @@ -93,7 +93,7 @@ DebugAssert ( @param Buffer Pointer to the target buffer to fill with PcdDebugClearMemoryValue. @param Length Number of bytes in Buffer to fill with zeros PcdDebugClearMemoryValue. - @return Buffer + @return Buffer filled with PcdDebugClearMemoryValue. **/ VOID * @@ -116,6 +116,8 @@ DebugClearMemory ( @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set. @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear. + + @return Always return FALSE. **/ BOOLEAN @@ -137,6 +139,8 @@ DebugAssertEnabled ( @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set. @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear. + + @return Always return FALSE. **/ BOOLEAN @@ -158,6 +162,8 @@ DebugPrintEnabled ( @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set. @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear. + + @return Always return FALSE. **/ BOOLEAN @@ -179,6 +185,8 @@ DebugCodeEnabled ( @retval TRUE The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set. @retval FALSE The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear. + + @return Always return FALSE. **/ BOOLEAN diff --git a/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicInternal.h b/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicInternal.h index 1a8cc27c56..4a29835ea3 100644 --- a/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicInternal.h +++ b/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicInternal.h @@ -1,7 +1,7 @@ /**@file Common header file shared by all source files. - This file includes package header files, library classes and protocol, PPI & GUID definitions. + This file includes package header files, dependent library classes. Copyright (c) 2007, Intel Corporation. All rights reserved. This program and the accompanying materials @@ -12,8 +12,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#ifndef __COMMON_HEADER_H_ -#define __COMMON_HEADER_H_ +#ifndef __BASEIOLIB_INTRINSIC_INTERNAL_H_ +#define __BASEIOLIB_INTRINSIC_INTERNAL_H_ diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoHighLevel.c b/MdePkg/Library/BaseIoLibIntrinsic/IoHighLevel.c index bc5d4aab89..4e5a738155 100644 --- a/MdePkg/Library/BaseIoLibIntrinsic/IoHighLevel.c +++ b/MdePkg/Library/BaseIoLibIntrinsic/IoHighLevel.c @@ -130,7 +130,8 @@ IoAndThenOr8 ( @param EndBit The ordinal of the most significant bit in the bit field. Range 0..7. - @return The value read. + @return The value read from I/O port specified by StartBit and + EndBit. **/ UINT8 @@ -410,7 +411,8 @@ IoAndThenOr16 ( @param EndBit The ordinal of the most significant bit in the bit field. Range 0..15. - @return The value read. + @return The value read from I/O port specified by StartBit and + EndBit. **/ UINT16 @@ -690,7 +692,8 @@ IoAndThenOr32 ( @param EndBit The ordinal of the most significant bit in the bit field. Range 0..31. - @return The value read. + @return The value read from I/O port specified by StartBit and + EndBit. **/ UINT32 @@ -970,7 +973,8 @@ IoAndThenOr64 ( @param EndBit The ordinal of the most significant bit in the bit field. Range 0..63. - @return The value read. + @return The value read from I/O port specified by StartBit and + EndBit. **/ UINT64 @@ -1251,7 +1255,8 @@ MmioAndThenOr8 ( @param EndBit The ordinal of the most significant bit in the bit field. Range 0..7. - @return The value read. + @return The value read from I/O port specified by StartBit and + EndBit. **/ UINT8 @@ -1533,7 +1538,8 @@ MmioAndThenOr16 ( @param EndBit The ordinal of the most significant bit in the bit field. Range 0..15. - @return The value read. + @return The value read from I/O port specified by StartBit and + EndBit. **/ UINT16 @@ -1815,7 +1821,8 @@ MmioAndThenOr32 ( @param EndBit The ordinal of the most significant bit in the bit field. Range 0..31. - @return The value read. + @return The value read from I/O port specified by StartBit and + EndBit. **/ UINT32 @@ -2097,7 +2104,8 @@ MmioAndThenOr64 ( @param EndBit The ordinal of the most significant bit in the bit field. Range 0..63. - @return The value read. + @return The value read from I/O port specified by StartBit and + EndBit. **/ UINT64 diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c index 25efcd2e60..86efa6db6a 100644 --- a/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c +++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c @@ -12,9 +12,6 @@ **/ -// -// Include common header file for this module. -// #include "BaseIoLibIntrinsicInternal.h" /** @@ -28,7 +25,7 @@ @param Port The I/O port to read. - @return The value read. + @return Always return zero. **/ UINT64 @@ -53,7 +50,7 @@ IoRead64 ( @param Port The I/O port to write. @param Value The value to write to the I/O port. - @return The value written the I/O port. + @return Always return zero. **/ UINT64 diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c index c28ad56624..db94f0f47e 100644 --- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c +++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c @@ -37,7 +37,7 @@ @param Address The MMIO register to read. - @return The value read. + @return The value read from Address. **/ UINT8 @@ -61,6 +61,9 @@ MmioRead8 ( @param Address The MMIO register to write. @param Value The value to write to the MMIO register. + @return The value written to the Mmio. It equals to the input + Value instead of the actual value read back from the + Mmio. **/ UINT8 EFIAPI @@ -83,7 +86,7 @@ MmioWrite8 ( @param Address The MMIO register to read. - @return The value read. + @return The value read from Address. **/ UINT16 @@ -108,6 +111,9 @@ MmioRead16 ( @param Address The MMIO register to write. @param Value The value to write to the MMIO register. + @return The value written to the Mmio. It equals to the input + Value instead of the actual value read back from the + Mmio. **/ UINT16 EFIAPI @@ -131,7 +137,7 @@ MmioWrite16 ( @param Address The MMIO register to read. - @return The value read. + @return The value read from Address. **/ UINT32 @@ -156,6 +162,9 @@ MmioRead32 ( @param Address The MMIO register to write. @param Value The value to write to the MMIO register. + @return The value written to the Mmio. It equals to the input + Value instead of the actual value read back from the + Mmio. **/ UINT32 EFIAPI @@ -179,7 +188,7 @@ MmioWrite32 ( @param Address The MMIO register to read. - @return The value read. + @return The value read from Address. **/ UINT64 @@ -204,6 +213,9 @@ MmioRead64 ( @param Address The MMIO register to write. @param Value The value to write to the MMIO register. + @return The value written to the Mmio. It equals to the input + Value instead of the actual value read back from the + Mmio. **/ UINT64 EFIAPI @@ -229,7 +241,7 @@ MmioWrite64 ( @param Port The I/O port to read. - @return The value read. + @return The value read from Port. **/ __inline__ @@ -257,7 +269,9 @@ IoRead8 ( @param Port The I/O port to write. @param Value The value to write to the I/O port. - @return The value written the I/O port. + @return The value written to the I/O port. It equals to the + input Value instead of the actual value read back from + the I/O port. **/ __inline__ @@ -283,7 +297,7 @@ IoWrite8 ( @param Port The I/O port to read. - @return The value read. + @return The value read from Port. **/ __inline__ @@ -312,7 +326,9 @@ IoRead16 ( @param Port The I/O port to write. @param Value The value to write to the I/O port. - @return The value written the I/O port. + @return The value written to the I/O port. It equals to the + input Value instead of the actual value read back from + the I/O port. **/ __inline__ @@ -339,7 +355,7 @@ IoWrite16 ( @param Port The I/O port to read. - @return The value read. + @return The value read from Port. **/ __inline__ @@ -368,7 +384,9 @@ IoRead32 ( @param Port The I/O port to write. @param Value The value to write to the I/O port. - @return The value written the I/O port. + @return The value written to the I/O port. It equals to the + input Value instead of the actual value read back from + the I/O port. **/ __inline__ diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibIcc.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibIcc.c index d12ce3de90..c83fe8838d 100644 --- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibIcc.c +++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibIcc.c @@ -13,9 +13,6 @@ **/ -// -// Include common header file for this module. -// #include "BaseIoLibIntrinsicInternal.h" /** @@ -29,7 +26,7 @@ @param Address The MMIO register to read. - @return The value read. + @return The value read from Address. **/ UINT8 @@ -52,6 +49,10 @@ MmioRead8 ( @param Address The MMIO register to write. @param Value The value to write to the MMIO register. + + @return The value written to the Mmio. It equals to the input + Value instead of the actual value read back from the + Mmio. **/ UINT8 @@ -75,7 +76,7 @@ MmioWrite8 ( @param Address The MMIO register to read. - @return The value read. + @return The value read from Address. **/ UINT16 @@ -99,6 +100,10 @@ MmioRead16 ( @param Address The MMIO register to write. @param Value The value to write to the MMIO register. + + @return The value written to the Mmio. It equals to the input + Value instead of the actual value read back from the + Mmio. **/ UINT16 @@ -123,7 +128,7 @@ MmioWrite16 ( @param Address The MMIO register to read. - @return The value read. + @return The value read from Address. **/ UINT32 @@ -147,6 +152,10 @@ MmioRead32 ( @param Address The MMIO register to write. @param Value The value to write to the MMIO register. + + @return The value written to the Mmio. It equals to the input + Value instead of the actual value read back from the + Mmio. **/ UINT32 @@ -171,7 +180,7 @@ MmioWrite32 ( @param Address The MMIO register to read. - @return The value read. + @return The value read from Address. **/ UINT64 @@ -196,6 +205,9 @@ MmioRead64 ( @param Address The MMIO register to write. @param Value The value to write to the MMIO register. + @return The value written to the Mmio. It equals to the input + Value instead of the actual value read back from the + Mmio. **/ UINT64 EFIAPI @@ -221,7 +233,7 @@ MmioWrite64 ( @param Port The I/O port to read. - @return The value read. + @return The value read from Port. **/ UINT8 @@ -253,7 +265,9 @@ IoRead8 ( @param Port The I/O port to write. @param Value The value to write to the I/O port. - @return The value written the I/O port. + @return The value written to the I/O port. It equals to the input + Value instead of the actual value read back from the + I/O port. **/ UINT8 @@ -282,7 +296,7 @@ IoWrite8 ( @param Port The I/O port to read. - @return The value read. + @return The value read from Port. **/ UINT16 @@ -316,7 +330,9 @@ IoRead16 ( @param Port The I/O port to write. @param Value The value to write to the I/O port. - @return The value written the I/O port. + @return The value written to the I/O port. It equals to the input + Value instead of the actual value read back from the + I/O port. **/ UINT16 @@ -351,7 +367,7 @@ IoWrite16 ( @param Port The I/O port to read. - @return The value read. + @return The value read from Port. **/ UINT32 @@ -385,7 +401,9 @@ IoRead32 ( @param Port The I/O port to write. @param Value The value to write to the I/O port. - @return The value written the I/O port. + @return The value written to the I/O port. It equals to the input + Value instead of the actual value read back from the + I/O port. **/ UINT32 diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibIpf.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibIpf.c index 23ca5c68ed..8eec29551f 100644 --- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibIpf.c +++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibIpf.c @@ -61,7 +61,7 @@ InternalGetMemoryMapAddress ( @param Port The I/O port to read. - @return The value read. + @return The value read from Port. **/ UINT8 @@ -82,7 +82,7 @@ IoRead8 ( @param Port The I/O port to read. - @return The value read. + @return The value read from Port. **/ UINT16 @@ -103,7 +103,7 @@ IoRead16 ( @param Port The I/O port to read. - @return The value read. + @return The value read from Port. **/ UINT32 @@ -126,7 +126,7 @@ IoRead32 ( @param Port The I/O port to read. - @return The value read. + @return The value read from Port. **/ UINT64 @@ -149,7 +149,9 @@ IoRead64 ( @param Port The I/O port to write. @param Value The value to write to the I/O port. - @return The value written the I/O port. + @return The value written to the I/O port. It equals to the + input Value instead of the actual value read back from + the I/O port. **/ UINT8 @@ -172,7 +174,9 @@ IoWrite8 ( @param Port The I/O port to write. @param Value The value to write to the I/O port. - @return The value written the I/O port. + @return The value written to the I/O port. It equals to the + input Value instead of the actual value read back from + the I/O port. **/ UINT16 @@ -195,7 +199,9 @@ IoWrite16 ( @param Port The I/O port to write. @param Value The value to write to the I/O port. - @return The value written the I/O port. + @return The value written to the I/O port. It equals to the + input Value instead of the actual value read back from + the I/O port. **/ UINT32 @@ -220,7 +226,9 @@ IoWrite32 ( @param Port The I/O port to write. @param Value The value to write to the I/O port. - @return The value written the I/O port. + @return The value written to the I/O port. It equals to the + input Value instead of the actual value read back from + the I/O port. **/ UINT64 @@ -243,7 +251,7 @@ IoWrite64 ( @param Address The MMIO register to read. - @return The value read. + @return The value read from Address. **/ UINT8 @@ -272,7 +280,7 @@ MmioRead8 ( @param Address The MMIO register to read. - @return The value read. + @return The value read from Address. **/ UINT16 @@ -306,7 +314,7 @@ MmioRead16 ( @param Address The MMIO register to read. - @return The value read. + @return The value read from Address. **/ UINT32 @@ -340,7 +348,7 @@ MmioRead32 ( @param Address The MMIO register to read. - @return The value read. + @return The value read from Address. **/ UINT64 @@ -376,7 +384,9 @@ MmioRead64 ( @param Address The MMIO register to write. @param Data The value to write to the MMIO register. - @return The value written the memory address. + @return The value written to the Mmio. It equals to the + input Value instead of the actual value read back from + the Mmio. **/ UINT8 @@ -405,7 +415,9 @@ MmioWrite8 ( @param Address The MMIO register to write. @param Data The value to write to the MMIO register. - @return The value written the memory address. + @return The value written to the Mmio. It equals to the + input Value instead of the actual value read back from + the Mmio. **/ UINT16 @@ -439,7 +451,9 @@ MmioWrite16 ( @param Address The MMIO register to write. @param Data The value to write to the MMIO register. - @return The value written the memory address. + @return The value written to the Mmio. It equals to the + input Value instead of the actual value read back from + the Mmio. **/ UINT32 @@ -473,7 +487,9 @@ MmioWrite32 ( @param Address The MMIO register to write. @param Data The value to write to the MMIO register. - @return The value written the memory address. + @return The value written to the Mmio. It equals to the + input Value instead of the actual value read back from + the Mmio. **/ UINT64 diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibMmioBuffer.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibMmioBuffer.c index 4569a166e7..20c4693f3a 100644 --- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibMmioBuffer.c +++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibMmioBuffer.c @@ -12,9 +12,6 @@ **/ -// -// Include common header file for this module. -// #include "BaseIoLibIntrinsicInternal.h" /** @@ -32,7 +29,7 @@ @param Length Size in bytes of the copy. @param Buffer Pointer to a system memory buffer receiving the data read. - @return Buffer + @return Buffer contains the data read from Mmio. **/ UINT8 * @@ -76,7 +73,7 @@ MmioReadBuffer8 ( @param Length Size in bytes of the copy. @param Buffer Pointer to a system memory buffer receiving the data read. - @return Buffer + @return Buffer contains the data read from Mmio. **/ UINT16 * @@ -127,7 +124,7 @@ MmioReadBuffer16 ( @param Length Size in bytes of the copy. @param Buffer Pointer to a system memory buffer receiving the data read. - @return Buffer + @return Buffer contains the data read from Mmio. **/ UINT32 * @@ -178,7 +175,7 @@ MmioReadBuffer32 ( @param Length Size in bytes of the copy. @param Buffer Pointer to a system memory buffer receiving the data read. - @return Buffer + @return Buffer contains the data read from Mmio. **/ UINT64 * diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c index 9fec1bcae9..1e903a7e25 100644 --- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c +++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c @@ -63,7 +63,7 @@ void _ReadWriteBarrier (void); @param Port The I/O port to read. - @return The value read. + @return The value read from Port. **/ UINT8 @@ -119,7 +119,7 @@ IoWrite8 ( @param Port The I/O port to read. - @return The value read. + @return The value read from Port. **/ UINT16 @@ -177,7 +177,7 @@ IoWrite16 ( @param Port The I/O port to read. - @return The value read. + @return The value read from Port. **/ UINT32 @@ -236,7 +236,7 @@ IoWrite32 ( @param Address The MMIO register to read. - @return The value read. + @return The value read from Address. **/ UINT8 @@ -262,7 +262,11 @@ MmioRead8 ( @param Address The MMIO register to write. @param Value The value to write to the MMIO register. - + + @return The value written to the Mmio. It equals to the input + Value instead of the actual value read back from the + Mmio. + **/ UINT8 EFIAPI @@ -285,7 +289,7 @@ MmioWrite8 ( @param Address The MMIO register to read. - @return The value read. + @return The value read from Address. **/ UINT16 @@ -312,6 +316,9 @@ MmioRead16 ( @param Address The MMIO register to write. @param Value The value to write to the MMIO register. + + @return The value read from the Mmio after wrote specified + Value. **/ UINT16 @@ -336,7 +343,7 @@ MmioWrite16 ( @param Address The MMIO register to read. - @return The value read. + @return The value read from Address. **/ UINT32 @@ -363,6 +370,10 @@ MmioRead32 ( @param Address The MMIO register to write. @param Value The value to write to the MMIO register. + + @return The value written to the Mmio. It equals to the input + Value instead of the actual value read back from the + Mmio. **/ UINT32 @@ -387,7 +398,7 @@ MmioWrite32 ( @param Address The MMIO register to read. - @return The value read. + @return The value read from Address. **/ UINT64 @@ -415,6 +426,10 @@ MmioRead64 ( @param Address The MMIO register to write. @param Value The value to write to the MMIO register. + @return The value written to the Mmio. It equals to the input + Value instead of the actual value read back from the + Mmio. + **/ UINT64 EFIAPI diff --git a/MdePkg/Library/BaseLib/BaseLibInternals.h b/MdePkg/Library/BaseLib/BaseLibInternals.h index 51f3c96cb8..04f622b79a 100644 --- a/MdePkg/Library/BaseLib/BaseLibInternals.h +++ b/MdePkg/Library/BaseLib/BaseLibInternals.h @@ -311,6 +311,7 @@ InternalMathDivRemU64x64 ( **/ INT64 +EFIAPI InternalMathDivRemS64x64 ( IN INT64 Dividend, IN INT64 Divisor, @@ -374,6 +375,7 @@ InternalSwitchStack ( **/ BOOLEAN +EFIAPI IsNodeInList ( IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node @@ -484,6 +486,7 @@ InternalSyncCompareExchange64 ( **/ unsigned int +EFIAPI BitFieldReadUint ( IN unsigned int Operand, IN UINTN StartBit, @@ -508,6 +511,7 @@ BitFieldReadUint ( **/ unsigned int +EFIAPI BitFieldOrUint ( IN unsigned int Operand, IN UINTN StartBit, @@ -533,6 +537,7 @@ BitFieldOrUint ( **/ unsigned int +EFIAPI BitFieldAndUint ( IN unsigned int Operand, IN UINTN StartBit, @@ -553,6 +558,7 @@ BitFieldAndUint ( **/ VOID +EFIAPI InternalAssertJumpBuffer ( IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer ); diff --git a/MdePkg/Library/BaseLib/BitField.c b/MdePkg/Library/BaseLib/BitField.c index 372ba12355..5e894843b2 100644 --- a/MdePkg/Library/BaseLib/BitField.c +++ b/MdePkg/Library/BaseLib/BitField.c @@ -32,6 +32,7 @@ **/ unsigned int +EFIAPI BitFieldReadUint ( IN unsigned int Operand, IN UINTN StartBit, @@ -62,6 +63,7 @@ BitFieldReadUint ( **/ unsigned int +EFIAPI BitFieldOrUint ( IN unsigned int Operand, IN UINTN StartBit, @@ -93,6 +95,7 @@ BitFieldOrUint ( **/ unsigned int +EFIAPI BitFieldAndUint ( IN unsigned int Operand, IN UINTN StartBit, diff --git a/MdePkg/Library/BaseLib/CpuDeadLoop.c b/MdePkg/Library/BaseLib/CpuDeadLoop.c index b2014c77af..325be96d93 100644 --- a/MdePkg/Library/BaseLib/CpuDeadLoop.c +++ b/MdePkg/Library/BaseLib/CpuDeadLoop.c @@ -36,5 +36,5 @@ CpuDeadLoop ( { volatile UINTN Index; - for (Index = 0; Index == 0;); + for (Index = 0; 0 == Index;); } diff --git a/MdePkg/Library/BaseLib/Ebc/SetJumpLongJump.c b/MdePkg/Library/BaseLib/Ebc/SetJumpLongJump.c index 44d393f6b4..13de998127 100644 --- a/MdePkg/Library/BaseLib/Ebc/SetJumpLongJump.c +++ b/MdePkg/Library/BaseLib/Ebc/SetJumpLongJump.c @@ -28,6 +28,7 @@ **/ VOID +EFIAPI InternalAssertJumpBuffer ( IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer ); diff --git a/MdePkg/Library/BaseLib/Ebc/Synchronization.c b/MdePkg/Library/BaseLib/Ebc/Synchronization.c index ef3fa62d89..cb5d1f3450 100644 --- a/MdePkg/Library/BaseLib/Ebc/Synchronization.c +++ b/MdePkg/Library/BaseLib/Ebc/Synchronization.c @@ -12,6 +12,25 @@ **/ +/** + Performs an atomic compare exchange operation on a 32-bit + unsigned integer. + + Performs an atomic compare exchange operation on the 32-bit + unsigned integer specified by Value. If Value is equal to + CompareValue, then Value is set to ExchangeValue and + CompareValue is returned. If Value is not equal to + CompareValue, then Value is returned. The compare exchange + operation must be performed using MP safe mechanisms. + + @param Value A pointer to the 32-bit value for the + compare exchange operation. + @param CompareValue 32-bit value used in compare operation. + @param ExchangeValue 32-bit value used in exchange operation. + + @return The original *Value before exchange. + +**/ UINT32 EFIAPI InternalSyncCompareExchange32 ( diff --git a/MdePkg/Library/BaseLib/GetPowerOfTwo32.c b/MdePkg/Library/BaseLib/GetPowerOfTwo32.c index 19b00dd760..f9849c34c4 100644 --- a/MdePkg/Library/BaseLib/GetPowerOfTwo32.c +++ b/MdePkg/Library/BaseLib/GetPowerOfTwo32.c @@ -38,7 +38,7 @@ GetPowerOfTwo32 ( IN UINT32 Operand ) { - if (Operand == 0) { + if (0 == Operand) { return 0; } diff --git a/MdePkg/Library/BaseLib/Ia32/DivS64x64Remainder.c b/MdePkg/Library/BaseLib/Ia32/DivS64x64Remainder.c index 3a1867b094..36b256f07c 100644 --- a/MdePkg/Library/BaseLib/Ia32/DivS64x64Remainder.c +++ b/MdePkg/Library/BaseLib/Ia32/DivS64x64Remainder.c @@ -37,6 +37,7 @@ **/ INT64 +EFIAPI InternalMathDivRemS64x64 ( IN INT64 Dividend, IN INT64 Divisor, diff --git a/MdePkg/Library/BaseLib/LinkedList.c b/MdePkg/Library/BaseLib/LinkedList.c index 5d804109ab..73cfe4d7a8 100644 --- a/MdePkg/Library/BaseLib/LinkedList.c +++ b/MdePkg/Library/BaseLib/LinkedList.c @@ -41,6 +41,7 @@ **/ BOOLEAN +EFIAPI IsNodeInList ( IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node @@ -384,6 +385,8 @@ IsNodeAtEnd ( @param FirstEntry A pointer to a node in a linked list. @param SecondEntry A pointer to another node in the same linked list. + + @return SecondEntry **/ LIST_ENTRY * diff --git a/MdePkg/Library/BaseLib/LowBitSet32.c b/MdePkg/Library/BaseLib/LowBitSet32.c index a598a1f71f..58d0063e22 100644 --- a/MdePkg/Library/BaseLib/LowBitSet32.c +++ b/MdePkg/Library/BaseLib/LowBitSet32.c @@ -44,6 +44,6 @@ LowBitSet32 ( return -1; } - for (BitIndex = 0; (Operand & 1) == 0; BitIndex++, Operand >>= 1); + for (BitIndex = 0; 0 == (Operand & 1); BitIndex++, Operand >>= 1); return BitIndex; } diff --git a/MdePkg/Library/BaseLib/Math64.c b/MdePkg/Library/BaseLib/Math64.c index 43dd575f09..02a29fb73f 100644 --- a/MdePkg/Library/BaseLib/Math64.c +++ b/MdePkg/Library/BaseLib/Math64.c @@ -361,6 +361,7 @@ InternalMathDivRemU64x64 ( **/ INT64 +EFIAPI InternalMathDivRemS64x64 ( IN INT64 Dividend, IN INT64 Divisor, diff --git a/MdePkg/Library/BaseLib/String.c b/MdePkg/Library/BaseLib/String.c index 909262e587..bdfa7a3c6d 100644 --- a/MdePkg/Library/BaseLib/String.c +++ b/MdePkg/Library/BaseLib/String.c @@ -193,7 +193,7 @@ StrLen ( @param String Pointer to a Null-terminated Unicode string. - @return The size of String. + @return The size in bytes of String. **/ UINTN @@ -291,7 +291,7 @@ StrnCmp ( IN UINTN Length ) { - if (Length == 0) { + if (0 == Length) { return 0; } @@ -469,7 +469,7 @@ StrStr ( SearchStringTmp++; } - if (*SearchStringTmp == '\0') { + if ('\0' == *SearchStringTmp) { return (CHAR16 *) FirstMatch; } @@ -641,14 +641,14 @@ StrDecimalToUintn ( // // Ignore the pad spaces (space or tab) // - while ((*String == L' ') || (*String == L'\t')) { + while ((L' ' ==*String) || (L'\t' == *String)) { String++; } // // Ignore leading Zeros after the spaces // - while (*String == L'0') { + while (L'0' == *String) { String++; } @@ -660,7 +660,7 @@ StrDecimalToUintn ( // to the range defined by UINTN, then ASSERT(). // ASSERT ((Result < QUIENT_MAX_UINTN_DIVIDED_BY_10) || - ((Result == QUIENT_MAX_UINTN_DIVIDED_BY_10) && + ((QUIENT_MAX_UINTN_DIVIDED_BY_10 == Result) && (*String - L'0') <= REMINDER_MAX_UINTN_DIVIDED_BY_10) ); @@ -723,14 +723,14 @@ StrDecimalToUint64 ( // // Ignore the pad spaces (space or tab) // - while ((*String == L' ') || (*String == L'\t')) { + while ((L' ' == *String) || (L'\t' == *String)) { String++; } // // Ignore leading Zeros after the spaces // - while (*String == L'0') { + while (L'0' == *String) { String++; } @@ -742,7 +742,7 @@ StrDecimalToUint64 ( // to the range defined by UINTN, then ASSERT(). // ASSERT ((Result < QUIENT_MAX_UINT64_DIVIDED_BY_10) || - ((Result == QUIENT_MAX_UINT64_DIVIDED_BY_10) && + ((QUIENT_MAX_UINT64_DIVIDED_BY_10 == Result) && (*String - L'0') <= REMINDER_MAX_UINT64_DIVIDED_BY_10) ); @@ -805,19 +805,19 @@ StrHexToUintn ( // // Ignore the pad spaces (space or tab) // - while ((*String == L' ') || (*String == L'\t')) { + while ((L' ' == *String) || (L'\t' == *String)) { String++; } // // Ignore leading Zeros after the spaces // - while (*String == L'0') { + while (L'0' == *String) { String++; } if (InternalCharToUpper (*String) == L'X') { - ASSERT (*(String - 1) == L'0'); + ASSERT (L'0' == *(String - 1)); if (*(String - 1) != L'0') { return 0; } @@ -835,7 +835,7 @@ StrHexToUintn ( // to the range defined by UINTN, then ASSERT(). // ASSERT ((Result < QUIENT_MAX_UINTN_DIVIDED_BY_16) || - ((Result == QUIENT_MAX_UINTN_DIVIDED_BY_16) && + ((QUIENT_MAX_UINTN_DIVIDED_BY_16 == Result) && (InternalHexCharToUintn (*String) <= REMINDER_MAX_UINTN_DIVIDED_BY_16)) ); @@ -899,19 +899,19 @@ StrHexToUint64 ( // // Ignore the pad spaces (space or tab) // - while ((*String == L' ') || (*String == L'\t')) { + while ((L' ' == *String) || (L'\t' == *String)) { String++; } // // Ignore leading Zeros after the spaces // - while (*String == L'0') { + while (L'0' == *String) { String++; } if (InternalCharToUpper (*String) == L'X') { - ASSERT (*(String - 1) == L'0'); + ASSERT (L'0' == *(String - 1)); if (*(String - 1) != L'0') { return 0; } @@ -929,7 +929,7 @@ StrHexToUint64 ( // to the range defined by UINTN, then ASSERT(). // ASSERT ((Result < QUIENT_MAX_UINT64_DIVIDED_BY_16)|| - ((Result == QUIENT_MAX_UINT64_DIVIDED_BY_16) && + ((QUIENT_MAX_UINT64_DIVIDED_BY_16 == Result) && (InternalHexCharToUintn (*String) <= REMINDER_MAX_UINT64_DIVIDED_BY_16)) ); @@ -1153,7 +1153,7 @@ AsciiStrnCpy ( { CHAR8 *ReturnValue; - if (Length == 0) { + if (0 == Length) { return Destination; } @@ -1432,7 +1432,7 @@ AsciiStrnCmp ( IN UINTN Length ) { - if (Length == 0) { + if (0 == Length) { return 0; } @@ -1662,14 +1662,14 @@ AsciiStrDecimalToUintn ( // // Ignore the pad spaces (space or tab) // - while ((*String == ' ') || (*String == '\t')) { + while ((' ' == *String) || ('\t' == *String)) { String++; } // // Ignore leading Zeros after the spaces // - while (*String == '0') { + while ('0' == *String) { String++; } @@ -1681,7 +1681,7 @@ AsciiStrDecimalToUintn ( // to the range defined by UINTN, then ASSERT(). // ASSERT ((Result < QUIENT_MAX_UINTN_DIVIDED_BY_10) || - ((Result == QUIENT_MAX_UINTN_DIVIDED_BY_10) && + ((QUIENT_MAX_UINTN_DIVIDED_BY_10 == Result) && (*String - '0') <= REMINDER_MAX_UINTN_DIVIDED_BY_10) ); @@ -1739,14 +1739,14 @@ AsciiStrDecimalToUint64 ( // // Ignore the pad spaces (space or tab) // - while ((*String == ' ') || (*String == '\t')) { + while ((' ' == *String) || ('\t' == *String)) { String++; } // // Ignore leading Zeros after the spaces // - while (*String == '0') { + while ('0' == *String) { String++; } @@ -1758,7 +1758,7 @@ AsciiStrDecimalToUint64 ( // to the range defined by UINTN, then ASSERT(). // ASSERT ((Result < QUIENT_MAX_UINT64_DIVIDED_BY_10) || - ((Result == QUIENT_MAX_UINT64_DIVIDED_BY_10) && + ((QUIENT_MAX_UINT64_DIVIDED_BY_10 == Result) && (*String - '0') <= REMINDER_MAX_UINT64_DIVIDED_BY_10) ); @@ -1819,19 +1819,19 @@ AsciiStrHexToUintn ( // // Ignore the pad spaces (space or tab) // - while ((*String == ' ') || (*String == '\t')) { + while ((' ' == *String) || ('\t' == *String)) { String++; } // // Ignore leading Zeros after the spaces // - while (*String == '0') { + while ('0' == *String) { String++; } if (AsciiToUpper (*String) == 'X') { - ASSERT (*(String - 1) == '0'); + ASSERT ('0' == *(String - 1)); if (*(String - 1) != '0') { return 0; } @@ -1849,7 +1849,7 @@ AsciiStrHexToUintn ( // to the range defined by UINTN, then ASSERT(). // ASSERT ((Result < QUIENT_MAX_UINTN_DIVIDED_BY_16) || - ((Result == QUIENT_MAX_UINTN_DIVIDED_BY_16) && + ((QUIENT_MAX_UINTN_DIVIDED_BY_16 == Result) && (InternalAsciiHexCharToUintn (*String) <= REMINDER_MAX_UINTN_DIVIDED_BY_16)) ); @@ -1914,19 +1914,19 @@ AsciiStrHexToUint64 ( // // Ignore the pad spaces (space or tab) // - while ((*String == ' ') || (*String == '\t')) { + while ((' ' == *String) || ('\t' == *String)) { String++; } // // Ignore leading Zeros after the spaces // - while (*String == '0') { + while ('0' == *String) { String++; } if (AsciiToUpper (*String) == 'X') { - ASSERT (*(String - 1) == '0'); + ASSERT ('0' == *(String - 1)); if (*(String - 1) != '0') { return 0; } @@ -1944,7 +1944,7 @@ AsciiStrHexToUint64 ( // to the range defined by UINTN, then ASSERT(). // ASSERT ((Result < QUIENT_MAX_UINT64_DIVIDED_BY_16) || - ((Result == QUIENT_MAX_UINT64_DIVIDED_BY_16) && + ((QUIENT_MAX_UINT64_DIVIDED_BY_16 == Result) && (InternalAsciiHexCharToUintn (*String) <= REMINDER_MAX_UINT64_DIVIDED_BY_16)) ); diff --git a/MdePkg/Library/BaseLib/Synchronization.c b/MdePkg/Library/BaseLib/Synchronization.c index f1565db3fd..8e8a2bf7e1 100644 --- a/MdePkg/Library/BaseLib/Synchronization.c +++ b/MdePkg/Library/BaseLib/Synchronization.c @@ -44,7 +44,6 @@ GetSpinLockProperties ( VOID ) { - // @bug May use a PCD entry to determine this alignment. return 32; } @@ -61,7 +60,7 @@ GetSpinLockProperties ( @param SpinLock A pointer to the spin lock to initialize to the released state. - @return SpinLock + @return SpinLock initialized in release state. **/ SPIN_LOCK * @@ -92,7 +91,7 @@ InitializeSpinLock ( @param SpinLock A pointer to the spin lock to place in the acquired state. - @return SpinLock + @return SpinLock aquired lock. **/ SPIN_LOCK * @@ -190,7 +189,7 @@ AcquireSpinLockOrFail ( ASSERT (SpinLock != NULL); LockValue = *SpinLock; - ASSERT (LockValue == SPIN_LOCK_ACQUIRED || LockValue == SPIN_LOCK_RELEASED); + ASSERT (SPIN_LOCK_ACQUIRED == LockValue || SPIN_LOCK_RELEASED == LockValue); return (BOOLEAN)( InterlockedCompareExchangePointer ( @@ -226,7 +225,7 @@ ReleaseSpinLock ( ASSERT (SpinLock != NULL); LockValue = *SpinLock; - ASSERT (LockValue == SPIN_LOCK_ACQUIRED || LockValue == SPIN_LOCK_RELEASED); + ASSERT (SPIN_LOCK_ACQUIRED == LockValue || SPIN_LOCK_RELEASED == LockValue); *SpinLock = SPIN_LOCK_RELEASED; return SpinLock; @@ -358,6 +357,8 @@ InterlockedCompareExchange64 ( operation. @param CompareValue Pointer value used in compare operation. @param ExchangeValue Pointer value used in exchange operation. + + @return The original *Value before exchange. **/ VOID * diff --git a/MdePkg/Library/BaseLib/SynchronizationGcc.c b/MdePkg/Library/BaseLib/SynchronizationGcc.c index 4c30dbc4b1..67a8f17be3 100644 --- a/MdePkg/Library/BaseLib/SynchronizationGcc.c +++ b/MdePkg/Library/BaseLib/SynchronizationGcc.c @@ -49,7 +49,6 @@ GetSpinLockProperties ( VOID ) { - // @bug May use a PCD entry to determine this alignment. return 32; } @@ -66,7 +65,7 @@ GetSpinLockProperties ( @param SpinLock A pointer to the spin lock to initialize to the released state. - @return SpinLock + @return SpinLock in release state. **/ SPIN_LOCK * @@ -101,7 +100,7 @@ InitializeSpinLock ( @param SpinLock A pointer to the spin lock to place in the acquired state. - @return SpinLock + @return SpinLock accquired lock. **/ SPIN_LOCK * @@ -224,7 +223,7 @@ AcquireSpinLockOrFail ( @param SpinLock A pointer to the spin lock to release. - @return SpinLock + @return SpinLock released lock. **/ SPIN_LOCK * @@ -374,6 +373,7 @@ InterlockedCompareExchange64 ( @param CompareValue Pointer value used in compare operation. @param ExchangeValue Pointer value used in exchange operation. + @return The original *Value before exchange. **/ VOID * EFIAPI diff --git a/MdePkg/Library/BaseLib/SynchronizationMsc.c b/MdePkg/Library/BaseLib/SynchronizationMsc.c index 0bc60259b1..a4fc399387 100644 --- a/MdePkg/Library/BaseLib/SynchronizationMsc.c +++ b/MdePkg/Library/BaseLib/SynchronizationMsc.c @@ -51,7 +51,6 @@ GetSpinLockProperties ( VOID ) { - // @bug May use a PCD entry to determine this alignment. return 32; } @@ -68,7 +67,7 @@ GetSpinLockProperties ( @param SpinLock A pointer to the spin lock to initialize to the released state. - @return SpinLock + @return SpinLock in released state. **/ SPIN_LOCK * @@ -103,7 +102,7 @@ InitializeSpinLock ( @param SpinLock A pointer to the spin lock to place in the acquired state. - @return SpinLock + @return SpinLock aquiring lock. **/ SPIN_LOCK * @@ -226,7 +225,7 @@ AcquireSpinLockOrFail ( @param SpinLock A pointer to the spin lock to release. - @return SpinLock + @return SpinLock releasing lock. **/ SPIN_LOCK * @@ -375,6 +374,8 @@ InterlockedCompareExchange64 ( operation. @param CompareValue Pointer value used in compare operation. @param ExchangeValue Pointer value used in exchange operation. + + @return The original *Value before exchange. **/ VOID * diff --git a/MdePkg/Library/BaseLib/Unaligned.c b/MdePkg/Library/BaseLib/Unaligned.c index e7b19e4dee..49518c0287 100644 --- a/MdePkg/Library/BaseLib/Unaligned.c +++ b/MdePkg/Library/BaseLib/Unaligned.c @@ -28,7 +28,7 @@ @param Buffer Pointer to a 16-bit value that may be unaligned. - @return *Uint16 + @return Data read from Buffer. **/ UINT16 @@ -54,7 +54,7 @@ ReadUnaligned16 ( @param Buffer Pointer to a 16-bit value that may be unaligned. @param Value 16-bit value to write to Buffer. - @return Value + @return Value written to Buffer **/ UINT16 @@ -79,7 +79,7 @@ WriteUnaligned16 ( @param Buffer Pointer to a 24-bit value that may be unaligned. - @return The value read. + @return The value read from Buffer. **/ UINT32 @@ -105,7 +105,7 @@ ReadUnaligned24 ( @param Buffer Pointer to a 24-bit value that may be unaligned. @param Value 24-bit value to write to Buffer. - @return The value written. + @return The value written to Buffer. **/ UINT32 @@ -131,7 +131,7 @@ WriteUnaligned24 ( @param Buffer Pointer to a 32-bit value that may be unaligned. - @return *Uint32 + @return Data read from Buffer. **/ UINT32 @@ -157,7 +157,7 @@ ReadUnaligned32 ( @param Buffer Pointer to a 32-bit value that may be unaligned. @param Value 32-bit value to write to Buffer. - @return Value + @return Value written to Buffer **/ UINT32 @@ -182,7 +182,7 @@ WriteUnaligned32 ( @param Buffer Pointer to a 64-bit value that may be unaligned. - @return *Uint64 + @return Data read from Buffer. **/ UINT64 @@ -208,7 +208,7 @@ ReadUnaligned64 ( @param Buffer Pointer to a 64-bit value that may be unaligned. @param Value 64-bit value to write to Buffer. - @return Value + @return Value written to Buffer. **/ UINT64 diff --git a/MdePkg/Library/BaseLib/x86FxRestore.c b/MdePkg/Library/BaseLib/x86FxRestore.c index 3da5ae202c..40410ecbbd 100644 --- a/MdePkg/Library/BaseLib/x86FxRestore.c +++ b/MdePkg/Library/BaseLib/x86FxRestore.c @@ -40,12 +40,12 @@ AsmFxRestore ( ) { ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & 0xf) == 0); + ASSERT (0 == ((UINTN)Buffer & 0xf)); // // Check the flag recorded by AsmFxSave() // - ASSERT (*(UINT32 *) (&Buffer[sizeof (IA32_FX_BUFFER) - 4]) == 0xAA5555AA); + ASSERT (0xAA5555AA == *(UINT32 *) (&Buffer[sizeof (IA32_FX_BUFFER) - 4])); InternalX86FxRestore (Buffer); } diff --git a/MdePkg/Library/BaseLib/x86FxSave.c b/MdePkg/Library/BaseLib/x86FxSave.c index 2f44c55543..6b8173d724 100644 --- a/MdePkg/Library/BaseLib/x86FxSave.c +++ b/MdePkg/Library/BaseLib/x86FxSave.c @@ -39,7 +39,7 @@ AsmFxSave ( ) { ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & 0xf) == 0); + ASSERT (0 == ((UINTN)Buffer & 0xf)); InternalX86FxSave (Buffer); diff --git a/MdePkg/Library/BaseLib/x86GetInterruptState.c b/MdePkg/Library/BaseLib/x86GetInterruptState.c index 613d012f85..6898b8db51 100644 --- a/MdePkg/Library/BaseLib/x86GetInterruptState.c +++ b/MdePkg/Library/BaseLib/x86GetInterruptState.c @@ -37,7 +37,7 @@ GetInterruptState ( IA32_EFLAGS32 EFlags; EFlags.UintN = AsmReadEflags (); - return (BOOLEAN)(EFlags.Bits.IF == 1); + return (BOOLEAN)(1 == EFlags.Bits.IF); } diff --git a/MdePkg/Library/BaseMemoryLib/CompareMemWrapper.c b/MdePkg/Library/BaseMemoryLib/CompareMemWrapper.c index ccd38e1aef..031b7fcec6 100644 --- a/MdePkg/Library/BaseMemoryLib/CompareMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLib/CompareMemWrapper.c @@ -58,7 +58,7 @@ CompareMem ( IN UINTN Length ) { - if (Length == 0) { + if (0 == Length) { return 0; } ASSERT (DestinationBuffer != NULL); diff --git a/MdePkg/Library/BaseMemoryLib/CopyMemWrapper.c b/MdePkg/Library/BaseMemoryLib/CopyMemWrapper.c index f957c8c850..09c18255aa 100644 --- a/MdePkg/Library/BaseMemoryLib/CopyMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLib/CopyMemWrapper.c @@ -52,7 +52,7 @@ CopyMem ( IN UINTN Length ) { - if (Length == 0) { + if (0 == Length) { return DestinationBuffer; } ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer)); diff --git a/MdePkg/Library/BaseMemoryLib/ScanMem16Wrapper.c b/MdePkg/Library/BaseMemoryLib/ScanMem16Wrapper.c index 1908788e7e..e45202d950 100644 --- a/MdePkg/Library/BaseMemoryLib/ScanMem16Wrapper.c +++ b/MdePkg/Library/BaseMemoryLib/ScanMem16Wrapper.c @@ -56,14 +56,14 @@ ScanMem16 ( IN UINT16 Value ) { - if (Length == 0) { + if (0 == Length) { return NULL; } ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); + ASSERT (0 == ((UINTN)Buffer & (sizeof (Value) - 1))); ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); + ASSERT (0 == (Length & (sizeof (Value) - 1))); return (VOID*)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value); } diff --git a/MdePkg/Library/BaseMemoryLib/ScanMem32Wrapper.c b/MdePkg/Library/BaseMemoryLib/ScanMem32Wrapper.c index 896d60c208..a4a16372e6 100644 --- a/MdePkg/Library/BaseMemoryLib/ScanMem32Wrapper.c +++ b/MdePkg/Library/BaseMemoryLib/ScanMem32Wrapper.c @@ -56,14 +56,14 @@ ScanMem32 ( IN UINT32 Value ) { - if (Length == 0) { + if (0 == Length) { return NULL; } ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); + ASSERT (0 == ((UINTN)Buffer & (sizeof (Value) - 1))); ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); + ASSERT (0 == (Length & (sizeof (Value) - 1))); return (VOID*)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value); } diff --git a/MdePkg/Library/BaseMemoryLib/ScanMem64Wrapper.c b/MdePkg/Library/BaseMemoryLib/ScanMem64Wrapper.c index c9cc20316c..b182243648 100644 --- a/MdePkg/Library/BaseMemoryLib/ScanMem64Wrapper.c +++ b/MdePkg/Library/BaseMemoryLib/ScanMem64Wrapper.c @@ -56,14 +56,14 @@ ScanMem64 ( IN UINT64 Value ) { - if (Length == 0) { + if (0 == Length) { return NULL; } ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); + ASSERT (0 == ((UINTN)Buffer & (sizeof (Value) - 1))); ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); + ASSERT (0 == (Length & (sizeof (Value) - 1))); return (VOID*)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value); } diff --git a/MdePkg/Library/BaseMemoryLib/ScanMem8Wrapper.c b/MdePkg/Library/BaseMemoryLib/ScanMem8Wrapper.c index 615a0b6171..8164e2a181 100644 --- a/MdePkg/Library/BaseMemoryLib/ScanMem8Wrapper.c +++ b/MdePkg/Library/BaseMemoryLib/ScanMem8Wrapper.c @@ -54,7 +54,7 @@ ScanMem8 ( IN UINT8 Value ) { - if (Length == 0) { + if (0 == Length) { return NULL; } ASSERT (Buffer != NULL); diff --git a/MdePkg/Library/BaseMemoryLib/SetMem16Wrapper.c b/MdePkg/Library/BaseMemoryLib/SetMem16Wrapper.c index 36ec277ada..9877d2f0c5 100644 --- a/MdePkg/Library/BaseMemoryLib/SetMem16Wrapper.c +++ b/MdePkg/Library/BaseMemoryLib/SetMem16Wrapper.c @@ -55,14 +55,14 @@ SetMem16 ( IN UINT16 Value ) { - if (Length == 0) { + if (0 == Length) { return Buffer; } ASSERT (Buffer != NULL); ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); + ASSERT (0 == (((UINTN)Buffer) & (sizeof (Value) - 1))); + ASSERT (0 == (Length & (sizeof (Value) - 1))); return InternalMemSetMem16 (Buffer, Length / sizeof (Value), Value); } diff --git a/MdePkg/Library/BaseMemoryLib/SetMem32Wrapper.c b/MdePkg/Library/BaseMemoryLib/SetMem32Wrapper.c index e42a3a92a6..ed63a01497 100644 --- a/MdePkg/Library/BaseMemoryLib/SetMem32Wrapper.c +++ b/MdePkg/Library/BaseMemoryLib/SetMem32Wrapper.c @@ -55,14 +55,14 @@ SetMem32 ( IN UINT32 Value ) { - if (Length == 0) { + if (0 == Length) { return Buffer; } ASSERT (Buffer != NULL); ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); + ASSERT (0 == (((UINTN)Buffer) & (sizeof (Value) - 1))); + ASSERT (0 == (Length & (sizeof (Value) - 1))); return InternalMemSetMem32 (Buffer, Length / sizeof (Value), Value); } diff --git a/MdePkg/Library/BaseMemoryLib/SetMem64Wrapper.c b/MdePkg/Library/BaseMemoryLib/SetMem64Wrapper.c index 4ddbc689f1..4e3fc75852 100644 --- a/MdePkg/Library/BaseMemoryLib/SetMem64Wrapper.c +++ b/MdePkg/Library/BaseMemoryLib/SetMem64Wrapper.c @@ -55,14 +55,14 @@ SetMem64 ( IN UINT64 Value ) { - if (Length == 0) { + if (0 == Length) { return Buffer; } ASSERT (Buffer != NULL); ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); + ASSERT (0 == (((UINTN)Buffer) & (sizeof (Value) - 1))); + ASSERT (0 == (Length & (sizeof (Value) - 1))); return InternalMemSetMem64 (Buffer, Length / sizeof (Value), Value); } diff --git a/MdePkg/Library/BaseMemoryLib/SetMemWrapper.c b/MdePkg/Library/BaseMemoryLib/SetMemWrapper.c index 609eab6db4..0e3428cd7a 100644 --- a/MdePkg/Library/BaseMemoryLib/SetMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLib/SetMemWrapper.c @@ -49,7 +49,7 @@ SetMem ( IN UINT8 Value ) { - if (Length == 0) { + if (0 == Length) { return Buffer; } diff --git a/MdePkg/Library/BaseMemoryLibMmx/CompareMemWrapper.c b/MdePkg/Library/BaseMemoryLibMmx/CompareMemWrapper.c index 4c0d3eaadb..1886da59df 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/CompareMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLibMmx/CompareMemWrapper.c @@ -55,7 +55,7 @@ CompareMem ( IN UINTN Length ) { - if (Length == 0) { + if (0 == Length) { return 0; } ASSERT (DestinationBuffer != NULL); diff --git a/MdePkg/Library/BaseMemoryLibMmx/CopyMemWrapper.c b/MdePkg/Library/BaseMemoryLibMmx/CopyMemWrapper.c index 9e620e2200..1cee34801a 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/CopyMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLibMmx/CopyMemWrapper.c @@ -49,7 +49,7 @@ CopyMem ( IN UINTN Length ) { - if (Length == 0) { + if (0 == Length) { return DestinationBuffer; } ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer)); diff --git a/MdePkg/Library/BaseMemoryLibMmx/MemLibInternals.h b/MdePkg/Library/BaseMemoryLibMmx/MemLibInternals.h index da7c7370d0..e8d72dd04c 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/MemLibInternals.h +++ b/MdePkg/Library/BaseMemoryLibMmx/MemLibInternals.h @@ -26,6 +26,7 @@ #ifndef __MEM_LIB_INTERNALS__ #define __MEM_LIB_INTERNALS__ +#include #include #include #include @@ -52,7 +53,7 @@ InternalMemCopyMem ( Set Buffer to Value for Size bytes. @param Buffer Memory to set. - @param Size Number of bytes to set + @param Length Number of bytes to set @param Value Value of the set operation. @return Buffer @@ -124,7 +125,7 @@ InternalMemSetMem64 ( Set Buffer to 0 for Size bytes. @param Buffer Memory to set. - @param Size Number of bytes to set + @param Length Number of bytes to set @return Buffer diff --git a/MdePkg/Library/BaseMemoryLibMmx/ScanMem16Wrapper.c b/MdePkg/Library/BaseMemoryLibMmx/ScanMem16Wrapper.c index 95f134bbda..d746c8fc60 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/ScanMem16Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibMmx/ScanMem16Wrapper.c @@ -53,7 +53,7 @@ ScanMem16 ( IN UINT16 Value ) { - if (Length == 0) { + if (0 == Length) { return NULL; } diff --git a/MdePkg/Library/BaseMemoryLibMmx/ScanMem32Wrapper.c b/MdePkg/Library/BaseMemoryLibMmx/ScanMem32Wrapper.c index 6a3dcd7ad2..d6681deecf 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/ScanMem32Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibMmx/ScanMem32Wrapper.c @@ -53,7 +53,7 @@ ScanMem32 ( IN UINT32 Value ) { - if (Length == 0) { + if (0 == Length) { return NULL; } diff --git a/MdePkg/Library/BaseMemoryLibMmx/ScanMem64Wrapper.c b/MdePkg/Library/BaseMemoryLibMmx/ScanMem64Wrapper.c index b355fe647c..6d8d8c9d95 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/ScanMem64Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibMmx/ScanMem64Wrapper.c @@ -53,7 +53,7 @@ ScanMem64 ( IN UINT64 Value ) { - if (Length == 0) { + if (0 == Length) { return NULL; } diff --git a/MdePkg/Library/BaseMemoryLibMmx/ScanMem8Wrapper.c b/MdePkg/Library/BaseMemoryLibMmx/ScanMem8Wrapper.c index 2b21b22166..ce4eed606a 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/ScanMem8Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibMmx/ScanMem8Wrapper.c @@ -51,7 +51,7 @@ ScanMem8 ( IN UINT8 Value ) { - if (Length == 0) { + if (0 == Length) { return NULL; } ASSERT (Buffer != NULL); diff --git a/MdePkg/Library/BaseMemoryLibMmx/SetMem16Wrapper.c b/MdePkg/Library/BaseMemoryLibMmx/SetMem16Wrapper.c index 889339c953..1596328a58 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/SetMem16Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibMmx/SetMem16Wrapper.c @@ -52,7 +52,7 @@ SetMem16 ( IN UINT16 Value ) { - if (Length == 0) { + if (0 == Length) { return Buffer; } diff --git a/MdePkg/Library/BaseMemoryLibMmx/SetMem32Wrapper.c b/MdePkg/Library/BaseMemoryLibMmx/SetMem32Wrapper.c index 15f8205ebc..2524917479 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/SetMem32Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibMmx/SetMem32Wrapper.c @@ -52,7 +52,7 @@ SetMem32 ( IN UINT32 Value ) { - if (Length == 0) { + if (0 == Length) { return Buffer; } diff --git a/MdePkg/Library/BaseMemoryLibMmx/SetMem64Wrapper.c b/MdePkg/Library/BaseMemoryLibMmx/SetMem64Wrapper.c index 981a7d4731..0cfcb9fa4b 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/SetMem64Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibMmx/SetMem64Wrapper.c @@ -52,7 +52,7 @@ SetMem64 ( IN UINT64 Value ) { - if (Length == 0) { + if (0 == Length) { return Buffer; } diff --git a/MdePkg/Library/BaseMemoryLibMmx/SetMemWrapper.c b/MdePkg/Library/BaseMemoryLibMmx/SetMemWrapper.c index e74ce8d65b..1c1a289b53 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/SetMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLibMmx/SetMemWrapper.c @@ -46,7 +46,7 @@ SetMem ( IN UINT8 Value ) { - if (Length == 0) { + if (0 == Length) { return Buffer; } diff --git a/MdePkg/Library/BaseMemoryLibMmx/ZeroMemWrapper.c b/MdePkg/Library/BaseMemoryLibMmx/ZeroMemWrapper.c index 90e607c0ce..00205b1908 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/ZeroMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLibMmx/ZeroMemWrapper.c @@ -45,7 +45,7 @@ ZeroMem ( IN UINTN Length ) { - ASSERT (!(Buffer == NULL && Length > 0)); + ASSERT (!(NULL == Buffer && Length > 0)); ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1)); return InternalMemZeroMem (Buffer, Length); } diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/CompareMemWrapper.c b/MdePkg/Library/BaseMemoryLibOptDxe/CompareMemWrapper.c index ccd38e1aef..031b7fcec6 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/CompareMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLibOptDxe/CompareMemWrapper.c @@ -58,7 +58,7 @@ CompareMem ( IN UINTN Length ) { - if (Length == 0) { + if (0 == Length) { return 0; } ASSERT (DestinationBuffer != NULL); diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/CopyMemWrapper.c b/MdePkg/Library/BaseMemoryLibOptDxe/CopyMemWrapper.c index f957c8c850..09c18255aa 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/CopyMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLibOptDxe/CopyMemWrapper.c @@ -52,7 +52,7 @@ CopyMem ( IN UINTN Length ) { - if (Length == 0) { + if (0 == Length) { return DestinationBuffer; } ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer)); diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem16Wrapper.c b/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem16Wrapper.c index 1908788e7e..54abe1c356 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem16Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem16Wrapper.c @@ -56,7 +56,7 @@ ScanMem16 ( IN UINT16 Value ) { - if (Length == 0) { + if (0 == Length) { return NULL; } diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem32Wrapper.c b/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem32Wrapper.c index 896d60c208..b91a38b973 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem32Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem32Wrapper.c @@ -56,7 +56,7 @@ ScanMem32 ( IN UINT32 Value ) { - if (Length == 0) { + if (0 == Length) { return NULL; } diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem64Wrapper.c b/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem64Wrapper.c index c9cc20316c..f47d700c9b 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem64Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem64Wrapper.c @@ -56,7 +56,7 @@ ScanMem64 ( IN UINT64 Value ) { - if (Length == 0) { + if (0 == Length) { return NULL; } diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem8Wrapper.c b/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem8Wrapper.c index 615a0b6171..8164e2a181 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem8Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem8Wrapper.c @@ -54,7 +54,7 @@ ScanMem8 ( IN UINT8 Value ) { - if (Length == 0) { + if (0 == Length) { return NULL; } ASSERT (Buffer != NULL); diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/SetMem16Wrapper.c b/MdePkg/Library/BaseMemoryLibOptDxe/SetMem16Wrapper.c index 36ec277ada..0a9936bb9a 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/SetMem16Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibOptDxe/SetMem16Wrapper.c @@ -55,7 +55,7 @@ SetMem16 ( IN UINT16 Value ) { - if (Length == 0) { + if (0 == Length) { return Buffer; } diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/SetMem32Wrapper.c b/MdePkg/Library/BaseMemoryLibOptDxe/SetMem32Wrapper.c index e42a3a92a6..d0015a3992 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/SetMem32Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibOptDxe/SetMem32Wrapper.c @@ -55,7 +55,7 @@ SetMem32 ( IN UINT32 Value ) { - if (Length == 0) { + if (0 == Length) { return Buffer; } diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/SetMem64Wrapper.c b/MdePkg/Library/BaseMemoryLibOptDxe/SetMem64Wrapper.c index 4ddbc689f1..408c074624 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/SetMem64Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibOptDxe/SetMem64Wrapper.c @@ -55,7 +55,7 @@ SetMem64 ( IN UINT64 Value ) { - if (Length == 0) { + if (0 == Length) { return Buffer; } diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/SetMemWrapper.c b/MdePkg/Library/BaseMemoryLibOptDxe/SetMemWrapper.c index 609eab6db4..0e3428cd7a 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/SetMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLibOptDxe/SetMemWrapper.c @@ -49,7 +49,7 @@ SetMem ( IN UINT8 Value ) { - if (Length == 0) { + if (0 == Length) { return Buffer; } diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/ZeroMemWrapper.c b/MdePkg/Library/BaseMemoryLibOptDxe/ZeroMemWrapper.c index 87565f1c9a..e27851b077 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/ZeroMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLibOptDxe/ZeroMemWrapper.c @@ -48,7 +48,7 @@ ZeroMem ( IN UINTN Length ) { - ASSERT (!(Buffer == NULL && Length > 0)); + ASSERT (!(NULL == Buffer && Length > 0)); ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1)); return InternalMemZeroMem (Buffer, Length); } diff --git a/MdePkg/Library/BaseMemoryLibOptPei/CompareMemWrapper.c b/MdePkg/Library/BaseMemoryLibOptPei/CompareMemWrapper.c index ccd38e1aef..031b7fcec6 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/CompareMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLibOptPei/CompareMemWrapper.c @@ -58,7 +58,7 @@ CompareMem ( IN UINTN Length ) { - if (Length == 0) { + if (0 == Length) { return 0; } ASSERT (DestinationBuffer != NULL); diff --git a/MdePkg/Library/BaseMemoryLibOptPei/CopyMemWrapper.c b/MdePkg/Library/BaseMemoryLibOptPei/CopyMemWrapper.c index f957c8c850..09c18255aa 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/CopyMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLibOptPei/CopyMemWrapper.c @@ -52,7 +52,7 @@ CopyMem ( IN UINTN Length ) { - if (Length == 0) { + if (0 == Length) { return DestinationBuffer; } ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer)); diff --git a/MdePkg/Library/BaseMemoryLibOptPei/MemLibGuid.c b/MdePkg/Library/BaseMemoryLibOptPei/MemLibGuid.c index 9825b9f792..cbbad2cb5d 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/MemLibGuid.c +++ b/MdePkg/Library/BaseMemoryLibOptPei/MemLibGuid.c @@ -24,7 +24,7 @@ // // Include common header file for this module. // -#include +#include "MemLibInternals.h" /** diff --git a/MdePkg/Library/BaseMemoryLibOptPei/MemLibInternals.h b/MdePkg/Library/BaseMemoryLibOptPei/MemLibInternals.h index ceddbbe7a0..ce55f447c0 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/MemLibInternals.h +++ b/MdePkg/Library/BaseMemoryLibOptPei/MemLibInternals.h @@ -51,7 +51,7 @@ InternalMemCopyMem ( Set Buffer to Value for Size bytes. @param Buffer Memory to set. - @param Size Number of bytes to set + @param Length Number of bytes to set @param Value Value of the set operation. @return Buffer @@ -123,7 +123,7 @@ InternalMemSetMem64 ( Set Buffer to 0 for Size bytes. @param Buffer Memory to set. - @param Size Number of bytes to set + @param Length Number of bytes to set @return Buffer diff --git a/MdePkg/Library/BaseMemoryLibOptPei/ScanMem16Wrapper.c b/MdePkg/Library/BaseMemoryLibOptPei/ScanMem16Wrapper.c index 1908788e7e..54abe1c356 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/ScanMem16Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibOptPei/ScanMem16Wrapper.c @@ -56,7 +56,7 @@ ScanMem16 ( IN UINT16 Value ) { - if (Length == 0) { + if (0 == Length) { return NULL; } diff --git a/MdePkg/Library/BaseMemoryLibOptPei/ScanMem32Wrapper.c b/MdePkg/Library/BaseMemoryLibOptPei/ScanMem32Wrapper.c index 896d60c208..b91a38b973 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/ScanMem32Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibOptPei/ScanMem32Wrapper.c @@ -56,7 +56,7 @@ ScanMem32 ( IN UINT32 Value ) { - if (Length == 0) { + if (0 == Length) { return NULL; } diff --git a/MdePkg/Library/BaseMemoryLibOptPei/ScanMem64Wrapper.c b/MdePkg/Library/BaseMemoryLibOptPei/ScanMem64Wrapper.c index c9cc20316c..f47d700c9b 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/ScanMem64Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibOptPei/ScanMem64Wrapper.c @@ -56,7 +56,7 @@ ScanMem64 ( IN UINT64 Value ) { - if (Length == 0) { + if (0 == Length) { return NULL; } diff --git a/MdePkg/Library/BaseMemoryLibOptPei/ScanMem8Wrapper.c b/MdePkg/Library/BaseMemoryLibOptPei/ScanMem8Wrapper.c index 615a0b6171..8164e2a181 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/ScanMem8Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibOptPei/ScanMem8Wrapper.c @@ -54,7 +54,7 @@ ScanMem8 ( IN UINT8 Value ) { - if (Length == 0) { + if (0 == Length) { return NULL; } ASSERT (Buffer != NULL); diff --git a/MdePkg/Library/BaseMemoryLibOptPei/SetMem16Wrapper.c b/MdePkg/Library/BaseMemoryLibOptPei/SetMem16Wrapper.c index 36ec277ada..0a9936bb9a 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/SetMem16Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibOptPei/SetMem16Wrapper.c @@ -55,7 +55,7 @@ SetMem16 ( IN UINT16 Value ) { - if (Length == 0) { + if (0 == Length) { return Buffer; } diff --git a/MdePkg/Library/BaseMemoryLibOptPei/SetMem32Wrapper.c b/MdePkg/Library/BaseMemoryLibOptPei/SetMem32Wrapper.c index e42a3a92a6..d0015a3992 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/SetMem32Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibOptPei/SetMem32Wrapper.c @@ -55,7 +55,7 @@ SetMem32 ( IN UINT32 Value ) { - if (Length == 0) { + if (0 == Length) { return Buffer; } diff --git a/MdePkg/Library/BaseMemoryLibOptPei/SetMem64Wrapper.c b/MdePkg/Library/BaseMemoryLibOptPei/SetMem64Wrapper.c index 4ddbc689f1..408c074624 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/SetMem64Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibOptPei/SetMem64Wrapper.c @@ -55,7 +55,7 @@ SetMem64 ( IN UINT64 Value ) { - if (Length == 0) { + if (0 == Length) { return Buffer; } diff --git a/MdePkg/Library/BaseMemoryLibOptPei/SetMemWrapper.c b/MdePkg/Library/BaseMemoryLibOptPei/SetMemWrapper.c index 609eab6db4..0e3428cd7a 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/SetMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLibOptPei/SetMemWrapper.c @@ -49,7 +49,7 @@ SetMem ( IN UINT8 Value ) { - if (Length == 0) { + if (0 == Length) { return Buffer; } diff --git a/MdePkg/Library/BaseMemoryLibOptPei/ZeroMemWrapper.c b/MdePkg/Library/BaseMemoryLibOptPei/ZeroMemWrapper.c index 87565f1c9a..e27851b077 100644 --- a/MdePkg/Library/BaseMemoryLibOptPei/ZeroMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLibOptPei/ZeroMemWrapper.c @@ -48,7 +48,7 @@ ZeroMem ( IN UINTN Length ) { - ASSERT (!(Buffer == NULL && Length > 0)); + ASSERT (!(NULL == Buffer && Length > 0)); ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1)); return InternalMemZeroMem (Buffer, Length); } diff --git a/MdePkg/Library/BaseMemoryLibRepStr/CompareMemWrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/CompareMemWrapper.c index ccd38e1aef..031b7fcec6 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/CompareMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLibRepStr/CompareMemWrapper.c @@ -58,7 +58,7 @@ CompareMem ( IN UINTN Length ) { - if (Length == 0) { + if (0 == Length) { return 0; } ASSERT (DestinationBuffer != NULL); diff --git a/MdePkg/Library/BaseMemoryLibRepStr/CopyMemWrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/CopyMemWrapper.c index f957c8c850..09c18255aa 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/CopyMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLibRepStr/CopyMemWrapper.c @@ -52,7 +52,7 @@ CopyMem ( IN UINTN Length ) { - if (Length == 0) { + if (0 == Length) { return DestinationBuffer; } ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer)); diff --git a/MdePkg/Library/BaseMemoryLibRepStr/MemLibInternals.h b/MdePkg/Library/BaseMemoryLibRepStr/MemLibInternals.h index ceddbbe7a0..ce55f447c0 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/MemLibInternals.h +++ b/MdePkg/Library/BaseMemoryLibRepStr/MemLibInternals.h @@ -51,7 +51,7 @@ InternalMemCopyMem ( Set Buffer to Value for Size bytes. @param Buffer Memory to set. - @param Size Number of bytes to set + @param Length Number of bytes to set @param Value Value of the set operation. @return Buffer @@ -123,7 +123,7 @@ InternalMemSetMem64 ( Set Buffer to 0 for Size bytes. @param Buffer Memory to set. - @param Size Number of bytes to set + @param Length Number of bytes to set @return Buffer diff --git a/MdePkg/Library/BaseMemoryLibRepStr/ScanMem16Wrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/ScanMem16Wrapper.c index 1908788e7e..54abe1c356 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/ScanMem16Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibRepStr/ScanMem16Wrapper.c @@ -56,7 +56,7 @@ ScanMem16 ( IN UINT16 Value ) { - if (Length == 0) { + if (0 == Length) { return NULL; } diff --git a/MdePkg/Library/BaseMemoryLibRepStr/ScanMem32Wrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/ScanMem32Wrapper.c index 896d60c208..b91a38b973 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/ScanMem32Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibRepStr/ScanMem32Wrapper.c @@ -56,7 +56,7 @@ ScanMem32 ( IN UINT32 Value ) { - if (Length == 0) { + if (0 == Length) { return NULL; } diff --git a/MdePkg/Library/BaseMemoryLibRepStr/ScanMem64Wrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/ScanMem64Wrapper.c index c9cc20316c..f47d700c9b 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/ScanMem64Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibRepStr/ScanMem64Wrapper.c @@ -56,7 +56,7 @@ ScanMem64 ( IN UINT64 Value ) { - if (Length == 0) { + if (0 == Length) { return NULL; } diff --git a/MdePkg/Library/BaseMemoryLibRepStr/ScanMem8Wrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/ScanMem8Wrapper.c index 615a0b6171..8164e2a181 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/ScanMem8Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibRepStr/ScanMem8Wrapper.c @@ -54,7 +54,7 @@ ScanMem8 ( IN UINT8 Value ) { - if (Length == 0) { + if (0 == Length) { return NULL; } ASSERT (Buffer != NULL); diff --git a/MdePkg/Library/BaseMemoryLibRepStr/SetMem16Wrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/SetMem16Wrapper.c index 36ec277ada..0a9936bb9a 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/SetMem16Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibRepStr/SetMem16Wrapper.c @@ -55,7 +55,7 @@ SetMem16 ( IN UINT16 Value ) { - if (Length == 0) { + if (0 == Length) { return Buffer; } diff --git a/MdePkg/Library/BaseMemoryLibRepStr/SetMem32Wrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/SetMem32Wrapper.c index e42a3a92a6..d0015a3992 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/SetMem32Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibRepStr/SetMem32Wrapper.c @@ -55,7 +55,7 @@ SetMem32 ( IN UINT32 Value ) { - if (Length == 0) { + if (0 == Length) { return Buffer; } diff --git a/MdePkg/Library/BaseMemoryLibRepStr/SetMem64Wrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/SetMem64Wrapper.c index 4ddbc689f1..408c074624 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/SetMem64Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibRepStr/SetMem64Wrapper.c @@ -55,7 +55,7 @@ SetMem64 ( IN UINT64 Value ) { - if (Length == 0) { + if (0 == Length) { return Buffer; } diff --git a/MdePkg/Library/BaseMemoryLibRepStr/SetMemWrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/SetMemWrapper.c index 609eab6db4..0e3428cd7a 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/SetMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLibRepStr/SetMemWrapper.c @@ -49,7 +49,7 @@ SetMem ( IN UINT8 Value ) { - if (Length == 0) { + if (0 == Length) { return Buffer; } diff --git a/MdePkg/Library/BaseMemoryLibRepStr/ZeroMemWrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/ZeroMemWrapper.c index 87565f1c9a..e27851b077 100644 --- a/MdePkg/Library/BaseMemoryLibRepStr/ZeroMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLibRepStr/ZeroMemWrapper.c @@ -48,7 +48,7 @@ ZeroMem ( IN UINTN Length ) { - ASSERT (!(Buffer == NULL && Length > 0)); + ASSERT (!(NULL == Buffer && Length > 0)); ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1)); return InternalMemZeroMem (Buffer, Length); } diff --git a/MdePkg/Library/BaseMemoryLibSse2/CompareMemWrapper.c b/MdePkg/Library/BaseMemoryLibSse2/CompareMemWrapper.c index ccd38e1aef..031b7fcec6 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/CompareMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLibSse2/CompareMemWrapper.c @@ -58,7 +58,7 @@ CompareMem ( IN UINTN Length ) { - if (Length == 0) { + if (0 == Length) { return 0; } ASSERT (DestinationBuffer != NULL); diff --git a/MdePkg/Library/BaseMemoryLibSse2/CopyMemWrapper.c b/MdePkg/Library/BaseMemoryLibSse2/CopyMemWrapper.c index f957c8c850..09c18255aa 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/CopyMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLibSse2/CopyMemWrapper.c @@ -52,7 +52,7 @@ CopyMem ( IN UINTN Length ) { - if (Length == 0) { + if (0 == Length) { return DestinationBuffer; } ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer)); diff --git a/MdePkg/Library/BaseMemoryLibSse2/MemLibGuid.c b/MdePkg/Library/BaseMemoryLibSse2/MemLibGuid.c index c13cd462e4..cf364c1d1f 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/MemLibGuid.c +++ b/MdePkg/Library/BaseMemoryLibSse2/MemLibGuid.c @@ -80,22 +80,17 @@ CompareGuid ( IN CONST GUID *Guid2 ) { - UINT64 Guid1ValueLo; - UINT64 Guid1ValueHi; - UINT64 Guid2ValueLo; - UINT64 Guid2ValueHi; + UINT64 LowPartOfGuid1; + UINT64 LowPartOfGuid2; + UINT64 HighPartOfGuid1; + UINT64 HighPartOfGuid2; - Guid1ValueLo = ReadUnaligned64 ((CONST UINT64*)Guid1); - Guid2ValueLo = ReadUnaligned64 ((CONST UINT64*)Guid2); + LowPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1); + LowPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2); + HighPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1 + 1); + HighPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2 + 1); - Guid1ValueHi = ReadUnaligned64 ((CONST UINT64*)Guid1 + 1); - Guid2ValueHi = ReadUnaligned64 ((CONST UINT64*)Guid2 + 1); - - - return (BOOLEAN) - ((Guid1ValueLo == Guid2ValueLo) && - (Guid1ValueHi == Guid2ValueHi) - ); + return (BOOLEAN) (LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2); } /** diff --git a/MdePkg/Library/BaseMemoryLibSse2/MemLibInternals.h b/MdePkg/Library/BaseMemoryLibSse2/MemLibInternals.h index ceddbbe7a0..ce55f447c0 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/MemLibInternals.h +++ b/MdePkg/Library/BaseMemoryLibSse2/MemLibInternals.h @@ -51,7 +51,7 @@ InternalMemCopyMem ( Set Buffer to Value for Size bytes. @param Buffer Memory to set. - @param Size Number of bytes to set + @param Length Number of bytes to set @param Value Value of the set operation. @return Buffer @@ -123,7 +123,7 @@ InternalMemSetMem64 ( Set Buffer to 0 for Size bytes. @param Buffer Memory to set. - @param Size Number of bytes to set + @param Length Number of bytes to set @return Buffer diff --git a/MdePkg/Library/BaseMemoryLibSse2/ScanMem16Wrapper.c b/MdePkg/Library/BaseMemoryLibSse2/ScanMem16Wrapper.c index 1908788e7e..54abe1c356 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/ScanMem16Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibSse2/ScanMem16Wrapper.c @@ -56,7 +56,7 @@ ScanMem16 ( IN UINT16 Value ) { - if (Length == 0) { + if (0 == Length) { return NULL; } diff --git a/MdePkg/Library/BaseMemoryLibSse2/ScanMem32Wrapper.c b/MdePkg/Library/BaseMemoryLibSse2/ScanMem32Wrapper.c index 896d60c208..b91a38b973 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/ScanMem32Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibSse2/ScanMem32Wrapper.c @@ -56,7 +56,7 @@ ScanMem32 ( IN UINT32 Value ) { - if (Length == 0) { + if (0 == Length) { return NULL; } diff --git a/MdePkg/Library/BaseMemoryLibSse2/ScanMem64Wrapper.c b/MdePkg/Library/BaseMemoryLibSse2/ScanMem64Wrapper.c index c9cc20316c..f47d700c9b 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/ScanMem64Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibSse2/ScanMem64Wrapper.c @@ -56,7 +56,7 @@ ScanMem64 ( IN UINT64 Value ) { - if (Length == 0) { + if (0 == Length) { return NULL; } diff --git a/MdePkg/Library/BaseMemoryLibSse2/ScanMem8Wrapper.c b/MdePkg/Library/BaseMemoryLibSse2/ScanMem8Wrapper.c index 615a0b6171..8164e2a181 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/ScanMem8Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibSse2/ScanMem8Wrapper.c @@ -54,7 +54,7 @@ ScanMem8 ( IN UINT8 Value ) { - if (Length == 0) { + if (0 == Length) { return NULL; } ASSERT (Buffer != NULL); diff --git a/MdePkg/Library/BaseMemoryLibSse2/SetMem16Wrapper.c b/MdePkg/Library/BaseMemoryLibSse2/SetMem16Wrapper.c index 36ec277ada..0a9936bb9a 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/SetMem16Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibSse2/SetMem16Wrapper.c @@ -55,7 +55,7 @@ SetMem16 ( IN UINT16 Value ) { - if (Length == 0) { + if (0 == Length) { return Buffer; } diff --git a/MdePkg/Library/BaseMemoryLibSse2/SetMem32Wrapper.c b/MdePkg/Library/BaseMemoryLibSse2/SetMem32Wrapper.c index e42a3a92a6..d0015a3992 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/SetMem32Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibSse2/SetMem32Wrapper.c @@ -55,7 +55,7 @@ SetMem32 ( IN UINT32 Value ) { - if (Length == 0) { + if (0 == Length) { return Buffer; } diff --git a/MdePkg/Library/BaseMemoryLibSse2/SetMem64Wrapper.c b/MdePkg/Library/BaseMemoryLibSse2/SetMem64Wrapper.c index 4ddbc689f1..408c074624 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/SetMem64Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibSse2/SetMem64Wrapper.c @@ -55,7 +55,7 @@ SetMem64 ( IN UINT64 Value ) { - if (Length == 0) { + if (0 == Length) { return Buffer; } diff --git a/MdePkg/Library/BaseMemoryLibSse2/SetMemWrapper.c b/MdePkg/Library/BaseMemoryLibSse2/SetMemWrapper.c index 609eab6db4..0e3428cd7a 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/SetMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLibSse2/SetMemWrapper.c @@ -49,7 +49,7 @@ SetMem ( IN UINT8 Value ) { - if (Length == 0) { + if (0 == Length) { return Buffer; } diff --git a/MdePkg/Library/BaseMemoryLibSse2/ZeroMemWrapper.c b/MdePkg/Library/BaseMemoryLibSse2/ZeroMemWrapper.c index 87565f1c9a..e27851b077 100644 --- a/MdePkg/Library/BaseMemoryLibSse2/ZeroMemWrapper.c +++ b/MdePkg/Library/BaseMemoryLibSse2/ZeroMemWrapper.c @@ -48,7 +48,7 @@ ZeroMem ( IN UINTN Length ) { - ASSERT (!(Buffer == NULL && Length > 0)); + ASSERT (!(NULL == Buffer && Length > 0)); ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1)); return InternalMemZeroMem (Buffer, Length); } diff --git a/MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c b/MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c index 7ed8f078fc..36370ba4f7 100644 --- a/MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c +++ b/MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c @@ -52,7 +52,7 @@ PeCoffLoaderGetEntryPoint ( ASSERT (EntryPoint != NULL); DosHdr = (EFI_IMAGE_DOS_HEADER *)Pe32Data; - if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) { + if (EFI_IMAGE_DOS_SIGNATURE == DosHdr->e_magic) { // // DOS image header is present, so read the PE header after the DOS image header. // @@ -104,7 +104,7 @@ PeCoffLoaderGetMachineType ( ASSERT (Pe32Data != NULL); DosHdr = (EFI_IMAGE_DOS_HEADER *)Pe32Data; - if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) { + if (EFI_IMAGE_DOS_SIGNATURE == DosHdr->e_magic) { // // DOS image header is present, so read the PE header after the DOS image header. // @@ -116,9 +116,9 @@ PeCoffLoaderGetMachineType ( Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)Pe32Data; } - if (Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) { + if (EFI_TE_IMAGE_HEADER_SIGNATURE == Hdr.Te->Signature) { return Hdr.Te->Machine; - } else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) { + } else if (EFI_IMAGE_NT_SIGNATURE == Hdr.Pe32->Signature) { return Hdr.Pe32->FileHeader.Machine; } @@ -168,7 +168,7 @@ PeCoffLoaderGetPdbPointer ( NumberOfRvaAndSizes = 0; DosHdr = (EFI_IMAGE_DOS_HEADER *)Pe32Data; - if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) { + if (EFI_IMAGE_DOS_SIGNATURE == DosHdr->e_magic) { // // DOS image header is present, so read the PE header after the DOS image header. // @@ -180,7 +180,7 @@ PeCoffLoaderGetPdbPointer ( Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)Pe32Data; } - if (Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) { + if (EFI_TE_IMAGE_HEADER_SIGNATURE == Hdr.Te->Signature) { if (Hdr.Te->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress != 0) { DirectoryEntry = &Hdr.Te->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG]; TEImageAdjust = sizeof (EFI_TE_IMAGE_HEADER) - Hdr.Te->StrippedSize; @@ -188,7 +188,7 @@ PeCoffLoaderGetPdbPointer ( Hdr.Te->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress + TEImageAdjust); } - } else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) { + } else if (EFI_IMAGE_NT_SIGNATURE == Hdr.Pe32->Signature) { // // NOTE: We use Machine field to identify PE32/PE32+, instead of Magic. // It is due to backward-compatibility, for some system might @@ -215,7 +215,7 @@ PeCoffLoaderGetPdbPointer ( Magic = Hdr.Pe32->OptionalHeader.Magic; } - if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) { + if (EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC == Magic) { // // Use PE32 offset get Debug Directory Entry // @@ -239,12 +239,15 @@ PeCoffLoaderGetPdbPointer ( return NULL; } - if (DebugEntry == NULL || DirectoryEntry == NULL) { + if (NULL == DebugEntry || NULL == DirectoryEntry) { return NULL; } + // + // Scan the directory to find the debug entry. + // for (DirCount = 0; DirCount < DirectoryEntry->Size; DirCount += sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY), DebugEntry++) { - if (DebugEntry->Type == EFI_IMAGE_DEBUG_TYPE_CODEVIEW) { + if (EFI_IMAGE_DEBUG_TYPE_CODEVIEW == DebugEntry->Type) { if (DebugEntry->SizeOfData > 0) { CodeViewEntryPointer = (VOID *) ((UINTN) DebugEntry->RVA + ((UINTN)Pe32Data) + (UINTN)TEImageAdjust); switch (* (UINT32 *) CodeViewEntryPointer) { -- 2.39.2