summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library
diff options
context:
space:
mode:
authorMichael Kubacki <michael.kubacki@microsoft.com>2021-12-05 14:54:05 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-12-07 17:24:28 +0000
commit2f88bd3a1296c522317f1c21377876de63de5be7 (patch)
treeba47875489cc5698061275a495983e9dea3be098 /MdePkg/Library
parent1436aea4d5707e672672a11bda72be2c63c936c3 (diff)
downloadedk2-2f88bd3a1296c522317f1c21377876de63de5be7.tar.gz
edk2-2f88bd3a1296c522317f1c21377876de63de5be7.tar.bz2
edk2-2f88bd3a1296c522317f1c21377876de63de5be7.zip
MdePkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the MdePkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Diffstat (limited to 'MdePkg/Library')
-rw-r--r--MdePkg/Library/BaseCacheMaintenanceLib/ArmCache.c32
-rw-r--r--MdePkg/Library/BaseCacheMaintenanceLib/EbcCache.c16
-rw-r--r--MdePkg/Library/BaseCacheMaintenanceLib/RiscVCache.c28
-rw-r--r--MdePkg/Library/BaseCacheMaintenanceLib/X86Cache.c31
-rw-r--r--MdePkg/Library/BaseCacheMaintenanceLibNull/BaseCacheMaintenanceLibNull.c16
-rw-r--r--MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c3
-rw-r--r--MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c1
-rw-r--r--MdePkg/Library/BaseCpuLib/Ia32/CpuSleep.c2
-rw-r--r--MdePkg/Library/BaseCpuLib/Ia32/CpuSleepGcc.c2
-rw-r--r--MdePkg/Library/BaseDebugLibNull/DebugLib.c23
-rw-r--r--MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c52
-rw-r--r--MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.c124
-rw-r--r--MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicInternal.h2
-rw-r--r--MdePkg/Library/BaseIoLibIntrinsic/IoHighLevel.c456
-rw-r--r--MdePkg/Library/BaseIoLibIntrinsic/IoLib.c80
-rw-r--r--MdePkg/Library/BaseIoLibIntrinsic/IoLibArmVirt.c140
-rw-r--r--MdePkg/Library/BaseIoLibIntrinsic/IoLibEbc.c55
-rw-r--r--MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c41
-rw-r--r--MdePkg/Library/BaseIoLibIntrinsic/IoLibMmioBuffer.c124
-rw-r--r--MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c96
-rw-r--r--MdePkg/Library/BaseIoLibIntrinsic/IoLibNoIo.c134
-rw-r--r--MdePkg/Library/BaseLib/ARShiftU64.c4
-rw-r--r--MdePkg/Library/BaseLib/Arm/InternalSwitchStack.c1
-rw-r--r--MdePkg/Library/BaseLib/Arm/Unaligned.c66
-rw-r--r--MdePkg/Library/BaseLib/BaseLibInternals.h140
-rw-r--r--MdePkg/Library/BaseLib/BitField.c215
-rw-r--r--MdePkg/Library/BaseLib/CheckSum.c104
-rw-r--r--MdePkg/Library/BaseLib/ChkStkGcc.c4
-rw-r--r--MdePkg/Library/BaseLib/Cpu.c6
-rw-r--r--MdePkg/Library/BaseLib/CpuDeadLoop.c4
-rw-r--r--MdePkg/Library/BaseLib/DivS64x64Remainder.c9
-rw-r--r--MdePkg/Library/BaseLib/DivU64x32.c7
-rw-r--r--MdePkg/Library/BaseLib/DivU64x32Remainder.c9
-rw-r--r--MdePkg/Library/BaseLib/DivU64x64Remainder.c9
-rw-r--r--MdePkg/Library/BaseLib/Ebc/CpuBreakpoint.c3
-rw-r--r--MdePkg/Library/BaseLib/Ebc/SpeculationBarrier.c1
-rw-r--r--MdePkg/Library/BaseLib/FilePaths.c39
-rw-r--r--MdePkg/Library/BaseLib/GetPowerOfTwo32.c5
-rw-r--r--MdePkg/Library/BaseLib/GetPowerOfTwo64.c7
-rw-r--r--MdePkg/Library/BaseLib/HighBitSet32.c14
-rw-r--r--MdePkg/Library/BaseLib/HighBitSet64.c7
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ARShiftU64.c8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/CpuBreakpoint.c9
-rw-r--r--MdePkg/Library/BaseLib/Ia32/CpuId.c10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/CpuIdEx.c12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/CpuPause.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/DisableCache.c1
-rw-r--r--MdePkg/Library/BaseLib/Ia32/DisableInterrupts.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/DisablePaging32.c2
-rw-r--r--MdePkg/Library/BaseLib/Ia32/DivS64x64Remainder.c17
-rw-r--r--MdePkg/Library/BaseLib/Ia32/DivU64x32.c8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.c7
-rw-r--r--MdePkg/Library/BaseLib/Ia32/EnableCache.c1
-rw-r--r--MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/EnableInterrupts.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/EnablePaging32.c2
-rw-r--r--MdePkg/Library/BaseLib/Ia32/FlushCacheLine.c6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/FxRestore.c5
-rw-r--r--MdePkg/Library/BaseLib/Ia32/FxSave.c5
-rw-r--r--MdePkg/Library/BaseLib/Ia32/GccInline.c81
-rw-r--r--MdePkg/Library/BaseLib/Ia32/GccInlinePriv.c173
-rw-r--r--MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.c10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/Invd.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/LRotU64.c10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/LShiftU64.c8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ModU64x32.c7
-rw-r--r--MdePkg/Library/BaseLib/Ia32/Monitor.c7
-rw-r--r--MdePkg/Library/BaseLib/Ia32/MultU64x32.c8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/MultU64x64.c8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/Mwait.c5
-rw-r--r--MdePkg/Library/BaseLib/Ia32/Non-existing.c10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/RRotU64.c8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/RShiftU64.c8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadCr0.c3
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadCr2.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadCr3.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadCr4.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadCs.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr0.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr1.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr2.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr3.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr4.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr5.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr6.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr7.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDs.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadEflags.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadEs.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadFs.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadGdtr.c3
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadGs.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadIdtr.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadLdtr.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm0.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm1.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm2.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm3.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm4.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm5.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm6.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm7.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMsr64.c6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadPmc.c3
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadSs.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadTr.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadTsc.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/SwapBytes64.c6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/Wbinvd.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteCr0.c1
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteCr2.c1
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteCr3.c1
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteCr4.c1
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr0.c3
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr1.c3
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr2.c3
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr3.c3
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr4.c3
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr5.c3
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr6.c3
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr7.c3
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteGdtr.c5
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteIdtr.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteLdtr.c6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm0.c6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm1.c6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm2.c6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm3.c6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm4.c5
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm5.c5
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm6.c6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm7.c6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMsr64.c5
-rw-r--r--MdePkg/Library/BaseLib/LRotU32.c4
-rw-r--r--MdePkg/Library/BaseLib/LRotU64.c4
-rw-r--r--MdePkg/Library/BaseLib/LShiftU64.c4
-rw-r--r--MdePkg/Library/BaseLib/LinkedList.c60
-rw-r--r--MdePkg/Library/BaseLib/LongJump.c3
-rw-r--r--MdePkg/Library/BaseLib/LowBitSet32.c11
-rw-r--r--MdePkg/Library/BaseLib/LowBitSet64.c12
-rw-r--r--MdePkg/Library/BaseLib/Math64.c65
-rw-r--r--MdePkg/Library/BaseLib/ModU64x32.c7
-rw-r--r--MdePkg/Library/BaseLib/MultS64x64.c9
-rw-r--r--MdePkg/Library/BaseLib/MultU64x32.c9
-rw-r--r--MdePkg/Library/BaseLib/MultU64x64.c9
-rw-r--r--MdePkg/Library/BaseLib/QuickSort.c31
-rw-r--r--MdePkg/Library/BaseLib/RRotU32.c4
-rw-r--r--MdePkg/Library/BaseLib/RRotU64.c4
-rw-r--r--MdePkg/Library/BaseLib/RShiftU64.c4
-rw-r--r--MdePkg/Library/BaseLib/RiscV64/CpuBreakpoint.c5
-rw-r--r--MdePkg/Library/BaseLib/RiscV64/CpuPause.c7
-rw-r--r--MdePkg/Library/BaseLib/RiscV64/DisableInterrupts.c6
-rw-r--r--MdePkg/Library/BaseLib/RiscV64/EnableInterrupts.c6
-rw-r--r--MdePkg/Library/BaseLib/RiscV64/GetInterruptState.c11
-rw-r--r--MdePkg/Library/BaseLib/RiscV64/InternalSwitchStack.c12
-rw-r--r--MdePkg/Library/BaseLib/SafeString.c619
-rw-r--r--MdePkg/Library/BaseLib/SetJump.c3
-rw-r--r--MdePkg/Library/BaseLib/String.c330
-rw-r--r--MdePkg/Library/BaseLib/SwapBytes16.c7
-rw-r--r--MdePkg/Library/BaseLib/SwapBytes32.c9
-rw-r--r--MdePkg/Library/BaseLib/SwapBytes64.c5
-rw-r--r--MdePkg/Library/BaseLib/SwitchStack.c2
-rw-r--r--MdePkg/Library/BaseLib/Unaligned.c26
-rw-r--r--MdePkg/Library/BaseLib/UnitTestHost.c2
-rw-r--r--MdePkg/Library/BaseLib/X64/CpuBreakpoint.c7
-rw-r--r--MdePkg/Library/BaseLib/X64/GccInline.c87
-rw-r--r--MdePkg/Library/BaseLib/X64/GccInlinePriv.c198
-rw-r--r--MdePkg/Library/BaseLib/X64/Non-existing.c11
-rw-r--r--MdePkg/Library/BaseLib/X64/ReadMsr64.c11
-rw-r--r--MdePkg/Library/BaseLib/X64/WriteMsr64.c10
-rw-r--r--MdePkg/Library/BaseLib/X86DisablePaging32.c3
-rw-r--r--MdePkg/Library/BaseLib/X86DisablePaging64.c13
-rw-r--r--MdePkg/Library/BaseLib/X86EnablePaging32.c3
-rw-r--r--MdePkg/Library/BaseLib/X86EnablePaging64.c13
-rw-r--r--MdePkg/Library/BaseLib/X86FxRestore.c7
-rw-r--r--MdePkg/Library/BaseLib/X86FxSave.c7
-rw-r--r--MdePkg/Library/BaseLib/X86GetInterruptState.c6
-rw-r--r--MdePkg/Library/BaseLib/X86MemoryFence.c3
-rw-r--r--MdePkg/Library/BaseLib/X86Msr.c116
-rw-r--r--MdePkg/Library/BaseLib/X86PatchInstruction.c48
-rw-r--r--MdePkg/Library/BaseLib/X86RdRand.c6
-rw-r--r--MdePkg/Library/BaseLib/X86ReadGdtr.c5
-rw-r--r--MdePkg/Library/BaseLib/X86ReadIdtr.c5
-rw-r--r--MdePkg/Library/BaseLib/X86Thunk.c51
-rw-r--r--MdePkg/Library/BaseLib/X86UnitTestHost.c196
-rw-r--r--MdePkg/Library/BaseLib/X86WriteGdtr.c5
-rw-r--r--MdePkg/Library/BaseLib/X86WriteIdtr.c5
-rw-r--r--MdePkg/Library/BaseMemoryLib/CompareMemWrapper.c3
-rw-r--r--MdePkg/Library/BaseMemoryLib/CopyMem.c82
-rw-r--r--MdePkg/Library/BaseMemoryLib/CopyMemWrapper.c2
-rw-r--r--MdePkg/Library/BaseMemoryLib/MemLibGeneric.c106
-rw-r--r--MdePkg/Library/BaseMemoryLib/MemLibGuid.c34
-rw-r--r--MdePkg/Library/BaseMemoryLib/MemLibInternals.h64
-rw-r--r--MdePkg/Library/BaseMemoryLib/ScanMem16Wrapper.c2
-rw-r--r--MdePkg/Library/BaseMemoryLib/ScanMem32Wrapper.c2
-rw-r--r--MdePkg/Library/BaseMemoryLib/ScanMem64Wrapper.c2
-rw-r--r--MdePkg/Library/BaseMemoryLib/ScanMem8Wrapper.c4
-rw-r--r--MdePkg/Library/BaseMemoryLib/SetMem.c35
-rw-r--r--MdePkg/Library/BaseMemoryLibMmx/CompareMemWrapper.c3
-rw-r--r--MdePkg/Library/BaseMemoryLibMmx/CopyMemWrapper.c2
-rw-r--r--MdePkg/Library/BaseMemoryLibMmx/MemLibGuid.c34
-rw-r--r--MdePkg/Library/BaseMemoryLibMmx/MemLibInternals.h64
-rw-r--r--MdePkg/Library/BaseMemoryLibMmx/ScanMem16Wrapper.c2
-rw-r--r--MdePkg/Library/BaseMemoryLibMmx/ScanMem32Wrapper.c2
-rw-r--r--MdePkg/Library/BaseMemoryLibMmx/ScanMem64Wrapper.c2
-rw-r--r--MdePkg/Library/BaseMemoryLibMmx/ScanMem8Wrapper.c4
-rw-r--r--MdePkg/Library/BaseMemoryLibOptDxe/Arm/MemLibGuid.c10
-rw-r--r--MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMemGeneric.c41
-rw-r--r--MdePkg/Library/BaseMemoryLibOptDxe/CompareMemWrapper.c3
-rw-r--r--MdePkg/Library/BaseMemoryLibOptDxe/CopyMemWrapper.c2
-rw-r--r--MdePkg/Library/BaseMemoryLibOptDxe/MemLibGuid.c34
-rw-r--r--MdePkg/Library/BaseMemoryLibOptDxe/MemLibInternals.h64
-rw-r--r--MdePkg/Library/BaseMemoryLibOptDxe/ScanMem16Wrapper.c2
-rw-r--r--MdePkg/Library/BaseMemoryLibOptDxe/ScanMem32Wrapper.c2
-rw-r--r--MdePkg/Library/BaseMemoryLibOptDxe/ScanMem64Wrapper.c2
-rw-r--r--MdePkg/Library/BaseMemoryLibOptDxe/ScanMem8Wrapper.c4
-rw-r--r--MdePkg/Library/BaseMemoryLibOptPei/CompareMemWrapper.c3
-rw-r--r--MdePkg/Library/BaseMemoryLibOptPei/CopyMemWrapper.c2
-rw-r--r--MdePkg/Library/BaseMemoryLibOptPei/MemLibGuid.c34
-rw-r--r--MdePkg/Library/BaseMemoryLibOptPei/MemLibInternals.h64
-rw-r--r--MdePkg/Library/BaseMemoryLibOptPei/ScanMem16Wrapper.c2
-rw-r--r--MdePkg/Library/BaseMemoryLibOptPei/ScanMem32Wrapper.c2
-rw-r--r--MdePkg/Library/BaseMemoryLibOptPei/ScanMem64Wrapper.c2
-rw-r--r--MdePkg/Library/BaseMemoryLibOptPei/ScanMem8Wrapper.c4
-rw-r--r--MdePkg/Library/BaseMemoryLibRepStr/CompareMemWrapper.c3
-rw-r--r--MdePkg/Library/BaseMemoryLibRepStr/CopyMemWrapper.c2
-rw-r--r--MdePkg/Library/BaseMemoryLibRepStr/MemLibGuid.c34
-rw-r--r--MdePkg/Library/BaseMemoryLibRepStr/MemLibInternals.h64
-rw-r--r--MdePkg/Library/BaseMemoryLibRepStr/ScanMem16Wrapper.c2
-rw-r--r--MdePkg/Library/BaseMemoryLibRepStr/ScanMem32Wrapper.c2
-rw-r--r--MdePkg/Library/BaseMemoryLibRepStr/ScanMem64Wrapper.c2
-rw-r--r--MdePkg/Library/BaseMemoryLibRepStr/ScanMem8Wrapper.c4
-rw-r--r--MdePkg/Library/BaseMemoryLibSse2/CompareMemWrapper.c3
-rw-r--r--MdePkg/Library/BaseMemoryLibSse2/CopyMemWrapper.c2
-rw-r--r--MdePkg/Library/BaseMemoryLibSse2/MemLibGuid.c34
-rw-r--r--MdePkg/Library/BaseMemoryLibSse2/MemLibInternals.h64
-rw-r--r--MdePkg/Library/BaseMemoryLibSse2/ScanMem16Wrapper.c2
-rw-r--r--MdePkg/Library/BaseMemoryLibSse2/ScanMem32Wrapper.c2
-rw-r--r--MdePkg/Library/BaseMemoryLibSse2/ScanMem64Wrapper.c2
-rw-r--r--MdePkg/Library/BaseMemoryLibSse2/ScanMem8Wrapper.c4
-rw-r--r--MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c317
-rw-r--r--MdePkg/Library/BasePcdLibNull/PcdLib.c221
-rw-r--r--MdePkg/Library/BasePciCf8Lib/PciCf8Lib.c331
-rw-r--r--MdePkg/Library/BasePciExpressLib/PciExpressLib.c478
-rw-r--r--MdePkg/Library/BasePciLibCf8/PciLib.c193
-rw-r--r--MdePkg/Library/BasePciLibPciExpress/PciLib.c193
-rw-r--r--MdePkg/Library/BasePciSegmentLibPci/PciSegmentLib.c254
-rw-r--r--MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c200
-rw-r--r--MdePkg/Library/BasePeCoffLib/Arm/PeCoffLoaderEx.c107
-rw-r--r--MdePkg/Library/BasePeCoffLib/BasePeCoff.c991
-rw-r--r--MdePkg/Library/BasePeCoffLib/BasePeCoffLibInternals.h31
-rw-r--r--MdePkg/Library/BasePeCoffLib/PeCoffLoaderEx.c21
-rw-r--r--MdePkg/Library/BasePeCoffLib/RiscV/PeCoffLoaderEx.c71
-rw-r--r--MdePkg/Library/BasePerformanceLibNull/PerformanceLib.c35
-rw-r--r--MdePkg/Library/BasePostCodeLibDebug/PostCode.c11
-rw-r--r--MdePkg/Library/BasePostCodeLibPort80/PostCode.c37
-rw-r--r--MdePkg/Library/BasePrintLib/PrintLib.c55
-rw-r--r--MdePkg/Library/BasePrintLib/PrintLibInternal.c938
-rw-r--r--MdePkg/Library/BasePrintLib/PrintLibInternal.h77
-rw-r--r--MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLib.c10
-rw-r--r--MdePkg/Library/BaseRngLib/AArch64/ArmRng.h2
-rw-r--r--MdePkg/Library/BaseRngLib/AArch64/Rndr.c17
-rw-r--r--MdePkg/Library/BaseRngLib/BaseRng.c11
-rw-r--r--MdePkg/Library/BaseRngLib/BaseRngLibInternals.h10
-rw-r--r--MdePkg/Library/BaseRngLib/Rand/RdRand.c11
-rw-r--r--MdePkg/Library/BaseRngLibNull/BaseRngLibNull.c8
-rw-r--r--MdePkg/Library/BaseRngLibTimerLib/RngLibTimer.c39
-rw-r--r--MdePkg/Library/BaseS3BootScriptLibNull/BootScriptLib.c173
-rw-r--r--MdePkg/Library/BaseS3IoLib/S3IoLib.c594
-rw-r--r--MdePkg/Library/BaseS3PciLib/S3PciLib.c219
-rw-r--r--MdePkg/Library/BaseS3PciSegmentLib/S3PciSegmentLib.c217
-rw-r--r--MdePkg/Library/BaseS3SmbusLib/S3SmbusLib.c33
-rw-r--r--MdePkg/Library/BaseS3StallLib/S3StallLib.c7
-rw-r--r--MdePkg/Library/BaseSafeIntLib/SafeIntLib.c346
-rw-r--r--MdePkg/Library/BaseSafeIntLib/SafeIntLib32.c17
-rw-r--r--MdePkg/Library/BaseSafeIntLib/SafeIntLib64.c5
-rw-r--r--MdePkg/Library/BaseSafeIntLib/SafeIntLibEbc.c36
-rw-r--r--MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.c31
-rw-r--r--MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.c18
-rw-r--r--MdePkg/Library/BaseStackCheckLib/BaseStackCheckGcc.c14
-rw-r--r--MdePkg/Library/BaseStackCheckLib/BaseStackCheckNull.c2
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLibInternals.h26
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/Ebc/Synchronization.c28
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c40
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.c10
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.c10
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.c9
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/Ia32/InternalGetSpinLockProperties.c3
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/InterlockedDecrementMsc.c10
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/InterlockedIncrementMsc.c10
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/Synchronization.c86
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/SynchronizationGcc.c92
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/SynchronizationMsc.c99
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c40
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.c18
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.c18
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.c18
-rw-r--r--MdePkg/Library/BaseTimerLibNullTemplate/TimerLibNull.c10
-rw-r--r--MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c181
-rw-r--r--MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLibInternals.h69
-rw-r--r--MdePkg/Library/BaseUefiDecompressLib/BaseUefiTianoCustomDecompressLib.c56
-rw-r--r--MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.c7
-rw-r--r--MdePkg/Library/DxeCoreHobLib/HobLib.c96
-rw-r--r--MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c105
-rw-r--r--MdePkg/Library/DxeHobLib/HobLib.c97
-rw-r--r--MdePkg/Library/DxeHstiLib/HstiAip.c17
-rw-r--r--MdePkg/Library/DxeHstiLib/HstiDxe.c179
-rw-r--r--MdePkg/Library/DxeHstiLib/HstiDxe.h18
-rw-r--r--MdePkg/Library/DxeIoLibCpuIo2/DxeCpuIo2LibInternal.h11
-rw-r--r--MdePkg/Library/DxeIoLibCpuIo2/IoHighLevel.c457
-rw-r--r--MdePkg/Library/DxeIoLibCpuIo2/IoLib.c90
-rw-r--r--MdePkg/Library/DxeIoLibCpuIo2/IoLibMmioBuffer.c124
-rw-r--r--MdePkg/Library/DxePcdLib/DxePcdLib.c314
-rw-r--r--MdePkg/Library/DxeRngLib/DxeRngLib.c52
-rw-r--r--MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c84
-rw-r--r--MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c378
-rw-r--r--MdePkg/Library/DxeServicesLib/Allocate.c5
-rw-r--r--MdePkg/Library/DxeServicesLib/DxeServicesLib.c434
-rw-r--r--MdePkg/Library/DxeServicesLib/X64/Allocate.c3
-rw-r--r--MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.c4
-rw-r--r--MdePkg/Library/DxeSmbusLib/DxeSmbusLib.c20
-rw-r--r--MdePkg/Library/DxeSmbusLib/InternalSmbusLib.h16
-rw-r--r--MdePkg/Library/DxeSmbusLib/SmbusLib.c20
-rw-r--r--MdePkg/Library/MmServicesTableLib/MmServicesTableLib.c6
-rw-r--r--MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.c4
-rw-r--r--MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLib.c4
-rw-r--r--MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLib.c30
-rw-r--r--MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.c409
-rw-r--r--MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.h8
-rw-r--r--MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.c8
-rw-r--r--MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PostCode.c9
-rw-r--r--MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c163
-rw-r--r--MdePkg/Library/PeiHobLib/HobLib.c173
-rw-r--r--MdePkg/Library/PeiIoLibCpuIo/IoHighLevel.c457
-rw-r--r--MdePkg/Library/PeiIoLibCpuIo/IoLib.c199
-rw-r--r--MdePkg/Library/PeiIoLibCpuIo/IoLibMmioBuffer.c125
-rw-r--r--MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c52
-rw-r--r--MdePkg/Library/PeiMemoryLib/CompareMemWrapper.c3
-rw-r--r--MdePkg/Library/PeiMemoryLib/CopyMemWrapper.c2
-rw-r--r--MdePkg/Library/PeiMemoryLib/MemLib.c14
-rw-r--r--MdePkg/Library/PeiMemoryLib/MemLibGeneric.c102
-rw-r--r--MdePkg/Library/PeiMemoryLib/MemLibGuid.c34
-rw-r--r--MdePkg/Library/PeiMemoryLib/MemLibInternals.h64
-rw-r--r--MdePkg/Library/PeiMemoryLib/ScanMem16Wrapper.c2
-rw-r--r--MdePkg/Library/PeiMemoryLib/ScanMem32Wrapper.c2
-rw-r--r--MdePkg/Library/PeiMemoryLib/ScanMem64Wrapper.c2
-rw-r--r--MdePkg/Library/PeiMemoryLib/ScanMem8Wrapper.c4
-rw-r--r--MdePkg/Library/PeiPcdLib/PeiPcdLib.c266
-rw-r--r--MdePkg/Library/PeiPciLibPciCfg2/PciLib.c288
-rw-r--r--MdePkg/Library/PeiPciSegmentLibPciCfg2/PciSegmentLib.c299
-rw-r--r--MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.c15
-rw-r--r--MdePkg/Library/PeiServicesLib/PeiServicesLib.c207
-rw-r--r--MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c7
-rw-r--r--MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointer.c34
-rw-r--r--MdePkg/Library/PeiSmbusLibSmbus2Ppi/InternalSmbusLib.h11
-rw-r--r--MdePkg/Library/PeiSmbusLibSmbus2Ppi/PeiSmbusLib.c18
-rw-r--r--MdePkg/Library/PeiSmbusLibSmbus2Ppi/SmbusLib.c20
-rw-r--r--MdePkg/Library/PeimEntryPoint/PeimEntryPoint.c11
-rw-r--r--MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.c29
-rw-r--r--MdePkg/Library/SecPeiDxeTimerLibCpu/X86TimerLib.c68
-rw-r--r--MdePkg/Library/SmiHandlerProfileLibNull/SmiHandlerProfileLibNull.c18
-rw-r--r--MdePkg/Library/SmmIoLib/SmmIoLib.c63
-rw-r--r--MdePkg/Library/SmmIoLibSmmCpuIo2/IoHighLevel.c456
-rw-r--r--MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c128
-rw-r--r--MdePkg/Library/SmmIoLibSmmCpuIo2/IoLibMmioBuffer.c124
-rw-r--r--MdePkg/Library/SmmIoLibSmmCpuIo2/SmmCpuIoLibInternal.h21
-rw-r--r--MdePkg/Library/SmmLibNull/SmmLibNull.c4
-rw-r--r--MdePkg/Library/SmmMemLib/SmmMemLib.c194
-rw-r--r--MdePkg/Library/SmmMemoryAllocationLib/MemoryAllocationLib.c60
-rw-r--r--MdePkg/Library/SmmPciExpressLib/PciExpressLib.c1058
-rw-r--r--MdePkg/Library/SmmPciLibPciRootBridgeIo/PciLib.c293
-rw-r--r--MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.c132
-rw-r--r--MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.c2
-rw-r--r--MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.c6
-rw-r--r--MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c2
-rw-r--r--MdePkg/Library/UefiApplicationEntryPoint/ApplicationEntryPoint.c5
-rw-r--r--MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.c1
-rw-r--r--MdePkg/Library/UefiDebugLibConOut/DebugLib.c56
-rw-r--r--MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c34
-rw-r--r--MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c83
-rw-r--r--MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLibConstructor.c22
-rw-r--r--MdePkg/Library/UefiDebugLibStdErr/DebugLib.c59
-rw-r--r--MdePkg/Library/UefiDebugLibStdErr/DebugLibConstructor.c34
-rw-r--r--MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c1904
-rw-r--r--MdePkg/Library/UefiDevicePathLib/DevicePathToText.c817
-rw-r--r--MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c101
-rw-r--r--MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesDxeSmm.c6
-rw-r--r--MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesStandaloneMm.c3
-rw-r--r--MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c21
-rw-r--r--MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.h152
-rw-r--r--MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.c48
-rw-r--r--MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c89
-rw-r--r--MdePkg/Library/UefiDriverEntryPoint/DriverEntryPoint.c7
-rw-r--r--MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c500
-rw-r--r--MdePkg/Library/UefiLib/Acpi.c130
-rw-r--r--MdePkg/Library/UefiLib/Console.c110
-rw-r--r--MdePkg/Library/UefiLib/UefiDriverModel.c2111
-rw-r--r--MdePkg/Library/UefiLib/UefiLib.c276
-rw-r--r--MdePkg/Library/UefiLib/UefiLibInternal.h1
-rw-r--r--MdePkg/Library/UefiLib/UefiLibPrint.c257
-rw-r--r--MdePkg/Library/UefiLib/UefiNotTiano.c26
-rw-r--r--MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c43
-rw-r--r--MdePkg/Library/UefiMemoryLib/CompareMemWrapper.c3
-rw-r--r--MdePkg/Library/UefiMemoryLib/CopyMemWrapper.c2
-rw-r--r--MdePkg/Library/UefiMemoryLib/MemLib.c14
-rw-r--r--MdePkg/Library/UefiMemoryLib/MemLibGeneric.c102
-rw-r--r--MdePkg/Library/UefiMemoryLib/MemLibGuid.c34
-rw-r--r--MdePkg/Library/UefiMemoryLib/MemLibInternals.h64
-rw-r--r--MdePkg/Library/UefiMemoryLib/ScanMem16Wrapper.c2
-rw-r--r--MdePkg/Library/UefiMemoryLib/ScanMem32Wrapper.c2
-rw-r--r--MdePkg/Library/UefiMemoryLib/ScanMem64Wrapper.c2
-rw-r--r--MdePkg/Library/UefiMemoryLib/ScanMem8Wrapper.c4
-rw-r--r--MdePkg/Library/UefiPciLibPciRootBridgeIo/PciLib.c268
-rw-r--r--MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/PciSegmentLib.c307
-rw-r--r--MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/PciSegmentLib.h3
-rw-r--r--MdePkg/Library/UefiRuntimeLib/RuntimeLib.c134
-rw-r--r--MdePkg/Library/UefiScsiLib/UefiScsiLib.c614
-rw-r--r--MdePkg/Library/UefiUsbLib/Hid.c133
-rw-r--r--MdePkg/Library/UefiUsbLib/UefiUsbLibInternal.h1
-rw-r--r--MdePkg/Library/UefiUsbLib/UsbDxeLib.c253
420 files changed, 15329 insertions, 14829 deletions
diff --git a/MdePkg/Library/BaseCacheMaintenanceLib/ArmCache.c b/MdePkg/Library/BaseCacheMaintenanceLib/ArmCache.c
index fd324c6091..390539bf1b 100644
--- a/MdePkg/Library/BaseCacheMaintenanceLib/ArmCache.c
+++ b/MdePkg/Library/BaseCacheMaintenanceLib/ArmCache.c
@@ -28,7 +28,7 @@ InvalidateInstructionCache (
VOID
)
{
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
/**
@@ -59,12 +59,12 @@ InvalidateInstructionCache (
VOID *
EFIAPI
InvalidateInstructionCacheRange (
- IN VOID *Address,
- IN UINTN Length
+ IN VOID *Address,
+ IN UINTN Length
)
{
ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);
- ASSERT(FALSE);
+ ASSERT (FALSE);
return Address;
}
@@ -84,7 +84,7 @@ WriteBackInvalidateDataCache (
VOID
)
{
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
/**
@@ -116,12 +116,12 @@ WriteBackInvalidateDataCache (
VOID *
EFIAPI
WriteBackInvalidateDataCacheRange (
- IN VOID *Address,
- IN UINTN Length
+ IN VOID *Address,
+ IN UINTN Length
)
{
ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);
- ASSERT(FALSE);
+ ASSERT (FALSE);
return Address;
}
@@ -141,7 +141,7 @@ WriteBackDataCache (
VOID
)
{
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
/**
@@ -172,12 +172,12 @@ WriteBackDataCache (
VOID *
EFIAPI
WriteBackDataCacheRange (
- IN VOID *Address,
- IN UINTN Length
+ IN VOID *Address,
+ IN UINTN Length
)
{
ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);
- ASSERT(FALSE);
+ ASSERT (FALSE);
return Address;
}
@@ -198,7 +198,7 @@ InvalidateDataCache (
VOID
)
{
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
/**
@@ -231,11 +231,11 @@ InvalidateDataCache (
VOID *
EFIAPI
InvalidateDataCacheRange (
- IN VOID *Address,
- IN UINTN Length
+ IN VOID *Address,
+ IN UINTN Length
)
{
ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);
- ASSERT(FALSE);
+ ASSERT (FALSE);
return Address;
}
diff --git a/MdePkg/Library/BaseCacheMaintenanceLib/EbcCache.c b/MdePkg/Library/BaseCacheMaintenanceLib/EbcCache.c
index f4b9d9d902..ab0eee87d7 100644
--- a/MdePkg/Library/BaseCacheMaintenanceLib/EbcCache.c
+++ b/MdePkg/Library/BaseCacheMaintenanceLib/EbcCache.c
@@ -50,8 +50,8 @@ InvalidateInstructionCache (
VOID *
EFIAPI
InvalidateInstructionCacheRange (
- IN VOID *Address,
- IN UINTN Length
+ IN VOID *Address,
+ IN UINTN Length
)
{
ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);
@@ -105,8 +105,8 @@ WriteBackInvalidateDataCache (
VOID *
EFIAPI
WriteBackInvalidateDataCacheRange (
- IN VOID *Address,
- IN UINTN Length
+ IN VOID *Address,
+ IN UINTN Length
)
{
ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);
@@ -159,8 +159,8 @@ WriteBackDataCache (
VOID *
EFIAPI
WriteBackDataCacheRange (
- IN VOID *Address,
- IN UINTN Length
+ IN VOID *Address,
+ IN UINTN Length
)
{
ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);
@@ -216,8 +216,8 @@ InvalidateDataCache (
VOID *
EFIAPI
InvalidateDataCacheRange (
- IN VOID *Address,
- IN UINTN Length
+ IN VOID *Address,
+ IN UINTN Length
)
{
ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);
diff --git a/MdePkg/Library/BaseCacheMaintenanceLib/RiscVCache.c b/MdePkg/Library/BaseCacheMaintenanceLib/RiscVCache.c
index 21a695c843..67a3387ff3 100644
--- a/MdePkg/Library/BaseCacheMaintenanceLib/RiscVCache.c
+++ b/MdePkg/Library/BaseCacheMaintenanceLib/RiscVCache.c
@@ -72,11 +72,11 @@ InvalidateInstructionCache (
VOID *
EFIAPI
InvalidateInstructionCacheRange (
- IN VOID *Address,
- IN UINTN Length
+ IN VOID *Address,
+ IN UINTN Length
)
{
- DEBUG((DEBUG_ERROR, "%a:RISC-V unsupported function.\n", __FUNCTION__));
+ DEBUG ((DEBUG_ERROR, "%a:RISC-V unsupported function.\n", __FUNCTION__));
return Address;
}
@@ -96,7 +96,7 @@ WriteBackInvalidateDataCache (
VOID
)
{
- DEBUG((DEBUG_ERROR, "%a:RISC-V unsupported function.\n", __FUNCTION__));
+ DEBUG ((DEBUG_ERROR, "%a:RISC-V unsupported function.\n", __FUNCTION__));
}
/**
@@ -128,11 +128,11 @@ WriteBackInvalidateDataCache (
VOID *
EFIAPI
WriteBackInvalidateDataCacheRange (
- IN VOID *Address,
- IN UINTN Length
+ IN VOID *Address,
+ IN UINTN Length
)
{
- DEBUG((DEBUG_ERROR, "%a:RISC-V unsupported function.\n", __FUNCTION__));
+ DEBUG ((DEBUG_ERROR, "%a:RISC-V unsupported function.\n", __FUNCTION__));
return Address;
}
@@ -152,7 +152,7 @@ WriteBackDataCache (
VOID
)
{
- DEBUG((DEBUG_ERROR, "%a:RISC-V unsupported function.\n", __FUNCTION__));
+ DEBUG ((DEBUG_ERROR, "%a:RISC-V unsupported function.\n", __FUNCTION__));
}
/**
@@ -183,11 +183,11 @@ WriteBackDataCache (
VOID *
EFIAPI
WriteBackDataCacheRange (
- IN VOID *Address,
- IN UINTN Length
+ IN VOID *Address,
+ IN UINTN Length
)
{
- DEBUG((DEBUG_ERROR, "%a:RISC-V unsupported function.\n", __FUNCTION__));
+ DEBUG ((DEBUG_ERROR, "%a:RISC-V unsupported function.\n", __FUNCTION__));
return Address;
}
@@ -241,10 +241,10 @@ InvalidateDataCache (
VOID *
EFIAPI
InvalidateDataCacheRange (
- IN VOID *Address,
- IN UINTN Length
+ IN VOID *Address,
+ IN UINTN Length
)
{
- DEBUG((DEBUG_ERROR, "%a:RISC-V unsupported function.\n", __FUNCTION__));
+ DEBUG ((DEBUG_ERROR, "%a:RISC-V unsupported function.\n", __FUNCTION__));
return Address;
}
diff --git a/MdePkg/Library/BaseCacheMaintenanceLib/X86Cache.c b/MdePkg/Library/BaseCacheMaintenanceLib/X86Cache.c
index 7a6a617aad..7846d4befa 100644
--- a/MdePkg/Library/BaseCacheMaintenanceLib/X86Cache.c
+++ b/MdePkg/Library/BaseCacheMaintenanceLib/X86Cache.c
@@ -52,8 +52,8 @@ InvalidateInstructionCache (
VOID *
EFIAPI
InvalidateInstructionCacheRange (
- IN VOID *Address,
- IN UINTN Length
+ IN VOID *Address,
+ IN UINTN Length
)
{
if (Length == 0) {
@@ -112,15 +112,15 @@ WriteBackInvalidateDataCache (
VOID *
EFIAPI
WriteBackInvalidateDataCacheRange (
- IN VOID *Address,
- IN UINTN Length
+ IN VOID *Address,
+ IN UINTN Length
)
{
- UINT32 RegEbx;
- UINT32 RegEdx;
- UINTN CacheLineSize;
- UINTN Start;
- UINTN End;
+ UINT32 RegEbx;
+ UINT32 RegEdx;
+ UINTN CacheLineSize;
+ UINTN Start;
+ UINTN End;
if (Length == 0) {
return Address;
@@ -147,12 +147,13 @@ WriteBackInvalidateDataCacheRange (
//
// Calculate the cache line alignment
//
- End = (Start + Length + (CacheLineSize - 1)) & ~(CacheLineSize - 1);
+ End = (Start + Length + (CacheLineSize - 1)) & ~(CacheLineSize - 1);
Start &= ~((UINTN)CacheLineSize - 1);
do {
- Start = (UINTN)AsmFlushCacheLine ((VOID*)Start) + CacheLineSize;
+ Start = (UINTN)AsmFlushCacheLine ((VOID *)Start) + CacheLineSize;
} while (Start != End);
+
return Address;
}
@@ -203,8 +204,8 @@ WriteBackDataCache (
VOID *
EFIAPI
WriteBackDataCacheRange (
- IN VOID *Address,
- IN UINTN Length
+ IN VOID *Address,
+ IN UINTN Length
)
{
return WriteBackInvalidateDataCacheRange (Address, Length);
@@ -260,8 +261,8 @@ InvalidateDataCache (
VOID *
EFIAPI
InvalidateDataCacheRange (
- IN VOID *Address,
- IN UINTN Length
+ IN VOID *Address,
+ IN UINTN Length
)
{
//
diff --git a/MdePkg/Library/BaseCacheMaintenanceLibNull/BaseCacheMaintenanceLibNull.c b/MdePkg/Library/BaseCacheMaintenanceLibNull/BaseCacheMaintenanceLibNull.c
index fd5b9d4710..d8b28f7c0a 100644
--- a/MdePkg/Library/BaseCacheMaintenanceLibNull/BaseCacheMaintenanceLibNull.c
+++ b/MdePkg/Library/BaseCacheMaintenanceLibNull/BaseCacheMaintenanceLibNull.c
@@ -50,8 +50,8 @@ InvalidateInstructionCache (
VOID *
EFIAPI
InvalidateInstructionCacheRange (
- IN VOID *Address,
- IN UINTN Length
+ IN VOID *Address,
+ IN UINTN Length
)
{
ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);
@@ -105,8 +105,8 @@ WriteBackInvalidateDataCache (
VOID *
EFIAPI
WriteBackInvalidateDataCacheRange (
- IN VOID *Address,
- IN UINTN Length
+ IN VOID *Address,
+ IN UINTN Length
)
{
ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);
@@ -159,8 +159,8 @@ WriteBackDataCache (
VOID *
EFIAPI
WriteBackDataCacheRange (
- IN VOID *Address,
- IN UINTN Length
+ IN VOID *Address,
+ IN UINTN Length
)
{
ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);
@@ -216,8 +216,8 @@ InvalidateDataCache (
VOID *
EFIAPI
InvalidateDataCacheRange (
- IN VOID *Address,
- IN UINTN Length
+ IN VOID *Address,
+ IN UINTN Length
)
{
ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);
diff --git a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c
index 89341c2f03..549f4eb8a0 100644
--- a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c
+++ b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c
@@ -6,8 +6,6 @@
**/
-
-
/**
Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU.
@@ -25,4 +23,3 @@ CpuFlushTlb (
mov cr3, eax
}
}
-
diff --git a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c
index 15d4149929..ee44f2ea6e 100644
--- a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c
+++ b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c
@@ -23,4 +23,3 @@ CpuFlushTlb (
{
AsmWriteCr3 (AsmReadCr3 ());
}
-
diff --git a/MdePkg/Library/BaseCpuLib/Ia32/CpuSleep.c b/MdePkg/Library/BaseCpuLib/Ia32/CpuSleep.c
index 0fcaf224e6..dc2632537a 100644
--- a/MdePkg/Library/BaseCpuLib/Ia32/CpuSleep.c
+++ b/MdePkg/Library/BaseCpuLib/Ia32/CpuSleep.c
@@ -6,7 +6,6 @@
**/
-
/**
Places the CPU in a sleep state until an interrupt is received.
@@ -25,4 +24,3 @@ CpuSleep (
hlt
}
}
-
diff --git a/MdePkg/Library/BaseCpuLib/Ia32/CpuSleepGcc.c b/MdePkg/Library/BaseCpuLib/Ia32/CpuSleepGcc.c
index ad5b150d61..bb9b634c0d 100644
--- a/MdePkg/Library/BaseCpuLib/Ia32/CpuSleepGcc.c
+++ b/MdePkg/Library/BaseCpuLib/Ia32/CpuSleepGcc.c
@@ -7,7 +7,6 @@
**/
-
/**
Places the CPU in a sleep state until an interrupt is received.
@@ -24,4 +23,3 @@ CpuSleep (
{
__asm__ __volatile__ ("hlt"::: "memory");
}
-
diff --git a/MdePkg/Library/BaseDebugLibNull/DebugLib.c b/MdePkg/Library/BaseDebugLibNull/DebugLib.c
index 20c175ec6d..e01a095781 100644
--- a/MdePkg/Library/BaseDebugLibNull/DebugLib.c
+++ b/MdePkg/Library/BaseDebugLibNull/DebugLib.c
@@ -34,7 +34,6 @@ DebugPrint (
{
}
-
/**
Prints a debug message to the debug output device if the specified
error level is enabled.
@@ -53,14 +52,13 @@ DebugPrint (
VOID
EFIAPI
DebugVPrint (
- IN UINTN ErrorLevel,
- IN CONST CHAR8 *Format,
- IN VA_LIST VaListMarker
+ IN UINTN ErrorLevel,
+ IN CONST CHAR8 *Format,
+ IN VA_LIST VaListMarker
)
{
}
-
/**
Prints a debug message to the debug output device if the specified
error level is enabled.
@@ -81,14 +79,13 @@ DebugVPrint (
VOID
EFIAPI
DebugBPrint (
- IN UINTN ErrorLevel,
- IN CONST CHAR8 *Format,
- IN BASE_LIST BaseListMarker
+ IN UINTN ErrorLevel,
+ IN CONST CHAR8 *Format,
+ IN BASE_LIST BaseListMarker
)
{
}
-
/**
Prints an assert message containing a filename, line number, and description.
This may be followed by a breakpoint or a dead loop.
@@ -120,7 +117,6 @@ DebugAssert (
{
}
-
/**
Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer.
@@ -146,7 +142,6 @@ DebugClearMemory (
return Buffer;
}
-
/**
Returns TRUE if ASSERT() macros are enabled.
@@ -166,7 +161,6 @@ DebugAssertEnabled (
return FALSE;
}
-
/**
Returns TRUE if DEBUG() macros are enabled.
@@ -186,7 +180,6 @@ DebugPrintEnabled (
return FALSE;
}
-
/**
Returns TRUE if DEBUG_CODE() macros are enabled.
@@ -206,7 +199,6 @@ DebugCodeEnabled (
return FALSE;
}
-
/**
Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
@@ -238,9 +230,8 @@ DebugClearMemoryEnabled (
BOOLEAN
EFIAPI
DebugPrintLevelEnabled (
- IN CONST UINTN ErrorLevel
+ IN CONST UINTN ErrorLevel
)
{
return FALSE;
}
-
diff --git a/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c b/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c
index aeeab85737..bd56869477 100644
--- a/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c
+++ b/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c
@@ -30,7 +30,7 @@
// VA_LIST can not initialize to NULL for all compiler, so we use this to
// indicate a null VA_LIST
//
-VA_LIST mVaListNull;
+VA_LIST mVaListNull;
/**
The constructor function initialize the Serial Port Library
@@ -77,7 +77,6 @@ DebugPrint (
VA_END (Marker);
}
-
/**
Prints a debug message to the debug output device if the specified
error level is enabled base on Null-terminated format string and a
@@ -97,13 +96,13 @@ DebugPrint (
**/
VOID
DebugPrintMarker (
- IN UINTN ErrorLevel,
- IN CONST CHAR8 *Format,
- IN VA_LIST VaListMarker,
- IN BASE_LIST BaseListMarker
+ IN UINTN ErrorLevel,
+ IN CONST CHAR8 *Format,
+ IN VA_LIST VaListMarker,
+ IN BASE_LIST BaseListMarker
)
{
- CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];
+ CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];
//
// If Format is NULL, then ASSERT().
@@ -132,7 +131,6 @@ DebugPrintMarker (
SerialPortWrite ((UINT8 *)Buffer, AsciiStrLen (Buffer));
}
-
/**
Prints a debug message to the debug output device if the specified
error level is enabled.
@@ -151,15 +149,14 @@ DebugPrintMarker (
VOID
EFIAPI
DebugVPrint (
- IN UINTN ErrorLevel,
- IN CONST CHAR8 *Format,
- IN VA_LIST VaListMarker
+ IN UINTN ErrorLevel,
+ IN CONST CHAR8 *Format,
+ IN VA_LIST VaListMarker
)
{
DebugPrintMarker (ErrorLevel, Format, VaListMarker, NULL);
}
-
/**
Prints a debug message to the debug output device if the specified
error level is enabled.
@@ -180,15 +177,14 @@ DebugVPrint (
VOID
EFIAPI
DebugBPrint (
- IN UINTN ErrorLevel,
- IN CONST CHAR8 *Format,
- IN BASE_LIST BaseListMarker
+ IN UINTN ErrorLevel,
+ IN CONST CHAR8 *Format,
+ IN BASE_LIST BaseListMarker
)
{
DebugPrintMarker (ErrorLevel, Format, mVaListNull, BaseListMarker);
}
-
/**
Prints an assert message containing a filename, line number, and description.
This may be followed by a breakpoint or a dead loop.
@@ -233,14 +229,13 @@ DebugAssert (
//
// Generate a Breakpoint, DeadLoop, or NOP based on PCD settings
//
- if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {
+ if ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {
CpuBreakpoint ();
- } else if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {
+ } else if ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {
CpuDeadLoop ();
}
}
-
/**
Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer.
@@ -271,10 +266,9 @@ DebugClearMemory (
//
// SetMem() checks for the the ASSERT() condition on Length and returns Buffer
//
- return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue));
+ return SetMem (Buffer, Length, PcdGet8 (PcdDebugClearMemoryValue));
}
-
/**
Returns TRUE if ASSERT() macros are enabled.
@@ -291,10 +285,9 @@ DebugAssertEnabled (
VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
}
-
/**
Returns TRUE if DEBUG() macros are enabled.
@@ -311,10 +304,9 @@ DebugPrintEnabled (
VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
}
-
/**
Returns TRUE if DEBUG_CODE() macros are enabled.
@@ -331,10 +323,9 @@ DebugCodeEnabled (
VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
}
-
/**
Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
@@ -351,7 +342,7 @@ DebugClearMemoryEnabled (
VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
}
/**
@@ -366,9 +357,8 @@ DebugClearMemoryEnabled (
BOOLEAN
EFIAPI
DebugPrintLevelEnabled (
- IN CONST UINTN ErrorLevel
+ IN CONST UINTN ErrorLevel
)
{
- return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0);
+ return (BOOLEAN)((ErrorLevel & PcdGet32 (PcdFixedDebugPrintErrorLevel)) != 0);
}
-
diff --git a/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.c b/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.c
index b7059ec109..e6f479b829 100644
--- a/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.c
+++ b/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.c
@@ -13,14 +13,14 @@
#include <Library/BaseMemoryLib.h>
#include <Library/ExtractGuidedSectionLib.h>
-#define EXTRACT_HANDLER_INFO_SIGNATURE SIGNATURE_32 ('E', 'G', 'S', 'I')
+#define EXTRACT_HANDLER_INFO_SIGNATURE SIGNATURE_32 ('E', 'G', 'S', 'I')
typedef struct {
- UINT32 Signature;
- UINT32 NumberOfExtractHandler;
- GUID *ExtractHandlerGuidTable;
- EXTRACT_GUIDED_SECTION_DECODE_HANDLER *ExtractDecodeHandlerTable;
- EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *ExtractGetInfoHandlerTable;
+ UINT32 Signature;
+ UINT32 NumberOfExtractHandler;
+ GUID *ExtractHandlerGuidTable;
+ EXTRACT_GUIDED_SECTION_DECODE_HANDLER *ExtractDecodeHandlerTable;
+ EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *ExtractGetInfoHandlerTable;
} EXTRACT_GUIDED_SECTION_HANDLER_INFO;
/**
@@ -35,15 +35,15 @@ typedef struct {
**/
RETURN_STATUS
GetExtractGuidedSectionHandlerInfo (
- IN OUT EXTRACT_GUIDED_SECTION_HANDLER_INFO **InfoPointer
+ IN OUT EXTRACT_GUIDED_SECTION_HANDLER_INFO **InfoPointer
)
{
- EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
+ EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
//
// Set the available memory address to handler info.
//
- HandlerInfo = (EXTRACT_GUIDED_SECTION_HANDLER_INFO*)(VOID*)(UINTN) PcdGet64 (PcdGuidedExtractHandlerTableAddress);
+ HandlerInfo = (EXTRACT_GUIDED_SECTION_HANDLER_INFO *)(VOID *)(UINTN)PcdGet64 (PcdGuidedExtractHandlerTableAddress);
if (HandlerInfo == NULL) {
*InfoPointer = NULL;
return EFI_OUT_OF_RESOURCES;
@@ -75,17 +75,17 @@ GetExtractGuidedSectionHandlerInfo (
//
// Init HandlerInfo structure
//
- HandlerInfo->NumberOfExtractHandler = 0;
- HandlerInfo->ExtractHandlerGuidTable = (GUID *) (HandlerInfo + 1);
- HandlerInfo->ExtractDecodeHandlerTable = (EXTRACT_GUIDED_SECTION_DECODE_HANDLER *) (
- (UINT8 *)HandlerInfo->ExtractHandlerGuidTable +
- PcdGet32 (PcdMaximumGuidedExtractHandler) * sizeof (GUID)
- );
- HandlerInfo->ExtractGetInfoHandlerTable = (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *) (
- (UINT8 *)HandlerInfo->ExtractDecodeHandlerTable +
- PcdGet32 (PcdMaximumGuidedExtractHandler) *
- sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER)
- );
+ HandlerInfo->NumberOfExtractHandler = 0;
+ HandlerInfo->ExtractHandlerGuidTable = (GUID *)(HandlerInfo + 1);
+ HandlerInfo->ExtractDecodeHandlerTable = (EXTRACT_GUIDED_SECTION_DECODE_HANDLER *)(
+ (UINT8 *)HandlerInfo->ExtractHandlerGuidTable +
+ PcdGet32 (PcdMaximumGuidedExtractHandler) * sizeof (GUID)
+ );
+ HandlerInfo->ExtractGetInfoHandlerTable = (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *)(
+ (UINT8 *)HandlerInfo->ExtractDecodeHandlerTable +
+ PcdGet32 (PcdMaximumGuidedExtractHandler) *
+ sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER)
+ );
*InfoPointer = HandlerInfo;
return RETURN_SUCCESS;
}
@@ -110,8 +110,8 @@ ExtractGuidedSectionGetGuidList (
OUT GUID **ExtractHandlerGuidTable
)
{
- RETURN_STATUS Status;
- EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
+ RETURN_STATUS Status;
+ EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
ASSERT (ExtractHandlerGuidTable != NULL);
@@ -164,9 +164,9 @@ ExtractGuidedSectionRegisterHandlers (
IN EXTRACT_GUIDED_SECTION_DECODE_HANDLER DecodeHandler
)
{
- UINT32 Index;
- RETURN_STATUS Status;
- EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
+ UINT32 Index;
+ RETURN_STATUS Status;
+ EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
//
// Check input parameter
@@ -187,13 +187,13 @@ ExtractGuidedSectionRegisterHandlers (
// Search the match registered GetInfo handler for the input guided section.
//
ASSERT (HandlerInfo != NULL);
- for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
+ for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index++) {
if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionGuid)) {
//
// If the guided handler has been registered before, only update its handler.
//
- HandlerInfo->ExtractDecodeHandlerTable [Index] = DecodeHandler;
- HandlerInfo->ExtractGetInfoHandlerTable [Index] = GetInfoHandler;
+ HandlerInfo->ExtractDecodeHandlerTable[Index] = DecodeHandler;
+ HandlerInfo->ExtractGetInfoHandlerTable[Index] = GetInfoHandler;
return RETURN_SUCCESS;
}
}
@@ -209,8 +209,8 @@ ExtractGuidedSectionRegisterHandlers (
// Register new Handler and guid value.
//
CopyGuid (HandlerInfo->ExtractHandlerGuidTable + HandlerInfo->NumberOfExtractHandler, SectionGuid);
- HandlerInfo->ExtractDecodeHandlerTable [HandlerInfo->NumberOfExtractHandler] = DecodeHandler;
- HandlerInfo->ExtractGetInfoHandlerTable [HandlerInfo->NumberOfExtractHandler++] = GetInfoHandler;
+ HandlerInfo->ExtractDecodeHandlerTable[HandlerInfo->NumberOfExtractHandler] = DecodeHandler;
+ HandlerInfo->ExtractGetInfoHandlerTable[HandlerInfo->NumberOfExtractHandler++] = GetInfoHandler;
return RETURN_SUCCESS;
}
@@ -258,10 +258,10 @@ ExtractGuidedSectionGetInfo (
OUT UINT16 *SectionAttribute
)
{
- UINT32 Index;
- RETURN_STATUS Status;
- EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
- EFI_GUID *SectionDefinitionGuid;
+ UINT32 Index;
+ RETURN_STATUS Status;
+ EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
+ EFI_GUID *SectionDefinitionGuid;
//
// Check input parameter
@@ -280,26 +280,26 @@ ExtractGuidedSectionGetInfo (
}
if (IS_SECTION2 (InputSection)) {
- SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *)InputSection)->SectionDefinitionGuid);
} else {
- SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *)InputSection)->SectionDefinitionGuid);
}
//
// Search the match registered GetInfo handler for the input guided section.
//
ASSERT (HandlerInfo != NULL);
- for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
+ for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index++) {
if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {
//
// Call the match handler to get information for the input section data.
//
- return HandlerInfo->ExtractGetInfoHandlerTable [Index] (
- InputSection,
- OutputBufferSize,
- ScratchBufferSize,
- SectionAttribute
- );
+ return HandlerInfo->ExtractGetInfoHandlerTable[Index](
+ InputSection,
+ OutputBufferSize,
+ ScratchBufferSize,
+ SectionAttribute
+ );
}
}
@@ -353,10 +353,10 @@ ExtractGuidedSectionDecode (
OUT UINT32 *AuthenticationStatus
)
{
- UINT32 Index;
- RETURN_STATUS Status;
- EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
- EFI_GUID *SectionDefinitionGuid;
+ UINT32 Index;
+ RETURN_STATUS Status;
+ EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
+ EFI_GUID *SectionDefinitionGuid;
//
// Check input parameter
@@ -374,26 +374,26 @@ ExtractGuidedSectionDecode (
}
if (IS_SECTION2 (InputSection)) {
- SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *)InputSection)->SectionDefinitionGuid);
} else {
- SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *)InputSection)->SectionDefinitionGuid);
}
//
// Search the match registered Extract handler for the input guided section.
//
ASSERT (HandlerInfo != NULL);
- for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
+ for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index++) {
if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {
//
// Call the match handler to extract raw data for the input guided section.
//
- return HandlerInfo->ExtractDecodeHandlerTable [Index] (
- InputSection,
- OutputBuffer,
- ScratchBuffer,
- AuthenticationStatus
- );
+ return HandlerInfo->ExtractDecodeHandlerTable[Index](
+ InputSection,
+ OutputBuffer,
+ ScratchBuffer,
+ AuthenticationStatus
+ );
}
}
@@ -438,9 +438,9 @@ ExtractGuidedSectionGetHandlers (
OUT EXTRACT_GUIDED_SECTION_DECODE_HANDLER *DecodeHandler OPTIONAL
)
{
- UINT32 Index;
- RETURN_STATUS Status;
- EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
+ UINT32 Index;
+ RETURN_STATUS Status;
+ EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
//
// Check input parameter
@@ -459,20 +459,22 @@ ExtractGuidedSectionGetHandlers (
// Search the match registered GetInfo handler for the input guided section.
//
ASSERT (HandlerInfo != NULL);
- for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
+ for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index++) {
if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionGuid)) {
-
//
// If the guided handler has been registered before, then return the registered handlers.
//
if (GetInfoHandler != NULL) {
*GetInfoHandler = HandlerInfo->ExtractGetInfoHandlerTable[Index];
}
+
if (DecodeHandler != NULL) {
*DecodeHandler = HandlerInfo->ExtractDecodeHandlerTable[Index];
}
+
return RETURN_SUCCESS;
}
}
+
return RETURN_NOT_FOUND;
}
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicInternal.h b/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicInternal.h
index 79b2eb3e7b..3225d3b24c 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicInternal.h
+++ b/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicInternal.h
@@ -10,8 +10,6 @@
#ifndef __BASEIOLIB_INTRINSIC_INTERNAL_H_
#define __BASEIOLIB_INTRINSIC_INTERNAL_H_
-
-
#include <Base.h>
#include <Library/IoLib.h>
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoHighLevel.c b/MdePkg/Library/BaseIoLibIntrinsic/IoHighLevel.c
index 559f569318..f01e4b571f 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/IoHighLevel.c
+++ b/MdePkg/Library/BaseIoLibIntrinsic/IoHighLevel.c
@@ -38,11 +38,11 @@
UINT8
EFIAPI
IoOr8 (
- IN UINTN Port,
- IN UINT8 OrData
+ IN UINTN Port,
+ IN UINT8 OrData
)
{
- return IoWrite8 (Port, (UINT8) (IoRead8 (Port) | OrData));
+ return IoWrite8 (Port, (UINT8)(IoRead8 (Port) | OrData));
}
/**
@@ -66,11 +66,11 @@ IoOr8 (
UINT8
EFIAPI
IoAnd8 (
- IN UINTN Port,
- IN UINT8 AndData
+ IN UINTN Port,
+ IN UINT8 AndData
)
{
- return IoWrite8 (Port, (UINT8) (IoRead8 (Port) & AndData));
+ return IoWrite8 (Port, (UINT8)(IoRead8 (Port) & AndData));
}
/**
@@ -96,12 +96,12 @@ IoAnd8 (
UINT8
EFIAPI
IoAndThenOr8 (
- IN UINTN Port,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Port,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
- return IoWrite8 (Port, (UINT8) ((IoRead8 (Port) & AndData) | OrData));
+ return IoWrite8 (Port, (UINT8)((IoRead8 (Port) & AndData) | OrData));
}
/**
@@ -127,9 +127,9 @@ IoAndThenOr8 (
UINT8
EFIAPI
IoBitFieldRead8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead8 (IoRead8 (Port), StartBit, EndBit);
@@ -161,10 +161,10 @@ IoBitFieldRead8 (
UINT8
EFIAPI
IoBitFieldWrite8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
return IoWrite8 (
@@ -202,10 +202,10 @@ IoBitFieldWrite8 (
UINT8
EFIAPI
IoBitFieldOr8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
return IoWrite8 (
@@ -243,10 +243,10 @@ IoBitFieldOr8 (
UINT8
EFIAPI
IoBitFieldAnd8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
return IoWrite8 (
@@ -288,11 +288,11 @@ IoBitFieldAnd8 (
UINT8
EFIAPI
IoBitFieldAndThenOr8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
return IoWrite8 (
@@ -323,11 +323,11 @@ IoBitFieldAndThenOr8 (
UINT16
EFIAPI
IoOr16 (
- IN UINTN Port,
- IN UINT16 OrData
+ IN UINTN Port,
+ IN UINT16 OrData
)
{
- return IoWrite16 (Port, (UINT16) (IoRead16 (Port) | OrData));
+ return IoWrite16 (Port, (UINT16)(IoRead16 (Port) | OrData));
}
/**
@@ -352,11 +352,11 @@ IoOr16 (
UINT16
EFIAPI
IoAnd16 (
- IN UINTN Port,
- IN UINT16 AndData
+ IN UINTN Port,
+ IN UINT16 AndData
)
{
- return IoWrite16 (Port, (UINT16) (IoRead16 (Port) & AndData));
+ return IoWrite16 (Port, (UINT16)(IoRead16 (Port) & AndData));
}
/**
@@ -383,12 +383,12 @@ IoAnd16 (
UINT16
EFIAPI
IoAndThenOr16 (
- IN UINTN Port,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Port,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
- return IoWrite16 (Port, (UINT16) ((IoRead16 (Port) & AndData) | OrData));
+ return IoWrite16 (Port, (UINT16)((IoRead16 (Port) & AndData) | OrData));
}
/**
@@ -415,9 +415,9 @@ IoAndThenOr16 (
UINT16
EFIAPI
IoBitFieldRead16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead16 (IoRead16 (Port), StartBit, EndBit);
@@ -451,10 +451,10 @@ IoBitFieldRead16 (
UINT16
EFIAPI
IoBitFieldWrite16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
return IoWrite16 (
@@ -493,10 +493,10 @@ IoBitFieldWrite16 (
UINT16
EFIAPI
IoBitFieldOr16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
return IoWrite16 (
@@ -535,10 +535,10 @@ IoBitFieldOr16 (
UINT16
EFIAPI
IoBitFieldAnd16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
return IoWrite16 (
@@ -581,11 +581,11 @@ IoBitFieldAnd16 (
UINT16
EFIAPI
IoBitFieldAndThenOr16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
return IoWrite16 (
@@ -616,8 +616,8 @@ IoBitFieldAndThenOr16 (
UINT32
EFIAPI
IoOr32 (
- IN UINTN Port,
- IN UINT32 OrData
+ IN UINTN Port,
+ IN UINT32 OrData
)
{
return IoWrite32 (Port, IoRead32 (Port) | OrData);
@@ -645,8 +645,8 @@ IoOr32 (
UINT32
EFIAPI
IoAnd32 (
- IN UINTN Port,
- IN UINT32 AndData
+ IN UINTN Port,
+ IN UINT32 AndData
)
{
return IoWrite32 (Port, IoRead32 (Port) & AndData);
@@ -676,9 +676,9 @@ IoAnd32 (
UINT32
EFIAPI
IoAndThenOr32 (
- IN UINTN Port,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Port,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return IoWrite32 (Port, (IoRead32 (Port) & AndData) | OrData);
@@ -708,9 +708,9 @@ IoAndThenOr32 (
UINT32
EFIAPI
IoBitFieldRead32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead32 (IoRead32 (Port), StartBit, EndBit);
@@ -744,10 +744,10 @@ IoBitFieldRead32 (
UINT32
EFIAPI
IoBitFieldWrite32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
return IoWrite32 (
@@ -786,10 +786,10 @@ IoBitFieldWrite32 (
UINT32
EFIAPI
IoBitFieldOr32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
return IoWrite32 (
@@ -828,10 +828,10 @@ IoBitFieldOr32 (
UINT32
EFIAPI
IoBitFieldAnd32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
return IoWrite32 (
@@ -874,11 +874,11 @@ IoBitFieldAnd32 (
UINT32
EFIAPI
IoBitFieldAndThenOr32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return IoWrite32 (
@@ -909,8 +909,8 @@ IoBitFieldAndThenOr32 (
UINT64
EFIAPI
IoOr64 (
- IN UINTN Port,
- IN UINT64 OrData
+ IN UINTN Port,
+ IN UINT64 OrData
)
{
return IoWrite64 (Port, IoRead64 (Port) | OrData);
@@ -938,8 +938,8 @@ IoOr64 (
UINT64
EFIAPI
IoAnd64 (
- IN UINTN Port,
- IN UINT64 AndData
+ IN UINTN Port,
+ IN UINT64 AndData
)
{
return IoWrite64 (Port, IoRead64 (Port) & AndData);
@@ -969,9 +969,9 @@ IoAnd64 (
UINT64
EFIAPI
IoAndThenOr64 (
- IN UINTN Port,
- IN UINT64 AndData,
- IN UINT64 OrData
+ IN UINTN Port,
+ IN UINT64 AndData,
+ IN UINT64 OrData
)
{
return IoWrite64 (Port, (IoRead64 (Port) & AndData) | OrData);
@@ -1001,9 +1001,9 @@ IoAndThenOr64 (
UINT64
EFIAPI
IoBitFieldRead64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead64 (IoRead64 (Port), StartBit, EndBit);
@@ -1037,10 +1037,10 @@ IoBitFieldRead64 (
UINT64
EFIAPI
IoBitFieldWrite64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 Value
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 Value
)
{
return IoWrite64 (
@@ -1079,10 +1079,10 @@ IoBitFieldWrite64 (
UINT64
EFIAPI
IoBitFieldOr64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 OrData
)
{
return IoWrite64 (
@@ -1121,10 +1121,10 @@ IoBitFieldOr64 (
UINT64
EFIAPI
IoBitFieldAnd64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData
)
{
return IoWrite64 (
@@ -1167,11 +1167,11 @@ IoBitFieldAnd64 (
UINT64
EFIAPI
IoBitFieldAndThenOr64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData,
- IN UINT64 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData,
+ IN UINT64 OrData
)
{
return IoWrite64 (
@@ -1201,11 +1201,11 @@ IoBitFieldAndThenOr64 (
UINT8
EFIAPI
MmioOr8 (
- IN UINTN Address,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 OrData
)
{
- return MmioWrite8 (Address, (UINT8) (MmioRead8 (Address) | OrData));
+ return MmioWrite8 (Address, (UINT8)(MmioRead8 (Address) | OrData));
}
/**
@@ -1229,11 +1229,11 @@ MmioOr8 (
UINT8
EFIAPI
MmioAnd8 (
- IN UINTN Address,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINT8 AndData
)
{
- return MmioWrite8 (Address, (UINT8) (MmioRead8 (Address) & AndData));
+ return MmioWrite8 (Address, (UINT8)(MmioRead8 (Address) & AndData));
}
/**
@@ -1260,12 +1260,12 @@ MmioAnd8 (
UINT8
EFIAPI
MmioAndThenOr8 (
- IN UINTN Address,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
- return MmioWrite8 (Address, (UINT8) ((MmioRead8 (Address) & AndData) | OrData));
+ return MmioWrite8 (Address, (UINT8)((MmioRead8 (Address) & AndData) | OrData));
}
/**
@@ -1291,9 +1291,9 @@ MmioAndThenOr8 (
UINT8
EFIAPI
MmioBitFieldRead8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead8 (MmioRead8 (Address), StartBit, EndBit);
@@ -1325,10 +1325,10 @@ MmioBitFieldRead8 (
UINT8
EFIAPI
MmioBitFieldWrite8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
return MmioWrite8 (
@@ -1367,10 +1367,10 @@ MmioBitFieldWrite8 (
UINT8
EFIAPI
MmioBitFieldOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
return MmioWrite8 (
@@ -1409,10 +1409,10 @@ MmioBitFieldOr8 (
UINT8
EFIAPI
MmioBitFieldAnd8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
return MmioWrite8 (
@@ -1454,11 +1454,11 @@ MmioBitFieldAnd8 (
UINT8
EFIAPI
MmioBitFieldAndThenOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
return MmioWrite8 (
@@ -1489,11 +1489,11 @@ MmioBitFieldAndThenOr8 (
UINT16
EFIAPI
MmioOr16 (
- IN UINTN Address,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 OrData
)
{
- return MmioWrite16 (Address, (UINT16) (MmioRead16 (Address) | OrData));
+ return MmioWrite16 (Address, (UINT16)(MmioRead16 (Address) | OrData));
}
/**
@@ -1518,11 +1518,11 @@ MmioOr16 (
UINT16
EFIAPI
MmioAnd16 (
- IN UINTN Address,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINT16 AndData
)
{
- return MmioWrite16 (Address, (UINT16) (MmioRead16 (Address) & AndData));
+ return MmioWrite16 (Address, (UINT16)(MmioRead16 (Address) & AndData));
}
/**
@@ -1549,12 +1549,12 @@ MmioAnd16 (
UINT16
EFIAPI
MmioAndThenOr16 (
- IN UINTN Address,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
- return MmioWrite16 (Address, (UINT16) ((MmioRead16 (Address) & AndData) | OrData));
+ return MmioWrite16 (Address, (UINT16)((MmioRead16 (Address) & AndData) | OrData));
}
/**
@@ -1581,9 +1581,9 @@ MmioAndThenOr16 (
UINT16
EFIAPI
MmioBitFieldRead16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead16 (MmioRead16 (Address), StartBit, EndBit);
@@ -1616,10 +1616,10 @@ MmioBitFieldRead16 (
UINT16
EFIAPI
MmioBitFieldWrite16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
return MmioWrite16 (
@@ -1659,10 +1659,10 @@ MmioBitFieldWrite16 (
UINT16
EFIAPI
MmioBitFieldOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
return MmioWrite16 (
@@ -1702,10 +1702,10 @@ MmioBitFieldOr16 (
UINT16
EFIAPI
MmioBitFieldAnd16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
return MmioWrite16 (
@@ -1748,11 +1748,11 @@ MmioBitFieldAnd16 (
UINT16
EFIAPI
MmioBitFieldAndThenOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
return MmioWrite16 (
@@ -1783,8 +1783,8 @@ MmioBitFieldAndThenOr16 (
UINT32
EFIAPI
MmioOr32 (
- IN UINTN Address,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 OrData
)
{
return MmioWrite32 (Address, MmioRead32 (Address) | OrData);
@@ -1812,8 +1812,8 @@ MmioOr32 (
UINT32
EFIAPI
MmioAnd32 (
- IN UINTN Address,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINT32 AndData
)
{
return MmioWrite32 (Address, MmioRead32 (Address) & AndData);
@@ -1843,9 +1843,9 @@ MmioAnd32 (
UINT32
EFIAPI
MmioAndThenOr32 (
- IN UINTN Address,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return MmioWrite32 (Address, (MmioRead32 (Address) & AndData) | OrData);
@@ -1875,9 +1875,9 @@ MmioAndThenOr32 (
UINT32
EFIAPI
MmioBitFieldRead32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead32 (MmioRead32 (Address), StartBit, EndBit);
@@ -1910,10 +1910,10 @@ MmioBitFieldRead32 (
UINT32
EFIAPI
MmioBitFieldWrite32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
return MmioWrite32 (
@@ -1953,10 +1953,10 @@ MmioBitFieldWrite32 (
UINT32
EFIAPI
MmioBitFieldOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
return MmioWrite32 (
@@ -1996,10 +1996,10 @@ MmioBitFieldOr32 (
UINT32
EFIAPI
MmioBitFieldAnd32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
return MmioWrite32 (
@@ -2042,11 +2042,11 @@ MmioBitFieldAnd32 (
UINT32
EFIAPI
MmioBitFieldAndThenOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return MmioWrite32 (
@@ -2077,8 +2077,8 @@ MmioBitFieldAndThenOr32 (
UINT64
EFIAPI
MmioOr64 (
- IN UINTN Address,
- IN UINT64 OrData
+ IN UINTN Address,
+ IN UINT64 OrData
)
{
return MmioWrite64 (Address, MmioRead64 (Address) | OrData);
@@ -2106,8 +2106,8 @@ MmioOr64 (
UINT64
EFIAPI
MmioAnd64 (
- IN UINTN Address,
- IN UINT64 AndData
+ IN UINTN Address,
+ IN UINT64 AndData
)
{
return MmioWrite64 (Address, MmioRead64 (Address) & AndData);
@@ -2137,9 +2137,9 @@ MmioAnd64 (
UINT64
EFIAPI
MmioAndThenOr64 (
- IN UINTN Address,
- IN UINT64 AndData,
- IN UINT64 OrData
+ IN UINTN Address,
+ IN UINT64 AndData,
+ IN UINT64 OrData
)
{
return MmioWrite64 (Address, (MmioRead64 (Address) & AndData) | OrData);
@@ -2169,9 +2169,9 @@ MmioAndThenOr64 (
UINT64
EFIAPI
MmioBitFieldRead64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead64 (MmioRead64 (Address), StartBit, EndBit);
@@ -2204,10 +2204,10 @@ MmioBitFieldRead64 (
UINT64
EFIAPI
MmioBitFieldWrite64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 Value
)
{
return MmioWrite64 (
@@ -2247,10 +2247,10 @@ MmioBitFieldWrite64 (
UINT64
EFIAPI
MmioBitFieldOr64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 OrData
)
{
return MmioWrite64 (
@@ -2290,10 +2290,10 @@ MmioBitFieldOr64 (
UINT64
EFIAPI
MmioBitFieldAnd64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData
)
{
return MmioWrite64 (
@@ -2336,11 +2336,11 @@ MmioBitFieldAnd64 (
UINT64
EFIAPI
MmioBitFieldAndThenOr64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData,
- IN UINT64 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData,
+ IN UINT64 OrData
)
{
return MmioWrite64 (
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c
index d0d7044f09..9d42e21a69 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c
+++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c
@@ -26,7 +26,7 @@
UINT64
EFIAPI
IoRead64 (
- IN UINTN Port
+ IN UINTN Port
)
{
ASSERT (FALSE);
@@ -52,15 +52,14 @@ IoRead64 (
UINT64
EFIAPI
IoWrite64 (
- IN UINTN Port,
- IN UINT64 Value
+ IN UINTN Port,
+ IN UINT64 Value
)
{
ASSERT (FALSE);
return 0;
}
-
/**
Reads an 8-bit MMIO register.
@@ -78,18 +77,19 @@ IoWrite64 (
UINT8
EFIAPI
MmioRead8 (
- IN UINTN Address
+ IN UINTN Address
)
{
- UINT8 Value;
- BOOLEAN Flag;
+ UINT8 Value;
+ BOOLEAN Flag;
Flag = FilterBeforeMmIoRead (FilterWidth8, Address, &Value);
if (Flag) {
MemoryFence ();
- Value = *(volatile UINT8*)Address;
+ Value = *(volatile UINT8 *)Address;
MemoryFence ();
}
+
FilterAfterMmIoRead (FilterWidth8, Address, &Value);
return Value;
@@ -113,18 +113,19 @@ MmioRead8 (
UINT8
EFIAPI
MmioWrite8 (
- IN UINTN Address,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINT8 Value
)
{
- BOOLEAN Flag;
+ BOOLEAN Flag;
Flag = FilterBeforeMmIoWrite (FilterWidth8, Address, &Value);
if (Flag) {
MemoryFence ();
- *(volatile UINT8*)Address = Value;
+ *(volatile UINT8 *)Address = Value;
MemoryFence ();
}
+
FilterAfterMmIoWrite (FilterWidth8, Address, &Value);
return Value;
@@ -148,19 +149,20 @@ MmioWrite8 (
UINT16
EFIAPI
MmioRead16 (
- IN UINTN Address
+ IN UINTN Address
)
{
- UINT16 Value;
- BOOLEAN Flag;
+ UINT16 Value;
+ BOOLEAN Flag;
ASSERT ((Address & 1) == 0);
Flag = FilterBeforeMmIoRead (FilterWidth16, Address, &Value);
if (Flag) {
MemoryFence ();
- Value = *(volatile UINT16*)Address;
+ Value = *(volatile UINT16 *)Address;
MemoryFence ();
}
+
FilterAfterMmIoRead (FilterWidth16, Address, &Value);
return Value;
@@ -185,20 +187,21 @@ MmioRead16 (
UINT16
EFIAPI
MmioWrite16 (
- IN UINTN Address,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINT16 Value
)
{
- BOOLEAN Flag;
+ BOOLEAN Flag;
ASSERT ((Address & 1) == 0);
Flag = FilterBeforeMmIoWrite (FilterWidth16, Address, &Value);
if (Flag) {
MemoryFence ();
- *(volatile UINT16*)Address = Value;
+ *(volatile UINT16 *)Address = Value;
MemoryFence ();
}
+
FilterAfterMmIoWrite (FilterWidth16, Address, &Value);
return Value;
@@ -222,20 +225,21 @@ MmioWrite16 (
UINT32
EFIAPI
MmioRead32 (
- IN UINTN Address
+ IN UINTN Address
)
{
- UINT32 Value;
- BOOLEAN Flag;
+ UINT32 Value;
+ BOOLEAN Flag;
ASSERT ((Address & 3) == 0);
Flag = FilterBeforeMmIoRead (FilterWidth32, Address, &Value);
if (Flag) {
MemoryFence ();
- Value = *(volatile UINT32*)Address;
+ Value = *(volatile UINT32 *)Address;
MemoryFence ();
}
+
FilterAfterMmIoRead (FilterWidth32, Address, &Value);
return Value;
@@ -260,20 +264,21 @@ MmioRead32 (
UINT32
EFIAPI
MmioWrite32 (
- IN UINTN Address,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINT32 Value
)
{
- BOOLEAN Flag;
+ BOOLEAN Flag;
ASSERT ((Address & 3) == 0);
Flag = FilterBeforeMmIoWrite (FilterWidth32, Address, &Value);
if (Flag) {
MemoryFence ();
- *(volatile UINT32*)Address = Value;
+ *(volatile UINT32 *)Address = Value;
MemoryFence ();
}
+
FilterAfterMmIoWrite (FilterWidth32, Address, &Value);
return Value;
@@ -297,20 +302,21 @@ MmioWrite32 (
UINT64
EFIAPI
MmioRead64 (
- IN UINTN Address
+ IN UINTN Address
)
{
- UINT64 Value;
- BOOLEAN Flag;
+ UINT64 Value;
+ BOOLEAN Flag;
ASSERT ((Address & 7) == 0);
Flag = FilterBeforeMmIoRead (FilterWidth64, Address, &Value);
if (Flag) {
MemoryFence ();
- Value = *(volatile UINT64*)Address;
+ Value = *(volatile UINT64 *)Address;
MemoryFence ();
}
+
FilterAfterMmIoRead (FilterWidth64, Address, &Value);
return Value;
@@ -333,22 +339,22 @@ MmioRead64 (
UINT64
EFIAPI
MmioWrite64 (
- IN UINTN Address,
- IN UINT64 Value
+ IN UINTN Address,
+ IN UINT64 Value
)
{
- BOOLEAN Flag;
+ BOOLEAN Flag;
ASSERT ((Address & 7) == 0);
Flag = FilterBeforeMmIoWrite (FilterWidth64, Address, &Value);
if (Flag) {
MemoryFence ();
- *(volatile UINT64*)Address = Value;
+ *(volatile UINT64 *)Address = Value;
MemoryFence ();
}
+
FilterAfterMmIoWrite (FilterWidth64, Address, &Value);
return Value;
}
-
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibArmVirt.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibArmVirt.c
index 6140840769..6360586929 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibArmVirt.c
+++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibArmVirt.c
@@ -27,7 +27,7 @@
UINT8
EFIAPI
MmioRead8Internal (
- IN UINTN Address
+ IN UINTN Address
);
/**
@@ -44,8 +44,8 @@ MmioRead8Internal (
VOID
EFIAPI
MmioWrite8Internal (
- IN UINTN Address,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINT8 Value
);
/**
@@ -63,7 +63,7 @@ MmioWrite8Internal (
UINT16
EFIAPI
MmioRead16Internal (
- IN UINTN Address
+ IN UINTN Address
);
/**
@@ -80,8 +80,8 @@ MmioRead16Internal (
VOID
EFIAPI
MmioWrite16Internal (
- IN UINTN Address,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINT16 Value
);
/**
@@ -99,7 +99,7 @@ MmioWrite16Internal (
UINT32
EFIAPI
MmioRead32Internal (
- IN UINTN Address
+ IN UINTN Address
);
/**
@@ -116,8 +116,8 @@ MmioRead32Internal (
VOID
EFIAPI
MmioWrite32Internal (
- IN UINTN Address,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINT32 Value
);
/**
@@ -135,7 +135,7 @@ MmioWrite32Internal (
UINT64
EFIAPI
MmioRead64Internal (
- IN UINTN Address
+ IN UINTN Address
);
/**
@@ -152,8 +152,8 @@ MmioRead64Internal (
VOID
EFIAPI
MmioWrite64Internal (
- IN UINTN Address,
- IN UINT64 Value
+ IN UINTN Address,
+ IN UINT64 Value
);
/**
@@ -173,7 +173,7 @@ MmioWrite64Internal (
UINT8
EFIAPI
IoRead8 (
- IN UINTN Port
+ IN UINTN Port
)
{
ASSERT (FALSE);
@@ -198,8 +198,8 @@ IoRead8 (
UINT8
EFIAPI
IoWrite8 (
- IN UINTN Port,
- IN UINT8 Value
+ IN UINTN Port,
+ IN UINT8 Value
)
{
ASSERT (FALSE);
@@ -223,7 +223,7 @@ IoWrite8 (
UINT16
EFIAPI
IoRead16 (
- IN UINTN Port
+ IN UINTN Port
)
{
ASSERT (FALSE);
@@ -248,8 +248,8 @@ IoRead16 (
UINT16
EFIAPI
IoWrite16 (
- IN UINTN Port,
- IN UINT16 Value
+ IN UINTN Port,
+ IN UINT16 Value
)
{
ASSERT (FALSE);
@@ -273,7 +273,7 @@ IoWrite16 (
UINT32
EFIAPI
IoRead32 (
- IN UINTN Port
+ IN UINTN Port
)
{
ASSERT (FALSE);
@@ -298,8 +298,8 @@ IoRead32 (
UINT32
EFIAPI
IoWrite32 (
- IN UINTN Port,
- IN UINT32 Value
+ IN UINTN Port,
+ IN UINT32 Value
)
{
ASSERT (FALSE);
@@ -324,7 +324,7 @@ IoWrite32 (
UINT64
EFIAPI
IoRead64 (
- IN UINTN Port
+ IN UINTN Port
)
{
ASSERT (FALSE);
@@ -350,8 +350,8 @@ IoRead64 (
UINT64
EFIAPI
IoWrite64 (
- IN UINTN Port,
- IN UINT64 Value
+ IN UINTN Port,
+ IN UINT64 Value
)
{
ASSERT (FALSE);
@@ -378,9 +378,9 @@ IoWrite64 (
VOID
EFIAPI
IoReadFifo8 (
- IN UINTN Port,
- IN UINTN Count,
- OUT VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ OUT VOID *Buffer
)
{
ASSERT (FALSE);
@@ -406,9 +406,9 @@ IoReadFifo8 (
VOID
EFIAPI
IoWriteFifo8 (
- IN UINTN Port,
- IN UINTN Count,
- IN VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ IN VOID *Buffer
)
{
ASSERT (FALSE);
@@ -434,9 +434,9 @@ IoWriteFifo8 (
VOID
EFIAPI
IoReadFifo16 (
- IN UINTN Port,
- IN UINTN Count,
- OUT VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ OUT VOID *Buffer
)
{
ASSERT (FALSE);
@@ -462,9 +462,9 @@ IoReadFifo16 (
VOID
EFIAPI
IoWriteFifo16 (
- IN UINTN Port,
- IN UINTN Count,
- IN VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ IN VOID *Buffer
)
{
ASSERT (FALSE);
@@ -490,9 +490,9 @@ IoWriteFifo16 (
VOID
EFIAPI
IoReadFifo32 (
- IN UINTN Port,
- IN UINTN Count,
- OUT VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ OUT VOID *Buffer
)
{
ASSERT (FALSE);
@@ -518,9 +518,9 @@ IoReadFifo32 (
VOID
EFIAPI
IoWriteFifo32 (
- IN UINTN Port,
- IN UINTN Count,
- IN VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ IN VOID *Buffer
)
{
ASSERT (FALSE);
@@ -543,16 +543,17 @@ IoWriteFifo32 (
UINT8
EFIAPI
MmioRead8 (
- IN UINTN Address
+ IN UINTN Address
)
{
- UINT8 Value;
- BOOLEAN Flag;
+ UINT8 Value;
+ BOOLEAN Flag;
Flag = FilterBeforeMmIoRead (FilterWidth8, Address, &Value);
if (Flag) {
Value = MmioRead8Internal (Address);
}
+
FilterAfterMmIoRead (FilterWidth8, Address, &Value);
return Value;
@@ -574,16 +575,17 @@ MmioRead8 (
UINT8
EFIAPI
MmioWrite8 (
- IN UINTN Address,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINT8 Value
)
{
- BOOLEAN Flag;
+ BOOLEAN Flag;
Flag = FilterBeforeMmIoWrite (FilterWidth8, Address, &Value);
if (Flag) {
MmioWrite8Internal (Address, Value);
}
+
FilterAfterMmIoWrite (FilterWidth8, Address, &Value);
return Value;
@@ -606,11 +608,11 @@ MmioWrite8 (
UINT16
EFIAPI
MmioRead16 (
- IN UINTN Address
+ IN UINTN Address
)
{
- BOOLEAN Flag;
- UINT16 Value;
+ BOOLEAN Flag;
+ UINT16 Value;
ASSERT ((Address & 1) == 0);
@@ -618,6 +620,7 @@ MmioRead16 (
if (Flag) {
Value = MmioRead16Internal (Address);
}
+
FilterAfterMmIoRead (FilterWidth16, Address, &Value);
return Value;
@@ -639,11 +642,11 @@ MmioRead16 (
UINT16
EFIAPI
MmioWrite16 (
- IN UINTN Address,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINT16 Value
)
{
- BOOLEAN Flag;
+ BOOLEAN Flag;
ASSERT ((Address & 1) == 0);
@@ -651,6 +654,7 @@ MmioWrite16 (
if (Flag) {
MmioWrite16Internal (Address, Value);
}
+
FilterAfterMmIoWrite (FilterWidth16, Address, &Value);
return Value;
@@ -673,11 +677,11 @@ MmioWrite16 (
UINT32
EFIAPI
MmioRead32 (
- IN UINTN Address
+ IN UINTN Address
)
{
- BOOLEAN Flag;
- UINT32 Value;
+ BOOLEAN Flag;
+ UINT32 Value;
ASSERT ((Address & 3) == 0);
@@ -685,6 +689,7 @@ MmioRead32 (
if (Flag) {
Value = MmioRead32Internal (Address);
}
+
FilterAfterMmIoRead (FilterWidth32, Address, &Value);
return Value;
@@ -706,11 +711,11 @@ MmioRead32 (
UINT32
EFIAPI
MmioWrite32 (
- IN UINTN Address,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINT32 Value
)
{
- BOOLEAN Flag;
+ BOOLEAN Flag;
ASSERT ((Address & 3) == 0);
@@ -718,6 +723,7 @@ MmioWrite32 (
if (Flag) {
MmioWrite32Internal (Address, Value);
}
+
FilterAfterMmIoWrite (FilterWidth32, Address, &Value);
return Value;
@@ -740,11 +746,11 @@ MmioWrite32 (
UINT64
EFIAPI
MmioRead64 (
- IN UINTN Address
+ IN UINTN Address
)
{
- BOOLEAN Flag;
- UINT64 Value;
+ BOOLEAN Flag;
+ UINT64 Value;
ASSERT ((Address & 7) == 0);
@@ -752,6 +758,7 @@ MmioRead64 (
if (Flag) {
Value = MmioRead64Internal (Address);
}
+
FilterAfterMmIoRead (FilterWidth64, Address, &Value);
return Value;
@@ -773,11 +780,11 @@ MmioRead64 (
UINT64
EFIAPI
MmioWrite64 (
- IN UINTN Address,
- IN UINT64 Value
+ IN UINTN Address,
+ IN UINT64 Value
)
{
- BOOLEAN Flag;
+ BOOLEAN Flag;
ASSERT ((Address & 7) == 0);
@@ -785,6 +792,7 @@ MmioWrite64 (
if (Flag) {
MmioWrite64Internal (Address, Value);
}
+
FilterAfterMmIoWrite (FilterWidth64, Address, &Value);
return Value;
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibEbc.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibEbc.c
index 98c774fa7b..aa25f81b11 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibEbc.c
+++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibEbc.c
@@ -29,7 +29,7 @@
UINT8
EFIAPI
IoRead8 (
- IN UINTN Port
+ IN UINTN Port
)
{
ASSERT (FALSE);
@@ -54,8 +54,8 @@ IoRead8 (
UINT8
EFIAPI
IoWrite8 (
- IN UINTN Port,
- IN UINT8 Value
+ IN UINTN Port,
+ IN UINT8 Value
)
{
ASSERT (FALSE);
@@ -80,7 +80,7 @@ IoWrite8 (
UINT16
EFIAPI
IoRead16 (
- IN UINTN Port
+ IN UINTN Port
)
{
ASSERT (FALSE);
@@ -106,8 +106,8 @@ IoRead16 (
UINT16
EFIAPI
IoWrite16 (
- IN UINTN Port,
- IN UINT16 Value
+ IN UINTN Port,
+ IN UINT16 Value
)
{
ASSERT (FALSE);
@@ -132,7 +132,7 @@ IoWrite16 (
UINT32
EFIAPI
IoRead32 (
- IN UINTN Port
+ IN UINTN Port
)
{
ASSERT (FALSE);
@@ -158,8 +158,8 @@ IoRead32 (
UINT32
EFIAPI
IoWrite32 (
- IN UINTN Port,
- IN UINT32 Value
+ IN UINTN Port,
+ IN UINT32 Value
)
{
ASSERT (FALSE);
@@ -186,9 +186,9 @@ IoWrite32 (
VOID
EFIAPI
IoReadFifo8 (
- IN UINTN Port,
- IN UINTN Count,
- OUT VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ OUT VOID *Buffer
)
{
ASSERT (FALSE);
@@ -214,9 +214,9 @@ IoReadFifo8 (
VOID
EFIAPI
IoWriteFifo8 (
- IN UINTN Port,
- IN UINTN Count,
- IN VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ IN VOID *Buffer
)
{
ASSERT (FALSE);
@@ -242,9 +242,9 @@ IoWriteFifo8 (
VOID
EFIAPI
IoReadFifo16 (
- IN UINTN Port,
- IN UINTN Count,
- OUT VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ OUT VOID *Buffer
)
{
ASSERT (FALSE);
@@ -270,9 +270,9 @@ IoReadFifo16 (
VOID
EFIAPI
IoWriteFifo16 (
- IN UINTN Port,
- IN UINTN Count,
- IN VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ IN VOID *Buffer
)
{
ASSERT (FALSE);
@@ -298,9 +298,9 @@ IoWriteFifo16 (
VOID
EFIAPI
IoReadFifo32 (
- IN UINTN Port,
- IN UINTN Count,
- OUT VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ OUT VOID *Buffer
)
{
ASSERT (FALSE);
@@ -326,11 +326,10 @@ IoReadFifo32 (
VOID
EFIAPI
IoWriteFifo32 (
- IN UINTN Port,
- IN UINTN Count,
- IN VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ IN VOID *Buffer
)
{
ASSERT (FALSE);
}
-
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c
index ecf9ed6191..5c791289c4 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c
+++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c
@@ -15,7 +15,6 @@
**/
-
#include "BaseIoLibIntrinsicInternal.h"
/**
@@ -35,16 +34,17 @@
UINT8
EFIAPI
IoRead8 (
- IN UINTN Port
+ IN UINTN Port
)
{
- UINT8 Data;
- BOOLEAN Flag;
+ UINT8 Data;
+ BOOLEAN Flag;
Flag = FilterBeforeIoRead (FilterWidth8, Port, &Data);
if (Flag) {
__asm__ __volatile__ ("inb %w1,%b0" : "=a" (Data) : "d" ((UINT16)Port));
}
+
FilterAfterIoRead (FilterWidth8, Port, &Data);
return Data;
@@ -68,19 +68,20 @@ IoRead8 (
UINT8
EFIAPI
IoWrite8 (
- IN UINTN Port,
- IN UINT8 Value
+ IN UINTN Port,
+ IN UINT8 Value
)
{
- BOOLEAN Flag;
+ BOOLEAN Flag;
Flag = FilterBeforeIoWrite (FilterWidth8, Port, &Value);
if (Flag) {
__asm__ __volatile__ ("outb %b0,%w1" : : "a" (Value), "d" ((UINT16)Port));
}
+
FilterAfterIoWrite (FilterWidth8, Port, &Value);
- return Value;;
+ return Value;
}
/**
@@ -101,7 +102,7 @@ IoWrite8 (
UINT16
EFIAPI
IoRead16 (
- IN UINTN Port
+ IN UINTN Port
)
{
UINT16 Data;
@@ -111,8 +112,9 @@ IoRead16 (
Flag = FilterBeforeIoRead (FilterWidth16, Port, &Data);
if (Flag) {
- __asm__ __volatile__ ("inw %w1,%w0" : "=a" (Data) : "d" ((UINT16)Port));
+ __asm__ __volatile__ ("inw %w1,%w0" : "=a" (Data) : "d" ((UINT16)Port));
}
+
FilterAfterIoRead (FilterWidth16, Port, &Data);
return Data;
@@ -137,12 +139,11 @@ IoRead16 (
UINT16
EFIAPI
IoWrite16 (
- IN UINTN Port,
- IN UINT16 Value
+ IN UINTN Port,
+ IN UINT16 Value
)
{
-
- BOOLEAN Flag;
+ BOOLEAN Flag;
ASSERT ((Port & 1) == 0);
@@ -150,9 +151,10 @@ IoWrite16 (
if (Flag) {
__asm__ __volatile__ ("outw %w0,%w1" : : "a" (Value), "d" ((UINT16)Port));
}
+
FilterAfterIoWrite (FilterWidth16, Port, &Value);
- return Value;;
+ return Value;
}
/**
@@ -173,7 +175,7 @@ IoWrite16 (
UINT32
EFIAPI
IoRead32 (
- IN UINTN Port
+ IN UINTN Port
)
{
UINT32 Data;
@@ -185,6 +187,7 @@ IoRead32 (
if (Flag) {
__asm__ __volatile__ ("inl %w1,%0" : "=a" (Data) : "d" ((UINT16)Port));
}
+
FilterAfterIoRead (FilterWidth32, Port, &Data);
return Data;
@@ -209,8 +212,8 @@ IoRead32 (
UINT32
EFIAPI
IoWrite32 (
- IN UINTN Port,
- IN UINT32 Value
+ IN UINTN Port,
+ IN UINT32 Value
)
{
BOOLEAN Flag;
@@ -221,8 +224,8 @@ IoWrite32 (
if (Flag) {
__asm__ __volatile__ ("outl %0,%w1" : : "a" (Value), "d" ((UINT16)Port));
}
+
FilterAfterIoWrite (FilterWidth32, Port, &Value);
return Value;
}
-
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibMmioBuffer.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibMmioBuffer.c
index 6059bab6b2..ecee7f2bde 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibMmioBuffer.c
+++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibMmioBuffer.c
@@ -29,15 +29,15 @@
UINT8 *
EFIAPI
MmioReadBuffer8 (
- IN UINTN StartAddress,
- IN UINTN Length,
- OUT UINT8 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ OUT UINT8 *Buffer
)
{
- UINT8 *ReturnBuffer;
+ UINT8 *ReturnBuffer;
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ReturnBuffer = Buffer;
@@ -73,27 +73,27 @@ MmioReadBuffer8 (
UINT16 *
EFIAPI
MmioReadBuffer16 (
- IN UINTN StartAddress,
- IN UINTN Length,
- OUT UINT16 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ OUT UINT16 *Buffer
)
{
- UINT16 *ReturnBuffer;
+ UINT16 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT16) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT16) - 1)) == 0);
+ ASSERT (((UINTN)Buffer & (sizeof (UINT16) - 1)) == 0);
ReturnBuffer = Buffer;
while (Length != 0) {
- *(Buffer++) = MmioRead16 (StartAddress);
+ *(Buffer++) = MmioRead16 (StartAddress);
StartAddress += sizeof (UINT16);
- Length -= sizeof (UINT16);
+ Length -= sizeof (UINT16);
}
return ReturnBuffer;
@@ -124,27 +124,27 @@ MmioReadBuffer16 (
UINT32 *
EFIAPI
MmioReadBuffer32 (
- IN UINTN StartAddress,
- IN UINTN Length,
- OUT UINT32 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ OUT UINT32 *Buffer
)
{
- UINT32 *ReturnBuffer;
+ UINT32 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT32) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0);
+ ASSERT (((UINTN)Buffer & (sizeof (UINT32) - 1)) == 0);
ReturnBuffer = Buffer;
while (Length != 0) {
- *(Buffer++) = MmioRead32 (StartAddress);
+ *(Buffer++) = MmioRead32 (StartAddress);
StartAddress += sizeof (UINT32);
- Length -= sizeof (UINT32);
+ Length -= sizeof (UINT32);
}
return ReturnBuffer;
@@ -175,33 +175,32 @@ MmioReadBuffer32 (
UINT64 *
EFIAPI
MmioReadBuffer64 (
- IN UINTN StartAddress,
- IN UINTN Length,
- OUT UINT64 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ OUT UINT64 *Buffer
)
{
- UINT64 *ReturnBuffer;
+ UINT64 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT64) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT64) - 1)) == 0);
+ ASSERT (((UINTN)Buffer & (sizeof (UINT64) - 1)) == 0);
ReturnBuffer = Buffer;
while (Length != 0) {
- *(Buffer++) = MmioRead64 (StartAddress);
+ *(Buffer++) = MmioRead64 (StartAddress);
StartAddress += sizeof (UINT64);
- Length -= sizeof (UINT64);
+ Length -= sizeof (UINT64);
}
return ReturnBuffer;
}
-
/**
Copy data from system memory to the MMIO region by using 8-bit access.
@@ -223,24 +222,23 @@ MmioReadBuffer64 (
UINT8 *
EFIAPI
MmioWriteBuffer8 (
- IN UINTN StartAddress,
- IN UINTN Length,
- IN CONST UINT8 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ IN CONST UINT8 *Buffer
)
{
- VOID* ReturnBuffer;
+ VOID *ReturnBuffer;
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
- ReturnBuffer = (UINT8 *) Buffer;
+ ReturnBuffer = (UINT8 *)Buffer;
while (Length-- != 0) {
- MmioWrite8 (StartAddress++, *(Buffer++));
+ MmioWrite8 (StartAddress++, *(Buffer++));
}
return ReturnBuffer;
-
}
/**
@@ -269,34 +267,33 @@ MmioWriteBuffer8 (
UINT16 *
EFIAPI
MmioWriteBuffer16 (
- IN UINTN StartAddress,
- IN UINTN Length,
- IN CONST UINT16 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ IN CONST UINT16 *Buffer
)
{
- UINT16 *ReturnBuffer;
+ UINT16 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT16) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT16) - 1)) == 0);
+ ASSERT (((UINTN)Buffer & (sizeof (UINT16) - 1)) == 0);
- ReturnBuffer = (UINT16 *) Buffer;
+ ReturnBuffer = (UINT16 *)Buffer;
while (Length != 0) {
MmioWrite16 (StartAddress, *(Buffer++));
StartAddress += sizeof (UINT16);
- Length -= sizeof (UINT16);
+ Length -= sizeof (UINT16);
}
return ReturnBuffer;
}
-
/**
Copy data from system memory to the MMIO region by using 32-bit access.
@@ -323,28 +320,28 @@ MmioWriteBuffer16 (
UINT32 *
EFIAPI
MmioWriteBuffer32 (
- IN UINTN StartAddress,
- IN UINTN Length,
- IN CONST UINT32 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ IN CONST UINT32 *Buffer
)
{
- UINT32 *ReturnBuffer;
+ UINT32 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT32) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0);
+ ASSERT (((UINTN)Buffer & (sizeof (UINT32) - 1)) == 0);
- ReturnBuffer = (UINT32 *) Buffer;
+ ReturnBuffer = (UINT32 *)Buffer;
while (Length != 0) {
MmioWrite32 (StartAddress, *(Buffer++));
StartAddress += sizeof (UINT32);
- Length -= sizeof (UINT32);
+ Length -= sizeof (UINT32);
}
return ReturnBuffer;
@@ -376,30 +373,29 @@ MmioWriteBuffer32 (
UINT64 *
EFIAPI
MmioWriteBuffer64 (
- IN UINTN StartAddress,
- IN UINTN Length,
- IN CONST UINT64 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ IN CONST UINT64 *Buffer
)
{
- UINT64 *ReturnBuffer;
+ UINT64 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT64) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT64) - 1)) == 0);
+ ASSERT (((UINTN)Buffer & (sizeof (UINT64) - 1)) == 0);
- ReturnBuffer = (UINT64 *) Buffer;
+ ReturnBuffer = (UINT64 *)Buffer;
while (Length != 0) {
MmioWrite64 (StartAddress, *(Buffer++));
StartAddress += sizeof (UINT64);
- Length -= sizeof (UINT64);
+ Length -= sizeof (UINT64);
}
return ReturnBuffer;
}
-
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c
index d2bc5f527c..9f225a6b5d 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c
+++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c
@@ -13,21 +13,49 @@
**/
-
-
#include "BaseIoLibIntrinsicInternal.h"
//
// Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics.
//
-int _inp (unsigned short port);
-unsigned short _inpw (unsigned short port);
-unsigned long _inpd (unsigned short port);
-int _outp (unsigned short port, int databyte );
-unsigned short _outpw (unsigned short port, unsigned short dataword );
-unsigned long _outpd (unsigned short port, unsigned long dataword );
-void _ReadWriteBarrier (void);
+int
+_inp (
+ unsigned short port
+ );
+
+unsigned short
+_inpw (
+ unsigned short port
+ );
+
+unsigned long
+_inpd (
+ unsigned short port
+ );
+
+int
+_outp (
+ unsigned short port,
+ int databyte
+ );
+
+unsigned short
+_outpw (
+ unsigned short port,
+ unsigned short dataword
+ );
+
+unsigned long
+_outpd (
+ unsigned short port,
+ unsigned long dataword
+ );
+
+void
+_ReadWriteBarrier (
+ void
+ );
#pragma intrinsic(_inp)
#pragma intrinsic(_inpw)
@@ -62,11 +90,11 @@ void _ReadWriteBarrier (void);
UINT8
EFIAPI
IoRead8 (
- IN UINTN Port
+ IN UINTN Port
)
{
- UINT8 Value;
- BOOLEAN Flag;
+ UINT8 Value;
+ BOOLEAN Flag;
Flag = FilterBeforeIoRead (FilterWidth8, Port, &Value);
if (Flag) {
@@ -74,6 +102,7 @@ IoRead8 (
Value = (UINT8)_inp ((UINT16)Port);
_ReadWriteBarrier ();
}
+
FilterAfterIoRead (FilterWidth8, Port, &Value);
return Value;
@@ -97,18 +126,19 @@ IoRead8 (
UINT8
EFIAPI
IoWrite8 (
- IN UINTN Port,
- IN UINT8 Value
+ IN UINTN Port,
+ IN UINT8 Value
)
{
- BOOLEAN Flag;
+ BOOLEAN Flag;
- Flag = FilterBeforeIoWrite(FilterWidth8, Port, &Value);
+ Flag = FilterBeforeIoWrite (FilterWidth8, Port, &Value);
if (Flag) {
_ReadWriteBarrier ();
(UINT8)_outp ((UINT16)Port, Value);
_ReadWriteBarrier ();
}
+
FilterAfterIoWrite (FilterWidth8, Port, &Value);
return Value;
@@ -132,11 +162,11 @@ IoWrite8 (
UINT16
EFIAPI
IoRead16 (
- IN UINTN Port
+ IN UINTN Port
)
{
- UINT16 Value;
- BOOLEAN Flag;
+ UINT16 Value;
+ BOOLEAN Flag;
ASSERT ((Port & 1) == 0);
@@ -146,6 +176,7 @@ IoRead16 (
Value = _inpw ((UINT16)Port);
_ReadWriteBarrier ();
}
+
FilterBeforeIoRead (FilterWidth16, Port, &Value);
return Value;
@@ -170,20 +201,21 @@ IoRead16 (
UINT16
EFIAPI
IoWrite16 (
- IN UINTN Port,
- IN UINT16 Value
+ IN UINTN Port,
+ IN UINT16 Value
)
{
- BOOLEAN Flag;
+ BOOLEAN Flag;
ASSERT ((Port & 1) == 0);
- Flag = FilterBeforeIoWrite(FilterWidth16, Port, &Value);
+ Flag = FilterBeforeIoWrite (FilterWidth16, Port, &Value);
if (Flag) {
_ReadWriteBarrier ();
_outpw ((UINT16)Port, Value);
_ReadWriteBarrier ();
}
+
FilterAfterIoWrite (FilterWidth16, Port, &Value);
return Value;
@@ -207,20 +239,21 @@ IoWrite16 (
UINT32
EFIAPI
IoRead32 (
- IN UINTN Port
+ IN UINTN Port
)
{
- UINT32 Value;
- BOOLEAN Flag;
+ UINT32 Value;
+ BOOLEAN Flag;
ASSERT ((Port & 3) == 0);
- Flag = FilterBeforeIoRead(FilterWidth32, Port, &Value);
+ Flag = FilterBeforeIoRead (FilterWidth32, Port, &Value);
if (Flag) {
_ReadWriteBarrier ();
Value = _inpd ((UINT16)Port);
_ReadWriteBarrier ();
}
+
FilterAfterIoRead (FilterWidth32, Port, &Value);
return Value;
@@ -245,20 +278,21 @@ IoRead32 (
UINT32
EFIAPI
IoWrite32 (
- IN UINTN Port,
- IN UINT32 Value
+ IN UINTN Port,
+ IN UINT32 Value
)
{
- BOOLEAN Flag;
+ BOOLEAN Flag;
ASSERT ((Port & 3) == 0);
- Flag = FilterBeforeIoWrite(FilterWidth32, Port, &Value);
+ Flag = FilterBeforeIoWrite (FilterWidth32, Port, &Value);
if (Flag) {
_ReadWriteBarrier ();
_outpd ((UINT16)Port, Value);
_ReadWriteBarrier ();
}
+
FilterAfterIoWrite (FilterWidth32, Port, &Value);
return Value;
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibNoIo.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibNoIo.c
index 291cd86eaa..c71f45b22e 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibNoIo.c
+++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibNoIo.c
@@ -11,7 +11,6 @@
**/
-
//
// Include common header file for this module.
//
@@ -34,7 +33,7 @@
UINT8
EFIAPI
IoRead8 (
- IN UINTN Port
+ IN UINTN Port
)
{
ASSERT (FALSE);
@@ -59,8 +58,8 @@ IoRead8 (
UINT8
EFIAPI
IoWrite8 (
- IN UINTN Port,
- IN UINT8 Value
+ IN UINTN Port,
+ IN UINT8 Value
)
{
ASSERT (FALSE);
@@ -84,7 +83,7 @@ IoWrite8 (
UINT16
EFIAPI
IoRead16 (
- IN UINTN Port
+ IN UINTN Port
)
{
ASSERT (FALSE);
@@ -109,8 +108,8 @@ IoRead16 (
UINT16
EFIAPI
IoWrite16 (
- IN UINTN Port,
- IN UINT16 Value
+ IN UINTN Port,
+ IN UINT16 Value
)
{
ASSERT (FALSE);
@@ -134,7 +133,7 @@ IoWrite16 (
UINT32
EFIAPI
IoRead32 (
- IN UINTN Port
+ IN UINTN Port
)
{
ASSERT (FALSE);
@@ -159,8 +158,8 @@ IoRead32 (
UINT32
EFIAPI
IoWrite32 (
- IN UINTN Port,
- IN UINT32 Value
+ IN UINTN Port,
+ IN UINT32 Value
)
{
ASSERT (FALSE);
@@ -185,7 +184,7 @@ IoWrite32 (
UINT64
EFIAPI
IoRead64 (
- IN UINTN Port
+ IN UINTN Port
)
{
ASSERT (FALSE);
@@ -211,8 +210,8 @@ IoRead64 (
UINT64
EFIAPI
IoWrite64 (
- IN UINTN Port,
- IN UINT64 Value
+ IN UINTN Port,
+ IN UINT64 Value
)
{
ASSERT (FALSE);
@@ -239,9 +238,9 @@ IoWrite64 (
VOID
EFIAPI
IoReadFifo8 (
- IN UINTN Port,
- IN UINTN Count,
- OUT VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ OUT VOID *Buffer
)
{
ASSERT (FALSE);
@@ -267,9 +266,9 @@ IoReadFifo8 (
VOID
EFIAPI
IoWriteFifo8 (
- IN UINTN Port,
- IN UINTN Count,
- IN VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ IN VOID *Buffer
)
{
ASSERT (FALSE);
@@ -295,9 +294,9 @@ IoWriteFifo8 (
VOID
EFIAPI
IoReadFifo16 (
- IN UINTN Port,
- IN UINTN Count,
- OUT VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ OUT VOID *Buffer
)
{
ASSERT (FALSE);
@@ -323,9 +322,9 @@ IoReadFifo16 (
VOID
EFIAPI
IoWriteFifo16 (
- IN UINTN Port,
- IN UINTN Count,
- IN VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ IN VOID *Buffer
)
{
ASSERT (FALSE);
@@ -351,9 +350,9 @@ IoWriteFifo16 (
VOID
EFIAPI
IoReadFifo32 (
- IN UINTN Port,
- IN UINTN Count,
- OUT VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ OUT VOID *Buffer
)
{
ASSERT (FALSE);
@@ -379,9 +378,9 @@ IoReadFifo32 (
VOID
EFIAPI
IoWriteFifo32 (
- IN UINTN Port,
- IN UINTN Count,
- IN VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ IN VOID *Buffer
)
{
ASSERT (FALSE);
@@ -404,16 +403,17 @@ IoWriteFifo32 (
UINT8
EFIAPI
MmioRead8 (
- IN UINTN Address
+ IN UINTN Address
)
{
- UINT8 Value;
- BOOLEAN Flag;
+ UINT8 Value;
+ BOOLEAN Flag;
Flag = FilterBeforeMmIoRead (FilterWidth8, Address, &Value);
if (Flag) {
- Value = *(volatile UINT8*)Address;
+ Value = *(volatile UINT8 *)Address;
}
+
FilterAfterMmIoRead (FilterWidth8, Address, &Value);
return Value;
@@ -435,16 +435,17 @@ MmioRead8 (
UINT8
EFIAPI
MmioWrite8 (
- IN UINTN Address,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINT8 Value
)
{
- BOOLEAN Flag;
+ BOOLEAN Flag;
Flag = FilterBeforeMmIoWrite (FilterWidth8, Address, &Value);
if (Flag) {
- *(volatile UINT8*)Address = Value;
+ *(volatile UINT8 *)Address = Value;
}
+
FilterAfterMmIoWrite (FilterWidth8, Address, &Value);
return Value;
@@ -467,18 +468,19 @@ MmioWrite8 (
UINT16
EFIAPI
MmioRead16 (
- IN UINTN Address
+ IN UINTN Address
)
{
- UINT16 Value;
- BOOLEAN Flag;
+ UINT16 Value;
+ BOOLEAN Flag;
ASSERT ((Address & 1) == 0);
Flag = FilterBeforeMmIoRead (FilterWidth16, Address, &Value);
if (Flag) {
- Value = *(volatile UINT16*)Address;
+ Value = *(volatile UINT16 *)Address;
}
+
FilterAfterMmIoRead (FilterWidth16, Address, &Value);
return Value;
@@ -500,18 +502,19 @@ MmioRead16 (
UINT16
EFIAPI
MmioWrite16 (
- IN UINTN Address,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINT16 Value
)
{
- BOOLEAN Flag;
+ BOOLEAN Flag;
ASSERT ((Address & 1) == 0);
Flag = FilterBeforeMmIoWrite (FilterWidth16, Address, &Value);
if (Flag) {
- *(volatile UINT16*)Address = Value;
+ *(volatile UINT16 *)Address = Value;
}
+
FilterAfterMmIoWrite (FilterWidth16, Address, &Value);
return Value;
@@ -534,18 +537,19 @@ MmioWrite16 (
UINT32
EFIAPI
MmioRead32 (
- IN UINTN Address
+ IN UINTN Address
)
{
- UINT32 Value;
- BOOLEAN Flag;
+ UINT32 Value;
+ BOOLEAN Flag;
ASSERT ((Address & 3) == 0);
Flag = FilterBeforeMmIoRead (FilterWidth32, Address, &Value);
if (Flag) {
- Value = *(volatile UINT32*)Address;
+ Value = *(volatile UINT32 *)Address;
}
+
FilterAfterMmIoRead (FilterWidth32, Address, &Value);
return Value;
@@ -567,18 +571,19 @@ MmioRead32 (
UINT32
EFIAPI
MmioWrite32 (
- IN UINTN Address,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINT32 Value
)
{
- BOOLEAN Flag;
+ BOOLEAN Flag;
ASSERT ((Address & 3) == 0);
Flag = FilterBeforeMmIoWrite (FilterWidth32, Address, &Value);
if (Flag) {
- *(volatile UINT32*)Address = Value;
+ *(volatile UINT32 *)Address = Value;
}
+
FilterAfterMmIoWrite (FilterWidth32, Address, &Value);
return Value;
@@ -601,18 +606,19 @@ MmioWrite32 (
UINT64
EFIAPI
MmioRead64 (
- IN UINTN Address
+ IN UINTN Address
)
{
- UINT64 Value;
- BOOLEAN Flag;
+ UINT64 Value;
+ BOOLEAN Flag;
ASSERT ((Address & 7) == 0);
Flag = FilterBeforeMmIoRead (FilterWidth64, Address, &Value);
if (Flag) {
- Value = *(volatile UINT64*)Address;
+ Value = *(volatile UINT64 *)Address;
}
+
FilterAfterMmIoRead (FilterWidth64, Address, &Value);
return Value;
@@ -634,20 +640,20 @@ MmioRead64 (
UINT64
EFIAPI
MmioWrite64 (
- IN UINTN Address,
- IN UINT64 Value
+ IN UINTN Address,
+ IN UINT64 Value
)
{
- BOOLEAN Flag;
+ BOOLEAN Flag;
ASSERT ((Address & 7) == 0);
Flag = FilterBeforeMmIoWrite (FilterWidth64, Address, &Value);
if (Flag) {
- *(volatile UINT64*)Address = Value;
+ *(volatile UINT64 *)Address = Value;
}
+
FilterAfterMmIoWrite (FilterWidth64, Address, &Value);
return Value;
}
-
diff --git a/MdePkg/Library/BaseLib/ARShiftU64.c b/MdePkg/Library/BaseLib/ARShiftU64.c
index 9928854ddf..ce1dfe9496 100644
--- a/MdePkg/Library/BaseLib/ARShiftU64.c
+++ b/MdePkg/Library/BaseLib/ARShiftU64.c
@@ -26,8 +26,8 @@
UINT64
EFIAPI
ARShiftU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
ASSERT (Count < 64);
diff --git a/MdePkg/Library/BaseLib/Arm/InternalSwitchStack.c b/MdePkg/Library/BaseLib/Arm/InternalSwitchStack.c
index 034ee041f3..258e39732e 100644
--- a/MdePkg/Library/BaseLib/Arm/InternalSwitchStack.c
+++ b/MdePkg/Library/BaseLib/Arm/InternalSwitchStack.c
@@ -33,7 +33,6 @@ InternalSwitchStackAsm (
IN VOID *NewStack
);
-
/**
Transfers control to a function starting with a new stack.
diff --git a/MdePkg/Library/BaseLib/Arm/Unaligned.c b/MdePkg/Library/BaseLib/Arm/Unaligned.c
index e9934e7003..73b7a78f5b 100644
--- a/MdePkg/Library/BaseLib/Arm/Unaligned.c
+++ b/MdePkg/Library/BaseLib/Arm/Unaligned.c
@@ -27,16 +27,16 @@
UINT16
EFIAPI
ReadUnaligned16 (
- IN CONST UINT16 *Buffer
+ IN CONST UINT16 *Buffer
)
{
- volatile UINT8 LowerByte;
- volatile UINT8 HigherByte;
+ volatile UINT8 LowerByte;
+ volatile UINT8 HigherByte;
ASSERT (Buffer != NULL);
- LowerByte = ((UINT8*)Buffer)[0];
- HigherByte = ((UINT8*)Buffer)[1];
+ LowerByte = ((UINT8 *)Buffer)[0];
+ HigherByte = ((UINT8 *)Buffer)[1];
return (UINT16)(LowerByte | (HigherByte << 8));
}
@@ -59,14 +59,14 @@ ReadUnaligned16 (
UINT16
EFIAPI
WriteUnaligned16 (
- OUT UINT16 *Buffer,
- IN UINT16 Value
+ OUT UINT16 *Buffer,
+ IN UINT16 Value
)
{
ASSERT (Buffer != NULL);
- ((volatile UINT8*)Buffer)[0] = (UINT8)Value;
- ((volatile UINT8*)Buffer)[1] = (UINT8)(Value >> 8);
+ ((volatile UINT8 *)Buffer)[0] = (UINT8)Value;
+ ((volatile UINT8 *)Buffer)[1] = (UINT8)(Value >> 8);
return Value;
}
@@ -87,15 +87,15 @@ WriteUnaligned16 (
UINT32
EFIAPI
ReadUnaligned24 (
- IN CONST UINT32 *Buffer
+ IN CONST UINT32 *Buffer
)
{
ASSERT (Buffer != NULL);
return (UINT32)(
- ReadUnaligned16 ((UINT16*)Buffer) |
- (((UINT8*)Buffer)[2] << 16)
- );
+ ReadUnaligned16 ((UINT16 *)Buffer) |
+ (((UINT8 *)Buffer)[2] << 16)
+ );
}
/**
@@ -116,14 +116,14 @@ ReadUnaligned24 (
UINT32
EFIAPI
WriteUnaligned24 (
- OUT UINT32 *Buffer,
- IN UINT32 Value
+ OUT UINT32 *Buffer,
+ IN UINT32 Value
)
{
ASSERT (Buffer != NULL);
- WriteUnaligned16 ((UINT16*)Buffer, (UINT16)Value);
- *(UINT8*)((UINT16*)Buffer + 1) = (UINT8)(Value >> 16);
+ WriteUnaligned16 ((UINT16 *)Buffer, (UINT16)Value);
+ *(UINT8 *)((UINT16 *)Buffer + 1) = (UINT8)(Value >> 16);
return Value;
}
@@ -143,7 +143,7 @@ WriteUnaligned24 (
UINT32
EFIAPI
ReadUnaligned32 (
- IN CONST UINT32 *Buffer
+ IN CONST UINT32 *Buffer
)
{
UINT16 LowerBytes;
@@ -151,10 +151,10 @@ ReadUnaligned32 (
ASSERT (Buffer != NULL);
- LowerBytes = ReadUnaligned16 ((UINT16*) Buffer);
- HigherBytes = ReadUnaligned16 ((UINT16*) Buffer + 1);
+ LowerBytes = ReadUnaligned16 ((UINT16 *)Buffer);
+ HigherBytes = ReadUnaligned16 ((UINT16 *)Buffer + 1);
- return (UINT32) (LowerBytes | (HigherBytes << 16));
+ return (UINT32)(LowerBytes | (HigherBytes << 16));
}
/**
@@ -175,14 +175,14 @@ ReadUnaligned32 (
UINT32
EFIAPI
WriteUnaligned32 (
- OUT UINT32 *Buffer,
- IN UINT32 Value
+ OUT UINT32 *Buffer,
+ IN UINT32 Value
)
{
ASSERT (Buffer != NULL);
- WriteUnaligned16 ((UINT16*)Buffer, (UINT16)Value);
- WriteUnaligned16 ((UINT16*)Buffer + 1, (UINT16)(Value >> 16));
+ WriteUnaligned16 ((UINT16 *)Buffer, (UINT16)Value);
+ WriteUnaligned16 ((UINT16 *)Buffer + 1, (UINT16)(Value >> 16));
return Value;
}
@@ -202,7 +202,7 @@ WriteUnaligned32 (
UINT64
EFIAPI
ReadUnaligned64 (
- IN CONST UINT64 *Buffer
+ IN CONST UINT64 *Buffer
)
{
UINT32 LowerBytes;
@@ -210,10 +210,10 @@ ReadUnaligned64 (
ASSERT (Buffer != NULL);
- LowerBytes = ReadUnaligned32 ((UINT32*) Buffer);
- HigherBytes = ReadUnaligned32 ((UINT32*) Buffer + 1);
+ LowerBytes = ReadUnaligned32 ((UINT32 *)Buffer);
+ HigherBytes = ReadUnaligned32 ((UINT32 *)Buffer + 1);
- return (UINT64) (LowerBytes | LShiftU64 (HigherBytes, 32));
+ return (UINT64)(LowerBytes | LShiftU64 (HigherBytes, 32));
}
/**
@@ -234,13 +234,13 @@ ReadUnaligned64 (
UINT64
EFIAPI
WriteUnaligned64 (
- OUT UINT64 *Buffer,
- IN UINT64 Value
+ OUT UINT64 *Buffer,
+ IN UINT64 Value
)
{
ASSERT (Buffer != NULL);
- WriteUnaligned32 ((UINT32*)Buffer, (UINT32)Value);
- WriteUnaligned32 ((UINT32*)Buffer + 1, (UINT32)RShiftU64 (Value, 32));
+ WriteUnaligned32 ((UINT32 *)Buffer, (UINT32)Value);
+ WriteUnaligned32 ((UINT32 *)Buffer + 1, (UINT32)RShiftU64 (Value, 32));
return Value;
}
diff --git a/MdePkg/Library/BaseLib/BaseLibInternals.h b/MdePkg/Library/BaseLib/BaseLibInternals.h
index 13ac982e92..d61e604385 100644
--- a/MdePkg/Library/BaseLib/BaseLibInternals.h
+++ b/MdePkg/Library/BaseLib/BaseLibInternals.h
@@ -35,8 +35,8 @@
UINT64
EFIAPI
InternalMathLShiftU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
);
/**
@@ -55,8 +55,8 @@ InternalMathLShiftU64 (
UINT64
EFIAPI
InternalMathRShiftU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
);
/**
@@ -75,8 +75,8 @@ InternalMathRShiftU64 (
UINT64
EFIAPI
InternalMathARShiftU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
);
/**
@@ -96,8 +96,8 @@ InternalMathARShiftU64 (
UINT64
EFIAPI
InternalMathLRotU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
);
/**
@@ -117,8 +117,8 @@ InternalMathLRotU64 (
UINT64
EFIAPI
InternalMathRRotU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
);
/**
@@ -136,7 +136,7 @@ InternalMathRRotU64 (
UINT64
EFIAPI
InternalMathSwapBytes64 (
- IN UINT64 Operand
+ IN UINT64 Operand
);
/**
@@ -156,8 +156,8 @@ InternalMathSwapBytes64 (
UINT64
EFIAPI
InternalMathMultU64x32 (
- IN UINT64 Multiplicand,
- IN UINT32 Multiplier
+ IN UINT64 Multiplicand,
+ IN UINT32 Multiplier
);
/**
@@ -177,8 +177,8 @@ InternalMathMultU64x32 (
UINT64
EFIAPI
InternalMathMultU64x64 (
- IN UINT64 Multiplicand,
- IN UINT64 Multiplier
+ IN UINT64 Multiplicand,
+ IN UINT64 Multiplier
);
/**
@@ -198,8 +198,8 @@ InternalMathMultU64x64 (
UINT64
EFIAPI
InternalMathDivU64x32 (
- IN UINT64 Dividend,
- IN UINT32 Divisor
+ IN UINT64 Dividend,
+ IN UINT32 Divisor
);
/**
@@ -219,8 +219,8 @@ InternalMathDivU64x32 (
UINT32
EFIAPI
InternalMathModU64x32 (
- IN UINT64 Dividend,
- IN UINT32 Divisor
+ IN UINT64 Dividend,
+ IN UINT32 Divisor
);
/**
@@ -243,9 +243,9 @@ InternalMathModU64x32 (
UINT64
EFIAPI
InternalMathDivRemU64x32 (
- IN UINT64 Dividend,
- IN UINT32 Divisor,
- OUT UINT32 *Remainder OPTIONAL
+ IN UINT64 Dividend,
+ IN UINT32 Divisor,
+ OUT UINT32 *Remainder OPTIONAL
);
/**
@@ -268,9 +268,9 @@ InternalMathDivRemU64x32 (
UINT64
EFIAPI
InternalMathDivRemU64x64 (
- IN UINT64 Dividend,
- IN UINT64 Divisor,
- OUT UINT64 *Remainder OPTIONAL
+ IN UINT64 Dividend,
+ IN UINT64 Divisor,
+ OUT UINT64 *Remainder OPTIONAL
);
/**
@@ -293,9 +293,9 @@ InternalMathDivRemU64x64 (
INT64
EFIAPI
InternalMathDivRemS64x64 (
- IN INT64 Dividend,
- IN INT64 Divisor,
- OUT INT64 *Remainder OPTIONAL
+ IN INT64 Dividend,
+ IN INT64 Divisor,
+ OUT INT64 *Remainder OPTIONAL
);
/**
@@ -332,7 +332,6 @@ InternalSwitchStack (
IN VA_LIST Marker
);
-
/**
Worker function that returns a bit field from Operand.
@@ -348,12 +347,11 @@ InternalSwitchStack (
UINTN
EFIAPI
BitFieldReadUint (
- IN UINTN Operand,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit
);
-
/**
Worker function that reads a bit field from Operand, performs a bitwise OR,
and returns the result.
@@ -373,13 +371,12 @@ BitFieldReadUint (
UINTN
EFIAPI
BitFieldOrUint (
- IN UINTN Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINTN OrData
+ IN UINTN Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINTN OrData
);
-
/**
Worker function that reads a bit field from Operand, performs a bitwise AND,
and returns the result.
@@ -399,13 +396,12 @@ BitFieldOrUint (
UINTN
EFIAPI
BitFieldAndUint (
- IN UINTN Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINTN AndData
+ IN UINTN Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINTN AndData
);
-
/**
Worker function that checks ASSERT condition for JumpBuffer
@@ -423,7 +419,6 @@ InternalAssertJumpBuffer (
IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
);
-
/**
Restores the CPU context that was saved with SetJump().
@@ -442,7 +437,6 @@ InternalLongJump (
IN UINTN Value
);
-
/**
Check if a Unicode character is a decimal character.
@@ -459,10 +453,9 @@ InternalLongJump (
BOOLEAN
EFIAPI
InternalIsDecimalDigitCharacter (
- IN CHAR16 Char
+ IN CHAR16 Char
);
-
/**
Convert a Unicode character to numerical value.
@@ -479,10 +472,9 @@ InternalIsDecimalDigitCharacter (
UINTN
EFIAPI
InternalHexCharToUintn (
- IN CHAR16 Char
+ IN CHAR16 Char
);
-
/**
Check if a Unicode character is a hexadecimal character.
@@ -500,10 +492,9 @@ InternalHexCharToUintn (
BOOLEAN
EFIAPI
InternalIsHexaDecimalDigitCharacter (
- IN CHAR16 Char
+ IN CHAR16 Char
);
-
/**
Check if a ASCII character is a decimal character.
@@ -520,10 +511,9 @@ InternalIsHexaDecimalDigitCharacter (
BOOLEAN
EFIAPI
InternalAsciiIsDecimalDigitCharacter (
- IN CHAR8 Char
+ IN CHAR8 Char
);
-
/**
Check if a ASCII character is a hexadecimal character.
@@ -541,10 +531,9 @@ InternalAsciiIsDecimalDigitCharacter (
BOOLEAN
EFIAPI
InternalAsciiIsHexaDecimalDigitCharacter (
- IN CHAR8 Char
+ IN CHAR8 Char
);
-
/**
Convert a ASCII character to numerical value.
@@ -561,10 +550,9 @@ InternalAsciiIsHexaDecimalDigitCharacter (
UINTN
EFIAPI
InternalAsciiHexCharToUintn (
- IN CHAR8 Char
+ IN CHAR8 Char
);
-
//
// Ia32 and x64 specific functions
//
@@ -582,7 +570,7 @@ InternalAsciiHexCharToUintn (
VOID
EFIAPI
InternalX86ReadGdtr (
- OUT IA32_DESCRIPTOR *Gdtr
+ OUT IA32_DESCRIPTOR *Gdtr
);
/**
@@ -597,7 +585,7 @@ InternalX86ReadGdtr (
VOID
EFIAPI
InternalX86WriteGdtr (
- IN CONST IA32_DESCRIPTOR *Gdtr
+ IN CONST IA32_DESCRIPTOR *Gdtr
);
/**
@@ -612,7 +600,7 @@ InternalX86WriteGdtr (
VOID
EFIAPI
InternalX86ReadIdtr (
- OUT IA32_DESCRIPTOR *Idtr
+ OUT IA32_DESCRIPTOR *Idtr
);
/**
@@ -627,7 +615,7 @@ InternalX86ReadIdtr (
VOID
EFIAPI
InternalX86WriteIdtr (
- IN CONST IA32_DESCRIPTOR *Idtr
+ IN CONST IA32_DESCRIPTOR *Idtr
);
/**
@@ -643,7 +631,7 @@ InternalX86WriteIdtr (
VOID
EFIAPI
InternalX86FxSave (
- OUT IA32_FX_BUFFER *Buffer
+ OUT IA32_FX_BUFFER *Buffer
);
/**
@@ -659,7 +647,7 @@ InternalX86FxSave (
VOID
EFIAPI
InternalX86FxRestore (
- IN CONST IA32_FX_BUFFER *Buffer
+ IN CONST IA32_FX_BUFFER *Buffer
);
/**
@@ -773,11 +761,11 @@ InternalX86DisablePaging32 (
VOID
EFIAPI
InternalX86EnablePaging64 (
- IN UINT16 Cs,
- IN UINT64 EntryPoint,
- IN UINT64 Context1 OPTIONAL,
- IN UINT64 Context2 OPTIONAL,
- IN UINT64 NewStack
+ IN UINT16 Cs,
+ IN UINT64 EntryPoint,
+ IN UINT64 Context1 OPTIONAL,
+ IN UINT64 Context2 OPTIONAL,
+ IN UINT64 NewStack
);
/**
@@ -809,11 +797,11 @@ InternalX86EnablePaging64 (
VOID
EFIAPI
InternalX86DisablePaging64 (
- IN UINT16 Cs,
- IN UINT32 EntryPoint,
- IN UINT32 Context1 OPTIONAL,
- IN UINT32 Context2 OPTIONAL,
- IN UINT32 NewStack
+ IN UINT16 Cs,
+ IN UINT32 EntryPoint,
+ IN UINT32 Context1 OPTIONAL,
+ IN UINT32 Context2 OPTIONAL,
+ IN UINT32 NewStack
);
/**
@@ -828,7 +816,7 @@ InternalX86DisablePaging64 (
BOOLEAN
EFIAPI
InternalX86RdRand16 (
- OUT UINT16 *Rand
+ OUT UINT16 *Rand
);
/**
@@ -843,7 +831,7 @@ InternalX86RdRand16 (
BOOLEAN
EFIAPI
InternalX86RdRand32 (
- OUT UINT32 *Rand
+ OUT UINT32 *Rand
);
/**
@@ -859,7 +847,7 @@ InternalX86RdRand32 (
BOOLEAN
EFIAPI
InternalX86RdRand64 (
- OUT UINT64 *Rand
+ OUT UINT64 *Rand
);
#else
diff --git a/MdePkg/Library/BaseLib/BitField.c b/MdePkg/Library/BaseLib/BitField.c
index 0f48a036ba..862af53e9c 100644
--- a/MdePkg/Library/BaseLib/BitField.c
+++ b/MdePkg/Library/BaseLib/BitField.c
@@ -23,9 +23,9 @@
UINTN
EFIAPI
InternalBaseLibBitFieldReadUint (
- IN UINTN Operand,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
//
@@ -56,10 +56,10 @@ InternalBaseLibBitFieldReadUint (
UINTN
EFIAPI
InternalBaseLibBitFieldOrUint (
- IN UINTN Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINTN OrData
+ IN UINTN Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINTN OrData
)
{
//
@@ -74,7 +74,7 @@ InternalBaseLibBitFieldOrUint (
// ~((UINTN)-2 << EndBit) is a mask in which bit[0] thru bit[EndBit]
// are 1's while bit[EndBit + 1] thru the most significant bit are 0's.
//
- return Operand | ((OrData << StartBit) & ~((UINTN) -2 << EndBit));
+ return Operand | ((OrData << StartBit) & ~((UINTN)-2 << EndBit));
}
/**
@@ -98,10 +98,10 @@ InternalBaseLibBitFieldOrUint (
UINTN
EFIAPI
InternalBaseLibBitFieldAndUint (
- IN UINTN Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINTN AndData
+ IN UINTN Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINTN AndData
)
{
//
@@ -141,9 +141,9 @@ InternalBaseLibBitFieldAndUint (
UINT8
EFIAPI
BitFieldRead8 (
- IN UINT8 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT8 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
ASSERT (EndBit < 8);
@@ -177,10 +177,10 @@ BitFieldRead8 (
UINT8
EFIAPI
BitFieldWrite8 (
- IN UINT8 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINT8 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
ASSERT (EndBit < 8);
@@ -215,10 +215,10 @@ BitFieldWrite8 (
UINT8
EFIAPI
BitFieldOr8 (
- IN UINT8 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINT8 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
ASSERT (EndBit < 8);
@@ -253,10 +253,10 @@ BitFieldOr8 (
UINT8
EFIAPI
BitFieldAnd8 (
- IN UINT8 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINT8 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
ASSERT (EndBit < 8);
@@ -294,11 +294,11 @@ BitFieldAnd8 (
UINT8
EFIAPI
BitFieldAndThenOr8 (
- IN UINT8 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINT8 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
ASSERT (EndBit < 8);
@@ -333,9 +333,9 @@ BitFieldAndThenOr8 (
UINT16
EFIAPI
BitFieldRead16 (
- IN UINT16 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT16 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
ASSERT (EndBit < 16);
@@ -369,10 +369,10 @@ BitFieldRead16 (
UINT16
EFIAPI
BitFieldWrite16 (
- IN UINT16 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINT16 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
ASSERT (EndBit < 16);
@@ -407,10 +407,10 @@ BitFieldWrite16 (
UINT16
EFIAPI
BitFieldOr16 (
- IN UINT16 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINT16 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
ASSERT (EndBit < 16);
@@ -445,10 +445,10 @@ BitFieldOr16 (
UINT16
EFIAPI
BitFieldAnd16 (
- IN UINT16 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINT16 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
ASSERT (EndBit < 16);
@@ -486,11 +486,11 @@ BitFieldAnd16 (
UINT16
EFIAPI
BitFieldAndThenOr16 (
- IN UINT16 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINT16 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
ASSERT (EndBit < 16);
@@ -525,9 +525,9 @@ BitFieldAndThenOr16 (
UINT32
EFIAPI
BitFieldRead32 (
- IN UINT32 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT32 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
ASSERT (EndBit < 32);
@@ -561,10 +561,10 @@ BitFieldRead32 (
UINT32
EFIAPI
BitFieldWrite32 (
- IN UINT32 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINT32 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
ASSERT (EndBit < 32);
@@ -599,10 +599,10 @@ BitFieldWrite32 (
UINT32
EFIAPI
BitFieldOr32 (
- IN UINT32 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINT32 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
ASSERT (EndBit < 32);
@@ -637,10 +637,10 @@ BitFieldOr32 (
UINT32
EFIAPI
BitFieldAnd32 (
- IN UINT32 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINT32 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
ASSERT (EndBit < 32);
@@ -678,11 +678,11 @@ BitFieldAnd32 (
UINT32
EFIAPI
BitFieldAndThenOr32 (
- IN UINT32 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINT32 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
ASSERT (EndBit < 32);
@@ -717,9 +717,9 @@ BitFieldAndThenOr32 (
UINT64
EFIAPI
BitFieldRead64 (
- IN UINT64 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT64 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
ASSERT (EndBit < 64);
@@ -753,10 +753,10 @@ BitFieldRead64 (
UINT64
EFIAPI
BitFieldWrite64 (
- IN UINT64 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 Value
+ IN UINT64 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 Value
)
{
ASSERT (EndBit < 64);
@@ -791,10 +791,10 @@ BitFieldWrite64 (
UINT64
EFIAPI
BitFieldOr64 (
- IN UINT64 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 OrData
+ IN UINT64 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 OrData
)
{
UINT64 Value1;
@@ -811,7 +811,7 @@ BitFieldOr64 (
ASSERT (RShiftU64 (OrData, EndBit - StartBit) == (RShiftU64 (OrData, EndBit - StartBit) & 1));
Value1 = LShiftU64 (OrData, StartBit);
- Value2 = LShiftU64 ((UINT64) - 2, EndBit);
+ Value2 = LShiftU64 ((UINT64)-2, EndBit);
return Operand | (Value1 & ~Value2);
}
@@ -843,10 +843,10 @@ BitFieldOr64 (
UINT64
EFIAPI
BitFieldAnd64 (
- IN UINT64 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData
+ IN UINT64 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData
)
{
UINT64 Value1;
@@ -898,11 +898,11 @@ BitFieldAnd64 (
UINT64
EFIAPI
BitFieldAndThenOr64 (
- IN UINT64 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData,
- IN UINT64 OrData
+ IN UINT64 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData,
+ IN UINT64 OrData
)
{
ASSERT (EndBit < 64);
@@ -938,25 +938,25 @@ BitFieldAndThenOr64 (
UINT8
EFIAPI
BitFieldCountOnes32 (
- IN UINT32 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT32 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
- UINT32 Count;
+ UINT32 Count;
ASSERT (EndBit < 32);
ASSERT (StartBit <= EndBit);
- Count = BitFieldRead32 (Operand, StartBit, EndBit);
+ Count = BitFieldRead32 (Operand, StartBit, EndBit);
Count -= ((Count >> 1) & 0x55555555);
- Count = (Count & 0x33333333) + ((Count >> 2) & 0x33333333);
+ Count = (Count & 0x33333333) + ((Count >> 2) & 0x33333333);
Count += Count >> 4;
Count &= 0x0F0F0F0F;
Count += Count >> 8;
Count += Count >> 16;
- return (UINT8) Count & 0x3F;
+ return (UINT8)Count & 0x3F;
}
/**
@@ -982,21 +982,20 @@ BitFieldCountOnes32 (
UINT8
EFIAPI
BitFieldCountOnes64 (
- IN UINT64 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT64 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
- UINT64 BitField;
- UINT8 Count;
+ UINT64 BitField;
+ UINT8 Count;
ASSERT (EndBit < 64);
ASSERT (StartBit <= EndBit);
BitField = BitFieldRead64 (Operand, StartBit, EndBit);
- Count = BitFieldCountOnes32 ((UINT32) BitField, 0, 31);
- Count += BitFieldCountOnes32 ((UINT32) RShiftU64(BitField, 32), 0, 31);
+ Count = BitFieldCountOnes32 ((UINT32)BitField, 0, 31);
+ Count += BitFieldCountOnes32 ((UINT32)RShiftU64 (BitField, 32), 0, 31);
return Count;
}
-
diff --git a/MdePkg/Library/BaseLib/CheckSum.c b/MdePkg/Library/BaseLib/CheckSum.c
index d91a7a07c7..28dee5ac6a 100644
--- a/MdePkg/Library/BaseLib/CheckSum.c
+++ b/MdePkg/Library/BaseLib/CheckSum.c
@@ -30,24 +30,23 @@
UINT8
EFIAPI
CalculateSum8 (
- IN CONST UINT8 *Buffer,
- IN UINTN Length
+ IN CONST UINT8 *Buffer,
+ IN UINTN Length
)
{
- UINT8 Sum;
- UINTN Count;
+ UINT8 Sum;
+ UINTN Count;
ASSERT (Buffer != NULL);
- ASSERT (Length <= (MAX_ADDRESS - ((UINTN) Buffer) + 1));
+ ASSERT (Length <= (MAX_ADDRESS - ((UINTN)Buffer) + 1));
for (Sum = 0, Count = 0; Count < Length; Count++) {
- Sum = (UINT8) (Sum + *(Buffer + Count));
+ Sum = (UINT8)(Sum + *(Buffer + Count));
}
return Sum;
}
-
/**
Returns the two's complement checksum of all elements in a buffer
of 8-bit values.
@@ -69,18 +68,18 @@ CalculateSum8 (
UINT8
EFIAPI
CalculateCheckSum8 (
- IN CONST UINT8 *Buffer,
- IN UINTN Length
+ IN CONST UINT8 *Buffer,
+ IN UINTN Length
)
{
- UINT8 CheckSum;
+ UINT8 CheckSum;
CheckSum = CalculateSum8 (Buffer, Length);
//
// Return the checksum based on 2's complement.
//
- return (UINT8) (0x100 - CheckSum);
+ return (UINT8)(0x100 - CheckSum);
}
/**
@@ -105,28 +104,27 @@ CalculateCheckSum8 (
UINT16
EFIAPI
CalculateSum16 (
- IN CONST UINT16 *Buffer,
- IN UINTN Length
+ IN CONST UINT16 *Buffer,
+ IN UINTN Length
)
{
- UINT16 Sum;
- UINTN Count;
- UINTN Total;
+ UINT16 Sum;
+ UINTN Count;
+ UINTN Total;
ASSERT (Buffer != NULL);
- ASSERT (((UINTN) Buffer & 0x1) == 0);
+ ASSERT (((UINTN)Buffer & 0x1) == 0);
ASSERT ((Length & 0x1) == 0);
- ASSERT (Length <= (MAX_ADDRESS - ((UINTN) Buffer) + 1));
+ ASSERT (Length <= (MAX_ADDRESS - ((UINTN)Buffer) + 1));
Total = Length / sizeof (*Buffer);
for (Sum = 0, Count = 0; Count < Total; Count++) {
- Sum = (UINT16) (Sum + *(Buffer + Count));
+ Sum = (UINT16)(Sum + *(Buffer + Count));
}
return Sum;
}
-
/**
Returns the two's complement checksum of all elements in a buffer of
16-bit values.
@@ -150,21 +148,20 @@ CalculateSum16 (
UINT16
EFIAPI
CalculateCheckSum16 (
- IN CONST UINT16 *Buffer,
- IN UINTN Length
+ IN CONST UINT16 *Buffer,
+ IN UINTN Length
)
{
- UINT16 CheckSum;
+ UINT16 CheckSum;
CheckSum = CalculateSum16 (Buffer, Length);
//
// Return the checksum based on 2's complement.
//
- return (UINT16) (0x10000 - CheckSum);
+ return (UINT16)(0x10000 - CheckSum);
}
-
/**
Returns the sum of all elements in a buffer of 32-bit values. During
calculation, the carry bits are dropped.
@@ -187,18 +184,18 @@ CalculateCheckSum16 (
UINT32
EFIAPI
CalculateSum32 (
- IN CONST UINT32 *Buffer,
- IN UINTN Length
+ IN CONST UINT32 *Buffer,
+ IN UINTN Length
)
{
- UINT32 Sum;
- UINTN Count;
- UINTN Total;
+ UINT32 Sum;
+ UINTN Count;
+ UINTN Total;
ASSERT (Buffer != NULL);
- ASSERT (((UINTN) Buffer & 0x3) == 0);
+ ASSERT (((UINTN)Buffer & 0x3) == 0);
ASSERT ((Length & 0x3) == 0);
- ASSERT (Length <= (MAX_ADDRESS - ((UINTN) Buffer) + 1));
+ ASSERT (Length <= (MAX_ADDRESS - ((UINTN)Buffer) + 1));
Total = Length / sizeof (*Buffer);
for (Sum = 0, Count = 0; Count < Total; Count++) {
@@ -208,7 +205,6 @@ CalculateSum32 (
return Sum;
}
-
/**
Returns the two's complement checksum of all elements in a buffer of
32-bit values.
@@ -232,21 +228,20 @@ CalculateSum32 (
UINT32
EFIAPI
CalculateCheckSum32 (
- IN CONST UINT32 *Buffer,
- IN UINTN Length
+ IN CONST UINT32 *Buffer,
+ IN UINTN Length
)
{
- UINT32 CheckSum;
+ UINT32 CheckSum;
CheckSum = CalculateSum32 (Buffer, Length);
//
// Return the checksum based on 2's complement.
//
- return (UINT32) ((UINT32)(-1) - CheckSum + 1);
+ return (UINT32)((UINT32)(-1) - CheckSum + 1);
}
-
/**
Returns the sum of all elements in a buffer of 64-bit values. During
calculation, the carry bits are dropped.
@@ -269,18 +264,18 @@ CalculateCheckSum32 (
UINT64
EFIAPI
CalculateSum64 (
- IN CONST UINT64 *Buffer,
- IN UINTN Length
+ IN CONST UINT64 *Buffer,
+ IN UINTN Length
)
{
- UINT64 Sum;
- UINTN Count;
- UINTN Total;
+ UINT64 Sum;
+ UINTN Count;
+ UINTN Total;
ASSERT (Buffer != NULL);
- ASSERT (((UINTN) Buffer & 0x7) == 0);
+ ASSERT (((UINTN)Buffer & 0x7) == 0);
ASSERT ((Length & 0x7) == 0);
- ASSERT (Length <= (MAX_ADDRESS - ((UINTN) Buffer) + 1));
+ ASSERT (Length <= (MAX_ADDRESS - ((UINTN)Buffer) + 1));
Total = Length / sizeof (*Buffer);
for (Sum = 0, Count = 0; Count < Total; Count++) {
@@ -290,7 +285,6 @@ CalculateSum64 (
return Sum;
}
-
/**
Returns the two's complement checksum of all elements in a buffer of
64-bit values.
@@ -314,18 +308,18 @@ CalculateSum64 (
UINT64
EFIAPI
CalculateCheckSum64 (
- IN CONST UINT64 *Buffer,
- IN UINTN Length
+ IN CONST UINT64 *Buffer,
+ IN UINTN Length
)
{
- UINT64 CheckSum;
+ UINT64 CheckSum;
CheckSum = CalculateSum64 (Buffer, Length);
//
// Return the checksum based on 2's complement.
//
- return (UINT64) ((UINT64)(-1) - CheckSum + 1);
+ return (UINT64)((UINT64)(-1) - CheckSum + 1);
}
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT32 mCrcTable[256] = {
@@ -602,9 +596,9 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT32 mCrcTable[256] = {
**/
UINT32
EFIAPI
-CalculateCrc32(
- IN VOID *Buffer,
- IN UINTN Length
+CalculateCrc32 (
+ IN VOID *Buffer,
+ IN UINTN Length
)
{
UINTN Index;
@@ -612,14 +606,14 @@ CalculateCrc32(
UINT8 *Ptr;
ASSERT (Buffer != NULL);
- ASSERT (Length <= (MAX_ADDRESS - ((UINTN) Buffer) + 1));
+ ASSERT (Length <= (MAX_ADDRESS - ((UINTN)Buffer) + 1));
//
// Compute CRC
//
Crc = 0xffffffff;
for (Index = 0, Ptr = Buffer; Index < Length; Index++, Ptr++) {
- Crc = (Crc >> 8) ^ mCrcTable[(UINT8) Crc ^ *Ptr];
+ Crc = (Crc >> 8) ^ mCrcTable[(UINT8)Crc ^ *Ptr];
}
return Crc ^ 0xffffffff;
diff --git a/MdePkg/Library/BaseLib/ChkStkGcc.c b/MdePkg/Library/BaseLib/ChkStkGcc.c
index 7f07ba2d6f..9c74e36273 100644
--- a/MdePkg/Library/BaseLib/ChkStkGcc.c
+++ b/MdePkg/Library/BaseLib/ChkStkGcc.c
@@ -12,7 +12,7 @@
Hack function for passing GCC build.
**/
VOID
-__chkstk()
+__chkstk (
+ )
{
}
-
diff --git a/MdePkg/Library/BaseLib/Cpu.c b/MdePkg/Library/BaseLib/Cpu.c
index 689246f162..e3daf38f83 100644
--- a/MdePkg/Library/BaseLib/Cpu.c
+++ b/MdePkg/Library/BaseLib/Cpu.c
@@ -8,7 +8,6 @@
#include "BaseLibInternals.h"
-
/**
Disables CPU interrupts and returns the interrupt state prior to the disable
operation.
@@ -23,7 +22,7 @@ SaveAndDisableInterrupts (
VOID
)
{
- BOOLEAN InterruptState;
+ BOOLEAN InterruptState;
InterruptState = GetInterruptState ();
DisableInterrupts ();
@@ -47,7 +46,7 @@ SaveAndDisableInterrupts (
BOOLEAN
EFIAPI
SetInterruptState (
- IN BOOLEAN InterruptState
+ IN BOOLEAN InterruptState
)
{
if (InterruptState) {
@@ -55,5 +54,6 @@ SetInterruptState (
} else {
DisableInterrupts ();
}
+
return InterruptState;
}
diff --git a/MdePkg/Library/BaseLib/CpuDeadLoop.c b/MdePkg/Library/BaseLib/CpuDeadLoop.c
index 3cd304351a..b3b7548fa5 100644
--- a/MdePkg/Library/BaseLib/CpuDeadLoop.c
+++ b/MdePkg/Library/BaseLib/CpuDeadLoop.c
@@ -6,8 +6,6 @@
**/
-
-
#include <Base.h>
#include <Library/BaseLib.h>
@@ -29,6 +27,6 @@ CpuDeadLoop (
volatile UINTN Index;
for (Index = 0; Index == 0;) {
- CpuPause();
+ CpuPause ();
}
}
diff --git a/MdePkg/Library/BaseLib/DivS64x64Remainder.c b/MdePkg/Library/BaseLib/DivS64x64Remainder.c
index bdf25b8366..9d6ec958aa 100644
--- a/MdePkg/Library/BaseLib/DivS64x64Remainder.c
+++ b/MdePkg/Library/BaseLib/DivS64x64Remainder.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -37,9 +34,9 @@
INT64
EFIAPI
DivS64x64Remainder (
- IN INT64 Dividend,
- IN INT64 Divisor,
- OUT INT64 *Remainder OPTIONAL
+ IN INT64 Dividend,
+ IN INT64 Divisor,
+ OUT INT64 *Remainder OPTIONAL
)
{
ASSERT (Divisor != 0);
diff --git a/MdePkg/Library/BaseLib/DivU64x32.c b/MdePkg/Library/BaseLib/DivU64x32.c
index fa377ec551..e505a50758 100644
--- a/MdePkg/Library/BaseLib/DivU64x32.c
+++ b/MdePkg/Library/BaseLib/DivU64x32.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -30,8 +27,8 @@
UINT64
EFIAPI
DivU64x32 (
- IN UINT64 Dividend,
- IN UINT32 Divisor
+ IN UINT64 Dividend,
+ IN UINT32 Divisor
)
{
ASSERT (Divisor != 0);
diff --git a/MdePkg/Library/BaseLib/DivU64x32Remainder.c b/MdePkg/Library/BaseLib/DivU64x32Remainder.c
index df9d3310e8..6f86ed717f 100644
--- a/MdePkg/Library/BaseLib/DivU64x32Remainder.c
+++ b/MdePkg/Library/BaseLib/DivU64x32Remainder.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -33,9 +30,9 @@
UINT64
EFIAPI
DivU64x32Remainder (
- IN UINT64 Dividend,
- IN UINT32 Divisor,
- OUT UINT32 *Remainder OPTIONAL
+ IN UINT64 Dividend,
+ IN UINT32 Divisor,
+ OUT UINT32 *Remainder OPTIONAL
)
{
ASSERT (Divisor != 0);
diff --git a/MdePkg/Library/BaseLib/DivU64x64Remainder.c b/MdePkg/Library/BaseLib/DivU64x64Remainder.c
index 94dc2b1a6a..e068e97f37 100644
--- a/MdePkg/Library/BaseLib/DivU64x64Remainder.c
+++ b/MdePkg/Library/BaseLib/DivU64x64Remainder.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -33,9 +30,9 @@
UINT64
EFIAPI
DivU64x64Remainder (
- IN UINT64 Dividend,
- IN UINT64 Divisor,
- OUT UINT64 *Remainder OPTIONAL
+ IN UINT64 Dividend,
+ IN UINT64 Divisor,
+ OUT UINT64 *Remainder OPTIONAL
)
{
ASSERT (Divisor != 0);
diff --git a/MdePkg/Library/BaseLib/Ebc/CpuBreakpoint.c b/MdePkg/Library/BaseLib/Ebc/CpuBreakpoint.c
index d0debec30f..ec7df5ea47 100644
--- a/MdePkg/Library/BaseLib/Ebc/CpuBreakpoint.c
+++ b/MdePkg/Library/BaseLib/Ebc/CpuBreakpoint.c
@@ -11,7 +11,7 @@
extern
UINT64
_break (
- CHAR8 BreakCode
+ CHAR8 BreakCode
);
/**
@@ -120,4 +120,3 @@ CpuPause (
)
{
}
-
diff --git a/MdePkg/Library/BaseLib/Ebc/SpeculationBarrier.c b/MdePkg/Library/BaseLib/Ebc/SpeculationBarrier.c
index d4067a4a0b..e3e7579b51 100644
--- a/MdePkg/Library/BaseLib/Ebc/SpeculationBarrier.c
+++ b/MdePkg/Library/BaseLib/Ebc/SpeculationBarrier.c
@@ -7,7 +7,6 @@
**/
-
/**
Uses as a barrier to stop speculative execution.
diff --git a/MdePkg/Library/BaseLib/FilePaths.c b/MdePkg/Library/BaseLib/FilePaths.c
index c2c561ac64..43808075e8 100644
--- a/MdePkg/Library/BaseLib/FilePaths.c
+++ b/MdePkg/Library/BaseLib/FilePaths.c
@@ -19,29 +19,33 @@
**/
BOOLEAN
EFIAPI
-PathRemoveLastItem(
- IN OUT CHAR16 *Path
+PathRemoveLastItem (
+ IN OUT CHAR16 *Path
)
{
- CHAR16 *Walker;
- CHAR16 *LastSlash;
+ CHAR16 *Walker;
+ CHAR16 *LastSlash;
+
//
// get directory name from path... ('chop' off extra)
//
for ( Walker = Path, LastSlash = NULL
- ; Walker != NULL && *Walker != CHAR_NULL
- ; Walker++
- ){
- if (*Walker == L'\\' && *(Walker + 1) != CHAR_NULL) {
+ ; Walker != NULL && *Walker != CHAR_NULL
+ ; Walker++
+ )
+ {
+ if ((*Walker == L'\\') && (*(Walker + 1) != CHAR_NULL)) {
LastSlash = Walker+1;
- } else if (*Walker == L':' && *(Walker + 1) != L'\\' && *(Walker + 1) != CHAR_NULL) {
+ } else if ((*Walker == L':') && (*(Walker + 1) != L'\\') && (*(Walker + 1) != CHAR_NULL)) {
LastSlash = Walker+1;
}
}
+
if (LastSlash != NULL) {
*LastSlash = CHAR_NULL;
return (TRUE);
}
+
return (FALSE);
}
@@ -59,11 +63,11 @@ PathRemoveLastItem(
@return Returns Path, otherwise returns NULL to indicate that an error has occurred.
**/
-CHAR16*
+CHAR16 *
EFIAPI
-PathCleanUpDirectories(
- IN CHAR16 *Path
-)
+PathCleanUpDirectories (
+ IN CHAR16 *Path
+ )
{
CHAR16 *TempString;
@@ -93,6 +97,7 @@ PathCleanUpDirectories(
while ((TempString = StrStr (Path, L"\\.\\")) != NULL) {
CopyMem (TempString, TempString + 2, StrSize (TempString + 2));
}
+
if ((StrLen (Path) >= 2) && (StrCmp (Path + StrLen (Path) - 2, L"\\.") == 0)) {
Path[StrLen (Path) - 1] = CHAR_NULL;
}
@@ -100,11 +105,12 @@ PathCleanUpDirectories(
//
// Remove all the "\..". E.g.: fs0:\abc\..\def\..
//
- while (((TempString = StrStr(Path, L"\\..")) != NULL) &&
+ while (((TempString = StrStr (Path, L"\\..")) != NULL) &&
((*(TempString + 3) == L'\\') || (*(TempString + 3) == CHAR_NULL))
- ) {
+ )
+ {
*(TempString + 1) = CHAR_NULL;
- PathRemoveLastItem(Path);
+ PathRemoveLastItem (Path);
if (*(TempString + 3) != CHAR_NULL) {
CopyMem (Path + StrLen (Path), TempString + 4, StrSize (TempString + 4));
}
@@ -112,4 +118,3 @@ PathCleanUpDirectories(
return Path;
}
-
diff --git a/MdePkg/Library/BaseLib/GetPowerOfTwo32.c b/MdePkg/Library/BaseLib/GetPowerOfTwo32.c
index 76f5e3cfbd..8a86d39f3f 100644
--- a/MdePkg/Library/BaseLib/GetPowerOfTwo32.c
+++ b/MdePkg/Library/BaseLib/GetPowerOfTwo32.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -27,7 +24,7 @@
UINT32
EFIAPI
GetPowerOfTwo32 (
- IN UINT32 Operand
+ IN UINT32 Operand
)
{
if (0 == Operand) {
diff --git a/MdePkg/Library/BaseLib/GetPowerOfTwo64.c b/MdePkg/Library/BaseLib/GetPowerOfTwo64.c
index 5033076f84..09a2c8a959 100644
--- a/MdePkg/Library/BaseLib/GetPowerOfTwo64.c
+++ b/MdePkg/Library/BaseLib/GetPowerOfTwo64.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -27,12 +24,12 @@
UINT64
EFIAPI
GetPowerOfTwo64 (
- IN UINT64 Operand
+ IN UINT64 Operand
)
{
if (Operand == 0) {
return 0;
}
- return LShiftU64 (1, (UINTN) HighBitSet64 (Operand));
+ return LShiftU64 (1, (UINTN)HighBitSet64 (Operand));
}
diff --git a/MdePkg/Library/BaseLib/HighBitSet32.c b/MdePkg/Library/BaseLib/HighBitSet32.c
index b3c9ed158b..520511b7fe 100644
--- a/MdePkg/Library/BaseLib/HighBitSet32.c
+++ b/MdePkg/Library/BaseLib/HighBitSet32.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -28,14 +25,17 @@
INTN
EFIAPI
HighBitSet32 (
- IN UINT32 Operand
+ IN UINT32 Operand
)
{
- INTN BitIndex;
+ INTN BitIndex;
if (Operand == 0) {
- return - 1;
+ return -1;
}
- for (BitIndex = 31; (INT32)Operand > 0; BitIndex--, Operand <<= 1);
+
+ for (BitIndex = 31; (INT32)Operand > 0; BitIndex--, Operand <<= 1) {
+ }
+
return BitIndex;
}
diff --git a/MdePkg/Library/BaseLib/HighBitSet64.c b/MdePkg/Library/BaseLib/HighBitSet64.c
index 4f06dfc883..ca64d88804 100644
--- a/MdePkg/Library/BaseLib/HighBitSet64.c
+++ b/MdePkg/Library/BaseLib/HighBitSet64.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -28,7 +25,7 @@
INTN
EFIAPI
HighBitSet64 (
- IN UINT64 Operand
+ IN UINT64 Operand
)
{
if (Operand == (UINT32)Operand) {
@@ -42,7 +39,7 @@ HighBitSet64 (
// Operand is really a 64-bit integer
//
if (sizeof (UINTN) == sizeof (UINT32)) {
- return HighBitSet32 (((UINT32*)&Operand)[1]) + 32;
+ return HighBitSet32 (((UINT32 *)&Operand)[1]) + 32;
} else {
return HighBitSet32 ((UINT32)RShiftU64 (Operand, 32)) + 32;
}
diff --git a/MdePkg/Library/BaseLib/Ia32/ARShiftU64.c b/MdePkg/Library/BaseLib/Ia32/ARShiftU64.c
index 836108364d..251fa0e5b6 100644
--- a/MdePkg/Library/BaseLib/Ia32/ARShiftU64.c
+++ b/MdePkg/Library/BaseLib/Ia32/ARShiftU64.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Shifts a 64-bit integer right between 0 and 63 bits. The high bits
are filled with original integer's bit 63. The shifted value is returned.
@@ -25,8 +22,8 @@
UINT64
EFIAPI
InternalMathARShiftU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
_asm {
@@ -42,4 +39,3 @@ L0:
sar edx, cl
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/CpuBreakpoint.c b/MdePkg/Library/BaseLib/Ia32/CpuBreakpoint.c
index a59da0ceef..8c03934ef5 100644
--- a/MdePkg/Library/BaseLib/Ia32/CpuBreakpoint.c
+++ b/MdePkg/Library/BaseLib/Ia32/CpuBreakpoint.c
@@ -6,14 +6,14 @@
**/
-
-
-
/**
Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics.
**/
-void __debugbreak (VOID);
+void
+__debugbreak (
+ VOID
+ );
#pragma intrinsic(__debugbreak)
@@ -32,4 +32,3 @@ CpuBreakpoint (
{
__debugbreak ();
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/CpuId.c b/MdePkg/Library/BaseLib/Ia32/CpuId.c
index c38b278dce..e1a7e8effb 100644
--- a/MdePkg/Library/BaseLib/Ia32/CpuId.c
+++ b/MdePkg/Library/BaseLib/Ia32/CpuId.c
@@ -34,11 +34,11 @@
UINT32
EFIAPI
AsmCpuid (
- IN UINT32 Index,
- OUT UINT32 *RegisterEax OPTIONAL,
- OUT UINT32 *RegisterEbx OPTIONAL,
- OUT UINT32 *RegisterEcx OPTIONAL,
- OUT UINT32 *RegisterEdx OPTIONAL
+ IN UINT32 Index,
+ OUT UINT32 *RegisterEax OPTIONAL,
+ OUT UINT32 *RegisterEbx OPTIONAL,
+ OUT UINT32 *RegisterEcx OPTIONAL,
+ OUT UINT32 *RegisterEdx OPTIONAL
)
{
_asm {
diff --git a/MdePkg/Library/BaseLib/Ia32/CpuIdEx.c b/MdePkg/Library/BaseLib/Ia32/CpuIdEx.c
index 7cd42eedbb..6eeb778231 100644
--- a/MdePkg/Library/BaseLib/Ia32/CpuIdEx.c
+++ b/MdePkg/Library/BaseLib/Ia32/CpuIdEx.c
@@ -41,12 +41,12 @@
UINT32
EFIAPI
AsmCpuidEx (
- IN UINT32 Index,
- IN UINT32 SubIndex,
- OUT UINT32 *RegisterEax OPTIONAL,
- OUT UINT32 *RegisterEbx OPTIONAL,
- OUT UINT32 *RegisterEcx OPTIONAL,
- OUT UINT32 *RegisterEdx OPTIONAL
+ IN UINT32 Index,
+ IN UINT32 SubIndex,
+ OUT UINT32 *RegisterEax OPTIONAL,
+ OUT UINT32 *RegisterEbx OPTIONAL,
+ OUT UINT32 *RegisterEcx OPTIONAL,
+ OUT UINT32 *RegisterEdx OPTIONAL
)
{
_asm {
diff --git a/MdePkg/Library/BaseLib/Ia32/CpuPause.c b/MdePkg/Library/BaseLib/Ia32/CpuPause.c
index 12dc896fe3..356b8ef994 100644
--- a/MdePkg/Library/BaseLib/Ia32/CpuPause.c
+++ b/MdePkg/Library/BaseLib/Ia32/CpuPause.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Requests CPU to pause for a short period of time.
@@ -26,4 +23,3 @@ CpuPause (
pause
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/DisableCache.c b/MdePkg/Library/BaseLib/Ia32/DisableCache.c
index 6a8be4ef20..d1aca0ed9a 100644
--- a/MdePkg/Library/BaseLib/Ia32/DisableCache.c
+++ b/MdePkg/Library/BaseLib/Ia32/DisableCache.c
@@ -27,4 +27,3 @@ AsmDisableCache (
wbinvd
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/DisableInterrupts.c b/MdePkg/Library/BaseLib/Ia32/DisableInterrupts.c
index 4141ef7511..d59d552223 100644
--- a/MdePkg/Library/BaseLib/Ia32/DisableInterrupts.c
+++ b/MdePkg/Library/BaseLib/Ia32/DisableInterrupts.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Disables CPU interrupts.
@@ -23,4 +20,3 @@ DisableInterrupts (
cli
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/DisablePaging32.c b/MdePkg/Library/BaseLib/Ia32/DisablePaging32.c
index 9bebd6d3f3..0e263c4509 100644
--- a/MdePkg/Library/BaseLib/Ia32/DisablePaging32.c
+++ b/MdePkg/Library/BaseLib/Ia32/DisablePaging32.c
@@ -38,7 +38,7 @@
function after paging is disabled.
**/
-__declspec (naked)
+__declspec(naked)
VOID
EFIAPI
InternalX86DisablePaging32 (
diff --git a/MdePkg/Library/BaseLib/Ia32/DivS64x64Remainder.c b/MdePkg/Library/BaseLib/Ia32/DivS64x64Remainder.c
index 4e64964042..4604208403 100644
--- a/MdePkg/Library/BaseLib/Ia32/DivS64x64Remainder.c
+++ b/MdePkg/Library/BaseLib/Ia32/DivS64x64Remainder.c
@@ -28,20 +28,21 @@
INT64
EFIAPI
InternalMathDivRemS64x64 (
- IN INT64 Dividend,
- IN INT64 Divisor,
- OUT INT64 *Remainder OPTIONAL
+ IN INT64 Dividend,
+ IN INT64 Divisor,
+ OUT INT64 *Remainder OPTIONAL
)
{
- INT64 Quot;
+ INT64 Quot;
Quot = InternalMathDivRemU64x64 (
- (UINT64) (Dividend >= 0 ? Dividend : -Dividend),
- (UINT64) (Divisor >= 0 ? Divisor : -Divisor),
- (UINT64 *) Remainder
+ (UINT64)(Dividend >= 0 ? Dividend : -Dividend),
+ (UINT64)(Divisor >= 0 ? Divisor : -Divisor),
+ (UINT64 *)Remainder
);
- if (Remainder != NULL && Dividend < 0) {
+ if ((Remainder != NULL) && (Dividend < 0)) {
*Remainder = -*Remainder;
}
+
return (Dividend ^ Divisor) >= 0 ? Quot : -Quot;
}
diff --git a/MdePkg/Library/BaseLib/Ia32/DivU64x32.c b/MdePkg/Library/BaseLib/Ia32/DivU64x32.c
index 538f77a83f..c46abba638 100644
--- a/MdePkg/Library/BaseLib/Ia32/DivU64x32.c
+++ b/MdePkg/Library/BaseLib/Ia32/DivU64x32.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Divides a 64-bit unsigned integer by a 32-bit unsigned integer and
generates a 64-bit unsigned result.
@@ -26,8 +23,8 @@
UINT64
EFIAPI
InternalMathDivU64x32 (
- IN UINT64 Dividend,
- IN UINT32 Divisor
+ IN UINT64 Dividend,
+ IN UINT32 Divisor
)
{
_asm {
@@ -41,4 +38,3 @@ InternalMathDivU64x32 (
pop edx ; restore high-order dword of the quotient
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.c b/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.c
index 035d4340db..a32d627834 100644
--- a/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.c
+++ b/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.c
@@ -26,9 +26,9 @@
UINT64
EFIAPI
InternalMathDivRemU64x32 (
- IN UINT64 Dividend,
- IN UINT32 Divisor,
- OUT UINT32 *Remainder
+ IN UINT64 Dividend,
+ IN UINT32 Divisor,
+ OUT UINT32 *Remainder
)
{
_asm {
@@ -46,4 +46,3 @@ RemainderNull:
pop edx
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/EnableCache.c b/MdePkg/Library/BaseLib/Ia32/EnableCache.c
index 4f5c6e9ab3..3b354af178 100644
--- a/MdePkg/Library/BaseLib/Ia32/EnableCache.c
+++ b/MdePkg/Library/BaseLib/Ia32/EnableCache.c
@@ -27,4 +27,3 @@ AsmEnableCache (
mov cr0, eax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.c b/MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.c
index 7ec62147f2..88b9171463 100644
--- a/MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.c
+++ b/MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Enables CPU interrupts for the smallest window required to capture any
pending interrupts.
@@ -27,4 +24,3 @@ EnableDisableInterrupts (
cli
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.c b/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.c
index bc03144c42..570c39db5b 100644
--- a/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.c
+++ b/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Enables CPU interrupts.
@@ -23,4 +20,3 @@ EnableInterrupts (
sti
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/EnablePaging32.c b/MdePkg/Library/BaseLib/Ia32/EnablePaging32.c
index 7280c12f60..3c3e347d19 100644
--- a/MdePkg/Library/BaseLib/Ia32/EnablePaging32.c
+++ b/MdePkg/Library/BaseLib/Ia32/EnablePaging32.c
@@ -41,7 +41,7 @@
function after paging is enabled.
**/
-__declspec (naked)
+__declspec(naked)
VOID
EFIAPI
InternalX86EnablePaging32 (
diff --git a/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.c b/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.c
index 8fbda06707..d6466880be 100644
--- a/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.c
+++ b/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Flushes a cache line from all the instruction and data caches within the
coherency domain of the CPU.
@@ -27,7 +24,7 @@
VOID *
EFIAPI
AsmFlushCacheLine (
- IN VOID *LinearAddress
+ IN VOID *LinearAddress
)
{
//
@@ -49,4 +46,3 @@ Done:
return LinearAddress;
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/FxRestore.c b/MdePkg/Library/BaseLib/Ia32/FxRestore.c
index ddd1e49037..5ebb281d14 100644
--- a/MdePkg/Library/BaseLib/Ia32/FxRestore.c
+++ b/MdePkg/Library/BaseLib/Ia32/FxRestore.c
@@ -6,10 +6,8 @@
**/
-
#include "BaseLibInternals.h"
-
/**
Restores the current floating point/SSE/SSE2 context from a buffer.
@@ -23,7 +21,7 @@
VOID
EFIAPI
InternalX86FxRestore (
- IN CONST IA32_FX_BUFFER *Buffer
+ IN CONST IA32_FX_BUFFER *Buffer
)
{
_asm {
@@ -31,4 +29,3 @@ InternalX86FxRestore (
fxrstor [eax]
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/FxSave.c b/MdePkg/Library/BaseLib/Ia32/FxSave.c
index a8c8882171..fc489c5f76 100644
--- a/MdePkg/Library/BaseLib/Ia32/FxSave.c
+++ b/MdePkg/Library/BaseLib/Ia32/FxSave.c
@@ -6,10 +6,8 @@
**/
-
#include "BaseLibInternals.h"
-
/**
Save the current floating point/SSE/SSE2 context to a buffer.
@@ -23,7 +21,7 @@
VOID
EFIAPI
InternalX86FxSave (
- OUT IA32_FX_BUFFER *Buffer
+ OUT IA32_FX_BUFFER *Buffer
)
{
_asm {
@@ -31,4 +29,3 @@ InternalX86FxSave (
fxsave [eax]
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/GccInline.c b/MdePkg/Library/BaseLib/Ia32/GccInline.c
index 6ed938187a..dab20c8aa2 100644
--- a/MdePkg/Library/BaseLib/Ia32/GccInline.c
+++ b/MdePkg/Library/BaseLib/Ia32/GccInline.c
@@ -7,7 +7,6 @@
**/
-
#include "BaseLibInternals.h"
/**
@@ -77,13 +76,13 @@ AsmReadEflags (
VOID
)
{
- UINTN Eflags;
+ UINTN Eflags;
__asm__ __volatile__ (
"pushfl \n\t"
"popl %0 "
: "=r" (Eflags)
- );
+ );
return Eflags;
}
@@ -101,17 +100,16 @@ AsmReadEflags (
VOID
EFIAPI
InternalX86FxSave (
- OUT IA32_FX_BUFFER *Buffer
+ OUT IA32_FX_BUFFER *Buffer
)
{
__asm__ __volatile__ (
"fxsave %0"
:
: "m" (*Buffer) // %0
- );
+ );
}
-
/**
Restores the current floating point/SSE/SSE2 context from a buffer.
@@ -125,17 +123,16 @@ InternalX86FxSave (
VOID
EFIAPI
InternalX86FxRestore (
- IN CONST IA32_FX_BUFFER *Buffer
+ IN CONST IA32_FX_BUFFER *Buffer
)
{
__asm__ __volatile__ (
"fxrstor %0"
:
: "m" (*Buffer) // %0
- );
+ );
}
-
/**
Reads the current value of 64-bit MMX Register #0 (MM0).
@@ -160,12 +157,11 @@ AsmReadMm0 (
"pop %%eax \n\t"
"pop %%edx \n\t"
: "=A" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #1 (MM1).
@@ -190,12 +186,11 @@ AsmReadMm1 (
"pop %%eax \n\t"
"pop %%edx \n\t"
: "=A" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #2 (MM2).
@@ -220,12 +215,11 @@ AsmReadMm2 (
"pop %%eax \n\t"
"pop %%edx \n\t"
: "=A" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #3 (MM3).
@@ -250,12 +244,11 @@ AsmReadMm3 (
"pop %%eax \n\t"
"pop %%edx \n\t"
: "=A" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #4 (MM4).
@@ -280,12 +273,11 @@ AsmReadMm4 (
"pop %%eax \n\t"
"pop %%edx \n\t"
: "=A" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #5 (MM5).
@@ -310,12 +302,11 @@ AsmReadMm5 (
"pop %%eax \n\t"
"pop %%edx \n\t"
: "=A" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #6 (MM6).
@@ -340,12 +331,11 @@ AsmReadMm6 (
"pop %%eax \n\t"
"pop %%edx \n\t"
: "=A" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #7 (MM7).
@@ -370,12 +360,11 @@ AsmReadMm7 (
"pop %%eax \n\t"
"pop %%edx \n\t"
: "=A" (Data) // %0
- );
+ );
return Data;
}
-
/**
Writes the current value of 64-bit MMX Register #0 (MM0).
@@ -388,17 +377,16 @@ AsmReadMm7 (
VOID
EFIAPI
AsmWriteMm0 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movq %0, %%mm0" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #1 (MM1).
@@ -411,17 +399,16 @@ AsmWriteMm0 (
VOID
EFIAPI
AsmWriteMm1 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movq %0, %%mm1" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #2 (MM2).
@@ -434,17 +421,16 @@ AsmWriteMm1 (
VOID
EFIAPI
AsmWriteMm2 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movq %0, %%mm2" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #3 (MM3).
@@ -457,17 +443,16 @@ AsmWriteMm2 (
VOID
EFIAPI
AsmWriteMm3 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movq %0, %%mm3" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #4 (MM4).
@@ -480,17 +465,16 @@ AsmWriteMm3 (
VOID
EFIAPI
AsmWriteMm4 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movq %0, %%mm4" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #5 (MM5).
@@ -503,17 +487,16 @@ AsmWriteMm4 (
VOID
EFIAPI
AsmWriteMm5 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movq %0, %%mm5" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #6 (MM6).
@@ -526,17 +509,16 @@ AsmWriteMm5 (
VOID
EFIAPI
AsmWriteMm6 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movq %0, %%mm6" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #7 (MM7).
@@ -549,17 +531,16 @@ AsmWriteMm6 (
VOID
EFIAPI
AsmWriteMm7 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movq %0, %%mm7" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Reads the current value of Time Stamp Counter (TSC).
@@ -580,7 +561,7 @@ AsmReadTsc (
__asm__ __volatile__ (
"rdtsc"
: "=A" (Data)
- );
+ );
return Data;
}
diff --git a/MdePkg/Library/BaseLib/Ia32/GccInlinePriv.c b/MdePkg/Library/BaseLib/Ia32/GccInlinePriv.c
index b8b5b85e73..df22a217ec 100644
--- a/MdePkg/Library/BaseLib/Ia32/GccInlinePriv.c
+++ b/MdePkg/Library/BaseLib/Ia32/GccInlinePriv.c
@@ -8,7 +8,6 @@
**/
-
#include "BaseLibInternals.h"
#include <Library/RegisterFilterLib.h>
@@ -27,7 +26,6 @@ EnableInterrupts (
__asm__ __volatile__ ("sti"::: "memory");
}
-
/**
Disables CPU interrupts.
@@ -60,11 +58,11 @@ DisableInterrupts (
UINT64
EFIAPI
AsmReadMsr64 (
- IN UINT32 Index
+ IN UINT32 Index
)
{
- UINT64 Data;
- BOOLEAN Flag;
+ UINT64 Data;
+ BOOLEAN Flag;
Flag = FilterBeforeMsrRead (Index, &Data);
if (Flag) {
@@ -72,8 +70,9 @@ AsmReadMsr64 (
"rdmsr"
: "=A" (Data) // %0
: "c" (Index) // %1
- );
+ );
}
+
FilterAfterMsrRead (Index, &Data);
return Data;
@@ -99,8 +98,8 @@ AsmReadMsr64 (
UINT64
EFIAPI
AsmWriteMsr64 (
- IN UINT32 Index,
- IN UINT64 Value
+ IN UINT32 Index,
+ IN UINT64 Value
)
{
BOOLEAN Flag;
@@ -112,8 +111,9 @@ AsmWriteMsr64 (
:
: "c" (Index),
"A" (Value)
- );
+ );
}
+
FilterAfterMsrWrite (Index, &Value);
return Value;
@@ -135,17 +135,16 @@ AsmReadCr0 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"movl %%cr0,%0"
: "=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of the Control Register 2 (CR2).
@@ -162,12 +161,12 @@ AsmReadCr2 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"movl %%cr2, %0"
: "=r" (Data)
- );
+ );
return Data;
}
@@ -188,17 +187,16 @@ AsmReadCr3 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"movl %%cr3, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of the Control Register 4 (CR4).
@@ -215,17 +213,16 @@ AsmReadCr4 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"movl %%cr4, %0"
: "=a" (Data)
- );
+ );
return Data;
}
-
/**
Writes a value to Control Register 0 (CR0).
@@ -247,11 +244,10 @@ AsmWriteCr0 (
"movl %0, %%cr0"
:
: "r" (Cr0)
- );
+ );
return Cr0;
}
-
/**
Writes a value to Control Register 2 (CR2).
@@ -273,11 +269,10 @@ AsmWriteCr2 (
"movl %0, %%cr2"
:
: "r" (Cr2)
- );
+ );
return Cr2;
}
-
/**
Writes a value to Control Register 3 (CR3).
@@ -299,11 +294,10 @@ AsmWriteCr3 (
"movl %0, %%cr3"
:
: "r" (Cr3)
- );
+ );
return Cr3;
}
-
/**
Writes a value to Control Register 4 (CR4).
@@ -325,11 +319,10 @@ AsmWriteCr4 (
"movl %0, %%cr4"
:
: "r" (Cr4)
- );
+ );
return Cr4;
}
-
/**
Reads the current value of Debug Register 0 (DR0).
@@ -346,17 +339,16 @@ AsmReadDr0 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"movl %%dr0, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 1 (DR1).
@@ -373,17 +365,16 @@ AsmReadDr1 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"movl %%dr1, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 2 (DR2).
@@ -400,17 +391,16 @@ AsmReadDr2 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"movl %%dr2, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 3 (DR3).
@@ -427,17 +417,16 @@ AsmReadDr3 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"movl %%dr3, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 4 (DR4).
@@ -454,17 +443,16 @@ AsmReadDr4 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"movl %%dr4, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 5 (DR5).
@@ -481,17 +469,16 @@ AsmReadDr5 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"movl %%dr5, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 6 (DR6).
@@ -508,17 +495,16 @@ AsmReadDr6 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"movl %%dr6, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 7 (DR7).
@@ -535,17 +521,16 @@ AsmReadDr7 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"movl %%dr7, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Writes a value to Debug Register 0 (DR0).
@@ -567,11 +552,10 @@ AsmWriteDr0 (
"movl %0, %%dr0"
:
: "r" (Dr0)
- );
+ );
return Dr0;
}
-
/**
Writes a value to Debug Register 1 (DR1).
@@ -593,11 +577,10 @@ AsmWriteDr1 (
"movl %0, %%dr1"
:
: "r" (Dr1)
- );
+ );
return Dr1;
}
-
/**
Writes a value to Debug Register 2 (DR2).
@@ -619,11 +602,10 @@ AsmWriteDr2 (
"movl %0, %%dr2"
:
: "r" (Dr2)
- );
+ );
return Dr2;
}
-
/**
Writes a value to Debug Register 3 (DR3).
@@ -645,11 +627,10 @@ AsmWriteDr3 (
"movl %0, %%dr3"
:
: "r" (Dr3)
- );
+ );
return Dr3;
}
-
/**
Writes a value to Debug Register 4 (DR4).
@@ -671,11 +652,10 @@ AsmWriteDr4 (
"movl %0, %%dr4"
:
: "r" (Dr4)
- );
+ );
return Dr4;
}
-
/**
Writes a value to Debug Register 5 (DR5).
@@ -697,11 +677,10 @@ AsmWriteDr5 (
"movl %0, %%dr5"
:
: "r" (Dr5)
- );
+ );
return Dr5;
}
-
/**
Writes a value to Debug Register 6 (DR6).
@@ -723,11 +702,10 @@ AsmWriteDr6 (
"movl %0, %%dr6"
:
: "r" (Dr6)
- );
+ );
return Dr6;
}
-
/**
Writes a value to Debug Register 7 (DR7).
@@ -749,11 +727,10 @@ AsmWriteDr7 (
"movl %0, %%dr7"
:
: "r" (Dr7)
- );
+ );
return Dr7;
}
-
/**
Reads the current value of Code Segment Register (CS).
@@ -774,12 +751,11 @@ AsmReadCs (
__asm__ __volatile__ (
"mov %%cs, %0"
:"=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Data Segment Register (DS).
@@ -800,12 +776,11 @@ AsmReadDs (
__asm__ __volatile__ (
"mov %%ds, %0"
:"=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Extra Segment Register (ES).
@@ -826,12 +801,11 @@ AsmReadEs (
__asm__ __volatile__ (
"mov %%es, %0"
:"=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of FS Data Segment Register (FS).
@@ -852,12 +826,11 @@ AsmReadFs (
__asm__ __volatile__ (
"mov %%fs, %0"
:"=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of GS Data Segment Register (GS).
@@ -878,12 +851,11 @@ AsmReadGs (
__asm__ __volatile__ (
"mov %%gs, %0"
:"=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Stack Segment Register (SS).
@@ -904,12 +876,11 @@ AsmReadSs (
__asm__ __volatile__ (
"mov %%ss, %0"
:"=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Task Register (TR).
@@ -930,12 +901,11 @@ AsmReadTr (
__asm__ __volatile__ (
"str %0"
: "=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current Global Descriptor Table Register(GDTR) descriptor.
@@ -948,16 +918,15 @@ AsmReadTr (
VOID
EFIAPI
InternalX86ReadGdtr (
- OUT IA32_DESCRIPTOR *Gdtr
+ OUT IA32_DESCRIPTOR *Gdtr
)
{
__asm__ __volatile__ (
"sgdt %0"
: "=m" (*Gdtr)
- );
+ );
}
-
/**
Writes the current Global Descriptor Table Register (GDTR) descriptor.
@@ -970,18 +939,16 @@ InternalX86ReadGdtr (
VOID
EFIAPI
InternalX86WriteGdtr (
- IN CONST IA32_DESCRIPTOR *Gdtr
+ IN CONST IA32_DESCRIPTOR *Gdtr
)
{
__asm__ __volatile__ (
"lgdt %0"
:
: "m" (*Gdtr)
- );
-
+ );
}
-
/**
Reads the current Interrupt Descriptor Table Register(GDTR) descriptor.
@@ -994,16 +961,15 @@ InternalX86WriteGdtr (
VOID
EFIAPI
InternalX86ReadIdtr (
- OUT IA32_DESCRIPTOR *Idtr
+ OUT IA32_DESCRIPTOR *Idtr
)
{
__asm__ __volatile__ (
"sidt %0"
: "=m" (*Idtr)
- );
+ );
}
-
/**
Writes the current Interrupt Descriptor Table Register(GDTR) descriptor.
@@ -1016,17 +982,16 @@ InternalX86ReadIdtr (
VOID
EFIAPI
InternalX86WriteIdtr (
- IN CONST IA32_DESCRIPTOR *Idtr
+ IN CONST IA32_DESCRIPTOR *Idtr
)
{
__asm__ __volatile__ (
"lidt %0"
:
: "m" (*Idtr)
- );
+ );
}
-
/**
Reads the current Local Descriptor Table Register(LDTR) selector.
@@ -1047,12 +1012,11 @@ AsmReadLdtr (
__asm__ __volatile__ (
"sldt %0"
: "=g" (Data) // %0
- );
+ );
return Data;
}
-
/**
Writes the current Local Descriptor Table Register (GDTR) selector.
@@ -1065,14 +1029,14 @@ AsmReadLdtr (
VOID
EFIAPI
AsmWriteLdtr (
- IN UINT16 Ldtr
+ IN UINT16 Ldtr
)
{
__asm__ __volatile__ (
"lldtw %0"
:
: "g" (Ldtr) // %0
- );
+ );
}
/**
@@ -1089,7 +1053,7 @@ AsmWriteLdtr (
UINT64
EFIAPI
AsmReadPmc (
- IN UINT32 Index
+ IN UINT32 Index
)
{
UINT64 Data;
@@ -1098,7 +1062,7 @@ AsmReadPmc (
"rdpmc"
: "=A" (Data)
: "c" (Index)
- );
+ );
return Data;
}
@@ -1133,10 +1097,8 @@ AsmInvd (
)
{
__asm__ __volatile__ ("invd":::"memory");
-
}
-
/**
Flushes a cache line from all the instruction and data caches within the
coherency domain of the CPU.
@@ -1155,7 +1117,7 @@ AsmInvd (
VOID *
EFIAPI
AsmFlushCacheLine (
- IN VOID *LinearAddress
+ IN VOID *LinearAddress
)
{
UINT32 RegEdx;
@@ -1170,13 +1132,12 @@ AsmFlushCacheLine (
return LinearAddress;
}
-
__asm__ __volatile__ (
"clflush (%0)"
: "+a" (LinearAddress)
:
: "memory"
- );
+ );
return LinearAddress;
}
diff --git a/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.c b/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.c
index 14647f22e5..9d586c38ee 100644
--- a/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.c
+++ b/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.c
@@ -44,11 +44,11 @@ InternalSwitchStack (
{
BASE_LIBRARY_JUMP_BUFFER JumpBuffer;
- JumpBuffer.Eip = (UINTN)EntryPoint;
- JumpBuffer.Esp = (UINTN)NewStack - sizeof (VOID*);
- JumpBuffer.Esp -= sizeof (Context1) + sizeof (Context2);
- ((VOID**)JumpBuffer.Esp)[1] = Context1;
- ((VOID**)JumpBuffer.Esp)[2] = Context2;
+ JumpBuffer.Eip = (UINTN)EntryPoint;
+ JumpBuffer.Esp = (UINTN)NewStack - sizeof (VOID *);
+ JumpBuffer.Esp -= sizeof (Context1) + sizeof (Context2);
+ ((VOID **)JumpBuffer.Esp)[1] = Context1;
+ ((VOID **)JumpBuffer.Esp)[2] = Context2;
LongJump (&JumpBuffer, (UINTN)-1);
}
diff --git a/MdePkg/Library/BaseLib/Ia32/Invd.c b/MdePkg/Library/BaseLib/Ia32/Invd.c
index 9870cf9c63..3c526b50ae 100644
--- a/MdePkg/Library/BaseLib/Ia32/Invd.c
+++ b/MdePkg/Library/BaseLib/Ia32/Invd.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Executes a INVD instruction.
@@ -26,4 +23,3 @@ AsmInvd (
invd
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/LRotU64.c b/MdePkg/Library/BaseLib/Ia32/LRotU64.c
index 87d370c6f4..496b9de0bb 100644
--- a/MdePkg/Library/BaseLib/Ia32/LRotU64.c
+++ b/MdePkg/Library/BaseLib/Ia32/LRotU64.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Rotates a 64-bit integer left between 0 and 63 bits, filling
the low bits with the high bits that were rotated.
@@ -26,8 +23,8 @@
UINT64
EFIAPI
InternalMathLRotU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
_asm {
@@ -43,7 +40,6 @@ InternalMathLRotU64 (
mov ecx, eax
mov eax, edx
mov edx, ecx
-L0:
+ L0 :
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/LShiftU64.c b/MdePkg/Library/BaseLib/Ia32/LShiftU64.c
index 1604e7e2f7..c8ee0df7e8 100644
--- a/MdePkg/Library/BaseLib/Ia32/LShiftU64.c
+++ b/MdePkg/Library/BaseLib/Ia32/LShiftU64.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Shifts a 64-bit integer left between 0 and 63 bits. The low bits
are filled with zeros. The shifted value is returned.
@@ -25,8 +22,8 @@
UINT64
EFIAPI
InternalMathLShiftU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
_asm {
@@ -42,4 +39,3 @@ L0:
shl eax, cl
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ModU64x32.c b/MdePkg/Library/BaseLib/Ia32/ModU64x32.c
index 26a19cbd93..d5f84e205d 100644
--- a/MdePkg/Library/BaseLib/Ia32/ModU64x32.c
+++ b/MdePkg/Library/BaseLib/Ia32/ModU64x32.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Divides a 64-bit unsigned integer by a 32-bit unsigned integer and
generates a 32-bit unsigned remainder.
@@ -26,8 +23,8 @@
UINT32
EFIAPI
InternalMathModU64x32 (
- IN UINT64 Dividend,
- IN UINT32 Divisor
+ IN UINT64 Dividend,
+ IN UINT32 Divisor
)
{
_asm {
diff --git a/MdePkg/Library/BaseLib/Ia32/Monitor.c b/MdePkg/Library/BaseLib/Ia32/Monitor.c
index 966b128a3b..630bf0c5fe 100644
--- a/MdePkg/Library/BaseLib/Ia32/Monitor.c
+++ b/MdePkg/Library/BaseLib/Ia32/Monitor.c
@@ -25,9 +25,9 @@
UINTN
EFIAPI
AsmMonitor (
- IN UINTN RegisterEax,
- IN UINTN RegisterEcx,
- IN UINTN RegisterEdx
+ IN UINTN RegisterEax,
+ IN UINTN RegisterEcx,
+ IN UINTN RegisterEdx
)
{
_asm {
@@ -39,4 +39,3 @@ AsmMonitor (
_emit 0xc8
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/MultU64x32.c b/MdePkg/Library/BaseLib/Ia32/MultU64x32.c
index a728684648..e382effc2c 100644
--- a/MdePkg/Library/BaseLib/Ia32/MultU64x32.c
+++ b/MdePkg/Library/BaseLib/Ia32/MultU64x32.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Multiples a 64-bit unsigned integer by a 32-bit unsigned integer
and generates a 64-bit unsigned result.
@@ -26,8 +23,8 @@
UINT64
EFIAPI
InternalMathMultU64x32 (
- IN UINT64 Multiplicand,
- IN UINT32 Multiplier
+ IN UINT64 Multiplicand,
+ IN UINT32 Multiplier
)
{
_asm {
@@ -38,4 +35,3 @@ InternalMathMultU64x32 (
add edx, ecx
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/MultU64x64.c b/MdePkg/Library/BaseLib/Ia32/MultU64x64.c
index 806cbd565a..d5aff3f181 100644
--- a/MdePkg/Library/BaseLib/Ia32/MultU64x64.c
+++ b/MdePkg/Library/BaseLib/Ia32/MultU64x64.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Multiplies a 64-bit unsigned integer by a 64-bit unsigned integer
and generates a 64-bit unsigned result.
@@ -26,8 +23,8 @@
UINT64
EFIAPI
InternalMathMultU64x64 (
- IN UINT64 Multiplicand,
- IN UINT64 Multiplier
+ IN UINT64 Multiplicand,
+ IN UINT64 Multiplier
)
{
_asm {
@@ -42,4 +39,3 @@ InternalMathMultU64x64 (
add edx, ebx
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/Mwait.c b/MdePkg/Library/BaseLib/Ia32/Mwait.c
index 08c666f792..143082a6c2 100644
--- a/MdePkg/Library/BaseLib/Ia32/Mwait.c
+++ b/MdePkg/Library/BaseLib/Ia32/Mwait.c
@@ -23,8 +23,8 @@
UINTN
EFIAPI
AsmMwait (
- IN UINTN RegisterEax,
- IN UINTN RegisterEcx
+ IN UINTN RegisterEax,
+ IN UINTN RegisterEcx
)
{
_asm {
@@ -35,4 +35,3 @@ AsmMwait (
_emit 0xC9
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/Non-existing.c b/MdePkg/Library/BaseLib/Ia32/Non-existing.c
index 3854d904fe..7765f58bcd 100644
--- a/MdePkg/Library/BaseLib/Ia32/Non-existing.c
+++ b/MdePkg/Library/BaseLib/Ia32/Non-existing.c
@@ -37,11 +37,11 @@
VOID
EFIAPI
InternalX86DisablePaging64 (
- IN UINT16 CodeSelector,
- IN UINT32 EntryPoint,
- IN UINT32 Context1 OPTIONAL,
- IN UINT32 Context2 OPTIONAL,
- IN UINT32 NewStack
+ IN UINT16 CodeSelector,
+ IN UINT32 EntryPoint,
+ IN UINT32 Context1 OPTIONAL,
+ IN UINT32 Context2 OPTIONAL,
+ IN UINT32 NewStack
)
{
//
diff --git a/MdePkg/Library/BaseLib/Ia32/RRotU64.c b/MdePkg/Library/BaseLib/Ia32/RRotU64.c
index 82711a5f81..89477c280b 100644
--- a/MdePkg/Library/BaseLib/Ia32/RRotU64.c
+++ b/MdePkg/Library/BaseLib/Ia32/RRotU64.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Rotates a 64-bit integer right between 0 and 63 bits, filling
the high bits with the high low bits that were rotated.
@@ -26,8 +23,8 @@
UINT64
EFIAPI
InternalMathRRotU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
_asm {
@@ -46,4 +43,3 @@ InternalMathRRotU64 (
L0:
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/RShiftU64.c b/MdePkg/Library/BaseLib/Ia32/RShiftU64.c
index 35d8437056..5aa7a856a0 100644
--- a/MdePkg/Library/BaseLib/Ia32/RShiftU64.c
+++ b/MdePkg/Library/BaseLib/Ia32/RShiftU64.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Shifts a 64-bit integer right between 0 and 63 bits. This high bits
are filled with zeros. The shifted value is returned.
@@ -25,8 +22,8 @@
UINT64
EFIAPI
InternalMathRShiftU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
_asm {
@@ -42,4 +39,3 @@ L0:
shr edx, cl
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadCr0.c b/MdePkg/Library/BaseLib/Ia32/ReadCr0.c
index 4a37c7b02c..7395218387 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadCr0.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadCr0.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of the Control Register 0 (CR0).
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadCr2.c b/MdePkg/Library/BaseLib/Ia32/ReadCr2.c
index feab380552..2de1c50380 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadCr2.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadCr2.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of the Control Register 2 (CR2).
@@ -29,4 +26,3 @@ AsmReadCr2 (
mov eax, cr2
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadCr3.c b/MdePkg/Library/BaseLib/Ia32/ReadCr3.c
index b00e324919..144b78057b 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadCr3.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadCr3.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of the Control Register 3 (CR3).
@@ -29,4 +26,3 @@ AsmReadCr3 (
mov eax, cr3
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadCr4.c b/MdePkg/Library/BaseLib/Ia32/ReadCr4.c
index f948f82b77..c0616618bd 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadCr4.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadCr4.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of the Control Register 4 (CR4).
@@ -31,4 +28,3 @@ AsmReadCr4 (
_emit 0xE0
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadCs.c b/MdePkg/Library/BaseLib/Ia32/ReadCs.c
index 02f23f5f1e..3a603f1aee 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadCs.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadCs.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of Code Segment Register (CS).
@@ -29,4 +26,3 @@ AsmReadCs (
mov ax, cs
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr0.c b/MdePkg/Library/BaseLib/Ia32/ReadDr0.c
index 5418f92a39..80bb9b7e53 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr0.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr0.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of Debug Register 0 (DR0).
@@ -29,4 +26,3 @@ AsmReadDr0 (
mov eax, dr0
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr1.c b/MdePkg/Library/BaseLib/Ia32/ReadDr1.c
index d72adaadb8..9ca51ce143 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr1.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr1.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of Debug Register 1 (DR1).
@@ -29,4 +26,3 @@ AsmReadDr1 (
mov eax, dr1
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr2.c b/MdePkg/Library/BaseLib/Ia32/ReadDr2.c
index fde799728f..1e8007d46b 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr2.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr2.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of Debug Register 2 (DR2).
@@ -29,4 +26,3 @@ AsmReadDr2 (
mov eax, dr2
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr3.c b/MdePkg/Library/BaseLib/Ia32/ReadDr3.c
index 9b899e79c7..3a2d7417fe 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr3.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr3.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of Debug Register 3 (DR3).
@@ -29,4 +26,3 @@ AsmReadDr3 (
mov eax, dr3
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr4.c b/MdePkg/Library/BaseLib/Ia32/ReadDr4.c
index 52293d335e..5d7e543823 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr4.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr4.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of Debug Register 4 (DR4).
@@ -31,4 +28,3 @@ AsmReadDr4 (
_emit 0xe0
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr5.c b/MdePkg/Library/BaseLib/Ia32/ReadDr5.c
index ecf6dc2d21..2418d222be 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr5.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr5.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of Debug Register 5 (DR5).
@@ -31,4 +28,3 @@ AsmReadDr5 (
_emit 0xe8
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr6.c b/MdePkg/Library/BaseLib/Ia32/ReadDr6.c
index 2b082970fc..43166828eb 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr6.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr6.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of Debug Register 6 (DR6).
@@ -29,4 +26,3 @@ AsmReadDr6 (
mov eax, dr6
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr7.c b/MdePkg/Library/BaseLib/Ia32/ReadDr7.c
index 8be80482f3..670c695638 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr7.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr7.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of Debug Register 7 (DR7).
@@ -29,4 +26,3 @@ AsmReadDr7 (
mov eax, dr7
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDs.c b/MdePkg/Library/BaseLib/Ia32/ReadDs.c
index 3cdada3ac5..d293bcf591 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDs.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDs.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of Data Segment Register (DS).
@@ -29,4 +26,3 @@ AsmReadDs (
mov ax, ds
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadEflags.c b/MdePkg/Library/BaseLib/Ia32/ReadEflags.c
index 1cea323c55..af3375503f 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadEflags.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadEflags.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of the EFLAGS register.
@@ -30,4 +27,3 @@ AsmReadEflags (
pop eax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadEs.c b/MdePkg/Library/BaseLib/Ia32/ReadEs.c
index 30953fdf3a..22c10bea55 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadEs.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadEs.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of ES Data Segment Register (ES).
@@ -29,4 +26,3 @@ AsmReadEs (
mov ax, es
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadFs.c b/MdePkg/Library/BaseLib/Ia32/ReadFs.c
index 51fb020b12..500058da18 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadFs.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadFs.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of FS Data Segment Register (FS).
@@ -29,4 +26,3 @@ AsmReadFs (
mov ax, fs
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadGdtr.c b/MdePkg/Library/BaseLib/Ia32/ReadGdtr.c
index 5b01300b4b..8f6d6122c4 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadGdtr.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadGdtr.c
@@ -6,10 +6,8 @@
**/
-
#include "BaseLibInternals.h"
-
/**
Reads the current Global Descriptor Table Register(GDTR) descriptor.
@@ -30,4 +28,3 @@ InternalX86ReadGdtr (
sgdt fword ptr [eax]
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadGs.c b/MdePkg/Library/BaseLib/Ia32/ReadGs.c
index 6209a31ae9..6449447b87 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadGs.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadGs.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of GS Data Segment Register (GS).
@@ -29,4 +26,3 @@ AsmReadGs (
mov ax, gs
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadIdtr.c b/MdePkg/Library/BaseLib/Ia32/ReadIdtr.c
index 93f44535d3..4a717bbcf4 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadIdtr.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadIdtr.c
@@ -6,10 +6,8 @@
**/
-
#include "BaseLibInternals.h"
-
/**
Reads the current Interrupt Descriptor Table Register(GDTR) descriptor.
@@ -22,7 +20,7 @@
VOID
EFIAPI
InternalX86ReadIdtr (
- OUT IA32_DESCRIPTOR *Idtr
+ OUT IA32_DESCRIPTOR *Idtr
)
{
_asm {
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadLdtr.c b/MdePkg/Library/BaseLib/Ia32/ReadLdtr.c
index 407676a465..31978ffaa7 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadLdtr.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadLdtr.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current Local Descriptor Table Register(LDTR) selector.
@@ -28,4 +25,3 @@ AsmReadLdtr (
sldt ax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm0.c b/MdePkg/Library/BaseLib/Ia32/ReadMm0.c
index 00dfe05895..f54452ab8c 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm0.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm0.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of 64-bit MMX Register #0 (MM0).
@@ -33,4 +30,3 @@ AsmReadMm0 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm1.c b/MdePkg/Library/BaseLib/Ia32/ReadMm1.c
index 0ed311e412..027cccc30b 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm1.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm1.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of 64-bit MMX Register #1 (MM1).
@@ -33,4 +30,3 @@ AsmReadMm1 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm2.c b/MdePkg/Library/BaseLib/Ia32/ReadMm2.c
index bd830c557f..25c8caa858 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm2.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm2.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of 64-bit MMX Register #2 (MM2).
@@ -33,4 +30,3 @@ AsmReadMm2 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm3.c b/MdePkg/Library/BaseLib/Ia32/ReadMm3.c
index c8967083ba..33aef907e5 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm3.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm3.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of 64-bit MMX Register #3 (MM3).
@@ -33,4 +30,3 @@ AsmReadMm3 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm4.c b/MdePkg/Library/BaseLib/Ia32/ReadMm4.c
index 9e2794cd4d..c5a646ffd9 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm4.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm4.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of 64-bit MMX Register #4 (MM4).
@@ -33,4 +30,3 @@ AsmReadMm4 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm5.c b/MdePkg/Library/BaseLib/Ia32/ReadMm5.c
index 93cad05a49..70b97b8bbb 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm5.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm5.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of 64-bit MMX Register #5 (MM5).
@@ -33,4 +30,3 @@ AsmReadMm5 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm6.c b/MdePkg/Library/BaseLib/Ia32/ReadMm6.c
index d2c559163a..6b3055c4bc 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm6.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm6.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of 64-bit MMX Register #6 (MM6).
@@ -33,4 +30,3 @@ AsmReadMm6 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm7.c b/MdePkg/Library/BaseLib/Ia32/ReadMm7.c
index 68cf039285..9ee911a199 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm7.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm7.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of 64-bit MMX Register #7 (MM7).
@@ -33,4 +30,3 @@ AsmReadMm7 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMsr64.c b/MdePkg/Library/BaseLib/Ia32/ReadMsr64.c
index afe3aa5bdc..837595c9b1 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMsr64.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMsr64.c
@@ -6,7 +6,6 @@
**/
-
#include <Library/RegisterFilterLib.h>
/**
@@ -54,13 +53,14 @@ AsmReadMsr64 (
IN UINT32 Index
)
{
- UINT64 Value;
- BOOLEAN Flag;
+ UINT64 Value;
+ BOOLEAN Flag;
Flag = FilterBeforeMsrRead (Index, &Value);
if (Flag) {
Value = AsmReadMsr64Internal (Index);
}
+
FilterAfterMsrRead (Index, &Value);
return Value;
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadPmc.c b/MdePkg/Library/BaseLib/Ia32/ReadPmc.c
index cc09ed7005..0137fe8525 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadPmc.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadPmc.c
@@ -20,7 +20,7 @@
UINT64
EFIAPI
AsmReadPmc (
- IN UINT32 Index
+ IN UINT32 Index
)
{
_asm {
@@ -28,4 +28,3 @@ AsmReadPmc (
rdpmc
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadSs.c b/MdePkg/Library/BaseLib/Ia32/ReadSs.c
index 9d7a6411a8..e5e2311a00 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadSs.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadSs.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of Stack Segment Register (SS).
@@ -29,4 +26,3 @@ AsmReadSs (
mov ax, ss
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadTr.c b/MdePkg/Library/BaseLib/Ia32/ReadTr.c
index b52f8f31d2..bfb5e6b0db 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadTr.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadTr.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of Task Register (TR).
@@ -28,4 +25,3 @@ AsmReadTr (
str ax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadTsc.c b/MdePkg/Library/BaseLib/Ia32/ReadTsc.c
index a67b57a77d..4109b96d8b 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadTsc.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadTsc.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of Time Stamp Counter (TSC).
@@ -28,4 +25,3 @@ AsmReadTsc (
rdtsc
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/SwapBytes64.c b/MdePkg/Library/BaseLib/Ia32/SwapBytes64.c
index 67587f1d27..42d4f66dd3 100644
--- a/MdePkg/Library/BaseLib/Ia32/SwapBytes64.c
+++ b/MdePkg/Library/BaseLib/Ia32/SwapBytes64.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Switches the endianess of a 64-bit integer.
@@ -24,7 +21,7 @@
UINT64
EFIAPI
InternalMathSwapBytes64 (
- IN UINT64 Operand
+ IN UINT64 Operand
)
{
_asm {
@@ -34,4 +31,3 @@ InternalMathSwapBytes64 (
bswap edx
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/Wbinvd.c b/MdePkg/Library/BaseLib/Ia32/Wbinvd.c
index 87bd71f05d..f41cb4ee14 100644
--- a/MdePkg/Library/BaseLib/Ia32/Wbinvd.c
+++ b/MdePkg/Library/BaseLib/Ia32/Wbinvd.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Executes a WBINVD instruction.
@@ -26,4 +23,3 @@ AsmWbinvd (
wbinvd
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteCr0.c b/MdePkg/Library/BaseLib/Ia32/WriteCr0.c
index 46e49a678a..e20f769c77 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteCr0.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteCr0.c
@@ -28,4 +28,3 @@ AsmWriteCr0 (
mov cr0, eax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteCr2.c b/MdePkg/Library/BaseLib/Ia32/WriteCr2.c
index f437bfc8c8..4571ec9505 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteCr2.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteCr2.c
@@ -28,4 +28,3 @@ AsmWriteCr2 (
mov cr2, eax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteCr3.c b/MdePkg/Library/BaseLib/Ia32/WriteCr3.c
index 48cb8ad16f..29d0ae21f6 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteCr3.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteCr3.c
@@ -28,4 +28,3 @@ AsmWriteCr3 (
mov cr3, eax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteCr4.c b/MdePkg/Library/BaseLib/Ia32/WriteCr4.c
index 01f059ffaa..f152464a4a 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteCr4.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteCr4.c
@@ -30,4 +30,3 @@ AsmWriteCr4 (
_emit 0xE0
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr0.c b/MdePkg/Library/BaseLib/Ia32/WriteDr0.c
index 80bb238184..027e1b458b 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr0.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr0.c
@@ -20,7 +20,7 @@
UINTN
EFIAPI
AsmWriteDr0 (
- IN UINTN Value
+ IN UINTN Value
)
{
_asm {
@@ -28,4 +28,3 @@ AsmWriteDr0 (
mov dr0, eax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr1.c b/MdePkg/Library/BaseLib/Ia32/WriteDr1.c
index f1c8f325e4..302c3491eb 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr1.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr1.c
@@ -20,7 +20,7 @@
UINTN
EFIAPI
AsmWriteDr1 (
- IN UINTN Value
+ IN UINTN Value
)
{
_asm {
@@ -28,4 +28,3 @@ AsmWriteDr1 (
mov dr1, eax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr2.c b/MdePkg/Library/BaseLib/Ia32/WriteDr2.c
index 6e1e7f2406..20b62246c0 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr2.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr2.c
@@ -20,7 +20,7 @@
UINTN
EFIAPI
AsmWriteDr2 (
- IN UINTN Value
+ IN UINTN Value
)
{
_asm {
@@ -28,4 +28,3 @@ AsmWriteDr2 (
mov dr2, eax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr3.c b/MdePkg/Library/BaseLib/Ia32/WriteDr3.c
index 7cb1d3724e..6eafe40dcf 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr3.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr3.c
@@ -20,7 +20,7 @@
UINTN
EFIAPI
AsmWriteDr3 (
- IN UINTN Value
+ IN UINTN Value
)
{
_asm {
@@ -28,4 +28,3 @@ AsmWriteDr3 (
mov dr3, eax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr4.c b/MdePkg/Library/BaseLib/Ia32/WriteDr4.c
index 778017f339..32815b28ff 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr4.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr4.c
@@ -20,7 +20,7 @@
UINTN
EFIAPI
AsmWriteDr4 (
- IN UINTN Value
+ IN UINTN Value
)
{
_asm {
@@ -30,4 +30,3 @@ AsmWriteDr4 (
_emit 0xe0
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr5.c b/MdePkg/Library/BaseLib/Ia32/WriteDr5.c
index 2159813a35..4a0c384518 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr5.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr5.c
@@ -20,7 +20,7 @@
UINTN
EFIAPI
AsmWriteDr5 (
- IN UINTN Value
+ IN UINTN Value
)
{
_asm {
@@ -30,4 +30,3 @@ AsmWriteDr5 (
_emit 0xe8
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr6.c b/MdePkg/Library/BaseLib/Ia32/WriteDr6.c
index c03d71643b..7cfc4bb282 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr6.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr6.c
@@ -20,7 +20,7 @@
UINTN
EFIAPI
AsmWriteDr6 (
- IN UINTN Value
+ IN UINTN Value
)
{
_asm {
@@ -28,4 +28,3 @@ AsmWriteDr6 (
mov dr6, eax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr7.c b/MdePkg/Library/BaseLib/Ia32/WriteDr7.c
index c4821e4cdf..78b0b72aeb 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr7.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr7.c
@@ -20,7 +20,7 @@
UINTN
EFIAPI
AsmWriteDr7 (
- IN UINTN Value
+ IN UINTN Value
)
{
_asm {
@@ -28,4 +28,3 @@ AsmWriteDr7 (
mov dr7, eax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteGdtr.c b/MdePkg/Library/BaseLib/Ia32/WriteGdtr.c
index 37ceae73ff..a542665375 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteGdtr.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteGdtr.c
@@ -6,10 +6,8 @@
**/
-
#include "BaseLibInternals.h"
-
/**
Writes the current Global Descriptor Table Register (GDTR) descriptor.
@@ -22,7 +20,7 @@
VOID
EFIAPI
InternalX86WriteGdtr (
- IN CONST IA32_DESCRIPTOR *Gdtr
+ IN CONST IA32_DESCRIPTOR *Gdtr
)
{
_asm {
@@ -30,4 +28,3 @@ InternalX86WriteGdtr (
lgdt fword ptr [eax]
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteIdtr.c b/MdePkg/Library/BaseLib/Ia32/WriteIdtr.c
index 49ef22b997..aaa29b3d1e 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteIdtr.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteIdtr.c
@@ -6,7 +6,6 @@
**/
-
#include "BaseLibInternals.h"
/**
@@ -21,7 +20,7 @@
VOID
EFIAPI
InternalX86WriteIdtr (
- IN CONST IA32_DESCRIPTOR *Idtr
+ IN CONST IA32_DESCRIPTOR *Idtr
)
{
_asm {
@@ -32,4 +31,3 @@ InternalX86WriteIdtr (
popfd
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteLdtr.c b/MdePkg/Library/BaseLib/Ia32/WriteLdtr.c
index 8e12f7840b..d45f0fe076 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteLdtr.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteLdtr.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Writes the current Local Descriptor Table Register (GDTR) selector.
@@ -21,7 +18,7 @@
VOID
EFIAPI
AsmWriteLdtr (
- IN UINT16 Ldtr
+ IN UINT16 Ldtr
)
{
_asm {
@@ -30,4 +27,3 @@ AsmWriteLdtr (
lldt ax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm0.c b/MdePkg/Library/BaseLib/Ia32/WriteMm0.c
index ea26009a68..7807c3583a 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm0.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm0.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Writes the current value of 64-bit MMX Register #0 (MM0).
@@ -21,7 +18,7 @@
VOID
EFIAPI
AsmWriteMm0 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
_asm {
@@ -29,4 +26,3 @@ AsmWriteMm0 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm1.c b/MdePkg/Library/BaseLib/Ia32/WriteMm1.c
index b8da47329d..378aac289a 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm1.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm1.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Writes the current value of 64-bit MMX Register #1 (MM1).
@@ -21,7 +18,7 @@
VOID
EFIAPI
AsmWriteMm1 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
_asm {
@@ -29,4 +26,3 @@ AsmWriteMm1 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm2.c b/MdePkg/Library/BaseLib/Ia32/WriteMm2.c
index 6b77aed7a4..ebab66f239 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm2.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm2.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Writes the current value of 64-bit MMX Register #2 (MM2).
@@ -21,7 +18,7 @@
VOID
EFIAPI
AsmWriteMm2 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
_asm {
@@ -29,4 +26,3 @@ AsmWriteMm2 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm3.c b/MdePkg/Library/BaseLib/Ia32/WriteMm3.c
index 4fc7d7042b..645a14fc68 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm3.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm3.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Writes the current value of 64-bit MMX Register #3 (MM3).
@@ -21,7 +18,7 @@
VOID
EFIAPI
AsmWriteMm3 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
_asm {
@@ -29,4 +26,3 @@ AsmWriteMm3 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm4.c b/MdePkg/Library/BaseLib/Ia32/WriteMm4.c
index 2fce554974..8a4728e594 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm4.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm4.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Writes the current value of 64-bit MMX Register #4 (MM4).
@@ -21,7 +18,7 @@
VOID
EFIAPI
AsmWriteMm4 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
_asm {
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm5.c b/MdePkg/Library/BaseLib/Ia32/WriteMm5.c
index a0ec714e30..1c4adc0feb 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm5.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm5.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Writes the current value of 64-bit MMX Register #5 (MM5).
@@ -21,7 +18,7 @@
VOID
EFIAPI
AsmWriteMm5 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
_asm {
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm6.c b/MdePkg/Library/BaseLib/Ia32/WriteMm6.c
index c3b57b4b51..8023fc05d7 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm6.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm6.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Writes the current value of 64-bit MMX Register #6 (MM6).
@@ -21,7 +18,7 @@
VOID
EFIAPI
AsmWriteMm6 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
_asm {
@@ -29,4 +26,3 @@ AsmWriteMm6 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm7.c b/MdePkg/Library/BaseLib/Ia32/WriteMm7.c
index e1e8932458..0b0fc44c71 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm7.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm7.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Writes the current value of 64-bit MMX Register #7 (MM7).
@@ -21,7 +18,7 @@
VOID
EFIAPI
AsmWriteMm7 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
_asm {
@@ -29,4 +26,3 @@ AsmWriteMm7 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMsr64.c b/MdePkg/Library/BaseLib/Ia32/WriteMsr64.c
index ba0cf3f74c..e8e49212f1 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMsr64.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMsr64.c
@@ -6,7 +6,6 @@
**/
-
#include <Library/RegisterFilterLib.h>
/**
@@ -33,7 +32,7 @@ AsmWriteMsr64 (
IN UINT64 Value
)
{
- BOOLEAN Flag;
+ BOOLEAN Flag;
Flag = FilterBeforeMsrWrite (Index, &Value);
if (Flag) {
@@ -44,8 +43,8 @@ AsmWriteMsr64 (
wrmsr
}
}
+
FilterAfterMsrWrite (Index, &Value);
return Value;
}
-
diff --git a/MdePkg/Library/BaseLib/LRotU32.c b/MdePkg/Library/BaseLib/LRotU32.c
index 4e671a320c..e9f4790d5b 100644
--- a/MdePkg/Library/BaseLib/LRotU32.c
+++ b/MdePkg/Library/BaseLib/LRotU32.c
@@ -27,8 +27,8 @@
UINT32
EFIAPI
LRotU32 (
- IN UINT32 Operand,
- IN UINTN Count
+ IN UINT32 Operand,
+ IN UINTN Count
)
{
ASSERT (Count < 32);
diff --git a/MdePkg/Library/BaseLib/LRotU64.c b/MdePkg/Library/BaseLib/LRotU64.c
index 48f35dc63a..aa6a9a2251 100644
--- a/MdePkg/Library/BaseLib/LRotU64.c
+++ b/MdePkg/Library/BaseLib/LRotU64.c
@@ -27,8 +27,8 @@
UINT64
EFIAPI
LRotU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
ASSERT (Count < 64);
diff --git a/MdePkg/Library/BaseLib/LShiftU64.c b/MdePkg/Library/BaseLib/LShiftU64.c
index 7b41a3efba..ce613c601b 100644
--- a/MdePkg/Library/BaseLib/LShiftU64.c
+++ b/MdePkg/Library/BaseLib/LShiftU64.c
@@ -26,8 +26,8 @@
UINT64
EFIAPI
LShiftU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
ASSERT (Count < 64);
diff --git a/MdePkg/Library/BaseLib/LinkedList.c b/MdePkg/Library/BaseLib/LinkedList.c
index 5648c18771..3aa20ef8a1 100644
--- a/MdePkg/Library/BaseLib/LinkedList.c
+++ b/MdePkg/Library/BaseLib/LinkedList.c
@@ -28,7 +28,7 @@
**/
#if !defined (MDEPKG_NDEBUG)
- #define ASSERT_VERIFY_NODE_IN_VALID_LIST(FirstEntry, SecondEntry, InList) \
+#define ASSERT_VERIFY_NODE_IN_VALID_LIST(FirstEntry, SecondEntry, InList) \
do { \
if (FeaturePcdGet (PcdVerifyNodeInList)) { \
ASSERT (InList == IsNodeInList ((FirstEntry), (SecondEntry))); \
@@ -37,7 +37,7 @@
} \
} while (FALSE)
#else
- #define ASSERT_VERIFY_NODE_IN_VALID_LIST(FirstEntry, SecondEntry, InList)
+#define ASSERT_VERIFY_NODE_IN_VALID_LIST(FirstEntry, SecondEntry, InList)
#endif
/**
@@ -119,8 +119,8 @@ InternalBaseLibIsListValid (
BOOLEAN
EFIAPI
IsNodeInList (
- IN CONST LIST_ENTRY *FirstEntry,
- IN CONST LIST_ENTRY *SecondEntry
+ IN CONST LIST_ENTRY *FirstEntry,
+ IN CONST LIST_ENTRY *SecondEntry
)
{
UINTN Count;
@@ -180,14 +180,14 @@ IsNodeInList (
LIST_ENTRY *
EFIAPI
InitializeListHead (
- IN OUT LIST_ENTRY *ListHead
+ IN OUT LIST_ENTRY *ListHead
)
{
ASSERT (ListHead != NULL);
ListHead->ForwardLink = ListHead;
- ListHead->BackLink = ListHead;
+ ListHead->BackLink = ListHead;
return ListHead;
}
@@ -216,8 +216,8 @@ InitializeListHead (
LIST_ENTRY *
EFIAPI
InsertHeadList (
- IN OUT LIST_ENTRY *ListHead,
- IN OUT LIST_ENTRY *Entry
+ IN OUT LIST_ENTRY *ListHead,
+ IN OUT LIST_ENTRY *Entry
)
{
//
@@ -225,10 +225,10 @@ InsertHeadList (
//
ASSERT_VERIFY_NODE_IN_VALID_LIST (ListHead, Entry, FALSE);
- Entry->ForwardLink = ListHead->ForwardLink;
- Entry->BackLink = ListHead;
+ Entry->ForwardLink = ListHead->ForwardLink;
+ Entry->BackLink = ListHead;
Entry->ForwardLink->BackLink = Entry;
- ListHead->ForwardLink = Entry;
+ ListHead->ForwardLink = Entry;
return ListHead;
}
@@ -257,8 +257,8 @@ InsertHeadList (
LIST_ENTRY *
EFIAPI
InsertTailList (
- IN OUT LIST_ENTRY *ListHead,
- IN OUT LIST_ENTRY *Entry
+ IN OUT LIST_ENTRY *ListHead,
+ IN OUT LIST_ENTRY *Entry
)
{
//
@@ -266,10 +266,10 @@ InsertTailList (
//
ASSERT_VERIFY_NODE_IN_VALID_LIST (ListHead, Entry, FALSE);
- Entry->ForwardLink = ListHead;
- Entry->BackLink = ListHead->BackLink;
+ Entry->ForwardLink = ListHead;
+ Entry->BackLink = ListHead->BackLink;
Entry->BackLink->ForwardLink = Entry;
- ListHead->BackLink = Entry;
+ ListHead->BackLink = Entry;
return ListHead;
}
@@ -296,7 +296,7 @@ InsertTailList (
LIST_ENTRY *
EFIAPI
GetFirstNode (
- IN CONST LIST_ENTRY *List
+ IN CONST LIST_ENTRY *List
)
{
//
@@ -331,8 +331,8 @@ GetFirstNode (
LIST_ENTRY *
EFIAPI
GetNextNode (
- IN CONST LIST_ENTRY *List,
- IN CONST LIST_ENTRY *Node
+ IN CONST LIST_ENTRY *List,
+ IN CONST LIST_ENTRY *Node
)
{
//
@@ -367,8 +367,8 @@ GetNextNode (
LIST_ENTRY *
EFIAPI
GetPreviousNode (
- IN CONST LIST_ENTRY *List,
- IN CONST LIST_ENTRY *Node
+ IN CONST LIST_ENTRY *List,
+ IN CONST LIST_ENTRY *Node
)
{
//
@@ -401,7 +401,7 @@ GetPreviousNode (
BOOLEAN
EFIAPI
IsListEmpty (
- IN CONST LIST_ENTRY *ListHead
+ IN CONST LIST_ENTRY *ListHead
)
{
//
@@ -441,8 +441,8 @@ IsListEmpty (
BOOLEAN
EFIAPI
IsNull (
- IN CONST LIST_ENTRY *List,
- IN CONST LIST_ENTRY *Node
+ IN CONST LIST_ENTRY *List,
+ IN CONST LIST_ENTRY *Node
)
{
//
@@ -479,8 +479,8 @@ IsNull (
BOOLEAN
EFIAPI
IsNodeAtEnd (
- IN CONST LIST_ENTRY *List,
- IN CONST LIST_ENTRY *Node
+ IN CONST LIST_ENTRY *List,
+ IN CONST LIST_ENTRY *Node
)
{
//
@@ -520,11 +520,11 @@ IsNodeAtEnd (
LIST_ENTRY *
EFIAPI
SwapListEntries (
- IN OUT LIST_ENTRY *FirstEntry,
- IN OUT LIST_ENTRY *SecondEntry
+ IN OUT LIST_ENTRY *FirstEntry,
+ IN OUT LIST_ENTRY *SecondEntry
)
{
- LIST_ENTRY *Ptr;
+ LIST_ENTRY *Ptr;
if (FirstEntry == SecondEntry) {
return SecondEntry;
@@ -588,7 +588,7 @@ SwapListEntries (
LIST_ENTRY *
EFIAPI
RemoveEntryList (
- IN CONST LIST_ENTRY *Entry
+ IN CONST LIST_ENTRY *Entry
)
{
ASSERT (!IsListEmpty (Entry));
diff --git a/MdePkg/Library/BaseLib/LongJump.c b/MdePkg/Library/BaseLib/LongJump.c
index 1d88e41213..a34f89e7a8 100644
--- a/MdePkg/Library/BaseLib/LongJump.c
+++ b/MdePkg/Library/BaseLib/LongJump.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
diff --git a/MdePkg/Library/BaseLib/LowBitSet32.c b/MdePkg/Library/BaseLib/LowBitSet32.c
index 8383c7954c..52714314dd 100644
--- a/MdePkg/Library/BaseLib/LowBitSet32.c
+++ b/MdePkg/Library/BaseLib/LowBitSet32.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -27,15 +24,17 @@
INTN
EFIAPI
LowBitSet32 (
- IN UINT32 Operand
+ IN UINT32 Operand
)
{
- INTN BitIndex;
+ INTN BitIndex;
if (Operand == 0) {
return -1;
}
- for (BitIndex = 0; 0 == (Operand & 1); BitIndex++, Operand >>= 1);
+ for (BitIndex = 0; 0 == (Operand & 1); BitIndex++, Operand >>= 1) {
+ }
+
return BitIndex;
}
diff --git a/MdePkg/Library/BaseLib/LowBitSet64.c b/MdePkg/Library/BaseLib/LowBitSet64.c
index 349ed526be..c1bc16c596 100644
--- a/MdePkg/Library/BaseLib/LowBitSet64.c
+++ b/MdePkg/Library/BaseLib/LowBitSet64.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -28,10 +25,10 @@
INTN
EFIAPI
LowBitSet64 (
- IN UINT64 Operand
+ IN UINT64 Operand
)
{
- INTN BitIndex;
+ INTN BitIndex;
if (Operand == 0) {
return -1;
@@ -39,6 +36,9 @@ LowBitSet64 (
for (BitIndex = 0;
(Operand & 1) == 0;
- BitIndex++, Operand = RShiftU64 (Operand, 1));
+ BitIndex++, Operand = RShiftU64 (Operand, 1))
+ {
+ }
+
return BitIndex;
}
diff --git a/MdePkg/Library/BaseLib/Math64.c b/MdePkg/Library/BaseLib/Math64.c
index 154b97ae79..5756d0fe92 100644
--- a/MdePkg/Library/BaseLib/Math64.c
+++ b/MdePkg/Library/BaseLib/Math64.c
@@ -25,8 +25,8 @@
UINT64
EFIAPI
InternalMathLShiftU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
return Operand << Count;
@@ -48,8 +48,8 @@ InternalMathLShiftU64 (
UINT64
EFIAPI
InternalMathRShiftU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
return Operand >> Count;
@@ -71,8 +71,8 @@ InternalMathRShiftU64 (
UINT64
EFIAPI
InternalMathARShiftU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
INTN TestValue;
@@ -95,7 +95,6 @@ InternalMathARShiftU64 (
((INTN)Operand < 0 ? ~((UINTN)-1 >> Count) : 0);
}
-
/**
Rotates a 64-bit integer left between 0 and 63 bits, filling
the low bits with the high bits that were rotated.
@@ -113,8 +112,8 @@ InternalMathARShiftU64 (
UINT64
EFIAPI
InternalMathLRotU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
return (Operand << Count) | (Operand >> (64 - Count));
@@ -137,8 +136,8 @@ InternalMathLRotU64 (
UINT64
EFIAPI
InternalMathRRotU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
return (Operand >> Count) | (Operand << (64 - Count));
@@ -159,14 +158,14 @@ InternalMathRRotU64 (
UINT64
EFIAPI
InternalMathSwapBytes64 (
- IN UINT64 Operand
+ IN UINT64 Operand
)
{
UINT64 LowerBytes;
UINT64 HigherBytes;
- LowerBytes = (UINT64) SwapBytes32 ((UINT32) Operand);
- HigherBytes = (UINT64) SwapBytes32 ((UINT32) (Operand >> 32));
+ LowerBytes = (UINT64)SwapBytes32 ((UINT32)Operand);
+ HigherBytes = (UINT64)SwapBytes32 ((UINT32)(Operand >> 32));
return (LowerBytes << 32 | HigherBytes);
}
@@ -188,14 +187,13 @@ InternalMathSwapBytes64 (
UINT64
EFIAPI
InternalMathMultU64x32 (
- IN UINT64 Multiplicand,
- IN UINT32 Multiplier
+ IN UINT64 Multiplicand,
+ IN UINT32 Multiplier
)
{
return Multiplicand * Multiplier;
}
-
/**
Multiplies a 64-bit unsigned integer by a 64-bit unsigned integer
and generates a 64-bit unsigned result.
@@ -213,8 +211,8 @@ InternalMathMultU64x32 (
UINT64
EFIAPI
InternalMathMultU64x64 (
- IN UINT64 Multiplicand,
- IN UINT64 Multiplier
+ IN UINT64 Multiplicand,
+ IN UINT64 Multiplier
)
{
return Multiplicand * Multiplier;
@@ -237,8 +235,8 @@ InternalMathMultU64x64 (
UINT64
EFIAPI
InternalMathDivU64x32 (
- IN UINT64 Dividend,
- IN UINT32 Divisor
+ IN UINT64 Dividend,
+ IN UINT32 Divisor
)
{
return Dividend / Divisor;
@@ -261,8 +259,8 @@ InternalMathDivU64x32 (
UINT32
EFIAPI
InternalMathModU64x32 (
- IN UINT64 Dividend,
- IN UINT32 Divisor
+ IN UINT64 Dividend,
+ IN UINT32 Divisor
)
{
return (UINT32)(Dividend % Divisor);
@@ -288,14 +286,15 @@ InternalMathModU64x32 (
UINT64
EFIAPI
InternalMathDivRemU64x32 (
- IN UINT64 Dividend,
- IN UINT32 Divisor,
- OUT UINT32 *Remainder OPTIONAL
+ IN UINT64 Dividend,
+ IN UINT32 Divisor,
+ OUT UINT32 *Remainder OPTIONAL
)
{
if (Remainder != NULL) {
*Remainder = (UINT32)(Dividend % Divisor);
}
+
return Dividend / Divisor;
}
@@ -319,14 +318,15 @@ InternalMathDivRemU64x32 (
UINT64
EFIAPI
InternalMathDivRemU64x64 (
- IN UINT64 Dividend,
- IN UINT64 Divisor,
- OUT UINT64 *Remainder OPTIONAL
+ IN UINT64 Dividend,
+ IN UINT64 Divisor,
+ OUT UINT64 *Remainder OPTIONAL
)
{
if (Remainder != NULL) {
*Remainder = Dividend % Divisor;
}
+
return Dividend / Divisor;
}
@@ -350,13 +350,14 @@ InternalMathDivRemU64x64 (
INT64
EFIAPI
InternalMathDivRemS64x64 (
- IN INT64 Dividend,
- IN INT64 Divisor,
- OUT INT64 *Remainder OPTIONAL
+ IN INT64 Dividend,
+ IN INT64 Divisor,
+ OUT INT64 *Remainder OPTIONAL
)
{
if (Remainder != NULL) {
*Remainder = Dividend % Divisor;
}
+
return Dividend / Divisor;
}
diff --git a/MdePkg/Library/BaseLib/ModU64x32.c b/MdePkg/Library/BaseLib/ModU64x32.c
index ee99ab3223..bfdbf8bbed 100644
--- a/MdePkg/Library/BaseLib/ModU64x32.c
+++ b/MdePkg/Library/BaseLib/ModU64x32.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -30,8 +27,8 @@
UINT32
EFIAPI
ModU64x32 (
- IN UINT64 Dividend,
- IN UINT32 Divisor
+ IN UINT64 Dividend,
+ IN UINT32 Divisor
)
{
ASSERT (Divisor != 0);
diff --git a/MdePkg/Library/BaseLib/MultS64x64.c b/MdePkg/Library/BaseLib/MultS64x64.c
index b5c745f7c5..e9db474974 100644
--- a/MdePkg/Library/BaseLib/MultS64x64.c
+++ b/MdePkg/Library/BaseLib/MultS64x64.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -28,9 +25,9 @@
INT64
EFIAPI
MultS64x64 (
- IN INT64 Multiplicand,
- IN INT64 Multiplier
+ IN INT64 Multiplicand,
+ IN INT64 Multiplier
)
{
- return (INT64)MultU64x64 ((UINT64) Multiplicand, (UINT64) Multiplier);
+ return (INT64)MultU64x64 ((UINT64)Multiplicand, (UINT64)Multiplier);
}
diff --git a/MdePkg/Library/BaseLib/MultU64x32.c b/MdePkg/Library/BaseLib/MultU64x32.c
index 2bbff51c82..f4c65f8c73 100644
--- a/MdePkg/Library/BaseLib/MultU64x32.c
+++ b/MdePkg/Library/BaseLib/MultU64x32.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -28,11 +25,11 @@
UINT64
EFIAPI
MultU64x32 (
- IN UINT64 Multiplicand,
- IN UINT32 Multiplier
+ IN UINT64 Multiplicand,
+ IN UINT32 Multiplier
)
{
- UINT64 Result;
+ UINT64 Result;
Result = InternalMathMultU64x32 (Multiplicand, Multiplier);
diff --git a/MdePkg/Library/BaseLib/MultU64x64.c b/MdePkg/Library/BaseLib/MultU64x64.c
index e1ee9f1c9c..90dea81856 100644
--- a/MdePkg/Library/BaseLib/MultU64x64.c
+++ b/MdePkg/Library/BaseLib/MultU64x64.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -28,11 +25,11 @@
UINT64
EFIAPI
MultU64x64 (
- IN UINT64 Multiplicand,
- IN UINT64 Multiplier
+ IN UINT64 Multiplicand,
+ IN UINT64 Multiplier
)
{
- UINT64 Result;
+ UINT64 Result;
Result = InternalMathMultU64x64 (Multiplicand, Multiplier);
diff --git a/MdePkg/Library/BaseLib/QuickSort.c b/MdePkg/Library/BaseLib/QuickSort.c
index a825c072b0..d9f0e9a0f4 100644
--- a/MdePkg/Library/BaseLib/QuickSort.c
+++ b/MdePkg/Library/BaseLib/QuickSort.c
@@ -34,16 +34,16 @@
VOID
EFIAPI
QuickSort (
- IN OUT VOID *BufferToSort,
- IN CONST UINTN Count,
- IN CONST UINTN ElementSize,
- IN BASE_SORT_COMPARE CompareFunction,
- OUT VOID *BufferOneElement
+ IN OUT VOID *BufferToSort,
+ IN CONST UINTN Count,
+ IN CONST UINTN ElementSize,
+ IN BASE_SORT_COMPARE CompareFunction,
+ OUT VOID *BufferOneElement
)
{
- VOID *Pivot;
- UINTN LoopCount;
- UINTN NextSwapLocation;
+ VOID *Pivot;
+ UINTN LoopCount;
+ UINTN NextSwapLocation;
ASSERT (BufferToSort != NULL);
ASSERT (CompareFunction != NULL);
@@ -59,7 +59,7 @@ QuickSort (
//
// pick a pivot (we choose last element)
//
- Pivot = ((UINT8*) BufferToSort + ((Count - 1) * ElementSize));
+ Pivot = ((UINT8 *)BufferToSort + ((Count - 1) * ElementSize));
//
// Now get the pivot such that all on "left" are below it
@@ -69,13 +69,13 @@ QuickSort (
//
// if the element is less than or equal to the pivot
//
- if (CompareFunction ((VOID*) ((UINT8*) BufferToSort + ((LoopCount) * ElementSize)), Pivot) <= 0){
+ if (CompareFunction ((VOID *)((UINT8 *)BufferToSort + ((LoopCount) * ElementSize)), Pivot) <= 0) {
//
// swap
//
- CopyMem (BufferOneElement, (UINT8*) BufferToSort + (NextSwapLocation * ElementSize), ElementSize);
- CopyMem ((UINT8*) BufferToSort + (NextSwapLocation * ElementSize), (UINT8*) BufferToSort + ((LoopCount) * ElementSize), ElementSize);
- CopyMem ((UINT8*) BufferToSort + ((LoopCount)*ElementSize), BufferOneElement, ElementSize);
+ CopyMem (BufferOneElement, (UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), ElementSize);
+ CopyMem ((UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), (UINT8 *)BufferToSort + ((LoopCount) * ElementSize), ElementSize);
+ CopyMem ((UINT8 *)BufferToSort + ((LoopCount)*ElementSize), BufferOneElement, ElementSize);
//
// increment NextSwapLocation
@@ -83,12 +83,13 @@ QuickSort (
NextSwapLocation++;
}
}
+
//
// swap pivot to it's final position (NextSwapLocation)
//
CopyMem (BufferOneElement, Pivot, ElementSize);
- CopyMem (Pivot, (UINT8*) BufferToSort + (NextSwapLocation * ElementSize), ElementSize);
- CopyMem ((UINT8*) BufferToSort + (NextSwapLocation * ElementSize), BufferOneElement, ElementSize);
+ CopyMem (Pivot, (UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), ElementSize);
+ CopyMem ((UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), BufferOneElement, ElementSize);
//
// Now recurse on 2 partial lists. neither of these will have the 'pivot' element
diff --git a/MdePkg/Library/BaseLib/RRotU32.c b/MdePkg/Library/BaseLib/RRotU32.c
index 3956fadddd..909168fac4 100644
--- a/MdePkg/Library/BaseLib/RRotU32.c
+++ b/MdePkg/Library/BaseLib/RRotU32.c
@@ -27,8 +27,8 @@
UINT32
EFIAPI
RRotU32 (
- IN UINT32 Operand,
- IN UINTN Count
+ IN UINT32 Operand,
+ IN UINTN Count
)
{
ASSERT (Count < 32);
diff --git a/MdePkg/Library/BaseLib/RRotU64.c b/MdePkg/Library/BaseLib/RRotU64.c
index e07ffd656b..f75c7355c7 100644
--- a/MdePkg/Library/BaseLib/RRotU64.c
+++ b/MdePkg/Library/BaseLib/RRotU64.c
@@ -27,8 +27,8 @@
UINT64
EFIAPI
RRotU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
ASSERT (Count < 64);
diff --git a/MdePkg/Library/BaseLib/RShiftU64.c b/MdePkg/Library/BaseLib/RShiftU64.c
index 20f94f7741..2ae24b3fe8 100644
--- a/MdePkg/Library/BaseLib/RShiftU64.c
+++ b/MdePkg/Library/BaseLib/RShiftU64.c
@@ -26,8 +26,8 @@
UINT64
EFIAPI
RShiftU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
ASSERT (Count < 64);
diff --git a/MdePkg/Library/BaseLib/RiscV64/CpuBreakpoint.c b/MdePkg/Library/BaseLib/RiscV64/CpuBreakpoint.c
index 88d0877a2f..6274cbcfaa 100644
--- a/MdePkg/Library/BaseLib/RiscV64/CpuBreakpoint.c
+++ b/MdePkg/Library/BaseLib/RiscV64/CpuBreakpoint.c
@@ -8,7 +8,10 @@
#include "BaseLibInternals.h"
-extern VOID RiscVCpuBreakpoint (VOID);
+extern VOID
+RiscVCpuBreakpoint (
+ VOID
+ );
/**
Generates a breakpoint on the CPU.
diff --git a/MdePkg/Library/BaseLib/RiscV64/CpuPause.c b/MdePkg/Library/BaseLib/RiscV64/CpuPause.c
index 9931bad294..687d68e3ec 100644
--- a/MdePkg/Library/BaseLib/RiscV64/CpuPause.c
+++ b/MdePkg/Library/BaseLib/RiscV64/CpuPause.c
@@ -8,8 +8,10 @@
#include "BaseLibInternals.h"
-extern VOID RiscVCpuPause (VOID);
-
+extern VOID
+RiscVCpuPause (
+ VOID
+ );
/**
Requests CPU to pause for a short period of time.
@@ -26,4 +28,3 @@ CpuPause (
{
RiscVCpuPause ();
}
-
diff --git a/MdePkg/Library/BaseLib/RiscV64/DisableInterrupts.c b/MdePkg/Library/BaseLib/RiscV64/DisableInterrupts.c
index 867086c09c..47aab90547 100644
--- a/MdePkg/Library/BaseLib/RiscV64/DisableInterrupts.c
+++ b/MdePkg/Library/BaseLib/RiscV64/DisableInterrupts.c
@@ -7,7 +7,10 @@
**/
#include "BaseLibInternals.h"
-extern VOID RiscVDisableSupervisorModeInterrupts (VOID);
+extern VOID
+RiscVDisableSupervisorModeInterrupts (
+ VOID
+ );
/**
Disables CPU interrupts.
@@ -21,4 +24,3 @@ DisableInterrupts (
{
RiscVDisableSupervisorModeInterrupts ();
}
-
diff --git a/MdePkg/Library/BaseLib/RiscV64/EnableInterrupts.c b/MdePkg/Library/BaseLib/RiscV64/EnableInterrupts.c
index 22ef73067e..7514d31848 100644
--- a/MdePkg/Library/BaseLib/RiscV64/EnableInterrupts.c
+++ b/MdePkg/Library/BaseLib/RiscV64/EnableInterrupts.c
@@ -8,7 +8,10 @@
#include "BaseLibInternals.h"
-extern VOID RiscVEnableSupervisorModeInterrupt (VOID);
+extern VOID
+RiscVEnableSupervisorModeInterrupt (
+ VOID
+ );
/**
Enables CPU interrupts.
@@ -22,4 +25,3 @@ EnableInterrupts (
{
RiscVEnableSupervisorModeInterrupt ();
}
-
diff --git a/MdePkg/Library/BaseLib/RiscV64/GetInterruptState.c b/MdePkg/Library/BaseLib/RiscV64/GetInterruptState.c
index 292f1ec441..1aa863d145 100644
--- a/MdePkg/Library/BaseLib/RiscV64/GetInterruptState.c
+++ b/MdePkg/Library/BaseLib/RiscV64/GetInterruptState.c
@@ -8,7 +8,10 @@
#include "BaseLibInternals.h"
-extern UINT32 RiscVGetSupervisorModeInterrupts (VOID);
+extern UINT32
+RiscVGetSupervisorModeInterrupts (
+ VOID
+ );
/**
Retrieves the current CPU interrupt state.
@@ -26,10 +29,8 @@ GetInterruptState (
VOID
)
{
- unsigned long RetValue;
+ unsigned long RetValue;
RetValue = RiscVGetSupervisorModeInterrupts ();
- return RetValue? TRUE: FALSE;
+ return RetValue ? TRUE : FALSE;
}
-
-
diff --git a/MdePkg/Library/BaseLib/RiscV64/InternalSwitchStack.c b/MdePkg/Library/BaseLib/RiscV64/InternalSwitchStack.c
index ed84cdfa94..cf646e498a 100644
--- a/MdePkg/Library/BaseLib/RiscV64/InternalSwitchStack.c
+++ b/MdePkg/Library/BaseLib/RiscV64/InternalSwitchStack.c
@@ -44,12 +44,18 @@ InternalSwitchStack (
{
BASE_LIBRARY_JUMP_BUFFER JumpBuffer;
- DEBUG ((DEBUG_INFO, "RISC-V InternalSwitchStack Entry:%x Context1:%x Context2:%x NewStack%x\n", \
- EntryPoint, Context1, Context2, NewStack));
+ DEBUG ((
+ DEBUG_INFO,
+ "RISC-V InternalSwitchStack Entry:%x Context1:%x Context2:%x NewStack%x\n", \
+ EntryPoint,
+ Context1,
+ Context2,
+ NewStack
+ ));
JumpBuffer.RA = (UINTN)EntryPoint;
JumpBuffer.SP = (UINTN)NewStack - sizeof (VOID *);
JumpBuffer.S0 = (UINT64)(UINTN)Context1;
JumpBuffer.S1 = (UINT64)(UINTN)Context2;
LongJump (&JumpBuffer, (UINTN)-1);
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
diff --git a/MdePkg/Library/BaseLib/SafeString.c b/MdePkg/Library/BaseLib/SafeString.c
index 149a9c04ba..f338a32a3a 100644
--- a/MdePkg/Library/BaseLib/SafeString.c
+++ b/MdePkg/Library/BaseLib/SafeString.c
@@ -35,16 +35,18 @@
**/
BOOLEAN
InternalSafeStringIsOverlap (
- IN VOID *Base1,
- IN UINTN Size1,
- IN VOID *Base2,
- IN UINTN Size2
+ IN VOID *Base1,
+ IN UINTN Size1,
+ IN VOID *Base2,
+ IN UINTN Size2
)
{
if ((((UINTN)Base1 >= (UINTN)Base2) && ((UINTN)Base1 < (UINTN)Base2 + Size2)) ||
- (((UINTN)Base2 >= (UINTN)Base1) && ((UINTN)Base2 < (UINTN)Base1 + Size1))) {
+ (((UINTN)Base2 >= (UINTN)Base1) && ((UINTN)Base2 < (UINTN)Base1 + Size1)))
+ {
return TRUE;
}
+
return FALSE;
}
@@ -69,7 +71,7 @@ InternalSafeStringNoStrOverlap (
IN UINTN Size2
)
{
- return !InternalSafeStringIsOverlap (Str1, Size1 * sizeof(CHAR16), Str2, Size2 * sizeof(CHAR16));
+ return !InternalSafeStringIsOverlap (Str1, Size1 * sizeof (CHAR16), Str2, Size2 * sizeof (CHAR16));
}
/**
@@ -87,10 +89,10 @@ InternalSafeStringNoStrOverlap (
**/
BOOLEAN
InternalSafeStringNoAsciiStrOverlap (
- IN CHAR8 *Str1,
- IN UINTN Size1,
- IN CHAR8 *Str2,
- IN UINTN Size2
+ IN CHAR8 *Str1,
+ IN UINTN Size1,
+ IN CHAR8 *Str2,
+ IN UINTN Size2
)
{
return !InternalSafeStringIsOverlap (Str1, Size1, Str2, Size2);
@@ -115,13 +117,13 @@ InternalSafeStringNoAsciiStrOverlap (
UINTN
EFIAPI
StrnLenS (
- IN CONST CHAR16 *String,
- IN UINTN MaxSize
+ IN CONST CHAR16 *String,
+ IN UINTN MaxSize
)
{
- UINTN Length;
+ UINTN Length;
- ASSERT (((UINTN) String & BIT0) == 0);
+ ASSERT (((UINTN)String & BIT0) == 0);
//
// If String is a null pointer or MaxSize is 0, then the StrnLenS function returns zero.
@@ -141,8 +143,10 @@ StrnLenS (
if (Length >= MaxSize - 1) {
return MaxSize;
}
+
Length++;
}
+
return Length;
}
@@ -170,8 +174,8 @@ StrnLenS (
UINTN
EFIAPI
StrnSizeS (
- IN CONST CHAR16 *String,
- IN UINTN MaxSize
+ IN CONST CHAR16 *String,
+ IN UINTN MaxSize
)
{
//
@@ -220,15 +224,15 @@ StrnSizeS (
RETURN_STATUS
EFIAPI
StrCpyS (
- OUT CHAR16 *Destination,
- IN UINTN DestMax,
- IN CONST CHAR16 *Source
+ OUT CHAR16 *Destination,
+ IN UINTN DestMax,
+ IN CONST CHAR16 *Source
)
{
- UINTN SourceLen;
+ UINTN SourceLen;
- ASSERT (((UINTN) Destination & BIT0) == 0);
- ASSERT (((UINTN) Source & BIT0) == 0);
+ ASSERT (((UINTN)Destination & BIT0) == 0);
+ ASSERT (((UINTN)Source & BIT0) == 0);
//
// 1. Neither Destination nor Source shall be a null pointer.
@@ -266,6 +270,7 @@ StrCpyS (
while (*Source != 0) {
*(Destination++) = *(Source++);
}
+
*Destination = 0;
return RETURN_SUCCESS;
@@ -303,16 +308,16 @@ StrCpyS (
RETURN_STATUS
EFIAPI
StrnCpyS (
- OUT CHAR16 *Destination,
- IN UINTN DestMax,
- IN CONST CHAR16 *Source,
- IN UINTN Length
+ OUT CHAR16 *Destination,
+ IN UINTN DestMax,
+ IN CONST CHAR16 *Source,
+ IN UINTN Length
)
{
- UINTN SourceLen;
+ UINTN SourceLen;
- ASSERT (((UINTN) Destination & BIT0) == 0);
- ASSERT (((UINTN) Source & BIT0) == 0);
+ ASSERT (((UINTN)Destination & BIT0) == 0);
+ ASSERT (((UINTN)Source & BIT0) == 0);
//
// 1. Neither Destination nor Source shall be a null pointer.
@@ -347,6 +352,7 @@ StrnCpyS (
if (SourceLen > Length) {
SourceLen = Length;
}
+
SAFE_STRING_CONSTRAINT_CHECK (InternalSafeStringNoStrOverlap (Destination, DestMax, (CHAR16 *)Source, SourceLen + 1), RETURN_ACCESS_DENIED);
//
@@ -359,6 +365,7 @@ StrnCpyS (
*(Destination++) = *(Source++);
SourceLen--;
}
+
*Destination = 0;
return RETURN_SUCCESS;
@@ -396,17 +403,17 @@ StrnCpyS (
RETURN_STATUS
EFIAPI
StrCatS (
- IN OUT CHAR16 *Destination,
- IN UINTN DestMax,
- IN CONST CHAR16 *Source
+ IN OUT CHAR16 *Destination,
+ IN UINTN DestMax,
+ IN CONST CHAR16 *Source
)
{
- UINTN DestLen;
- UINTN CopyLen;
- UINTN SourceLen;
+ UINTN DestLen;
+ UINTN CopyLen;
+ UINTN SourceLen;
- ASSERT (((UINTN) Destination & BIT0) == 0);
- ASSERT (((UINTN) Source & BIT0) == 0);
+ ASSERT (((UINTN)Destination & BIT0) == 0);
+ ASSERT (((UINTN)Source & BIT0) == 0);
//
// Let CopyLen denote the value DestMax - StrnLenS(Destination, DestMax) upon entry to StrCatS.
@@ -457,6 +464,7 @@ StrCatS (
while (*Source != 0) {
*(Destination++) = *(Source++);
}
+
*Destination = 0;
return RETURN_SUCCESS;
@@ -497,18 +505,18 @@ StrCatS (
RETURN_STATUS
EFIAPI
StrnCatS (
- IN OUT CHAR16 *Destination,
- IN UINTN DestMax,
- IN CONST CHAR16 *Source,
- IN UINTN Length
+ IN OUT CHAR16 *Destination,
+ IN UINTN DestMax,
+ IN CONST CHAR16 *Source,
+ IN UINTN Length
)
{
- UINTN DestLen;
- UINTN CopyLen;
- UINTN SourceLen;
+ UINTN DestLen;
+ UINTN CopyLen;
+ UINTN SourceLen;
- ASSERT (((UINTN) Destination & BIT0) == 0);
- ASSERT (((UINTN) Source & BIT0) == 0);
+ ASSERT (((UINTN)Destination & BIT0) == 0);
+ ASSERT (((UINTN)Source & BIT0) == 0);
//
// Let CopyLen denote the value DestMax - StrnLenS(Destination, DestMax) upon entry to StrnCatS.
@@ -554,6 +562,7 @@ StrnCatS (
if (SourceLen > Length) {
SourceLen = Length;
}
+
SAFE_STRING_CONSTRAINT_CHECK (InternalSafeStringNoStrOverlap (Destination, DestMax, (CHAR16 *)Source, SourceLen + 1), RETURN_ACCESS_DENIED);
//
@@ -568,6 +577,7 @@ StrnCatS (
*(Destination++) = *(Source++);
SourceLen--;
}
+
*Destination = 0;
return RETURN_SUCCESS;
@@ -619,12 +629,12 @@ StrnCatS (
RETURN_STATUS
EFIAPI
StrDecimalToUintnS (
- IN CONST CHAR16 *String,
- OUT CHAR16 **EndPointer OPTIONAL,
- OUT UINTN *Data
+ IN CONST CHAR16 *String,
+ OUT CHAR16 **EndPointer OPTIONAL,
+ OUT UINTN *Data
)
{
- ASSERT (((UINTN) String & BIT0) == 0);
+ ASSERT (((UINTN)String & BIT0) == 0);
//
// 1. Neither String nor Data shall be a null pointer.
@@ -640,7 +650,7 @@ StrDecimalToUintnS (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR16 *) String;
+ *EndPointer = (CHAR16 *)String;
}
//
@@ -668,8 +678,9 @@ StrDecimalToUintnS (
if (*Data > ((MAX_UINTN - (*String - L'0')) / 10)) {
*Data = MAX_UINTN;
if (EndPointer != NULL) {
- *EndPointer = (CHAR16 *) String;
+ *EndPointer = (CHAR16 *)String;
}
+
return RETURN_UNSUPPORTED;
}
@@ -678,8 +689,9 @@ StrDecimalToUintnS (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR16 *) String;
+ *EndPointer = (CHAR16 *)String;
}
+
return RETURN_SUCCESS;
}
@@ -729,12 +741,12 @@ StrDecimalToUintnS (
RETURN_STATUS
EFIAPI
StrDecimalToUint64S (
- IN CONST CHAR16 *String,
- OUT CHAR16 **EndPointer OPTIONAL,
- OUT UINT64 *Data
+ IN CONST CHAR16 *String,
+ OUT CHAR16 **EndPointer OPTIONAL,
+ OUT UINT64 *Data
)
{
- ASSERT (((UINTN) String & BIT0) == 0);
+ ASSERT (((UINTN)String & BIT0) == 0);
//
// 1. Neither String nor Data shall be a null pointer.
@@ -750,7 +762,7 @@ StrDecimalToUint64S (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR16 *) String;
+ *EndPointer = (CHAR16 *)String;
}
//
@@ -778,8 +790,9 @@ StrDecimalToUint64S (
if (*Data > DivU64x32 (MAX_UINT64 - (*String - L'0'), 10)) {
*Data = MAX_UINT64;
if (EndPointer != NULL) {
- *EndPointer = (CHAR16 *) String;
+ *EndPointer = (CHAR16 *)String;
}
+
return RETURN_UNSUPPORTED;
}
@@ -788,8 +801,9 @@ StrDecimalToUint64S (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR16 *) String;
+ *EndPointer = (CHAR16 *)String;
}
+
return RETURN_SUCCESS;
}
@@ -844,12 +858,12 @@ StrDecimalToUint64S (
RETURN_STATUS
EFIAPI
StrHexToUintnS (
- IN CONST CHAR16 *String,
- OUT CHAR16 **EndPointer OPTIONAL,
- OUT UINTN *Data
+ IN CONST CHAR16 *String,
+ OUT CHAR16 **EndPointer OPTIONAL,
+ OUT UINTN *Data
)
{
- ASSERT (((UINTN) String & BIT0) == 0);
+ ASSERT (((UINTN)String & BIT0) == 0);
//
// 1. Neither String nor Data shall be a null pointer.
@@ -865,7 +879,7 @@ StrHexToUintnS (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR16 *) String;
+ *EndPointer = (CHAR16 *)String;
}
//
@@ -887,6 +901,7 @@ StrHexToUintnS (
*Data = 0;
return RETURN_SUCCESS;
}
+
//
// Skip the 'X'
//
@@ -904,8 +919,9 @@ StrHexToUintnS (
if (*Data > ((MAX_UINTN - InternalHexCharToUintn (*String)) >> 4)) {
*Data = MAX_UINTN;
if (EndPointer != NULL) {
- *EndPointer = (CHAR16 *) String;
+ *EndPointer = (CHAR16 *)String;
}
+
return RETURN_UNSUPPORTED;
}
@@ -914,8 +930,9 @@ StrHexToUintnS (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR16 *) String;
+ *EndPointer = (CHAR16 *)String;
}
+
return RETURN_SUCCESS;
}
@@ -970,12 +987,12 @@ StrHexToUintnS (
RETURN_STATUS
EFIAPI
StrHexToUint64S (
- IN CONST CHAR16 *String,
- OUT CHAR16 **EndPointer OPTIONAL,
- OUT UINT64 *Data
+ IN CONST CHAR16 *String,
+ OUT CHAR16 **EndPointer OPTIONAL,
+ OUT UINT64 *Data
)
{
- ASSERT (((UINTN) String & BIT0) == 0);
+ ASSERT (((UINTN)String & BIT0) == 0);
//
// 1. Neither String nor Data shall be a null pointer.
@@ -991,7 +1008,7 @@ StrHexToUint64S (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR16 *) String;
+ *EndPointer = (CHAR16 *)String;
}
//
@@ -1013,6 +1030,7 @@ StrHexToUint64S (
*Data = 0;
return RETURN_SUCCESS;
}
+
//
// Skip the 'X'
//
@@ -1030,8 +1048,9 @@ StrHexToUint64S (
if (*Data > RShiftU64 (MAX_UINT64 - InternalHexCharToUintn (*String), 4)) {
*Data = MAX_UINT64;
if (EndPointer != NULL) {
- *EndPointer = (CHAR16 *) String;
+ *EndPointer = (CHAR16 *)String;
}
+
return RETURN_UNSUPPORTED;
}
@@ -1040,8 +1059,9 @@ StrHexToUint64S (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR16 *) String;
+ *EndPointer = (CHAR16 *)String;
}
+
return RETURN_SUCCESS;
}
@@ -1098,27 +1118,27 @@ StrHexToUint64S (
RETURN_STATUS
EFIAPI
StrToIpv6Address (
- IN CONST CHAR16 *String,
- OUT CHAR16 **EndPointer OPTIONAL,
- OUT IPv6_ADDRESS *Address,
- OUT UINT8 *PrefixLength OPTIONAL
+ IN CONST CHAR16 *String,
+ OUT CHAR16 **EndPointer OPTIONAL,
+ OUT IPv6_ADDRESS *Address,
+ OUT UINT8 *PrefixLength OPTIONAL
)
{
- RETURN_STATUS Status;
- UINTN AddressIndex;
- UINTN Uintn;
- IPv6_ADDRESS LocalAddress;
- UINT8 LocalPrefixLength;
- CONST CHAR16 *Pointer;
- CHAR16 *End;
- UINTN CompressStart;
- BOOLEAN ExpectPrefix;
+ RETURN_STATUS Status;
+ UINTN AddressIndex;
+ UINTN Uintn;
+ IPv6_ADDRESS LocalAddress;
+ UINT8 LocalPrefixLength;
+ CONST CHAR16 *Pointer;
+ CHAR16 *End;
+ UINTN CompressStart;
+ BOOLEAN ExpectPrefix;
LocalPrefixLength = MAX_UINT8;
CompressStart = ARRAY_SIZE (Address->Addr);
ExpectPrefix = FALSE;
- ASSERT (((UINTN) String & BIT0) == 0);
+ ASSERT (((UINTN)String & BIT0) == 0);
//
// 1. None of String or Guid shall be a null pointer.
@@ -1146,7 +1166,7 @@ StrToIpv6Address (
return RETURN_UNSUPPORTED;
}
- if (CompressStart != ARRAY_SIZE (Address->Addr) || AddressIndex == ARRAY_SIZE (Address->Addr)) {
+ if ((CompressStart != ARRAY_SIZE (Address->Addr)) || (AddressIndex == ARRAY_SIZE (Address->Addr))) {
//
// "::" can only appear once.
// "::" can only appear when address is not full length.
@@ -1166,6 +1186,7 @@ StrToIpv6Address (
//
return RETURN_UNSUPPORTED;
}
+
Pointer++;
}
}
@@ -1188,33 +1209,35 @@ StrToIpv6Address (
// Get X.
//
Status = StrHexToUintnS (Pointer, &End, &Uintn);
- if (RETURN_ERROR (Status) || End - Pointer > 4) {
+ if (RETURN_ERROR (Status) || (End - Pointer > 4)) {
//
// Number of hexadecimal digit characters is no more than 4.
//
return RETURN_UNSUPPORTED;
}
+
Pointer = End;
//
// Uintn won't exceed MAX_UINT16 if number of hexadecimal digit characters is no more than 4.
//
ASSERT (AddressIndex + 1 < ARRAY_SIZE (Address->Addr));
- LocalAddress.Addr[AddressIndex] = (UINT8) ((UINT16) Uintn >> 8);
- LocalAddress.Addr[AddressIndex + 1] = (UINT8) Uintn;
- AddressIndex += 2;
+ LocalAddress.Addr[AddressIndex] = (UINT8)((UINT16)Uintn >> 8);
+ LocalAddress.Addr[AddressIndex + 1] = (UINT8)Uintn;
+ AddressIndex += 2;
} else {
//
// Get P, then exit the loop.
//
Status = StrDecimalToUintnS (Pointer, &End, &Uintn);
- if (RETURN_ERROR (Status) || End == Pointer || Uintn > 128) {
+ if (RETURN_ERROR (Status) || (End == Pointer) || (Uintn > 128)) {
//
// Prefix length should not exceed 128.
//
return RETURN_UNSUPPORTED;
}
- LocalPrefixLength = (UINT8) Uintn;
- Pointer = End;
+
+ LocalPrefixLength = (UINT8)Uintn;
+ Pointer = End;
break;
}
}
@@ -1237,18 +1260,21 @@ StrToIpv6Address (
//
break;
}
+
Pointer++;
}
- if ((AddressIndex == ARRAY_SIZE (Address->Addr) && CompressStart != ARRAY_SIZE (Address->Addr)) ||
- (AddressIndex != ARRAY_SIZE (Address->Addr) && CompressStart == ARRAY_SIZE (Address->Addr))
- ) {
+ if (((AddressIndex == ARRAY_SIZE (Address->Addr)) && (CompressStart != ARRAY_SIZE (Address->Addr))) ||
+ ((AddressIndex != ARRAY_SIZE (Address->Addr)) && (CompressStart == ARRAY_SIZE (Address->Addr)))
+ )
+ {
//
// Full length of address shall not have compressing zeros.
// Non-full length of address shall have compressing zeros.
//
return RETURN_UNSUPPORTED;
}
+
CopyMem (&Address->Addr[0], &LocalAddress.Addr[0], CompressStart);
ZeroMem (&Address->Addr[CompressStart], ARRAY_SIZE (Address->Addr) - AddressIndex);
if (AddressIndex > CompressStart) {
@@ -1262,8 +1288,9 @@ StrToIpv6Address (
if (PrefixLength != NULL) {
*PrefixLength = LocalPrefixLength;
}
+
if (EndPointer != NULL) {
- *EndPointer = (CHAR16 *) Pointer;
+ *EndPointer = (CHAR16 *)Pointer;
}
return RETURN_SUCCESS;
@@ -1313,22 +1340,22 @@ StrToIpv6Address (
RETURN_STATUS
EFIAPI
StrToIpv4Address (
- IN CONST CHAR16 *String,
- OUT CHAR16 **EndPointer OPTIONAL,
- OUT IPv4_ADDRESS *Address,
- OUT UINT8 *PrefixLength OPTIONAL
+ IN CONST CHAR16 *String,
+ OUT CHAR16 **EndPointer OPTIONAL,
+ OUT IPv4_ADDRESS *Address,
+ OUT UINT8 *PrefixLength OPTIONAL
)
{
- RETURN_STATUS Status;
- UINTN AddressIndex;
- UINTN Uintn;
- IPv4_ADDRESS LocalAddress;
- UINT8 LocalPrefixLength;
- CHAR16 *Pointer;
+ RETURN_STATUS Status;
+ UINTN AddressIndex;
+ UINTN Uintn;
+ IPv4_ADDRESS LocalAddress;
+ UINT8 LocalPrefixLength;
+ CHAR16 *Pointer;
LocalPrefixLength = MAX_UINT8;
- ASSERT (((UINTN) String & BIT0) == 0);
+ ASSERT (((UINTN)String & BIT0) == 0);
//
// 1. None of String or Guid shall be a null pointer.
@@ -1336,7 +1363,7 @@ StrToIpv4Address (
SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER);
SAFE_STRING_CONSTRAINT_CHECK ((Address != NULL), RETURN_INVALID_PARAMETER);
- for (Pointer = (CHAR16 *) String, AddressIndex = 0; AddressIndex < ARRAY_SIZE (Address->Addr) + 1;) {
+ for (Pointer = (CHAR16 *)String, AddressIndex = 0; AddressIndex < ARRAY_SIZE (Address->Addr) + 1;) {
if (!InternalIsDecimalDigitCharacter (*Pointer)) {
//
// D or P contains invalid characters.
@@ -1347,10 +1374,11 @@ StrToIpv4Address (
//
// Get D or P.
//
- Status = StrDecimalToUintnS ((CONST CHAR16 *) Pointer, &Pointer, &Uintn);
+ Status = StrDecimalToUintnS ((CONST CHAR16 *)Pointer, &Pointer, &Uintn);
if (RETURN_ERROR (Status)) {
return RETURN_UNSUPPORTED;
}
+
if (AddressIndex == ARRAY_SIZE (Address->Addr)) {
//
// It's P.
@@ -1358,7 +1386,8 @@ StrToIpv4Address (
if (Uintn > 32) {
return RETURN_UNSUPPORTED;
}
- LocalPrefixLength = (UINT8) Uintn;
+
+ LocalPrefixLength = (UINT8)Uintn;
} else {
//
// It's D.
@@ -1366,7 +1395,8 @@ StrToIpv4Address (
if (Uintn > MAX_UINT8) {
return RETURN_UNSUPPORTED;
}
- LocalAddress.Addr[AddressIndex] = (UINT8) Uintn;
+
+ LocalAddress.Addr[AddressIndex] = (UINT8)Uintn;
AddressIndex++;
}
@@ -1406,6 +1436,7 @@ StrToIpv4Address (
if (PrefixLength != NULL) {
*PrefixLength = LocalPrefixLength;
}
+
if (EndPointer != NULL) {
*EndPointer = Pointer;
}
@@ -1458,14 +1489,14 @@ StrToIpv4Address (
RETURN_STATUS
EFIAPI
StrToGuid (
- IN CONST CHAR16 *String,
- OUT GUID *Guid
+ IN CONST CHAR16 *String,
+ OUT GUID *Guid
)
{
- RETURN_STATUS Status;
- GUID LocalGuid;
+ RETURN_STATUS Status;
+ GUID LocalGuid;
- ASSERT (((UINTN) String & BIT0) == 0);
+ ASSERT (((UINTN)String & BIT0) == 0);
//
// 1. None of String or Guid shall be a null pointer.
@@ -1476,49 +1507,53 @@ StrToGuid (
//
// Get aabbccdd in big-endian.
//
- Status = StrHexToBytes (String, 2 * sizeof (LocalGuid.Data1), (UINT8 *) &LocalGuid.Data1, sizeof (LocalGuid.Data1));
- if (RETURN_ERROR (Status) || String[2 * sizeof (LocalGuid.Data1)] != L'-') {
+ Status = StrHexToBytes (String, 2 * sizeof (LocalGuid.Data1), (UINT8 *)&LocalGuid.Data1, sizeof (LocalGuid.Data1));
+ if (RETURN_ERROR (Status) || (String[2 * sizeof (LocalGuid.Data1)] != L'-')) {
return RETURN_UNSUPPORTED;
}
+
//
// Convert big-endian to little-endian.
//
LocalGuid.Data1 = SwapBytes32 (LocalGuid.Data1);
- String += 2 * sizeof (LocalGuid.Data1) + 1;
+ String += 2 * sizeof (LocalGuid.Data1) + 1;
//
// Get eeff in big-endian.
//
- Status = StrHexToBytes (String, 2 * sizeof (LocalGuid.Data2), (UINT8 *) &LocalGuid.Data2, sizeof (LocalGuid.Data2));
- if (RETURN_ERROR (Status) || String[2 * sizeof (LocalGuid.Data2)] != L'-') {
+ Status = StrHexToBytes (String, 2 * sizeof (LocalGuid.Data2), (UINT8 *)&LocalGuid.Data2, sizeof (LocalGuid.Data2));
+ if (RETURN_ERROR (Status) || (String[2 * sizeof (LocalGuid.Data2)] != L'-')) {
return RETURN_UNSUPPORTED;
}
+
//
// Convert big-endian to little-endian.
//
LocalGuid.Data2 = SwapBytes16 (LocalGuid.Data2);
- String += 2 * sizeof (LocalGuid.Data2) + 1;
+ String += 2 * sizeof (LocalGuid.Data2) + 1;
//
// Get gghh in big-endian.
//
- Status = StrHexToBytes (String, 2 * sizeof (LocalGuid.Data3), (UINT8 *) &LocalGuid.Data3, sizeof (LocalGuid.Data3));
- if (RETURN_ERROR (Status) || String[2 * sizeof (LocalGuid.Data3)] != L'-') {
+ Status = StrHexToBytes (String, 2 * sizeof (LocalGuid.Data3), (UINT8 *)&LocalGuid.Data3, sizeof (LocalGuid.Data3));
+ if (RETURN_ERROR (Status) || (String[2 * sizeof (LocalGuid.Data3)] != L'-')) {
return RETURN_UNSUPPORTED;
}
+
//
// Convert big-endian to little-endian.
//
LocalGuid.Data3 = SwapBytes16 (LocalGuid.Data3);
- String += 2 * sizeof (LocalGuid.Data3) + 1;
+ String += 2 * sizeof (LocalGuid.Data3) + 1;
//
// Get iijj.
//
Status = StrHexToBytes (String, 2 * 2, &LocalGuid.Data4[0], 2);
- if (RETURN_ERROR (Status) || String[2 * 2] != L'-') {
+ if (RETURN_ERROR (Status) || (String[2 * 2] != L'-')) {
return RETURN_UNSUPPORTED;
}
+
String += 2 * 2 + 1;
//
@@ -1569,15 +1604,15 @@ StrToGuid (
RETURN_STATUS
EFIAPI
StrHexToBytes (
- IN CONST CHAR16 *String,
- IN UINTN Length,
- OUT UINT8 *Buffer,
- IN UINTN MaxBufferSize
+ IN CONST CHAR16 *String,
+ IN UINTN Length,
+ OUT UINT8 *Buffer,
+ IN UINTN MaxBufferSize
)
{
- UINTN Index;
+ UINTN Index;
- ASSERT (((UINTN) String & BIT0) == 0);
+ ASSERT (((UINTN)String & BIT0) == 0);
//
// 1. None of String or Buffer shall be a null pointer.
@@ -1610,6 +1645,7 @@ StrHexToBytes (
break;
}
}
+
if (Index != Length) {
return RETURN_UNSUPPORTED;
}
@@ -1617,18 +1653,18 @@ StrHexToBytes (
//
// Convert the hex string to bytes.
//
- for(Index = 0; Index < Length; Index++) {
-
+ for (Index = 0; Index < Length; Index++) {
//
// For even characters, write the upper nibble for each buffer byte,
// and for even characters, the lower nibble.
//
if ((Index & BIT0) == 0) {
- Buffer[Index / 2] = (UINT8) InternalHexCharToUintn (String[Index]) << 4;
+ Buffer[Index / 2] = (UINT8)InternalHexCharToUintn (String[Index]) << 4;
} else {
- Buffer[Index / 2] |= (UINT8) InternalHexCharToUintn (String[Index]);
+ Buffer[Index / 2] |= (UINT8)InternalHexCharToUintn (String[Index]);
}
}
+
return RETURN_SUCCESS;
}
@@ -1649,11 +1685,11 @@ StrHexToBytes (
UINTN
EFIAPI
AsciiStrnLenS (
- IN CONST CHAR8 *String,
- IN UINTN MaxSize
+ IN CONST CHAR8 *String,
+ IN UINTN MaxSize
)
{
- UINTN Length;
+ UINTN Length;
//
// If String is a null pointer or MaxSize is 0, then the AsciiStrnLenS function returns zero.
@@ -1673,8 +1709,10 @@ AsciiStrnLenS (
if (Length >= MaxSize - 1) {
return MaxSize;
}
+
Length++;
}
+
return Length;
}
@@ -1700,8 +1738,8 @@ AsciiStrnLenS (
UINTN
EFIAPI
AsciiStrnSizeS (
- IN CONST CHAR8 *String,
- IN UINTN MaxSize
+ IN CONST CHAR8 *String,
+ IN UINTN MaxSize
)
{
//
@@ -1753,7 +1791,7 @@ AsciiStrCpyS (
IN CONST CHAR8 *Source
)
{
- UINTN SourceLen;
+ UINTN SourceLen;
//
// 1. Neither Destination nor Source shall be a null pointer.
@@ -1791,6 +1829,7 @@ AsciiStrCpyS (
while (*Source != 0) {
*(Destination++) = *(Source++);
}
+
*Destination = 0;
return RETURN_SUCCESS;
@@ -1831,7 +1870,7 @@ AsciiStrnCpyS (
IN UINTN Length
)
{
- UINTN SourceLen;
+ UINTN SourceLen;
//
// 1. Neither Destination nor Source shall be a null pointer.
@@ -1866,6 +1905,7 @@ AsciiStrnCpyS (
if (SourceLen > Length) {
SourceLen = Length;
}
+
SAFE_STRING_CONSTRAINT_CHECK (InternalSafeStringNoAsciiStrOverlap (Destination, DestMax, (CHAR8 *)Source, SourceLen + 1), RETURN_ACCESS_DENIED);
//
@@ -1878,6 +1918,7 @@ AsciiStrnCpyS (
*(Destination++) = *(Source++);
SourceLen--;
}
+
*Destination = 0;
return RETURN_SUCCESS;
@@ -1917,9 +1958,9 @@ AsciiStrCatS (
IN CONST CHAR8 *Source
)
{
- UINTN DestLen;
- UINTN CopyLen;
- UINTN SourceLen;
+ UINTN DestLen;
+ UINTN CopyLen;
+ UINTN SourceLen;
//
// Let CopyLen denote the value DestMax - AsciiStrnLenS(Destination, DestMax) upon entry to AsciiStrCatS.
@@ -1970,6 +2011,7 @@ AsciiStrCatS (
while (*Source != 0) {
*(Destination++) = *(Source++);
}
+
*Destination = 0;
return RETURN_SUCCESS;
@@ -2013,9 +2055,9 @@ AsciiStrnCatS (
IN UINTN Length
)
{
- UINTN DestLen;
- UINTN CopyLen;
- UINTN SourceLen;
+ UINTN DestLen;
+ UINTN CopyLen;
+ UINTN SourceLen;
//
// Let CopyLen denote the value DestMax - AsciiStrnLenS(Destination, DestMax) upon entry to AsciiStrnCatS.
@@ -2061,6 +2103,7 @@ AsciiStrnCatS (
if (SourceLen > Length) {
SourceLen = Length;
}
+
SAFE_STRING_CONSTRAINT_CHECK (InternalSafeStringNoAsciiStrOverlap (Destination, DestMax, (CHAR8 *)Source, SourceLen + 1), RETURN_ACCESS_DENIED);
//
@@ -2075,6 +2118,7 @@ AsciiStrnCatS (
*(Destination++) = *(Source++);
SourceLen--;
}
+
*Destination = 0;
return RETURN_SUCCESS;
@@ -2124,9 +2168,9 @@ AsciiStrnCatS (
RETURN_STATUS
EFIAPI
AsciiStrDecimalToUintnS (
- IN CONST CHAR8 *String,
- OUT CHAR8 **EndPointer OPTIONAL,
- OUT UINTN *Data
+ IN CONST CHAR8 *String,
+ OUT CHAR8 **EndPointer OPTIONAL,
+ OUT UINTN *Data
)
{
//
@@ -2143,7 +2187,7 @@ AsciiStrDecimalToUintnS (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR8 *) String;
+ *EndPointer = (CHAR8 *)String;
}
//
@@ -2171,8 +2215,9 @@ AsciiStrDecimalToUintnS (
if (*Data > ((MAX_UINTN - (*String - '0')) / 10)) {
*Data = MAX_UINTN;
if (EndPointer != NULL) {
- *EndPointer = (CHAR8 *) String;
+ *EndPointer = (CHAR8 *)String;
}
+
return RETURN_UNSUPPORTED;
}
@@ -2181,8 +2226,9 @@ AsciiStrDecimalToUintnS (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR8 *) String;
+ *EndPointer = (CHAR8 *)String;
}
+
return RETURN_SUCCESS;
}
@@ -2230,9 +2276,9 @@ AsciiStrDecimalToUintnS (
RETURN_STATUS
EFIAPI
AsciiStrDecimalToUint64S (
- IN CONST CHAR8 *String,
- OUT CHAR8 **EndPointer OPTIONAL,
- OUT UINT64 *Data
+ IN CONST CHAR8 *String,
+ OUT CHAR8 **EndPointer OPTIONAL,
+ OUT UINT64 *Data
)
{
//
@@ -2249,7 +2295,7 @@ AsciiStrDecimalToUint64S (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR8 *) String;
+ *EndPointer = (CHAR8 *)String;
}
//
@@ -2277,8 +2323,9 @@ AsciiStrDecimalToUint64S (
if (*Data > DivU64x32 (MAX_UINT64 - (*String - '0'), 10)) {
*Data = MAX_UINT64;
if (EndPointer != NULL) {
- *EndPointer = (CHAR8 *) String;
+ *EndPointer = (CHAR8 *)String;
}
+
return RETURN_UNSUPPORTED;
}
@@ -2287,8 +2334,9 @@ AsciiStrDecimalToUint64S (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR8 *) String;
+ *EndPointer = (CHAR8 *)String;
}
+
return RETURN_SUCCESS;
}
@@ -2340,9 +2388,9 @@ AsciiStrDecimalToUint64S (
RETURN_STATUS
EFIAPI
AsciiStrHexToUintnS (
- IN CONST CHAR8 *String,
- OUT CHAR8 **EndPointer OPTIONAL,
- OUT UINTN *Data
+ IN CONST CHAR8 *String,
+ OUT CHAR8 **EndPointer OPTIONAL,
+ OUT UINTN *Data
)
{
//
@@ -2359,7 +2407,7 @@ AsciiStrHexToUintnS (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR8 *) String;
+ *EndPointer = (CHAR8 *)String;
}
//
@@ -2381,6 +2429,7 @@ AsciiStrHexToUintnS (
*Data = 0;
return RETURN_SUCCESS;
}
+
//
// Skip the 'X'
//
@@ -2398,8 +2447,9 @@ AsciiStrHexToUintnS (
if (*Data > ((MAX_UINTN - InternalAsciiHexCharToUintn (*String)) >> 4)) {
*Data = MAX_UINTN;
if (EndPointer != NULL) {
- *EndPointer = (CHAR8 *) String;
+ *EndPointer = (CHAR8 *)String;
}
+
return RETURN_UNSUPPORTED;
}
@@ -2408,8 +2458,9 @@ AsciiStrHexToUintnS (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR8 *) String;
+ *EndPointer = (CHAR8 *)String;
}
+
return RETURN_SUCCESS;
}
@@ -2461,9 +2512,9 @@ AsciiStrHexToUintnS (
RETURN_STATUS
EFIAPI
AsciiStrHexToUint64S (
- IN CONST CHAR8 *String,
- OUT CHAR8 **EndPointer OPTIONAL,
- OUT UINT64 *Data
+ IN CONST CHAR8 *String,
+ OUT CHAR8 **EndPointer OPTIONAL,
+ OUT UINT64 *Data
)
{
//
@@ -2480,7 +2531,7 @@ AsciiStrHexToUint64S (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR8 *) String;
+ *EndPointer = (CHAR8 *)String;
}
//
@@ -2502,6 +2553,7 @@ AsciiStrHexToUint64S (
*Data = 0;
return RETURN_SUCCESS;
}
+
//
// Skip the 'X'
//
@@ -2519,8 +2571,9 @@ AsciiStrHexToUint64S (
if (*Data > RShiftU64 (MAX_UINT64 - InternalAsciiHexCharToUintn (*String), 4)) {
*Data = MAX_UINT64;
if (EndPointer != NULL) {
- *EndPointer = (CHAR8 *) String;
+ *EndPointer = (CHAR8 *)String;
}
+
return RETURN_UNSUPPORTED;
}
@@ -2529,8 +2582,9 @@ AsciiStrHexToUint64S (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR8 *) String;
+ *EndPointer = (CHAR8 *)String;
}
+
return RETURN_SUCCESS;
}
@@ -2577,14 +2631,14 @@ AsciiStrHexToUint64S (
RETURN_STATUS
EFIAPI
UnicodeStrToAsciiStrS (
- IN CONST CHAR16 *Source,
- OUT CHAR8 *Destination,
- IN UINTN DestMax
+ IN CONST CHAR16 *Source,
+ OUT CHAR8 *Destination,
+ IN UINTN DestMax
)
{
- UINTN SourceLen;
+ UINTN SourceLen;
- ASSERT (((UINTN) Source & BIT0) == 0);
+ ASSERT (((UINTN)Source & BIT0) == 0);
//
// 1. Neither Destination nor Source shall be a null pointer.
@@ -2598,6 +2652,7 @@ UnicodeStrToAsciiStrS (
if (ASCII_RSIZE_MAX != 0) {
SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER);
}
+
if (RSIZE_MAX != 0) {
SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= RSIZE_MAX), RETURN_INVALID_PARAMETER);
}
@@ -2616,7 +2671,7 @@ UnicodeStrToAsciiStrS (
//
// 5. Copying shall not take place between objects that overlap.
//
- SAFE_STRING_CONSTRAINT_CHECK (!InternalSafeStringIsOverlap (Destination, DestMax, (VOID *)Source, (SourceLen + 1) * sizeof(CHAR16)), RETURN_ACCESS_DENIED);
+ SAFE_STRING_CONSTRAINT_CHECK (!InternalSafeStringIsOverlap (Destination, DestMax, (VOID *)Source, (SourceLen + 1) * sizeof (CHAR16)), RETURN_ACCESS_DENIED);
//
// convert string
@@ -2627,8 +2682,9 @@ UnicodeStrToAsciiStrS (
// non-zero value in the upper 8 bits, then ASSERT().
//
ASSERT (*Source < 0x100);
- *(Destination++) = (CHAR8) *(Source++);
+ *(Destination++) = (CHAR8)*(Source++);
}
+
*Destination = '\0';
return RETURN_SUCCESS;
@@ -2682,16 +2738,16 @@ UnicodeStrToAsciiStrS (
RETURN_STATUS
EFIAPI
UnicodeStrnToAsciiStrS (
- IN CONST CHAR16 *Source,
- IN UINTN Length,
- OUT CHAR8 *Destination,
- IN UINTN DestMax,
- OUT UINTN *DestinationLength
+ IN CONST CHAR16 *Source,
+ IN UINTN Length,
+ OUT CHAR8 *Destination,
+ IN UINTN DestMax,
+ OUT UINTN *DestinationLength
)
{
- UINTN SourceLen;
+ UINTN SourceLen;
- ASSERT (((UINTN) Source & BIT0) == 0);
+ ASSERT (((UINTN)Source & BIT0) == 0);
//
// 1. None of Destination, Source or DestinationLength shall be a null
@@ -2709,6 +2765,7 @@ UnicodeStrnToAsciiStrS (
SAFE_STRING_CONSTRAINT_CHECK ((Length <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER);
SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER);
}
+
if (RSIZE_MAX != 0) {
SAFE_STRING_CONSTRAINT_CHECK ((Length <= RSIZE_MAX), RETURN_INVALID_PARAMETER);
SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= RSIZE_MAX), RETURN_INVALID_PARAMETER);
@@ -2734,7 +2791,8 @@ UnicodeStrnToAsciiStrS (
if (SourceLen > Length) {
SourceLen = Length;
}
- SAFE_STRING_CONSTRAINT_CHECK (!InternalSafeStringIsOverlap (Destination, DestMax, (VOID *)Source, (SourceLen + 1) * sizeof(CHAR16)), RETURN_ACCESS_DENIED);
+
+ SAFE_STRING_CONSTRAINT_CHECK (!InternalSafeStringIsOverlap (Destination, DestMax, (VOID *)Source, (SourceLen + 1) * sizeof (CHAR16)), RETURN_ACCESS_DENIED);
*DestinationLength = 0;
@@ -2747,10 +2805,11 @@ UnicodeStrnToAsciiStrS (
// 8 bits, then ASSERT().
//
ASSERT (*Source < 0x100);
- *(Destination++) = (CHAR8) *(Source++);
+ *(Destination++) = (CHAR8)*(Source++);
SourceLen--;
(*DestinationLength)++;
}
+
*Destination = 0;
return RETURN_SUCCESS;
@@ -2795,14 +2854,14 @@ UnicodeStrnToAsciiStrS (
RETURN_STATUS
EFIAPI
AsciiStrToUnicodeStrS (
- IN CONST CHAR8 *Source,
- OUT CHAR16 *Destination,
- IN UINTN DestMax
+ IN CONST CHAR8 *Source,
+ OUT CHAR16 *Destination,
+ IN UINTN DestMax
)
{
- UINTN SourceLen;
+ UINTN SourceLen;
- ASSERT (((UINTN) Destination & BIT0) == 0);
+ ASSERT (((UINTN)Destination & BIT0) == 0);
//
// 1. Neither Destination nor Source shall be a null pointer.
@@ -2816,6 +2875,7 @@ AsciiStrToUnicodeStrS (
if (RSIZE_MAX != 0) {
SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= RSIZE_MAX), RETURN_INVALID_PARAMETER);
}
+
if (ASCII_RSIZE_MAX != 0) {
SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER);
}
@@ -2834,7 +2894,7 @@ AsciiStrToUnicodeStrS (
//
// 5. Copying shall not take place between objects that overlap.
//
- SAFE_STRING_CONSTRAINT_CHECK (!InternalSafeStringIsOverlap (Destination, DestMax * sizeof(CHAR16), (VOID *)Source, SourceLen + 1), RETURN_ACCESS_DENIED);
+ SAFE_STRING_CONSTRAINT_CHECK (!InternalSafeStringIsOverlap (Destination, DestMax * sizeof (CHAR16), (VOID *)Source, SourceLen + 1), RETURN_ACCESS_DENIED);
//
// Convert string
@@ -2842,6 +2902,7 @@ AsciiStrToUnicodeStrS (
while (*Source != '\0') {
*(Destination++) = (CHAR16)(UINT8)*(Source++);
}
+
*Destination = '\0';
return RETURN_SUCCESS;
@@ -2892,16 +2953,16 @@ AsciiStrToUnicodeStrS (
RETURN_STATUS
EFIAPI
AsciiStrnToUnicodeStrS (
- IN CONST CHAR8 *Source,
- IN UINTN Length,
- OUT CHAR16 *Destination,
- IN UINTN DestMax,
- OUT UINTN *DestinationLength
+ IN CONST CHAR8 *Source,
+ IN UINTN Length,
+ OUT CHAR16 *Destination,
+ IN UINTN DestMax,
+ OUT UINTN *DestinationLength
)
{
- UINTN SourceLen;
+ UINTN SourceLen;
- ASSERT (((UINTN) Destination & BIT0) == 0);
+ ASSERT (((UINTN)Destination & BIT0) == 0);
//
// 1. None of Destination, Source or DestinationLength shall be a null
@@ -2919,6 +2980,7 @@ AsciiStrnToUnicodeStrS (
SAFE_STRING_CONSTRAINT_CHECK ((Length <= RSIZE_MAX), RETURN_INVALID_PARAMETER);
SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= RSIZE_MAX), RETURN_INVALID_PARAMETER);
}
+
if (ASCII_RSIZE_MAX != 0) {
SAFE_STRING_CONSTRAINT_CHECK ((Length <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER);
SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER);
@@ -2944,7 +3006,8 @@ AsciiStrnToUnicodeStrS (
if (SourceLen > Length) {
SourceLen = Length;
}
- SAFE_STRING_CONSTRAINT_CHECK (!InternalSafeStringIsOverlap (Destination, DestMax * sizeof(CHAR16), (VOID *)Source, SourceLen + 1), RETURN_ACCESS_DENIED);
+
+ SAFE_STRING_CONSTRAINT_CHECK (!InternalSafeStringIsOverlap (Destination, DestMax * sizeof (CHAR16), (VOID *)Source, SourceLen + 1), RETURN_ACCESS_DENIED);
*DestinationLength = 0;
@@ -2956,6 +3019,7 @@ AsciiStrnToUnicodeStrS (
SourceLen--;
(*DestinationLength)++;
}
+
*Destination = 0;
return RETURN_SUCCESS;
@@ -3012,21 +3076,21 @@ AsciiStrnToUnicodeStrS (
RETURN_STATUS
EFIAPI
AsciiStrToIpv6Address (
- IN CONST CHAR8 *String,
- OUT CHAR8 **EndPointer OPTIONAL,
- OUT IPv6_ADDRESS *Address,
- OUT UINT8 *PrefixLength OPTIONAL
+ IN CONST CHAR8 *String,
+ OUT CHAR8 **EndPointer OPTIONAL,
+ OUT IPv6_ADDRESS *Address,
+ OUT UINT8 *PrefixLength OPTIONAL
)
{
- RETURN_STATUS Status;
- UINTN AddressIndex;
- UINTN Uintn;
- IPv6_ADDRESS LocalAddress;
- UINT8 LocalPrefixLength;
- CONST CHAR8 *Pointer;
- CHAR8 *End;
- UINTN CompressStart;
- BOOLEAN ExpectPrefix;
+ RETURN_STATUS Status;
+ UINTN AddressIndex;
+ UINTN Uintn;
+ IPv6_ADDRESS LocalAddress;
+ UINT8 LocalPrefixLength;
+ CONST CHAR8 *Pointer;
+ CHAR8 *End;
+ UINTN CompressStart;
+ BOOLEAN ExpectPrefix;
LocalPrefixLength = MAX_UINT8;
CompressStart = ARRAY_SIZE (Address->Addr);
@@ -3058,7 +3122,7 @@ AsciiStrToIpv6Address (
return RETURN_UNSUPPORTED;
}
- if (CompressStart != ARRAY_SIZE (Address->Addr) || AddressIndex == ARRAY_SIZE (Address->Addr)) {
+ if ((CompressStart != ARRAY_SIZE (Address->Addr)) || (AddressIndex == ARRAY_SIZE (Address->Addr))) {
//
// "::" can only appear once.
// "::" can only appear when address is not full length.
@@ -3078,6 +3142,7 @@ AsciiStrToIpv6Address (
//
return RETURN_UNSUPPORTED;
}
+
Pointer++;
}
}
@@ -3100,33 +3165,35 @@ AsciiStrToIpv6Address (
// Get X.
//
Status = AsciiStrHexToUintnS (Pointer, &End, &Uintn);
- if (RETURN_ERROR (Status) || End - Pointer > 4) {
+ if (RETURN_ERROR (Status) || (End - Pointer > 4)) {
//
// Number of hexadecimal digit characters is no more than 4.
//
return RETURN_UNSUPPORTED;
}
+
Pointer = End;
//
// Uintn won't exceed MAX_UINT16 if number of hexadecimal digit characters is no more than 4.
//
ASSERT (AddressIndex + 1 < ARRAY_SIZE (Address->Addr));
- LocalAddress.Addr[AddressIndex] = (UINT8) ((UINT16) Uintn >> 8);
- LocalAddress.Addr[AddressIndex + 1] = (UINT8) Uintn;
- AddressIndex += 2;
+ LocalAddress.Addr[AddressIndex] = (UINT8)((UINT16)Uintn >> 8);
+ LocalAddress.Addr[AddressIndex + 1] = (UINT8)Uintn;
+ AddressIndex += 2;
} else {
//
// Get P, then exit the loop.
//
Status = AsciiStrDecimalToUintnS (Pointer, &End, &Uintn);
- if (RETURN_ERROR (Status) || End == Pointer || Uintn > 128) {
+ if (RETURN_ERROR (Status) || (End == Pointer) || (Uintn > 128)) {
//
// Prefix length should not exceed 128.
//
return RETURN_UNSUPPORTED;
}
- LocalPrefixLength = (UINT8) Uintn;
- Pointer = End;
+
+ LocalPrefixLength = (UINT8)Uintn;
+ Pointer = End;
break;
}
}
@@ -3149,18 +3216,21 @@ AsciiStrToIpv6Address (
//
break;
}
+
Pointer++;
}
- if ((AddressIndex == ARRAY_SIZE (Address->Addr) && CompressStart != ARRAY_SIZE (Address->Addr)) ||
- (AddressIndex != ARRAY_SIZE (Address->Addr) && CompressStart == ARRAY_SIZE (Address->Addr))
- ) {
+ if (((AddressIndex == ARRAY_SIZE (Address->Addr)) && (CompressStart != ARRAY_SIZE (Address->Addr))) ||
+ ((AddressIndex != ARRAY_SIZE (Address->Addr)) && (CompressStart == ARRAY_SIZE (Address->Addr)))
+ )
+ {
//
// Full length of address shall not have compressing zeros.
// Non-full length of address shall have compressing zeros.
//
return RETURN_UNSUPPORTED;
}
+
CopyMem (&Address->Addr[0], &LocalAddress.Addr[0], CompressStart);
ZeroMem (&Address->Addr[CompressStart], ARRAY_SIZE (Address->Addr) - AddressIndex);
if (AddressIndex > CompressStart) {
@@ -3169,14 +3239,14 @@ AsciiStrToIpv6Address (
&LocalAddress.Addr[CompressStart],
AddressIndex - CompressStart
);
-
}
if (PrefixLength != NULL) {
*PrefixLength = LocalPrefixLength;
}
+
if (EndPointer != NULL) {
- *EndPointer = (CHAR8 *) Pointer;
+ *EndPointer = (CHAR8 *)Pointer;
}
return RETURN_SUCCESS;
@@ -3224,18 +3294,18 @@ AsciiStrToIpv6Address (
RETURN_STATUS
EFIAPI
AsciiStrToIpv4Address (
- IN CONST CHAR8 *String,
- OUT CHAR8 **EndPointer OPTIONAL,
- OUT IPv4_ADDRESS *Address,
- OUT UINT8 *PrefixLength OPTIONAL
+ IN CONST CHAR8 *String,
+ OUT CHAR8 **EndPointer OPTIONAL,
+ OUT IPv4_ADDRESS *Address,
+ OUT UINT8 *PrefixLength OPTIONAL
)
{
- RETURN_STATUS Status;
- UINTN AddressIndex;
- UINTN Uintn;
- IPv4_ADDRESS LocalAddress;
- UINT8 LocalPrefixLength;
- CHAR8 *Pointer;
+ RETURN_STATUS Status;
+ UINTN AddressIndex;
+ UINTN Uintn;
+ IPv4_ADDRESS LocalAddress;
+ UINT8 LocalPrefixLength;
+ CHAR8 *Pointer;
LocalPrefixLength = MAX_UINT8;
@@ -3245,7 +3315,7 @@ AsciiStrToIpv4Address (
SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER);
SAFE_STRING_CONSTRAINT_CHECK ((Address != NULL), RETURN_INVALID_PARAMETER);
- for (Pointer = (CHAR8 *) String, AddressIndex = 0; AddressIndex < ARRAY_SIZE (Address->Addr) + 1;) {
+ for (Pointer = (CHAR8 *)String, AddressIndex = 0; AddressIndex < ARRAY_SIZE (Address->Addr) + 1;) {
if (!InternalAsciiIsDecimalDigitCharacter (*Pointer)) {
//
// D or P contains invalid characters.
@@ -3256,10 +3326,11 @@ AsciiStrToIpv4Address (
//
// Get D or P.
//
- Status = AsciiStrDecimalToUintnS ((CONST CHAR8 *) Pointer, &Pointer, &Uintn);
+ Status = AsciiStrDecimalToUintnS ((CONST CHAR8 *)Pointer, &Pointer, &Uintn);
if (RETURN_ERROR (Status)) {
return RETURN_UNSUPPORTED;
}
+
if (AddressIndex == ARRAY_SIZE (Address->Addr)) {
//
// It's P.
@@ -3267,7 +3338,8 @@ AsciiStrToIpv4Address (
if (Uintn > 32) {
return RETURN_UNSUPPORTED;
}
- LocalPrefixLength = (UINT8) Uintn;
+
+ LocalPrefixLength = (UINT8)Uintn;
} else {
//
// It's D.
@@ -3275,7 +3347,8 @@ AsciiStrToIpv4Address (
if (Uintn > MAX_UINT8) {
return RETURN_UNSUPPORTED;
}
- LocalAddress.Addr[AddressIndex] = (UINT8) Uintn;
+
+ LocalAddress.Addr[AddressIndex] = (UINT8)Uintn;
AddressIndex++;
}
@@ -3315,6 +3388,7 @@ AsciiStrToIpv4Address (
if (PrefixLength != NULL) {
*PrefixLength = LocalPrefixLength;
}
+
if (EndPointer != NULL) {
*EndPointer = Pointer;
}
@@ -3365,12 +3439,12 @@ AsciiStrToIpv4Address (
RETURN_STATUS
EFIAPI
AsciiStrToGuid (
- IN CONST CHAR8 *String,
- OUT GUID *Guid
+ IN CONST CHAR8 *String,
+ OUT GUID *Guid
)
{
- RETURN_STATUS Status;
- GUID LocalGuid;
+ RETURN_STATUS Status;
+ GUID LocalGuid;
//
// None of String or Guid shall be a null pointer.
@@ -3381,49 +3455,53 @@ AsciiStrToGuid (
//
// Get aabbccdd in big-endian.
//
- Status = AsciiStrHexToBytes (String, 2 * sizeof (LocalGuid.Data1), (UINT8 *) &LocalGuid.Data1, sizeof (LocalGuid.Data1));
- if (RETURN_ERROR (Status) || String[2 * sizeof (LocalGuid.Data1)] != '-') {
+ Status = AsciiStrHexToBytes (String, 2 * sizeof (LocalGuid.Data1), (UINT8 *)&LocalGuid.Data1, sizeof (LocalGuid.Data1));
+ if (RETURN_ERROR (Status) || (String[2 * sizeof (LocalGuid.Data1)] != '-')) {
return RETURN_UNSUPPORTED;
}
+
//
// Convert big-endian to little-endian.
//
LocalGuid.Data1 = SwapBytes32 (LocalGuid.Data1);
- String += 2 * sizeof (LocalGuid.Data1) + 1;
+ String += 2 * sizeof (LocalGuid.Data1) + 1;
//
// Get eeff in big-endian.
//
- Status = AsciiStrHexToBytes (String, 2 * sizeof (LocalGuid.Data2), (UINT8 *) &LocalGuid.Data2, sizeof (LocalGuid.Data2));
- if (RETURN_ERROR (Status) || String[2 * sizeof (LocalGuid.Data2)] != '-') {
+ Status = AsciiStrHexToBytes (String, 2 * sizeof (LocalGuid.Data2), (UINT8 *)&LocalGuid.Data2, sizeof (LocalGuid.Data2));
+ if (RETURN_ERROR (Status) || (String[2 * sizeof (LocalGuid.Data2)] != '-')) {
return RETURN_UNSUPPORTED;
}
+
//
// Convert big-endian to little-endian.
//
LocalGuid.Data2 = SwapBytes16 (LocalGuid.Data2);
- String += 2 * sizeof (LocalGuid.Data2) + 1;
+ String += 2 * sizeof (LocalGuid.Data2) + 1;
//
// Get gghh in big-endian.
//
- Status = AsciiStrHexToBytes (String, 2 * sizeof (LocalGuid.Data3), (UINT8 *) &LocalGuid.Data3, sizeof (LocalGuid.Data3));
- if (RETURN_ERROR (Status) || String[2 * sizeof (LocalGuid.Data3)] != '-') {
+ Status = AsciiStrHexToBytes (String, 2 * sizeof (LocalGuid.Data3), (UINT8 *)&LocalGuid.Data3, sizeof (LocalGuid.Data3));
+ if (RETURN_ERROR (Status) || (String[2 * sizeof (LocalGuid.Data3)] != '-')) {
return RETURN_UNSUPPORTED;
}
+
//
// Convert big-endian to little-endian.
//
LocalGuid.Data3 = SwapBytes16 (LocalGuid.Data3);
- String += 2 * sizeof (LocalGuid.Data3) + 1;
+ String += 2 * sizeof (LocalGuid.Data3) + 1;
//
// Get iijj.
//
Status = AsciiStrHexToBytes (String, 2 * 2, &LocalGuid.Data4[0], 2);
- if (RETURN_ERROR (Status) || String[2 * 2] != '-') {
+ if (RETURN_ERROR (Status) || (String[2 * 2] != '-')) {
return RETURN_UNSUPPORTED;
}
+
String += 2 * 2 + 1;
//
@@ -3472,13 +3550,13 @@ AsciiStrToGuid (
RETURN_STATUS
EFIAPI
AsciiStrHexToBytes (
- IN CONST CHAR8 *String,
- IN UINTN Length,
- OUT UINT8 *Buffer,
- IN UINTN MaxBufferSize
+ IN CONST CHAR8 *String,
+ IN UINTN Length,
+ OUT UINT8 *Buffer,
+ IN UINTN MaxBufferSize
)
{
- UINTN Index;
+ UINTN Index;
//
// 1. None of String or Buffer shall be a null pointer.
@@ -3511,6 +3589,7 @@ AsciiStrHexToBytes (
break;
}
}
+
if (Index != Length) {
return RETURN_UNSUPPORTED;
}
@@ -3518,17 +3597,17 @@ AsciiStrHexToBytes (
//
// Convert the hex string to bytes.
//
- for(Index = 0; Index < Length; Index++) {
-
+ for (Index = 0; Index < Length; Index++) {
//
// For even characters, write the upper nibble for each buffer byte,
// and for even characters, the lower nibble.
//
if ((Index & BIT0) == 0) {
- Buffer[Index / 2] = (UINT8) InternalAsciiHexCharToUintn (String[Index]) << 4;
+ Buffer[Index / 2] = (UINT8)InternalAsciiHexCharToUintn (String[Index]) << 4;
} else {
- Buffer[Index / 2] |= (UINT8) InternalAsciiHexCharToUintn (String[Index]);
+ Buffer[Index / 2] |= (UINT8)InternalAsciiHexCharToUintn (String[Index]);
}
}
+
return RETURN_SUCCESS;
}
diff --git a/MdePkg/Library/BaseLib/SetJump.c b/MdePkg/Library/BaseLib/SetJump.c
index 516f92f28e..22345e9cf9 100644
--- a/MdePkg/Library/BaseLib/SetJump.c
+++ b/MdePkg/Library/BaseLib/SetJump.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
diff --git a/MdePkg/Library/BaseLib/String.c b/MdePkg/Library/BaseLib/String.c
index f4854f357e..98e6d31463 100644
--- a/MdePkg/Library/BaseLib/String.c
+++ b/MdePkg/Library/BaseLib/String.c
@@ -8,7 +8,6 @@
#include "BaseLibInternals.h"
-
/**
Returns the length of a Null-terminated Unicode string.
@@ -29,13 +28,13 @@
UINTN
EFIAPI
StrLen (
- IN CONST CHAR16 *String
+ IN CONST CHAR16 *String
)
{
- UINTN Length;
+ UINTN Length;
ASSERT (String != NULL);
- ASSERT (((UINTN) String & BIT0) == 0);
+ ASSERT (((UINTN)String & BIT0) == 0);
for (Length = 0; *String != L'\0'; String++, Length++) {
//
@@ -46,6 +45,7 @@ StrLen (
ASSERT (Length < PcdGet32 (PcdMaximumUnicodeStringLength));
}
}
+
return Length;
}
@@ -70,7 +70,7 @@ StrLen (
UINTN
EFIAPI
StrSize (
- IN CONST CHAR16 *String
+ IN CONST CHAR16 *String
)
{
return (StrLen (String) + 1) * sizeof (*String);
@@ -107,8 +107,8 @@ StrSize (
INTN
EFIAPI
StrCmp (
- IN CONST CHAR16 *FirstString,
- IN CONST CHAR16 *SecondString
+ IN CONST CHAR16 *FirstString,
+ IN CONST CHAR16 *SecondString
)
{
//
@@ -121,6 +121,7 @@ StrCmp (
FirstString++;
SecondString++;
}
+
return *FirstString - *SecondString;
}
@@ -159,9 +160,9 @@ StrCmp (
INTN
EFIAPI
StrnCmp (
- IN CONST CHAR16 *FirstString,
- IN CONST CHAR16 *SecondString,
- IN UINTN Length
+ IN CONST CHAR16 *FirstString,
+ IN CONST CHAR16 *SecondString,
+ IN UINTN Length
)
{
if (Length == 0) {
@@ -182,7 +183,8 @@ StrnCmp (
while ((*FirstString != L'\0') &&
(*SecondString != L'\0') &&
(*FirstString == *SecondString) &&
- (Length > 1)) {
+ (Length > 1))
+ {
FirstString++;
SecondString++;
Length--;
@@ -191,7 +193,6 @@ StrnCmp (
return *FirstString - *SecondString;
}
-
/**
Returns the first occurrence of a Null-terminated Unicode sub-string
in a Null-terminated Unicode string.
@@ -221,12 +222,12 @@ StrnCmp (
CHAR16 *
EFIAPI
StrStr (
- IN CONST CHAR16 *String,
- IN CONST CHAR16 *SearchString
+ IN CONST CHAR16 *String,
+ IN CONST CHAR16 *SearchString
)
{
- CONST CHAR16 *FirstMatch;
- CONST CHAR16 *SearchStringTmp;
+ CONST CHAR16 *FirstMatch;
+ CONST CHAR16 *SearchStringTmp;
//
// ASSERT both strings are less long than PcdMaximumUnicodeStringLength.
@@ -236,21 +237,22 @@ StrStr (
ASSERT (StrSize (SearchString) != 0);
if (*SearchString == L'\0') {
- return (CHAR16 *) String;
+ return (CHAR16 *)String;
}
while (*String != L'\0') {
SearchStringTmp = SearchString;
- FirstMatch = String;
+ FirstMatch = String;
- while ((*String == *SearchStringTmp)
- && (*String != L'\0')) {
+ while ( (*String == *SearchStringTmp)
+ && (*String != L'\0'))
+ {
String++;
SearchStringTmp++;
}
if (*SearchStringTmp == L'\0') {
- return (CHAR16 *) FirstMatch;
+ return (CHAR16 *)FirstMatch;
}
if (*String == L'\0') {
@@ -279,10 +281,10 @@ StrStr (
BOOLEAN
EFIAPI
InternalIsDecimalDigitCharacter (
- IN CHAR16 Char
+ IN CHAR16 Char
)
{
- return (BOOLEAN) (Char >= L'0' && Char <= L'9');
+ return (BOOLEAN)(Char >= L'0' && Char <= L'9');
}
/**
@@ -303,11 +305,11 @@ InternalIsDecimalDigitCharacter (
CHAR16
EFIAPI
CharToUpper (
- IN CHAR16 Char
+ IN CHAR16 Char
)
{
- if (Char >= L'a' && Char <= L'z') {
- return (CHAR16) (Char - (L'a' - L'A'));
+ if ((Char >= L'a') && (Char <= L'z')) {
+ return (CHAR16)(Char - (L'a' - L'A'));
}
return Char;
@@ -329,7 +331,7 @@ CharToUpper (
UINTN
EFIAPI
InternalHexCharToUintn (
- IN CHAR16 Char
+ IN CHAR16 Char
)
{
if (InternalIsDecimalDigitCharacter (Char)) {
@@ -356,13 +358,12 @@ InternalHexCharToUintn (
BOOLEAN
EFIAPI
InternalIsHexaDecimalDigitCharacter (
- IN CHAR16 Char
+ IN CHAR16 Char
)
{
-
- return (BOOLEAN) (InternalIsDecimalDigitCharacter (Char) ||
- (Char >= L'A' && Char <= L'F') ||
- (Char >= L'a' && Char <= L'f'));
+ return (BOOLEAN)(InternalIsDecimalDigitCharacter (Char) ||
+ (Char >= L'A' && Char <= L'F') ||
+ (Char >= L'a' && Char <= L'f'));
}
/**
@@ -402,16 +403,15 @@ InternalIsHexaDecimalDigitCharacter (
UINTN
EFIAPI
StrDecimalToUintn (
- IN CONST CHAR16 *String
+ IN CONST CHAR16 *String
)
{
- UINTN Result;
+ UINTN Result;
- StrDecimalToUintnS (String, (CHAR16 **) NULL, &Result);
+ StrDecimalToUintnS (String, (CHAR16 **)NULL, &Result);
return Result;
}
-
/**
Convert a Null-terminated Unicode decimal string to a value of
type UINT64.
@@ -449,12 +449,12 @@ StrDecimalToUintn (
UINT64
EFIAPI
StrDecimalToUint64 (
- IN CONST CHAR16 *String
+ IN CONST CHAR16 *String
)
{
- UINT64 Result;
+ UINT64 Result;
- StrDecimalToUint64S (String, (CHAR16 **) NULL, &Result);
+ StrDecimalToUint64S (String, (CHAR16 **)NULL, &Result);
return Result;
}
@@ -496,16 +496,15 @@ StrDecimalToUint64 (
UINTN
EFIAPI
StrHexToUintn (
- IN CONST CHAR16 *String
+ IN CONST CHAR16 *String
)
{
- UINTN Result;
+ UINTN Result;
- StrHexToUintnS (String, (CHAR16 **) NULL, &Result);
+ StrHexToUintnS (String, (CHAR16 **)NULL, &Result);
return Result;
}
-
/**
Convert a Null-terminated Unicode hexadecimal string to a value of type UINT64.
@@ -544,12 +543,12 @@ StrHexToUintn (
UINT64
EFIAPI
StrHexToUint64 (
- IN CONST CHAR16 *String
+ IN CONST CHAR16 *String
)
{
- UINT64 Result;
+ UINT64 Result;
- StrHexToUint64S (String, (CHAR16 **) NULL, &Result);
+ StrHexToUint64S (String, (CHAR16 **)NULL, &Result);
return Result;
}
@@ -569,10 +568,10 @@ StrHexToUint64 (
BOOLEAN
EFIAPI
InternalAsciiIsDecimalDigitCharacter (
- IN CHAR8 Char
+ IN CHAR8 Char
)
{
- return (BOOLEAN) (Char >= '0' && Char <= '9');
+ return (BOOLEAN)(Char >= '0' && Char <= '9');
}
/**
@@ -592,16 +591,14 @@ InternalAsciiIsDecimalDigitCharacter (
BOOLEAN
EFIAPI
InternalAsciiIsHexaDecimalDigitCharacter (
- IN CHAR8 Char
+ IN CHAR8 Char
)
{
-
- return (BOOLEAN) (InternalAsciiIsDecimalDigitCharacter (Char) ||
- (Char >= 'A' && Char <= 'F') ||
- (Char >= 'a' && Char <= 'f'));
+ return (BOOLEAN)(InternalAsciiIsDecimalDigitCharacter (Char) ||
+ (Char >= 'A' && Char <= 'F') ||
+ (Char >= 'a' && Char <= 'f'));
}
-
/**
Returns the length of a Null-terminated ASCII string.
@@ -622,10 +619,10 @@ InternalAsciiIsHexaDecimalDigitCharacter (
UINTN
EFIAPI
AsciiStrLen (
- IN CONST CHAR8 *String
+ IN CONST CHAR8 *String
)
{
- UINTN Length;
+ UINTN Length;
ASSERT (String != NULL);
@@ -638,6 +635,7 @@ AsciiStrLen (
ASSERT (Length < PcdGet32 (PcdMaximumAsciiStringLength));
}
}
+
return Length;
}
@@ -661,7 +659,7 @@ AsciiStrLen (
UINTN
EFIAPI
AsciiStrSize (
- IN CONST CHAR8 *String
+ IN CONST CHAR8 *String
)
{
return (AsciiStrLen (String) + 1) * sizeof (*String);
@@ -696,8 +694,8 @@ AsciiStrSize (
INTN
EFIAPI
AsciiStrCmp (
- IN CONST CHAR8 *FirstString,
- IN CONST CHAR8 *SecondString
+ IN CONST CHAR8 *FirstString,
+ IN CONST CHAR8 *SecondString
)
{
//
@@ -730,10 +728,10 @@ AsciiStrCmp (
CHAR8
EFIAPI
AsciiCharToUpper (
- IN CHAR8 Chr
+ IN CHAR8 Chr
)
{
- return (UINT8) ((Chr >= 'a' && Chr <= 'z') ? Chr - ('a' - 'A') : Chr);
+ return (UINT8)((Chr >= 'a' && Chr <= 'z') ? Chr - ('a' - 'A') : Chr);
}
/**
@@ -752,7 +750,7 @@ AsciiCharToUpper (
UINTN
EFIAPI
InternalAsciiHexCharToUintn (
- IN CHAR8 Char
+ IN CHAR8 Char
)
{
if (InternalIsDecimalDigitCharacter (Char)) {
@@ -762,7 +760,6 @@ InternalAsciiHexCharToUintn (
return (10 + AsciiCharToUpper (Char) - 'A');
}
-
/**
Performs a case insensitive comparison of two Null-terminated ASCII strings,
and returns the difference between the first mismatched ASCII characters.
@@ -795,8 +792,8 @@ InternalAsciiHexCharToUintn (
INTN
EFIAPI
AsciiStriCmp (
- IN CONST CHAR8 *FirstString,
- IN CONST CHAR8 *SecondString
+ IN CONST CHAR8 *FirstString,
+ IN CONST CHAR8 *SecondString
)
{
CHAR8 UpperFirstString;
@@ -853,9 +850,9 @@ AsciiStriCmp (
INTN
EFIAPI
AsciiStrnCmp (
- IN CONST CHAR8 *FirstString,
- IN CONST CHAR8 *SecondString,
- IN UINTN Length
+ IN CONST CHAR8 *FirstString,
+ IN CONST CHAR8 *SecondString,
+ IN UINTN Length
)
{
if (Length == 0) {
@@ -875,15 +872,16 @@ AsciiStrnCmp (
while ((*FirstString != '\0') &&
(*SecondString != '\0') &&
(*FirstString == *SecondString) &&
- (Length > 1)) {
+ (Length > 1))
+ {
FirstString++;
SecondString++;
Length--;
}
+
return *FirstString - *SecondString;
}
-
/**
Returns the first occurrence of a Null-terminated ASCII sub-string
in a Null-terminated ASCII string.
@@ -911,12 +909,12 @@ AsciiStrnCmp (
CHAR8 *
EFIAPI
AsciiStrStr (
- IN CONST CHAR8 *String,
- IN CONST CHAR8 *SearchString
+ IN CONST CHAR8 *String,
+ IN CONST CHAR8 *SearchString
)
{
- CONST CHAR8 *FirstMatch;
- CONST CHAR8 *SearchStringTmp;
+ CONST CHAR8 *FirstMatch;
+ CONST CHAR8 *SearchStringTmp;
//
// ASSERT both strings are less long than PcdMaximumAsciiStringLength
@@ -925,21 +923,22 @@ AsciiStrStr (
ASSERT (AsciiStrSize (SearchString) != 0);
if (*SearchString == '\0') {
- return (CHAR8 *) String;
+ return (CHAR8 *)String;
}
while (*String != '\0') {
SearchStringTmp = SearchString;
- FirstMatch = String;
+ FirstMatch = String;
- while ((*String == *SearchStringTmp)
- && (*String != '\0')) {
+ while ( (*String == *SearchStringTmp)
+ && (*String != '\0'))
+ {
String++;
SearchStringTmp++;
}
if (*SearchStringTmp == '\0') {
- return (CHAR8 *) FirstMatch;
+ return (CHAR8 *)FirstMatch;
}
if (*String == '\0') {
@@ -985,16 +984,15 @@ AsciiStrStr (
UINTN
EFIAPI
AsciiStrDecimalToUintn (
- IN CONST CHAR8 *String
+ IN CONST CHAR8 *String
)
{
- UINTN Result;
+ UINTN Result;
- AsciiStrDecimalToUintnS (String, (CHAR8 **) NULL, &Result);
+ AsciiStrDecimalToUintnS (String, (CHAR8 **)NULL, &Result);
return Result;
}
-
/**
Convert a Null-terminated ASCII decimal string to a value of type
UINT64.
@@ -1028,12 +1026,12 @@ AsciiStrDecimalToUintn (
UINT64
EFIAPI
AsciiStrDecimalToUint64 (
- IN CONST CHAR8 *String
+ IN CONST CHAR8 *String
)
{
- UINT64 Result;
+ UINT64 Result;
- AsciiStrDecimalToUint64S (String, (CHAR8 **) NULL, &Result);
+ AsciiStrDecimalToUint64S (String, (CHAR8 **)NULL, &Result);
return Result;
}
@@ -1074,16 +1072,15 @@ AsciiStrDecimalToUint64 (
UINTN
EFIAPI
AsciiStrHexToUintn (
- IN CONST CHAR8 *String
+ IN CONST CHAR8 *String
)
{
- UINTN Result;
+ UINTN Result;
- AsciiStrHexToUintnS (String, (CHAR8 **) NULL, &Result);
+ AsciiStrHexToUintnS (String, (CHAR8 **)NULL, &Result);
return Result;
}
-
/**
Convert a Null-terminated ASCII hexadecimal string to a value of type UINT64.
@@ -1121,17 +1118,16 @@ AsciiStrHexToUintn (
UINT64
EFIAPI
AsciiStrHexToUint64 (
- IN CONST CHAR8 *String
+ IN CONST CHAR8 *String
)
{
- UINT64 Result;
+ UINT64 Result;
- AsciiStrHexToUint64S (String, (CHAR8 **) NULL, &Result);
+ AsciiStrHexToUint64S (String, (CHAR8 **)NULL, &Result);
return Result;
}
-
-STATIC CHAR8 EncodingTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+STATIC CHAR8 EncodingTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789+/";
@@ -1158,14 +1154,13 @@ RETURN_STATUS
EFIAPI
Base64Encode (
IN CONST UINT8 *Source,
- IN UINTN SourceLength,
+ IN UINTN SourceLength,
OUT CHAR8 *Destination OPTIONAL,
IN OUT UINTN *DestinationSize
)
{
-
- UINTN RequiredSize;
- UINTN Left;
+ UINTN RequiredSize;
+ UINTN Left;
//
// Check pointers, and SourceLength is valid
@@ -1182,15 +1177,16 @@ Base64Encode (
*DestinationSize = 1;
return RETURN_BUFFER_TOO_SMALL;
}
+
*DestinationSize = 1;
- *Destination = '\0';
+ *Destination = '\0';
return RETURN_SUCCESS;
}
//
// Check if SourceLength or DestinationSize is valid
//
- if ((SourceLength >= (MAX_ADDRESS - (UINTN)Source)) || (*DestinationSize >= (MAX_ADDRESS - (UINTN)Destination))){
+ if ((SourceLength >= (MAX_ADDRESS - (UINTN)Source)) || (*DestinationSize >= (MAX_ADDRESS - (UINTN)Destination))) {
return RETURN_INVALID_PARAMETER;
}
@@ -1198,7 +1194,7 @@ Base64Encode (
// 4 ascii per 3 bytes + NULL
//
RequiredSize = ((SourceLength + 2) / 3) * 4 + 1;
- if ((Destination == NULL) || *DestinationSize < RequiredSize) {
+ if ((Destination == NULL) || (*DestinationSize < RequiredSize)) {
*DestinationSize = RequiredSize;
return RETURN_BUFFER_TOO_SMALL;
}
@@ -1209,13 +1205,12 @@ Base64Encode (
// Encode 24 bits (three bytes) into 4 ascii characters
//
while (Left >= 3) {
-
- *Destination++ = EncodingTable[( Source[0] & 0xfc) >> 2 ];
+ *Destination++ = EncodingTable[(Source[0] & 0xfc) >> 2];
*Destination++ = EncodingTable[((Source[0] & 0x03) << 4) + ((Source[1] & 0xf0) >> 4)];
*Destination++ = EncodingTable[((Source[1] & 0x0f) << 2) + ((Source[2] & 0xc0) >> 6)];
- *Destination++ = EncodingTable[( Source[2] & 0x3f)];
- Left -= 3;
- Source += 3;
+ *Destination++ = EncodingTable[(Source[2] & 0x3f)];
+ Left -= 3;
+ Source += 3;
}
//
@@ -1233,7 +1228,7 @@ Base64Encode (
//
// One more data byte, two pad characters
//
- *Destination++ = EncodingTable[( Source[0] & 0xfc) >> 2];
+ *Destination++ = EncodingTable[(Source[0] & 0xfc) >> 2];
*Destination++ = EncodingTable[((Source[0] & 0x03) << 4)];
*Destination++ = '=';
*Destination++ = '=';
@@ -1243,12 +1238,13 @@ Base64Encode (
//
// Two more data bytes, and one pad character
//
- *Destination++ = EncodingTable[( Source[0] & 0xfc) >> 2];
+ *Destination++ = EncodingTable[(Source[0] & 0xfc) >> 2];
*Destination++ = EncodingTable[((Source[0] & 0x03) << 4) + ((Source[1] & 0xf0) >> 4)];
*Destination++ = EncodingTable[((Source[1] & 0x0f) << 2)];
*Destination++ = '=';
break;
- }
+ }
+
//
// Add terminating NULL
//
@@ -1341,20 +1337,20 @@ Base64Encode (
RETURN_STATUS
EFIAPI
Base64Decode (
- IN CONST CHAR8 *Source OPTIONAL,
- IN UINTN SourceSize,
- OUT UINT8 *Destination OPTIONAL,
- IN OUT UINTN *DestinationSize
+ IN CONST CHAR8 *Source OPTIONAL,
+ IN UINTN SourceSize,
+ OUT UINT8 *Destination OPTIONAL,
+ IN OUT UINTN *DestinationSize
)
{
- BOOLEAN PaddingMode;
- UINTN SixBitGroupsConsumed;
- UINT32 Accumulator;
- UINTN OriginalDestinationSize;
- UINTN SourceIndex;
- CHAR8 SourceChar;
- UINT32 Base64Value;
- UINT8 DestinationOctet;
+ BOOLEAN PaddingMode;
+ UINTN SixBitGroupsConsumed;
+ UINT32 Accumulator;
+ UINTN OriginalDestinationSize;
+ UINTN SourceIndex;
+ CHAR8 SourceChar;
+ UINT32 Base64Value;
+ UINT8 DestinationOctet;
if (DestinationSize == NULL) {
return RETURN_INVALID_PARAMETER;
@@ -1397,7 +1393,7 @@ Base64Decode (
//
// Check for overlap.
//
- if (Source != NULL && Destination != NULL) {
+ if ((Source != NULL) && (Destination != NULL)) {
//
// Both arrays have been provided, and we know from earlier that each array
// is valid in itself.
@@ -1436,8 +1432,9 @@ Base64Decode (
//
// Whitespace is ignored at all positions (regardless of padding mode).
//
- if (SourceChar == '\t' || SourceChar == '\n' || SourceChar == '\v' ||
- SourceChar == '\f' || SourceChar == '\r' || SourceChar == ' ') {
+ if ((SourceChar == '\t') || (SourceChar == '\n') || (SourceChar == '\v') ||
+ (SourceChar == '\f') || (SourceChar == '\r') || (SourceChar == ' '))
+ {
continue;
}
@@ -1451,10 +1448,11 @@ Base64Decode (
// "=" padding characters.
//
if (PaddingMode) {
- if (SourceChar == '=' && SixBitGroupsConsumed == 3) {
+ if ((SourceChar == '=') && (SixBitGroupsConsumed == 3)) {
SixBitGroupsConsumed = 0;
continue;
}
+
return RETURN_INVALID_PARAMETER;
}
@@ -1462,11 +1460,11 @@ Base64Decode (
// When not in padding mode, decode Base64Value based on RFC4648, "Table 1:
// The Base 64 Alphabet".
//
- if ('A' <= SourceChar && SourceChar <= 'Z') {
+ if (('A' <= SourceChar) && (SourceChar <= 'Z')) {
Base64Value = SourceChar - 'A';
- } else if ('a' <= SourceChar && SourceChar <= 'z') {
+ } else if (('a' <= SourceChar) && (SourceChar <= 'z')) {
Base64Value = 26 + (SourceChar - 'a');
- } else if ('0' <= SourceChar && SourceChar <= '9') {
+ } else if (('0' <= SourceChar) && (SourceChar <= '9')) {
Base64Value = 52 + (SourceChar - '0');
} else if (SourceChar == '+') {
Base64Value = 62;
@@ -1530,38 +1528,38 @@ Base64Decode (
Accumulator = (Accumulator << 6) | Base64Value;
SixBitGroupsConsumed++;
switch (SixBitGroupsConsumed) {
- case 1:
- //
- // No octet to spill after consuming the first 6-bit group of the
- // quantum; advance to the next source character.
- //
- continue;
- case 2:
- //
- // 12 bits accumulated (6 pending + 6 new); prepare for spilling an
- // octet. 4 bits remain pending.
- //
- DestinationOctet = (UINT8)(Accumulator >> 4);
- Accumulator &= 0xF;
- break;
- case 3:
- //
- // 10 bits accumulated (4 pending + 6 new); prepare for spilling an
- // octet. 2 bits remain pending.
- //
- DestinationOctet = (UINT8)(Accumulator >> 2);
- Accumulator &= 0x3;
- break;
- default:
- ASSERT (SixBitGroupsConsumed == 4);
- //
- // 8 bits accumulated (2 pending + 6 new); prepare for spilling an octet.
- // The quantum is complete, 0 bits remain pending.
- //
- DestinationOctet = (UINT8)Accumulator;
- Accumulator = 0;
- SixBitGroupsConsumed = 0;
- break;
+ case 1:
+ //
+ // No octet to spill after consuming the first 6-bit group of the
+ // quantum; advance to the next source character.
+ //
+ continue;
+ case 2:
+ //
+ // 12 bits accumulated (6 pending + 6 new); prepare for spilling an
+ // octet. 4 bits remain pending.
+ //
+ DestinationOctet = (UINT8)(Accumulator >> 4);
+ Accumulator &= 0xF;
+ break;
+ case 3:
+ //
+ // 10 bits accumulated (4 pending + 6 new); prepare for spilling an
+ // octet. 2 bits remain pending.
+ //
+ DestinationOctet = (UINT8)(Accumulator >> 2);
+ Accumulator &= 0x3;
+ break;
+ default:
+ ASSERT (SixBitGroupsConsumed == 4);
+ //
+ // 8 bits accumulated (2 pending + 6 new); prepare for spilling an octet.
+ // The quantum is complete, 0 bits remain pending.
+ //
+ DestinationOctet = (UINT8)Accumulator;
+ Accumulator = 0;
+ SixBitGroupsConsumed = 0;
+ break;
}
//
@@ -1572,6 +1570,7 @@ Base64Decode (
ASSERT (Destination != NULL);
Destination[*DestinationSize] = DestinationOctet;
}
+
(*DestinationSize)++;
//
@@ -1592,6 +1591,7 @@ Base64Decode (
if (*DestinationSize <= OriginalDestinationSize) {
return RETURN_SUCCESS;
}
+
return RETURN_BUFFER_TOO_SMALL;
}
@@ -1611,11 +1611,11 @@ Base64Decode (
UINT8
EFIAPI
DecimalToBcd8 (
- IN UINT8 Value
+ IN UINT8 Value
)
{
ASSERT (Value < 100);
- return (UINT8) (((Value / 10) << 4) | (Value % 10));
+ return (UINT8)(((Value / 10) << 4) | (Value % 10));
}
/**
@@ -1635,10 +1635,10 @@ DecimalToBcd8 (
UINT8
EFIAPI
BcdToDecimal8 (
- IN UINT8 Value
+ IN UINT8 Value
)
{
ASSERT (Value < 0xa0);
ASSERT ((Value & 0xf) < 0xa);
- return (UINT8) ((Value >> 4) * 10 + (Value & 0xf));
+ return (UINT8)((Value >> 4) * 10 + (Value & 0xf));
}
diff --git a/MdePkg/Library/BaseLib/SwapBytes16.c b/MdePkg/Library/BaseLib/SwapBytes16.c
index 52e7f71d25..12d452f891 100644
--- a/MdePkg/Library/BaseLib/SwapBytes16.c
+++ b/MdePkg/Library/BaseLib/SwapBytes16.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -26,8 +23,8 @@
UINT16
EFIAPI
SwapBytes16 (
- IN UINT16 Value
+ IN UINT16 Value
)
{
- return (UINT16) ((Value<< 8) | (Value>> 8));
+ return (UINT16)((Value<< 8) | (Value>> 8));
}
diff --git a/MdePkg/Library/BaseLib/SwapBytes32.c b/MdePkg/Library/BaseLib/SwapBytes32.c
index 5109ad512e..206a846528 100644
--- a/MdePkg/Library/BaseLib/SwapBytes32.c
+++ b/MdePkg/Library/BaseLib/SwapBytes32.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -26,14 +23,14 @@
UINT32
EFIAPI
SwapBytes32 (
- IN UINT32 Value
+ IN UINT32 Value
)
{
UINT32 LowerBytes;
UINT32 HigherBytes;
- LowerBytes = (UINT32) SwapBytes16 ((UINT16) Value);
- HigherBytes = (UINT32) SwapBytes16 ((UINT16) (Value >> 16));
+ LowerBytes = (UINT32)SwapBytes16 ((UINT16)Value);
+ HigherBytes = (UINT32)SwapBytes16 ((UINT16)(Value >> 16));
return (LowerBytes << 16 | HigherBytes);
}
diff --git a/MdePkg/Library/BaseLib/SwapBytes64.c b/MdePkg/Library/BaseLib/SwapBytes64.c
index 500f76d484..85102c42e6 100644
--- a/MdePkg/Library/BaseLib/SwapBytes64.c
+++ b/MdePkg/Library/BaseLib/SwapBytes64.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -26,7 +23,7 @@
UINT64
EFIAPI
SwapBytes64 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
return InternalMathSwapBytes64 (Value);
diff --git a/MdePkg/Library/BaseLib/SwitchStack.c b/MdePkg/Library/BaseLib/SwitchStack.c
index 3eb39d4d1d..954e863fc1 100644
--- a/MdePkg/Library/BaseLib/SwitchStack.c
+++ b/MdePkg/Library/BaseLib/SwitchStack.c
@@ -47,7 +47,7 @@ SwitchStack (
...
)
{
- VA_LIST Marker;
+ VA_LIST Marker;
ASSERT (EntryPoint != NULL);
ASSERT (NewStack != NULL);
diff --git a/MdePkg/Library/BaseLib/Unaligned.c b/MdePkg/Library/BaseLib/Unaligned.c
index a419cb85e5..74d76e8316 100644
--- a/MdePkg/Library/BaseLib/Unaligned.c
+++ b/MdePkg/Library/BaseLib/Unaligned.c
@@ -6,10 +6,8 @@
**/
-
#include "BaseLibInternals.h"
-
/**
Reads a 16-bit value from memory that may be unaligned.
@@ -26,7 +24,7 @@
UINT16
EFIAPI
ReadUnaligned16 (
- IN CONST UINT16 *Buffer
+ IN CONST UINT16 *Buffer
)
{
ASSERT (Buffer != NULL);
@@ -52,8 +50,8 @@ ReadUnaligned16 (
UINT16
EFIAPI
WriteUnaligned16 (
- OUT UINT16 *Buffer,
- IN UINT16 Value
+ OUT UINT16 *Buffer,
+ IN UINT16 Value
)
{
ASSERT (Buffer != NULL);
@@ -77,7 +75,7 @@ WriteUnaligned16 (
UINT32
EFIAPI
ReadUnaligned24 (
- IN CONST UINT32 *Buffer
+ IN CONST UINT32 *Buffer
)
{
ASSERT (Buffer != NULL);
@@ -103,8 +101,8 @@ ReadUnaligned24 (
UINT32
EFIAPI
WriteUnaligned24 (
- OUT UINT32 *Buffer,
- IN UINT32 Value
+ OUT UINT32 *Buffer,
+ IN UINT32 Value
)
{
ASSERT (Buffer != NULL);
@@ -129,7 +127,7 @@ WriteUnaligned24 (
UINT32
EFIAPI
ReadUnaligned32 (
- IN CONST UINT32 *Buffer
+ IN CONST UINT32 *Buffer
)
{
ASSERT (Buffer != NULL);
@@ -155,8 +153,8 @@ ReadUnaligned32 (
UINT32
EFIAPI
WriteUnaligned32 (
- OUT UINT32 *Buffer,
- IN UINT32 Value
+ OUT UINT32 *Buffer,
+ IN UINT32 Value
)
{
ASSERT (Buffer != NULL);
@@ -180,7 +178,7 @@ WriteUnaligned32 (
UINT64
EFIAPI
ReadUnaligned64 (
- IN CONST UINT64 *Buffer
+ IN CONST UINT64 *Buffer
)
{
ASSERT (Buffer != NULL);
@@ -206,8 +204,8 @@ ReadUnaligned64 (
UINT64
EFIAPI
WriteUnaligned64 (
- OUT UINT64 *Buffer,
- IN UINT64 Value
+ OUT UINT64 *Buffer,
+ IN UINT64 Value
)
{
ASSERT (Buffer != NULL);
diff --git a/MdePkg/Library/BaseLib/UnitTestHost.c b/MdePkg/Library/BaseLib/UnitTestHost.c
index 79eec7caca..b8831407f9 100644
--- a/MdePkg/Library/BaseLib/UnitTestHost.c
+++ b/MdePkg/Library/BaseLib/UnitTestHost.c
@@ -11,7 +11,7 @@
///
/// Module global variable for simple system emulation of interrupt state
///
-STATIC BOOLEAN mUnitTestHostBaseLibInterruptState;
+STATIC BOOLEAN mUnitTestHostBaseLibInterruptState;
/**
Enables CPU interrupts.
diff --git a/MdePkg/Library/BaseLib/X64/CpuBreakpoint.c b/MdePkg/Library/BaseLib/X64/CpuBreakpoint.c
index c626ef8ece..8c03934ef5 100644
--- a/MdePkg/Library/BaseLib/X64/CpuBreakpoint.c
+++ b/MdePkg/Library/BaseLib/X64/CpuBreakpoint.c
@@ -6,12 +6,14 @@
**/
-
/**
Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics.
**/
-void __debugbreak (VOID);
+void
+__debugbreak (
+ VOID
+ );
#pragma intrinsic(__debugbreak)
@@ -30,4 +32,3 @@ CpuBreakpoint (
{
__debugbreak ();
}
-
diff --git a/MdePkg/Library/BaseLib/X64/GccInline.c b/MdePkg/Library/BaseLib/X64/GccInline.c
index 40a208f198..c21eb0622e 100644
--- a/MdePkg/Library/BaseLib/X64/GccInline.c
+++ b/MdePkg/Library/BaseLib/X64/GccInline.c
@@ -7,12 +7,8 @@
**/
-
#include "BaseLibInternals.h"
-
-
-
/**
Used to serialize load and store operations.
@@ -32,7 +28,6 @@ MemoryFence (
__asm__ __volatile__ ("":::"memory");
}
-
/**
Requests CPU to pause for a short period of time.
@@ -49,7 +44,6 @@ CpuPause (
__asm__ __volatile__ ("pause");
}
-
/**
Generates a breakpoint on the CPU.
@@ -66,7 +60,6 @@ CpuBreakpoint (
__asm__ __volatile__ ("int $3");
}
-
/**
Reads the current value of the EFLAGS register.
@@ -83,13 +76,13 @@ AsmReadEflags (
VOID
)
{
- UINTN Eflags;
+ UINTN Eflags;
__asm__ __volatile__ (
"pushfq \n\t"
"pop %0 "
: "=r" (Eflags) // %0
- );
+ );
return Eflags;
}
@@ -107,17 +100,16 @@ AsmReadEflags (
VOID
EFIAPI
InternalX86FxSave (
- OUT IA32_FX_BUFFER *Buffer
+ OUT IA32_FX_BUFFER *Buffer
)
{
__asm__ __volatile__ (
"fxsave %0"
:
: "m" (*Buffer) // %0
- );
+ );
}
-
/**
Restores the current floating point/SSE/SSE2 context from a buffer.
@@ -131,17 +123,16 @@ InternalX86FxSave (
VOID
EFIAPI
InternalX86FxRestore (
- IN CONST IA32_FX_BUFFER *Buffer
+ IN CONST IA32_FX_BUFFER *Buffer
)
{
__asm__ __volatile__ (
"fxrstor %0"
:
: "m" (*Buffer) // %0
- );
+ );
}
-
/**
Reads the current value of 64-bit MMX Register #0 (MM0).
@@ -162,12 +153,11 @@ AsmReadMm0 (
__asm__ __volatile__ (
"movd %%mm0, %0 \n\t"
: "=r" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #1 (MM1).
@@ -188,12 +178,11 @@ AsmReadMm1 (
__asm__ __volatile__ (
"movd %%mm1, %0 \n\t"
: "=r" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #2 (MM2).
@@ -214,12 +203,11 @@ AsmReadMm2 (
__asm__ __volatile__ (
"movd %%mm2, %0 \n\t"
: "=r" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #3 (MM3).
@@ -240,12 +228,11 @@ AsmReadMm3 (
__asm__ __volatile__ (
"movd %%mm3, %0 \n\t"
: "=r" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #4 (MM4).
@@ -266,12 +253,11 @@ AsmReadMm4 (
__asm__ __volatile__ (
"movd %%mm4, %0 \n\t"
: "=r" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #5 (MM5).
@@ -292,12 +278,11 @@ AsmReadMm5 (
__asm__ __volatile__ (
"movd %%mm5, %0 \n\t"
: "=r" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #6 (MM6).
@@ -318,12 +303,11 @@ AsmReadMm6 (
__asm__ __volatile__ (
"movd %%mm6, %0 \n\t"
: "=r" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #7 (MM7).
@@ -344,12 +328,11 @@ AsmReadMm7 (
__asm__ __volatile__ (
"movd %%mm7, %0 \n\t"
: "=r" (Data) // %0
- );
+ );
return Data;
}
-
/**
Writes the current value of 64-bit MMX Register #0 (MM0).
@@ -362,17 +345,16 @@ AsmReadMm7 (
VOID
EFIAPI
AsmWriteMm0 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movd %0, %%mm0" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #1 (MM1).
@@ -385,17 +367,16 @@ AsmWriteMm0 (
VOID
EFIAPI
AsmWriteMm1 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movd %0, %%mm1" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #2 (MM2).
@@ -408,17 +389,16 @@ AsmWriteMm1 (
VOID
EFIAPI
AsmWriteMm2 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movd %0, %%mm2" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #3 (MM3).
@@ -431,17 +411,16 @@ AsmWriteMm2 (
VOID
EFIAPI
AsmWriteMm3 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movd %0, %%mm3" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #4 (MM4).
@@ -454,17 +433,16 @@ AsmWriteMm3 (
VOID
EFIAPI
AsmWriteMm4 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movd %0, %%mm4" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #5 (MM5).
@@ -477,17 +455,16 @@ AsmWriteMm4 (
VOID
EFIAPI
AsmWriteMm5 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movd %0, %%mm5" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #6 (MM6).
@@ -500,17 +477,16 @@ AsmWriteMm5 (
VOID
EFIAPI
AsmWriteMm6 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movd %0, %%mm6" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #7 (MM7).
@@ -523,17 +499,16 @@ AsmWriteMm6 (
VOID
EFIAPI
AsmWriteMm7 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movd %0, %%mm7" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Reads the current value of Time Stamp Counter (TSC).
@@ -556,7 +531,7 @@ AsmReadTsc (
"rdtsc"
: "=a" (LowData),
"=d" (HiData)
- );
+ );
return (((UINT64)HiData) << 32) | LowData;
}
diff --git a/MdePkg/Library/BaseLib/X64/GccInlinePriv.c b/MdePkg/Library/BaseLib/X64/GccInlinePriv.c
index c3feb9f922..f63e03e0c5 100644
--- a/MdePkg/Library/BaseLib/X64/GccInlinePriv.c
+++ b/MdePkg/Library/BaseLib/X64/GccInlinePriv.c
@@ -8,7 +8,6 @@
**/
-
#include "BaseLibInternals.h"
#include <Library/RegisterFilterLib.h>
@@ -27,7 +26,6 @@ EnableInterrupts (
__asm__ __volatile__ ("sti"::: "memory");
}
-
/**
Disables CPU interrupts.
@@ -60,13 +58,13 @@ DisableInterrupts (
UINT64
EFIAPI
AsmReadMsr64 (
- IN UINT32 Index
+ IN UINT32 Index
)
{
- UINT32 LowData;
- UINT32 HighData;
- UINT64 Value;
- BOOLEAN Flag;
+ UINT32 LowData;
+ UINT32 HighData;
+ UINT64 Value;
+ BOOLEAN Flag;
Flag = FilterBeforeMsrRead (Index, &Value);
if (Flag) {
@@ -75,9 +73,10 @@ AsmReadMsr64 (
: "=a" (LowData), // %0
"=d" (HighData) // %1
: "c" (Index) // %2
- );
+ );
Value = (((UINT64)HighData) << 32) | LowData;
}
+
FilterAfterMsrRead (Index, &Value);
return Value;
@@ -103,13 +102,13 @@ AsmReadMsr64 (
UINT64
EFIAPI
AsmWriteMsr64 (
- IN UINT32 Index,
- IN UINT64 Value
+ IN UINT32 Index,
+ IN UINT64 Value
)
{
- UINT32 LowData;
- UINT32 HighData;
- BOOLEAN Flag;
+ UINT32 LowData;
+ UINT32 HighData;
+ BOOLEAN Flag;
Flag = FilterBeforeMsrWrite (Index, &Value);
if (Flag) {
@@ -121,8 +120,9 @@ AsmWriteMsr64 (
: "c" (Index),
"a" (LowData),
"d" (HighData)
- );
+ );
}
+
FilterAfterMsrWrite (Index, &Value);
return Value;
@@ -144,17 +144,16 @@ AsmReadCr0 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"mov %%cr0,%0"
: "=r" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of the Control Register 2 (CR2).
@@ -171,12 +170,12 @@ AsmReadCr2 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"mov %%cr2, %0"
: "=r" (Data) // %0
- );
+ );
return Data;
}
@@ -197,17 +196,16 @@ AsmReadCr3 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"mov %%cr3, %0"
: "=r" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of the Control Register 4 (CR4).
@@ -224,17 +222,16 @@ AsmReadCr4 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"mov %%cr4, %0"
: "=r" (Data) // %0
- );
+ );
return Data;
}
-
/**
Writes a value to Control Register 0 (CR0).
@@ -256,11 +253,10 @@ AsmWriteCr0 (
"mov %0, %%cr0"
:
: "r" (Cr0)
- );
+ );
return Cr0;
}
-
/**
Writes a value to Control Register 2 (CR2).
@@ -282,11 +278,10 @@ AsmWriteCr2 (
"mov %0, %%cr2"
:
: "r" (Cr2)
- );
+ );
return Cr2;
}
-
/**
Writes a value to Control Register 3 (CR3).
@@ -308,11 +303,10 @@ AsmWriteCr3 (
"mov %0, %%cr3"
:
: "r" (Cr3)
- );
+ );
return Cr3;
}
-
/**
Writes a value to Control Register 4 (CR4).
@@ -334,11 +328,10 @@ AsmWriteCr4 (
"mov %0, %%cr4"
:
: "r" (Cr4)
- );
+ );
return Cr4;
}
-
/**
Reads the current value of Debug Register 0 (DR0).
@@ -355,17 +348,16 @@ AsmReadDr0 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"mov %%dr0, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 1 (DR1).
@@ -382,17 +374,16 @@ AsmReadDr1 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"mov %%dr1, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 2 (DR2).
@@ -409,17 +400,16 @@ AsmReadDr2 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"mov %%dr2, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 3 (DR3).
@@ -436,17 +426,16 @@ AsmReadDr3 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"mov %%dr3, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 4 (DR4).
@@ -463,17 +452,16 @@ AsmReadDr4 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"mov %%dr4, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 5 (DR5).
@@ -490,17 +478,16 @@ AsmReadDr5 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"mov %%dr5, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 6 (DR6).
@@ -517,17 +504,16 @@ AsmReadDr6 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"mov %%dr6, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 7 (DR7).
@@ -544,17 +530,16 @@ AsmReadDr7 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"mov %%dr7, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Writes a value to Debug Register 0 (DR0).
@@ -576,11 +561,10 @@ AsmWriteDr0 (
"mov %0, %%dr0"
:
: "r" (Dr0)
- );
+ );
return Dr0;
}
-
/**
Writes a value to Debug Register 1 (DR1).
@@ -602,11 +586,10 @@ AsmWriteDr1 (
"mov %0, %%dr1"
:
: "r" (Dr1)
- );
+ );
return Dr1;
}
-
/**
Writes a value to Debug Register 2 (DR2).
@@ -628,11 +611,10 @@ AsmWriteDr2 (
"mov %0, %%dr2"
:
: "r" (Dr2)
- );
+ );
return Dr2;
}
-
/**
Writes a value to Debug Register 3 (DR3).
@@ -654,11 +636,10 @@ AsmWriteDr3 (
"mov %0, %%dr3"
:
: "r" (Dr3)
- );
+ );
return Dr3;
}
-
/**
Writes a value to Debug Register 4 (DR4).
@@ -680,11 +661,10 @@ AsmWriteDr4 (
"mov %0, %%dr4"
:
: "r" (Dr4)
- );
+ );
return Dr4;
}
-
/**
Writes a value to Debug Register 5 (DR5).
@@ -706,11 +686,10 @@ AsmWriteDr5 (
"mov %0, %%dr5"
:
: "r" (Dr5)
- );
+ );
return Dr5;
}
-
/**
Writes a value to Debug Register 6 (DR6).
@@ -732,11 +711,10 @@ AsmWriteDr6 (
"mov %0, %%dr6"
:
: "r" (Dr6)
- );
+ );
return Dr6;
}
-
/**
Writes a value to Debug Register 7 (DR7).
@@ -758,11 +736,10 @@ AsmWriteDr7 (
"mov %0, %%dr7"
:
: "r" (Dr7)
- );
+ );
return Dr7;
}
-
/**
Reads the current value of Code Segment Register (CS).
@@ -783,12 +760,11 @@ AsmReadCs (
__asm__ __volatile__ (
"mov %%cs, %0"
:"=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Data Segment Register (DS).
@@ -809,12 +785,11 @@ AsmReadDs (
__asm__ __volatile__ (
"mov %%ds, %0"
:"=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Extra Segment Register (ES).
@@ -835,12 +810,11 @@ AsmReadEs (
__asm__ __volatile__ (
"mov %%es, %0"
:"=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of FS Data Segment Register (FS).
@@ -861,12 +835,11 @@ AsmReadFs (
__asm__ __volatile__ (
"mov %%fs, %0"
:"=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of GS Data Segment Register (GS).
@@ -887,12 +860,11 @@ AsmReadGs (
__asm__ __volatile__ (
"mov %%gs, %0"
:"=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Stack Segment Register (SS).
@@ -913,12 +885,11 @@ AsmReadSs (
__asm__ __volatile__ (
"mov %%ss, %0"
:"=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Task Register (TR).
@@ -939,12 +910,11 @@ AsmReadTr (
__asm__ __volatile__ (
"str %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current Global Descriptor Table Register(GDTR) descriptor.
@@ -957,16 +927,15 @@ AsmReadTr (
VOID
EFIAPI
InternalX86ReadGdtr (
- OUT IA32_DESCRIPTOR *Gdtr
+ OUT IA32_DESCRIPTOR *Gdtr
)
{
__asm__ __volatile__ (
"sgdt %0"
: "=m" (*Gdtr)
- );
+ );
}
-
/**
Writes the current Global Descriptor Table Register (GDTR) descriptor.
@@ -979,18 +948,16 @@ InternalX86ReadGdtr (
VOID
EFIAPI
InternalX86WriteGdtr (
- IN CONST IA32_DESCRIPTOR *Gdtr
+ IN CONST IA32_DESCRIPTOR *Gdtr
)
{
__asm__ __volatile__ (
"lgdt %0"
:
: "m" (*Gdtr)
- );
-
+ );
}
-
/**
Reads the current Interrupt Descriptor Table Register(GDTR) descriptor.
@@ -1003,16 +970,15 @@ InternalX86WriteGdtr (
VOID
EFIAPI
InternalX86ReadIdtr (
- OUT IA32_DESCRIPTOR *Idtr
+ OUT IA32_DESCRIPTOR *Idtr
)
{
__asm__ __volatile__ (
"sidt %0"
: "=m" (*Idtr)
- );
+ );
}
-
/**
Writes the current Interrupt Descriptor Table Register(GDTR) descriptor.
@@ -1025,17 +991,16 @@ InternalX86ReadIdtr (
VOID
EFIAPI
InternalX86WriteIdtr (
- IN CONST IA32_DESCRIPTOR *Idtr
+ IN CONST IA32_DESCRIPTOR *Idtr
)
{
__asm__ __volatile__ (
"lidt %0"
:
: "m" (*Idtr)
- );
+ );
}
-
/**
Reads the current Local Descriptor Table Register(LDTR) selector.
@@ -1056,12 +1021,11 @@ AsmReadLdtr (
__asm__ __volatile__ (
"sldt %0"
: "=g" (Data) // %0
- );
+ );
return Data;
}
-
/**
Writes the current Local Descriptor Table Register (GDTR) selector.
@@ -1074,14 +1038,14 @@ AsmReadLdtr (
VOID
EFIAPI
AsmWriteLdtr (
- IN UINT16 Ldtr
+ IN UINT16 Ldtr
)
{
__asm__ __volatile__ (
"lldtw %0"
:
: "g" (Ldtr) // %0
- );
+ );
}
/**
@@ -1098,7 +1062,7 @@ AsmWriteLdtr (
UINT64
EFIAPI
AsmReadPmc (
- IN UINT32 Index
+ IN UINT32 Index
)
{
UINT32 LowData;
@@ -1109,7 +1073,7 @@ AsmReadPmc (
: "=a" (LowData),
"=d" (HiData)
: "c" (Index)
- );
+ );
return (((UINT64)HiData) << 32) | LowData;
}
@@ -1133,9 +1097,9 @@ AsmReadPmc (
UINTN
EFIAPI
AsmMonitor (
- IN UINTN Eax,
- IN UINTN Ecx,
- IN UINTN Edx
+ IN UINTN Eax,
+ IN UINTN Ecx,
+ IN UINTN Edx
)
{
__asm__ __volatile__ (
@@ -1144,7 +1108,7 @@ AsmMonitor (
: "a" (Eax),
"c" (Ecx),
"d" (Edx)
- );
+ );
return Eax;
}
@@ -1166,8 +1130,8 @@ AsmMonitor (
UINTN
EFIAPI
AsmMwait (
- IN UINTN Eax,
- IN UINTN Ecx
+ IN UINTN Eax,
+ IN UINTN Ecx
)
{
__asm__ __volatile__ (
@@ -1175,7 +1139,7 @@ AsmMwait (
:
: "a" (Eax),
"c" (Ecx)
- );
+ );
return Eax;
}
@@ -1210,10 +1174,8 @@ AsmInvd (
)
{
__asm__ __volatile__ ("invd":::"memory");
-
}
-
/**
Flushes a cache line from all the instruction and data caches within the
coherency domain of the CPU.
@@ -1232,7 +1194,7 @@ AsmInvd (
VOID *
EFIAPI
AsmFlushCacheLine (
- IN VOID *LinearAddress
+ IN VOID *LinearAddress
)
{
__asm__ __volatile__ (
@@ -1240,7 +1202,7 @@ AsmFlushCacheLine (
:
: "r" (LinearAddress)
: "memory"
- );
+ );
- return LinearAddress;
+ return LinearAddress;
}
diff --git a/MdePkg/Library/BaseLib/X64/Non-existing.c b/MdePkg/Library/BaseLib/X64/Non-existing.c
index 8f1eb4a4ce..a8c7226c47 100644
--- a/MdePkg/Library/BaseLib/X64/Non-existing.c
+++ b/MdePkg/Library/BaseLib/X64/Non-existing.c
@@ -102,7 +102,6 @@ InternalX86DisablePaging32 (
ASSERT (FALSE);
}
-
/**
Enables the 64-bit paging mode on the CPU.
@@ -133,11 +132,11 @@ InternalX86DisablePaging32 (
VOID
EFIAPI
InternalX86EnablePaging64 (
- IN UINT16 Cs,
- IN UINT64 EntryPoint,
- IN UINT64 Context1 OPTIONAL,
- IN UINT64 Context2 OPTIONAL,
- IN UINT64 NewStack
+ IN UINT16 Cs,
+ IN UINT64 EntryPoint,
+ IN UINT64 Context1 OPTIONAL,
+ IN UINT64 Context2 OPTIONAL,
+ IN UINT64 NewStack
)
{
//
diff --git a/MdePkg/Library/BaseLib/X64/ReadMsr64.c b/MdePkg/Library/BaseLib/X64/ReadMsr64.c
index 36a349432c..546bdc96b4 100644
--- a/MdePkg/Library/BaseLib/X64/ReadMsr64.c
+++ b/MdePkg/Library/BaseLib/X64/ReadMsr64.c
@@ -12,7 +12,10 @@
#include <Library/RegisterFilterLib.h>
-unsigned __int64 __readmsr (int register);
+unsigned __int64
+__readmsr (
+ int register
+ );
#pragma intrinsic(__readmsr)
@@ -30,15 +33,15 @@ AsmReadMsr64 (
IN UINT32 Index
)
{
- UINT64 Value;
- BOOLEAN Flag;
+ UINT64 Value;
+ BOOLEAN Flag;
Flag = FilterBeforeMsrRead (Index, &Value);
if (Flag) {
Value = __readmsr (Index);
}
+
FilterAfterMsrRead (Index, &Value);
return Value;
}
-
diff --git a/MdePkg/Library/BaseLib/X64/WriteMsr64.c b/MdePkg/Library/BaseLib/X64/WriteMsr64.c
index bb030832c4..1e48b71467 100644
--- a/MdePkg/Library/BaseLib/X64/WriteMsr64.c
+++ b/MdePkg/Library/BaseLib/X64/WriteMsr64.c
@@ -12,7 +12,11 @@
#include <Library/RegisterFilterLib.h>
-void __writemsr (unsigned long Register, unsigned __int64 Value);
+void
+__writemsr (
+ unsigned long Register,
+ unsigned __int64 Value
+ );
#pragma intrinsic(__writemsr)
@@ -32,14 +36,14 @@ AsmWriteMsr64 (
IN UINT64 Value
)
{
- BOOLEAN Flag;
+ BOOLEAN Flag;
Flag = FilterBeforeMsrWrite (Index, &Value);
if (Flag) {
__writemsr (Index, Value);
}
+
FilterAfterMsrWrite (Index, &Value);
return Value;
}
-
diff --git a/MdePkg/Library/BaseLib/X86DisablePaging32.c b/MdePkg/Library/BaseLib/X86DisablePaging32.c
index 7a6cb84c59..a82a502ff3 100644
--- a/MdePkg/Library/BaseLib/X86DisablePaging32.c
+++ b/MdePkg/Library/BaseLib/X86DisablePaging32.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
diff --git a/MdePkg/Library/BaseLib/X86DisablePaging64.c b/MdePkg/Library/BaseLib/X86DisablePaging64.c
index 2879185817..59173a24e9 100644
--- a/MdePkg/Library/BaseLib/X86DisablePaging64.c
+++ b/MdePkg/Library/BaseLib/X86DisablePaging64.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -44,11 +41,11 @@
VOID
EFIAPI
AsmDisablePaging64 (
- IN UINT16 Cs,
- IN UINT32 EntryPoint,
- IN UINT32 Context1 OPTIONAL,
- IN UINT32 Context2 OPTIONAL,
- IN UINT32 NewStack
+ IN UINT16 Cs,
+ IN UINT32 EntryPoint,
+ IN UINT32 Context1 OPTIONAL,
+ IN UINT32 Context2 OPTIONAL,
+ IN UINT32 NewStack
)
{
ASSERT (EntryPoint != 0);
diff --git a/MdePkg/Library/BaseLib/X86EnablePaging32.c b/MdePkg/Library/BaseLib/X86EnablePaging32.c
index 2f0c4078f1..c331cc96fe 100644
--- a/MdePkg/Library/BaseLib/X86EnablePaging32.c
+++ b/MdePkg/Library/BaseLib/X86EnablePaging32.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
diff --git a/MdePkg/Library/BaseLib/X86EnablePaging64.c b/MdePkg/Library/BaseLib/X86EnablePaging64.c
index a09d079109..533ca7d426 100644
--- a/MdePkg/Library/BaseLib/X86EnablePaging64.c
+++ b/MdePkg/Library/BaseLib/X86EnablePaging64.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -46,11 +43,11 @@
VOID
EFIAPI
AsmEnablePaging64 (
- IN UINT16 Cs,
- IN UINT64 EntryPoint,
- IN UINT64 Context1 OPTIONAL,
- IN UINT64 Context2 OPTIONAL,
- IN UINT64 NewStack
+ IN UINT16 Cs,
+ IN UINT64 EntryPoint,
+ IN UINT64 Context1 OPTIONAL,
+ IN UINT64 Context2 OPTIONAL,
+ IN UINT64 NewStack
)
{
ASSERT (EntryPoint != 0);
diff --git a/MdePkg/Library/BaseLib/X86FxRestore.c b/MdePkg/Library/BaseLib/X86FxRestore.c
index c4fa668568..b236f6d51f 100644
--- a/MdePkg/Library/BaseLib/X86FxRestore.c
+++ b/MdePkg/Library/BaseLib/X86FxRestore.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -28,7 +25,7 @@
VOID
EFIAPI
AsmFxRestore (
- IN CONST IA32_FX_BUFFER *Buffer
+ IN CONST IA32_FX_BUFFER *Buffer
)
{
ASSERT (Buffer != NULL);
@@ -37,7 +34,7 @@ AsmFxRestore (
//
// Check the flag recorded by AsmFxSave()
//
- ASSERT (0xAA5555AA == *(UINT32 *) (&Buffer->Buffer[sizeof (Buffer->Buffer) - 4]));
+ ASSERT (0xAA5555AA == *(UINT32 *)(&Buffer->Buffer[sizeof (Buffer->Buffer) - 4]));
InternalX86FxRestore (Buffer);
}
diff --git a/MdePkg/Library/BaseLib/X86FxSave.c b/MdePkg/Library/BaseLib/X86FxSave.c
index 2621a08a30..a335d40611 100644
--- a/MdePkg/Library/BaseLib/X86FxSave.c
+++ b/MdePkg/Library/BaseLib/X86FxSave.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -27,7 +24,7 @@
VOID
EFIAPI
AsmFxSave (
- OUT IA32_FX_BUFFER *Buffer
+ OUT IA32_FX_BUFFER *Buffer
)
{
ASSERT (Buffer != NULL);
@@ -38,5 +35,5 @@ AsmFxSave (
//
// Mark one flag at end of Buffer, it will be check by AsmFxRestor()
//
- *(UINT32 *) (&Buffer->Buffer[sizeof (Buffer->Buffer) - 4]) = 0xAA5555AA;
+ *(UINT32 *)(&Buffer->Buffer[sizeof (Buffer->Buffer) - 4]) = 0xAA5555AA;
}
diff --git a/MdePkg/Library/BaseLib/X86GetInterruptState.c b/MdePkg/Library/BaseLib/X86GetInterruptState.c
index 4363a7fdac..6e0cfbaf85 100644
--- a/MdePkg/Library/BaseLib/X86GetInterruptState.c
+++ b/MdePkg/Library/BaseLib/X86GetInterruptState.c
@@ -6,10 +6,8 @@
**/
-
#include "BaseLibInternals.h"
-
/**
Retrieves the current CPU interrupt state.
@@ -26,10 +24,8 @@ GetInterruptState (
VOID
)
{
- IA32_EFLAGS32 EFlags;
+ IA32_EFLAGS32 EFlags;
EFlags.UintN = AsmReadEflags ();
return (BOOLEAN)(1 == EFlags.Bits.IF);
}
-
-
diff --git a/MdePkg/Library/BaseLib/X86MemoryFence.c b/MdePkg/Library/BaseLib/X86MemoryFence.c
index 399b36b569..774d0034fa 100644
--- a/MdePkg/Library/BaseLib/X86MemoryFence.c
+++ b/MdePkg/Library/BaseLib/X86MemoryFence.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Used to serialize load and store operations.
diff --git a/MdePkg/Library/BaseLib/X86Msr.c b/MdePkg/Library/BaseLib/X86Msr.c
index ea51ca9ada..1995cb8fd3 100644
--- a/MdePkg/Library/BaseLib/X86Msr.c
+++ b/MdePkg/Library/BaseLib/X86Msr.c
@@ -6,10 +6,8 @@
**/
-
#include "BaseLibInternals.h"
-
/**
Returns the lower 32-bits of a Machine Specific Register(MSR).
@@ -27,7 +25,7 @@
UINT32
EFIAPI
AsmReadMsr32 (
- IN UINT32 Index
+ IN UINT32 Index
)
{
return (UINT32)AsmReadMsr64 (Index);
@@ -53,8 +51,8 @@ AsmReadMsr32 (
UINT32
EFIAPI
AsmWriteMsr32 (
- IN UINT32 Index,
- IN UINT32 Value
+ IN UINT32 Index,
+ IN UINT32 Value
)
{
return (UINT32)AsmWriteMsr64 (Index, Value);
@@ -82,8 +80,8 @@ AsmWriteMsr32 (
UINT32
EFIAPI
AsmMsrOr32 (
- IN UINT32 Index,
- IN UINT32 OrData
+ IN UINT32 Index,
+ IN UINT32 OrData
)
{
return (UINT32)AsmMsrOr64 (Index, OrData);
@@ -111,8 +109,8 @@ AsmMsrOr32 (
UINT32
EFIAPI
AsmMsrAnd32 (
- IN UINT32 Index,
- IN UINT32 AndData
+ IN UINT32 Index,
+ IN UINT32 AndData
)
{
return (UINT32)AsmMsrAnd64 (Index, AndData);
@@ -143,9 +141,9 @@ AsmMsrAnd32 (
UINT32
EFIAPI
AsmMsrAndThenOr32 (
- IN UINT32 Index,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINT32 Index,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return (UINT32)AsmMsrAndThenOr64 (Index, AndData, OrData);
@@ -176,9 +174,9 @@ AsmMsrAndThenOr32 (
UINT32
EFIAPI
AsmMsrBitFieldRead32 (
- IN UINT32 Index,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT32 Index,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead32 (AsmReadMsr32 (Index), StartBit, EndBit);
@@ -212,10 +210,10 @@ AsmMsrBitFieldRead32 (
UINT32
EFIAPI
AsmMsrBitFieldWrite32 (
- IN UINT32 Index,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINT32 Index,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
ASSERT (EndBit < sizeof (Value) * 8);
@@ -253,10 +251,10 @@ AsmMsrBitFieldWrite32 (
UINT32
EFIAPI
AsmMsrBitFieldOr32 (
- IN UINT32 Index,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINT32 Index,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
ASSERT (EndBit < sizeof (OrData) * 8);
@@ -294,10 +292,10 @@ AsmMsrBitFieldOr32 (
UINT32
EFIAPI
AsmMsrBitFieldAnd32 (
- IN UINT32 Index,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINT32 Index,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
ASSERT (EndBit < sizeof (AndData) * 8);
@@ -339,11 +337,11 @@ AsmMsrBitFieldAnd32 (
UINT32
EFIAPI
AsmMsrBitFieldAndThenOr32 (
- IN UINT32 Index,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINT32 Index,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
ASSERT (EndBit < sizeof (AndData) * 8);
@@ -378,8 +376,8 @@ AsmMsrBitFieldAndThenOr32 (
UINT64
EFIAPI
AsmMsrOr64 (
- IN UINT32 Index,
- IN UINT64 OrData
+ IN UINT32 Index,
+ IN UINT64 OrData
)
{
return AsmWriteMsr64 (Index, AsmReadMsr64 (Index) | OrData);
@@ -406,8 +404,8 @@ AsmMsrOr64 (
UINT64
EFIAPI
AsmMsrAnd64 (
- IN UINT32 Index,
- IN UINT64 AndData
+ IN UINT32 Index,
+ IN UINT64 AndData
)
{
return AsmWriteMsr64 (Index, AsmReadMsr64 (Index) & AndData);
@@ -437,9 +435,9 @@ AsmMsrAnd64 (
UINT64
EFIAPI
AsmMsrAndThenOr64 (
- IN UINT32 Index,
- IN UINT64 AndData,
- IN UINT64 OrData
+ IN UINT32 Index,
+ IN UINT64 AndData,
+ IN UINT64 OrData
)
{
return AsmWriteMsr64 (Index, (AsmReadMsr64 (Index) & AndData) | OrData);
@@ -470,9 +468,9 @@ AsmMsrAndThenOr64 (
UINT64
EFIAPI
AsmMsrBitFieldRead64 (
- IN UINT32 Index,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT32 Index,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead64 (AsmReadMsr64 (Index), StartBit, EndBit);
@@ -505,10 +503,10 @@ AsmMsrBitFieldRead64 (
UINT64
EFIAPI
AsmMsrBitFieldWrite64 (
- IN UINT32 Index,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 Value
+ IN UINT32 Index,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 Value
)
{
return AsmWriteMsr64 (
@@ -547,10 +545,10 @@ AsmMsrBitFieldWrite64 (
UINT64
EFIAPI
AsmMsrBitFieldOr64 (
- IN UINT32 Index,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 OrData
+ IN UINT32 Index,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 OrData
)
{
return AsmWriteMsr64 (
@@ -589,10 +587,10 @@ AsmMsrBitFieldOr64 (
UINT64
EFIAPI
AsmMsrBitFieldAnd64 (
- IN UINT32 Index,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData
+ IN UINT32 Index,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData
)
{
return AsmWriteMsr64 (
@@ -634,11 +632,11 @@ AsmMsrBitFieldAnd64 (
UINT64
EFIAPI
AsmMsrBitFieldAndThenOr64 (
- IN UINT32 Index,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData,
- IN UINT64 OrData
+ IN UINT32 Index,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData,
+ IN UINT64 OrData
)
{
return AsmWriteMsr64 (
diff --git a/MdePkg/Library/BaseLib/X86PatchInstruction.c b/MdePkg/Library/BaseLib/X86PatchInstruction.c
index fc70a352d3..116a50199e 100644
--- a/MdePkg/Library/BaseLib/X86PatchInstruction.c
+++ b/MdePkg/Library/BaseLib/X86PatchInstruction.c
@@ -46,9 +46,9 @@
VOID
EFIAPI
PatchInstructionX86 (
- OUT X86_ASSEMBLY_PATCH_LABEL *InstructionEnd,
- IN UINT64 PatchValue,
- IN UINTN ValueSize
+ OUT X86_ASSEMBLY_PATCH_LABEL *InstructionEnd,
+ IN UINT64 PatchValue,
+ IN UINTN ValueSize
)
{
//
@@ -58,26 +58,26 @@ PatchInstructionX86 (
ASSERT ((UINTN)InstructionEnd > ValueSize);
switch (ValueSize) {
- case 1:
- ASSERT (PatchValue <= MAX_UINT8);
- *((UINT8 *)(UINTN)InstructionEnd - 1) = (UINT8)PatchValue;
- break;
-
- case 2:
- ASSERT (PatchValue <= MAX_UINT16);
- WriteUnaligned16 ((UINT16 *)(UINTN)InstructionEnd - 1, (UINT16)PatchValue);
- break;
-
- case 4:
- ASSERT (PatchValue <= MAX_UINT32);
- WriteUnaligned32 ((UINT32 *)(UINTN)InstructionEnd - 1, (UINT32)PatchValue);
- break;
-
- case 8:
- WriteUnaligned64 ((UINT64 *)(UINTN)InstructionEnd - 1, PatchValue);
- break;
-
- default:
- ASSERT (FALSE);
+ case 1:
+ ASSERT (PatchValue <= MAX_UINT8);
+ *((UINT8 *)(UINTN)InstructionEnd - 1) = (UINT8)PatchValue;
+ break;
+
+ case 2:
+ ASSERT (PatchValue <= MAX_UINT16);
+ WriteUnaligned16 ((UINT16 *)(UINTN)InstructionEnd - 1, (UINT16)PatchValue);
+ break;
+
+ case 4:
+ ASSERT (PatchValue <= MAX_UINT32);
+ WriteUnaligned32 ((UINT32 *)(UINTN)InstructionEnd - 1, (UINT32)PatchValue);
+ break;
+
+ case 8:
+ WriteUnaligned64 ((UINT64 *)(UINTN)InstructionEnd - 1, PatchValue);
+ break;
+
+ default:
+ ASSERT (FALSE);
}
}
diff --git a/MdePkg/Library/BaseLib/X86RdRand.c b/MdePkg/Library/BaseLib/X86RdRand.c
index dcbd969573..a78e8b177e 100644
--- a/MdePkg/Library/BaseLib/X86RdRand.c
+++ b/MdePkg/Library/BaseLib/X86RdRand.c
@@ -23,7 +23,7 @@
BOOLEAN
EFIAPI
AsmRdRand16 (
- OUT UINT16 *Rand
+ OUT UINT16 *Rand
)
{
ASSERT (Rand != NULL);
@@ -44,7 +44,7 @@ AsmRdRand16 (
BOOLEAN
EFIAPI
AsmRdRand32 (
- OUT UINT32 *Rand
+ OUT UINT32 *Rand
)
{
ASSERT (Rand != NULL);
@@ -65,7 +65,7 @@ AsmRdRand32 (
BOOLEAN
EFIAPI
AsmRdRand64 (
- OUT UINT64 *Rand
+ OUT UINT64 *Rand
)
{
ASSERT (Rand != NULL);
diff --git a/MdePkg/Library/BaseLib/X86ReadGdtr.c b/MdePkg/Library/BaseLib/X86ReadGdtr.c
index ca7c5de6a5..1989cd00ad 100644
--- a/MdePkg/Library/BaseLib/X86ReadGdtr.c
+++ b/MdePkg/Library/BaseLib/X86ReadGdtr.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -25,7 +22,7 @@
VOID
EFIAPI
AsmReadGdtr (
- OUT IA32_DESCRIPTOR *Gdtr
+ OUT IA32_DESCRIPTOR *Gdtr
)
{
ASSERT (Gdtr != NULL);
diff --git a/MdePkg/Library/BaseLib/X86ReadIdtr.c b/MdePkg/Library/BaseLib/X86ReadIdtr.c
index f9133f9aa0..1b61ba243d 100644
--- a/MdePkg/Library/BaseLib/X86ReadIdtr.c
+++ b/MdePkg/Library/BaseLib/X86ReadIdtr.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -25,7 +22,7 @@
VOID
EFIAPI
AsmReadIdtr (
- OUT IA32_DESCRIPTOR *Idtr
+ OUT IA32_DESCRIPTOR *Idtr
)
{
ASSERT (Idtr != NULL);
diff --git a/MdePkg/Library/BaseLib/X86Thunk.c b/MdePkg/Library/BaseLib/X86Thunk.c
index 5c8a039899..9940dca859 100644
--- a/MdePkg/Library/BaseLib/X86Thunk.c
+++ b/MdePkg/Library/BaseLib/X86Thunk.c
@@ -6,15 +6,14 @@
**/
-
#include "BaseLibInternals.h"
-extern CONST UINT8 m16Start;
-extern CONST UINT16 m16Size;
-extern CONST UINT16 mThunk16Attr;
-extern CONST UINT16 m16Gdt;
-extern CONST UINT16 m16GdtrBase;
-extern CONST UINT16 mTransition;
+extern CONST UINT8 m16Start;
+extern CONST UINT16 m16Size;
+extern CONST UINT16 mThunk16Attr;
+extern CONST UINT16 m16Gdt;
+extern CONST UINT16 m16GdtrBase;
+extern CONST UINT16 mTransition;
/**
Invokes 16-bit code in big real mode and returns the updated register set.
@@ -33,8 +32,8 @@ extern CONST UINT16 mTransition;
IA32_REGISTER_SET *
EFIAPI
InternalAsmThunk16 (
- IN IA32_REGISTER_SET *RegisterSet,
- IN OUT VOID *Transition
+ IN IA32_REGISTER_SET *RegisterSet,
+ IN OUT VOID *Transition
);
/**
@@ -61,8 +60,8 @@ InternalAsmThunk16 (
VOID
EFIAPI
AsmGetThunk16Properties (
- OUT UINT32 *RealModeBufferSize,
- OUT UINT32 *ExtraStackSize
+ OUT UINT32 *RealModeBufferSize,
+ OUT UINT32 *ExtraStackSize
)
{
ASSERT (RealModeBufferSize != NULL);
@@ -93,10 +92,10 @@ AsmGetThunk16Properties (
VOID
EFIAPI
AsmPrepareThunk16 (
- IN OUT THUNK_CONTEXT *ThunkContext
+ IN OUT THUNK_CONTEXT *ThunkContext
)
{
- IA32_SEGMENT_DESCRIPTOR *RealModeGdt;
+ IA32_SEGMENT_DESCRIPTOR *RealModeGdt;
ASSERT (ThunkContext != NULL);
ASSERT ((UINTN)ThunkContext->RealModeBuffer < 0x100000);
@@ -113,8 +112,8 @@ AsmPrepareThunk16 (
// RealModeGdt[2]: Data Segment
// RealModeGdt[3]: Call Gate
//
- RealModeGdt = (IA32_SEGMENT_DESCRIPTOR*)(
- (UINTN)ThunkContext->RealModeBuffer + m16Gdt);
+ RealModeGdt = (IA32_SEGMENT_DESCRIPTOR *)(
+ (UINTN)ThunkContext->RealModeBuffer + m16Gdt);
//
// Update Code & Data Segment Descriptor
@@ -127,7 +126,7 @@ AsmPrepareThunk16 (
//
// Update transition code entry point offset
//
- *(UINT32*)((UINTN)ThunkContext->RealModeBuffer + mTransition) +=
+ *(UINT32 *)((UINTN)ThunkContext->RealModeBuffer + mTransition) +=
(UINT32)(UINTN)ThunkContext->RealModeBuffer & 0xf;
//
@@ -138,20 +137,20 @@ AsmPrepareThunk16 (
// Set segment limits to 64KB
//
RealModeGdt[1].Bits.LimitHigh = 0;
- RealModeGdt[1].Bits.G = 0;
+ RealModeGdt[1].Bits.G = 0;
RealModeGdt[2].Bits.LimitHigh = 0;
- RealModeGdt[2].Bits.G = 0;
+ RealModeGdt[2].Bits.G = 0;
}
//
// Update GDTBASE for this thunk context
//
- *(VOID**)((UINTN)ThunkContext->RealModeBuffer + m16GdtrBase) = RealModeGdt;
+ *(VOID **)((UINTN)ThunkContext->RealModeBuffer + m16GdtrBase) = RealModeGdt;
//
// Update Thunk Attributes
//
- *(UINT32*)((UINTN)ThunkContext->RealModeBuffer + mThunk16Attr) =
+ *(UINT32 *)((UINTN)ThunkContext->RealModeBuffer + mThunk16Attr) =
ThunkContext->ThunkAttributes;
}
@@ -211,17 +210,19 @@ AsmPrepareThunk16 (
VOID
EFIAPI
AsmThunk16 (
- IN OUT THUNK_CONTEXT *ThunkContext
+ IN OUT THUNK_CONTEXT *ThunkContext
)
{
- IA32_REGISTER_SET *UpdatedRegs;
+ IA32_REGISTER_SET *UpdatedRegs;
ASSERT (ThunkContext != NULL);
ASSERT ((UINTN)ThunkContext->RealModeBuffer < 0x100000);
ASSERT (ThunkContext->RealModeBufferSize >= m16Size);
ASSERT ((UINTN)ThunkContext->RealModeBuffer + m16Size <= 0x100000);
- ASSERT (((ThunkContext->ThunkAttributes & (THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 | THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL)) != \
- (THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 | THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL)));
+ ASSERT (
+ ((ThunkContext->ThunkAttributes & (THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 | THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL)) != \
+ (THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 | THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL))
+ );
UpdatedRegs = InternalAsmThunk16 (
ThunkContext->RealModeState,
@@ -254,7 +255,7 @@ AsmThunk16 (
VOID
EFIAPI
AsmPrepareAndThunk16 (
- IN OUT THUNK_CONTEXT *ThunkContext
+ IN OUT THUNK_CONTEXT *ThunkContext
)
{
AsmPrepareThunk16 (ThunkContext);
diff --git a/MdePkg/Library/BaseLib/X86UnitTestHost.c b/MdePkg/Library/BaseLib/X86UnitTestHost.c
index 3730e2fe26..8ba4f54a38 100644
--- a/MdePkg/Library/BaseLib/X86UnitTestHost.c
+++ b/MdePkg/Library/BaseLib/X86UnitTestHost.c
@@ -59,25 +59,29 @@ STATIC IA32_DESCRIPTOR mUnitTestHostBaseLibIdtr;
UINT32
EFIAPI
UnitTestHostBaseLibAsmCpuid (
- IN UINT32 Index,
- OUT UINT32 *Eax OPTIONAL,
- OUT UINT32 *Ebx OPTIONAL,
- OUT UINT32 *Ecx OPTIONAL,
- OUT UINT32 *Edx OPTIONAL
+ IN UINT32 Index,
+ OUT UINT32 *Eax OPTIONAL,
+ OUT UINT32 *Ebx OPTIONAL,
+ OUT UINT32 *Ecx OPTIONAL,
+ OUT UINT32 *Edx OPTIONAL
)
{
if (Eax != NULL) {
*Eax = 0;
}
+
if (Ebx != NULL) {
*Ebx = 0;
}
+
if (Ecx != NULL) {
*Ecx = 0;
}
+
if (Edx != NULL) {
*Edx = 0;
}
+
return Index;
}
@@ -116,26 +120,30 @@ UnitTestHostBaseLibAsmCpuid (
UINT32
EFIAPI
UnitTestHostBaseLibAsmCpuidEx (
- IN UINT32 Index,
- IN UINT32 SubIndex,
- OUT UINT32 *Eax OPTIONAL,
- OUT UINT32 *Ebx OPTIONAL,
- OUT UINT32 *Ecx OPTIONAL,
- OUT UINT32 *Edx OPTIONAL
+ IN UINT32 Index,
+ IN UINT32 SubIndex,
+ OUT UINT32 *Eax OPTIONAL,
+ OUT UINT32 *Ebx OPTIONAL,
+ OUT UINT32 *Ecx OPTIONAL,
+ OUT UINT32 *Edx OPTIONAL
)
{
if (Eax != NULL) {
*Eax = 0;
}
+
if (Ebx != NULL) {
*Ebx = 0;
}
+
if (Ecx != NULL) {
*Ecx = 0;
}
+
if (Edx != NULL) {
*Edx = 0;
}
+
return Index;
}
@@ -186,15 +194,17 @@ UnitTestHostBaseLibAsmEnableCache (
UINT64
EFIAPI
UnitTestHostBaseLibAsmReadMsr64 (
- IN UINT32 Index
+ IN UINT32 Index
)
{
if (Index < 0x1000) {
return mUnitTestHostBaseLibMsr[0][Index];
}
- if (Index >= 0xC0000000 && Index < 0xC0001000) {
+
+ if ((Index >= 0xC0000000) && (Index < 0xC0001000)) {
return mUnitTestHostBaseLibMsr[1][Index];
}
+
return 0;
}
@@ -218,16 +228,18 @@ UnitTestHostBaseLibAsmReadMsr64 (
UINT64
EFIAPI
UnitTestHostBaseLibAsmWriteMsr64 (
- IN UINT32 Index,
- IN UINT64 Value
+ IN UINT32 Index,
+ IN UINT64 Value
)
{
if (Index < 0x1000) {
mUnitTestHostBaseLibMsr[0][Index] = Value;
}
- if (Index >= 0xC0000000 && Index < 0xC0001000) {
+
+ if ((Index >= 0xC0000000) && (Index < 0xC0001000)) {
mUnitTestHostBaseLibMsr[1][Index - 0xC00000000] = Value;
}
+
return Value;
}
@@ -851,7 +863,7 @@ UnitTestHostBaseLibAsmReadTr (
VOID
EFIAPI
UnitTestHostBaseLibAsmReadGdtr (
- OUT IA32_DESCRIPTOR *Gdtr
+ OUT IA32_DESCRIPTOR *Gdtr
)
{
Gdtr = &mUnitTestHostBaseLibGdtr;
@@ -871,7 +883,7 @@ UnitTestHostBaseLibAsmReadGdtr (
VOID
EFIAPI
UnitTestHostBaseLibAsmWriteGdtr (
- IN CONST IA32_DESCRIPTOR *Gdtr
+ IN CONST IA32_DESCRIPTOR *Gdtr
)
{
CopyMem (&mUnitTestHostBaseLibGdtr, Gdtr, sizeof (IA32_DESCRIPTOR));
@@ -891,7 +903,7 @@ UnitTestHostBaseLibAsmWriteGdtr (
VOID
EFIAPI
UnitTestHostBaseLibAsmReadIdtr (
- OUT IA32_DESCRIPTOR *Idtr
+ OUT IA32_DESCRIPTOR *Idtr
)
{
Idtr = &mUnitTestHostBaseLibIdtr;
@@ -911,7 +923,7 @@ UnitTestHostBaseLibAsmReadIdtr (
VOID
EFIAPI
UnitTestHostBaseLibAsmWriteIdtr (
- IN CONST IA32_DESCRIPTOR *Idtr
+ IN CONST IA32_DESCRIPTOR *Idtr
)
{
CopyMem (&mUnitTestHostBaseLibIdtr, Idtr, sizeof (IA32_DESCRIPTOR));
@@ -947,7 +959,7 @@ UnitTestHostBaseLibAsmReadLdtr (
VOID
EFIAPI
UnitTestHostBaseLibAsmWriteLdtr (
- IN UINT16 Ldtr
+ IN UINT16 Ldtr
)
{
mUnitTestHostBaseLibSegment[UNIT_TEST_HOST_BASE_LIB_SEGMENT_LDTR] = Ldtr;
@@ -967,7 +979,7 @@ UnitTestHostBaseLibAsmWriteLdtr (
UINT64
EFIAPI
UnitTestHostBaseLibAsmReadPmc (
- IN UINT32 Index
+ IN UINT32 Index
)
{
return 0;
@@ -992,9 +1004,9 @@ UnitTestHostBaseLibAsmReadPmc (
UINTN
EFIAPI
UnitTestHostBaseLibAsmMonitor (
- IN UINTN Eax,
- IN UINTN Ecx,
- IN UINTN Edx
+ IN UINTN Eax,
+ IN UINTN Ecx,
+ IN UINTN Edx
)
{
return Eax;
@@ -1017,8 +1029,8 @@ UnitTestHostBaseLibAsmMonitor (
UINTN
EFIAPI
UnitTestHostBaseLibAsmMwait (
- IN UINTN Eax,
- IN UINTN Ecx
+ IN UINTN Eax,
+ IN UINTN Ecx
)
{
return Eax;
@@ -1072,7 +1084,7 @@ UnitTestHostBaseLibAsmInvd (
VOID *
EFIAPI
UnitTestHostBaseLibAsmFlushCacheLine (
- IN VOID *LinearAddress
+ IN VOID *LinearAddress
)
{
return LinearAddress;
@@ -1208,11 +1220,11 @@ UnitTestHostBaseLibAsmDisablePaging32 (
VOID
EFIAPI
UnitTestHostBaseLibAsmEnablePaging64 (
- IN UINT16 Cs,
- IN UINT64 EntryPoint,
- IN UINT64 Context1 OPTIONAL,
- IN UINT64 Context2 OPTIONAL,
- IN UINT64 NewStack
+ IN UINT16 Cs,
+ IN UINT64 EntryPoint,
+ IN UINT64 Context1 OPTIONAL,
+ IN UINT64 Context2 OPTIONAL,
+ IN UINT64 NewStack
)
{
SWITCH_STACK_ENTRY_POINT NewEntryPoint;
@@ -1254,11 +1266,11 @@ UnitTestHostBaseLibAsmEnablePaging64 (
VOID
EFIAPI
UnitTestHostBaseLibAsmDisablePaging64 (
- IN UINT16 Cs,
- IN UINT32 EntryPoint,
- IN UINT32 Context1 OPTIONAL,
- IN UINT32 Context2 OPTIONAL,
- IN UINT32 NewStack
+ IN UINT16 Cs,
+ IN UINT32 EntryPoint,
+ IN UINT32 Context1 OPTIONAL,
+ IN UINT32 Context2 OPTIONAL,
+ IN UINT32 NewStack
)
{
SWITCH_STACK_ENTRY_POINT NewEntryPoint;
@@ -1291,8 +1303,8 @@ UnitTestHostBaseLibAsmDisablePaging64 (
VOID
EFIAPI
UnitTestHostBaseLibAsmGetThunk16Properties (
- OUT UINT32 *RealModeBufferSize,
- OUT UINT32 *ExtraStackSize
+ OUT UINT32 *RealModeBufferSize,
+ OUT UINT32 *ExtraStackSize
)
{
*RealModeBufferSize = 0;
@@ -1316,7 +1328,7 @@ UnitTestHostBaseLibAsmGetThunk16Properties (
VOID
EFIAPI
UnitTestHostBaseLibAsmPrepareThunk16 (
- IN OUT THUNK_CONTEXT *ThunkContext
+ IN OUT THUNK_CONTEXT *ThunkContext
)
{
}
@@ -1377,7 +1389,7 @@ UnitTestHostBaseLibAsmPrepareThunk16 (
VOID
EFIAPI
UnitTestHostBaseLibAsmThunk16 (
- IN OUT THUNK_CONTEXT *ThunkContext
+ IN OUT THUNK_CONTEXT *ThunkContext
)
{
}
@@ -1405,7 +1417,7 @@ UnitTestHostBaseLibAsmThunk16 (
VOID
EFIAPI
UnitTestHostBaseLibAsmPrepareAndThunk16 (
- IN OUT THUNK_CONTEXT *ThunkContext
+ IN OUT THUNK_CONTEXT *ThunkContext
)
{
}
@@ -1418,7 +1430,7 @@ UnitTestHostBaseLibAsmPrepareAndThunk16 (
VOID
EFIAPI
UnitTestHostBaseLibAsmWriteTr (
- IN UINT16 Selector
+ IN UINT16 Selector
)
{
mUnitTestHostBaseLibSegment[UNIT_TEST_HOST_BASE_LIB_SEGMENT_TR] = Selector;
@@ -1476,9 +1488,9 @@ UnitTestHostBaseLibAsmLfence (
VOID
EFIAPI
UnitTestHostBaseLibPatchInstructionX86 (
- OUT X86_ASSEMBLY_PATCH_LABEL *InstructionEnd,
- IN UINT64 PatchValue,
- IN UINTN ValueSize
+ OUT X86_ASSEMBLY_PATCH_LABEL *InstructionEnd,
+ IN UINT64 PatchValue,
+ IN UINTN ValueSize
)
{
}
@@ -1511,11 +1523,11 @@ UnitTestHostBaseLibPatchInstructionX86 (
UINT32
EFIAPI
AsmCpuid (
- IN UINT32 Index,
- OUT UINT32 *Eax OPTIONAL,
- OUT UINT32 *Ebx OPTIONAL,
- OUT UINT32 *Ecx OPTIONAL,
- OUT UINT32 *Edx OPTIONAL
+ IN UINT32 Index,
+ OUT UINT32 *Eax OPTIONAL,
+ OUT UINT32 *Ebx OPTIONAL,
+ OUT UINT32 *Ecx OPTIONAL,
+ OUT UINT32 *Edx OPTIONAL
)
{
return gUnitTestHostBaseLib.X86->AsmCpuid (Index, Eax, Ebx, Ecx, Edx);
@@ -1556,12 +1568,12 @@ AsmCpuid (
UINT32
EFIAPI
AsmCpuidEx (
- IN UINT32 Index,
- IN UINT32 SubIndex,
- OUT UINT32 *Eax OPTIONAL,
- OUT UINT32 *Ebx OPTIONAL,
- OUT UINT32 *Ecx OPTIONAL,
- OUT UINT32 *Edx OPTIONAL
+ IN UINT32 Index,
+ IN UINT32 SubIndex,
+ OUT UINT32 *Eax OPTIONAL,
+ OUT UINT32 *Ebx OPTIONAL,
+ OUT UINT32 *Ecx OPTIONAL,
+ OUT UINT32 *Edx OPTIONAL
)
{
return gUnitTestHostBaseLib.X86->AsmCpuidEx (Index, SubIndex, Eax, Ebx, Ecx, Edx);
@@ -1616,7 +1628,7 @@ AsmEnableCache (
UINT64
EFIAPI
AsmReadMsr64 (
- IN UINT32 Index
+ IN UINT32 Index
)
{
return gUnitTestHostBaseLib.X86->AsmReadMsr64 (Index);
@@ -1642,8 +1654,8 @@ AsmReadMsr64 (
UINT64
EFIAPI
AsmWriteMsr64 (
- IN UINT32 Index,
- IN UINT64 Value
+ IN UINT32 Index,
+ IN UINT64 Value
)
{
return gUnitTestHostBaseLib.X86->AsmWriteMsr64 (Index, Value);
@@ -2257,7 +2269,7 @@ AsmReadTr (
VOID
EFIAPI
AsmReadGdtr (
- OUT IA32_DESCRIPTOR *Gdtr
+ OUT IA32_DESCRIPTOR *Gdtr
)
{
gUnitTestHostBaseLib.X86->AsmReadGdtr (Gdtr);
@@ -2277,7 +2289,7 @@ AsmReadGdtr (
VOID
EFIAPI
AsmWriteGdtr (
- IN CONST IA32_DESCRIPTOR *Gdtr
+ IN CONST IA32_DESCRIPTOR *Gdtr
)
{
gUnitTestHostBaseLib.X86->AsmWriteGdtr (Gdtr);
@@ -2297,7 +2309,7 @@ AsmWriteGdtr (
VOID
EFIAPI
AsmReadIdtr (
- OUT IA32_DESCRIPTOR *Idtr
+ OUT IA32_DESCRIPTOR *Idtr
)
{
gUnitTestHostBaseLib.X86->AsmReadIdtr (Idtr);
@@ -2317,7 +2329,7 @@ AsmReadIdtr (
VOID
EFIAPI
AsmWriteIdtr (
- IN CONST IA32_DESCRIPTOR *Idtr
+ IN CONST IA32_DESCRIPTOR *Idtr
)
{
gUnitTestHostBaseLib.X86->AsmWriteIdtr (Idtr);
@@ -2353,7 +2365,7 @@ AsmReadLdtr (
VOID
EFIAPI
AsmWriteLdtr (
- IN UINT16 Ldtr
+ IN UINT16 Ldtr
)
{
gUnitTestHostBaseLib.X86->AsmWriteLdtr (Ldtr);
@@ -2373,7 +2385,7 @@ AsmWriteLdtr (
UINT64
EFIAPI
AsmReadPmc (
- IN UINT32 Index
+ IN UINT32 Index
)
{
return gUnitTestHostBaseLib.X86->AsmReadPmc (Index);
@@ -2398,9 +2410,9 @@ AsmReadPmc (
UINTN
EFIAPI
AsmMonitor (
- IN UINTN Eax,
- IN UINTN Ecx,
- IN UINTN Edx
+ IN UINTN Eax,
+ IN UINTN Ecx,
+ IN UINTN Edx
)
{
return gUnitTestHostBaseLib.X86->AsmMonitor (Eax, Ecx, Edx);
@@ -2423,8 +2435,8 @@ AsmMonitor (
UINTN
EFIAPI
AsmMwait (
- IN UINTN Eax,
- IN UINTN Ecx
+ IN UINTN Eax,
+ IN UINTN Ecx
)
{
return gUnitTestHostBaseLib.X86->AsmMwait (Eax, Ecx);
@@ -2480,7 +2492,7 @@ AsmInvd (
VOID *
EFIAPI
AsmFlushCacheLine (
- IN VOID *LinearAddress
+ IN VOID *LinearAddress
)
{
return gUnitTestHostBaseLib.X86->AsmFlushCacheLine (LinearAddress);
@@ -2616,11 +2628,11 @@ AsmDisablePaging32 (
VOID
EFIAPI
AsmEnablePaging64 (
- IN UINT16 Cs,
- IN UINT64 EntryPoint,
- IN UINT64 Context1 OPTIONAL,
- IN UINT64 Context2 OPTIONAL,
- IN UINT64 NewStack
+ IN UINT16 Cs,
+ IN UINT64 EntryPoint,
+ IN UINT64 Context1 OPTIONAL,
+ IN UINT64 Context2 OPTIONAL,
+ IN UINT64 NewStack
)
{
gUnitTestHostBaseLib.X86->AsmEnablePaging64 (Cs, EntryPoint, Context1, Context2, NewStack);
@@ -2659,11 +2671,11 @@ AsmEnablePaging64 (
VOID
EFIAPI
AsmDisablePaging64 (
- IN UINT16 Cs,
- IN UINT32 EntryPoint,
- IN UINT32 Context1 OPTIONAL,
- IN UINT32 Context2 OPTIONAL,
- IN UINT32 NewStack
+ IN UINT16 Cs,
+ IN UINT32 EntryPoint,
+ IN UINT32 Context1 OPTIONAL,
+ IN UINT32 Context2 OPTIONAL,
+ IN UINT32 NewStack
)
{
gUnitTestHostBaseLib.X86->AsmDisablePaging64 (Cs, EntryPoint, Context1, Context2, NewStack);
@@ -2693,8 +2705,8 @@ AsmDisablePaging64 (
VOID
EFIAPI
AsmGetThunk16Properties (
- OUT UINT32 *RealModeBufferSize,
- OUT UINT32 *ExtraStackSize
+ OUT UINT32 *RealModeBufferSize,
+ OUT UINT32 *ExtraStackSize
)
{
gUnitTestHostBaseLib.X86->AsmGetThunk16Properties (RealModeBufferSize, ExtraStackSize);
@@ -2717,7 +2729,7 @@ AsmGetThunk16Properties (
VOID
EFIAPI
AsmPrepareThunk16 (
- IN OUT THUNK_CONTEXT *ThunkContext
+ IN OUT THUNK_CONTEXT *ThunkContext
)
{
gUnitTestHostBaseLib.X86->AsmPrepareThunk16 (ThunkContext);
@@ -2779,7 +2791,7 @@ AsmPrepareThunk16 (
VOID
EFIAPI
AsmThunk16 (
- IN OUT THUNK_CONTEXT *ThunkContext
+ IN OUT THUNK_CONTEXT *ThunkContext
)
{
gUnitTestHostBaseLib.X86->AsmThunk16 (ThunkContext);
@@ -2808,7 +2820,7 @@ AsmThunk16 (
VOID
EFIAPI
AsmPrepareAndThunk16 (
- IN OUT THUNK_CONTEXT *ThunkContext
+ IN OUT THUNK_CONTEXT *ThunkContext
)
{
gUnitTestHostBaseLib.X86->AsmPrepareAndThunk16 (ThunkContext);
@@ -2822,7 +2834,7 @@ AsmPrepareAndThunk16 (
VOID
EFIAPI
AsmWriteTr (
- IN UINT16 Selector
+ IN UINT16 Selector
)
{
gUnitTestHostBaseLib.X86->AsmWriteTr (Selector);
@@ -2881,9 +2893,9 @@ AsmLfence (
VOID
EFIAPI
PatchInstructionX86 (
- OUT X86_ASSEMBLY_PATCH_LABEL *InstructionEnd,
- IN UINT64 PatchValue,
- IN UINTN ValueSize
+ OUT X86_ASSEMBLY_PATCH_LABEL *InstructionEnd,
+ IN UINT64 PatchValue,
+ IN UINTN ValueSize
)
{
gUnitTestHostBaseLib.X86->PatchInstructionX86 (InstructionEnd, PatchValue, ValueSize);
diff --git a/MdePkg/Library/BaseLib/X86WriteGdtr.c b/MdePkg/Library/BaseLib/X86WriteGdtr.c
index 1a570e3d9d..07ebb21959 100644
--- a/MdePkg/Library/BaseLib/X86WriteGdtr.c
+++ b/MdePkg/Library/BaseLib/X86WriteGdtr.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -25,7 +22,7 @@
VOID
EFIAPI
AsmWriteGdtr (
- IN CONST IA32_DESCRIPTOR *Gdtr
+ IN CONST IA32_DESCRIPTOR *Gdtr
)
{
ASSERT (Gdtr != NULL);
diff --git a/MdePkg/Library/BaseLib/X86WriteIdtr.c b/MdePkg/Library/BaseLib/X86WriteIdtr.c
index 9ea979b76d..af8f8b3afc 100644
--- a/MdePkg/Library/BaseLib/X86WriteIdtr.c
+++ b/MdePkg/Library/BaseLib/X86WriteIdtr.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -25,7 +22,7 @@
VOID
EFIAPI
AsmWriteIdtr (
- IN CONST IA32_DESCRIPTOR *Idtr
+ IN CONST IA32_DESCRIPTOR *Idtr
)
{
ASSERT (Idtr != NULL);
diff --git a/MdePkg/Library/BaseMemoryLib/CompareMemWrapper.c b/MdePkg/Library/BaseMemoryLib/CompareMemWrapper.c
index 57d82f08ca..0ca0edb69e 100644
--- a/MdePkg/Library/BaseMemoryLib/CompareMemWrapper.c
+++ b/MdePkg/Library/BaseMemoryLib/CompareMemWrapper.c
@@ -48,9 +48,10 @@ CompareMem (
IN UINTN Length
)
{
- if (Length == 0 || DestinationBuffer == SourceBuffer) {
+ if ((Length == 0) || (DestinationBuffer == SourceBuffer)) {
return 0;
}
+
ASSERT (DestinationBuffer != NULL);
ASSERT (SourceBuffer != NULL);
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer));
diff --git a/MdePkg/Library/BaseMemoryLib/CopyMem.c b/MdePkg/Library/BaseMemoryLib/CopyMem.c
index 55e8616c98..929f700747 100644
--- a/MdePkg/Library/BaseMemoryLib/CopyMem.c
+++ b/MdePkg/Library/BaseMemoryLib/CopyMem.c
@@ -11,9 +11,6 @@
**/
-
-
-
#include "MemLibInternals.h"
/**
@@ -29,9 +26,9 @@
VOID *
EFIAPI
InternalMemCopyMem (
- OUT VOID *DestinationBuffer,
- IN CONST VOID *SourceBuffer,
- IN UINTN Length
+ OUT VOID *DestinationBuffer,
+ IN CONST VOID *SourceBuffer,
+ IN UINTN Length
)
{
//
@@ -39,32 +36,32 @@ InternalMemCopyMem (
// volatile to prevent the optimizer from replacing this function with
// the intrinsic memcpy()
//
- volatile UINT8 *Destination8;
- CONST UINT8 *Source8;
- volatile UINT32 *Destination32;
- CONST UINT32 *Source32;
- volatile UINT64 *Destination64;
- CONST UINT64 *Source64;
- UINTN Alignment;
+ volatile UINT8 *Destination8;
+ CONST UINT8 *Source8;
+ volatile UINT32 *Destination32;
+ CONST UINT32 *Source32;
+ volatile UINT64 *Destination64;
+ CONST UINT64 *Source64;
+ UINTN Alignment;
if ((((UINTN)DestinationBuffer & 0x7) == 0) && (((UINTN)SourceBuffer & 0x7) == 0) && (Length >= 8)) {
if (SourceBuffer > DestinationBuffer) {
- Destination64 = (UINT64*)DestinationBuffer;
- Source64 = (CONST UINT64*)SourceBuffer;
+ Destination64 = (UINT64 *)DestinationBuffer;
+ Source64 = (CONST UINT64 *)SourceBuffer;
while (Length >= 8) {
*(Destination64++) = *(Source64++);
- Length -= 8;
+ Length -= 8;
}
// Finish if there are still some bytes to copy
- Destination8 = (UINT8*)Destination64;
- Source8 = (CONST UINT8*)Source64;
+ Destination8 = (UINT8 *)Destination64;
+ Source8 = (CONST UINT8 *)Source64;
while (Length-- != 0) {
*(Destination8++) = *(Source8++);
}
} else if (SourceBuffer < DestinationBuffer) {
- Destination64 = (UINT64*)((UINTN)DestinationBuffer + Length);
- Source64 = (CONST UINT64*)((UINTN)SourceBuffer + Length);
+ Destination64 = (UINT64 *)((UINTN)DestinationBuffer + Length);
+ Source64 = (CONST UINT64 *)((UINTN)SourceBuffer + Length);
// Destination64 and Source64 were aligned on a 64-bit boundary
// but if length is not a multiple of 8 bytes then they won't be
@@ -72,40 +69,41 @@ InternalMemCopyMem (
Alignment = Length & 0x7;
if (Alignment != 0) {
- Destination8 = (UINT8*)Destination64;
- Source8 = (CONST UINT8*)Source64;
+ Destination8 = (UINT8 *)Destination64;
+ Source8 = (CONST UINT8 *)Source64;
while (Alignment-- != 0) {
*(--Destination8) = *(--Source8);
--Length;
}
- Destination64 = (UINT64*)Destination8;
- Source64 = (CONST UINT64*)Source8;
+
+ Destination64 = (UINT64 *)Destination8;
+ Source64 = (CONST UINT64 *)Source8;
}
while (Length > 0) {
*(--Destination64) = *(--Source64);
- Length -= 8;
+ Length -= 8;
}
}
} else if ((((UINTN)DestinationBuffer & 0x3) == 0) && (((UINTN)SourceBuffer & 0x3) == 0) && (Length >= 4)) {
if (SourceBuffer > DestinationBuffer) {
- Destination32 = (UINT32*)DestinationBuffer;
- Source32 = (CONST UINT32*)SourceBuffer;
+ Destination32 = (UINT32 *)DestinationBuffer;
+ Source32 = (CONST UINT32 *)SourceBuffer;
while (Length >= 4) {
*(Destination32++) = *(Source32++);
- Length -= 4;
+ Length -= 4;
}
// Finish if there are still some bytes to copy
- Destination8 = (UINT8*)Destination32;
- Source8 = (CONST UINT8*)Source32;
+ Destination8 = (UINT8 *)Destination32;
+ Source8 = (CONST UINT8 *)Source32;
while (Length-- != 0) {
*(Destination8++) = *(Source8++);
}
} else if (SourceBuffer < DestinationBuffer) {
- Destination32 = (UINT32*)((UINTN)DestinationBuffer + Length);
- Source32 = (CONST UINT32*)((UINTN)SourceBuffer + Length);
+ Destination32 = (UINT32 *)((UINTN)DestinationBuffer + Length);
+ Source32 = (CONST UINT32 *)((UINTN)SourceBuffer + Length);
// Destination32 and Source32 were aligned on a 32-bit boundary
// but if length is not a multiple of 4 bytes then they won't be
@@ -113,36 +111,38 @@ InternalMemCopyMem (
Alignment = Length & 0x3;
if (Alignment != 0) {
- Destination8 = (UINT8*)Destination32;
- Source8 = (CONST UINT8*)Source32;
+ Destination8 = (UINT8 *)Destination32;
+ Source8 = (CONST UINT8 *)Source32;
while (Alignment-- != 0) {
*(--Destination8) = *(--Source8);
--Length;
}
- Destination32 = (UINT32*)Destination8;
- Source32 = (CONST UINT32*)Source8;
+
+ Destination32 = (UINT32 *)Destination8;
+ Source32 = (CONST UINT32 *)Source8;
}
while (Length > 0) {
*(--Destination32) = *(--Source32);
- Length -= 4;
+ Length -= 4;
}
}
} else {
if (SourceBuffer > DestinationBuffer) {
- Destination8 = (UINT8*)DestinationBuffer;
- Source8 = (CONST UINT8*)SourceBuffer;
+ Destination8 = (UINT8 *)DestinationBuffer;
+ Source8 = (CONST UINT8 *)SourceBuffer;
while (Length-- != 0) {
*(Destination8++) = *(Source8++);
}
} else if (SourceBuffer < DestinationBuffer) {
- Destination8 = (UINT8*)DestinationBuffer + (Length - 1);
- Source8 = (CONST UINT8*)SourceBuffer + (Length - 1);
+ Destination8 = (UINT8 *)DestinationBuffer + (Length - 1);
+ Source8 = (CONST UINT8 *)SourceBuffer + (Length - 1);
while (Length-- != 0) {
*(Destination8--) = *(Source8--);
}
}
}
+
return DestinationBuffer;
}
diff --git a/MdePkg/Library/BaseMemoryLib/CopyMemWrapper.c b/MdePkg/Library/BaseMemoryLib/CopyMemWrapper.c
index 1ac5f33f20..c4ef37957d 100644
--- a/MdePkg/Library/BaseMemoryLib/CopyMemWrapper.c
+++ b/MdePkg/Library/BaseMemoryLib/CopyMemWrapper.c
@@ -47,11 +47,13 @@ CopyMem (
if (Length == 0) {
return DestinationBuffer;
}
+
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)SourceBuffer));
if (DestinationBuffer == SourceBuffer) {
return DestinationBuffer;
}
+
return InternalMemCopyMem (DestinationBuffer, SourceBuffer, Length);
}
diff --git a/MdePkg/Library/BaseMemoryLib/MemLibGeneric.c b/MdePkg/Library/BaseMemoryLib/MemLibGeneric.c
index 6a261ae345..086eb2966b 100644
--- a/MdePkg/Library/BaseMemoryLib/MemLibGeneric.c
+++ b/MdePkg/Library/BaseMemoryLib/MemLibGeneric.c
@@ -26,14 +26,15 @@
VOID *
EFIAPI
InternalMemSetMem16 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT16 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT16 Value
)
{
- for (; Length != 0; Length--) {
- ((UINT16*)Buffer)[Length - 1] = Value;
+ for ( ; Length != 0; Length--) {
+ ((UINT16 *)Buffer)[Length - 1] = Value;
}
+
return Buffer;
}
@@ -50,14 +51,15 @@ InternalMemSetMem16 (
VOID *
EFIAPI
InternalMemSetMem32 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT32 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT32 Value
)
{
- for (; Length != 0; Length--) {
- ((UINT32*)Buffer)[Length - 1] = Value;
+ for ( ; Length != 0; Length--) {
+ ((UINT32 *)Buffer)[Length - 1] = Value;
}
+
return Buffer;
}
@@ -74,14 +76,15 @@ InternalMemSetMem32 (
VOID *
EFIAPI
InternalMemSetMem64 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT64 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT64 Value
)
{
- for (; Length != 0; Length--) {
- ((UINT64*)Buffer)[Length - 1] = Value;
+ for ( ; Length != 0; Length--) {
+ ((UINT64 *)Buffer)[Length - 1] = Value;
}
+
return Buffer;
}
@@ -97,8 +100,8 @@ InternalMemSetMem64 (
VOID *
EFIAPI
InternalMemZeroMem (
- OUT VOID *Buffer,
- IN UINTN Length
+ OUT VOID *Buffer,
+ IN UINTN Length
)
{
return InternalMemSetMem (Buffer, Length, 0);
@@ -120,17 +123,19 @@ InternalMemZeroMem (
INTN
EFIAPI
InternalMemCompareMem (
- IN CONST VOID *DestinationBuffer,
- IN CONST VOID *SourceBuffer,
- IN UINTN Length
+ IN CONST VOID *DestinationBuffer,
+ IN CONST VOID *SourceBuffer,
+ IN UINTN Length
)
{
while ((--Length != 0) &&
- (*(INT8*)DestinationBuffer == *(INT8*)SourceBuffer)) {
- DestinationBuffer = (INT8*)DestinationBuffer + 1;
- SourceBuffer = (INT8*)SourceBuffer + 1;
+ (*(INT8 *)DestinationBuffer == *(INT8 *)SourceBuffer))
+ {
+ DestinationBuffer = (INT8 *)DestinationBuffer + 1;
+ SourceBuffer = (INT8 *)SourceBuffer + 1;
}
- return (INTN)*(UINT8*)DestinationBuffer - (INTN)*(UINT8*)SourceBuffer;
+
+ return (INTN)*(UINT8 *)DestinationBuffer - (INTN)*(UINT8 *)SourceBuffer;
}
/**
@@ -147,20 +152,22 @@ InternalMemCompareMem (
CONST VOID *
EFIAPI
InternalMemScanMem8 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT8 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT8 Value
)
{
- CONST UINT8 *Pointer;
+ CONST UINT8 *Pointer;
- Pointer = (CONST UINT8*)Buffer;
+ Pointer = (CONST UINT8 *)Buffer;
do {
if (*Pointer == Value) {
return Pointer;
}
+
++Pointer;
} while (--Length != 0);
+
return NULL;
}
@@ -178,20 +185,22 @@ InternalMemScanMem8 (
CONST VOID *
EFIAPI
InternalMemScanMem16 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT16 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT16 Value
)
{
- CONST UINT16 *Pointer;
+ CONST UINT16 *Pointer;
- Pointer = (CONST UINT16*)Buffer;
+ Pointer = (CONST UINT16 *)Buffer;
do {
if (*Pointer == Value) {
return Pointer;
}
+
++Pointer;
} while (--Length != 0);
+
return NULL;
}
@@ -209,20 +218,22 @@ InternalMemScanMem16 (
CONST VOID *
EFIAPI
InternalMemScanMem32 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT32 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT32 Value
)
{
- CONST UINT32 *Pointer;
+ CONST UINT32 *Pointer;
- Pointer = (CONST UINT32*)Buffer;
+ Pointer = (CONST UINT32 *)Buffer;
do {
if (*Pointer == Value) {
return Pointer;
}
+
++Pointer;
} while (--Length != 0);
+
return NULL;
}
@@ -240,20 +251,22 @@ InternalMemScanMem32 (
CONST VOID *
EFIAPI
InternalMemScanMem64 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT64 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT64 Value
)
{
- CONST UINT64 *Pointer;
+ CONST UINT64 *Pointer;
- Pointer = (CONST UINT64*)Buffer;
+ Pointer = (CONST UINT64 *)Buffer;
do {
if (*Pointer == Value) {
return Pointer;
}
+
++Pointer;
} while (--Length != 0);
+
return NULL;
}
@@ -274,8 +287,8 @@ InternalMemIsZeroBuffer (
IN UINTN Length
)
{
- CONST UINT8 *BufferData;
- UINTN Index;
+ CONST UINT8 *BufferData;
+ UINTN Index;
BufferData = Buffer;
for (Index = 0; Index < Length; Index++) {
@@ -283,5 +296,6 @@ InternalMemIsZeroBuffer (
return FALSE;
}
}
+
return TRUE;
}
diff --git a/MdePkg/Library/BaseMemoryLib/MemLibGuid.c b/MdePkg/Library/BaseMemoryLib/MemLibGuid.c
index e2976dd0c0..b645ca22e3 100644
--- a/MdePkg/Library/BaseMemoryLib/MemLibGuid.c
+++ b/MdePkg/Library/BaseMemoryLib/MemLibGuid.c
@@ -42,12 +42,12 @@ CopyGuid (
)
{
WriteUnaligned64 (
- (UINT64*)DestinationGuid,
- ReadUnaligned64 ((CONST UINT64*)SourceGuid)
+ (UINT64 *)DestinationGuid,
+ ReadUnaligned64 ((CONST UINT64 *)SourceGuid)
);
WriteUnaligned64 (
- (UINT64*)DestinationGuid + 1,
- ReadUnaligned64 ((CONST UINT64*)SourceGuid + 1)
+ (UINT64 *)DestinationGuid + 1,
+ ReadUnaligned64 ((CONST UINT64 *)SourceGuid + 1)
);
return DestinationGuid;
}
@@ -80,12 +80,12 @@ CompareGuid (
UINT64 HighPartOfGuid1;
UINT64 HighPartOfGuid2;
- LowPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1);
- LowPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2);
- HighPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1 + 1);
- HighPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2 + 1);
+ LowPartOfGuid1 = ReadUnaligned64 ((CONST UINT64 *)Guid1);
+ LowPartOfGuid2 = ReadUnaligned64 ((CONST UINT64 *)Guid2);
+ HighPartOfGuid1 = ReadUnaligned64 ((CONST UINT64 *)Guid1 + 1);
+ HighPartOfGuid2 = ReadUnaligned64 ((CONST UINT64 *)Guid2 + 1);
- return (BOOLEAN) (LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2);
+ return (BOOLEAN)(LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2);
}
/**
@@ -118,20 +118,22 @@ ScanGuid (
IN CONST GUID *Guid
)
{
- CONST GUID *GuidPtr;
+ CONST GUID *GuidPtr;
ASSERT (((UINTN)Buffer & (sizeof (Guid->Data1) - 1)) == 0);
ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1));
ASSERT ((Length & (sizeof (*GuidPtr) - 1)) == 0);
- GuidPtr = (GUID*)Buffer;
+ GuidPtr = (GUID *)Buffer;
Buffer = GuidPtr + Length / sizeof (*GuidPtr);
- while (GuidPtr < (CONST GUID*)Buffer) {
+ while (GuidPtr < (CONST GUID *)Buffer) {
if (CompareGuid (GuidPtr, Guid)) {
- return (VOID*)GuidPtr;
+ return (VOID *)GuidPtr;
}
+
GuidPtr++;
}
+
return NULL;
}
@@ -158,8 +160,8 @@ IsZeroGuid (
UINT64 LowPartOfGuid;
UINT64 HighPartOfGuid;
- LowPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid);
- HighPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid + 1);
+ LowPartOfGuid = ReadUnaligned64 ((CONST UINT64 *)Guid);
+ HighPartOfGuid = ReadUnaligned64 ((CONST UINT64 *)Guid + 1);
- return (BOOLEAN) (LowPartOfGuid == 0 && HighPartOfGuid == 0);
+ return (BOOLEAN)(LowPartOfGuid == 0 && HighPartOfGuid == 0);
}
diff --git a/MdePkg/Library/BaseMemoryLib/MemLibInternals.h b/MdePkg/Library/BaseMemoryLib/MemLibInternals.h
index 9d3730aff4..a39c37c833 100644
--- a/MdePkg/Library/BaseMemoryLib/MemLibInternals.h
+++ b/MdePkg/Library/BaseMemoryLib/MemLibInternals.h
@@ -35,9 +35,9 @@
VOID *
EFIAPI
InternalMemCopyMem (
- OUT VOID *DestinationBuffer,
- IN CONST VOID *SourceBuffer,
- IN UINTN Length
+ OUT VOID *DestinationBuffer,
+ IN CONST VOID *SourceBuffer,
+ IN UINTN Length
);
/**
@@ -53,9 +53,9 @@ InternalMemCopyMem (
VOID *
EFIAPI
InternalMemSetMem (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT8 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT8 Value
);
/**
@@ -71,9 +71,9 @@ InternalMemSetMem (
VOID *
EFIAPI
InternalMemSetMem16 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT16 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT16 Value
);
/**
@@ -89,9 +89,9 @@ InternalMemSetMem16 (
VOID *
EFIAPI
InternalMemSetMem32 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT32 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT32 Value
);
/**
@@ -107,9 +107,9 @@ InternalMemSetMem32 (
VOID *
EFIAPI
InternalMemSetMem64 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT64 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT64 Value
);
/**
@@ -124,8 +124,8 @@ InternalMemSetMem64 (
VOID *
EFIAPI
InternalMemZeroMem (
- OUT VOID *Buffer,
- IN UINTN Length
+ OUT VOID *Buffer,
+ IN UINTN Length
);
/**
@@ -144,9 +144,9 @@ InternalMemZeroMem (
INTN
EFIAPI
InternalMemCompareMem (
- IN CONST VOID *DestinationBuffer,
- IN CONST VOID *SourceBuffer,
- IN UINTN Length
+ IN CONST VOID *DestinationBuffer,
+ IN CONST VOID *SourceBuffer,
+ IN UINTN Length
);
/**
@@ -163,9 +163,9 @@ InternalMemCompareMem (
CONST VOID *
EFIAPI
InternalMemScanMem8 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT8 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT8 Value
);
/**
@@ -182,9 +182,9 @@ InternalMemScanMem8 (
CONST VOID *
EFIAPI
InternalMemScanMem16 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT16 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT16 Value
);
/**
@@ -201,9 +201,9 @@ InternalMemScanMem16 (
CONST VOID *
EFIAPI
InternalMemScanMem32 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT32 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT32 Value
);
/**
@@ -220,9 +220,9 @@ InternalMemScanMem32 (
CONST VOID *
EFIAPI
InternalMemScanMem64 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT64 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT64 Value
);
/**
diff --git a/MdePkg/Library/BaseMemoryLib/ScanMem16Wrapper.c b/MdePkg/Library/BaseMemoryLib/ScanMem16Wrapper.c
index 8201313523..7eeb1a48be 100644
--- a/MdePkg/Library/BaseMemoryLib/ScanMem16Wrapper.c
+++ b/MdePkg/Library/BaseMemoryLib/ScanMem16Wrapper.c
@@ -57,5 +57,5 @@ ScanMem16 (
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
- return (VOID*)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value);
+ return (VOID *)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value);
}
diff --git a/MdePkg/Library/BaseMemoryLib/ScanMem32Wrapper.c b/MdePkg/Library/BaseMemoryLib/ScanMem32Wrapper.c
index 22c0c79ff6..bdcee0e2eb 100644
--- a/MdePkg/Library/BaseMemoryLib/ScanMem32Wrapper.c
+++ b/MdePkg/Library/BaseMemoryLib/ScanMem32Wrapper.c
@@ -56,5 +56,5 @@ ScanMem32 (
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
- return (VOID*)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value);
+ return (VOID *)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value);
}
diff --git a/MdePkg/Library/BaseMemoryLib/ScanMem64Wrapper.c b/MdePkg/Library/BaseMemoryLib/ScanMem64Wrapper.c
index a617d870a0..eb75390d24 100644
--- a/MdePkg/Library/BaseMemoryLib/ScanMem64Wrapper.c
+++ b/MdePkg/Library/BaseMemoryLib/ScanMem64Wrapper.c
@@ -57,5 +57,5 @@ ScanMem64 (
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
- return (VOID*)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value);
+ return (VOID *)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value);
}
diff --git a/MdePkg/Library/BaseMemoryLib/ScanMem8Wrapper.c b/MdePkg/Library/BaseMemoryLib/ScanMem8Wrapper.c
index fb2c5a4e0a..f54e53338e 100644
--- a/MdePkg/Library/BaseMemoryLib/ScanMem8Wrapper.c
+++ b/MdePkg/Library/BaseMemoryLib/ScanMem8Wrapper.c
@@ -49,10 +49,11 @@ ScanMem8 (
if (Length == 0) {
return NULL;
}
+
ASSERT (Buffer != NULL);
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
- return (VOID*)InternalMemScanMem8 (Buffer, Length, Value);
+ return (VOID *)InternalMemScanMem8 (Buffer, Length, Value);
}
/**
@@ -90,4 +91,3 @@ ScanMemN (
return ScanMem32 (Buffer, Length, (UINT32)Value);
}
}
-
diff --git a/MdePkg/Library/BaseMemoryLib/SetMem.c b/MdePkg/Library/BaseMemoryLib/SetMem.c
index d42abb1287..c079d75a18 100644
--- a/MdePkg/Library/BaseMemoryLib/SetMem.c
+++ b/MdePkg/Library/BaseMemoryLib/SetMem.c
@@ -12,9 +12,6 @@
**/
-
-
-
#include "MemLibInternals.h"
/**
@@ -30,9 +27,9 @@
VOID *
EFIAPI
InternalMemSetMem (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT8 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT8 Value
)
{
//
@@ -40,42 +37,44 @@ InternalMemSetMem (
// volatile to prevent the optimizer from replacing this function with
// the intrinsic memset()
//
- volatile UINT8 *Pointer8;
- volatile UINT32 *Pointer32;
- volatile UINT64 *Pointer64;
- UINT32 Value32;
- UINT64 Value64;
+ volatile UINT8 *Pointer8;
+ volatile UINT32 *Pointer32;
+ volatile UINT64 *Pointer64;
+ UINT32 Value32;
+ UINT64 Value64;
if ((((UINTN)Buffer & 0x7) == 0) && (Length >= 8)) {
// Generate the 64bit value
Value32 = (Value << 24) | (Value << 16) | (Value << 8) | Value;
Value64 = LShiftU64 (Value32, 32) | Value32;
- Pointer64 = (UINT64*)Buffer;
+ Pointer64 = (UINT64 *)Buffer;
while (Length >= 8) {
*(Pointer64++) = Value64;
- Length -= 8;
+ Length -= 8;
}
// Finish with bytes if needed
- Pointer8 = (UINT8*)Pointer64;
+ Pointer8 = (UINT8 *)Pointer64;
} else if ((((UINTN)Buffer & 0x3) == 0) && (Length >= 4)) {
// Generate the 32bit value
Value32 = (Value << 24) | (Value << 16) | (Value << 8) | Value;
- Pointer32 = (UINT32*)Buffer;
+ Pointer32 = (UINT32 *)Buffer;
while (Length >= 4) {
*(Pointer32++) = Value32;
- Length -= 4;
+ Length -= 4;
}
// Finish with bytes if needed
- Pointer8 = (UINT8*)Pointer32;
+ Pointer8 = (UINT8 *)Pointer32;
} else {
- Pointer8 = (UINT8*)Buffer;
+ Pointer8 = (UINT8 *)Buffer;
}
+
while (Length-- > 0) {
*(Pointer8++) = Value;
}
+
return Buffer;
}
diff --git a/MdePkg/Library/BaseMemoryLibMmx/CompareMemWrapper.c b/MdePkg/Library/BaseMemoryLibMmx/CompareMemWrapper.c
index 6c539a685e..5b65a1d264 100644
--- a/MdePkg/Library/BaseMemoryLibMmx/CompareMemWrapper.c
+++ b/MdePkg/Library/BaseMemoryLibMmx/CompareMemWrapper.c
@@ -48,9 +48,10 @@ CompareMem (
IN UINTN Length
)
{
- if (Length == 0 || DestinationBuffer == SourceBuffer) {
+ if ((Length == 0) || (DestinationBuffer == SourceBuffer)) {
return 0;
}
+
ASSERT (DestinationBuffer != NULL);
ASSERT (SourceBuffer != NULL);
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer));
diff --git a/MdePkg/Library/BaseMemoryLibMmx/CopyMemWrapper.c b/MdePkg/Library/BaseMemoryLibMmx/CopyMemWrapper.c
index 438abf4e86..dc48904766 100644
--- a/MdePkg/Library/BaseMemoryLibMmx/CopyMemWrapper.c
+++ b/MdePkg/Library/BaseMemoryLibMmx/CopyMemWrapper.c
@@ -47,11 +47,13 @@ CopyMem (
if (Length == 0) {
return DestinationBuffer;
}
+
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)SourceBuffer));
if (DestinationBuffer == SourceBuffer) {
return DestinationBuffer;
}
+
return InternalMemCopyMem (DestinationBuffer, SourceBuffer, Length);
}
diff --git a/MdePkg/Library/BaseMemoryLibMmx/MemLibGuid.c b/MdePkg/Library/BaseMemoryLibMmx/MemLibGuid.c
index 319487dda9..9ded5ca0f1 100644
--- a/MdePkg/Library/BaseMemoryLibMmx/MemLibGuid.c
+++ b/MdePkg/Library/BaseMemoryLibMmx/MemLibGuid.c
@@ -42,12 +42,12 @@ CopyGuid (
)
{
WriteUnaligned64 (
- (UINT64*)DestinationGuid,
- ReadUnaligned64 ((CONST UINT64*)SourceGuid)
+ (UINT64 *)DestinationGuid,
+ ReadUnaligned64 ((CONST UINT64 *)SourceGuid)
);
WriteUnaligned64 (
- (UINT64*)DestinationGuid + 1,
- ReadUnaligned64 ((CONST UINT64*)SourceGuid + 1)
+ (UINT64 *)DestinationGuid + 1,
+ ReadUnaligned64 ((CONST UINT64 *)SourceGuid + 1)
);
return DestinationGuid;
}
@@ -80,12 +80,12 @@ CompareGuid (
UINT64 HighPartOfGuid1;
UINT64 HighPartOfGuid2;
- LowPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1);
- LowPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2);
- HighPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1 + 1);
- HighPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2 + 1);
+ LowPartOfGuid1 = ReadUnaligned64 ((CONST UINT64 *)Guid1);
+ LowPartOfGuid2 = ReadUnaligned64 ((CONST UINT64 *)Guid2);
+ HighPartOfGuid1 = ReadUnaligned64 ((CONST UINT64 *)Guid1 + 1);
+ HighPartOfGuid2 = ReadUnaligned64 ((CONST UINT64 *)Guid2 + 1);
- return (BOOLEAN) (LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2);
+ return (BOOLEAN)(LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2);
}
/**
@@ -118,20 +118,22 @@ ScanGuid (
IN CONST GUID *Guid
)
{
- CONST GUID *GuidPtr;
+ CONST GUID *GuidPtr;
ASSERT (((UINTN)Buffer & (sizeof (Guid->Data1) - 1)) == 0);
ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1));
ASSERT ((Length & (sizeof (*GuidPtr) - 1)) == 0);
- GuidPtr = (GUID*)Buffer;
+ GuidPtr = (GUID *)Buffer;
Buffer = GuidPtr + Length / sizeof (*GuidPtr);
- while (GuidPtr < (CONST GUID*)Buffer) {
+ while (GuidPtr < (CONST GUID *)Buffer) {
if (CompareGuid (GuidPtr, Guid)) {
- return (VOID*)GuidPtr;
+ return (VOID *)GuidPtr;
}
+
GuidPtr++;
}
+
return NULL;
}
@@ -158,8 +160,8 @@ IsZeroGuid (
UINT64 LowPartOfGuid;
UINT64 HighPartOfGuid;
- LowPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid);
- HighPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid + 1);
+ LowPartOfGuid = ReadUnaligned64 ((CONST UINT64 *)Guid);
+ HighPartOfGuid = ReadUnaligned64 ((CONST UINT64 *)Guid + 1);
- return (BOOLEAN) (LowPartOfGuid == 0 && HighPartOfGuid == 0);
+ return (BOOLEAN)(LowPartOfGuid == 0 && HighPartOfGuid == 0);
}
diff --git a/MdePkg/Library/BaseMemoryLibMmx/MemLibInternals.h b/MdePkg/Library/BaseMemoryLibMmx/MemLibInternals.h
index ae3dbaadcf..30745dd4c6 100644
--- a/MdePkg/Library/BaseMemoryLibMmx/MemLibInternals.h
+++ b/MdePkg/Library/BaseMemoryLibMmx/MemLibInternals.h
@@ -35,9 +35,9 @@
VOID *
EFIAPI
InternalMemCopyMem (
- OUT VOID *DestinationBuffer,
- IN CONST VOID *SourceBuffer,
- IN UINTN Length
+ OUT VOID *DestinationBuffer,
+ IN CONST VOID *SourceBuffer,
+ IN UINTN Length
);
/**
@@ -53,9 +53,9 @@ InternalMemCopyMem (
VOID *
EFIAPI
InternalMemSetMem (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT8 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT8 Value
);
/**
@@ -71,9 +71,9 @@ InternalMemSetMem (
VOID *
EFIAPI
InternalMemSetMem16 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT16 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT16 Value
);
/**
@@ -89,9 +89,9 @@ InternalMemSetMem16 (
VOID *
EFIAPI
InternalMemSetMem32 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT32 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT32 Value
);
/**
@@ -107,9 +107,9 @@ InternalMemSetMem32 (
VOID *
EFIAPI
InternalMemSetMem64 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT64 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT64 Value
);
/**
@@ -124,8 +124,8 @@ InternalMemSetMem64 (
VOID *
EFIAPI
InternalMemZeroMem (
- OUT VOID *Buffer,
- IN UINTN Length
+ OUT VOID *Buffer,
+ IN UINTN Length
);
/**
@@ -144,9 +144,9 @@ InternalMemZeroMem (
INTN
EFIAPI
InternalMemCompareMem (
- IN CONST VOID *DestinationBuffer,
- IN CONST VOID *SourceBuffer,
- IN UINTN Length
+ IN CONST VOID *DestinationBuffer,
+ IN CONST VOID *SourceBuffer,
+ IN UINTN Length
);
/**
@@ -163,9 +163,9 @@ InternalMemCompareMem (
CONST VOID *
EFIAPI
InternalMemScanMem8 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT8 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT8 Value
);
/**
@@ -182,9 +182,9 @@ InternalMemScanMem8 (
CONST VOID *
EFIAPI
InternalMemScanMem16 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT16 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT16 Value
);
/**
@@ -201,9 +201,9 @@ InternalMemScanMem16 (
CONST VOID *
EFIAPI
InternalMemScanMem32 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT32 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT32 Value
);
/**
@@ -220,9 +220,9 @@ InternalMemScanMem32 (
CONST VOID *
EFIAPI
InternalMemScanMem64 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT64 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT64 Value
);
/**
diff --git a/MdePkg/Library/BaseMemoryLibMmx/ScanMem16Wrapper.c b/MdePkg/Library/BaseMemoryLibMmx/ScanMem16Wrapper.c
index 8201313523..7eeb1a48be 100644
--- a/MdePkg/Library/BaseMemoryLibMmx/ScanMem16Wrapper.c
+++ b/MdePkg/Library/BaseMemoryLibMmx/ScanMem16Wrapper.c
@@ -57,5 +57,5 @@ ScanMem16 (
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
- return (VOID*)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value);
+ return (VOID *)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value);
}
diff --git a/MdePkg/Library/BaseMemoryLibMmx/ScanMem32Wrapper.c b/MdePkg/Library/BaseMemoryLibMmx/ScanMem32Wrapper.c
index 7b66ccdcb5..99162658ea 100644
--- a/MdePkg/Library/BaseMemoryLibMmx/ScanMem32Wrapper.c
+++ b/MdePkg/Library/BaseMemoryLibMmx/ScanMem32Wrapper.c
@@ -56,5 +56,5 @@ ScanMem32 (
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
- return (VOID*)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value);
+ return (VOID *)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value);
}
diff --git a/MdePkg/Library/BaseMemoryLibMmx/ScanMem64Wrapper.c b/MdePkg/Library/BaseMemoryLibMmx/ScanMem64Wrapper.c
index a617d870a0..eb75390d24 100644
--- a/MdePkg/Library/BaseMemoryLibMmx/ScanMem64Wrapper.c
+++ b/MdePkg/Library/BaseMemoryLibMmx/ScanMem64Wrapper.c
@@ -57,5 +57,5 @@ ScanMem64 (
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
- return (VOID*)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value);
+ return (VOID *)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value);
}
diff --git a/MdePkg/Library/BaseMemoryLibMmx/ScanMem8Wrapper.c b/MdePkg/Library/BaseMemoryLibMmx/ScanMem8Wrapper.c
index f2bf7d6f68..aa0de6442f 100644
--- a/MdePkg/Library/BaseMemoryLibMmx/ScanMem8Wrapper.c
+++ b/MdePkg/Library/BaseMemoryLibMmx/ScanMem8Wrapper.c
@@ -49,10 +49,11 @@ ScanMem8 (
if (Length == 0) {
return NULL;
}
+
ASSERT (Buffer != NULL);
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
- return (VOID*)InternalMemScanMem8 (Buffer, Length, Value);
+ return (VOID *)InternalMemScanMem8 (Buffer, Length, Value);
}
/**
@@ -90,4 +91,3 @@ ScanMemN (
return ScanMem32 (Buffer, Length, (UINT32)Value);
}
}
-
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Arm/MemLibGuid.c b/MdePkg/Library/BaseMemoryLibOptDxe/Arm/MemLibGuid.c
index f27b95c114..32d30cb7ce 100644
--- a/MdePkg/Library/BaseMemoryLibOptDxe/Arm/MemLibGuid.c
+++ b/MdePkg/Library/BaseMemoryLibOptDxe/Arm/MemLibGuid.c
@@ -116,20 +116,22 @@ ScanGuid (
IN CONST GUID *Guid
)
{
- CONST GUID *GuidPtr;
+ CONST GUID *GuidPtr;
ASSERT (((UINTN)Buffer & (sizeof (Guid->Data1) - 1)) == 0);
ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1));
ASSERT ((Length & (sizeof (*GuidPtr) - 1)) == 0);
- GuidPtr = (GUID*)Buffer;
+ GuidPtr = (GUID *)Buffer;
Buffer = GuidPtr + Length / sizeof (*GuidPtr);
- while (GuidPtr < (CONST GUID*)Buffer) {
+ while (GuidPtr < (CONST GUID *)Buffer) {
if (InternalMemCompareGuid (GuidPtr, Guid)) {
- return (VOID*)GuidPtr;
+ return (VOID *)GuidPtr;
}
+
GuidPtr++;
}
+
return NULL;
}
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMemGeneric.c b/MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMemGeneric.c
index e0b4f27079..173782ec3d 100644
--- a/MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMemGeneric.c
+++ b/MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMemGeneric.c
@@ -27,20 +27,22 @@
CONST VOID *
EFIAPI
InternalMemScanMem16 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT16 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT16 Value
)
{
- CONST UINT16 *Pointer;
+ CONST UINT16 *Pointer;
- Pointer = (CONST UINT16*)Buffer;
+ Pointer = (CONST UINT16 *)Buffer;
do {
if (*Pointer == Value) {
return Pointer;
}
+
++Pointer;
} while (--Length != 0);
+
return NULL;
}
@@ -58,20 +60,22 @@ InternalMemScanMem16 (
CONST VOID *
EFIAPI
InternalMemScanMem32 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT32 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT32 Value
)
{
- CONST UINT32 *Pointer;
+ CONST UINT32 *Pointer;
- Pointer = (CONST UINT32*)Buffer;
+ Pointer = (CONST UINT32 *)Buffer;
do {
if (*Pointer == Value) {
return Pointer;
}
+
++Pointer;
} while (--Length != 0);
+
return NULL;
}
@@ -89,20 +93,22 @@ InternalMemScanMem32 (
CONST VOID *
EFIAPI
InternalMemScanMem64 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT64 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT64 Value
)
{
- CONST UINT64 *Pointer;
+ CONST UINT64 *Pointer;
- Pointer = (CONST UINT64*)Buffer;
+ Pointer = (CONST UINT64 *)Buffer;
do {
if (*Pointer == Value) {
return Pointer;
}
+
++Pointer;
} while (--Length != 0);
+
return NULL;
}
@@ -123,8 +129,8 @@ InternalMemIsZeroBuffer (
IN UINTN Length
)
{
- CONST UINT8 *BufferData;
- UINTN Index;
+ CONST UINT8 *BufferData;
+ UINTN Index;
BufferData = Buffer;
for (Index = 0; Index < Length; Index++) {
@@ -132,5 +138,6 @@ InternalMemIsZeroBuffer (
return FALSE;
}
}
+
return TRUE;
}
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/CompareMemWrapper.c b/MdePkg/Library/BaseMemoryLibOptDxe/CompareMemWrapper.c
index 6c539a685e..5b65a1d264 100644
--- a/MdePkg/Library/BaseMemoryLibOptDxe/CompareMemWrapper.c
+++ b/MdePkg/Library/BaseMemoryLibOptDxe/CompareMemWrapper.c
@@ -48,9 +48,10 @@ CompareMem (
IN UINTN Length
)
{
- if (Length == 0 || DestinationBuffer == SourceBuffer) {
+ if ((Length == 0) || (DestinationBuffer == SourceBuffer)) {
return 0;
}
+
ASSERT (DestinationBuffer != NULL);
ASSERT (SourceBuffer != NULL);
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer));
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/CopyMemWrapper.c b/MdePkg/Library/BaseMemoryLibOptDxe/CopyMemWrapper.c
index 438abf4e86..dc48904766 100644
--- a/MdePkg/Library/BaseMemoryLibOptDxe/CopyMemWrapper.c
+++ b/MdePkg/Library/BaseMemoryLibOptDxe/CopyMemWrapper.c
@@ -47,11 +47,13 @@ CopyMem (
if (Length == 0) {
return DestinationBuffer;
}
+
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)SourceBuffer));
if (DestinationBuffer == SourceBuffer) {
return DestinationBuffer;
}
+
return InternalMemCopyMem (DestinationBuffer, SourceBuffer, Length);
}
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/MemLibGuid.c b/MdePkg/Library/BaseMemoryLibOptDxe/MemLibGuid.c
index 319487dda9..9ded5ca0f1 100644
--- a/MdePkg/Library/BaseMemoryLibOptDxe/MemLibGuid.c
+++ b/MdePkg/Library/BaseMemoryLibOptDxe/MemLibGuid.c
@@ -42,12 +42,12 @@ CopyGuid (
)
{
WriteUnaligned64 (
- (UINT64*)DestinationGuid,
- ReadUnaligned64 ((CONST UINT64*)SourceGuid)
+ (UINT64 *)DestinationGuid,
+ ReadUnaligned64 ((CONST UINT64 *)SourceGuid)
);
WriteUnaligned64 (
- (UINT64*)DestinationGuid + 1,
- ReadUnaligned64 ((CONST UINT64*)SourceGuid + 1)
+ (UINT64 *)DestinationGuid + 1,
+ ReadUnaligned64 ((CONST UINT64 *)SourceGuid + 1)
);
return DestinationGuid;
}
@@ -80,12 +80,12 @@ CompareGuid (
UINT64 HighPartOfGuid1;
UINT64 HighPartOfGuid2;
- LowPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1);
- LowPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2);
- HighPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1 + 1);
- HighPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2 + 1);
+ LowPartOfGuid1 = ReadUnaligned64 ((CONST UINT64 *)Guid1);
+ LowPartOfGuid2 = ReadUnaligned64 ((CONST UINT64 *)Guid2);
+ HighPartOfGuid1 = ReadUnaligned64 ((CONST UINT64 *)Guid1 + 1);
+ HighPartOfGuid2 = ReadUnaligned64 ((CONST UINT64 *)Guid2 + 1);
- return (BOOLEAN) (LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2);
+ return (BOOLEAN)(LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2);
}
/**
@@ -118,20 +118,22 @@ ScanGuid (
IN CONST GUID *Guid
)
{
- CONST GUID *GuidPtr;
+ CONST GUID *GuidPtr;
ASSERT (((UINTN)Buffer & (sizeof (Guid->Data1) - 1)) == 0);
ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1));
ASSERT ((Length & (sizeof (*GuidPtr) - 1)) == 0);
- GuidPtr = (GUID*)Buffer;
+ GuidPtr = (GUID *)Buffer;
Buffer = GuidPtr + Length / sizeof (*GuidPtr);
- while (GuidPtr < (CONST GUID*)Buffer) {
+ while (GuidPtr < (CONST GUID *)Buffer) {
if (CompareGuid (GuidPtr, Guid)) {
- return (VOID*)GuidPtr;
+ return (VOID *)GuidPtr;
}
+
GuidPtr++;
}
+
return NULL;
}
@@ -158,8 +160,8 @@ IsZeroGuid (
UINT64 LowPartOfGuid;
UINT64 HighPartOfGuid;
- LowPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid);
- HighPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid + 1);
+ LowPartOfGuid = ReadUnaligned64 ((CONST UINT64 *)Guid);
+ HighPartOfGuid = ReadUnaligned64 ((CONST UINT64 *)Guid + 1);
- return (BOOLEAN) (LowPartOfGuid == 0 && HighPartOfGuid == 0);
+ return (BOOLEAN)(LowPartOfGuid == 0 && HighPartOfGuid == 0);
}
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/MemLibInternals.h b/MdePkg/Library/BaseMemoryLibOptDxe/MemLibInternals.h
index bbd8b63cb8..0c8424c08c 100644
--- a/MdePkg/Library/BaseMemoryLibOptDxe/MemLibInternals.h
+++ b/MdePkg/Library/BaseMemoryLibOptDxe/MemLibInternals.h
@@ -35,9 +35,9 @@
VOID *
EFIAPI
InternalMemCopyMem (
- OUT VOID *DestinationBuffer,
- IN CONST VOID *SourceBuffer,
- IN UINTN Length
+ OUT VOID *DestinationBuffer,
+ IN CONST VOID *SourceBuffer,
+ IN UINTN Length
);
/**
@@ -53,9 +53,9 @@ InternalMemCopyMem (
VOID *
EFIAPI
InternalMemSetMem (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT8 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT8 Value
);
/**
@@ -71,9 +71,9 @@ InternalMemSetMem (
VOID *
EFIAPI
InternalMemSetMem16 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT16 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT16 Value
);
/**
@@ -89,9 +89,9 @@ InternalMemSetMem16 (
VOID *
EFIAPI
InternalMemSetMem32 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT32 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT32 Value
);
/**
@@ -107,9 +107,9 @@ InternalMemSetMem32 (
VOID *
EFIAPI
InternalMemSetMem64 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT64 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT64 Value
);
/**
@@ -124,8 +124,8 @@ InternalMemSetMem64 (
VOID *
EFIAPI
InternalMemZeroMem (
- OUT VOID *Buffer,
- IN UINTN Length
+ OUT VOID *Buffer,
+ IN UINTN Length
);
/**
@@ -144,9 +144,9 @@ InternalMemZeroMem (
INTN
EFIAPI
InternalMemCompareMem (
- IN CONST VOID *DestinationBuffer,
- IN CONST VOID *SourceBuffer,
- IN UINTN Length
+ IN CONST VOID *DestinationBuffer,
+ IN CONST VOID *SourceBuffer,
+ IN UINTN Length
);
/**
@@ -163,9 +163,9 @@ InternalMemCompareMem (
CONST VOID *
EFIAPI
InternalMemScanMem8 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT8 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT8 Value
);
/**
@@ -182,9 +182,9 @@ InternalMemScanMem8 (
CONST VOID *
EFIAPI
InternalMemScanMem16 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT16 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT16 Value
);
/**
@@ -201,9 +201,9 @@ InternalMemScanMem16 (
CONST VOID *
EFIAPI
InternalMemScanMem32 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT32 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT32 Value
);
/**
@@ -220,9 +220,9 @@ InternalMemScanMem32 (
CONST VOID *
EFIAPI
InternalMemScanMem64 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT64 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT64 Value
);
/**
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem16Wrapper.c b/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem16Wrapper.c
index 8201313523..7eeb1a48be 100644
--- a/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem16Wrapper.c
+++ b/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem16Wrapper.c
@@ -57,5 +57,5 @@ ScanMem16 (
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
- return (VOID*)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value);
+ return (VOID *)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value);
}
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem32Wrapper.c b/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem32Wrapper.c
index 22c0c79ff6..bdcee0e2eb 100644
--- a/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem32Wrapper.c
+++ b/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem32Wrapper.c
@@ -56,5 +56,5 @@ ScanMem32 (
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
- return (VOID*)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value);
+ return (VOID *)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value);
}
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem64Wrapper.c b/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem64Wrapper.c
index a617d870a0..eb75390d24 100644
--- a/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem64Wrapper.c
+++ b/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem64Wrapper.c
@@ -57,5 +57,5 @@ ScanMem64 (
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
- return (VOID*)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value);
+ return (VOID *)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value);
}
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem8Wrapper.c b/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem8Wrapper.c
index 6df99e22cb..c4b58cd262 100644
--- a/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem8Wrapper.c
+++ b/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem8Wrapper.c
@@ -49,10 +49,11 @@ ScanMem8 (
if (Length == 0) {
return NULL;
}
+
ASSERT (Buffer != NULL);
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
- return (VOID*)InternalMemScanMem8 (Buffer, Length, Value);
+ return (VOID *)InternalMemScanMem8 (Buffer, Length, Value);
}
/**
@@ -91,4 +92,3 @@ ScanMemN (
return ScanMem32 (Buffer, Length, (UINT32)Value);
}
}
-
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/CompareMemWrapper.c b/MdePkg/Library/BaseMemoryLibOptPei/CompareMemWrapper.c
index 6c539a685e..5b65a1d264 100644
--- a/MdePkg/Library/BaseMemoryLibOptPei/CompareMemWrapper.c
+++ b/MdePkg/Library/BaseMemoryLibOptPei/CompareMemWrapper.c
@@ -48,9 +48,10 @@ CompareMem (
IN UINTN Length
)
{
- if (Length == 0 || DestinationBuffer == SourceBuffer) {
+ if ((Length == 0) || (DestinationBuffer == SourceBuffer)) {
return 0;
}
+
ASSERT (DestinationBuffer != NULL);
ASSERT (SourceBuffer != NULL);
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer));
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/CopyMemWrapper.c b/MdePkg/Library/BaseMemoryLibOptPei/CopyMemWrapper.c
index 438abf4e86..dc48904766 100644
--- a/MdePkg/Library/BaseMemoryLibOptPei/CopyMemWrapper.c
+++ b/MdePkg/Library/BaseMemoryLibOptPei/CopyMemWrapper.c
@@ -47,11 +47,13 @@ CopyMem (
if (Length == 0) {
return DestinationBuffer;
}
+
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)SourceBuffer));
if (DestinationBuffer == SourceBuffer) {
return DestinationBuffer;
}
+
return InternalMemCopyMem (DestinationBuffer, SourceBuffer, Length);
}
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/MemLibGuid.c b/MdePkg/Library/BaseMemoryLibOptPei/MemLibGuid.c
index 319487dda9..9ded5ca0f1 100644
--- a/MdePkg/Library/BaseMemoryLibOptPei/MemLibGuid.c
+++ b/MdePkg/Library/BaseMemoryLibOptPei/MemLibGuid.c
@@ -42,12 +42,12 @@ CopyGuid (
)
{
WriteUnaligned64 (
- (UINT64*)DestinationGuid,
- ReadUnaligned64 ((CONST UINT64*)SourceGuid)
+ (UINT64 *)DestinationGuid,
+ ReadUnaligned64 ((CONST UINT64 *)SourceGuid)
);
WriteUnaligned64 (
- (UINT64*)DestinationGuid + 1,
- ReadUnaligned64 ((CONST UINT64*)SourceGuid + 1)
+ (UINT64 *)DestinationGuid + 1,
+ ReadUnaligned64 ((CONST UINT64 *)SourceGuid + 1)
);
return DestinationGuid;
}
@@ -80,12 +80,12 @@ CompareGuid (
UINT64 HighPartOfGuid1;
UINT64 HighPartOfGuid2;
- LowPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1);
- LowPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2);
- HighPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1 + 1);
- HighPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2 + 1);
+ LowPartOfGuid1 = ReadUnaligned64 ((CONST UINT64 *)Guid1);
+ LowPartOfGuid2 = ReadUnaligned64 ((CONST UINT64 *)Guid2);
+ HighPartOfGuid1 = ReadUnaligned64 ((CONST UINT64 *)Guid1 + 1);
+ HighPartOfGuid2 = ReadUnaligned64 ((CONST UINT64 *)Guid2 + 1);
- return (BOOLEAN) (LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2);
+ return (BOOLEAN)(LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2);
}
/**
@@ -118,20 +118,22 @@ ScanGuid (
IN CONST GUID *Guid
)
{
- CONST GUID *GuidPtr;
+ CONST GUID *GuidPtr;
ASSERT (((UINTN)Buffer & (sizeof (Guid->Data1) - 1)) == 0);
ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1));
ASSERT ((Length & (sizeof (*GuidPtr) - 1)) == 0);
- GuidPtr = (GUID*)Buffer;
+ GuidPtr = (GUID *)Buffer;
Buffer = GuidPtr + Length / sizeof (*GuidPtr);
- while (GuidPtr < (CONST GUID*)Buffer) {
+ while (GuidPtr < (CONST GUID *)Buffer) {
if (CompareGuid (GuidPtr, Guid)) {
- return (VOID*)GuidPtr;
+ return (VOID *)GuidPtr;
}
+
GuidPtr++;
}
+
return NULL;
}
@@ -158,8 +160,8 @@ IsZeroGuid (
UINT64 LowPartOfGuid;
UINT64 HighPartOfGuid;
- LowPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid);
- HighPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid + 1);
+ LowPartOfGuid = ReadUnaligned64 ((CONST UINT64 *)Guid);
+ HighPartOfGuid = ReadUnaligned64 ((CONST UINT64 *)Guid + 1);
- return (BOOLEAN) (LowPartOfGuid == 0 && HighPartOfGuid == 0);
+ return (BOOLEAN)(LowPartOfGuid == 0 && HighPartOfGuid == 0);
}
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/MemLibInternals.h b/MdePkg/Library/BaseMemoryLibOptPei/MemLibInternals.h
index 68cd31626d..3ecbae91ad 100644
--- a/MdePkg/Library/BaseMemoryLibOptPei/MemLibInternals.h
+++ b/MdePkg/Library/BaseMemoryLibOptPei/MemLibInternals.h
@@ -35,9 +35,9 @@
VOID *
EFIAPI
InternalMemCopyMem (
- OUT VOID *DestinationBuffer,
- IN CONST VOID *SourceBuffer,
- IN UINTN Length
+ OUT VOID *DestinationBuffer,
+ IN CONST VOID *SourceBuffer,
+ IN UINTN Length
);
/**
@@ -53,9 +53,9 @@ InternalMemCopyMem (
VOID *
EFIAPI
InternalMemSetMem (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT8 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT8 Value
);
/**
@@ -71,9 +71,9 @@ InternalMemSetMem (
VOID *
EFIAPI
InternalMemSetMem16 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT16 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT16 Value
);
/**
@@ -89,9 +89,9 @@ InternalMemSetMem16 (
VOID *
EFIAPI
InternalMemSetMem32 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT32 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT32 Value
);
/**
@@ -107,9 +107,9 @@ InternalMemSetMem32 (
VOID *
EFIAPI
InternalMemSetMem64 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT64 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT64 Value
);
/**
@@ -124,8 +124,8 @@ InternalMemSetMem64 (
VOID *
EFIAPI
InternalMemZeroMem (
- OUT VOID *Buffer,
- IN UINTN Length
+ OUT VOID *Buffer,
+ IN UINTN Length
);
/**
@@ -144,9 +144,9 @@ InternalMemZeroMem (
INTN
EFIAPI
InternalMemCompareMem (
- IN CONST VOID *DestinationBuffer,
- IN CONST VOID *SourceBuffer,
- IN UINTN Length
+ IN CONST VOID *DestinationBuffer,
+ IN CONST VOID *SourceBuffer,
+ IN UINTN Length
);
/**
@@ -163,9 +163,9 @@ InternalMemCompareMem (
CONST VOID *
EFIAPI
InternalMemScanMem8 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT8 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT8 Value
);
/**
@@ -182,9 +182,9 @@ InternalMemScanMem8 (
CONST VOID *
EFIAPI
InternalMemScanMem16 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT16 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT16 Value
);
/**
@@ -201,9 +201,9 @@ InternalMemScanMem16 (
CONST VOID *
EFIAPI
InternalMemScanMem32 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT32 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT32 Value
);
/**
@@ -220,9 +220,9 @@ InternalMemScanMem32 (
CONST VOID *
EFIAPI
InternalMemScanMem64 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT64 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT64 Value
);
/**
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/ScanMem16Wrapper.c b/MdePkg/Library/BaseMemoryLibOptPei/ScanMem16Wrapper.c
index 8201313523..7eeb1a48be 100644
--- a/MdePkg/Library/BaseMemoryLibOptPei/ScanMem16Wrapper.c
+++ b/MdePkg/Library/BaseMemoryLibOptPei/ScanMem16Wrapper.c
@@ -57,5 +57,5 @@ ScanMem16 (
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
- return (VOID*)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value);
+ return (VOID *)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value);
}
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/ScanMem32Wrapper.c b/MdePkg/Library/BaseMemoryLibOptPei/ScanMem32Wrapper.c
index 22c0c79ff6..bdcee0e2eb 100644
--- a/MdePkg/Library/BaseMemoryLibOptPei/ScanMem32Wrapper.c
+++ b/MdePkg/Library/BaseMemoryLibOptPei/ScanMem32Wrapper.c
@@ -56,5 +56,5 @@ ScanMem32 (
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
- return (VOID*)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value);
+ return (VOID *)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value);
}
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/ScanMem64Wrapper.c b/MdePkg/Library/BaseMemoryLibOptPei/ScanMem64Wrapper.c
index a617d870a0..eb75390d24 100644
--- a/MdePkg/Library/BaseMemoryLibOptPei/ScanMem64Wrapper.c
+++ b/MdePkg/Library/BaseMemoryLibOptPei/ScanMem64Wrapper.c
@@ -57,5 +57,5 @@ ScanMem64 (
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
- return (VOID*)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value);
+ return (VOID *)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value);
}
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/ScanMem8Wrapper.c b/MdePkg/Library/BaseMemoryLibOptPei/ScanMem8Wrapper.c
index f2bf7d6f68..aa0de6442f 100644
--- a/MdePkg/Library/BaseMemoryLibOptPei/ScanMem8Wrapper.c
+++ b/MdePkg/Library/BaseMemoryLibOptPei/ScanMem8Wrapper.c
@@ -49,10 +49,11 @@ ScanMem8 (
if (Length == 0) {
return NULL;
}
+
ASSERT (Buffer != NULL);
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
- return (VOID*)InternalMemScanMem8 (Buffer, Length, Value);
+ return (VOID *)InternalMemScanMem8 (Buffer, Length, Value);
}
/**
@@ -90,4 +91,3 @@ ScanMemN (
return ScanMem32 (Buffer, Length, (UINT32)Value);
}
}
-
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/CompareMemWrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/CompareMemWrapper.c
index 6c539a685e..5b65a1d264 100644
--- a/MdePkg/Library/BaseMemoryLibRepStr/CompareMemWrapper.c
+++ b/MdePkg/Library/BaseMemoryLibRepStr/CompareMemWrapper.c
@@ -48,9 +48,10 @@ CompareMem (
IN UINTN Length
)
{
- if (Length == 0 || DestinationBuffer == SourceBuffer) {
+ if ((Length == 0) || (DestinationBuffer == SourceBuffer)) {
return 0;
}
+
ASSERT (DestinationBuffer != NULL);
ASSERT (SourceBuffer != NULL);
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer));
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/CopyMemWrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/CopyMemWrapper.c
index 438abf4e86..dc48904766 100644
--- a/MdePkg/Library/BaseMemoryLibRepStr/CopyMemWrapper.c
+++ b/MdePkg/Library/BaseMemoryLibRepStr/CopyMemWrapper.c
@@ -47,11 +47,13 @@ CopyMem (
if (Length == 0) {
return DestinationBuffer;
}
+
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)SourceBuffer));
if (DestinationBuffer == SourceBuffer) {
return DestinationBuffer;
}
+
return InternalMemCopyMem (DestinationBuffer, SourceBuffer, Length);
}
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/MemLibGuid.c b/MdePkg/Library/BaseMemoryLibRepStr/MemLibGuid.c
index 319487dda9..9ded5ca0f1 100644
--- a/MdePkg/Library/BaseMemoryLibRepStr/MemLibGuid.c
+++ b/MdePkg/Library/BaseMemoryLibRepStr/MemLibGuid.c
@@ -42,12 +42,12 @@ CopyGuid (
)
{
WriteUnaligned64 (
- (UINT64*)DestinationGuid,
- ReadUnaligned64 ((CONST UINT64*)SourceGuid)
+ (UINT64 *)DestinationGuid,
+ ReadUnaligned64 ((CONST UINT64 *)SourceGuid)
);
WriteUnaligned64 (
- (UINT64*)DestinationGuid + 1,
- ReadUnaligned64 ((CONST UINT64*)SourceGuid + 1)
+ (UINT64 *)DestinationGuid + 1,
+ ReadUnaligned64 ((CONST UINT64 *)SourceGuid + 1)
);
return DestinationGuid;
}
@@ -80,12 +80,12 @@ CompareGuid (
UINT64 HighPartOfGuid1;
UINT64 HighPartOfGuid2;
- LowPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1);
- LowPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2);
- HighPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1 + 1);
- HighPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2 + 1);
+ LowPartOfGuid1 = ReadUnaligned64 ((CONST UINT64 *)Guid1);
+ LowPartOfGuid2 = ReadUnaligned64 ((CONST UINT64 *)Guid2);
+ HighPartOfGuid1 = ReadUnaligned64 ((CONST UINT64 *)Guid1 + 1);
+ HighPartOfGuid2 = ReadUnaligned64 ((CONST UINT64 *)Guid2 + 1);
- return (BOOLEAN) (LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2);
+ return (BOOLEAN)(LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2);
}
/**
@@ -118,20 +118,22 @@ ScanGuid (
IN CONST GUID *Guid
)
{
- CONST GUID *GuidPtr;
+ CONST GUID *GuidPtr;
ASSERT (((UINTN)Buffer & (sizeof (Guid->Data1) - 1)) == 0);
ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1));
ASSERT ((Length & (sizeof (*GuidPtr) - 1)) == 0);
- GuidPtr = (GUID*)Buffer;
+ GuidPtr = (GUID *)Buffer;
Buffer = GuidPtr + Length / sizeof (*GuidPtr);
- while (GuidPtr < (CONST GUID*)Buffer) {
+ while (GuidPtr < (CONST GUID *)Buffer) {
if (CompareGuid (GuidPtr, Guid)) {
- return (VOID*)GuidPtr;
+ return (VOID *)GuidPtr;
}
+
GuidPtr++;
}
+
return NULL;
}
@@ -158,8 +160,8 @@ IsZeroGuid (
UINT64 LowPartOfGuid;
UINT64 HighPartOfGuid;
- LowPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid);
- HighPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid + 1);
+ LowPartOfGuid = ReadUnaligned64 ((CONST UINT64 *)Guid);
+ HighPartOfGuid = ReadUnaligned64 ((CONST UINT64 *)Guid + 1);
- return (BOOLEAN) (LowPartOfGuid == 0 && HighPartOfGuid == 0);
+ return (BOOLEAN)(LowPartOfGuid == 0 && HighPartOfGuid == 0);
}
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/MemLibInternals.h b/MdePkg/Library/BaseMemoryLibRepStr/MemLibInternals.h
index 5be42bcb8a..f9784aad02 100644
--- a/MdePkg/Library/BaseMemoryLibRepStr/MemLibInternals.h
+++ b/MdePkg/Library/BaseMemoryLibRepStr/MemLibInternals.h
@@ -35,9 +35,9 @@
VOID *
EFIAPI
InternalMemCopyMem (
- OUT VOID *DestinationBuffer,
- IN CONST VOID *SourceBuffer,
- IN UINTN Length
+ OUT VOID *DestinationBuffer,
+ IN CONST VOID *SourceBuffer,
+ IN UINTN Length
);
/**
@@ -53,9 +53,9 @@ InternalMemCopyMem (
VOID *
EFIAPI
InternalMemSetMem (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT8 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT8 Value
);
/**
@@ -71,9 +71,9 @@ InternalMemSetMem (
VOID *
EFIAPI
InternalMemSetMem16 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT16 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT16 Value
);
/**
@@ -89,9 +89,9 @@ InternalMemSetMem16 (
VOID *
EFIAPI
InternalMemSetMem32 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT32 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT32 Value
);
/**
@@ -107,9 +107,9 @@ InternalMemSetMem32 (
VOID *
EFIAPI
InternalMemSetMem64 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT64 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT64 Value
);
/**
@@ -124,8 +124,8 @@ InternalMemSetMem64 (
VOID *
EFIAPI
InternalMemZeroMem (
- OUT VOID *Buffer,
- IN UINTN Length
+ OUT VOID *Buffer,
+ IN UINTN Length
);
/**
@@ -144,9 +144,9 @@ InternalMemZeroMem (
INTN
EFIAPI
InternalMemCompareMem (
- IN CONST VOID *DestinationBuffer,
- IN CONST VOID *SourceBuffer,
- IN UINTN Length
+ IN CONST VOID *DestinationBuffer,
+ IN CONST VOID *SourceBuffer,
+ IN UINTN Length
);
/**
@@ -163,9 +163,9 @@ InternalMemCompareMem (
CONST VOID *
EFIAPI
InternalMemScanMem8 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT8 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT8 Value
);
/**
@@ -182,9 +182,9 @@ InternalMemScanMem8 (
CONST VOID *
EFIAPI
InternalMemScanMem16 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT16 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT16 Value
);
/**
@@ -201,9 +201,9 @@ InternalMemScanMem16 (
CONST VOID *
EFIAPI
InternalMemScanMem32 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT32 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT32 Value
);
/**
@@ -220,9 +220,9 @@ InternalMemScanMem32 (
CONST VOID *
EFIAPI
InternalMemScanMem64 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT64 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT64 Value
);
/**
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/ScanMem16Wrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/ScanMem16Wrapper.c
index 8201313523..7eeb1a48be 100644
--- a/MdePkg/Library/BaseMemoryLibRepStr/ScanMem16Wrapper.c
+++ b/MdePkg/Library/BaseMemoryLibRepStr/ScanMem16Wrapper.c
@@ -57,5 +57,5 @@ ScanMem16 (
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
- return (VOID*)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value);
+ return (VOID *)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value);
}
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/ScanMem32Wrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/ScanMem32Wrapper.c
index 22c0c79ff6..bdcee0e2eb 100644
--- a/MdePkg/Library/BaseMemoryLibRepStr/ScanMem32Wrapper.c
+++ b/MdePkg/Library/BaseMemoryLibRepStr/ScanMem32Wrapper.c
@@ -56,5 +56,5 @@ ScanMem32 (
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
- return (VOID*)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value);
+ return (VOID *)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value);
}
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/ScanMem64Wrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/ScanMem64Wrapper.c
index a617d870a0..eb75390d24 100644
--- a/MdePkg/Library/BaseMemoryLibRepStr/ScanMem64Wrapper.c
+++ b/MdePkg/Library/BaseMemoryLibRepStr/ScanMem64Wrapper.c
@@ -57,5 +57,5 @@ ScanMem64 (
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
- return (VOID*)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value);
+ return (VOID *)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value);
}
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/ScanMem8Wrapper.c b/MdePkg/Library/BaseMemoryLibRepStr/ScanMem8Wrapper.c
index f2bf7d6f68..aa0de6442f 100644
--- a/MdePkg/Library/BaseMemoryLibRepStr/ScanMem8Wrapper.c
+++ b/MdePkg/Library/BaseMemoryLibRepStr/ScanMem8Wrapper.c
@@ -49,10 +49,11 @@ ScanMem8 (
if (Length == 0) {
return NULL;
}
+
ASSERT (Buffer != NULL);
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
- return (VOID*)InternalMemScanMem8 (Buffer, Length, Value);
+ return (VOID *)InternalMemScanMem8 (Buffer, Length, Value);
}
/**
@@ -90,4 +91,3 @@ ScanMemN (
return ScanMem32 (Buffer, Length, (UINT32)Value);
}
}
-
diff --git a/MdePkg/Library/BaseMemoryLibSse2/CompareMemWrapper.c b/MdePkg/Library/BaseMemoryLibSse2/CompareMemWrapper.c
index 6c539a685e..5b65a1d264 100644
--- a/MdePkg/Library/BaseMemoryLibSse2/CompareMemWrapper.c
+++ b/MdePkg/Library/BaseMemoryLibSse2/CompareMemWrapper.c
@@ -48,9 +48,10 @@ CompareMem (
IN UINTN Length
)
{
- if (Length == 0 || DestinationBuffer == SourceBuffer) {
+ if ((Length == 0) || (DestinationBuffer == SourceBuffer)) {
return 0;
}
+
ASSERT (DestinationBuffer != NULL);
ASSERT (SourceBuffer != NULL);
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer));
diff --git a/MdePkg/Library/BaseMemoryLibSse2/CopyMemWrapper.c b/MdePkg/Library/BaseMemoryLibSse2/CopyMemWrapper.c
index 438abf4e86..dc48904766 100644
--- a/MdePkg/Library/BaseMemoryLibSse2/CopyMemWrapper.c
+++ b/MdePkg/Library/BaseMemoryLibSse2/CopyMemWrapper.c
@@ -47,11 +47,13 @@ CopyMem (
if (Length == 0) {
return DestinationBuffer;
}
+
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)SourceBuffer));
if (DestinationBuffer == SourceBuffer) {
return DestinationBuffer;
}
+
return InternalMemCopyMem (DestinationBuffer, SourceBuffer, Length);
}
diff --git a/MdePkg/Library/BaseMemoryLibSse2/MemLibGuid.c b/MdePkg/Library/BaseMemoryLibSse2/MemLibGuid.c
index 319487dda9..9ded5ca0f1 100644
--- a/MdePkg/Library/BaseMemoryLibSse2/MemLibGuid.c
+++ b/MdePkg/Library/BaseMemoryLibSse2/MemLibGuid.c
@@ -42,12 +42,12 @@ CopyGuid (
)
{
WriteUnaligned64 (
- (UINT64*)DestinationGuid,
- ReadUnaligned64 ((CONST UINT64*)SourceGuid)
+ (UINT64 *)DestinationGuid,
+ ReadUnaligned64 ((CONST UINT64 *)SourceGuid)
);
WriteUnaligned64 (
- (UINT64*)DestinationGuid + 1,
- ReadUnaligned64 ((CONST UINT64*)SourceGuid + 1)
+ (UINT64 *)DestinationGuid + 1,
+ ReadUnaligned64 ((CONST UINT64 *)SourceGuid + 1)
);
return DestinationGuid;
}
@@ -80,12 +80,12 @@ CompareGuid (
UINT64 HighPartOfGuid1;
UINT64 HighPartOfGuid2;
- LowPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1);
- LowPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2);
- HighPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1 + 1);
- HighPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2 + 1);
+ LowPartOfGuid1 = ReadUnaligned64 ((CONST UINT64 *)Guid1);
+ LowPartOfGuid2 = ReadUnaligned64 ((CONST UINT64 *)Guid2);
+ HighPartOfGuid1 = ReadUnaligned64 ((CONST UINT64 *)Guid1 + 1);
+ HighPartOfGuid2 = ReadUnaligned64 ((CONST UINT64 *)Guid2 + 1);
- return (BOOLEAN) (LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2);
+ return (BOOLEAN)(LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2);
}
/**
@@ -118,20 +118,22 @@ ScanGuid (
IN CONST GUID *Guid
)
{
- CONST GUID *GuidPtr;
+ CONST GUID *GuidPtr;
ASSERT (((UINTN)Buffer & (sizeof (Guid->Data1) - 1)) == 0);
ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1));
ASSERT ((Length & (sizeof (*GuidPtr) - 1)) == 0);
- GuidPtr = (GUID*)Buffer;
+ GuidPtr = (GUID *)Buffer;
Buffer = GuidPtr + Length / sizeof (*GuidPtr);
- while (GuidPtr < (CONST GUID*)Buffer) {
+ while (GuidPtr < (CONST GUID *)Buffer) {
if (CompareGuid (GuidPtr, Guid)) {
- return (VOID*)GuidPtr;
+ return (VOID *)GuidPtr;
}
+
GuidPtr++;
}
+
return NULL;
}
@@ -158,8 +160,8 @@ IsZeroGuid (
UINT64 LowPartOfGuid;
UINT64 HighPartOfGuid;
- LowPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid);
- HighPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid + 1);
+ LowPartOfGuid = ReadUnaligned64 ((CONST UINT64 *)Guid);
+ HighPartOfGuid = ReadUnaligned64 ((CONST UINT64 *)Guid + 1);
- return (BOOLEAN) (LowPartOfGuid == 0 && HighPartOfGuid == 0);
+ return (BOOLEAN)(LowPartOfGuid == 0 && HighPartOfGuid == 0);
}
diff --git a/MdePkg/Library/BaseMemoryLibSse2/MemLibInternals.h b/MdePkg/Library/BaseMemoryLibSse2/MemLibInternals.h
index ce376afda9..20131d147a 100644
--- a/MdePkg/Library/BaseMemoryLibSse2/MemLibInternals.h
+++ b/MdePkg/Library/BaseMemoryLibSse2/MemLibInternals.h
@@ -35,9 +35,9 @@
VOID *
EFIAPI
InternalMemCopyMem (
- OUT VOID *DestinationBuffer,
- IN CONST VOID *SourceBuffer,
- IN UINTN Length
+ OUT VOID *DestinationBuffer,
+ IN CONST VOID *SourceBuffer,
+ IN UINTN Length
);
/**
@@ -53,9 +53,9 @@ InternalMemCopyMem (
VOID *
EFIAPI
InternalMemSetMem (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT8 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT8 Value
);
/**
@@ -71,9 +71,9 @@ InternalMemSetMem (
VOID *
EFIAPI
InternalMemSetMem16 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT16 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT16 Value
);
/**
@@ -89,9 +89,9 @@ InternalMemSetMem16 (
VOID *
EFIAPI
InternalMemSetMem32 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT32 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT32 Value
);
/**
@@ -107,9 +107,9 @@ InternalMemSetMem32 (
VOID *
EFIAPI
InternalMemSetMem64 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT64 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT64 Value
);
/**
@@ -124,8 +124,8 @@ InternalMemSetMem64 (
VOID *
EFIAPI
InternalMemZeroMem (
- OUT VOID *Buffer,
- IN UINTN Length
+ OUT VOID *Buffer,
+ IN UINTN Length
);
/**
@@ -144,9 +144,9 @@ InternalMemZeroMem (
INTN
EFIAPI
InternalMemCompareMem (
- IN CONST VOID *DestinationBuffer,
- IN CONST VOID *SourceBuffer,
- IN UINTN Length
+ IN CONST VOID *DestinationBuffer,
+ IN CONST VOID *SourceBuffer,
+ IN UINTN Length
);
/**
@@ -163,9 +163,9 @@ InternalMemCompareMem (
CONST VOID *
EFIAPI
InternalMemScanMem8 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT8 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT8 Value
);
/**
@@ -182,9 +182,9 @@ InternalMemScanMem8 (
CONST VOID *
EFIAPI
InternalMemScanMem16 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT16 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT16 Value
);
/**
@@ -201,9 +201,9 @@ InternalMemScanMem16 (
CONST VOID *
EFIAPI
InternalMemScanMem32 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT32 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT32 Value
);
/**
@@ -220,9 +220,9 @@ InternalMemScanMem32 (
CONST VOID *
EFIAPI
InternalMemScanMem64 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT64 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT64 Value
);
/**
diff --git a/MdePkg/Library/BaseMemoryLibSse2/ScanMem16Wrapper.c b/MdePkg/Library/BaseMemoryLibSse2/ScanMem16Wrapper.c
index 8201313523..7eeb1a48be 100644
--- a/MdePkg/Library/BaseMemoryLibSse2/ScanMem16Wrapper.c
+++ b/MdePkg/Library/BaseMemoryLibSse2/ScanMem16Wrapper.c
@@ -57,5 +57,5 @@ ScanMem16 (
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
- return (VOID*)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value);
+ return (VOID *)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value);
}
diff --git a/MdePkg/Library/BaseMemoryLibSse2/ScanMem32Wrapper.c b/MdePkg/Library/BaseMemoryLibSse2/ScanMem32Wrapper.c
index 22c0c79ff6..bdcee0e2eb 100644
--- a/MdePkg/Library/BaseMemoryLibSse2/ScanMem32Wrapper.c
+++ b/MdePkg/Library/BaseMemoryLibSse2/ScanMem32Wrapper.c
@@ -56,5 +56,5 @@ ScanMem32 (
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
- return (VOID*)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value);
+ return (VOID *)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value);
}
diff --git a/MdePkg/Library/BaseMemoryLibSse2/ScanMem64Wrapper.c b/MdePkg/Library/BaseMemoryLibSse2/ScanMem64Wrapper.c
index a617d870a0..eb75390d24 100644
--- a/MdePkg/Library/BaseMemoryLibSse2/ScanMem64Wrapper.c
+++ b/MdePkg/Library/BaseMemoryLibSse2/ScanMem64Wrapper.c
@@ -57,5 +57,5 @@ ScanMem64 (
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
- return (VOID*)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value);
+ return (VOID *)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value);
}
diff --git a/MdePkg/Library/BaseMemoryLibSse2/ScanMem8Wrapper.c b/MdePkg/Library/BaseMemoryLibSse2/ScanMem8Wrapper.c
index f2bf7d6f68..aa0de6442f 100644
--- a/MdePkg/Library/BaseMemoryLibSse2/ScanMem8Wrapper.c
+++ b/MdePkg/Library/BaseMemoryLibSse2/ScanMem8Wrapper.c
@@ -49,10 +49,11 @@ ScanMem8 (
if (Length == 0) {
return NULL;
}
+
ASSERT (Buffer != NULL);
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
- return (VOID*)InternalMemScanMem8 (Buffer, Length, Value);
+ return (VOID *)InternalMemScanMem8 (Buffer, Length, Value);
}
/**
@@ -90,4 +91,3 @@ ScanMemN (
return ScanMem32 (Buffer, Length, (UINT32)Value);
}
}
-
diff --git a/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c b/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c
index 650a761480..f47301de89 100644
--- a/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c
+++ b/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c
@@ -30,26 +30,25 @@ typedef enum {
// header. Beside completing the types, we introduce typedefs here that reflect
// the implementation closely.
//
-typedef ORDERED_COLLECTION RED_BLACK_TREE;
-typedef ORDERED_COLLECTION_ENTRY RED_BLACK_TREE_NODE;
-typedef ORDERED_COLLECTION_USER_COMPARE RED_BLACK_TREE_USER_COMPARE;
-typedef ORDERED_COLLECTION_KEY_COMPARE RED_BLACK_TREE_KEY_COMPARE;
+typedef ORDERED_COLLECTION RED_BLACK_TREE;
+typedef ORDERED_COLLECTION_ENTRY RED_BLACK_TREE_NODE;
+typedef ORDERED_COLLECTION_USER_COMPARE RED_BLACK_TREE_USER_COMPARE;
+typedef ORDERED_COLLECTION_KEY_COMPARE RED_BLACK_TREE_KEY_COMPARE;
struct ORDERED_COLLECTION {
- RED_BLACK_TREE_NODE *Root;
- RED_BLACK_TREE_USER_COMPARE UserStructCompare;
- RED_BLACK_TREE_KEY_COMPARE KeyCompare;
+ RED_BLACK_TREE_NODE *Root;
+ RED_BLACK_TREE_USER_COMPARE UserStructCompare;
+ RED_BLACK_TREE_KEY_COMPARE KeyCompare;
};
struct ORDERED_COLLECTION_ENTRY {
- VOID *UserStruct;
- RED_BLACK_TREE_NODE *Parent;
- RED_BLACK_TREE_NODE *Left;
- RED_BLACK_TREE_NODE *Right;
- RED_BLACK_TREE_COLOR Color;
+ VOID *UserStruct;
+ RED_BLACK_TREE_NODE *Parent;
+ RED_BLACK_TREE_NODE *Left;
+ RED_BLACK_TREE_NODE *Right;
+ RED_BLACK_TREE_COLOR Color;
};
-
/**
Retrieve the user structure linked by the specified tree node.
@@ -64,7 +63,7 @@ struct ORDERED_COLLECTION_ENTRY {
VOID *
EFIAPI
OrderedCollectionUserStruct (
- IN CONST RED_BLACK_TREE_NODE *Node
+ IN CONST RED_BLACK_TREE_NODE *Node
)
{
return Node->UserStruct;
@@ -83,10 +82,9 @@ OrderedCollectionUserStruct (
**/
VOID
RedBlackTreeValidate (
- IN CONST RED_BLACK_TREE *Tree
+ IN CONST RED_BLACK_TREE *Tree
);
-
/**
Allocate and initialize the RED_BLACK_TREE structure.
@@ -109,11 +107,11 @@ RedBlackTreeValidate (
RED_BLACK_TREE *
EFIAPI
OrderedCollectionInit (
- IN RED_BLACK_TREE_USER_COMPARE UserStructCompare,
- IN RED_BLACK_TREE_KEY_COMPARE KeyCompare
+ IN RED_BLACK_TREE_USER_COMPARE UserStructCompare,
+ IN RED_BLACK_TREE_KEY_COMPARE KeyCompare
)
{
- RED_BLACK_TREE *Tree;
+ RED_BLACK_TREE *Tree;
Tree = AllocatePool (sizeof *Tree);
if (Tree == NULL) {
@@ -127,10 +125,10 @@ OrderedCollectionInit (
if (FeaturePcdGet (PcdValidateOrderedCollection)) {
RedBlackTreeValidate (Tree);
}
+
return Tree;
}
-
/**
Check whether the tree is empty (has no nodes).
@@ -145,13 +143,12 @@ OrderedCollectionInit (
BOOLEAN
EFIAPI
OrderedCollectionIsEmpty (
- IN CONST RED_BLACK_TREE *Tree
+ IN CONST RED_BLACK_TREE *Tree
)
{
return (BOOLEAN)(Tree->Root == NULL);
}
-
/**
Uninitialize and release an empty RED_BLACK_TREE structure.
@@ -167,14 +164,13 @@ OrderedCollectionIsEmpty (
VOID
EFIAPI
OrderedCollectionUninit (
- IN RED_BLACK_TREE *Tree
+ IN RED_BLACK_TREE *Tree
)
{
ASSERT (OrderedCollectionIsEmpty (Tree));
FreePool (Tree);
}
-
/**
Look up the tree node that links the user structure that matches the
specified standalone key.
@@ -195,26 +191,27 @@ OrderedCollectionUninit (
RED_BLACK_TREE_NODE *
EFIAPI
OrderedCollectionFind (
- IN CONST RED_BLACK_TREE *Tree,
- IN CONST VOID *StandaloneKey
+ IN CONST RED_BLACK_TREE *Tree,
+ IN CONST VOID *StandaloneKey
)
{
- RED_BLACK_TREE_NODE *Node;
+ RED_BLACK_TREE_NODE *Node;
Node = Tree->Root;
while (Node != NULL) {
- INTN Result;
+ INTN Result;
Result = Tree->KeyCompare (StandaloneKey, Node->UserStruct);
if (Result == 0) {
break;
}
+
Node = (Result < 0) ? Node->Left : Node->Right;
}
+
return Node;
}
-
/**
Find the tree node of the minimum user structure stored in the tree.
@@ -231,22 +228,23 @@ OrderedCollectionFind (
RED_BLACK_TREE_NODE *
EFIAPI
OrderedCollectionMin (
- IN CONST RED_BLACK_TREE *Tree
+ IN CONST RED_BLACK_TREE *Tree
)
{
- RED_BLACK_TREE_NODE *Node;
+ RED_BLACK_TREE_NODE *Node;
Node = Tree->Root;
if (Node == NULL) {
return NULL;
}
+
while (Node->Left != NULL) {
Node = Node->Left;
}
+
return Node;
}
-
/**
Find the tree node of the maximum user structure stored in the tree.
@@ -263,22 +261,23 @@ OrderedCollectionMin (
RED_BLACK_TREE_NODE *
EFIAPI
OrderedCollectionMax (
- IN CONST RED_BLACK_TREE *Tree
+ IN CONST RED_BLACK_TREE *Tree
)
{
- RED_BLACK_TREE_NODE *Node;
+ RED_BLACK_TREE_NODE *Node;
Node = Tree->Root;
if (Node == NULL) {
return NULL;
}
+
while (Node->Right != NULL) {
Node = Node->Right;
}
+
return Node;
}
-
/**
Get the tree node of the least user structure that is greater than the one
linked by Node.
@@ -296,11 +295,11 @@ OrderedCollectionMax (
RED_BLACK_TREE_NODE *
EFIAPI
OrderedCollectionNext (
- IN CONST RED_BLACK_TREE_NODE *Node
+ IN CONST RED_BLACK_TREE_NODE *Node
)
{
- RED_BLACK_TREE_NODE *Walk;
- CONST RED_BLACK_TREE_NODE *Child;
+ RED_BLACK_TREE_NODE *Walk;
+ CONST RED_BLACK_TREE_NODE *Child;
if (Node == NULL) {
return NULL;
@@ -315,6 +314,7 @@ OrderedCollectionNext (
while (Walk->Left != NULL) {
Walk = Walk->Left;
}
+
return Walk;
}
@@ -323,15 +323,15 @@ OrderedCollectionNext (
// ascending to the left).
//
Child = Node;
- Walk = Child->Parent;
+ Walk = Child->Parent;
while (Walk != NULL && Child == Walk->Right) {
Child = Walk;
- Walk = Child->Parent;
+ Walk = Child->Parent;
}
+
return Walk;
}
-
/**
Get the tree node of the greatest user structure that is less than the one
linked by Node.
@@ -349,11 +349,11 @@ OrderedCollectionNext (
RED_BLACK_TREE_NODE *
EFIAPI
OrderedCollectionPrev (
- IN CONST RED_BLACK_TREE_NODE *Node
+ IN CONST RED_BLACK_TREE_NODE *Node
)
{
- RED_BLACK_TREE_NODE *Walk;
- CONST RED_BLACK_TREE_NODE *Child;
+ RED_BLACK_TREE_NODE *Walk;
+ CONST RED_BLACK_TREE_NODE *Child;
if (Node == NULL) {
return NULL;
@@ -368,6 +368,7 @@ OrderedCollectionPrev (
while (Walk->Right != NULL) {
Walk = Walk->Right;
}
+
return Walk;
}
@@ -376,15 +377,15 @@ OrderedCollectionPrev (
// ascending to the right).
//
Child = Node;
- Walk = Child->Parent;
+ Walk = Child->Parent;
while (Walk != NULL && Child == Walk->Left) {
Child = Walk;
- Walk = Child->Parent;
+ Walk = Child->Parent;
}
+
return Walk;
}
-
/**
Rotate tree nodes around Pivot to the right.
@@ -419,13 +420,13 @@ OrderedCollectionPrev (
**/
VOID
RedBlackTreeRotateRight (
- IN OUT RED_BLACK_TREE_NODE *Pivot,
- OUT RED_BLACK_TREE_NODE **NewRoot
+ IN OUT RED_BLACK_TREE_NODE *Pivot,
+ OUT RED_BLACK_TREE_NODE **NewRoot
)
{
- RED_BLACK_TREE_NODE *Parent;
- RED_BLACK_TREE_NODE *LeftChild;
- RED_BLACK_TREE_NODE *LeftRightChild;
+ RED_BLACK_TREE_NODE *Parent;
+ RED_BLACK_TREE_NODE *LeftChild;
+ RED_BLACK_TREE_NODE *LeftRightChild;
Parent = Pivot->Parent;
LeftChild = Pivot->Left;
@@ -435,6 +436,7 @@ RedBlackTreeRotateRight (
if (LeftRightChild != NULL) {
LeftRightChild->Parent = Pivot;
}
+
LeftChild->Parent = Parent;
if (Parent == NULL) {
*NewRoot = LeftChild;
@@ -445,11 +447,11 @@ RedBlackTreeRotateRight (
Parent->Right = LeftChild;
}
}
+
LeftChild->Right = Pivot;
- Pivot->Parent = LeftChild;
+ Pivot->Parent = LeftChild;
}
-
/**
Rotate tree nodes around Pivot to the left.
@@ -484,13 +486,13 @@ RedBlackTreeRotateRight (
**/
VOID
RedBlackTreeRotateLeft (
- IN OUT RED_BLACK_TREE_NODE *Pivot,
- OUT RED_BLACK_TREE_NODE **NewRoot
+ IN OUT RED_BLACK_TREE_NODE *Pivot,
+ OUT RED_BLACK_TREE_NODE **NewRoot
)
{
- RED_BLACK_TREE_NODE *Parent;
- RED_BLACK_TREE_NODE *RightChild;
- RED_BLACK_TREE_NODE *RightLeftChild;
+ RED_BLACK_TREE_NODE *Parent;
+ RED_BLACK_TREE_NODE *RightChild;
+ RED_BLACK_TREE_NODE *RightLeftChild;
Parent = Pivot->Parent;
RightChild = Pivot->Right;
@@ -500,6 +502,7 @@ RedBlackTreeRotateLeft (
if (RightLeftChild != NULL) {
RightLeftChild->Parent = Pivot;
}
+
RightChild->Parent = Parent;
if (Parent == NULL) {
*NewRoot = RightChild;
@@ -510,11 +513,11 @@ RedBlackTreeRotateLeft (
Parent->Right = RightChild;
}
}
+
RightChild->Left = Pivot;
- Pivot->Parent = RightChild;
+ Pivot->Parent = RightChild;
}
-
/**
Insert (link) a user structure into the tree.
@@ -579,18 +582,18 @@ RedBlackTreeRotateLeft (
RETURN_STATUS
EFIAPI
OrderedCollectionInsert (
- IN OUT RED_BLACK_TREE *Tree,
- OUT RED_BLACK_TREE_NODE **Node OPTIONAL,
- IN VOID *UserStruct
+ IN OUT RED_BLACK_TREE *Tree,
+ OUT RED_BLACK_TREE_NODE **Node OPTIONAL,
+ IN VOID *UserStruct
)
{
- RED_BLACK_TREE_NODE *Tmp;
- RED_BLACK_TREE_NODE *Parent;
- INTN Result;
- RETURN_STATUS Status;
- RED_BLACK_TREE_NODE *NewRoot;
+ RED_BLACK_TREE_NODE *Tmp;
+ RED_BLACK_TREE_NODE *Parent;
+ INTN Result;
+ RETURN_STATUS Status;
+ RED_BLACK_TREE_NODE *NewRoot;
- Tmp = Tree->Root;
+ Tmp = Tree->Root;
Parent = NULL;
Result = 0;
@@ -603,14 +606,16 @@ OrderedCollectionInsert (
if (Result == 0) {
break;
}
+
Parent = Tmp;
- Tmp = (Result < 0) ? Tmp->Left : Tmp->Right;
+ Tmp = (Result < 0) ? Tmp->Left : Tmp->Right;
}
if (Tmp != NULL) {
if (Node != NULL) {
*Node = Tmp;
}
+
Status = RETURN_ALREADY_STARTED;
goto Done;
}
@@ -623,6 +628,7 @@ OrderedCollectionInsert (
Status = RETURN_OUT_OF_RESOURCES;
goto Done;
}
+
if (Node != NULL) {
*Node = Tmp;
}
@@ -637,19 +643,21 @@ OrderedCollectionInsert (
// If there's no parent, the new node is the root node in the tree.
//
Tmp->Parent = Parent;
- Tmp->Left = NULL;
- Tmp->Right = NULL;
+ Tmp->Left = NULL;
+ Tmp->Right = NULL;
if (Parent == NULL) {
Tree->Root = Tmp;
Tmp->Color = RedBlackTreeBlack;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
goto Done;
}
+
if (Result < 0) {
Parent->Left = Tmp;
} else {
Parent->Right = Tmp;
}
+
Tmp->Color = RedBlackTreeRed;
//
@@ -674,8 +682,8 @@ OrderedCollectionInsert (
NewRoot = Tree->Root;
while (Tmp != NewRoot && Parent->Color == RedBlackTreeRed) {
- RED_BLACK_TREE_NODE *GrandParent;
- RED_BLACK_TREE_NODE *Uncle;
+ RED_BLACK_TREE_NODE *GrandParent;
+ RED_BLACK_TREE_NODE *Uncle;
//
// Tmp is not the root node. Tmp is red. Tmp's parent is red. (Breaking
@@ -691,7 +699,7 @@ OrderedCollectionInsert (
if (Parent == GrandParent->Left) {
Uncle = GrandParent->Right;
- if (Uncle != NULL && Uncle->Color == RedBlackTreeRed) {
+ if ((Uncle != NULL) && (Uncle->Color == RedBlackTreeRed)) {
//
// GrandParent (black)
// / \_
@@ -700,8 +708,8 @@ OrderedCollectionInsert (
// Tmp (red)
//
- Parent->Color = RedBlackTreeBlack;
- Uncle->Color = RedBlackTreeBlack;
+ Parent->Color = RedBlackTreeBlack;
+ Uncle->Color = RedBlackTreeBlack;
GrandParent->Color = RedBlackTreeRed;
//
@@ -720,7 +728,7 @@ OrderedCollectionInsert (
// and we will have broken property #5, by coloring the root red. We'll
// restore property #5 after the loop, without breaking any others.
//
- Tmp = GrandParent;
+ Tmp = GrandParent;
Parent = Tmp->Parent;
} else {
//
@@ -759,7 +767,7 @@ OrderedCollectionInsert (
ASSERT (GrandParent == Parent->Parent);
}
- Parent->Color = RedBlackTreeBlack;
+ Parent->Color = RedBlackTreeBlack;
GrandParent->Color = RedBlackTreeRed;
//
@@ -794,12 +802,12 @@ OrderedCollectionInsert (
// Symmetrical to the other branch.
//
Uncle = GrandParent->Left;
- if (Uncle != NULL && Uncle->Color == RedBlackTreeRed) {
- Parent->Color = RedBlackTreeBlack;
- Uncle->Color = RedBlackTreeBlack;
+ if ((Uncle != NULL) && (Uncle->Color == RedBlackTreeRed)) {
+ Parent->Color = RedBlackTreeBlack;
+ Uncle->Color = RedBlackTreeBlack;
GrandParent->Color = RedBlackTreeRed;
- Tmp = GrandParent;
- Parent = Tmp->Parent;
+ Tmp = GrandParent;
+ Parent = Tmp->Parent;
} else {
if (Tmp == Parent->Left) {
Tmp = Parent;
@@ -807,7 +815,8 @@ OrderedCollectionInsert (
Parent = Tmp->Parent;
ASSERT (GrandParent == Parent->Parent);
}
- Parent->Color = RedBlackTreeBlack;
+
+ Parent->Color = RedBlackTreeBlack;
GrandParent->Color = RedBlackTreeRed;
RedBlackTreeRotateLeft (GrandParent, &NewRoot);
}
@@ -815,17 +824,17 @@ OrderedCollectionInsert (
}
NewRoot->Color = RedBlackTreeBlack;
- Tree->Root = NewRoot;
- Status = RETURN_SUCCESS;
+ Tree->Root = NewRoot;
+ Status = RETURN_SUCCESS;
Done:
if (FeaturePcdGet (PcdValidateOrderedCollection)) {
RedBlackTreeValidate (Tree);
}
+
return Status;
}
-
/**
Check if a node is black, allowing for leaf nodes (see property #2).
@@ -837,13 +846,12 @@ Done:
**/
BOOLEAN
NodeIsNullOrBlack (
- IN CONST RED_BLACK_TREE_NODE *Node
+ IN CONST RED_BLACK_TREE_NODE *Node
)
{
return (BOOLEAN)(Node == NULL || Node->Color == RedBlackTreeBlack);
}
-
/**
Delete a node from the tree, unlinking the associated user structure.
@@ -912,18 +920,18 @@ NodeIsNullOrBlack (
VOID
EFIAPI
OrderedCollectionDelete (
- IN OUT RED_BLACK_TREE *Tree,
- IN RED_BLACK_TREE_NODE *Node,
- OUT VOID **UserStruct OPTIONAL
+ IN OUT RED_BLACK_TREE *Tree,
+ IN RED_BLACK_TREE_NODE *Node,
+ OUT VOID **UserStruct OPTIONAL
)
{
- RED_BLACK_TREE_NODE *NewRoot;
- RED_BLACK_TREE_NODE *OrigLeftChild;
- RED_BLACK_TREE_NODE *OrigRightChild;
- RED_BLACK_TREE_NODE *OrigParent;
- RED_BLACK_TREE_NODE *Child;
- RED_BLACK_TREE_NODE *Parent;
- RED_BLACK_TREE_COLOR ColorOfUnlinked;
+ RED_BLACK_TREE_NODE *NewRoot;
+ RED_BLACK_TREE_NODE *OrigLeftChild;
+ RED_BLACK_TREE_NODE *OrigRightChild;
+ RED_BLACK_TREE_NODE *OrigParent;
+ RED_BLACK_TREE_NODE *Child;
+ RED_BLACK_TREE_NODE *Parent;
+ RED_BLACK_TREE_COLOR ColorOfUnlinked;
NewRoot = Tree->Root;
OrigLeftChild = Node->Left,
@@ -941,20 +949,21 @@ OrderedCollectionDelete (
// - Parent will point to the *position* of the original parent of the node
// that we will have unlinked.
//
- if (OrigLeftChild == NULL || OrigRightChild == NULL) {
+ if ((OrigLeftChild == NULL) || (OrigRightChild == NULL)) {
//
// Node has at most one child. We can connect that child (if any) with
// Node's parent (if any), unlinking Node. This will preserve ordering
// because the subtree rooted in Node's child (if any) remains on the same
// side of Node's parent (if any) that Node was before.
//
- Parent = OrigParent;
- Child = (OrigLeftChild != NULL) ? OrigLeftChild : OrigRightChild;
+ Parent = OrigParent;
+ Child = (OrigLeftChild != NULL) ? OrigLeftChild : OrigRightChild;
ColorOfUnlinked = Node->Color;
if (Child != NULL) {
Child->Parent = Parent;
}
+
if (OrigParent == NULL) {
NewRoot = Child;
} else {
@@ -978,7 +987,7 @@ OrderedCollectionDelete (
// of Node's parent as Node itself. The relinking doesn't change this
// relation.
//
- RED_BLACK_TREE_NODE *ToRelink;
+ RED_BLACK_TREE_NODE *ToRelink;
ToRelink = OrigRightChild;
if (ToRelink->Left == NULL) {
@@ -994,7 +1003,7 @@ OrderedCollectionDelete (
// F <--- Child
//
Parent = OrigRightChild;
- Child = OrigRightChild->Right;
+ Child = OrigRightChild->Right;
} else {
do {
ToRelink = ToRelink->Left;
@@ -1013,7 +1022,7 @@ OrderedCollectionDelete (
// \_
// D <--- Child
Parent = ToRelink->Parent;
- Child = ToRelink->Right;
+ Child = ToRelink->Right;
//
// Unlink Node's successor (ie. ToRelink):
@@ -1046,7 +1055,7 @@ OrderedCollectionDelete (
//
//
//
- ToRelink->Right = OrigRightChild;
+ ToRelink->Right = OrigRightChild;
OrigRightChild->Parent = ToRelink;
}
@@ -1066,7 +1075,7 @@ OrderedCollectionDelete (
// | D <--- Child
// Child
//
- ToRelink->Left = OrigLeftChild;
+ ToRelink->Left = OrigLeftChild;
OrigLeftChild->Parent = ToRelink;
//
@@ -1129,9 +1138,9 @@ OrderedCollectionDelete (
// Rotations in the loop preserve property #4.
//
while (Child != NewRoot && NodeIsNullOrBlack (Child)) {
- RED_BLACK_TREE_NODE *Sibling;
- RED_BLACK_TREE_NODE *LeftNephew;
- RED_BLACK_TREE_NODE *RightNephew;
+ RED_BLACK_TREE_NODE *Sibling;
+ RED_BLACK_TREE_NODE *LeftNephew;
+ RED_BLACK_TREE_NODE *RightNephew;
if (Child == Parent->Left) {
Sibling = Parent->Right;
@@ -1163,7 +1172,7 @@ OrderedCollectionDelete (
// b:C b:E Child,2b:A Sibling,b:C
//
Sibling->Color = RedBlackTreeBlack;
- Parent->Color = RedBlackTreeRed;
+ Parent->Color = RedBlackTreeRed;
RedBlackTreeRotateLeft (Parent, &NewRoot);
Sibling = Parent->Right;
//
@@ -1177,10 +1186,11 @@ OrderedCollectionDelete (
// node.)
//
ASSERT (Sibling->Color == RedBlackTreeBlack);
- LeftNephew = Sibling->Left;
+ LeftNephew = Sibling->Left;
RightNephew = Sibling->Right;
if (NodeIsNullOrBlack (LeftNephew) &&
- NodeIsNullOrBlack (RightNephew)) {
+ NodeIsNullOrBlack (RightNephew))
+ {
//
// In this case we can "steal" one black value from Child and Sibling
// each, and pass it to Parent. "Stealing" means that Sibling (black
@@ -1200,8 +1210,8 @@ OrderedCollectionDelete (
// LeftNephew,b:C RightNephew,b:E b:C b:E
//
Sibling->Color = RedBlackTreeRed;
- Child = Parent;
- Parent = Parent->Parent;
+ Child = Parent;
+ Parent = Parent->Parent;
//
// Continue ascending.
//
@@ -1230,14 +1240,15 @@ OrderedCollectionDelete (
// b:C b:E b:E b:G
//
LeftNephew->Color = RedBlackTreeBlack;
- Sibling->Color = RedBlackTreeRed;
+ Sibling->Color = RedBlackTreeRed;
RedBlackTreeRotateRight (Sibling, &NewRoot);
- Sibling = Parent->Right;
+ Sibling = Parent->Right;
RightNephew = Sibling->Right;
//
// These operations ensure that...
//
}
+
//
// ... RightNephew is definitely red here, plus Sibling is (still)
// black and non-NULL.
@@ -1272,8 +1283,8 @@ OrderedCollectionDelete (
// y:C RightNephew,r:E b:A y:C
//
//
- Sibling->Color = Parent->Color;
- Parent->Color = RedBlackTreeBlack;
+ Sibling->Color = Parent->Color;
+ Parent->Color = RedBlackTreeBlack;
RightNephew->Color = RedBlackTreeBlack;
RedBlackTreeRotateLeft (Parent, &NewRoot);
Child = NewRoot;
@@ -1289,7 +1300,7 @@ OrderedCollectionDelete (
ASSERT (Sibling != NULL);
if (Sibling->Color == RedBlackTreeRed) {
Sibling->Color = RedBlackTreeBlack;
- Parent->Color = RedBlackTreeRed;
+ Parent->Color = RedBlackTreeRed;
RedBlackTreeRotateRight (Parent, &NewRoot);
Sibling = Parent->Left;
ASSERT (Sibling != NULL);
@@ -1297,26 +1308,28 @@ OrderedCollectionDelete (
ASSERT (Sibling->Color == RedBlackTreeBlack);
RightNephew = Sibling->Right;
- LeftNephew = Sibling->Left;
+ LeftNephew = Sibling->Left;
if (NodeIsNullOrBlack (RightNephew) &&
- NodeIsNullOrBlack (LeftNephew)) {
+ NodeIsNullOrBlack (LeftNephew))
+ {
Sibling->Color = RedBlackTreeRed;
- Child = Parent;
- Parent = Parent->Parent;
+ Child = Parent;
+ Parent = Parent->Parent;
} else {
if (NodeIsNullOrBlack (LeftNephew)) {
RightNephew->Color = RedBlackTreeBlack;
- Sibling->Color = RedBlackTreeRed;
+ Sibling->Color = RedBlackTreeRed;
RedBlackTreeRotateLeft (Sibling, &NewRoot);
- Sibling = Parent->Left;
+ Sibling = Parent->Left;
LeftNephew = Sibling->Left;
}
+
ASSERT (LeftNephew != NULL);
ASSERT (LeftNephew->Color == RedBlackTreeRed);
ASSERT (Sibling != NULL);
ASSERT (Sibling->Color == RedBlackTreeBlack);
- Sibling->Color = Parent->Color;
- Parent->Color = RedBlackTreeBlack;
+ Sibling->Color = Parent->Color;
+ Parent->Color = RedBlackTreeBlack;
LeftNephew->Color = RedBlackTreeBlack;
RedBlackTreeRotateRight (Parent, &NewRoot);
Child = NewRoot;
@@ -1336,7 +1349,6 @@ OrderedCollectionDelete (
}
}
-
/**
Recursively check the red-black tree properties #1 to #4 on a node.
@@ -1346,11 +1358,11 @@ OrderedCollectionDelete (
**/
UINT32
RedBlackTreeRecursiveCheck (
- IN CONST RED_BLACK_TREE_NODE *Node
+ IN CONST RED_BLACK_TREE_NODE *Node
)
{
- UINT32 LeftHeight;
- UINT32 RightHeight;
+ UINT32 LeftHeight;
+ UINT32 RightHeight;
//
// property #2
@@ -1375,14 +1387,13 @@ RedBlackTreeRecursiveCheck (
//
// property #4
//
- LeftHeight = RedBlackTreeRecursiveCheck (Node->Left);
+ LeftHeight = RedBlackTreeRecursiveCheck (Node->Left);
RightHeight = RedBlackTreeRecursiveCheck (Node->Right);
ASSERT (LeftHeight == RightHeight);
return (Node->Color == RedBlackTreeBlack) + LeftHeight;
}
-
/**
A slow function that asserts that the tree is a valid red-black tree, and
that it orders user structures correctly.
@@ -1396,14 +1407,14 @@ RedBlackTreeRecursiveCheck (
**/
VOID
RedBlackTreeValidate (
- IN CONST RED_BLACK_TREE *Tree
+ IN CONST RED_BLACK_TREE *Tree
)
{
- UINT32 BlackHeight;
- UINT32 ForwardCount;
- UINT32 BackwardCount;
- CONST RED_BLACK_TREE_NODE *Last;
- CONST RED_BLACK_TREE_NODE *Node;
+ UINT32 BlackHeight;
+ UINT32 ForwardCount;
+ UINT32 BackwardCount;
+ CONST RED_BLACK_TREE_NODE *Last;
+ CONST RED_BLACK_TREE_NODE *Node;
DEBUG ((DEBUG_VERBOSE, "%a: Tree=%p\n", __FUNCTION__, Tree));
@@ -1420,10 +1431,11 @@ RedBlackTreeValidate (
//
// forward ordering
//
- Last = OrderedCollectionMin (Tree);
+ Last = OrderedCollectionMin (Tree);
ForwardCount = (Last != NULL);
for (Node = OrderedCollectionNext (Last); Node != NULL;
- Node = OrderedCollectionNext (Last)) {
+ Node = OrderedCollectionNext (Last))
+ {
ASSERT (Tree->UserStructCompare (Last->UserStruct, Node->UserStruct) < 0);
Last = Node;
++ForwardCount;
@@ -1432,10 +1444,11 @@ RedBlackTreeValidate (
//
// backward ordering
//
- Last = OrderedCollectionMax (Tree);
+ Last = OrderedCollectionMax (Tree);
BackwardCount = (Last != NULL);
for (Node = OrderedCollectionPrev (Last); Node != NULL;
- Node = OrderedCollectionPrev (Last)) {
+ Node = OrderedCollectionPrev (Last))
+ {
ASSERT (Tree->UserStructCompare (Last->UserStruct, Node->UserStruct) > 0);
Last = Node;
++BackwardCount;
@@ -1443,6 +1456,12 @@ RedBlackTreeValidate (
ASSERT (ForwardCount == BackwardCount);
- DEBUG ((DEBUG_VERBOSE, "%a: Tree=%p BlackHeight=%Ld Count=%Ld\n",
- __FUNCTION__, Tree, (INT64)BlackHeight, (INT64)ForwardCount));
+ DEBUG ((
+ DEBUG_VERBOSE,
+ "%a: Tree=%p BlackHeight=%Ld Count=%Ld\n",
+ __FUNCTION__,
+ Tree,
+ (INT64)BlackHeight,
+ (INT64)ForwardCount
+ ));
}
diff --git a/MdePkg/Library/BasePcdLibNull/PcdLib.c b/MdePkg/Library/BasePcdLibNull/PcdLib.c
index 7cb3714a89..a214371c3f 100644
--- a/MdePkg/Library/BasePcdLibNull/PcdLib.c
+++ b/MdePkg/Library/BasePcdLibNull/PcdLib.c
@@ -12,7 +12,6 @@
#include <Library/PcdLib.h>
#include <Library/BaseMemoryLib.h>
-
/**
This function provides a means by which SKU support can be established in the PCD infrastructure.
@@ -27,7 +26,7 @@
UINTN
EFIAPI
LibPcdSetSku (
- IN UINTN SkuId
+ IN UINTN SkuId
)
{
ASSERT (FALSE);
@@ -48,7 +47,7 @@ LibPcdSetSku (
UINT8
EFIAPI
LibPcdGet8 (
- IN UINTN TokenNumber
+ IN UINTN TokenNumber
)
{
ASSERT (FALSE);
@@ -56,8 +55,6 @@ LibPcdGet8 (
return 0;
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -71,7 +68,7 @@ LibPcdGet8 (
UINT16
EFIAPI
LibPcdGet16 (
- IN UINTN TokenNumber
+ IN UINTN TokenNumber
)
{
ASSERT (FALSE);
@@ -79,8 +76,6 @@ LibPcdGet16 (
return 0;
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -94,7 +89,7 @@ LibPcdGet16 (
UINT32
EFIAPI
LibPcdGet32 (
- IN UINTN TokenNumber
+ IN UINTN TokenNumber
)
{
ASSERT (FALSE);
@@ -102,8 +97,6 @@ LibPcdGet32 (
return 0;
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -117,7 +110,7 @@ LibPcdGet32 (
UINT64
EFIAPI
LibPcdGet64 (
- IN UINTN TokenNumber
+ IN UINTN TokenNumber
)
{
ASSERT (FALSE);
@@ -125,8 +118,6 @@ LibPcdGet64 (
return 0;
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -140,7 +131,7 @@ LibPcdGet64 (
VOID *
EFIAPI
LibPcdGetPtr (
- IN UINTN TokenNumber
+ IN UINTN TokenNumber
)
{
ASSERT (FALSE);
@@ -148,8 +139,6 @@ LibPcdGetPtr (
return 0;
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -163,7 +152,7 @@ LibPcdGetPtr (
BOOLEAN
EFIAPI
LibPcdGetBool (
- IN UINTN TokenNumber
+ IN UINTN TokenNumber
)
{
ASSERT (FALSE);
@@ -171,8 +160,6 @@ LibPcdGetBool (
return 0;
}
-
-
/**
This function provides a means by which to retrieve the size of a given PCD token.
@@ -184,7 +171,7 @@ LibPcdGetBool (
UINTN
EFIAPI
LibPcdGetSize (
- IN UINTN TokenNumber
+ IN UINTN TokenNumber
)
{
ASSERT (FALSE);
@@ -192,8 +179,6 @@ LibPcdGetSize (
return 0;
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -211,8 +196,8 @@ LibPcdGetSize (
UINT8
EFIAPI
LibPcdGetEx8 (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber
)
{
ASSERT (FALSE);
@@ -220,8 +205,6 @@ LibPcdGetEx8 (
return 0;
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -239,8 +222,8 @@ LibPcdGetEx8 (
UINT16
EFIAPI
LibPcdGetEx16 (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber
)
{
ASSERT (FALSE);
@@ -248,8 +231,6 @@ LibPcdGetEx16 (
return 0;
}
-
-
/**
Returns the 32-bit value for the token specified by TokenNumber and Guid.
If Guid is NULL, then ASSERT().
@@ -264,8 +245,8 @@ LibPcdGetEx16 (
UINT32
EFIAPI
LibPcdGetEx32 (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber
)
{
ASSERT (FALSE);
@@ -273,8 +254,6 @@ LibPcdGetEx32 (
return 0;
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -292,8 +271,8 @@ LibPcdGetEx32 (
UINT64
EFIAPI
LibPcdGetEx64 (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber
)
{
ASSERT (FALSE);
@@ -301,8 +280,6 @@ LibPcdGetEx64 (
return 0;
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -320,8 +297,8 @@ LibPcdGetEx64 (
VOID *
EFIAPI
LibPcdGetExPtr (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber
)
{
ASSERT (FALSE);
@@ -329,8 +306,6 @@ LibPcdGetExPtr (
return 0;
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -348,8 +323,8 @@ LibPcdGetExPtr (
BOOLEAN
EFIAPI
LibPcdGetExBool (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber
)
{
ASSERT (FALSE);
@@ -357,8 +332,6 @@ LibPcdGetExBool (
return 0;
}
-
-
/**
This function provides a means by which to retrieve the size of a given PCD token.
@@ -376,8 +349,8 @@ LibPcdGetExBool (
UINTN
EFIAPI
LibPcdGetExSize (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber
)
{
ASSERT (FALSE);
@@ -385,7 +358,6 @@ LibPcdGetExSize (
return 0;
}
-
/**
This function provides a means by which to set a value for a given PCD token.
@@ -401,8 +373,8 @@ LibPcdGetExSize (
RETURN_STATUS
EFIAPI
LibPcdSet8S (
- IN UINTN TokenNumber,
- IN UINT8 Value
+ IN UINTN TokenNumber,
+ IN UINT8 Value
)
{
ASSERT (FALSE);
@@ -425,8 +397,8 @@ LibPcdSet8S (
RETURN_STATUS
EFIAPI
LibPcdSet16S (
- IN UINTN TokenNumber,
- IN UINT16 Value
+ IN UINTN TokenNumber,
+ IN UINT16 Value
)
{
ASSERT (FALSE);
@@ -449,8 +421,8 @@ LibPcdSet16S (
RETURN_STATUS
EFIAPI
LibPcdSet32S (
- IN UINTN TokenNumber,
- IN UINT32 Value
+ IN UINTN TokenNumber,
+ IN UINT32 Value
)
{
ASSERT (FALSE);
@@ -473,8 +445,8 @@ LibPcdSet32S (
RETURN_STATUS
EFIAPI
LibPcdSet64S (
- IN UINTN TokenNumber,
- IN UINT64 Value
+ IN UINTN TokenNumber,
+ IN UINT64 Value
)
{
ASSERT (FALSE);
@@ -507,9 +479,9 @@ LibPcdSet64S (
RETURN_STATUS
EFIAPI
LibPcdSetPtrS (
- IN UINTN TokenNumber,
- IN OUT UINTN *SizeOfBuffer,
- IN CONST VOID *Buffer
+ IN UINTN TokenNumber,
+ IN OUT UINTN *SizeOfBuffer,
+ IN CONST VOID *Buffer
)
{
ASSERT (FALSE);
@@ -532,8 +504,8 @@ LibPcdSetPtrS (
RETURN_STATUS
EFIAPI
LibPcdSetBoolS (
- IN UINTN TokenNumber,
- IN BOOLEAN Value
+ IN UINTN TokenNumber,
+ IN BOOLEAN Value
)
{
ASSERT (FALSE);
@@ -560,9 +532,9 @@ LibPcdSetBoolS (
RETURN_STATUS
EFIAPI
LibPcdSetEx8S (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber,
- IN UINT8 Value
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ IN UINT8 Value
)
{
ASSERT (FALSE);
@@ -589,9 +561,9 @@ LibPcdSetEx8S (
RETURN_STATUS
EFIAPI
LibPcdSetEx16S (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber,
- IN UINT16 Value
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ IN UINT16 Value
)
{
ASSERT (FALSE);
@@ -618,9 +590,9 @@ LibPcdSetEx16S (
RETURN_STATUS
EFIAPI
LibPcdSetEx32S (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber,
- IN UINT32 Value
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ IN UINT32 Value
)
{
ASSERT (FALSE);
@@ -647,9 +619,9 @@ LibPcdSetEx32S (
RETURN_STATUS
EFIAPI
LibPcdSetEx64S (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber,
- IN UINT64 Value
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ IN UINT64 Value
)
{
ASSERT (FALSE);
@@ -682,10 +654,10 @@ LibPcdSetEx64S (
RETURN_STATUS
EFIAPI
LibPcdSetExPtrS (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber,
- IN OUT UINTN *SizeOfBuffer,
- IN VOID *Buffer
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ IN OUT UINTN *SizeOfBuffer,
+ IN VOID *Buffer
)
{
ASSERT (FALSE);
@@ -712,9 +684,9 @@ LibPcdSetExPtrS (
RETURN_STATUS
EFIAPI
LibPcdSetExBoolS (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber,
- IN BOOLEAN Value
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ IN BOOLEAN Value
)
{
ASSERT (FALSE);
@@ -742,16 +714,14 @@ LibPcdSetExBoolS (
VOID
EFIAPI
LibPcdCallbackOnSet (
- IN CONST GUID *Guid OPTIONAL,
- IN UINTN TokenNumber,
- IN PCD_CALLBACK NotificationFunction
+ IN CONST GUID *Guid OPTIONAL,
+ IN UINTN TokenNumber,
+ IN PCD_CALLBACK NotificationFunction
)
{
ASSERT (FALSE);
}
-
-
/**
Disable a notification function that was established with LibPcdCallbackonSet().
@@ -769,16 +739,14 @@ LibPcdCallbackOnSet (
VOID
EFIAPI
LibPcdCancelCallback (
- IN CONST GUID *Guid OPTIONAL,
- IN UINTN TokenNumber,
- IN PCD_CALLBACK NotificationFunction
+ IN CONST GUID *Guid OPTIONAL,
+ IN UINTN TokenNumber,
+ IN PCD_CALLBACK NotificationFunction
)
{
ASSERT (FALSE);
}
-
-
/**
Retrieves the next token in a token space.
@@ -801,8 +769,8 @@ LibPcdCancelCallback (
UINTN
EFIAPI
LibPcdGetNextToken (
- IN CONST GUID *Guid OPTIONAL,
- IN UINTN TokenNumber
+ IN CONST GUID *Guid OPTIONAL,
+ IN UINTN TokenNumber
)
{
ASSERT (FALSE);
@@ -810,8 +778,6 @@ LibPcdGetNextToken (
return 0;
}
-
-
/**
Used to retrieve the list of available PCD token space GUIDs.
@@ -836,7 +802,6 @@ LibPcdGetNextTokenSpace (
return NULL;
}
-
/**
Sets a value of a patchable PCD entry that is type pointer.
@@ -863,10 +828,10 @@ LibPcdGetNextTokenSpace (
VOID *
EFIAPI
LibPatchPcdSetPtr (
- OUT VOID *PatchVariable,
- IN UINTN MaximumDatumSize,
- IN OUT UINTN *SizeOfBuffer,
- IN CONST VOID *Buffer
+ OUT VOID *PatchVariable,
+ IN UINTN MaximumDatumSize,
+ IN OUT UINTN *SizeOfBuffer,
+ IN CONST VOID *Buffer
)
{
ASSERT (PatchVariable != NULL);
@@ -877,14 +842,15 @@ LibPatchPcdSetPtr (
}
if ((*SizeOfBuffer > MaximumDatumSize) ||
- (*SizeOfBuffer == MAX_ADDRESS)) {
+ (*SizeOfBuffer == MAX_ADDRESS))
+ {
*SizeOfBuffer = MaximumDatumSize;
return NULL;
}
CopyMem (PatchVariable, Buffer, *SizeOfBuffer);
- return (VOID *) Buffer;
+ return (VOID *)Buffer;
}
/**
@@ -913,10 +879,10 @@ LibPatchPcdSetPtr (
RETURN_STATUS
EFIAPI
LibPatchPcdSetPtrS (
- OUT VOID *PatchVariable,
- IN UINTN MaximumDatumSize,
- IN OUT UINTN *SizeOfBuffer,
- IN CONST VOID *Buffer
+ OUT VOID *PatchVariable,
+ IN UINTN MaximumDatumSize,
+ IN OUT UINTN *SizeOfBuffer,
+ IN CONST VOID *Buffer
)
{
ASSERT (PatchVariable != NULL);
@@ -927,7 +893,8 @@ LibPatchPcdSetPtrS (
}
if ((*SizeOfBuffer > MaximumDatumSize) ||
- (*SizeOfBuffer == MAX_ADDRESS)) {
+ (*SizeOfBuffer == MAX_ADDRESS))
+ {
*SizeOfBuffer = MaximumDatumSize;
return RETURN_INVALID_PARAMETER;
}
@@ -965,11 +932,11 @@ LibPatchPcdSetPtrS (
VOID *
EFIAPI
LibPatchPcdSetPtrAndSize (
- OUT VOID *PatchVariable,
- OUT UINTN *SizeOfPatchVariable,
- IN UINTN MaximumDatumSize,
- IN OUT UINTN *SizeOfBuffer,
- IN CONST VOID *Buffer
+ OUT VOID *PatchVariable,
+ OUT UINTN *SizeOfPatchVariable,
+ IN UINTN MaximumDatumSize,
+ IN OUT UINTN *SizeOfBuffer,
+ IN CONST VOID *Buffer
)
{
ASSERT (PatchVariable != NULL);
@@ -981,7 +948,8 @@ LibPatchPcdSetPtrAndSize (
}
if ((*SizeOfBuffer > MaximumDatumSize) ||
- (*SizeOfBuffer == MAX_ADDRESS)) {
+ (*SizeOfBuffer == MAX_ADDRESS))
+ {
*SizeOfBuffer = MaximumDatumSize;
return NULL;
}
@@ -989,7 +957,7 @@ LibPatchPcdSetPtrAndSize (
CopyMem (PatchVariable, Buffer, *SizeOfBuffer);
*SizeOfPatchVariable = *SizeOfBuffer;
- return (VOID *) Buffer;
+ return (VOID *)Buffer;
}
/**
@@ -1020,11 +988,11 @@ LibPatchPcdSetPtrAndSize (
RETURN_STATUS
EFIAPI
LibPatchPcdSetPtrAndSizeS (
- OUT VOID *PatchVariable,
- OUT UINTN *SizeOfPatchVariable,
- IN UINTN MaximumDatumSize,
- IN OUT UINTN *SizeOfBuffer,
- IN CONST VOID *Buffer
+ OUT VOID *PatchVariable,
+ OUT UINTN *SizeOfPatchVariable,
+ IN UINTN MaximumDatumSize,
+ IN OUT UINTN *SizeOfBuffer,
+ IN CONST VOID *Buffer
)
{
ASSERT (PatchVariable != NULL);
@@ -1036,7 +1004,8 @@ LibPatchPcdSetPtrAndSizeS (
}
if ((*SizeOfBuffer > MaximumDatumSize) ||
- (*SizeOfBuffer == MAX_ADDRESS)) {
+ (*SizeOfBuffer == MAX_ADDRESS))
+ {
*SizeOfBuffer = MaximumDatumSize;
return RETURN_INVALID_PARAMETER;
}
@@ -1062,8 +1031,8 @@ LibPatchPcdSetPtrAndSizeS (
VOID
EFIAPI
LibPcdGetInfo (
- IN UINTN TokenNumber,
- OUT PCD_INFO *PcdInfo
+ IN UINTN TokenNumber,
+ OUT PCD_INFO *PcdInfo
)
{
ASSERT (FALSE);
@@ -1085,9 +1054,9 @@ LibPcdGetInfo (
VOID
EFIAPI
LibPcdGetInfoEx (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber,
- OUT PCD_INFO *PcdInfo
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ OUT PCD_INFO *PcdInfo
)
{
ASSERT (FALSE);
diff --git a/MdePkg/Library/BasePciCf8Lib/PciCf8Lib.c b/MdePkg/Library/BasePciCf8Lib/PciCf8Lib.c
index ba4190ab68..0d9667178f 100644
--- a/MdePkg/Library/BasePciCf8Lib/PciCf8Lib.c
+++ b/MdePkg/Library/BasePciCf8Lib/PciCf8Lib.c
@@ -7,7 +7,6 @@
**/
-
#include <Base.h>
#include <Library/BaseLib.h>
@@ -51,7 +50,7 @@
@param M Additional bits to assert to be zero.
**/
-#define ASSERT_INVALID_PCI_ADDRESS(A,M) \
+#define ASSERT_INVALID_PCI_ADDRESS(A, M) \
ASSERT (((A) & (~0xffff0ff | (M))) == 0)
/**
@@ -105,7 +104,7 @@ PciCf8RegisterForRuntimeAccess (
UINT8
EFIAPI
PciCf8Read8 (
- IN UINTN Address
+ IN UINTN Address
)
{
BOOLEAN InterruptState;
@@ -114,7 +113,7 @@ PciCf8Read8 (
ASSERT_INVALID_PCI_ADDRESS (Address, 0);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoRead8 (PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 3));
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort);
@@ -142,8 +141,8 @@ PciCf8Read8 (
UINT8
EFIAPI
PciCf8Write8 (
- IN UINTN Address,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINT8 Value
)
{
BOOLEAN InterruptState;
@@ -152,7 +151,7 @@ PciCf8Write8 (
ASSERT_INVALID_PCI_ADDRESS (Address, 0);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoWrite8 (
PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 3),
@@ -187,8 +186,8 @@ PciCf8Write8 (
UINT8
EFIAPI
PciCf8Or8 (
- IN UINTN Address,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 OrData
)
{
BOOLEAN InterruptState;
@@ -197,7 +196,7 @@ PciCf8Or8 (
ASSERT_INVALID_PCI_ADDRESS (Address, 0);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoOr8 (
PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 3),
@@ -232,8 +231,8 @@ PciCf8Or8 (
UINT8
EFIAPI
PciCf8And8 (
- IN UINTN Address,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINT8 AndData
)
{
BOOLEAN InterruptState;
@@ -242,7 +241,7 @@ PciCf8And8 (
ASSERT_INVALID_PCI_ADDRESS (Address, 0);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoAnd8 (
PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 3),
@@ -279,9 +278,9 @@ PciCf8And8 (
UINT8
EFIAPI
PciCf8AndThenOr8 (
- IN UINTN Address,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
BOOLEAN InterruptState;
@@ -290,7 +289,7 @@ PciCf8AndThenOr8 (
ASSERT_INVALID_PCI_ADDRESS (Address, 0);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoAndThenOr8 (
PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 3),
@@ -327,9 +326,9 @@ PciCf8AndThenOr8 (
UINT8
EFIAPI
PciCf8BitFieldRead8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
BOOLEAN InterruptState;
@@ -338,7 +337,7 @@ PciCf8BitFieldRead8 (
ASSERT_INVALID_PCI_ADDRESS (Address, 0);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoBitFieldRead8 (
PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 3),
@@ -378,10 +377,10 @@ PciCf8BitFieldRead8 (
UINT8
EFIAPI
PciCf8BitFieldWrite8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
BOOLEAN InterruptState;
@@ -390,7 +389,7 @@ PciCf8BitFieldWrite8 (
ASSERT_INVALID_PCI_ADDRESS (Address, 0);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoBitFieldWrite8 (
PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 3),
@@ -434,10 +433,10 @@ PciCf8BitFieldWrite8 (
UINT8
EFIAPI
PciCf8BitFieldOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
BOOLEAN InterruptState;
@@ -446,7 +445,7 @@ PciCf8BitFieldOr8 (
ASSERT_INVALID_PCI_ADDRESS (Address, 0);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoBitFieldOr8 (
PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 3),
@@ -490,10 +489,10 @@ PciCf8BitFieldOr8 (
UINT8
EFIAPI
PciCf8BitFieldAnd8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
BOOLEAN InterruptState;
@@ -502,7 +501,7 @@ PciCf8BitFieldAnd8 (
ASSERT_INVALID_PCI_ADDRESS (Address, 0);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoBitFieldAnd8 (
PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 3),
@@ -549,12 +548,12 @@ PciCf8BitFieldAnd8 (
**/
UINT8
EFIAPI
-PciCf8BitFieldAndThenOr8(
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+PciCf8BitFieldAndThenOr8 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
BOOLEAN InterruptState;
@@ -563,7 +562,7 @@ PciCf8BitFieldAndThenOr8(
ASSERT_INVALID_PCI_ADDRESS (Address, 0);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoBitFieldAndThenOr8 (
PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 3),
@@ -597,7 +596,7 @@ PciCf8BitFieldAndThenOr8(
UINT16
EFIAPI
PciCf8Read16 (
- IN UINTN Address
+ IN UINTN Address
)
{
BOOLEAN InterruptState;
@@ -606,7 +605,7 @@ PciCf8Read16 (
ASSERT_INVALID_PCI_ADDRESS (Address, 1);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoRead16 (PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 2));
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort);
@@ -635,8 +634,8 @@ PciCf8Read16 (
UINT16
EFIAPI
PciCf8Write16 (
- IN UINTN Address,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINT16 Value
)
{
BOOLEAN InterruptState;
@@ -645,7 +644,7 @@ PciCf8Write16 (
ASSERT_INVALID_PCI_ADDRESS (Address, 1);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoWrite16 (
PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 2),
@@ -681,8 +680,8 @@ PciCf8Write16 (
UINT16
EFIAPI
PciCf8Or16 (
- IN UINTN Address,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 OrData
)
{
BOOLEAN InterruptState;
@@ -691,7 +690,7 @@ PciCf8Or16 (
ASSERT_INVALID_PCI_ADDRESS (Address, 1);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoOr16 (
PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 2),
@@ -727,8 +726,8 @@ PciCf8Or16 (
UINT16
EFIAPI
PciCf8And16 (
- IN UINTN Address,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINT16 AndData
)
{
BOOLEAN InterruptState;
@@ -737,7 +736,7 @@ PciCf8And16 (
ASSERT_INVALID_PCI_ADDRESS (Address, 1);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoAnd16 (
PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 2),
@@ -775,9 +774,9 @@ PciCf8And16 (
UINT16
EFIAPI
PciCf8AndThenOr16 (
- IN UINTN Address,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
BOOLEAN InterruptState;
@@ -786,7 +785,7 @@ PciCf8AndThenOr16 (
ASSERT_INVALID_PCI_ADDRESS (Address, 1);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoAndThenOr16 (
PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 2),
@@ -824,9 +823,9 @@ PciCf8AndThenOr16 (
UINT16
EFIAPI
PciCf8BitFieldRead16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
BOOLEAN InterruptState;
@@ -835,7 +834,7 @@ PciCf8BitFieldRead16 (
ASSERT_INVALID_PCI_ADDRESS (Address, 1);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoBitFieldRead16 (
PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 2),
@@ -876,10 +875,10 @@ PciCf8BitFieldRead16 (
UINT16
EFIAPI
PciCf8BitFieldWrite16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
BOOLEAN InterruptState;
@@ -888,7 +887,7 @@ PciCf8BitFieldWrite16 (
ASSERT_INVALID_PCI_ADDRESS (Address, 1);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoBitFieldWrite16 (
PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 2),
@@ -933,10 +932,10 @@ PciCf8BitFieldWrite16 (
UINT16
EFIAPI
PciCf8BitFieldOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
BOOLEAN InterruptState;
@@ -945,7 +944,7 @@ PciCf8BitFieldOr16 (
ASSERT_INVALID_PCI_ADDRESS (Address, 1);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoBitFieldOr16 (
PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 2),
@@ -990,10 +989,10 @@ PciCf8BitFieldOr16 (
UINT16
EFIAPI
PciCf8BitFieldAnd16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
BOOLEAN InterruptState;
@@ -1002,7 +1001,7 @@ PciCf8BitFieldAnd16 (
ASSERT_INVALID_PCI_ADDRESS (Address, 1);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoBitFieldAnd16 (
PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 2),
@@ -1050,12 +1049,12 @@ PciCf8BitFieldAnd16 (
**/
UINT16
EFIAPI
-PciCf8BitFieldAndThenOr16(
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+PciCf8BitFieldAndThenOr16 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
BOOLEAN InterruptState;
@@ -1064,7 +1063,7 @@ PciCf8BitFieldAndThenOr16(
ASSERT_INVALID_PCI_ADDRESS (Address, 1);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoBitFieldAndThenOr16 (
PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 2),
@@ -1098,7 +1097,7 @@ PciCf8BitFieldAndThenOr16(
UINT32
EFIAPI
PciCf8Read32 (
- IN UINTN Address
+ IN UINTN Address
)
{
BOOLEAN InterruptState;
@@ -1107,7 +1106,7 @@ PciCf8Read32 (
ASSERT_INVALID_PCI_ADDRESS (Address, 3);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoRead32 (PCI_CONFIGURATION_DATA_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort);
@@ -1136,8 +1135,8 @@ PciCf8Read32 (
UINT32
EFIAPI
PciCf8Write32 (
- IN UINTN Address,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINT32 Value
)
{
BOOLEAN InterruptState;
@@ -1146,7 +1145,7 @@ PciCf8Write32 (
ASSERT_INVALID_PCI_ADDRESS (Address, 3);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoWrite32 (
PCI_CONFIGURATION_DATA_PORT,
@@ -1182,8 +1181,8 @@ PciCf8Write32 (
UINT32
EFIAPI
PciCf8Or32 (
- IN UINTN Address,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 OrData
)
{
BOOLEAN InterruptState;
@@ -1192,7 +1191,7 @@ PciCf8Or32 (
ASSERT_INVALID_PCI_ADDRESS (Address, 3);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoOr32 (
PCI_CONFIGURATION_DATA_PORT,
@@ -1228,8 +1227,8 @@ PciCf8Or32 (
UINT32
EFIAPI
PciCf8And32 (
- IN UINTN Address,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINT32 AndData
)
{
BOOLEAN InterruptState;
@@ -1238,7 +1237,7 @@ PciCf8And32 (
ASSERT_INVALID_PCI_ADDRESS (Address, 3);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoAnd32 (
PCI_CONFIGURATION_DATA_PORT,
@@ -1276,9 +1275,9 @@ PciCf8And32 (
UINT32
EFIAPI
PciCf8AndThenOr32 (
- IN UINTN Address,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
BOOLEAN InterruptState;
@@ -1287,7 +1286,7 @@ PciCf8AndThenOr32 (
ASSERT_INVALID_PCI_ADDRESS (Address, 3);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoAndThenOr32 (
PCI_CONFIGURATION_DATA_PORT,
@@ -1325,9 +1324,9 @@ PciCf8AndThenOr32 (
UINT32
EFIAPI
PciCf8BitFieldRead32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
BOOLEAN InterruptState;
@@ -1336,7 +1335,7 @@ PciCf8BitFieldRead32 (
ASSERT_INVALID_PCI_ADDRESS (Address, 3);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoBitFieldRead32 (
PCI_CONFIGURATION_DATA_PORT,
@@ -1377,10 +1376,10 @@ PciCf8BitFieldRead32 (
UINT32
EFIAPI
PciCf8BitFieldWrite32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
BOOLEAN InterruptState;
@@ -1389,7 +1388,7 @@ PciCf8BitFieldWrite32 (
ASSERT_INVALID_PCI_ADDRESS (Address, 3);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoBitFieldWrite32 (
PCI_CONFIGURATION_DATA_PORT,
@@ -1434,10 +1433,10 @@ PciCf8BitFieldWrite32 (
UINT32
EFIAPI
PciCf8BitFieldOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
BOOLEAN InterruptState;
@@ -1446,7 +1445,7 @@ PciCf8BitFieldOr32 (
ASSERT_INVALID_PCI_ADDRESS (Address, 3);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoBitFieldOr32 (
PCI_CONFIGURATION_DATA_PORT,
@@ -1491,10 +1490,10 @@ PciCf8BitFieldOr32 (
UINT32
EFIAPI
PciCf8BitFieldAnd32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
BOOLEAN InterruptState;
@@ -1503,7 +1502,7 @@ PciCf8BitFieldAnd32 (
ASSERT_INVALID_PCI_ADDRESS (Address, 3);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoBitFieldAnd32 (
PCI_CONFIGURATION_DATA_PORT,
@@ -1551,12 +1550,12 @@ PciCf8BitFieldAnd32 (
**/
UINT32
EFIAPI
-PciCf8BitFieldAndThenOr32(
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+PciCf8BitFieldAndThenOr32 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
BOOLEAN InterruptState;
@@ -1565,15 +1564,15 @@ PciCf8BitFieldAndThenOr32(
ASSERT_INVALID_PCI_ADDRESS (Address, 3);
InterruptState = SaveAndDisableInterrupts ();
- AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
+ AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoBitFieldAndThenOr32 (
- PCI_CONFIGURATION_DATA_PORT,
- StartBit,
- EndBit,
- AndData,
- OrData
- );
+ PCI_CONFIGURATION_DATA_PORT,
+ StartBit,
+ EndBit,
+ AndData,
+ OrData
+ );
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort);
SetInterruptState (InterruptState);
return Result;
@@ -1606,12 +1605,12 @@ PciCf8BitFieldAndThenOr32(
UINTN
EFIAPI
PciCf8ReadBuffer (
- IN UINTN StartAddress,
- IN UINTN Size,
- OUT VOID *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Size,
+ OUT VOID *Buffer
)
{
- UINTN ReturnValue;
+ UINTN ReturnValue;
ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x100);
@@ -1632,40 +1631,40 @@ PciCf8ReadBuffer (
// Read a byte if StartAddress is byte aligned
//
*(volatile UINT8 *)Buffer = PciCf8Read8 (StartAddress);
- StartAddress += sizeof (UINT8);
- Size -= sizeof (UINT8);
- Buffer = (UINT8*)Buffer + 1;
+ StartAddress += sizeof (UINT8);
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *)Buffer + 1;
}
- if (Size >= sizeof (UINT16) && (StartAddress & 2) != 0) {
+ if ((Size >= sizeof (UINT16)) && ((StartAddress & 2) != 0)) {
//
// Read a word if StartAddress is word aligned
//
- WriteUnaligned16 ((UINT16 *)Buffer, (UINT16) PciCf8Read16 (StartAddress));
+ WriteUnaligned16 ((UINT16 *)Buffer, (UINT16)PciCf8Read16 (StartAddress));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
while (Size >= sizeof (UINT32)) {
//
// Read as many double words as possible
//
- WriteUnaligned32 ((UINT32 *)Buffer, (UINT32) PciCf8Read32 (StartAddress));
+ WriteUnaligned32 ((UINT32 *)Buffer, (UINT32)PciCf8Read32 (StartAddress));
StartAddress += sizeof (UINT32);
- Size -= sizeof (UINT32);
- Buffer = (UINT32*)Buffer + 1;
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *)Buffer + 1;
}
if (Size >= sizeof (UINT16)) {
//
// Read the last remaining word if exist
//
- WriteUnaligned16 ((UINT16 *)Buffer, (UINT16) PciCf8Read16 (StartAddress));
+ WriteUnaligned16 ((UINT16 *)Buffer, (UINT16)PciCf8Read16 (StartAddress));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
if (Size >= sizeof (UINT8)) {
@@ -1706,12 +1705,12 @@ PciCf8ReadBuffer (
UINTN
EFIAPI
PciCf8WriteBuffer (
- IN UINTN StartAddress,
- IN UINTN Size,
- IN VOID *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Size,
+ IN VOID *Buffer
)
{
- UINTN ReturnValue;
+ UINTN ReturnValue;
ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x100);
@@ -1731,47 +1730,47 @@ PciCf8WriteBuffer (
//
// Write a byte if StartAddress is byte aligned
//
- PciCf8Write8 (StartAddress, *(UINT8*)Buffer);
+ PciCf8Write8 (StartAddress, *(UINT8 *)Buffer);
StartAddress += sizeof (UINT8);
- Size -= sizeof (UINT8);
- Buffer = (UINT8*)Buffer + 1;
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *)Buffer + 1;
}
- if (Size >= sizeof (UINT16) && (StartAddress & 2) != 0) {
+ if ((Size >= sizeof (UINT16)) && ((StartAddress & 2) != 0)) {
//
// Write a word if StartAddress is word aligned
//
- PciCf8Write16 (StartAddress, ReadUnaligned16 ((UINT16*)Buffer));
+ PciCf8Write16 (StartAddress, ReadUnaligned16 ((UINT16 *)Buffer));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
while (Size >= sizeof (UINT32)) {
//
// Write as many double words as possible
//
- PciCf8Write32 (StartAddress, ReadUnaligned32 ((UINT32*)Buffer));
+ PciCf8Write32 (StartAddress, ReadUnaligned32 ((UINT32 *)Buffer));
StartAddress += sizeof (UINT32);
- Size -= sizeof (UINT32);
- Buffer = (UINT32*)Buffer + 1;
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *)Buffer + 1;
}
if (Size >= sizeof (UINT16)) {
//
// Write the last remaining word if exist
//
- PciCf8Write16 (StartAddress, ReadUnaligned16 ((UINT16*)Buffer));
+ PciCf8Write16 (StartAddress, ReadUnaligned16 ((UINT16 *)Buffer));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
if (Size >= sizeof (UINT8)) {
//
// Write the last remaining byte if exist
//
- PciCf8Write8 (StartAddress, *(UINT8*)Buffer);
+ PciCf8Write8 (StartAddress, *(UINT8 *)Buffer);
}
return ReturnValue;
diff --git a/MdePkg/Library/BasePciExpressLib/PciExpressLib.c b/MdePkg/Library/BasePciExpressLib/PciExpressLib.c
index 910dd75bb4..df937ec1fb 100644
--- a/MdePkg/Library/BasePciExpressLib/PciExpressLib.c
+++ b/MdePkg/Library/BasePciExpressLib/PciExpressLib.c
@@ -10,7 +10,6 @@
**/
-
#include <Base.h>
#include <Library/BaseLib.h>
@@ -19,7 +18,6 @@
#include <Library/DebugLib.h>
#include <Library/PcdLib.h>
-
/**
Assert the validity of a PCI address. A valid PCI address should contain 1's
only in the low 28 bits. PcdPciExpressBaseSize limits the size to the real
@@ -72,12 +70,12 @@ PciExpressRegisterForRuntimeAccess (
@return The base address of PCI Express.
**/
-VOID*
+VOID *
GetPciExpressBaseAddress (
VOID
)
{
- return (VOID*)(UINTN) PcdGet64 (PcdPciExpressBaseAddress);
+ return (VOID *)(UINTN)PcdGet64 (PcdPciExpressBaseAddress);
}
/**
@@ -95,7 +93,7 @@ PcdPciExpressBaseSize (
VOID
)
{
- return (UINTN) PcdGet64 (PcdPciExpressBaseSize);
+ return (UINTN)PcdGet64 (PcdPciExpressBaseSize);
}
/**
@@ -117,14 +115,15 @@ PcdPciExpressBaseSize (
UINT8
EFIAPI
PciExpressRead8 (
- IN UINTN Address
+ IN UINTN Address
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT8) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT8)-1;
}
- return MmioRead8 ((UINTN) GetPciExpressBaseAddress () + Address);
+
+ return MmioRead8 ((UINTN)GetPciExpressBaseAddress () + Address);
}
/**
@@ -147,15 +146,16 @@ PciExpressRead8 (
UINT8
EFIAPI
PciExpressWrite8 (
- IN UINTN Address,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINT8 Value
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT8) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT8)-1;
}
- return MmioWrite8 ((UINTN) GetPciExpressBaseAddress () + Address, Value);
+
+ return MmioWrite8 ((UINTN)GetPciExpressBaseAddress () + Address, Value);
}
/**
@@ -182,15 +182,16 @@ PciExpressWrite8 (
UINT8
EFIAPI
PciExpressOr8 (
- IN UINTN Address,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 OrData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT8) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT8)-1;
}
- return MmioOr8 ((UINTN) GetPciExpressBaseAddress () + Address, OrData);
+
+ return MmioOr8 ((UINTN)GetPciExpressBaseAddress () + Address, OrData);
}
/**
@@ -217,15 +218,16 @@ PciExpressOr8 (
UINT8
EFIAPI
PciExpressAnd8 (
- IN UINTN Address,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINT8 AndData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT8) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT8)-1;
}
- return MmioAnd8 ((UINTN) GetPciExpressBaseAddress () + Address, AndData);
+
+ return MmioAnd8 ((UINTN)GetPciExpressBaseAddress () + Address, AndData);
}
/**
@@ -254,17 +256,18 @@ PciExpressAnd8 (
UINT8
EFIAPI
PciExpressAndThenOr8 (
- IN UINTN Address,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT8) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT8)-1;
}
+
return MmioAndThenOr8 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
AndData,
OrData
);
@@ -296,17 +299,18 @@ PciExpressAndThenOr8 (
UINT8
EFIAPI
PciExpressBitFieldRead8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT8) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT8)-1;
}
+
return MmioBitFieldRead8 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit
);
@@ -340,18 +344,19 @@ PciExpressBitFieldRead8 (
UINT8
EFIAPI
PciExpressBitFieldWrite8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT8) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT8)-1;
}
+
return MmioBitFieldWrite8 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
Value
@@ -389,18 +394,19 @@ PciExpressBitFieldWrite8 (
UINT8
EFIAPI
PciExpressBitFieldOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT8) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT8)-1;
}
+
return MmioBitFieldOr8 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
OrData
@@ -438,18 +444,19 @@ PciExpressBitFieldOr8 (
UINT8
EFIAPI
PciExpressBitFieldAnd8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT8) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT8)-1;
}
+
return MmioBitFieldAnd8 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
AndData
@@ -491,19 +498,20 @@ PciExpressBitFieldAnd8 (
UINT8
EFIAPI
PciExpressBitFieldAndThenOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT8) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT8)-1;
}
+
return MmioBitFieldAndThenOr8 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
AndData,
@@ -531,14 +539,15 @@ PciExpressBitFieldAndThenOr8 (
UINT16
EFIAPI
PciExpressRead16 (
- IN UINTN Address
+ IN UINTN Address
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT16) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT16)-1;
}
- return MmioRead16 ((UINTN) GetPciExpressBaseAddress () + Address);
+
+ return MmioRead16 ((UINTN)GetPciExpressBaseAddress () + Address);
}
/**
@@ -562,15 +571,16 @@ PciExpressRead16 (
UINT16
EFIAPI
PciExpressWrite16 (
- IN UINTN Address,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINT16 Value
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT16) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT16)-1;
}
- return MmioWrite16 ((UINTN) GetPciExpressBaseAddress () + Address, Value);
+
+ return MmioWrite16 ((UINTN)GetPciExpressBaseAddress () + Address, Value);
}
/**
@@ -598,15 +608,16 @@ PciExpressWrite16 (
UINT16
EFIAPI
PciExpressOr16 (
- IN UINTN Address,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 OrData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT16) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT16)-1;
}
- return MmioOr16 ((UINTN) GetPciExpressBaseAddress () + Address, OrData);
+
+ return MmioOr16 ((UINTN)GetPciExpressBaseAddress () + Address, OrData);
}
/**
@@ -634,15 +645,16 @@ PciExpressOr16 (
UINT16
EFIAPI
PciExpressAnd16 (
- IN UINTN Address,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINT16 AndData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT16) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT16)-1;
}
- return MmioAnd16 ((UINTN) GetPciExpressBaseAddress () + Address, AndData);
+
+ return MmioAnd16 ((UINTN)GetPciExpressBaseAddress () + Address, AndData);
}
/**
@@ -672,17 +684,18 @@ PciExpressAnd16 (
UINT16
EFIAPI
PciExpressAndThenOr16 (
- IN UINTN Address,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT16) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT16)-1;
}
+
return MmioAndThenOr16 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
AndData,
OrData
);
@@ -715,17 +728,18 @@ PciExpressAndThenOr16 (
UINT16
EFIAPI
PciExpressBitFieldRead16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT16) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT16)-1;
}
+
return MmioBitFieldRead16 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit
);
@@ -760,18 +774,19 @@ PciExpressBitFieldRead16 (
UINT16
EFIAPI
PciExpressBitFieldWrite16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT16) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT16)-1;
}
+
return MmioBitFieldWrite16 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
Value
@@ -810,18 +825,19 @@ PciExpressBitFieldWrite16 (
UINT16
EFIAPI
PciExpressBitFieldOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT16) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT16)-1;
}
+
return MmioBitFieldOr16 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
OrData
@@ -860,18 +876,19 @@ PciExpressBitFieldOr16 (
UINT16
EFIAPI
PciExpressBitFieldAnd16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT16) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT16)-1;
}
+
return MmioBitFieldAnd16 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
AndData
@@ -914,19 +931,20 @@ PciExpressBitFieldAnd16 (
UINT16
EFIAPI
PciExpressBitFieldAndThenOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT16) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT16)-1;
}
+
return MmioBitFieldAndThenOr16 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
AndData,
@@ -954,14 +972,15 @@ PciExpressBitFieldAndThenOr16 (
UINT32
EFIAPI
PciExpressRead32 (
- IN UINTN Address
+ IN UINTN Address
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT32) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT32)-1;
}
- return MmioRead32 ((UINTN) GetPciExpressBaseAddress () + Address);
+
+ return MmioRead32 ((UINTN)GetPciExpressBaseAddress () + Address);
}
/**
@@ -985,15 +1004,16 @@ PciExpressRead32 (
UINT32
EFIAPI
PciExpressWrite32 (
- IN UINTN Address,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINT32 Value
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT32) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT32)-1;
}
- return MmioWrite32 ((UINTN) GetPciExpressBaseAddress () + Address, Value);
+
+ return MmioWrite32 ((UINTN)GetPciExpressBaseAddress () + Address, Value);
}
/**
@@ -1021,15 +1041,16 @@ PciExpressWrite32 (
UINT32
EFIAPI
PciExpressOr32 (
- IN UINTN Address,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 OrData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT32) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT32)-1;
}
- return MmioOr32 ((UINTN) GetPciExpressBaseAddress () + Address, OrData);
+
+ return MmioOr32 ((UINTN)GetPciExpressBaseAddress () + Address, OrData);
}
/**
@@ -1057,15 +1078,16 @@ PciExpressOr32 (
UINT32
EFIAPI
PciExpressAnd32 (
- IN UINTN Address,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINT32 AndData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT32) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT32)-1;
}
- return MmioAnd32 ((UINTN) GetPciExpressBaseAddress () + Address, AndData);
+
+ return MmioAnd32 ((UINTN)GetPciExpressBaseAddress () + Address, AndData);
}
/**
@@ -1095,17 +1117,18 @@ PciExpressAnd32 (
UINT32
EFIAPI
PciExpressAndThenOr32 (
- IN UINTN Address,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT32) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT32)-1;
}
+
return MmioAndThenOr32 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
AndData,
OrData
);
@@ -1138,17 +1161,18 @@ PciExpressAndThenOr32 (
UINT32
EFIAPI
PciExpressBitFieldRead32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT32) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT32)-1;
}
+
return MmioBitFieldRead32 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit
);
@@ -1183,18 +1207,19 @@ PciExpressBitFieldRead32 (
UINT32
EFIAPI
PciExpressBitFieldWrite32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT32) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT32)-1;
}
+
return MmioBitFieldWrite32 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
Value
@@ -1233,18 +1258,19 @@ PciExpressBitFieldWrite32 (
UINT32
EFIAPI
PciExpressBitFieldOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT32) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT32)-1;
}
+
return MmioBitFieldOr32 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
OrData
@@ -1283,18 +1309,19 @@ PciExpressBitFieldOr32 (
UINT32
EFIAPI
PciExpressBitFieldAnd32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT32) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT32)-1;
}
+
return MmioBitFieldAnd32 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
AndData
@@ -1337,19 +1364,20 @@ PciExpressBitFieldAnd32 (
UINT32
EFIAPI
PciExpressBitFieldAndThenOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT32) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT32)-1;
}
+
return MmioBitFieldAndThenOr32 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
AndData,
@@ -1384,17 +1412,18 @@ PciExpressBitFieldAndThenOr32 (
UINTN
EFIAPI
PciExpressReadBuffer (
- IN UINTN StartAddress,
- IN UINTN Size,
- OUT VOID *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Size,
+ OUT VOID *Buffer
)
{
- UINTN ReturnValue;
+ UINTN ReturnValue;
ASSERT_INVALID_PCI_ADDRESS (StartAddress);
- if (StartAddress >= PcdPciExpressBaseSize()) {
- return (UINTN) -1;
+ if (StartAddress >= PcdPciExpressBaseSize ()) {
+ return (UINTN)-1;
}
+
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
if (Size == 0) {
@@ -1413,41 +1442,41 @@ PciExpressReadBuffer (
// Read a byte if StartAddress is byte aligned
//
*(volatile UINT8 *)Buffer = PciExpressRead8 (StartAddress);
- StartAddress += sizeof (UINT8);
- Size -= sizeof (UINT8);
- Buffer = (UINT8*)Buffer + 1;
+ StartAddress += sizeof (UINT8);
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *)Buffer + 1;
}
- if (Size >= sizeof (UINT16) && (StartAddress & 2) != 0) {
+ if ((Size >= sizeof (UINT16)) && ((StartAddress & 2) != 0)) {
//
// Read a word if StartAddress is word aligned
//
- WriteUnaligned16 ((UINT16 *) Buffer, (UINT16) PciExpressRead16 (StartAddress));
+ WriteUnaligned16 ((UINT16 *)Buffer, (UINT16)PciExpressRead16 (StartAddress));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
while (Size >= sizeof (UINT32)) {
//
// Read as many double words as possible
//
- WriteUnaligned32 ((UINT32 *) Buffer, (UINT32) PciExpressRead32 (StartAddress));
+ WriteUnaligned32 ((UINT32 *)Buffer, (UINT32)PciExpressRead32 (StartAddress));
StartAddress += sizeof (UINT32);
- Size -= sizeof (UINT32);
- Buffer = (UINT32*)Buffer + 1;
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *)Buffer + 1;
}
if (Size >= sizeof (UINT16)) {
//
// Read the last remaining word if exist
//
- WriteUnaligned16 ((UINT16 *) Buffer, (UINT16) PciExpressRead16 (StartAddress));
+ WriteUnaligned16 ((UINT16 *)Buffer, (UINT16)PciExpressRead16 (StartAddress));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
if (Size >= sizeof (UINT8)) {
@@ -1488,17 +1517,18 @@ PciExpressReadBuffer (
UINTN
EFIAPI
PciExpressWriteBuffer (
- IN UINTN StartAddress,
- IN UINTN Size,
- IN VOID *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Size,
+ IN VOID *Buffer
)
{
- UINTN ReturnValue;
+ UINTN ReturnValue;
ASSERT_INVALID_PCI_ADDRESS (StartAddress);
- if (StartAddress >= PcdPciExpressBaseSize()) {
- return (UINTN) -1;
+ if (StartAddress >= PcdPciExpressBaseSize ()) {
+ return (UINTN)-1;
}
+
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
if (Size == 0) {
@@ -1516,47 +1546,47 @@ PciExpressWriteBuffer (
//
// Write a byte if StartAddress is byte aligned
//
- PciExpressWrite8 (StartAddress, *(UINT8*)Buffer);
+ PciExpressWrite8 (StartAddress, *(UINT8 *)Buffer);
StartAddress += sizeof (UINT8);
- Size -= sizeof (UINT8);
- Buffer = (UINT8*)Buffer + 1;
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *)Buffer + 1;
}
- if (Size >= sizeof (UINT16) && (StartAddress & 2) != 0) {
+ if ((Size >= sizeof (UINT16)) && ((StartAddress & 2) != 0)) {
//
// Write a word if StartAddress is word aligned
//
- PciExpressWrite16 (StartAddress, ReadUnaligned16 ((UINT16*)Buffer));
+ PciExpressWrite16 (StartAddress, ReadUnaligned16 ((UINT16 *)Buffer));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
while (Size >= sizeof (UINT32)) {
//
// Write as many double words as possible
//
- PciExpressWrite32 (StartAddress, ReadUnaligned32 ((UINT32*)Buffer));
+ PciExpressWrite32 (StartAddress, ReadUnaligned32 ((UINT32 *)Buffer));
StartAddress += sizeof (UINT32);
- Size -= sizeof (UINT32);
- Buffer = (UINT32*)Buffer + 1;
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *)Buffer + 1;
}
if (Size >= sizeof (UINT16)) {
//
// Write the last remaining word if exist
//
- PciExpressWrite16 (StartAddress, ReadUnaligned16 ((UINT16*)Buffer));
+ PciExpressWrite16 (StartAddress, ReadUnaligned16 ((UINT16 *)Buffer));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
if (Size >= sizeof (UINT8)) {
//
// Write the last remaining byte if exist
//
- PciExpressWrite8 (StartAddress, *(UINT8*)Buffer);
+ PciExpressWrite8 (StartAddress, *(UINT8 *)Buffer);
}
return ReturnValue;
diff --git a/MdePkg/Library/BasePciLibCf8/PciLib.c b/MdePkg/Library/BasePciLibCf8/PciLib.c
index a2eb4d9dc4..74cece0fca 100644
--- a/MdePkg/Library/BasePciLibCf8/PciLib.c
+++ b/MdePkg/Library/BasePciLibCf8/PciLib.c
@@ -7,7 +7,6 @@
**/
-
#include <Base.h>
#include <Library/PciLib.h>
@@ -61,7 +60,7 @@ PciRegisterForRuntimeAccess (
UINT8
EFIAPI
PciRead8 (
- IN UINTN Address
+ IN UINTN Address
)
{
return PciCf8Read8 (Address);
@@ -86,8 +85,8 @@ PciRead8 (
UINT8
EFIAPI
PciWrite8 (
- IN UINTN Address,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINT8 Value
)
{
return PciCf8Write8 (Address, Value);
@@ -116,8 +115,8 @@ PciWrite8 (
UINT8
EFIAPI
PciOr8 (
- IN UINTN Address,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 OrData
)
{
return PciCf8Or8 (Address, OrData);
@@ -146,8 +145,8 @@ PciOr8 (
UINT8
EFIAPI
PciAnd8 (
- IN UINTN Address,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINT8 AndData
)
{
return PciCf8And8 (Address, AndData);
@@ -178,9 +177,9 @@ PciAnd8 (
UINT8
EFIAPI
PciAndThenOr8 (
- IN UINTN Address,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
return PciCf8AndThenOr8 (Address, AndData, OrData);
@@ -210,9 +209,9 @@ PciAndThenOr8 (
UINT8
EFIAPI
PciBitFieldRead8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return PciCf8BitFieldRead8 (Address, StartBit, EndBit);
@@ -245,10 +244,10 @@ PciBitFieldRead8 (
UINT8
EFIAPI
PciBitFieldWrite8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
return PciCf8BitFieldWrite8 (Address, StartBit, EndBit, Value);
@@ -284,10 +283,10 @@ PciBitFieldWrite8 (
UINT8
EFIAPI
PciBitFieldOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
return PciCf8BitFieldOr8 (Address, StartBit, EndBit, OrData);
@@ -323,10 +322,10 @@ PciBitFieldOr8 (
UINT8
EFIAPI
PciBitFieldAnd8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
return PciCf8BitFieldAnd8 (Address, StartBit, EndBit, AndData);
@@ -366,11 +365,11 @@ PciBitFieldAnd8 (
UINT8
EFIAPI
PciBitFieldAndThenOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
return PciCf8BitFieldAndThenOr8 (Address, StartBit, EndBit, AndData, OrData);
@@ -395,7 +394,7 @@ PciBitFieldAndThenOr8 (
UINT16
EFIAPI
PciRead16 (
- IN UINTN Address
+ IN UINTN Address
)
{
return PciCf8Read16 (Address);
@@ -421,8 +420,8 @@ PciRead16 (
UINT16
EFIAPI
PciWrite16 (
- IN UINTN Address,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINT16 Value
)
{
return PciCf8Write16 (Address, Value);
@@ -452,8 +451,8 @@ PciWrite16 (
UINT16
EFIAPI
PciOr16 (
- IN UINTN Address,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 OrData
)
{
return PciCf8Or16 (Address, OrData);
@@ -483,8 +482,8 @@ PciOr16 (
UINT16
EFIAPI
PciAnd16 (
- IN UINTN Address,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINT16 AndData
)
{
return PciCf8And16 (Address, AndData);
@@ -516,9 +515,9 @@ PciAnd16 (
UINT16
EFIAPI
PciAndThenOr16 (
- IN UINTN Address,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
return PciCf8AndThenOr16 (Address, AndData, OrData);
@@ -549,9 +548,9 @@ PciAndThenOr16 (
UINT16
EFIAPI
PciBitFieldRead16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return PciCf8BitFieldRead16 (Address, StartBit, EndBit);
@@ -585,10 +584,10 @@ PciBitFieldRead16 (
UINT16
EFIAPI
PciBitFieldWrite16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
return PciCf8BitFieldWrite16 (Address, StartBit, EndBit, Value);
@@ -625,10 +624,10 @@ PciBitFieldWrite16 (
UINT16
EFIAPI
PciBitFieldOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
return PciCf8BitFieldOr16 (Address, StartBit, EndBit, OrData);
@@ -665,10 +664,10 @@ PciBitFieldOr16 (
UINT16
EFIAPI
PciBitFieldAnd16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
return PciCf8BitFieldAnd16 (Address, StartBit, EndBit, AndData);
@@ -709,11 +708,11 @@ PciBitFieldAnd16 (
UINT16
EFIAPI
PciBitFieldAndThenOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
return PciCf8BitFieldAndThenOr16 (Address, StartBit, EndBit, AndData, OrData);
@@ -738,7 +737,7 @@ PciBitFieldAndThenOr16 (
UINT32
EFIAPI
PciRead32 (
- IN UINTN Address
+ IN UINTN Address
)
{
return PciCf8Read32 (Address);
@@ -764,8 +763,8 @@ PciRead32 (
UINT32
EFIAPI
PciWrite32 (
- IN UINTN Address,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINT32 Value
)
{
return PciCf8Write32 (Address, Value);
@@ -795,8 +794,8 @@ PciWrite32 (
UINT32
EFIAPI
PciOr32 (
- IN UINTN Address,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 OrData
)
{
return PciCf8Or32 (Address, OrData);
@@ -826,8 +825,8 @@ PciOr32 (
UINT32
EFIAPI
PciAnd32 (
- IN UINTN Address,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINT32 AndData
)
{
return PciCf8And32 (Address, AndData);
@@ -859,9 +858,9 @@ PciAnd32 (
UINT32
EFIAPI
PciAndThenOr32 (
- IN UINTN Address,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return PciCf8AndThenOr32 (Address, AndData, OrData);
@@ -892,9 +891,9 @@ PciAndThenOr32 (
UINT32
EFIAPI
PciBitFieldRead32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return PciCf8BitFieldRead32 (Address, StartBit, EndBit);
@@ -928,10 +927,10 @@ PciBitFieldRead32 (
UINT32
EFIAPI
PciBitFieldWrite32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
return PciCf8BitFieldWrite32 (Address, StartBit, EndBit, Value);
@@ -968,10 +967,10 @@ PciBitFieldWrite32 (
UINT32
EFIAPI
PciBitFieldOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
return PciCf8BitFieldOr32 (Address, StartBit, EndBit, OrData);
@@ -1008,10 +1007,10 @@ PciBitFieldOr32 (
UINT32
EFIAPI
PciBitFieldAnd32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
return PciCf8BitFieldAnd32 (Address, StartBit, EndBit, AndData);
@@ -1052,11 +1051,11 @@ PciBitFieldAnd32 (
UINT32
EFIAPI
PciBitFieldAndThenOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return PciCf8BitFieldAndThenOr32 (Address, StartBit, EndBit, AndData, OrData);
@@ -1088,9 +1087,9 @@ PciBitFieldAndThenOr32 (
UINTN
EFIAPI
PciReadBuffer (
- IN UINTN StartAddress,
- IN UINTN Size,
- OUT VOID *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Size,
+ OUT VOID *Buffer
)
{
return PciCf8ReadBuffer (StartAddress, Size, Buffer);
@@ -1123,9 +1122,9 @@ PciReadBuffer (
UINTN
EFIAPI
PciWriteBuffer (
- IN UINTN StartAddress,
- IN UINTN Size,
- IN VOID *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Size,
+ IN VOID *Buffer
)
{
return PciCf8WriteBuffer (StartAddress, Size, Buffer);
diff --git a/MdePkg/Library/BasePciLibPciExpress/PciLib.c b/MdePkg/Library/BasePciLibPciExpress/PciLib.c
index 00dd31c122..1f037f717a 100644
--- a/MdePkg/Library/BasePciLibPciExpress/PciLib.c
+++ b/MdePkg/Library/BasePciLibPciExpress/PciLib.c
@@ -7,7 +7,6 @@
**/
-
#include <Base.h>
#include <Library/PciLib.h>
@@ -61,7 +60,7 @@ PciRegisterForRuntimeAccess (
UINT8
EFIAPI
PciRead8 (
- IN UINTN Address
+ IN UINTN Address
)
{
return PciExpressRead8 (Address);
@@ -86,8 +85,8 @@ PciRead8 (
UINT8
EFIAPI
PciWrite8 (
- IN UINTN Address,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINT8 Value
)
{
return PciExpressWrite8 (Address, Value);
@@ -116,8 +115,8 @@ PciWrite8 (
UINT8
EFIAPI
PciOr8 (
- IN UINTN Address,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 OrData
)
{
return PciExpressOr8 (Address, OrData);
@@ -146,8 +145,8 @@ PciOr8 (
UINT8
EFIAPI
PciAnd8 (
- IN UINTN Address,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINT8 AndData
)
{
return PciExpressAnd8 (Address, AndData);
@@ -178,9 +177,9 @@ PciAnd8 (
UINT8
EFIAPI
PciAndThenOr8 (
- IN UINTN Address,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
return PciExpressAndThenOr8 (Address, AndData, OrData);
@@ -210,9 +209,9 @@ PciAndThenOr8 (
UINT8
EFIAPI
PciBitFieldRead8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return PciExpressBitFieldRead8 (Address, StartBit, EndBit);
@@ -245,10 +244,10 @@ PciBitFieldRead8 (
UINT8
EFIAPI
PciBitFieldWrite8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
return PciExpressBitFieldWrite8 (Address, StartBit, EndBit, Value);
@@ -284,10 +283,10 @@ PciBitFieldWrite8 (
UINT8
EFIAPI
PciBitFieldOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
return PciExpressBitFieldOr8 (Address, StartBit, EndBit, OrData);
@@ -323,10 +322,10 @@ PciBitFieldOr8 (
UINT8
EFIAPI
PciBitFieldAnd8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
return PciExpressBitFieldAnd8 (Address, StartBit, EndBit, AndData);
@@ -366,11 +365,11 @@ PciBitFieldAnd8 (
UINT8
EFIAPI
PciBitFieldAndThenOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
return PciExpressBitFieldAndThenOr8 (Address, StartBit, EndBit, AndData, OrData);
@@ -395,7 +394,7 @@ PciBitFieldAndThenOr8 (
UINT16
EFIAPI
PciRead16 (
- IN UINTN Address
+ IN UINTN Address
)
{
return PciExpressRead16 (Address);
@@ -421,8 +420,8 @@ PciRead16 (
UINT16
EFIAPI
PciWrite16 (
- IN UINTN Address,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINT16 Value
)
{
return PciExpressWrite16 (Address, Value);
@@ -452,8 +451,8 @@ PciWrite16 (
UINT16
EFIAPI
PciOr16 (
- IN UINTN Address,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 OrData
)
{
return PciExpressOr16 (Address, OrData);
@@ -483,8 +482,8 @@ PciOr16 (
UINT16
EFIAPI
PciAnd16 (
- IN UINTN Address,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINT16 AndData
)
{
return PciExpressAnd16 (Address, AndData);
@@ -516,9 +515,9 @@ PciAnd16 (
UINT16
EFIAPI
PciAndThenOr16 (
- IN UINTN Address,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
return PciExpressAndThenOr16 (Address, AndData, OrData);
@@ -549,9 +548,9 @@ PciAndThenOr16 (
UINT16
EFIAPI
PciBitFieldRead16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return PciExpressBitFieldRead16 (Address, StartBit, EndBit);
@@ -585,10 +584,10 @@ PciBitFieldRead16 (
UINT16
EFIAPI
PciBitFieldWrite16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
return PciExpressBitFieldWrite16 (Address, StartBit, EndBit, Value);
@@ -625,10 +624,10 @@ PciBitFieldWrite16 (
UINT16
EFIAPI
PciBitFieldOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
return PciExpressBitFieldOr16 (Address, StartBit, EndBit, OrData);
@@ -665,10 +664,10 @@ PciBitFieldOr16 (
UINT16
EFIAPI
PciBitFieldAnd16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
return PciExpressBitFieldAnd16 (Address, StartBit, EndBit, AndData);
@@ -709,11 +708,11 @@ PciBitFieldAnd16 (
UINT16
EFIAPI
PciBitFieldAndThenOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
return PciExpressBitFieldAndThenOr16 (Address, StartBit, EndBit, AndData, OrData);
@@ -738,7 +737,7 @@ PciBitFieldAndThenOr16 (
UINT32
EFIAPI
PciRead32 (
- IN UINTN Address
+ IN UINTN Address
)
{
return PciExpressRead32 (Address);
@@ -764,8 +763,8 @@ PciRead32 (
UINT32
EFIAPI
PciWrite32 (
- IN UINTN Address,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINT32 Value
)
{
return PciExpressWrite32 (Address, Value);
@@ -795,8 +794,8 @@ PciWrite32 (
UINT32
EFIAPI
PciOr32 (
- IN UINTN Address,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 OrData
)
{
return PciExpressOr32 (Address, OrData);
@@ -826,8 +825,8 @@ PciOr32 (
UINT32
EFIAPI
PciAnd32 (
- IN UINTN Address,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINT32 AndData
)
{
return PciExpressAnd32 (Address, AndData);
@@ -859,9 +858,9 @@ PciAnd32 (
UINT32
EFIAPI
PciAndThenOr32 (
- IN UINTN Address,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return PciExpressAndThenOr32 (Address, AndData, OrData);
@@ -892,9 +891,9 @@ PciAndThenOr32 (
UINT32
EFIAPI
PciBitFieldRead32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return PciExpressBitFieldRead32 (Address, StartBit, EndBit);
@@ -928,10 +927,10 @@ PciBitFieldRead32 (
UINT32
EFIAPI
PciBitFieldWrite32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
return PciExpressBitFieldWrite32 (Address, StartBit, EndBit, Value);
@@ -968,10 +967,10 @@ PciBitFieldWrite32 (
UINT32
EFIAPI
PciBitFieldOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
return PciExpressBitFieldOr32 (Address, StartBit, EndBit, OrData);
@@ -1008,10 +1007,10 @@ PciBitFieldOr32 (
UINT32
EFIAPI
PciBitFieldAnd32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
return PciExpressBitFieldAnd32 (Address, StartBit, EndBit, AndData);
@@ -1052,11 +1051,11 @@ PciBitFieldAnd32 (
UINT32
EFIAPI
PciBitFieldAndThenOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return PciExpressBitFieldAndThenOr32 (Address, StartBit, EndBit, AndData, OrData);
@@ -1088,9 +1087,9 @@ PciBitFieldAndThenOr32 (
UINTN
EFIAPI
PciReadBuffer (
- IN UINTN StartAddress,
- IN UINTN Size,
- OUT VOID *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Size,
+ OUT VOID *Buffer
)
{
return PciExpressReadBuffer (StartAddress, Size, Buffer);
@@ -1123,9 +1122,9 @@ PciReadBuffer (
UINTN
EFIAPI
PciWriteBuffer (
- IN UINTN StartAddress,
- IN UINTN Size,
- IN VOID *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Size,
+ IN VOID *Buffer
)
{
return PciExpressWriteBuffer (StartAddress, Size, Buffer);
diff --git a/MdePkg/Library/BasePciSegmentLibPci/PciSegmentLib.c b/MdePkg/Library/BasePciSegmentLibPci/PciSegmentLib.c
index 95cab4aede..5946bdc3f5 100644
--- a/MdePkg/Library/BasePciSegmentLibPci/PciSegmentLib.c
+++ b/MdePkg/Library/BasePciSegmentLibPci/PciSegmentLib.c
@@ -22,7 +22,7 @@
@param M Additional bits to assert to be zero.
**/
-#define ASSERT_INVALID_PCI_SEGMENT_ADDRESS(A,M) \
+#define ASSERT_INVALID_PCI_SEGMENT_ADDRESS(A, M) \
ASSERT (((A) & (0xfffffffff0000000ULL | (M))) == 0)
/**
@@ -30,7 +30,7 @@
@param A The address to convert.
**/
-#define PCI_SEGMENT_TO_PCI_ADDRESS(A) ((UINTN) (UINT32) A)
+#define PCI_SEGMENT_TO_PCI_ADDRESS(A) ((UINTN) (UINT32) A)
/**
Register a PCI device so PCI configuration registers may be accessed after
@@ -76,7 +76,7 @@ PciSegmentRegisterForRuntimeAccess (
UINT8
EFIAPI
PciSegmentRead8 (
- IN UINT64 Address
+ IN UINT64 Address
)
{
ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0);
@@ -101,8 +101,8 @@ PciSegmentRead8 (
UINT8
EFIAPI
PciSegmentWrite8 (
- IN UINT64 Address,
- IN UINT8 Value
+ IN UINT64 Address,
+ IN UINT8 Value
)
{
ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0);
@@ -130,11 +130,11 @@ PciSegmentWrite8 (
UINT8
EFIAPI
PciSegmentOr8 (
- IN UINT64 Address,
- IN UINT8 OrData
+ IN UINT64 Address,
+ IN UINT8 OrData
)
{
- return PciWrite8 (PCI_SEGMENT_TO_PCI_ADDRESS (Address), (UINT8) (PciSegmentRead8 (Address) | OrData));
+ return PciWrite8 (PCI_SEGMENT_TO_PCI_ADDRESS (Address), (UINT8)(PciSegmentRead8 (Address) | OrData));
}
/**
@@ -156,11 +156,11 @@ PciSegmentOr8 (
UINT8
EFIAPI
PciSegmentAnd8 (
- IN UINT64 Address,
- IN UINT8 AndData
+ IN UINT64 Address,
+ IN UINT8 AndData
)
{
- return PciSegmentWrite8 (Address, (UINT8) (PciSegmentRead8 (Address) & AndData));
+ return PciSegmentWrite8 (Address, (UINT8)(PciSegmentRead8 (Address) & AndData));
}
/**
@@ -186,12 +186,12 @@ PciSegmentAnd8 (
UINT8
EFIAPI
PciSegmentAndThenOr8 (
- IN UINT64 Address,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINT64 Address,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
- return PciSegmentWrite8 (Address, (UINT8) ((PciSegmentRead8 (Address) & AndData) | OrData));
+ return PciSegmentWrite8 (Address, (UINT8)((PciSegmentRead8 (Address) & AndData) | OrData));
}
/**
@@ -218,9 +218,9 @@ PciSegmentAndThenOr8 (
UINT8
EFIAPI
PciSegmentBitFieldRead8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead8 (PciSegmentRead8 (Address), StartBit, EndBit);
@@ -253,10 +253,10 @@ PciSegmentBitFieldRead8 (
UINT8
EFIAPI
PciSegmentBitFieldWrite8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
return PciSegmentWrite8 (
@@ -295,10 +295,10 @@ PciSegmentBitFieldWrite8 (
UINT8
EFIAPI
PciSegmentBitFieldOr8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
return PciSegmentWrite8 (
@@ -337,10 +337,10 @@ PciSegmentBitFieldOr8 (
UINT8
EFIAPI
PciSegmentBitFieldAnd8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
return PciSegmentWrite8 (
@@ -382,11 +382,11 @@ PciSegmentBitFieldAnd8 (
UINT8
EFIAPI
PciSegmentBitFieldAndThenOr8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
return PciSegmentWrite8 (
@@ -412,7 +412,7 @@ PciSegmentBitFieldAndThenOr8 (
UINT16
EFIAPI
PciSegmentRead16 (
- IN UINT64 Address
+ IN UINT64 Address
)
{
ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 1);
@@ -438,8 +438,8 @@ PciSegmentRead16 (
UINT16
EFIAPI
PciSegmentWrite16 (
- IN UINT64 Address,
- IN UINT16 Value
+ IN UINT64 Address,
+ IN UINT16 Value
)
{
ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 1);
@@ -470,11 +470,11 @@ PciSegmentWrite16 (
UINT16
EFIAPI
PciSegmentOr16 (
- IN UINT64 Address,
- IN UINT16 OrData
+ IN UINT64 Address,
+ IN UINT16 OrData
)
{
- return PciSegmentWrite16 (Address, (UINT16) (PciSegmentRead16 (Address) | OrData));
+ return PciSegmentWrite16 (Address, (UINT16)(PciSegmentRead16 (Address) | OrData));
}
/**
@@ -498,11 +498,11 @@ PciSegmentOr16 (
UINT16
EFIAPI
PciSegmentAnd16 (
- IN UINT64 Address,
- IN UINT16 AndData
+ IN UINT64 Address,
+ IN UINT16 AndData
)
{
- return PciSegmentWrite16 (Address, (UINT16) (PciSegmentRead16 (Address) & AndData));
+ return PciSegmentWrite16 (Address, (UINT16)(PciSegmentRead16 (Address) & AndData));
}
/**
@@ -529,12 +529,12 @@ PciSegmentAnd16 (
UINT16
EFIAPI
PciSegmentAndThenOr16 (
- IN UINT64 Address,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINT64 Address,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
- return PciSegmentWrite16 (Address, (UINT16) ((PciSegmentRead16 (Address) & AndData) | OrData));
+ return PciSegmentWrite16 (Address, (UINT16)((PciSegmentRead16 (Address) & AndData) | OrData));
}
/**
@@ -562,9 +562,9 @@ PciSegmentAndThenOr16 (
UINT16
EFIAPI
PciSegmentBitFieldRead16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead16 (PciSegmentRead16 (Address), StartBit, EndBit);
@@ -598,10 +598,10 @@ PciSegmentBitFieldRead16 (
UINT16
EFIAPI
PciSegmentBitFieldWrite16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
return PciSegmentWrite16 (
@@ -641,10 +641,10 @@ PciSegmentBitFieldWrite16 (
UINT16
EFIAPI
PciSegmentBitFieldOr16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
return PciSegmentWrite16 (
@@ -684,10 +684,10 @@ PciSegmentBitFieldOr16 (
UINT16
EFIAPI
PciSegmentBitFieldAnd16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
return PciSegmentWrite16 (
@@ -730,11 +730,11 @@ PciSegmentBitFieldAnd16 (
UINT16
EFIAPI
PciSegmentBitFieldAndThenOr16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
return PciSegmentWrite16 (
@@ -760,7 +760,7 @@ PciSegmentBitFieldAndThenOr16 (
UINT32
EFIAPI
PciSegmentRead32 (
- IN UINT64 Address
+ IN UINT64 Address
)
{
ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 3);
@@ -786,8 +786,8 @@ PciSegmentRead32 (
UINT32
EFIAPI
PciSegmentWrite32 (
- IN UINT64 Address,
- IN UINT32 Value
+ IN UINT64 Address,
+ IN UINT32 Value
)
{
ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 3);
@@ -816,8 +816,8 @@ PciSegmentWrite32 (
UINT32
EFIAPI
PciSegmentOr32 (
- IN UINT64 Address,
- IN UINT32 OrData
+ IN UINT64 Address,
+ IN UINT32 OrData
)
{
return PciSegmentWrite32 (Address, PciSegmentRead32 (Address) | OrData);
@@ -844,8 +844,8 @@ PciSegmentOr32 (
UINT32
EFIAPI
PciSegmentAnd32 (
- IN UINT64 Address,
- IN UINT32 AndData
+ IN UINT64 Address,
+ IN UINT32 AndData
)
{
return PciSegmentWrite32 (Address, PciSegmentRead32 (Address) & AndData);
@@ -875,9 +875,9 @@ PciSegmentAnd32 (
UINT32
EFIAPI
PciSegmentAndThenOr32 (
- IN UINT64 Address,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINT64 Address,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return PciSegmentWrite32 (Address, (PciSegmentRead32 (Address) & AndData) | OrData);
@@ -908,9 +908,9 @@ PciSegmentAndThenOr32 (
UINT32
EFIAPI
PciSegmentBitFieldRead32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead32 (PciSegmentRead32 (Address), StartBit, EndBit);
@@ -944,10 +944,10 @@ PciSegmentBitFieldRead32 (
UINT32
EFIAPI
PciSegmentBitFieldWrite32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
return PciSegmentWrite32 (
@@ -986,10 +986,10 @@ PciSegmentBitFieldWrite32 (
UINT32
EFIAPI
PciSegmentBitFieldOr32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
return PciSegmentWrite32 (
@@ -1028,10 +1028,10 @@ PciSegmentBitFieldOr32 (
UINT32
EFIAPI
PciSegmentBitFieldAnd32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
return PciSegmentWrite32 (
@@ -1074,11 +1074,11 @@ PciSegmentBitFieldAnd32 (
UINT32
EFIAPI
PciSegmentBitFieldAndThenOr32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return PciSegmentWrite32 (
@@ -1113,12 +1113,12 @@ PciSegmentBitFieldAndThenOr32 (
UINTN
EFIAPI
PciSegmentReadBuffer (
- IN UINT64 StartAddress,
- IN UINTN Size,
- OUT VOID *Buffer
+ IN UINT64 StartAddress,
+ IN UINTN Size,
+ OUT VOID *Buffer
)
{
- UINTN ReturnValue;
+ UINTN ReturnValue;
ASSERT_INVALID_PCI_SEGMENT_ADDRESS (StartAddress, 0);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
@@ -1139,19 +1139,19 @@ PciSegmentReadBuffer (
// Read a byte if StartAddress is byte aligned
//
*(volatile UINT8 *)Buffer = PciSegmentRead8 (StartAddress);
- StartAddress += sizeof (UINT8);
- Size -= sizeof (UINT8);
- Buffer = (UINT8*)Buffer + 1;
+ StartAddress += sizeof (UINT8);
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *)Buffer + 1;
}
- if (Size >= sizeof (UINT16) && (StartAddress & BIT1) != 0) {
+ if ((Size >= sizeof (UINT16)) && ((StartAddress & BIT1) != 0)) {
//
// Read a word if StartAddress is word aligned
//
WriteUnaligned16 (Buffer, PciSegmentRead16 (StartAddress));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
while (Size >= sizeof (UINT32)) {
@@ -1160,8 +1160,8 @@ PciSegmentReadBuffer (
//
WriteUnaligned32 (Buffer, PciSegmentRead32 (StartAddress));
StartAddress += sizeof (UINT32);
- Size -= sizeof (UINT32);
- Buffer = (UINT32*)Buffer + 1;
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *)Buffer + 1;
}
if (Size >= sizeof (UINT16)) {
@@ -1170,8 +1170,8 @@ PciSegmentReadBuffer (
//
WriteUnaligned16 (Buffer, PciSegmentRead16 (StartAddress));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
if (Size >= sizeof (UINT8)) {
@@ -1211,12 +1211,12 @@ PciSegmentReadBuffer (
UINTN
EFIAPI
PciSegmentWriteBuffer (
- IN UINT64 StartAddress,
- IN UINTN Size,
- IN VOID *Buffer
+ IN UINT64 StartAddress,
+ IN UINTN Size,
+ IN VOID *Buffer
)
{
- UINTN ReturnValue;
+ UINTN ReturnValue;
ASSERT_INVALID_PCI_SEGMENT_ADDRESS (StartAddress, 0);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
@@ -1236,20 +1236,20 @@ PciSegmentWriteBuffer (
//
// Write a byte if StartAddress is byte aligned
//
- PciSegmentWrite8 (StartAddress, *(UINT8*) Buffer);
+ PciSegmentWrite8 (StartAddress, *(UINT8 *)Buffer);
StartAddress += sizeof (UINT8);
- Size -= sizeof (UINT8);
- Buffer = (UINT8*) Buffer + 1;
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *)Buffer + 1;
}
- if (Size >= sizeof (UINT16) && (StartAddress & BIT1) != 0) {
+ if ((Size >= sizeof (UINT16)) && ((StartAddress & BIT1) != 0)) {
//
// Write a word if StartAddress is word aligned
//
PciSegmentWrite16 (StartAddress, ReadUnaligned16 (Buffer));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*) Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
while (Size >= sizeof (UINT32)) {
@@ -1258,8 +1258,8 @@ PciSegmentWriteBuffer (
//
PciSegmentWrite32 (StartAddress, ReadUnaligned32 (Buffer));
StartAddress += sizeof (UINT32);
- Size -= sizeof (UINT32);
- Buffer = (UINT32*) Buffer + 1;
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *)Buffer + 1;
}
if (Size >= sizeof (UINT16)) {
@@ -1268,15 +1268,15 @@ PciSegmentWriteBuffer (
//
PciSegmentWrite16 (StartAddress, ReadUnaligned16 (Buffer));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*) Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
if (Size >= sizeof (UINT8)) {
//
// Write the last remaining byte if exist
//
- PciSegmentWrite8 (StartAddress, *(UINT8*) Buffer);
+ PciSegmentWrite8 (StartAddress, *(UINT8 *)Buffer);
}
return ReturnValue;
diff --git a/MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c b/MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c
index cf10fc5fe4..00b645a101 100644
--- a/MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c
+++ b/MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c
@@ -8,7 +8,6 @@
**/
-
#include <Base.h>
#include <Library/PeCoffGetEntryPointLib.h>
@@ -16,7 +15,7 @@
#include <IndustryStandard/PeImage.h>
-#define PE_COFF_IMAGE_ALIGN_SIZE 4
+#define PE_COFF_IMAGE_ALIGN_SIZE 4
/**
Retrieves and returns a pointer to the entry point to a PE/COFF image that has been loaded
@@ -42,8 +41,8 @@ PeCoffLoaderGetEntryPoint (
OUT VOID **EntryPoint
)
{
- EFI_IMAGE_DOS_HEADER *DosHdr;
- EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;
+ EFI_IMAGE_DOS_HEADER *DosHdr;
+ EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;
ASSERT (Pe32Data != NULL);
ASSERT (EntryPoint != NULL);
@@ -53,7 +52,7 @@ PeCoffLoaderGetEntryPoint (
//
// DOS image header is present, so read the PE header after the DOS image header.
//
- Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN) Pe32Data + (UINTN) ((DosHdr->e_lfanew) & 0x0ffff));
+ Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN)Pe32Data + (UINTN)((DosHdr->e_lfanew) & 0x0ffff));
} else {
//
// DOS image header is not present, so PE header is at the image base.
@@ -66,7 +65,7 @@ PeCoffLoaderGetEntryPoint (
// AddressOfEntryPoint is common for PE32 & PE32+
//
if (Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) {
- *EntryPoint = (VOID *)((UINTN)Pe32Data + (UINTN)(Hdr.Te->AddressOfEntryPoint & 0x0ffffffff) + sizeof(EFI_TE_IMAGE_HEADER) - Hdr.Te->StrippedSize);
+ *EntryPoint = (VOID *)((UINTN)Pe32Data + (UINTN)(Hdr.Te->AddressOfEntryPoint & 0x0ffffffff) + sizeof (EFI_TE_IMAGE_HEADER) - Hdr.Te->StrippedSize);
return RETURN_SUCCESS;
} else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) {
*EntryPoint = (VOID *)((UINTN)Pe32Data + (UINTN)(Hdr.Pe32->OptionalHeader.AddressOfEntryPoint & 0x0ffffffff));
@@ -76,7 +75,6 @@ PeCoffLoaderGetEntryPoint (
return RETURN_UNSUPPORTED;
}
-
/**
Returns the machine type of a PE/COFF image.
@@ -105,7 +103,7 @@ PeCoffLoaderGetMachineType (
//
// DOS image header is present, so read the PE header after the DOS image header.
//
- Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN) Pe32Data + (UINTN) ((DosHdr->e_lfanew) & 0x0ffff));
+ Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN)Pe32Data + (UINTN)((DosHdr->e_lfanew) & 0x0ffff));
} else {
//
// DOS image header is not present, so PE header is at the image base.
@@ -115,7 +113,7 @@ PeCoffLoaderGetMachineType (
if (Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) {
return Hdr.Te->Machine;
- } else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) {
+ } else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) {
return Hdr.Pe32->FileHeader.Machine;
}
@@ -147,15 +145,15 @@ PeCoffLoaderGetPdbPointer (
IN VOID *Pe32Data
)
{
- EFI_IMAGE_DOS_HEADER *DosHdr;
- EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;
- EFI_IMAGE_DATA_DIRECTORY *DirectoryEntry;
- EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *DebugEntry;
- UINTN DirCount;
- VOID *CodeViewEntryPointer;
- INTN TEImageAdjust;
- UINT32 NumberOfRvaAndSizes;
- UINT16 Magic;
+ EFI_IMAGE_DOS_HEADER *DosHdr;
+ EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;
+ EFI_IMAGE_DATA_DIRECTORY *DirectoryEntry;
+ EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *DebugEntry;
+ UINTN DirCount;
+ VOID *CodeViewEntryPointer;
+ INTN TEImageAdjust;
+ UINT32 NumberOfRvaAndSizes;
+ UINT16 Magic;
ASSERT (Pe32Data != NULL);
@@ -169,7 +167,7 @@ PeCoffLoaderGetPdbPointer (
//
// DOS image header is present, so read the PE header after the DOS image header.
//
- Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN) Pe32Data + (UINTN) ((DosHdr->e_lfanew) & 0x0ffff));
+ Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN)Pe32Data + (UINTN)((DosHdr->e_lfanew) & 0x0ffff));
} else {
//
// DOS image header is not present, so PE header is at the image base.
@@ -179,11 +177,11 @@ PeCoffLoaderGetPdbPointer (
if (Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_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;
- DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *)((UINTN) Hdr.Te +
- Hdr.Te->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress +
- TEImageAdjust);
+ DirectoryEntry = &Hdr.Te->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG];
+ TEImageAdjust = sizeof (EFI_TE_IMAGE_HEADER) - Hdr.Te->StrippedSize;
+ DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *)((UINTN)Hdr.Te +
+ Hdr.Te->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress +
+ TEImageAdjust);
}
} else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) {
//
@@ -192,24 +190,24 @@ PeCoffLoaderGetPdbPointer (
// generate PE32+ image with PE32 Magic.
//
switch (Hdr.Pe32->FileHeader.Machine) {
- case IMAGE_FILE_MACHINE_I386:
- //
- // Assume PE32 image with IA32 Machine field.
- //
- Magic = EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC;
- break;
- case IMAGE_FILE_MACHINE_X64:
- case IMAGE_FILE_MACHINE_IA64:
- //
- // Assume PE32+ image with x64 or IA64 Machine field
- //
- Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC;
- break;
- default:
- //
- // For unknow Machine field, use Magic in optional Header
- //
- Magic = Hdr.Pe32->OptionalHeader.Magic;
+ case IMAGE_FILE_MACHINE_I386:
+ //
+ // Assume PE32 image with IA32 Machine field.
+ //
+ Magic = EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC;
+ break;
+ case IMAGE_FILE_MACHINE_X64:
+ case IMAGE_FILE_MACHINE_IA64:
+ //
+ // Assume PE32+ image with x64 or IA64 Machine field
+ //
+ Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC;
+ break;
+ default:
+ //
+ // For unknow Machine field, use Magic in optional Header
+ //
+ Magic = Hdr.Pe32->OptionalHeader.Magic;
}
if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
@@ -217,26 +215,26 @@ PeCoffLoaderGetPdbPointer (
// Use PE32 offset get Debug Directory Entry
//
NumberOfRvaAndSizes = Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes;
- DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
- DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *) ((UINTN) Pe32Data + DirectoryEntry->VirtualAddress);
+ DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
+ DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *)((UINTN)Pe32Data + DirectoryEntry->VirtualAddress);
} else if (Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
//
// Use PE32+ offset get Debug Directory Entry
//
NumberOfRvaAndSizes = Hdr.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes;
- DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
- DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *) ((UINTN) Pe32Data + DirectoryEntry->VirtualAddress);
+ DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
+ DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *)((UINTN)Pe32Data + DirectoryEntry->VirtualAddress);
}
if (NumberOfRvaAndSizes <= EFI_IMAGE_DIRECTORY_ENTRY_DEBUG) {
DirectoryEntry = NULL;
- DebugEntry = NULL;
+ DebugEntry = NULL;
}
} else {
return NULL;
}
- if (DebugEntry == NULL || DirectoryEntry == NULL) {
+ if ((DebugEntry == NULL) || (DirectoryEntry == NULL)) {
return NULL;
}
@@ -246,16 +244,16 @@ PeCoffLoaderGetPdbPointer (
for (DirCount = 0; DirCount < DirectoryEntry->Size; DirCount += sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY), DebugEntry++) {
if (DebugEntry->Type == EFI_IMAGE_DEBUG_TYPE_CODEVIEW) {
if (DebugEntry->SizeOfData > 0) {
- CodeViewEntryPointer = (VOID *) ((UINTN) DebugEntry->RVA + ((UINTN)Pe32Data) + (UINTN)TEImageAdjust);
- switch (* (UINT32 *) CodeViewEntryPointer) {
- case CODEVIEW_SIGNATURE_NB10:
- return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY));
- case CODEVIEW_SIGNATURE_RSDS:
- return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY));
- case CODEVIEW_SIGNATURE_MTOC:
- return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY));
- default:
- break;
+ CodeViewEntryPointer = (VOID *)((UINTN)DebugEntry->RVA + ((UINTN)Pe32Data) + (UINTN)TEImageAdjust);
+ switch (*(UINT32 *)CodeViewEntryPointer) {
+ case CODEVIEW_SIGNATURE_NB10:
+ return (VOID *)((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY));
+ case CODEVIEW_SIGNATURE_RSDS:
+ return (VOID *)((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY));
+ case CODEVIEW_SIGNATURE_MTOC:
+ return (VOID *)((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY));
+ default:
+ break;
}
}
}
@@ -279,12 +277,12 @@ PeCoffLoaderGetPdbPointer (
UINT32
EFIAPI
PeCoffGetSizeOfHeaders (
- IN VOID *Pe32Data
+ IN VOID *Pe32Data
)
{
- EFI_IMAGE_DOS_HEADER *DosHdr;
- EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;
- UINTN SizeOfHeaders;
+ EFI_IMAGE_DOS_HEADER *DosHdr;
+ EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;
+ UINTN SizeOfHeaders;
ASSERT (Pe32Data != NULL);
@@ -293,7 +291,7 @@ PeCoffGetSizeOfHeaders (
//
// DOS image header is present, so read the PE header after the DOS image header.
//
- Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN) Pe32Data + (UINTN) ((DosHdr->e_lfanew) & 0x0ffff));
+ Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN)Pe32Data + (UINTN)((DosHdr->e_lfanew) & 0x0ffff));
} else {
//
// DOS image header is not present, so PE header is at the image base.
@@ -309,7 +307,7 @@ PeCoffGetSizeOfHeaders (
SizeOfHeaders = 0;
}
- return (UINT32) SizeOfHeaders;
+ return (UINT32)SizeOfHeaders;
}
/**
@@ -327,55 +325,57 @@ PeCoffGetSizeOfHeaders (
UINTN
EFIAPI
PeCoffSearchImageBase (
- IN UINTN Address
+ IN UINTN Address
)
{
- UINTN Pe32Data;
+ UINTN Pe32Data;
Pe32Data = 0;
DEBUG_CODE_BEGIN ();
- EFI_IMAGE_DOS_HEADER *DosHdr;
- EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;
+ EFI_IMAGE_DOS_HEADER *DosHdr;
+ EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;
- //
- // Find Image Base
- //
- Pe32Data = Address & ~(PE_COFF_IMAGE_ALIGN_SIZE - 1);
- while (Pe32Data != 0) {
- DosHdr = (EFI_IMAGE_DOS_HEADER *) Pe32Data;
- if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
- //
- // DOS image header is present, so read the PE header after the DOS image header.
- //
- Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)(Pe32Data + (UINTN) ((DosHdr->e_lfanew) & 0x0ffff));
- //
- // Make sure PE header address does not overflow and is less than the initial address.
- //
- if (((UINTN)Hdr.Pe32 > Pe32Data) && ((UINTN)Hdr.Pe32 < Address)) {
- if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) {
- break;
- }
- }
- } else {
- //
- // DOS image header is not present, TE header is at the image base.
- //
- Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)Pe32Data;
- if ((Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) &&
- ((Hdr.Te->Machine == IMAGE_FILE_MACHINE_I386) || (Hdr.Te->Machine == IMAGE_FILE_MACHINE_IA64) ||
- (Hdr.Te->Machine == IMAGE_FILE_MACHINE_EBC) || (Hdr.Te->Machine == IMAGE_FILE_MACHINE_X64) ||
- (Hdr.Te->Machine == IMAGE_FILE_MACHINE_ARM64) || (Hdr.Te->Machine == IMAGE_FILE_MACHINE_ARMTHUMB_MIXED))
- ) {
+ //
+ // Find Image Base
+ //
+ Pe32Data = Address & ~(PE_COFF_IMAGE_ALIGN_SIZE - 1);
+ while (Pe32Data != 0) {
+ DosHdr = (EFI_IMAGE_DOS_HEADER *)Pe32Data;
+ if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
+ //
+ // DOS image header is present, so read the PE header after the DOS image header.
+ //
+ Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)(Pe32Data + (UINTN)((DosHdr->e_lfanew) & 0x0ffff));
+ //
+ // Make sure PE header address does not overflow and is less than the initial address.
+ //
+ if (((UINTN)Hdr.Pe32 > Pe32Data) && ((UINTN)Hdr.Pe32 < Address)) {
+ if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) {
break;
}
}
-
+ } else {
//
- // Not found the image base, check the previous aligned address
+ // DOS image header is not present, TE header is at the image base.
//
- Pe32Data -= PE_COFF_IMAGE_ALIGN_SIZE;
+ Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)Pe32Data;
+ if ((Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) &&
+ ((Hdr.Te->Machine == IMAGE_FILE_MACHINE_I386) || (Hdr.Te->Machine == IMAGE_FILE_MACHINE_IA64) ||
+ (Hdr.Te->Machine == IMAGE_FILE_MACHINE_EBC) || (Hdr.Te->Machine == IMAGE_FILE_MACHINE_X64) ||
+ (Hdr.Te->Machine == IMAGE_FILE_MACHINE_ARM64) || (Hdr.Te->Machine == IMAGE_FILE_MACHINE_ARMTHUMB_MIXED))
+ )
+ {
+ break;
+ }
}
+
+ //
+ // Not found the image base, check the previous aligned address
+ //
+ Pe32Data -= PE_COFF_IMAGE_ALIGN_SIZE;
+ }
+
DEBUG_CODE_END ();
return Pe32Data;
diff --git a/MdePkg/Library/BasePeCoffLib/Arm/PeCoffLoaderEx.c b/MdePkg/Library/BasePeCoffLib/Arm/PeCoffLoaderEx.c
index a851a448d6..595377bed6 100644
--- a/MdePkg/Library/BasePeCoffLib/Arm/PeCoffLoaderEx.c
+++ b/MdePkg/Library/BasePeCoffLib/Arm/PeCoffLoaderEx.c
@@ -10,7 +10,6 @@
#include "BasePeCoffLibInternals.h"
#include <Library/BaseLib.h>
-
/**
Pass in a pointer to an ARM MOVT or MOVW immediate instruciton and
return the immediate data encoded in the instruction.
@@ -22,7 +21,7 @@
**/
UINT16
ThumbMovtImmediateAddress (
- IN UINT16 *Instruction
+ IN UINT16 *Instruction
)
{
UINT32 Movt;
@@ -43,7 +42,6 @@ ThumbMovtImmediateAddress (
return Address;
}
-
/**
Update an ARM MOVT or MOVW immediate instruction immediate data.
@@ -52,14 +50,14 @@ ThumbMovtImmediateAddress (
**/
VOID
ThumbMovtImmediatePatch (
- IN OUT UINT16 *Instruction,
- IN UINT16 Address
+ IN OUT UINT16 *Instruction,
+ IN UINT16 Address
)
{
UINT16 Patch;
// First 16-bit chunk of instruciton
- Patch = ((Address >> 12) & 0x000f); // imm4
+ Patch = ((Address >> 12) & 0x000f); // imm4
Patch |= (((Address & BIT11) != 0) ? BIT10 : 0); // i
// Mask out instruction bits and or in address
*(Instruction) = (*Instruction & ~0x040f) | Patch;
@@ -72,8 +70,6 @@ ThumbMovtImmediatePatch (
*Instruction = (*Instruction & ~0x70ff) | Patch;
}
-
-
/**
Pass in a pointer to an ARM MOVW/MOVT instruciton pair and
return the immediate data encoded in the two` instruction.
@@ -85,7 +81,7 @@ ThumbMovtImmediatePatch (
**/
UINT32
ThumbMovwMovtImmediateAddress (
- IN UINT16 *Instructions
+ IN UINT16 *Instructions
)
{
UINT16 *Word;
@@ -97,7 +93,6 @@ ThumbMovwMovtImmediateAddress (
return (ThumbMovtImmediateAddress (Top) << 16) + ThumbMovtImmediateAddress (Word);
}
-
/**
Update an ARM MOVW/MOVT immediate instruction instruction pair.
@@ -106,8 +101,8 @@ ThumbMovwMovtImmediateAddress (
**/
VOID
ThumbMovwMovtImmediatePatch (
- IN OUT UINT16 *Instructions,
- IN UINT32 Address
+ IN OUT UINT16 *Instructions,
+ IN UINT32 Address
)
{
UINT16 *Word;
@@ -120,8 +115,6 @@ ThumbMovwMovtImmediatePatch (
ThumbMovtImmediatePatch (Top, (UINT16)(Address >> 16));
}
-
-
/**
Performs an ARM-based specific relocation fixup and is a no-op on other
instruction sets.
@@ -136,36 +129,36 @@ ThumbMovwMovtImmediatePatch (
**/
RETURN_STATUS
PeCoffLoaderRelocateImageEx (
- IN UINT16 *Reloc,
- IN OUT CHAR8 *Fixup,
- IN OUT CHAR8 **FixupData,
- IN UINT64 Adjust
+ IN UINT16 *Reloc,
+ IN OUT CHAR8 *Fixup,
+ IN OUT CHAR8 **FixupData,
+ IN UINT64 Adjust
)
{
- UINT16 *Fixup16;
- UINT32 FixupVal;
+ UINT16 *Fixup16;
+ UINT32 FixupVal;
- Fixup16 = (UINT16 *) Fixup;
+ Fixup16 = (UINT16 *)Fixup;
switch ((*Reloc) >> 12) {
+ case EFI_IMAGE_REL_BASED_ARM_MOV32T:
+ FixupVal = ThumbMovwMovtImmediateAddress (Fixup16) + (UINT32)Adjust;
+ ThumbMovwMovtImmediatePatch (Fixup16, FixupVal);
+
+ if (*FixupData != NULL) {
+ *FixupData = ALIGN_POINTER (*FixupData, sizeof (UINT64));
+ // Fixup16 is not aligned so we must copy it. Thumb instructions are streams of 16 bytes.
+ CopyMem (*FixupData, Fixup16, sizeof (UINT64));
+ *FixupData = *FixupData + sizeof (UINT64);
+ }
- case EFI_IMAGE_REL_BASED_ARM_MOV32T:
- FixupVal = ThumbMovwMovtImmediateAddress (Fixup16) + (UINT32)Adjust;
- ThumbMovwMovtImmediatePatch (Fixup16, FixupVal);
-
- if (*FixupData != NULL) {
- *FixupData = ALIGN_POINTER(*FixupData, sizeof(UINT64));
- // Fixup16 is not aligned so we must copy it. Thumb instructions are streams of 16 bytes.
- CopyMem (*FixupData, Fixup16, sizeof (UINT64));
- *FixupData = *FixupData + sizeof(UINT64);
- }
- break;
-
- case EFI_IMAGE_REL_BASED_ARM_MOV32A:
- ASSERT (FALSE);
- // break omitted - ARM instruction encoding not implemented
- default:
- return RETURN_UNSUPPORTED;
+ break;
+
+ case EFI_IMAGE_REL_BASED_ARM_MOV32A:
+ ASSERT (FALSE);
+ // break omitted - ARM instruction encoding not implemented
+ default:
+ return RETURN_UNSUPPORTED;
}
return RETURN_SUCCESS;
@@ -209,10 +202,10 @@ PeCoffLoaderImageFormatSupported (
**/
RETURN_STATUS
PeHotRelocateImageEx (
- IN UINT16 *Reloc,
- IN OUT CHAR8 *Fixup,
- IN OUT CHAR8 **FixupData,
- IN UINT64 Adjust
+ IN UINT16 *Reloc,
+ IN OUT CHAR8 *Fixup,
+ IN OUT CHAR8 **FixupData,
+ IN UINT64 Adjust
)
{
UINT16 *Fixup16;
@@ -221,22 +214,22 @@ PeHotRelocateImageEx (
Fixup16 = (UINT16 *)Fixup;
switch ((*Reloc) >> 12) {
-
- case EFI_IMAGE_REL_BASED_ARM_MOV32T:
- *FixupData = ALIGN_POINTER (*FixupData, sizeof (UINT64));
- if (*(UINT64 *) (*FixupData) == ReadUnaligned64 ((UINT64 *)Fixup16)) {
- FixupVal = ThumbMovwMovtImmediateAddress (Fixup16) + (UINT32)Adjust;
- ThumbMovwMovtImmediatePatch (Fixup16, FixupVal);
- }
- *FixupData = *FixupData + sizeof(UINT64);
- break;
-
- case EFI_IMAGE_REL_BASED_ARM_MOV32A:
- ASSERT (FALSE);
+ case EFI_IMAGE_REL_BASED_ARM_MOV32T:
+ *FixupData = ALIGN_POINTER (*FixupData, sizeof (UINT64));
+ if (*(UINT64 *)(*FixupData) == ReadUnaligned64 ((UINT64 *)Fixup16)) {
+ FixupVal = ThumbMovwMovtImmediateAddress (Fixup16) + (UINT32)Adjust;
+ ThumbMovwMovtImmediatePatch (Fixup16, FixupVal);
+ }
+
+ *FixupData = *FixupData + sizeof (UINT64);
+ break;
+
+ case EFI_IMAGE_REL_BASED_ARM_MOV32A:
+ ASSERT (FALSE);
// break omitted - ARM instruction encoding not implemented
- default:
- DEBUG ((DEBUG_ERROR, "PeHotRelocateEx:unknown fixed type\n"));
- return RETURN_UNSUPPORTED;
+ default:
+ DEBUG ((DEBUG_ERROR, "PeHotRelocateEx:unknown fixed type\n"));
+ return RETURN_UNSUPPORTED;
}
return RETURN_SUCCESS;
diff --git a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c
index 1102833b94..6d8d9faeb8 100644
--- a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c
+++ b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c
@@ -33,8 +33,8 @@
**/
VOID
PeCoffLoaderAdjustOffsetForTeImage (
- EFI_IMAGE_SECTION_HEADER *SectionHeader,
- UINT32 TeStrippedOffset
+ EFI_IMAGE_SECTION_HEADER *SectionHeader,
+ UINT32 TeStrippedOffset
)
{
SectionHeader->VirtualAddress -= TeStrippedOffset;
@@ -62,33 +62,34 @@ PeCoffLoaderGetPeHeader (
OUT EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr
)
{
- RETURN_STATUS Status;
- EFI_IMAGE_DOS_HEADER DosHdr;
- UINTN Size;
- UINTN ReadSize;
- UINT32 SectionHeaderOffset;
- UINT32 Index;
- UINT32 HeaderWithoutDataDir;
- CHAR8 BufferData;
- UINTN NumberOfSections;
+ RETURN_STATUS Status;
+ EFI_IMAGE_DOS_HEADER DosHdr;
+ UINTN Size;
+ UINTN ReadSize;
+ UINT32 SectionHeaderOffset;
+ UINT32 Index;
+ UINT32 HeaderWithoutDataDir;
+ CHAR8 BufferData;
+ UINTN NumberOfSections;
EFI_IMAGE_SECTION_HEADER SectionHeader;
//
// Read the DOS image header to check for its existence
//
- Size = sizeof (EFI_IMAGE_DOS_HEADER);
+ Size = sizeof (EFI_IMAGE_DOS_HEADER);
ReadSize = Size;
- Status = ImageContext->ImageRead (
- ImageContext->Handle,
- 0,
- &Size,
- &DosHdr
- );
+ Status = ImageContext->ImageRead (
+ ImageContext->Handle,
+ 0,
+ &Size,
+ &DosHdr
+ );
if (RETURN_ERROR (Status) || (Size != ReadSize)) {
ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
if (Size != ReadSize) {
Status = RETURN_UNSUPPORTED;
}
+
return Status;
}
@@ -107,19 +108,20 @@ PeCoffLoaderGetPeHeader (
// determines if this is a PE32 or PE32+ image. The magic is in the same
// location in both images.
//
- Size = sizeof (EFI_IMAGE_OPTIONAL_HEADER_UNION);
+ Size = sizeof (EFI_IMAGE_OPTIONAL_HEADER_UNION);
ReadSize = Size;
- Status = ImageContext->ImageRead (
- ImageContext->Handle,
- ImageContext->PeCoffHeaderOffset,
- &Size,
- Hdr.Pe32
- );
+ Status = ImageContext->ImageRead (
+ ImageContext->Handle,
+ ImageContext->PeCoffHeaderOffset,
+ &Size,
+ Hdr.Pe32
+ );
if (RETURN_ERROR (Status) || (Size != ReadSize)) {
ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
if (Size != ReadSize) {
Status = RETURN_UNSUPPORTED;
}
+
return Status;
}
@@ -127,16 +129,16 @@ PeCoffLoaderGetPeHeader (
// Use Signature to figure out if we understand the image format
//
if (Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) {
- ImageContext->IsTeImage = TRUE;
- ImageContext->Machine = Hdr.Te->Machine;
- ImageContext->ImageType = (UINT16)(Hdr.Te->Subsystem);
+ ImageContext->IsTeImage = TRUE;
+ ImageContext->Machine = Hdr.Te->Machine;
+ ImageContext->ImageType = (UINT16)(Hdr.Te->Subsystem);
//
// For TeImage, SectionAlignment is undefined to be set to Zero
// ImageSize can be calculated.
//
- ImageContext->ImageSize = 0;
- ImageContext->SectionAlignment = 0;
- ImageContext->SizeOfHeaders = sizeof (EFI_TE_IMAGE_HEADER) + (UINTN)Hdr.Te->BaseOfCode - (UINTN)Hdr.Te->StrippedSize;
+ ImageContext->ImageSize = 0;
+ ImageContext->SectionAlignment = 0;
+ ImageContext->SizeOfHeaders = sizeof (EFI_TE_IMAGE_HEADER) + (UINTN)Hdr.Te->BaseOfCode - (UINTN)Hdr.Te->StrippedSize;
//
// Check the StrippedSize.
@@ -157,19 +159,20 @@ PeCoffLoaderGetPeHeader (
//
// Read last byte of Hdr.Te->SizeOfHeaders from the file.
//
- Size = 1;
+ Size = 1;
ReadSize = Size;
- Status = ImageContext->ImageRead (
- ImageContext->Handle,
- ImageContext->SizeOfHeaders - 1,
- &Size,
- &BufferData
- );
+ Status = ImageContext->ImageRead (
+ ImageContext->Handle,
+ ImageContext->SizeOfHeaders - 1,
+ &Size,
+ &BufferData
+ );
if (RETURN_ERROR (Status) || (Size != ReadSize)) {
ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
if (Size != ReadSize) {
Status = RETURN_UNSUPPORTED;
}
+
return Status;
}
@@ -177,14 +180,15 @@ PeCoffLoaderGetPeHeader (
// TE Image Data Directory Entry size is non-zero, but the Data Directory Virtual Address is zero.
// This case is not a valid TE image.
//
- if ((Hdr.Te->DataDirectory[0].Size != 0 && Hdr.Te->DataDirectory[0].VirtualAddress == 0) ||
- (Hdr.Te->DataDirectory[1].Size != 0 && Hdr.Te->DataDirectory[1].VirtualAddress == 0)) {
+ if (((Hdr.Te->DataDirectory[0].Size != 0) && (Hdr.Te->DataDirectory[0].VirtualAddress == 0)) ||
+ ((Hdr.Te->DataDirectory[1].Size != 0) && (Hdr.Te->DataDirectory[1].VirtualAddress == 0)))
+ {
ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
return RETURN_UNSUPPORTED;
}
- } else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) {
+ } else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) {
ImageContext->IsTeImage = FALSE;
- ImageContext->Machine = Hdr.Pe32->FileHeader.Machine;
+ ImageContext->Machine = Hdr.Pe32->FileHeader.Machine;
if (Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
//
@@ -202,7 +206,8 @@ PeCoffLoaderGetPeHeader (
//
HeaderWithoutDataDir = sizeof (EFI_IMAGE_OPTIONAL_HEADER32) - sizeof (EFI_IMAGE_DATA_DIRECTORY) * EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES;
if (((UINT32)Hdr.Pe32->FileHeader.SizeOfOptionalHeader - HeaderWithoutDataDir) !=
- Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes * sizeof (EFI_IMAGE_DATA_DIRECTORY)) {
+ Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes * sizeof (EFI_IMAGE_DATA_DIRECTORY))
+ {
ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
return RETURN_UNSUPPORTED;
}
@@ -215,6 +220,7 @@ PeCoffLoaderGetPeHeader (
ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
return RETURN_UNSUPPORTED;
}
+
if ((Hdr.Pe32->OptionalHeader.SizeOfImage - SectionHeaderOffset) / EFI_IMAGE_SIZEOF_SECTION_HEADER <= Hdr.Pe32->FileHeader.NumberOfSections) {
ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
return RETURN_UNSUPPORTED;
@@ -227,10 +233,12 @@ PeCoffLoaderGetPeHeader (
ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
return RETURN_UNSUPPORTED;
}
+
if (Hdr.Pe32->OptionalHeader.SizeOfHeaders >= Hdr.Pe32->OptionalHeader.SizeOfImage) {
ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
return RETURN_UNSUPPORTED;
}
+
if ((Hdr.Pe32->OptionalHeader.SizeOfHeaders - SectionHeaderOffset) / EFI_IMAGE_SIZEOF_SECTION_HEADER < (UINT32)Hdr.Pe32->FileHeader.NumberOfSections) {
ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
return RETURN_UNSUPPORTED;
@@ -239,19 +247,20 @@ PeCoffLoaderGetPeHeader (
//
// 4.2 Read last byte of Hdr.Pe32.OptionalHeader.SizeOfHeaders from the file.
//
- Size = 1;
+ Size = 1;
ReadSize = Size;
- Status = ImageContext->ImageRead (
- ImageContext->Handle,
- Hdr.Pe32->OptionalHeader.SizeOfHeaders - 1,
- &Size,
- &BufferData
- );
+ Status = ImageContext->ImageRead (
+ ImageContext->Handle,
+ Hdr.Pe32->OptionalHeader.SizeOfHeaders - 1,
+ &Size,
+ &BufferData
+ );
if (RETURN_ERROR (Status) || (Size != ReadSize)) {
ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
if (Size != ReadSize) {
Status = RETURN_UNSUPPORTED;
}
+
return Status;
}
@@ -265,8 +274,9 @@ PeCoffLoaderGetPeHeader (
//
// Check the member data to avoid overflow.
//
- if ((UINT32) (~0) - Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY].VirtualAddress <
- Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY].Size) {
+ if ((UINT32)(~0) - Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY].VirtualAddress <
+ Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY].Size)
+ {
ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
return RETURN_UNSUPPORTED;
}
@@ -274,20 +284,21 @@ PeCoffLoaderGetPeHeader (
//
// Read last byte of section header from file
//
- Size = 1;
+ Size = 1;
ReadSize = Size;
- Status = ImageContext->ImageRead (
- ImageContext->Handle,
- Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY].VirtualAddress +
- Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY].Size - 1,
- &Size,
- &BufferData
- );
+ Status = ImageContext->ImageRead (
+ ImageContext->Handle,
+ Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY].VirtualAddress +
+ Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY].Size - 1,
+ &Size,
+ &BufferData
+ );
if (RETURN_ERROR (Status) || (Size != ReadSize)) {
ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
if (Size != ReadSize) {
Status = RETURN_UNSUPPORTED;
}
+
return Status;
}
}
@@ -296,11 +307,10 @@ PeCoffLoaderGetPeHeader (
//
// Use PE32 offset
//
- ImageContext->ImageType = Hdr.Pe32->OptionalHeader.Subsystem;
- ImageContext->ImageSize = (UINT64)Hdr.Pe32->OptionalHeader.SizeOfImage;
- ImageContext->SectionAlignment = Hdr.Pe32->OptionalHeader.SectionAlignment;
- ImageContext->SizeOfHeaders = Hdr.Pe32->OptionalHeader.SizeOfHeaders;
-
+ ImageContext->ImageType = Hdr.Pe32->OptionalHeader.Subsystem;
+ ImageContext->ImageSize = (UINT64)Hdr.Pe32->OptionalHeader.SizeOfImage;
+ ImageContext->SectionAlignment = Hdr.Pe32->OptionalHeader.SectionAlignment;
+ ImageContext->SizeOfHeaders = Hdr.Pe32->OptionalHeader.SizeOfHeaders;
} else if (Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
//
// 1. Check FileHeader.NumberOfRvaAndSizes filed.
@@ -309,6 +319,7 @@ PeCoffLoaderGetPeHeader (
ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
return RETURN_UNSUPPORTED;
}
+
//
// 2. Check the FileHeader.SizeOfOptionalHeader field.
// OptionalHeader.NumberOfRvaAndSizes is not bigger than 16, so
@@ -316,7 +327,8 @@ PeCoffLoaderGetPeHeader (
//
HeaderWithoutDataDir = sizeof (EFI_IMAGE_OPTIONAL_HEADER64) - sizeof (EFI_IMAGE_DATA_DIRECTORY) * EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES;
if (((UINT32)Hdr.Pe32Plus->FileHeader.SizeOfOptionalHeader - HeaderWithoutDataDir) !=
- Hdr.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes * sizeof (EFI_IMAGE_DATA_DIRECTORY)) {
+ Hdr.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes * sizeof (EFI_IMAGE_DATA_DIRECTORY))
+ {
ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
return RETURN_UNSUPPORTED;
}
@@ -329,6 +341,7 @@ PeCoffLoaderGetPeHeader (
ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
return RETURN_UNSUPPORTED;
}
+
if ((Hdr.Pe32Plus->OptionalHeader.SizeOfImage - SectionHeaderOffset) / EFI_IMAGE_SIZEOF_SECTION_HEADER <= Hdr.Pe32Plus->FileHeader.NumberOfSections) {
ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
return RETURN_UNSUPPORTED;
@@ -341,10 +354,12 @@ PeCoffLoaderGetPeHeader (
ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
return RETURN_UNSUPPORTED;
}
+
if (Hdr.Pe32Plus->OptionalHeader.SizeOfHeaders >= Hdr.Pe32Plus->OptionalHeader.SizeOfImage) {
ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
return RETURN_UNSUPPORTED;
}
+
if ((Hdr.Pe32Plus->OptionalHeader.SizeOfHeaders - SectionHeaderOffset) / EFI_IMAGE_SIZEOF_SECTION_HEADER < (UINT32)Hdr.Pe32Plus->FileHeader.NumberOfSections) {
ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
return RETURN_UNSUPPORTED;
@@ -353,19 +368,20 @@ PeCoffLoaderGetPeHeader (
//
// 4.2 Read last byte of Hdr.Pe32Plus.OptionalHeader.SizeOfHeaders from the file.
//
- Size = 1;
+ Size = 1;
ReadSize = Size;
- Status = ImageContext->ImageRead (
- ImageContext->Handle,
- Hdr.Pe32Plus->OptionalHeader.SizeOfHeaders - 1,
- &Size,
- &BufferData
- );
+ Status = ImageContext->ImageRead (
+ ImageContext->Handle,
+ Hdr.Pe32Plus->OptionalHeader.SizeOfHeaders - 1,
+ &Size,
+ &BufferData
+ );
if (RETURN_ERROR (Status) || (Size != ReadSize)) {
ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
if (Size != ReadSize) {
Status = RETURN_UNSUPPORTED;
}
+
return Status;
}
@@ -379,8 +395,9 @@ PeCoffLoaderGetPeHeader (
//
// Check the member data to avoid overflow.
//
- if ((UINT32) (~0) - Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY].VirtualAddress <
- Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY].Size) {
+ if ((UINT32)(~0) - Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY].VirtualAddress <
+ Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY].Size)
+ {
ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
return RETURN_UNSUPPORTED;
}
@@ -388,20 +405,21 @@ PeCoffLoaderGetPeHeader (
//
// Read last byte of section header from file
//
- Size = 1;
+ Size = 1;
ReadSize = Size;
- Status = ImageContext->ImageRead (
- ImageContext->Handle,
- Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY].VirtualAddress +
- Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY].Size - 1,
- &Size,
- &BufferData
- );
+ Status = ImageContext->ImageRead (
+ ImageContext->Handle,
+ Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY].VirtualAddress +
+ Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY].Size - 1,
+ &Size,
+ &BufferData
+ );
if (RETURN_ERROR (Status) || (Size != ReadSize)) {
ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
if (Size != ReadSize) {
Status = RETURN_UNSUPPORTED;
}
+
return Status;
}
}
@@ -410,10 +428,10 @@ PeCoffLoaderGetPeHeader (
//
// Use PE32+ offset
//
- ImageContext->ImageType = Hdr.Pe32Plus->OptionalHeader.Subsystem;
- ImageContext->ImageSize = (UINT64) Hdr.Pe32Plus->OptionalHeader.SizeOfImage;
- ImageContext->SectionAlignment = Hdr.Pe32Plus->OptionalHeader.SectionAlignment;
- ImageContext->SizeOfHeaders = Hdr.Pe32Plus->OptionalHeader.SizeOfHeaders;
+ ImageContext->ImageType = Hdr.Pe32Plus->OptionalHeader.Subsystem;
+ ImageContext->ImageSize = (UINT64)Hdr.Pe32Plus->OptionalHeader.SizeOfImage;
+ ImageContext->SectionAlignment = Hdr.Pe32Plus->OptionalHeader.SectionAlignment;
+ ImageContext->SizeOfHeaders = Hdr.Pe32Plus->OptionalHeader.SizeOfHeaders;
} else {
ImageContext->ImageError = IMAGE_ERROR_INVALID_MACHINE_TYPE;
return RETURN_UNSUPPORTED;
@@ -437,30 +455,31 @@ PeCoffLoaderGetPeHeader (
// Check each section field.
//
if (ImageContext->IsTeImage) {
- SectionHeaderOffset = sizeof(EFI_TE_IMAGE_HEADER);
- NumberOfSections = (UINTN) (Hdr.Te->NumberOfSections);
+ SectionHeaderOffset = sizeof (EFI_TE_IMAGE_HEADER);
+ NumberOfSections = (UINTN)(Hdr.Te->NumberOfSections);
} else {
SectionHeaderOffset = ImageContext->PeCoffHeaderOffset + sizeof (UINT32) + sizeof (EFI_IMAGE_FILE_HEADER) + Hdr.Pe32->FileHeader.SizeOfOptionalHeader;
- NumberOfSections = (UINTN) (Hdr.Pe32->FileHeader.NumberOfSections);
+ NumberOfSections = (UINTN)(Hdr.Pe32->FileHeader.NumberOfSections);
}
for (Index = 0; Index < NumberOfSections; Index++) {
//
// Read section header from file
//
- Size = sizeof (EFI_IMAGE_SECTION_HEADER);
+ Size = sizeof (EFI_IMAGE_SECTION_HEADER);
ReadSize = Size;
- Status = ImageContext->ImageRead (
- ImageContext->Handle,
- SectionHeaderOffset,
- &Size,
- &SectionHeader
- );
+ Status = ImageContext->ImageRead (
+ ImageContext->Handle,
+ SectionHeaderOffset,
+ &Size,
+ &SectionHeader
+ );
if (RETURN_ERROR (Status) || (Size != ReadSize)) {
ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
if (Size != ReadSize) {
Status = RETURN_UNSUPPORTED;
}
+
return Status;
}
@@ -475,8 +494,9 @@ PeCoffLoaderGetPeHeader (
//
// Section data should bigger than the Pe header.
//
- if (SectionHeader.VirtualAddress < ImageContext->SizeOfHeaders ||
- SectionHeader.PointerToRawData < ImageContext->SizeOfHeaders) {
+ if ((SectionHeader.VirtualAddress < ImageContext->SizeOfHeaders) ||
+ (SectionHeader.PointerToRawData < ImageContext->SizeOfHeaders))
+ {
ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
return RETURN_UNSUPPORTED;
}
@@ -484,7 +504,7 @@ PeCoffLoaderGetPeHeader (
//
// Check the member data to avoid overflow.
//
- if ((UINT32) (~0) - SectionHeader.PointerToRawData < SectionHeader.SizeOfRawData) {
+ if ((UINT32)(~0) - SectionHeader.PointerToRawData < SectionHeader.SizeOfRawData) {
ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
return RETURN_UNSUPPORTED;
}
@@ -493,19 +513,20 @@ PeCoffLoaderGetPeHeader (
// Base on the ImageRead function to check the section data field.
// Read the last byte to make sure the data is in the image region.
//
- Size = 1;
+ Size = 1;
ReadSize = Size;
- Status = ImageContext->ImageRead (
- ImageContext->Handle,
- SectionHeader.PointerToRawData + SectionHeader.SizeOfRawData - 1,
- &Size,
- &BufferData
- );
+ Status = ImageContext->ImageRead (
+ ImageContext->Handle,
+ SectionHeader.PointerToRawData + SectionHeader.SizeOfRawData - 1,
+ &Size,
+ &BufferData
+ );
if (RETURN_ERROR (Status) || (Size != ReadSize)) {
ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
if (Size != ReadSize) {
Status = RETURN_UNSUPPORTED;
}
+
return Status;
}
}
@@ -519,7 +540,6 @@ PeCoffLoaderGetPeHeader (
return RETURN_SUCCESS;
}
-
/**
Retrieves information about a PE/COFF image.
@@ -554,31 +574,32 @@ PeCoffLoaderGetImageInfo (
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
)
{
- RETURN_STATUS Status;
- EFI_IMAGE_OPTIONAL_HEADER_UNION HdrData;
- EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;
- EFI_IMAGE_DATA_DIRECTORY *DebugDirectoryEntry;
- UINTN Size;
- UINTN ReadSize;
- UINTN Index;
- UINTN DebugDirectoryEntryRva;
- UINTN DebugDirectoryEntryFileOffset;
- UINTN SectionHeaderOffset;
- EFI_IMAGE_SECTION_HEADER SectionHeader;
- EFI_IMAGE_DEBUG_DIRECTORY_ENTRY DebugEntry;
- UINT32 NumberOfRvaAndSizes;
- UINT32 TeStrippedOffset;
+ RETURN_STATUS Status;
+ EFI_IMAGE_OPTIONAL_HEADER_UNION HdrData;
+ EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;
+ EFI_IMAGE_DATA_DIRECTORY *DebugDirectoryEntry;
+ UINTN Size;
+ UINTN ReadSize;
+ UINTN Index;
+ UINTN DebugDirectoryEntryRva;
+ UINTN DebugDirectoryEntryFileOffset;
+ UINTN SectionHeaderOffset;
+ EFI_IMAGE_SECTION_HEADER SectionHeader;
+ EFI_IMAGE_DEBUG_DIRECTORY_ENTRY DebugEntry;
+ UINT32 NumberOfRvaAndSizes;
+ UINT32 TeStrippedOffset;
if (ImageContext == NULL) {
return RETURN_INVALID_PARAMETER;
}
+
//
// Assume success
//
- ImageContext->ImageError = IMAGE_ERROR_SUCCESS;
+ ImageContext->ImageError = IMAGE_ERROR_SUCCESS;
Hdr.Union = &HdrData;
- Status = PeCoffLoaderGetPeHeader (ImageContext, Hdr);
+ Status = PeCoffLoaderGetPeHeader (ImageContext, Hdr);
if (RETURN_ERROR (Status)) {
return Status;
}
@@ -600,7 +621,7 @@ PeCoffLoaderGetImageInfo (
ImageContext->ImageAddress = Hdr.Pe32Plus->OptionalHeader.ImageBase;
}
} else {
- TeStrippedOffset = (UINT32)Hdr.Te->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER);
+ TeStrippedOffset = (UINT32)Hdr.Te->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER);
ImageContext->ImageAddress = (PHYSICAL_ADDRESS)(Hdr.Te->ImageBase + TeStrippedOffset);
}
@@ -652,7 +673,6 @@ PeCoffLoaderGetImageInfo (
}
if (NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_DEBUG) {
-
DebugDirectoryEntryRva = DebugDirectoryEntry->VirtualAddress;
//
@@ -671,25 +691,26 @@ PeCoffLoaderGetImageInfo (
//
// Read section header from file
//
- Size = sizeof (EFI_IMAGE_SECTION_HEADER);
+ Size = sizeof (EFI_IMAGE_SECTION_HEADER);
ReadSize = Size;
- Status = ImageContext->ImageRead (
- ImageContext->Handle,
- SectionHeaderOffset,
- &Size,
- &SectionHeader
- );
+ Status = ImageContext->ImageRead (
+ ImageContext->Handle,
+ SectionHeaderOffset,
+ &Size,
+ &SectionHeader
+ );
if (RETURN_ERROR (Status) || (Size != ReadSize)) {
ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
if (Size != ReadSize) {
Status = RETURN_UNSUPPORTED;
}
+
return Status;
}
- if (DebugDirectoryEntryRva >= SectionHeader.VirtualAddress &&
- DebugDirectoryEntryRva < SectionHeader.VirtualAddress + SectionHeader.Misc.VirtualSize) {
-
+ if ((DebugDirectoryEntryRva >= SectionHeader.VirtualAddress) &&
+ (DebugDirectoryEntryRva < SectionHeader.VirtualAddress + SectionHeader.Misc.VirtualSize))
+ {
DebugDirectoryEntryFileOffset = DebugDirectoryEntryRva - SectionHeader.VirtualAddress + SectionHeader.PointerToRawData;
break;
}
@@ -702,19 +723,20 @@ PeCoffLoaderGetImageInfo (
//
// Read next debug directory entry
//
- Size = sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY);
+ Size = sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY);
ReadSize = Size;
- Status = ImageContext->ImageRead (
- ImageContext->Handle,
- DebugDirectoryEntryFileOffset + Index,
- &Size,
- &DebugEntry
- );
+ Status = ImageContext->ImageRead (
+ ImageContext->Handle,
+ DebugDirectoryEntryFileOffset + Index,
+ &Size,
+ &DebugEntry
+ );
if (RETURN_ERROR (Status) || (Size != ReadSize)) {
ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
if (Size != ReadSize) {
Status = RETURN_UNSUPPORTED;
}
+
return Status;
}
@@ -724,8 +746,8 @@ PeCoffLoaderGetImageInfo (
// ImageContext->ImageSize when DebugEntry.RVA == 0.
//
if (DebugEntry.Type == EFI_IMAGE_DEBUG_TYPE_CODEVIEW) {
- ImageContext->DebugDirectoryEntryRva = (UINT32) (DebugDirectoryEntryRva + Index);
- if (DebugEntry.RVA == 0 && DebugEntry.FileOffset != 0) {
+ ImageContext->DebugDirectoryEntryRva = (UINT32)(DebugDirectoryEntryRva + Index);
+ if ((DebugEntry.RVA == 0) && (DebugEntry.FileOffset != 0)) {
ImageContext->ImageSize += DebugEntry.SizeOfData;
}
@@ -735,35 +757,36 @@ PeCoffLoaderGetImageInfo (
}
}
} else {
+ DebugDirectoryEntry = &Hdr.Te->DataDirectory[1];
+ DebugDirectoryEntryRva = DebugDirectoryEntry->VirtualAddress;
+ SectionHeaderOffset = (UINTN)(sizeof (EFI_TE_IMAGE_HEADER));
- DebugDirectoryEntry = &Hdr.Te->DataDirectory[1];
- DebugDirectoryEntryRva = DebugDirectoryEntry->VirtualAddress;
- SectionHeaderOffset = (UINTN)(sizeof (EFI_TE_IMAGE_HEADER));
-
- DebugDirectoryEntryFileOffset = 0;
+ DebugDirectoryEntryFileOffset = 0;
for (Index = 0; Index < Hdr.Te->NumberOfSections;) {
//
// Read section header from file
//
- Size = sizeof (EFI_IMAGE_SECTION_HEADER);
+ Size = sizeof (EFI_IMAGE_SECTION_HEADER);
ReadSize = Size;
- Status = ImageContext->ImageRead (
- ImageContext->Handle,
- SectionHeaderOffset,
- &Size,
- &SectionHeader
- );
+ Status = ImageContext->ImageRead (
+ ImageContext->Handle,
+ SectionHeaderOffset,
+ &Size,
+ &SectionHeader
+ );
if (RETURN_ERROR (Status) || (Size != ReadSize)) {
ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
if (Size != ReadSize) {
Status = RETURN_UNSUPPORTED;
}
+
return Status;
}
- if (DebugDirectoryEntryRva >= SectionHeader.VirtualAddress &&
- DebugDirectoryEntryRva < SectionHeader.VirtualAddress + SectionHeader.Misc.VirtualSize) {
+ if ((DebugDirectoryEntryRva >= SectionHeader.VirtualAddress) &&
+ (DebugDirectoryEntryRva < SectionHeader.VirtualAddress + SectionHeader.Misc.VirtualSize))
+ {
DebugDirectoryEntryFileOffset = DebugDirectoryEntryRva -
SectionHeader.VirtualAddress +
SectionHeader.PointerToRawData -
@@ -773,9 +796,9 @@ PeCoffLoaderGetImageInfo (
// File offset of the debug directory was found, if this is not the last
// section, then skip to the last section for calculating the image size.
//
- if (Index < (UINTN) Hdr.Te->NumberOfSections - 1) {
+ if (Index < (UINTN)Hdr.Te->NumberOfSections - 1) {
SectionHeaderOffset += (Hdr.Te->NumberOfSections - 1 - Index) * sizeof (EFI_IMAGE_SECTION_HEADER);
- Index = Hdr.Te->NumberOfSections - 1;
+ Index = Hdr.Te->NumberOfSections - 1;
continue;
}
}
@@ -802,24 +825,25 @@ PeCoffLoaderGetImageInfo (
//
// Read next debug directory entry
//
- Size = sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY);
+ Size = sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY);
ReadSize = Size;
- Status = ImageContext->ImageRead (
- ImageContext->Handle,
- DebugDirectoryEntryFileOffset + Index,
- &Size,
- &DebugEntry
- );
+ Status = ImageContext->ImageRead (
+ ImageContext->Handle,
+ DebugDirectoryEntryFileOffset + Index,
+ &Size,
+ &DebugEntry
+ );
if (RETURN_ERROR (Status) || (Size != ReadSize)) {
ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
if (Size != ReadSize) {
Status = RETURN_UNSUPPORTED;
}
+
return Status;
}
if (DebugEntry.Type == EFI_IMAGE_DEBUG_TYPE_CODEVIEW) {
- ImageContext->DebugDirectoryEntryRva = (UINT32) (DebugDirectoryEntryRva + Index);
+ ImageContext->DebugDirectoryEntryRva = (UINT32)(DebugDirectoryEntryRva + Index);
return RETURN_SUCCESS;
}
}
@@ -829,7 +853,6 @@ PeCoffLoaderGetImageInfo (
return RETURN_SUCCESS;
}
-
/**
Converts an image address to the loaded address.
@@ -842,9 +865,9 @@ PeCoffLoaderGetImageInfo (
**/
VOID *
PeCoffLoaderImageAddress (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
- IN UINTN Address,
- IN UINTN TeStrippedOffset
+ IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
+ IN UINTN Address,
+ IN UINTN TeStrippedOffset
)
{
//
@@ -855,7 +878,7 @@ PeCoffLoaderImageAddress (
return NULL;
}
- return (CHAR8 *)((UINTN) ImageContext->ImageAddress + Address - TeStrippedOffset);
+ return (CHAR8 *)((UINTN)ImageContext->ImageAddress + Address - TeStrippedOffset);
}
/**
@@ -894,24 +917,24 @@ PeCoffLoaderRelocateImage (
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
)
{
- RETURN_STATUS Status;
- EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;
- EFI_IMAGE_DATA_DIRECTORY *RelocDir;
- UINT64 Adjust;
- EFI_IMAGE_BASE_RELOCATION *RelocBaseOrg;
- EFI_IMAGE_BASE_RELOCATION *RelocBase;
- EFI_IMAGE_BASE_RELOCATION *RelocBaseEnd;
- UINT16 *Reloc;
- UINT16 *RelocEnd;
- CHAR8 *Fixup;
- CHAR8 *FixupBase;
- UINT16 *Fixup16;
- UINT32 *Fixup32;
- UINT64 *Fixup64;
- CHAR8 *FixupData;
- PHYSICAL_ADDRESS BaseAddress;
- UINT32 NumberOfRvaAndSizes;
- UINT32 TeStrippedOffset;
+ RETURN_STATUS Status;
+ EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;
+ EFI_IMAGE_DATA_DIRECTORY *RelocDir;
+ UINT64 Adjust;
+ EFI_IMAGE_BASE_RELOCATION *RelocBaseOrg;
+ EFI_IMAGE_BASE_RELOCATION *RelocBase;
+ EFI_IMAGE_BASE_RELOCATION *RelocBaseEnd;
+ UINT16 *Reloc;
+ UINT16 *RelocEnd;
+ CHAR8 *Fixup;
+ CHAR8 *FixupBase;
+ UINT16 *Fixup16;
+ UINT32 *Fixup32;
+ UINT64 *Fixup64;
+ CHAR8 *FixupData;
+ PHYSICAL_ADDRESS BaseAddress;
+ UINT32 NumberOfRvaAndSizes;
+ UINT32 TeStrippedOffset;
ASSERT (ImageContext != NULL);
@@ -941,7 +964,7 @@ PeCoffLoaderRelocateImage (
}
if (!(ImageContext->IsTeImage)) {
- Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN)ImageContext->ImageAddress + ImageContext->PeCoffHeaderOffset);
+ Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN)ImageContext->ImageAddress + ImageContext->PeCoffHeaderOffset);
TeStrippedOffset = 0;
if (Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
@@ -954,18 +977,18 @@ PeCoffLoaderRelocateImage (
}
NumberOfRvaAndSizes = Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes;
- RelocDir = &Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC];
+ RelocDir = &Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC];
} else {
//
// Use PE32+ offset
//
- Adjust = (UINT64) BaseAddress - Hdr.Pe32Plus->OptionalHeader.ImageBase;
+ Adjust = (UINT64)BaseAddress - Hdr.Pe32Plus->OptionalHeader.ImageBase;
if (Adjust != 0) {
Hdr.Pe32Plus->OptionalHeader.ImageBase = (UINT64)BaseAddress;
}
NumberOfRvaAndSizes = Hdr.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes;
- RelocDir = &Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC];
+ RelocDir = &Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC];
}
//
@@ -978,11 +1001,11 @@ PeCoffLoaderRelocateImage (
RelocDir = NULL;
}
} else {
- Hdr.Te = (EFI_TE_IMAGE_HEADER *)(UINTN)(ImageContext->ImageAddress);
- TeStrippedOffset = (UINT32)Hdr.Te->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER);
- Adjust = (UINT64) (BaseAddress - (Hdr.Te->ImageBase + TeStrippedOffset));
+ Hdr.Te = (EFI_TE_IMAGE_HEADER *)(UINTN)(ImageContext->ImageAddress);
+ TeStrippedOffset = (UINT32)Hdr.Te->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER);
+ Adjust = (UINT64)(BaseAddress - (Hdr.Te->ImageBase + TeStrippedOffset));
if (Adjust != 0) {
- Hdr.Te->ImageBase = (UINT64) (BaseAddress - TeStrippedOffset);
+ Hdr.Te->ImageBase = (UINT64)(BaseAddress - TeStrippedOffset);
}
//
@@ -992,12 +1015,13 @@ PeCoffLoaderRelocateImage (
}
if ((RelocDir != NULL) && (RelocDir->Size > 0)) {
- RelocBase = (EFI_IMAGE_BASE_RELOCATION *) PeCoffLoaderImageAddress (ImageContext, RelocDir->VirtualAddress, TeStrippedOffset);
- RelocBaseEnd = (EFI_IMAGE_BASE_RELOCATION *) PeCoffLoaderImageAddress (ImageContext,
- RelocDir->VirtualAddress + RelocDir->Size - 1,
- TeStrippedOffset
- );
- if (RelocBase == NULL || RelocBaseEnd == NULL || (UINTN) RelocBaseEnd < (UINTN) RelocBase) {
+ RelocBase = (EFI_IMAGE_BASE_RELOCATION *)PeCoffLoaderImageAddress (ImageContext, RelocDir->VirtualAddress, TeStrippedOffset);
+ RelocBaseEnd = (EFI_IMAGE_BASE_RELOCATION *)PeCoffLoaderImageAddress (
+ ImageContext,
+ RelocDir->VirtualAddress + RelocDir->Size - 1,
+ TeStrippedOffset
+ );
+ if ((RelocBase == NULL) || (RelocBaseEnd == NULL) || ((UINTN)RelocBaseEnd < (UINTN)RelocBase)) {
ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
return RETURN_LOAD_ERROR;
}
@@ -1007,6 +1031,7 @@ PeCoffLoaderRelocateImage (
//
RelocBase = RelocBaseEnd = NULL;
}
+
RelocBaseOrg = RelocBase;
//
@@ -1017,9 +1042,8 @@ PeCoffLoaderRelocateImage (
// Run the relocation information and apply the fixups
//
FixupData = ImageContext->FixupData;
- while ((UINTN) RelocBase < (UINTN) RelocBaseEnd) {
-
- Reloc = (UINT16 *) ((CHAR8 *) RelocBase + sizeof (EFI_IMAGE_BASE_RELOCATION));
+ while ((UINTN)RelocBase < (UINTN)RelocBaseEnd) {
+ Reloc = (UINT16 *)((CHAR8 *)RelocBase + sizeof (EFI_IMAGE_BASE_RELOCATION));
//
// Add check for RelocBase->SizeOfBlock field.
//
@@ -1027,16 +1051,18 @@ PeCoffLoaderRelocateImage (
ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
return RETURN_LOAD_ERROR;
}
+
if ((UINTN)RelocBase > MAX_ADDRESS - RelocBase->SizeOfBlock) {
ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
return RETURN_LOAD_ERROR;
}
- RelocEnd = (UINT16 *) ((CHAR8 *) RelocBase + RelocBase->SizeOfBlock);
+ RelocEnd = (UINT16 *)((CHAR8 *)RelocBase + RelocBase->SizeOfBlock);
if ((UINTN)RelocEnd > (UINTN)RelocBaseOrg + RelocDir->Size) {
ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
return RETURN_LOAD_ERROR;
}
+
FixupBase = PeCoffLoaderImageAddress (ImageContext, RelocBase->VirtualAddress, TeStrippedOffset);
if (FixupBase == NULL) {
ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
@@ -1046,65 +1072,70 @@ PeCoffLoaderRelocateImage (
//
// Run this relocation record
//
- while ((UINTN) Reloc < (UINTN) RelocEnd) {
+ while ((UINTN)Reloc < (UINTN)RelocEnd) {
Fixup = PeCoffLoaderImageAddress (ImageContext, RelocBase->VirtualAddress + (*Reloc & 0xFFF), TeStrippedOffset);
if (Fixup == NULL) {
ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
return RETURN_LOAD_ERROR;
}
+
switch ((*Reloc) >> 12) {
- case EFI_IMAGE_REL_BASED_ABSOLUTE:
- break;
+ case EFI_IMAGE_REL_BASED_ABSOLUTE:
+ break;
+
+ case EFI_IMAGE_REL_BASED_HIGH:
+ Fixup16 = (UINT16 *)Fixup;
+ *Fixup16 = (UINT16)(*Fixup16 + ((UINT16)((UINT32)Adjust >> 16)));
+ if (FixupData != NULL) {
+ *(UINT16 *)FixupData = *Fixup16;
+ FixupData = FixupData + sizeof (UINT16);
+ }
- case EFI_IMAGE_REL_BASED_HIGH:
- Fixup16 = (UINT16 *) Fixup;
- *Fixup16 = (UINT16) (*Fixup16 + ((UINT16) ((UINT32) Adjust >> 16)));
- if (FixupData != NULL) {
- *(UINT16 *) FixupData = *Fixup16;
- FixupData = FixupData + sizeof (UINT16);
- }
- break;
+ break;
- case EFI_IMAGE_REL_BASED_LOW:
- Fixup16 = (UINT16 *) Fixup;
- *Fixup16 = (UINT16) (*Fixup16 + (UINT16) Adjust);
- if (FixupData != NULL) {
- *(UINT16 *) FixupData = *Fixup16;
- FixupData = FixupData + sizeof (UINT16);
- }
- break;
+ case EFI_IMAGE_REL_BASED_LOW:
+ Fixup16 = (UINT16 *)Fixup;
+ *Fixup16 = (UINT16)(*Fixup16 + (UINT16)Adjust);
+ if (FixupData != NULL) {
+ *(UINT16 *)FixupData = *Fixup16;
+ FixupData = FixupData + sizeof (UINT16);
+ }
- case EFI_IMAGE_REL_BASED_HIGHLOW:
- Fixup32 = (UINT32 *) Fixup;
- *Fixup32 = *Fixup32 + (UINT32) Adjust;
- if (FixupData != NULL) {
- FixupData = ALIGN_POINTER (FixupData, sizeof (UINT32));
- *(UINT32 *)FixupData = *Fixup32;
- FixupData = FixupData + sizeof (UINT32);
- }
- break;
+ break;
- case EFI_IMAGE_REL_BASED_DIR64:
- Fixup64 = (UINT64 *) Fixup;
- *Fixup64 = *Fixup64 + (UINT64) Adjust;
- if (FixupData != NULL) {
- FixupData = ALIGN_POINTER (FixupData, sizeof(UINT64));
- *(UINT64 *)(FixupData) = *Fixup64;
- FixupData = FixupData + sizeof(UINT64);
- }
- break;
+ case EFI_IMAGE_REL_BASED_HIGHLOW:
+ Fixup32 = (UINT32 *)Fixup;
+ *Fixup32 = *Fixup32 + (UINT32)Adjust;
+ if (FixupData != NULL) {
+ FixupData = ALIGN_POINTER (FixupData, sizeof (UINT32));
+ *(UINT32 *)FixupData = *Fixup32;
+ FixupData = FixupData + sizeof (UINT32);
+ }
- default:
- //
- // The common code does not handle some of the stranger IPF relocations
- // PeCoffLoaderRelocateImageEx () adds support for these complex fixups
- // on IPF and is a No-Op on other architectures.
- //
- Status = PeCoffLoaderRelocateImageEx (Reloc, Fixup, &FixupData, Adjust);
- if (RETURN_ERROR (Status)) {
- ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
- return Status;
- }
+ break;
+
+ case EFI_IMAGE_REL_BASED_DIR64:
+ Fixup64 = (UINT64 *)Fixup;
+ *Fixup64 = *Fixup64 + (UINT64)Adjust;
+ if (FixupData != NULL) {
+ FixupData = ALIGN_POINTER (FixupData, sizeof (UINT64));
+ *(UINT64 *)(FixupData) = *Fixup64;
+ FixupData = FixupData + sizeof (UINT64);
+ }
+
+ break;
+
+ default:
+ //
+ // The common code does not handle some of the stranger IPF relocations
+ // PeCoffLoaderRelocateImageEx () adds support for these complex fixups
+ // on IPF and is a No-Op on other architectures.
+ //
+ Status = PeCoffLoaderRelocateImageEx (Reloc, Fixup, &FixupData, Adjust);
+ if (RETURN_ERROR (Status)) {
+ ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
+ return Status;
+ }
}
//
@@ -1116,16 +1147,17 @@ PeCoffLoaderRelocateImage (
//
// Next reloc block
//
- RelocBase = (EFI_IMAGE_BASE_RELOCATION *) RelocEnd;
+ RelocBase = (EFI_IMAGE_BASE_RELOCATION *)RelocEnd;
}
+
ASSERT ((UINTN)FixupData <= (UINTN)ImageContext->FixupData + ImageContext->FixupDataSize);
//
// Adjust the EntryPoint to match the linked-to address
//
if (ImageContext->DestinationAddress != 0) {
- ImageContext->EntryPoint -= (UINT64) ImageContext->ImageAddress;
- ImageContext->EntryPoint += (UINT64) ImageContext->DestinationAddress;
+ ImageContext->EntryPoint -= (UINT64)ImageContext->ImageAddress;
+ ImageContext->EntryPoint += (UINT64)ImageContext->DestinationAddress;
}
}
@@ -1173,27 +1205,27 @@ PeCoffLoaderLoadImage (
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
)
{
- RETURN_STATUS Status;
- EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;
- PE_COFF_LOADER_IMAGE_CONTEXT CheckContext;
- EFI_IMAGE_SECTION_HEADER *FirstSection;
- EFI_IMAGE_SECTION_HEADER *Section;
- UINTN NumberOfSections;
- UINTN Index;
- CHAR8 *Base;
- CHAR8 *End;
- EFI_IMAGE_DATA_DIRECTORY *DirectoryEntry;
- EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *DebugEntry;
- UINTN Size;
- UINT32 TempDebugEntryRva;
- UINT32 NumberOfRvaAndSizes;
- EFI_IMAGE_RESOURCE_DIRECTORY *ResourceDirectory;
- EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *ResourceDirectoryEntry;
- EFI_IMAGE_RESOURCE_DIRECTORY_STRING *ResourceDirectoryString;
- EFI_IMAGE_RESOURCE_DATA_ENTRY *ResourceDataEntry;
- CHAR16 *String;
- UINT32 Offset;
- UINT32 TeStrippedOffset;
+ RETURN_STATUS Status;
+ EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;
+ PE_COFF_LOADER_IMAGE_CONTEXT CheckContext;
+ EFI_IMAGE_SECTION_HEADER *FirstSection;
+ EFI_IMAGE_SECTION_HEADER *Section;
+ UINTN NumberOfSections;
+ UINTN Index;
+ CHAR8 *Base;
+ CHAR8 *End;
+ EFI_IMAGE_DATA_DIRECTORY *DirectoryEntry;
+ EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *DebugEntry;
+ UINTN Size;
+ UINT32 TempDebugEntryRva;
+ UINT32 NumberOfRvaAndSizes;
+ EFI_IMAGE_RESOURCE_DIRECTORY *ResourceDirectory;
+ EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *ResourceDirectoryEntry;
+ EFI_IMAGE_RESOURCE_DIRECTORY_STRING *ResourceDirectoryString;
+ EFI_IMAGE_RESOURCE_DATA_ENTRY *ResourceDataEntry;
+ CHAR16 *String;
+ UINT32 Offset;
+ UINT32 TeStrippedOffset;
ASSERT (ImageContext != NULL);
@@ -1221,6 +1253,7 @@ PeCoffLoaderLoadImage (
ImageContext->ImageError = IMAGE_ERROR_INVALID_IMAGE_SIZE;
return RETURN_BUFFER_TOO_SMALL;
}
+
if (ImageContext->ImageAddress == 0) {
//
// Image cannot be loaded into 0 address.
@@ -1228,6 +1261,7 @@ PeCoffLoaderLoadImage (
ImageContext->ImageError = IMAGE_ERROR_INVALID_IMAGE_ADDRESS;
return RETURN_INVALID_PARAMETER;
}
+
//
// If there's no relocations, then make sure it's not a runtime driver,
// and that it's being loaded at the linked address.
@@ -1241,6 +1275,7 @@ PeCoffLoaderLoadImage (
ImageContext->ImageError = IMAGE_ERROR_INVALID_SUBSYSTEM;
return RETURN_LOAD_ERROR;
}
+
//
// If the image does not contain relocations, and the requested load address
// is not the linked address, then return an error.
@@ -1250,6 +1285,7 @@ PeCoffLoaderLoadImage (
return RETURN_INVALID_PARAMETER;
}
}
+
//
// Make sure the allocated space has the proper section alignment
//
@@ -1259,43 +1295,44 @@ PeCoffLoaderLoadImage (
return RETURN_INVALID_PARAMETER;
}
}
+
//
// Read the entire PE/COFF or TE header into memory
//
if (!(ImageContext->IsTeImage)) {
Status = ImageContext->ImageRead (
- ImageContext->Handle,
- 0,
- &ImageContext->SizeOfHeaders,
- (VOID *) (UINTN) ImageContext->ImageAddress
- );
+ ImageContext->Handle,
+ 0,
+ &ImageContext->SizeOfHeaders,
+ (VOID *)(UINTN)ImageContext->ImageAddress
+ );
Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN)ImageContext->ImageAddress + ImageContext->PeCoffHeaderOffset);
- FirstSection = (EFI_IMAGE_SECTION_HEADER *) (
- (UINTN)ImageContext->ImageAddress +
- ImageContext->PeCoffHeaderOffset +
- sizeof(UINT32) +
- sizeof(EFI_IMAGE_FILE_HEADER) +
- Hdr.Pe32->FileHeader.SizeOfOptionalHeader
- );
- NumberOfSections = (UINTN) (Hdr.Pe32->FileHeader.NumberOfSections);
+ FirstSection = (EFI_IMAGE_SECTION_HEADER *)(
+ (UINTN)ImageContext->ImageAddress +
+ ImageContext->PeCoffHeaderOffset +
+ sizeof (UINT32) +
+ sizeof (EFI_IMAGE_FILE_HEADER) +
+ Hdr.Pe32->FileHeader.SizeOfOptionalHeader
+ );
+ NumberOfSections = (UINTN)(Hdr.Pe32->FileHeader.NumberOfSections);
TeStrippedOffset = 0;
} else {
Status = ImageContext->ImageRead (
- ImageContext->Handle,
- 0,
- &ImageContext->SizeOfHeaders,
- (void *)(UINTN)ImageContext->ImageAddress
- );
-
- Hdr.Te = (EFI_TE_IMAGE_HEADER *)(UINTN)(ImageContext->ImageAddress);
- FirstSection = (EFI_IMAGE_SECTION_HEADER *) (
- (UINTN)ImageContext->ImageAddress +
- sizeof(EFI_TE_IMAGE_HEADER)
- );
- NumberOfSections = (UINTN) (Hdr.Te->NumberOfSections);
- TeStrippedOffset = (UINT32) Hdr.Te->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER);
+ ImageContext->Handle,
+ 0,
+ &ImageContext->SizeOfHeaders,
+ (void *)(UINTN)ImageContext->ImageAddress
+ );
+
+ Hdr.Te = (EFI_TE_IMAGE_HEADER *)(UINTN)(ImageContext->ImageAddress);
+ FirstSection = (EFI_IMAGE_SECTION_HEADER *)(
+ (UINTN)ImageContext->ImageAddress +
+ sizeof (EFI_TE_IMAGE_HEADER)
+ );
+ NumberOfSections = (UINTN)(Hdr.Te->NumberOfSections);
+ TeStrippedOffset = (UINT32)Hdr.Te->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER);
}
if (RETURN_ERROR (Status)) {
@@ -1311,9 +1348,9 @@ PeCoffLoaderLoadImage (
//
// Read the section
//
- Size = (UINTN) Section->Misc.VirtualSize;
+ Size = (UINTN)Section->Misc.VirtualSize;
if ((Size == 0) || (Size > Section->SizeOfRawData)) {
- Size = (UINTN) Section->SizeOfRawData;
+ Size = (UINTN)Section->SizeOfRawData;
}
//
@@ -1332,11 +1369,11 @@ PeCoffLoaderLoadImage (
if (Section->SizeOfRawData > 0) {
Status = ImageContext->ImageRead (
- ImageContext->Handle,
- Section->PointerToRawData - TeStrippedOffset,
- &Size,
- Base
- );
+ ImageContext->Handle,
+ Section->PointerToRawData - TeStrippedOffset,
+ &Size,
+ Base
+ );
if (RETURN_ERROR (Status)) {
ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
return Status;
@@ -1404,13 +1441,13 @@ PeCoffLoaderLoadImage (
// Use PE32 offset
//
NumberOfRvaAndSizes = Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes;
- DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC];
+ DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC];
} else {
//
// Use PE32+ offset
//
NumberOfRvaAndSizes = Hdr.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes;
- DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC];
+ DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC];
}
//
@@ -1425,6 +1462,7 @@ PeCoffLoaderLoadImage (
DirectoryEntry = &Hdr.Te->DataDirectory[0];
ImageContext->FixupDataSize = DirectoryEntry->Size / sizeof (UINT16) * sizeof (UINT64);
}
+
//
// Consumer must allocate a buffer for the relocation fixup log.
// Only used for runtime drivers.
@@ -1436,17 +1474,17 @@ PeCoffLoaderLoadImage (
//
if (ImageContext->DebugDirectoryEntryRva != 0) {
DebugEntry = PeCoffLoaderImageAddress (
- ImageContext,
- ImageContext->DebugDirectoryEntryRva,
- TeStrippedOffset
- );
+ ImageContext,
+ ImageContext->DebugDirectoryEntryRva,
+ TeStrippedOffset
+ );
if (DebugEntry == NULL) {
ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
return RETURN_LOAD_ERROR;
}
TempDebugEntryRva = DebugEntry->RVA;
- if (DebugEntry->RVA == 0 && DebugEntry->FileOffset != 0) {
+ if ((DebugEntry->RVA == 0) && (DebugEntry->FileOffset != 0)) {
Section--;
if ((UINTN)Section->SizeOfRawData < Section->Misc.VirtualSize) {
TempDebugEntryRva = Section->VirtualAddress + Section->Misc.VirtualSize;
@@ -1463,13 +1501,13 @@ PeCoffLoaderLoadImage (
}
if (DebugEntry->RVA == 0) {
- Size = DebugEntry->SizeOfData;
+ Size = DebugEntry->SizeOfData;
Status = ImageContext->ImageRead (
- ImageContext->Handle,
- DebugEntry->FileOffset - TeStrippedOffset,
- &Size,
- ImageContext->CodeView
- );
+ ImageContext->Handle,
+ DebugEntry->FileOffset - TeStrippedOffset,
+ &Size,
+ ImageContext->CodeView
+ );
//
// Should we apply fix up to this field according to the size difference between PE and TE?
// Because now we maintain TE header fields unfixed, this field will also remain as they are
@@ -1484,33 +1522,36 @@ PeCoffLoaderLoadImage (
DebugEntry->RVA = TempDebugEntryRva;
}
- switch (*(UINT32 *) ImageContext->CodeView) {
- case CODEVIEW_SIGNATURE_NB10:
- if (DebugEntry->SizeOfData < sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY)) {
- ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
- return RETURN_UNSUPPORTED;
- }
- ImageContext->PdbPointer = (CHAR8 *)ImageContext->CodeView + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY);
- break;
+ switch (*(UINT32 *)ImageContext->CodeView) {
+ case CODEVIEW_SIGNATURE_NB10:
+ if (DebugEntry->SizeOfData < sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY)) {
+ ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+ return RETURN_UNSUPPORTED;
+ }
- case CODEVIEW_SIGNATURE_RSDS:
- if (DebugEntry->SizeOfData < sizeof (EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY)) {
- ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
- return RETURN_UNSUPPORTED;
- }
- ImageContext->PdbPointer = (CHAR8 *)ImageContext->CodeView + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY);
- break;
+ ImageContext->PdbPointer = (CHAR8 *)ImageContext->CodeView + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY);
+ break;
- case CODEVIEW_SIGNATURE_MTOC:
- if (DebugEntry->SizeOfData < sizeof (EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY)) {
- ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
- return RETURN_UNSUPPORTED;
- }
- ImageContext->PdbPointer = (CHAR8 *)ImageContext->CodeView + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY);
- break;
+ case CODEVIEW_SIGNATURE_RSDS:
+ if (DebugEntry->SizeOfData < sizeof (EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY)) {
+ ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+ return RETURN_UNSUPPORTED;
+ }
+
+ ImageContext->PdbPointer = (CHAR8 *)ImageContext->CodeView + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY);
+ break;
+
+ case CODEVIEW_SIGNATURE_MTOC:
+ if (DebugEntry->SizeOfData < sizeof (EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY)) {
+ ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+ return RETURN_UNSUPPORTED;
+ }
- default:
- break;
+ ImageContext->PdbPointer = (CHAR8 *)ImageContext->CodeView + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY);
+ break;
+
+ default:
+ break;
}
}
}
@@ -1525,26 +1566,27 @@ PeCoffLoaderLoadImage (
// Use PE32 offset
//
NumberOfRvaAndSizes = Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes;
- DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE];
+ DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE];
} else {
//
// Use PE32+ offset
//
NumberOfRvaAndSizes = Hdr.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes;
- DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE];
+ DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE];
}
- if (NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE && DirectoryEntry->Size != 0) {
+ if ((NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE) && (DirectoryEntry->Size != 0)) {
Base = PeCoffLoaderImageAddress (ImageContext, DirectoryEntry->VirtualAddress, 0);
if (Base != NULL) {
- ResourceDirectory = (EFI_IMAGE_RESOURCE_DIRECTORY *) Base;
- Offset = sizeof (EFI_IMAGE_RESOURCE_DIRECTORY) + sizeof (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY) *
- (ResourceDirectory->NumberOfNamedEntries + ResourceDirectory->NumberOfIdEntries);
+ ResourceDirectory = (EFI_IMAGE_RESOURCE_DIRECTORY *)Base;
+ Offset = sizeof (EFI_IMAGE_RESOURCE_DIRECTORY) + sizeof (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY) *
+ (ResourceDirectory->NumberOfNamedEntries + ResourceDirectory->NumberOfIdEntries);
if (Offset > DirectoryEntry->Size) {
ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
return RETURN_UNSUPPORTED;
}
- ResourceDirectoryEntry = (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *) (ResourceDirectory + 1);
+
+ ResourceDirectoryEntry = (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *)(ResourceDirectory + 1);
for (Index = 0; Index < ResourceDirectory->NumberOfNamedEntries; Index++) {
if (ResourceDirectoryEntry->u1.s.NameIsString) {
@@ -1555,13 +1597,15 @@ PeCoffLoaderLoadImage (
ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
return RETURN_UNSUPPORTED;
}
- ResourceDirectoryString = (EFI_IMAGE_RESOURCE_DIRECTORY_STRING *) (Base + ResourceDirectoryEntry->u1.s.NameOffset);
- String = &ResourceDirectoryString->String[0];
- if (ResourceDirectoryString->Length == 3 &&
- String[0] == L'H' &&
- String[1] == L'I' &&
- String[2] == L'I') {
+ ResourceDirectoryString = (EFI_IMAGE_RESOURCE_DIRECTORY_STRING *)(Base + ResourceDirectoryEntry->u1.s.NameOffset);
+ String = &ResourceDirectoryString->String[0];
+
+ if ((ResourceDirectoryString->Length == 3) &&
+ (String[0] == L'H') &&
+ (String[1] == L'I') &&
+ (String[2] == L'I'))
+ {
//
// Resource Type "HII" found
//
@@ -1573,14 +1617,16 @@ PeCoffLoaderLoadImage (
ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
return RETURN_UNSUPPORTED;
}
- ResourceDirectory = (EFI_IMAGE_RESOURCE_DIRECTORY *) (Base + ResourceDirectoryEntry->u2.s.OffsetToDirectory);
- Offset = ResourceDirectoryEntry->u2.s.OffsetToDirectory + sizeof (EFI_IMAGE_RESOURCE_DIRECTORY) +
- sizeof (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY) * (ResourceDirectory->NumberOfNamedEntries + ResourceDirectory->NumberOfIdEntries);
+
+ ResourceDirectory = (EFI_IMAGE_RESOURCE_DIRECTORY *)(Base + ResourceDirectoryEntry->u2.s.OffsetToDirectory);
+ Offset = ResourceDirectoryEntry->u2.s.OffsetToDirectory + sizeof (EFI_IMAGE_RESOURCE_DIRECTORY) +
+ sizeof (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY) * (ResourceDirectory->NumberOfNamedEntries + ResourceDirectory->NumberOfIdEntries);
if (Offset > DirectoryEntry->Size) {
ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
return RETURN_UNSUPPORTED;
}
- ResourceDirectoryEntry = (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *) (ResourceDirectory + 1);
+
+ ResourceDirectoryEntry = (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *)(ResourceDirectory + 1);
if (ResourceDirectoryEntry->u2.s.DataIsDirectory) {
//
@@ -1590,14 +1636,16 @@ PeCoffLoaderLoadImage (
ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
return RETURN_UNSUPPORTED;
}
- ResourceDirectory = (EFI_IMAGE_RESOURCE_DIRECTORY *) (Base + ResourceDirectoryEntry->u2.s.OffsetToDirectory);
- Offset = ResourceDirectoryEntry->u2.s.OffsetToDirectory + sizeof (EFI_IMAGE_RESOURCE_DIRECTORY) +
- sizeof (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY) * (ResourceDirectory->NumberOfNamedEntries + ResourceDirectory->NumberOfIdEntries);
+
+ ResourceDirectory = (EFI_IMAGE_RESOURCE_DIRECTORY *)(Base + ResourceDirectoryEntry->u2.s.OffsetToDirectory);
+ Offset = ResourceDirectoryEntry->u2.s.OffsetToDirectory + sizeof (EFI_IMAGE_RESOURCE_DIRECTORY) +
+ sizeof (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY) * (ResourceDirectory->NumberOfNamedEntries + ResourceDirectory->NumberOfIdEntries);
if (Offset > DirectoryEntry->Size) {
ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
return RETURN_UNSUPPORTED;
}
- ResourceDirectoryEntry = (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *) (ResourceDirectory + 1);
+
+ ResourceDirectoryEntry = (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *)(ResourceDirectory + 1);
}
}
@@ -1609,12 +1657,14 @@ PeCoffLoaderLoadImage (
ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
return RETURN_UNSUPPORTED;
}
- ResourceDataEntry = (EFI_IMAGE_RESOURCE_DATA_ENTRY *) (Base + ResourceDirectoryEntry->u2.OffsetToData);
- ImageContext->HiiResourceData = (PHYSICAL_ADDRESS) (UINTN) PeCoffLoaderImageAddress (ImageContext, ResourceDataEntry->OffsetToData, 0);
+
+ ResourceDataEntry = (EFI_IMAGE_RESOURCE_DATA_ENTRY *)(Base + ResourceDirectoryEntry->u2.OffsetToData);
+ ImageContext->HiiResourceData = (PHYSICAL_ADDRESS)(UINTN)PeCoffLoaderImageAddress (ImageContext, ResourceDataEntry->OffsetToData, 0);
break;
}
}
}
+
ResourceDirectoryEntry++;
}
}
@@ -1624,7 +1674,6 @@ PeCoffLoaderLoadImage (
return Status;
}
-
/**
Reapply fixups on a fixed up PE32/PE32+ image to allow virutal calling at EFI
runtime.
@@ -1651,44 +1700,44 @@ PeCoffLoaderLoadImage (
VOID
EFIAPI
PeCoffLoaderRelocateImageForRuntime (
- IN PHYSICAL_ADDRESS ImageBase,
- IN PHYSICAL_ADDRESS VirtImageBase,
- IN UINTN ImageSize,
- IN VOID *RelocationData
+ IN PHYSICAL_ADDRESS ImageBase,
+ IN PHYSICAL_ADDRESS VirtImageBase,
+ IN UINTN ImageSize,
+ IN VOID *RelocationData
)
{
- CHAR8 *OldBase;
- CHAR8 *NewBase;
- EFI_IMAGE_DOS_HEADER *DosHdr;
- EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;
- UINT32 NumberOfRvaAndSizes;
- EFI_IMAGE_DATA_DIRECTORY *DataDirectory;
- EFI_IMAGE_DATA_DIRECTORY *RelocDir;
- EFI_IMAGE_BASE_RELOCATION *RelocBase;
- EFI_IMAGE_BASE_RELOCATION *RelocBaseEnd;
- EFI_IMAGE_BASE_RELOCATION *RelocBaseOrig;
- UINT16 *Reloc;
- UINT16 *RelocEnd;
- CHAR8 *Fixup;
- CHAR8 *FixupBase;
- UINT16 *Fixup16;
- UINT32 *Fixup32;
- UINT64 *Fixup64;
- CHAR8 *FixupData;
- UINTN Adjust;
- RETURN_STATUS Status;
- PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
-
- if (RelocationData == NULL || ImageBase == 0x0 || VirtImageBase == 0x0) {
+ CHAR8 *OldBase;
+ CHAR8 *NewBase;
+ EFI_IMAGE_DOS_HEADER *DosHdr;
+ EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;
+ UINT32 NumberOfRvaAndSizes;
+ EFI_IMAGE_DATA_DIRECTORY *DataDirectory;
+ EFI_IMAGE_DATA_DIRECTORY *RelocDir;
+ EFI_IMAGE_BASE_RELOCATION *RelocBase;
+ EFI_IMAGE_BASE_RELOCATION *RelocBaseEnd;
+ EFI_IMAGE_BASE_RELOCATION *RelocBaseOrig;
+ UINT16 *Reloc;
+ UINT16 *RelocEnd;
+ CHAR8 *Fixup;
+ CHAR8 *FixupBase;
+ UINT16 *Fixup16;
+ UINT32 *Fixup32;
+ UINT64 *Fixup64;
+ CHAR8 *FixupData;
+ UINTN Adjust;
+ RETURN_STATUS Status;
+ PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
+
+ if ((RelocationData == NULL) || (ImageBase == 0x0) || (VirtImageBase == 0x0)) {
return;
}
OldBase = (CHAR8 *)((UINTN)ImageBase);
NewBase = (CHAR8 *)((UINTN)VirtImageBase);
- Adjust = (UINTN) NewBase - (UINTN) OldBase;
+ Adjust = (UINTN)NewBase - (UINTN)OldBase;
ImageContext.ImageAddress = ImageBase;
- ImageContext.ImageSize = ImageSize;
+ ImageContext.ImageSize = ImageSize;
//
// Find the image's relocate dir info
@@ -1710,7 +1759,7 @@ PeCoffLoaderRelocateImageForRuntime (
//
// Not a valid PE image so Exit
//
- return ;
+ return;
}
if (Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
@@ -1718,13 +1767,13 @@ PeCoffLoaderRelocateImageForRuntime (
// Use PE32 offset
//
NumberOfRvaAndSizes = Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes;
- DataDirectory = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32->OptionalHeader.DataDirectory[0]);
+ DataDirectory = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32->OptionalHeader.DataDirectory[0]);
} else {
//
// Use PE32+ offset
//
NumberOfRvaAndSizes = Hdr.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes;
- DataDirectory = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32Plus->OptionalHeader.DataDirectory[0]);
+ DataDirectory = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32Plus->OptionalHeader.DataDirectory[0]);
}
//
@@ -1734,18 +1783,20 @@ PeCoffLoaderRelocateImageForRuntime (
// is present in the image. You have to check the NumberOfRvaAndSizes in
// the optional header to verify a desired directory entry is there.
//
- RelocBase = NULL;
+ RelocBase = NULL;
RelocBaseEnd = NULL;
if (NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC) {
- RelocDir = DataDirectory + EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC;
+ RelocDir = DataDirectory + EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC;
if ((RelocDir != NULL) && (RelocDir->Size > 0)) {
- RelocBase = (EFI_IMAGE_BASE_RELOCATION *) PeCoffLoaderImageAddress (&ImageContext, RelocDir->VirtualAddress, 0);
- RelocBaseEnd = (EFI_IMAGE_BASE_RELOCATION *) PeCoffLoaderImageAddress (&ImageContext,
- RelocDir->VirtualAddress + RelocDir->Size - 1,
- 0
- );
+ RelocBase = (EFI_IMAGE_BASE_RELOCATION *)PeCoffLoaderImageAddress (&ImageContext, RelocDir->VirtualAddress, 0);
+ RelocBaseEnd = (EFI_IMAGE_BASE_RELOCATION *)PeCoffLoaderImageAddress (
+ &ImageContext,
+ RelocDir->VirtualAddress + RelocDir->Size - 1,
+ 0
+ );
}
- if (RelocBase == NULL || RelocBaseEnd == NULL || (UINTN) RelocBaseEnd < (UINTN) RelocBase) {
+
+ if ((RelocBase == NULL) || (RelocBaseEnd == NULL) || ((UINTN)RelocBaseEnd < (UINTN)RelocBase)) {
//
// relocation block is not valid, just return
//
@@ -1756,7 +1807,7 @@ PeCoffLoaderRelocateImageForRuntime (
// Cannot find relocations, cannot continue to relocate the image, ASSERT for this invalid image.
//
ASSERT (FALSE);
- return ;
+ return;
}
//
@@ -1772,9 +1823,9 @@ PeCoffLoaderRelocateImageForRuntime (
// by code will not be fixed up, since that would set them back to
// defaults.
//
- FixupData = RelocationData;
+ FixupData = RelocationData;
RelocBaseOrig = RelocBase;
- while ((UINTN) RelocBase < (UINTN) RelocBaseEnd) {
+ while ((UINTN)RelocBase < (UINTN)RelocBaseEnd) {
//
// Add check for RelocBase->SizeOfBlock field.
//
@@ -1785,8 +1836,8 @@ PeCoffLoaderRelocateImageForRuntime (
return;
}
- Reloc = (UINT16 *) ((UINT8 *) RelocBase + sizeof (EFI_IMAGE_BASE_RELOCATION));
- RelocEnd = (UINT16 *) ((UINT8 *) RelocBase + RelocBase->SizeOfBlock);
+ Reloc = (UINT16 *)((UINT8 *)RelocBase + sizeof (EFI_IMAGE_BASE_RELOCATION));
+ RelocEnd = (UINT16 *)((UINT8 *)RelocBase + RelocBase->SizeOfBlock);
if ((UINTN)RelocEnd > (UINTN)RelocBaseOrig + RelocDir->Size) {
return;
}
@@ -1799,78 +1850,78 @@ PeCoffLoaderRelocateImageForRuntime (
//
// Run this relocation record
//
- while ((UINTN) Reloc < (UINTN) RelocEnd) {
-
+ while ((UINTN)Reloc < (UINTN)RelocEnd) {
Fixup = PeCoffLoaderImageAddress (&ImageContext, RelocBase->VirtualAddress + (*Reloc & 0xFFF), 0);
if (Fixup == NULL) {
return;
}
+
switch ((*Reloc) >> 12) {
+ case EFI_IMAGE_REL_BASED_ABSOLUTE:
+ break;
- case EFI_IMAGE_REL_BASED_ABSOLUTE:
- break;
+ case EFI_IMAGE_REL_BASED_HIGH:
+ Fixup16 = (UINT16 *)Fixup;
+ if (*(UINT16 *)FixupData == *Fixup16) {
+ *Fixup16 = (UINT16)(*Fixup16 + ((UINT16)((UINT32)Adjust >> 16)));
+ }
- case EFI_IMAGE_REL_BASED_HIGH:
- Fixup16 = (UINT16 *) Fixup;
- if (*(UINT16 *) FixupData == *Fixup16) {
- *Fixup16 = (UINT16) (*Fixup16 + ((UINT16) ((UINT32) Adjust >> 16)));
- }
+ FixupData = FixupData + sizeof (UINT16);
+ break;
- FixupData = FixupData + sizeof (UINT16);
- break;
-
- case EFI_IMAGE_REL_BASED_LOW:
- Fixup16 = (UINT16 *) Fixup;
- if (*(UINT16 *) FixupData == *Fixup16) {
- *Fixup16 = (UINT16) (*Fixup16 + ((UINT16) Adjust & 0xffff));
- }
+ case EFI_IMAGE_REL_BASED_LOW:
+ Fixup16 = (UINT16 *)Fixup;
+ if (*(UINT16 *)FixupData == *Fixup16) {
+ *Fixup16 = (UINT16)(*Fixup16 + ((UINT16)Adjust & 0xffff));
+ }
- FixupData = FixupData + sizeof (UINT16);
- break;
+ FixupData = FixupData + sizeof (UINT16);
+ break;
- case EFI_IMAGE_REL_BASED_HIGHLOW:
- Fixup32 = (UINT32 *) Fixup;
- FixupData = ALIGN_POINTER (FixupData, sizeof (UINT32));
- if (*(UINT32 *) FixupData == *Fixup32) {
- *Fixup32 = *Fixup32 + (UINT32) Adjust;
- }
+ case EFI_IMAGE_REL_BASED_HIGHLOW:
+ Fixup32 = (UINT32 *)Fixup;
+ FixupData = ALIGN_POINTER (FixupData, sizeof (UINT32));
+ if (*(UINT32 *)FixupData == *Fixup32) {
+ *Fixup32 = *Fixup32 + (UINT32)Adjust;
+ }
- FixupData = FixupData + sizeof (UINT32);
- break;
+ FixupData = FixupData + sizeof (UINT32);
+ break;
- case EFI_IMAGE_REL_BASED_DIR64:
- Fixup64 = (UINT64 *)Fixup;
- FixupData = ALIGN_POINTER (FixupData, sizeof (UINT64));
- if (*(UINT64 *) FixupData == *Fixup64) {
- *Fixup64 = *Fixup64 + (UINT64)Adjust;
- }
+ case EFI_IMAGE_REL_BASED_DIR64:
+ Fixup64 = (UINT64 *)Fixup;
+ FixupData = ALIGN_POINTER (FixupData, sizeof (UINT64));
+ if (*(UINT64 *)FixupData == *Fixup64) {
+ *Fixup64 = *Fixup64 + (UINT64)Adjust;
+ }
- FixupData = FixupData + sizeof (UINT64);
- break;
+ FixupData = FixupData + sizeof (UINT64);
+ break;
- default:
- //
- // Only Itanium requires ConvertPeImage_Ex
- //
- Status = PeHotRelocateImageEx (Reloc, Fixup, &FixupData, Adjust);
- if (RETURN_ERROR (Status)) {
- return ;
- }
+ default:
+ //
+ // Only Itanium requires ConvertPeImage_Ex
+ //
+ Status = PeHotRelocateImageEx (Reloc, Fixup, &FixupData, Adjust);
+ if (RETURN_ERROR (Status)) {
+ return;
+ }
}
+
//
// Next relocation record
//
Reloc += 1;
}
+
//
// next reloc block
//
- RelocBase = (EFI_IMAGE_BASE_RELOCATION *) RelocEnd;
+ RelocBase = (EFI_IMAGE_BASE_RELOCATION *)RelocEnd;
}
}
}
-
/**
Reads contents of a PE/COFF image from a buffer in system memory.
@@ -1899,10 +1950,10 @@ PeCoffLoaderRelocateImageForRuntime (
RETURN_STATUS
EFIAPI
PeCoffLoaderImageReadFromMemory (
- IN VOID *FileHandle,
- IN UINTN FileOffset,
- IN OUT UINTN *ReadSize,
- OUT VOID *Buffer
+ IN VOID *FileHandle,
+ IN UINTN FileOffset,
+ IN OUT UINTN *ReadSize,
+ OUT VOID *Buffer
)
{
ASSERT (ReadSize != NULL);
diff --git a/MdePkg/Library/BasePeCoffLib/BasePeCoffLibInternals.h b/MdePkg/Library/BasePeCoffLib/BasePeCoffLibInternals.h
index 3ee56e0e5f..aa86a54850 100644
--- a/MdePkg/Library/BasePeCoffLib/BasePeCoffLibInternals.h
+++ b/MdePkg/Library/BasePeCoffLib/BasePeCoffLibInternals.h
@@ -20,13 +20,12 @@
//
// Macro definitions for RISC-V architecture.
//
-#define RV_X(x, s, n) (((x) >> (s)) & ((1<<(n))-1))
-#define RISCV_IMM_BITS 12
-#define RISCV_IMM_REACH (1LL<<RISCV_IMM_BITS)
+#define RV_X(x, s, n) (((x) >> (s)) & ((1<<(n))-1))
+#define RISCV_IMM_BITS 12
+#define RISCV_IMM_REACH (1LL<<RISCV_IMM_BITS)
#define RISCV_CONST_HIGH_PART(VALUE) \
(((VALUE) + (RISCV_IMM_REACH/2)) & ~(RISCV_IMM_REACH-1))
-
/**
Performs an Itanium-based specific relocation fixup and is a no-op on other
instruction sets.
@@ -41,13 +40,12 @@
**/
RETURN_STATUS
PeCoffLoaderRelocateImageEx (
- IN UINT16 *Reloc,
- IN OUT CHAR8 *Fixup,
- IN OUT CHAR8 **FixupData,
- IN UINT64 Adjust
+ IN UINT16 *Reloc,
+ IN OUT CHAR8 *Fixup,
+ IN OUT CHAR8 **FixupData,
+ IN UINT64 Adjust
);
-
/**
Performs an Itanium-based specific re-relocation fixup and is a no-op on other
instruction sets. This is used to re-relocated the image into the EFI virtual
@@ -63,13 +61,12 @@ PeCoffLoaderRelocateImageEx (
**/
RETURN_STATUS
PeHotRelocateImageEx (
- IN UINT16 *Reloc,
- IN OUT CHAR8 *Fixup,
- IN OUT CHAR8 **FixupData,
- IN UINT64 Adjust
+ IN UINT16 *Reloc,
+ IN OUT CHAR8 *Fixup,
+ IN OUT CHAR8 **FixupData,
+ IN UINT64 Adjust
);
-
/**
Returns TRUE if the machine type of PE/COFF image is supported. Supported
does not mean the image can be executed it means the PE/COFF loader supports
@@ -128,9 +125,9 @@ PeCoffLoaderGetPeHeader (
**/
VOID *
PeCoffLoaderImageAddress (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
- IN UINTN Address,
- IN UINTN TeStrippedOffset
+ IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
+ IN UINTN Address,
+ IN UINTN TeStrippedOffset
);
#endif
diff --git a/MdePkg/Library/BasePeCoffLib/PeCoffLoaderEx.c b/MdePkg/Library/BasePeCoffLib/PeCoffLoaderEx.c
index 988b17ff09..1a806dd62d 100644
--- a/MdePkg/Library/BasePeCoffLib/PeCoffLoaderEx.c
+++ b/MdePkg/Library/BasePeCoffLib/PeCoffLoaderEx.c
@@ -8,7 +8,6 @@
#include "BasePeCoffLibInternals.h"
-
/**
Performs an Itanium-based specific relocation fixup and is a no-op on other
instruction sets.
@@ -23,10 +22,10 @@
**/
RETURN_STATUS
PeCoffLoaderRelocateImageEx (
- IN UINT16 *Reloc,
- IN OUT CHAR8 *Fixup,
- IN OUT CHAR8 **FixupData,
- IN UINT64 Adjust
+ IN UINT16 *Reloc,
+ IN OUT CHAR8 *Fixup,
+ IN OUT CHAR8 **FixupData,
+ IN UINT64 Adjust
)
{
return RETURN_UNSUPPORTED;
@@ -51,7 +50,8 @@ PeCoffLoaderImageFormatSupported (
)
{
if ((Machine == IMAGE_FILE_MACHINE_I386) || (Machine == IMAGE_FILE_MACHINE_X64) ||
- (Machine == IMAGE_FILE_MACHINE_EBC) || (Machine == IMAGE_FILE_MACHINE_ARM64)) {
+ (Machine == IMAGE_FILE_MACHINE_EBC) || (Machine == IMAGE_FILE_MACHINE_ARM64))
+ {
return TRUE;
}
@@ -73,12 +73,11 @@ PeCoffLoaderImageFormatSupported (
**/
RETURN_STATUS
PeHotRelocateImageEx (
- IN UINT16 *Reloc,
- IN OUT CHAR8 *Fixup,
- IN OUT CHAR8 **FixupData,
- IN UINT64 Adjust
+ IN UINT16 *Reloc,
+ IN OUT CHAR8 *Fixup,
+ IN OUT CHAR8 **FixupData,
+ IN UINT64 Adjust
)
{
return RETURN_UNSUPPORTED;
}
-
diff --git a/MdePkg/Library/BasePeCoffLib/RiscV/PeCoffLoaderEx.c b/MdePkg/Library/BasePeCoffLib/RiscV/PeCoffLoaderEx.c
index 23170a6603..adbfe9ccf5 100644
--- a/MdePkg/Library/BasePeCoffLib/RiscV/PeCoffLoaderEx.c
+++ b/MdePkg/Library/BasePeCoffLib/RiscV/PeCoffLoaderEx.c
@@ -25,63 +25,66 @@
**/
RETURN_STATUS
PeCoffLoaderRelocateImageEx (
- IN UINT16 *Reloc,
- IN OUT CHAR8 *Fixup,
- IN OUT CHAR8 **FixupData,
- IN UINT64 Adjust
+ IN UINT16 *Reloc,
+ IN OUT CHAR8 *Fixup,
+ IN OUT CHAR8 **FixupData,
+ IN UINT64 Adjust
)
{
- UINT32 Value;
- UINT32 Value2;
- UINT32 *RiscVHi20Fixup;
+ UINT32 Value;
+ UINT32 Value2;
+ UINT32 *RiscVHi20Fixup;
switch ((*Reloc) >> 12) {
- case EFI_IMAGE_REL_BASED_RISCV_HI20:
+ case EFI_IMAGE_REL_BASED_RISCV_HI20:
*(UINT64 *)(*FixupData) = (UINT64)(UINTN)Fixup;
break;
- case EFI_IMAGE_REL_BASED_RISCV_LOW12I:
+ case EFI_IMAGE_REL_BASED_RISCV_LOW12I:
RiscVHi20Fixup = (UINT32 *)(*(UINT64 *)(*FixupData));
if (RiscVHi20Fixup != NULL) {
-
- Value = (UINT32)(RV_X(*RiscVHi20Fixup, 12, 20) << 12);
- Value2 = (UINT32)(RV_X(*(UINT32 *)Fixup, 20, 12));
+ Value = (UINT32)(RV_X (*RiscVHi20Fixup, 12, 20) << 12);
+ Value2 = (UINT32)(RV_X (*(UINT32 *)Fixup, 20, 12));
if (Value2 & (RISCV_IMM_REACH/2)) {
Value2 |= ~(RISCV_IMM_REACH-1);
}
- Value += Value2;
- Value += (UINT32)Adjust;
- Value2 = RISCV_CONST_HIGH_PART (Value);
- *(UINT32 *)RiscVHi20Fixup = (RV_X (Value2, 12, 20) << 12) |\
- (RV_X (*(UINT32 *)RiscVHi20Fixup, 0, 12));
- *(UINT32 *)Fixup = (RV_X (Value, 0, 12) << 20) |\
+
+ Value += Value2;
+ Value += (UINT32)Adjust;
+ Value2 = RISCV_CONST_HIGH_PART (Value);
+ *(UINT32 *)RiscVHi20Fixup = (RV_X (Value2, 12, 20) << 12) | \
+ (RV_X (*(UINT32 *)RiscVHi20Fixup, 0, 12));
+ *(UINT32 *)Fixup = (RV_X (Value, 0, 12) << 20) | \
(RV_X (*(UINT32 *)Fixup, 0, 20));
}
+
break;
- case EFI_IMAGE_REL_BASED_RISCV_LOW12S:
+ case EFI_IMAGE_REL_BASED_RISCV_LOW12S:
RiscVHi20Fixup = (UINT32 *)(*(UINT64 *)(*FixupData));
if (RiscVHi20Fixup != NULL) {
- Value = (UINT32)(RV_X(*RiscVHi20Fixup, 12, 20) << 12);
- Value2 = (UINT32)(RV_X(*(UINT32 *)Fixup, 7, 5) | (RV_X(*(UINT32 *)Fixup, 25, 7) << 5));
+ Value = (UINT32)(RV_X (*RiscVHi20Fixup, 12, 20) << 12);
+ Value2 = (UINT32)(RV_X (*(UINT32 *)Fixup, 7, 5) | (RV_X (*(UINT32 *)Fixup, 25, 7) << 5));
if (Value2 & (RISCV_IMM_REACH/2)) {
Value2 |= ~(RISCV_IMM_REACH-1);
}
- Value += Value2;
- Value += (UINT32)Adjust;
- Value2 = RISCV_CONST_HIGH_PART (Value);
+
+ Value += Value2;
+ Value += (UINT32)Adjust;
+ Value2 = RISCV_CONST_HIGH_PART (Value);
*(UINT32 *)RiscVHi20Fixup = (RV_X (Value2, 12, 20) << 12) | \
- (RV_X (*(UINT32 *)RiscVHi20Fixup, 0, 12));
- Value2 = *(UINT32 *)Fixup & 0x01fff07f;
- Value &= RISCV_IMM_REACH - 1;
- *(UINT32 *)Fixup = Value2 | (UINT32)(((RV_X(Value, 0, 5) << 7) | (RV_X(Value, 5, 7) << 25)));
+ (RV_X (*(UINT32 *)RiscVHi20Fixup, 0, 12));
+ Value2 = *(UINT32 *)Fixup & 0x01fff07f;
+ Value &= RISCV_IMM_REACH - 1;
+ *(UINT32 *)Fixup = Value2 | (UINT32)(((RV_X (Value, 0, 5) << 7) | (RV_X (Value, 5, 7) << 25)));
}
+
break;
- default:
+ default:
return RETURN_UNSUPPORTED;
-
}
+
return RETURN_SUCCESS;
}
@@ -123,10 +126,10 @@ PeCoffLoaderImageFormatSupported (
**/
RETURN_STATUS
PeHotRelocateImageEx (
- IN UINT16 *Reloc,
- IN OUT CHAR8 *Fixup,
- IN OUT CHAR8 **FixupData,
- IN UINT64 Adjust
+ IN UINT16 *Reloc,
+ IN OUT CHAR8 *Fixup,
+ IN OUT CHAR8 **FixupData,
+ IN UINT64 Adjust
)
{
return RETURN_UNSUPPORTED;
diff --git a/MdePkg/Library/BasePerformanceLibNull/PerformanceLib.c b/MdePkg/Library/BasePerformanceLibNull/PerformanceLib.c
index 239ea55fe7..61e9ec443c 100644
--- a/MdePkg/Library/BasePerformanceLibNull/PerformanceLib.c
+++ b/MdePkg/Library/BasePerformanceLibNull/PerformanceLib.c
@@ -6,10 +6,8 @@
**/
-
#include <Base.h>
-
#include <Library/PerformanceLib.h>
#include <Library/DebugLib.h>
#include <Library/PcdLib.h>
@@ -124,12 +122,12 @@ EndPerformanceMeasurement (
UINTN
EFIAPI
GetPerformanceMeasurement (
- IN UINTN LogEntryKey,
- OUT CONST VOID **Handle,
- OUT CONST CHAR8 **Token,
- OUT CONST CHAR8 **Module,
- OUT UINT64 *StartTimeStamp,
- OUT UINT64 *EndTimeStamp
+ IN UINTN LogEntryKey,
+ OUT CONST VOID **Handle,
+ OUT CONST CHAR8 **Token,
+ OUT CONST CHAR8 **Module,
+ OUT UINT64 *StartTimeStamp,
+ OUT UINT64 *EndTimeStamp
)
{
ASSERT (Handle != NULL);
@@ -259,13 +257,13 @@ EndPerformanceMeasurementEx (
UINTN
EFIAPI
GetPerformanceMeasurementEx (
- IN UINTN LogEntryKey,
- OUT CONST VOID **Handle,
- OUT CONST CHAR8 **Token,
- OUT CONST CHAR8 **Module,
- OUT UINT64 *StartTimeStamp,
- OUT UINT64 *EndTimeStamp,
- OUT UINT32 *Identifier
+ IN UINTN LogEntryKey,
+ OUT CONST VOID **Handle,
+ OUT CONST CHAR8 **Token,
+ OUT CONST CHAR8 **Module,
+ OUT UINT64 *StartTimeStamp,
+ OUT UINT64 *EndTimeStamp,
+ OUT UINT32 *Identifier
)
{
ASSERT (Handle != NULL);
@@ -296,7 +294,7 @@ PerformanceMeasurementEnabled (
VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0);
}
/**
@@ -342,14 +340,15 @@ LogPerformanceMeasurement (
BOOLEAN
EFIAPI
LogPerformanceMeasurementEnabled (
- IN CONST UINTN Type
+ IN CONST UINTN Type
)
{
//
// When Performance measurement is enabled and the type is not filtered, the performance can be logged.
//
- if (PerformanceMeasurementEnabled () && (PcdGet8(PcdPerformanceLibraryPropertyMask) & Type) == 0) {
+ if (PerformanceMeasurementEnabled () && ((PcdGet8 (PcdPerformanceLibraryPropertyMask) & Type) == 0)) {
return TRUE;
}
+
return FALSE;
}
diff --git a/MdePkg/Library/BasePostCodeLibDebug/PostCode.c b/MdePkg/Library/BasePostCodeLibDebug/PostCode.c
index 1bb4ed5e93..57a3bd6bff 100644
--- a/MdePkg/Library/BasePostCodeLibDebug/PostCode.c
+++ b/MdePkg/Library/BasePostCodeLibDebug/PostCode.c
@@ -36,11 +36,10 @@ PostCode (
IN UINT32 Value
)
{
- DEBUG((DEBUG_INFO, "POST %08x\n", Value));
+ DEBUG ((DEBUG_INFO, "POST %08x\n", Value));
return Value;
}
-
/**
Sends an 32-bit value to a POST and associated ASCII string.
@@ -72,11 +71,10 @@ PostCodeWithDescription (
IN CONST CHAR8 *Description OPTIONAL
)
{
- DEBUG((DEBUG_INFO, "POST %08x - %s\n", Value, Description));
+ DEBUG ((DEBUG_INFO, "POST %08x - %s\n", Value, Description));
return Value;
}
-
/**
Returns TRUE if POST Codes are enabled.
@@ -95,10 +93,9 @@ PostCodeEnabled (
VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);
}
-
/**
Returns TRUE if POST code descriptions are enabled.
@@ -117,5 +114,5 @@ PostCodeDescriptionEnabled (
VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED) != 0);
}
diff --git a/MdePkg/Library/BasePostCodeLibPort80/PostCode.c b/MdePkg/Library/BasePostCodeLibPort80/PostCode.c
index bcba4a733e..306906a750 100644
--- a/MdePkg/Library/BasePostCodeLibPort80/PostCode.c
+++ b/MdePkg/Library/BasePostCodeLibPort80/PostCode.c
@@ -38,27 +38,26 @@ PostCode (
)
{
switch (PcdGet8 (PcdPort80DataWidth)) {
- case 8:
- IoWrite8 (0x80, (UINT8)(Value));
- break;
- case 16:
- IoWrite16 (0x80, (UINT16)(Value));
- break;
- case 32:
- IoWrite32 (0x80, Value);
- break;
- default:
- //
- // Assert on the invalid data width
- //
- ASSERT (FALSE);
- break;
+ case 8:
+ IoWrite8 (0x80, (UINT8)(Value));
+ break;
+ case 16:
+ IoWrite16 (0x80, (UINT16)(Value));
+ break;
+ case 32:
+ IoWrite32 (0x80, Value);
+ break;
+ default:
+ //
+ // Assert on the invalid data width
+ //
+ ASSERT (FALSE);
+ break;
}
return Value;
}
-
/**
Sends an 32-bit value to a POST and associated ASCII string.
@@ -94,7 +93,6 @@ PostCodeWithDescription (
return Value;
}
-
/**
Returns TRUE if POST Codes are enabled.
@@ -113,10 +111,9 @@ PostCodeEnabled (
VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);
}
-
/**
Returns TRUE if POST code descriptions are enabled.
@@ -135,5 +132,5 @@ PostCodeDescriptionEnabled (
VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED) != 0);
}
diff --git a/MdePkg/Library/BasePrintLib/PrintLib.c b/MdePkg/Library/BasePrintLib/PrintLib.c
index 8bfbab05f5..e6f4042bb9 100644
--- a/MdePkg/Library/BasePrintLib/PrintLib.c
+++ b/MdePkg/Library/BasePrintLib/PrintLib.c
@@ -15,9 +15,9 @@
// A NULL VA_LIST can not be passed into BasePrintLibSPrintMarker() because some
// compilers define VA_LIST to be a structure.
//
-VA_LIST gNullVaList;
+VA_LIST gNullVaList;
-#define ASSERT_UNICODE_BUFFER(Buffer) ASSERT ((((UINTN) (Buffer)) & 0x01) == 0)
+#define ASSERT_UNICODE_BUFFER(Buffer) ASSERT ((((UINTN) (Buffer)) & 0x01) == 0)
/**
Produces a Null-terminated Unicode string in an output buffer based on
@@ -174,8 +174,8 @@ UnicodeSPrint (
...
)
{
- VA_LIST Marker;
- UINTN NumberOfPrinted;
+ VA_LIST Marker;
+ UINTN NumberOfPrinted;
VA_START (Marker, FormatString);
NumberOfPrinted = UnicodeVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);
@@ -334,8 +334,8 @@ UnicodeSPrintAsciiFormat (
...
)
{
- VA_LIST Marker;
- UINTN NumberOfPrinted;
+ VA_LIST Marker;
+ UINTN NumberOfPrinted;
VA_START (Marker, FormatString);
NumberOfPrinted = UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize, FormatString, Marker);
@@ -343,7 +343,6 @@ UnicodeSPrintAsciiFormat (
return NumberOfPrinted;
}
-
/**
Converts a decimal value to a Null-terminated Unicode string.
@@ -405,7 +404,7 @@ UnicodeValueToStringS (
IN UINTN Width
)
{
- ASSERT_UNICODE_BUFFER(Buffer);
+ ASSERT_UNICODE_BUFFER (Buffer);
return BasePrintLibConvertValueToStringS ((CHAR8 *)Buffer, BufferSize, Flags, Value, Width, 2);
}
@@ -449,10 +448,10 @@ UnicodeValueToStringS (
UINTN
EFIAPI
AsciiVSPrint (
- OUT CHAR8 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR8 *FormatString,
- IN VA_LIST Marker
+ OUT CHAR8 *StartOfBuffer,
+ IN UINTN BufferSize,
+ IN CONST CHAR8 *FormatString,
+ IN VA_LIST Marker
)
{
return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, 0, FormatString, Marker, NULL);
@@ -496,10 +495,10 @@ AsciiVSPrint (
UINTN
EFIAPI
AsciiBSPrint (
- OUT CHAR8 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR8 *FormatString,
- IN BASE_LIST Marker
+ OUT CHAR8 *StartOfBuffer,
+ IN UINTN BufferSize,
+ IN CONST CHAR8 *FormatString,
+ IN BASE_LIST Marker
)
{
return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, 0, FormatString, gNullVaList, Marker);
@@ -552,8 +551,8 @@ AsciiSPrint (
...
)
{
- VA_LIST Marker;
- UINTN NumberOfPrinted;
+ VA_LIST Marker;
+ UINTN NumberOfPrinted;
VA_START (Marker, FormatString);
NumberOfPrinted = AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);
@@ -712,8 +711,8 @@ AsciiSPrintUnicodeFormat (
...
)
{
- VA_LIST Marker;
- UINTN NumberOfPrinted;
+ VA_LIST Marker;
+ UINTN NumberOfPrinted;
VA_START (Marker, FormatString);
NumberOfPrinted = AsciiVSPrintUnicodeFormat (StartOfBuffer, BufferSize, FormatString, Marker);
@@ -773,11 +772,11 @@ AsciiSPrintUnicodeFormat (
RETURN_STATUS
EFIAPI
AsciiValueToStringS (
- IN OUT CHAR8 *Buffer,
- IN UINTN BufferSize,
- IN UINTN Flags,
- IN INT64 Value,
- IN UINTN Width
+ IN OUT CHAR8 *Buffer,
+ IN UINTN BufferSize,
+ IN UINTN Flags,
+ IN INT64 Value,
+ IN UINTN Width
)
{
return BasePrintLibConvertValueToStringS (Buffer, BufferSize, Flags, Value, Width, 1);
@@ -803,7 +802,7 @@ AsciiValueToStringS (
UINTN
EFIAPI
SPrintLength (
- IN CONST CHAR16 *FormatString,
+ IN CONST CHAR16 *FormatString,
IN VA_LIST Marker
)
{
@@ -829,8 +828,8 @@ SPrintLength (
UINTN
EFIAPI
SPrintLengthAsciiFormat (
- IN CONST CHAR8 *FormatString,
- IN VA_LIST Marker
+ IN CONST CHAR8 *FormatString,
+ IN VA_LIST Marker
)
{
return BasePrintLibSPrintMarker (NULL, 0, OUTPUT_UNICODE | COUNT_ONLY_NO_PRINT, (CHAR8 *)FormatString, Marker, NULL);
diff --git a/MdePkg/Library/BasePrintLib/PrintLibInternal.c b/MdePkg/Library/BasePrintLib/PrintLibInternal.c
index f389682816..42b598a432 100644
--- a/MdePkg/Library/BasePrintLib/PrintLibInternal.c
+++ b/MdePkg/Library/BasePrintLib/PrintLibInternal.c
@@ -8,14 +8,14 @@
#include "PrintLibInternal.h"
-#define WARNING_STATUS_NUMBER 5
-#define ERROR_STATUS_NUMBER 33
+#define WARNING_STATUS_NUMBER 5
+#define ERROR_STATUS_NUMBER 33
//
// Safe print checks
//
-#define RSIZE_MAX (PcdGet32 (PcdMaximumUnicodeStringLength))
-#define ASCII_RSIZE_MAX (PcdGet32 (PcdMaximumAsciiStringLength))
+#define RSIZE_MAX (PcdGet32 (PcdMaximumUnicodeStringLength))
+#define ASCII_RSIZE_MAX (PcdGet32 (PcdMaximumAsciiStringLength))
#define SAFE_PRINT_CONSTRAINT_CHECK(Expression, RetVal) \
do { \
@@ -25,12 +25,12 @@
} \
} while (FALSE)
-GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mHexStr[] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
+GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mHexStr[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
//
// Longest string: RETURN_WARN_BUFFER_TOO_SMALL => 24 characters plus NUL byte
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mWarningString[][24+1] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mWarningString[][24+1] = {
"Success", // RETURN_SUCCESS = 0
"Warning Unknown Glyph", // RETURN_WARN_UNKNOWN_GLYPH = 1
"Warning Delete Failure", // RETURN_WARN_DELETE_FAILURE = 2
@@ -42,7 +42,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mWarningString[][24+1] = {
//
// Longest string: RETURN_INCOMPATIBLE_VERSION => 20 characters plus NUL byte
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mErrorString[][20+1] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mErrorString[][20+1] = {
"Load Error", // RETURN_LOAD_ERROR = 1 | MAX_BIT
"Invalid Parameter", // RETURN_INVALID_PARAMETER = 2 | MAX_BIT
"Unsupported", // RETURN_UNSUPPORTED = 3 | MAX_BIT
@@ -78,7 +78,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mErrorString[][20+1] = {
"Compromised Data" // RETURN_COMPROMISED_DATA = 33 | MAX_BIT
};
-
/**
Internal function that places the character into the Buffer.
@@ -97,20 +96,21 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mErrorString[][20+1] = {
**/
CHAR8 *
BasePrintLibFillBuffer (
- OUT CHAR8 *Buffer,
- IN CHAR8 *EndBuffer,
- IN INTN Length,
- IN UINTN Character,
- IN INTN Increment
+ OUT CHAR8 *Buffer,
+ IN CHAR8 *EndBuffer,
+ IN INTN Length,
+ IN UINTN Character,
+ IN INTN Increment
)
{
INTN Index;
for (Index = 0; Index < Length && Buffer < EndBuffer; Index++) {
- *Buffer = (CHAR8) Character;
+ *Buffer = (CHAR8)Character;
if (Increment != 1) {
*(Buffer + 1) = (CHAR8)(Character >> 8);
}
+
Buffer += Increment;
}
@@ -143,7 +143,7 @@ BasePrintLibValueToString (
//
*Buffer = 0;
do {
- Value = (INT64)DivU64x32Remainder ((UINT64)Value, (UINT32)Radix, &Remainder);
+ Value = (INT64)DivU64x32Remainder ((UINT64)Value, (UINT32)Radix, &Remainder);
*(++Buffer) = mHexStr[Remainder];
} while (Value != 0);
@@ -193,11 +193,11 @@ BasePrintLibValueToString (
**/
UINTN
BasePrintLibConvertValueToString (
- IN OUT CHAR8 *Buffer,
- IN UINTN Flags,
- IN INT64 Value,
- IN UINTN Width,
- IN UINTN Increment
+ IN OUT CHAR8 *Buffer,
+ IN UINTN Flags,
+ IN INT64 Value,
+ IN UINTN Width,
+ IN UINTN Increment
)
{
CHAR8 *OriginalBuffer;
@@ -229,15 +229,17 @@ BasePrintLibConvertValueToString (
//
// Width is 0 or COMMA_TYPE is set, PREFIX_ZERO is ignored.
//
- if (Width == 0 || (Flags & COMMA_TYPE) != 0) {
- Flags &= ~((UINTN) PREFIX_ZERO);
+ if ((Width == 0) || ((Flags & COMMA_TYPE) != 0)) {
+ Flags &= ~((UINTN)PREFIX_ZERO);
}
+
//
// If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
//
if (Width == 0) {
Width = MAXIMUM_VALUE_CHARACTERS - 1;
}
+
//
// Set the tag for the end of the input Buffer.
//
@@ -247,7 +249,7 @@ BasePrintLibConvertValueToString (
// Convert decimal negative
//
if ((Value < 0) && ((Flags & RADIX_HEX) == 0)) {
- Value = -Value;
+ Value = -Value;
Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, '-', Increment);
Width--;
}
@@ -255,9 +257,9 @@ BasePrintLibConvertValueToString (
//
// Count the length of the value string.
//
- Radix = ((Flags & RADIX_HEX) == 0)? 10 : 16;
+ Radix = ((Flags & RADIX_HEX) == 0) ? 10 : 16;
ValueBufferPtr = BasePrintLibValueToString (ValueBuffer, Value, Radix);
- Count = ValueBufferPtr - ValueBuffer;
+ Count = ValueBufferPtr - ValueBuffer;
//
// Append Zero
@@ -273,6 +275,7 @@ BasePrintLibConvertValueToString (
if (Digits != 0) {
Digits = 3 - Digits;
}
+
for (Index = 0; Index < Count; Index++) {
Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, *ValueBufferPtr--, Increment);
if ((Flags & COMMA_TYPE) != 0) {
@@ -347,12 +350,12 @@ BasePrintLibConvertValueToString (
**/
RETURN_STATUS
BasePrintLibConvertValueToStringS (
- IN OUT CHAR8 *Buffer,
- IN UINTN BufferSize,
- IN UINTN Flags,
- IN INT64 Value,
- IN UINTN Width,
- IN UINTN Increment
+ IN OUT CHAR8 *Buffer,
+ IN UINTN BufferSize,
+ IN UINTN Flags,
+ IN INT64 Value,
+ IN UINTN Width,
+ IN UINTN Increment
)
{
CHAR8 *EndBuffer;
@@ -403,9 +406,10 @@ BasePrintLibConvertValueToStringS (
//
// Width is 0 or COMMA_TYPE is set, PREFIX_ZERO is ignored.
//
- if (Width == 0 || (Flags & COMMA_TYPE) != 0) {
- Flags &= ~((UINTN) PREFIX_ZERO);
+ if ((Width == 0) || ((Flags & COMMA_TYPE) != 0)) {
+ Flags &= ~((UINTN)PREFIX_ZERO);
}
+
//
// If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
//
@@ -417,7 +421,7 @@ BasePrintLibConvertValueToStringS (
// Count the characters of the output string.
//
Count = 0;
- Radix = ((Flags & RADIX_HEX) == 0)? 10 : 16;
+ Radix = ((Flags & RADIX_HEX) == 0) ? 10 : 16;
if ((Flags & PREFIX_ZERO) != 0) {
Count = Width;
@@ -428,6 +432,7 @@ BasePrintLibConvertValueToStringS (
} else {
ValueBufferPtr = BasePrintLibValueToString (ValueBuffer, Value, Radix);
}
+
Digits = ValueBufferPtr - ValueBuffer;
Count += Digits;
@@ -452,7 +457,7 @@ BasePrintLibConvertValueToStringS (
// Convert decimal negative
//
if ((Value < 0) && ((Flags & RADIX_HEX) == 0)) {
- Value = -Value;
+ Value = -Value;
Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, '-', Increment);
Width--;
}
@@ -461,7 +466,7 @@ BasePrintLibConvertValueToStringS (
// Count the length of the value string.
//
ValueBufferPtr = BasePrintLibValueToString (ValueBuffer, Value, Radix);
- Count = ValueBufferPtr - ValueBuffer;
+ Count = ValueBufferPtr - ValueBuffer;
//
// Append Zero
@@ -477,6 +482,7 @@ BasePrintLibConvertValueToStringS (
if (Digits != 0) {
Digits = 3 - Digits;
}
+
for (Index = 0; Index < Count; Index++) {
Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, *ValueBufferPtr--, Increment);
if ((Flags & COMMA_TYPE) != 0) {
@@ -536,36 +542,36 @@ BasePrintLibSPrintMarker (
IN BASE_LIST BaseListMarker OPTIONAL
)
{
- CHAR8 *OriginalBuffer;
- CHAR8 *EndBuffer;
- CHAR8 ValueBuffer[MAXIMUM_VALUE_CHARACTERS];
- UINT32 BytesPerOutputCharacter;
- UINTN BytesPerFormatCharacter;
- UINTN FormatMask;
- UINTN FormatCharacter;
- UINTN Width;
- UINTN Precision;
- INT64 Value;
- CONST CHAR8 *ArgumentString;
- UINTN Character;
- GUID *TmpGuid;
- TIME *TmpTime;
- UINTN Count;
- UINTN ArgumentMask;
- INTN BytesPerArgumentCharacter;
- UINTN ArgumentCharacter;
- BOOLEAN Done;
- UINTN Index;
- CHAR8 Prefix;
- BOOLEAN ZeroPad;
- BOOLEAN Comma;
- UINTN Digits;
- UINTN Radix;
- RETURN_STATUS Status;
- UINT32 GuidData1;
- UINT16 GuidData2;
- UINT16 GuidData3;
- UINTN LengthToReturn;
+ CHAR8 *OriginalBuffer;
+ CHAR8 *EndBuffer;
+ CHAR8 ValueBuffer[MAXIMUM_VALUE_CHARACTERS];
+ UINT32 BytesPerOutputCharacter;
+ UINTN BytesPerFormatCharacter;
+ UINTN FormatMask;
+ UINTN FormatCharacter;
+ UINTN Width;
+ UINTN Precision;
+ INT64 Value;
+ CONST CHAR8 *ArgumentString;
+ UINTN Character;
+ GUID *TmpGuid;
+ TIME *TmpTime;
+ UINTN Count;
+ UINTN ArgumentMask;
+ INTN BytesPerArgumentCharacter;
+ UINTN ArgumentCharacter;
+ BOOLEAN Done;
+ UINTN Index;
+ CHAR8 Prefix;
+ BOOLEAN ZeroPad;
+ BOOLEAN Comma;
+ UINTN Digits;
+ UINTN Radix;
+ RETURN_STATUS Status;
+ UINT32 GuidData1;
+ UINT16 GuidData2;
+ UINT16 GuidData3;
+ UINTN LengthToReturn;
//
// If you change this code be sure to match the 2 versions of this function.
@@ -597,11 +603,13 @@ BasePrintLibSPrintMarker (
if (RSIZE_MAX != 0) {
SAFE_PRINT_CONSTRAINT_CHECK ((BufferSize <= RSIZE_MAX), 0);
}
+
BytesPerOutputCharacter = 2;
} else {
if (ASCII_RSIZE_MAX != 0) {
SAFE_PRINT_CONSTRAINT_CHECK ((BufferSize <= ASCII_RSIZE_MAX), 0);
}
+
BytesPerOutputCharacter = 1;
}
@@ -613,14 +621,16 @@ BasePrintLibSPrintMarker (
if (RSIZE_MAX != 0) {
SAFE_PRINT_CONSTRAINT_CHECK ((StrnLenS ((CHAR16 *)Format, RSIZE_MAX + 1) <= RSIZE_MAX), 0);
}
+
BytesPerFormatCharacter = 2;
- FormatMask = 0xffff;
+ FormatMask = 0xffff;
} else {
if (ASCII_RSIZE_MAX != 0) {
SAFE_PRINT_CONSTRAINT_CHECK ((AsciiStrnLenS (Format, ASCII_RSIZE_MAX + 1) <= ASCII_RSIZE_MAX), 0);
}
+
BytesPerFormatCharacter = 1;
- FormatMask = 0xff;
+ FormatMask = 0xff;
}
if ((Flags & COUNT_ONLY_NO_PRINT) != 0) {
@@ -637,7 +647,7 @@ BasePrintLibSPrintMarker (
}
LengthToReturn = 0;
- EndBuffer = NULL;
+ EndBuffer = NULL;
OriginalBuffer = NULL;
//
@@ -665,10 +675,11 @@ BasePrintLibSPrintMarker (
if ((Buffer != NULL) && (Buffer >= EndBuffer)) {
break;
}
+
//
// Clear all the flag bits except those that may have been passed in
//
- Flags &= (UINTN) (OUTPUT_UNICODE | FORMAT_UNICODE | COUNT_ONLY_NO_PRINT);
+ Flags &= (UINTN)(OUTPUT_UNICODE | FORMAT_UNICODE | COUNT_ONLY_NO_PRINT);
//
// Set the default width to zero, and the default precision to 1
@@ -682,344 +693,415 @@ BasePrintLibSPrintMarker (
Digits = 0;
switch (FormatCharacter) {
- case '%':
- //
- // Parse Flags and Width
- //
- for (Done = FALSE; !Done; ) {
- Format += BytesPerFormatCharacter;
- FormatCharacter = ((*Format & 0xff) | ((BytesPerFormatCharacter == 1) ? 0 : (*(Format + 1) << 8))) & FormatMask;
+ case '%':
+ //
+ // Parse Flags and Width
+ //
+ for (Done = FALSE; !Done; ) {
+ Format += BytesPerFormatCharacter;
+ FormatCharacter = ((*Format & 0xff) | ((BytesPerFormatCharacter == 1) ? 0 : (*(Format + 1) << 8))) & FormatMask;
+ switch (FormatCharacter) {
+ case '.':
+ Flags |= PRECISION;
+ break;
+ case '-':
+ Flags |= LEFT_JUSTIFY;
+ break;
+ case '+':
+ Flags |= PREFIX_SIGN;
+ break;
+ case ' ':
+ Flags |= PREFIX_BLANK;
+ break;
+ case ',':
+ Flags |= COMMA_TYPE;
+ break;
+ case 'L':
+ case 'l':
+ Flags |= LONG_TYPE;
+ break;
+ case '*':
+ if ((Flags & PRECISION) == 0) {
+ Flags |= PAD_TO_WIDTH;
+ if (BaseListMarker == NULL) {
+ Width = VA_ARG (VaListMarker, UINTN);
+ } else {
+ Width = BASE_ARG (BaseListMarker, UINTN);
+ }
+ } else {
+ if (BaseListMarker == NULL) {
+ Precision = VA_ARG (VaListMarker, UINTN);
+ } else {
+ Precision = BASE_ARG (BaseListMarker, UINTN);
+ }
+ }
+
+ break;
+ case '0':
+ if ((Flags & PRECISION) == 0) {
+ Flags |= PREFIX_ZERO;
+ }
+
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ for (Count = 0; ((FormatCharacter >= '0') && (FormatCharacter <= '9')); ) {
+ Count = (Count * 10) + FormatCharacter - '0';
+ Format += BytesPerFormatCharacter;
+ FormatCharacter = ((*Format & 0xff) | ((BytesPerFormatCharacter == 1) ? 0 : (*(Format + 1) << 8))) & FormatMask;
+ }
+
+ Format -= BytesPerFormatCharacter;
+ if ((Flags & PRECISION) == 0) {
+ Flags |= PAD_TO_WIDTH;
+ Width = Count;
+ } else {
+ Precision = Count;
+ }
+
+ break;
+
+ case '\0':
+ //
+ // Make no output if Format string terminates unexpectedly when
+ // looking up for flag, width, precision and type.
+ //
+ Format -= BytesPerFormatCharacter;
+ Precision = 0;
+ //
+ // break skipped on purpose.
+ //
+ default:
+ Done = TRUE;
+ break;
+ }
+ }
+
+ //
+ // Handle each argument type
+ //
switch (FormatCharacter) {
- case '.':
- Flags |= PRECISION;
- break;
- case '-':
- Flags |= LEFT_JUSTIFY;
- break;
- case '+':
- Flags |= PREFIX_SIGN;
- break;
- case ' ':
- Flags |= PREFIX_BLANK;
- break;
- case ',':
- Flags |= COMMA_TYPE;
- break;
- case 'L':
- case 'l':
- Flags |= LONG_TYPE;
- break;
- case '*':
- if ((Flags & PRECISION) == 0) {
- Flags |= PAD_TO_WIDTH;
- if (BaseListMarker == NULL) {
- Width = VA_ARG (VaListMarker, UINTN);
- } else {
- Width = BASE_ARG (BaseListMarker, UINTN);
- }
- } else {
- if (BaseListMarker == NULL) {
- Precision = VA_ARG (VaListMarker, UINTN);
- } else {
- Precision = BASE_ARG (BaseListMarker, UINTN);
+ case 'p':
+ //
+ // Flag space, +, 0, L & l are invalid for type p.
+ //
+ Flags &= ~((UINTN)(PREFIX_BLANK | PREFIX_SIGN | PREFIX_ZERO | LONG_TYPE));
+ if (sizeof (VOID *) > 4) {
+ Flags |= LONG_TYPE;
}
- }
- break;
- case '0':
- if ((Flags & PRECISION) == 0) {
- Flags |= PREFIX_ZERO;
- }
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- for (Count = 0; ((FormatCharacter >= '0') && (FormatCharacter <= '9')); ){
- Count = (Count * 10) + FormatCharacter - '0';
- Format += BytesPerFormatCharacter;
- FormatCharacter = ((*Format & 0xff) | ((BytesPerFormatCharacter == 1) ? 0 : (*(Format + 1) << 8))) & FormatMask;
- }
- Format -= BytesPerFormatCharacter;
- if ((Flags & PRECISION) == 0) {
- Flags |= PAD_TO_WIDTH;
- Width = Count;
- } else {
- Precision = Count;
- }
- break;
- case '\0':
//
- // Make no output if Format string terminates unexpectedly when
- // looking up for flag, width, precision and type.
+ // break skipped on purpose
+ //
+ case 'X':
+ Flags |= PREFIX_ZERO;
//
- Format -= BytesPerFormatCharacter;
- Precision = 0;
+ // break skipped on purpose
//
- // break skipped on purpose.
+ case 'x':
+ Flags |= RADIX_HEX;
//
- default:
- Done = TRUE;
- break;
- }
- }
+ // break skipped on purpose
+ //
+ case 'u':
+ if ((Flags & RADIX_HEX) == 0) {
+ Flags &= ~((UINTN)(PREFIX_SIGN));
+ Flags |= UNSIGNED_TYPE;
+ }
- //
- // Handle each argument type
- //
- switch (FormatCharacter) {
- case 'p':
- //
- // Flag space, +, 0, L & l are invalid for type p.
- //
- Flags &= ~((UINTN) (PREFIX_BLANK | PREFIX_SIGN | PREFIX_ZERO | LONG_TYPE));
- if (sizeof (VOID *) > 4) {
- Flags |= LONG_TYPE;
- }
- //
- // break skipped on purpose
- //
- case 'X':
- Flags |= PREFIX_ZERO;
- //
- // break skipped on purpose
- //
- case 'x':
- Flags |= RADIX_HEX;
- //
- // break skipped on purpose
- //
- case 'u':
- if ((Flags & RADIX_HEX) == 0) {
- Flags &= ~((UINTN) (PREFIX_SIGN));
- Flags |= UNSIGNED_TYPE;
- }
- //
- // break skipped on purpose
- //
- case 'd':
- if ((Flags & LONG_TYPE) == 0) {
//
- // 'd', 'u', 'x', and 'X' that are not preceded by 'l' or 'L' are assumed to be type "int".
- // This assumption is made so the format string definition is compatible with the ANSI C
- // Specification for formatted strings. It is recommended that the Base Types be used
- // everywhere, but in this one case, compliance with ANSI C is more important, and
- // provides an implementation that is compatible with that largest possible set of CPU
- // architectures. This is why the type "int" is used in this one case.
+ // break skipped on purpose
//
- if (BaseListMarker == NULL) {
- Value = VA_ARG (VaListMarker, int);
- } else {
- Value = BASE_ARG (BaseListMarker, int);
- }
- } else {
- if (BaseListMarker == NULL) {
- Value = VA_ARG (VaListMarker, INT64);
- } else {
- Value = BASE_ARG (BaseListMarker, INT64);
- }
- }
- if ((Flags & PREFIX_BLANK) != 0) {
- Prefix = ' ';
- }
- if ((Flags & PREFIX_SIGN) != 0) {
- Prefix = '+';
- }
- if ((Flags & COMMA_TYPE) != 0) {
- Comma = TRUE;
- }
- if ((Flags & RADIX_HEX) == 0) {
- Radix = 10;
- if (Comma) {
- Flags &= ~((UINTN) PREFIX_ZERO);
- Precision = 1;
- }
- if (Value < 0 && (Flags & UNSIGNED_TYPE) == 0) {
- Flags |= PREFIX_SIGN;
- Prefix = '-';
- Value = -Value;
- } else if ((Flags & UNSIGNED_TYPE) != 0 && (Flags & LONG_TYPE) == 0) {
+ case 'd':
+ if ((Flags & LONG_TYPE) == 0) {
+ //
+ // 'd', 'u', 'x', and 'X' that are not preceded by 'l' or 'L' are assumed to be type "int".
+ // This assumption is made so the format string definition is compatible with the ANSI C
+ // Specification for formatted strings. It is recommended that the Base Types be used
+ // everywhere, but in this one case, compliance with ANSI C is more important, and
+ // provides an implementation that is compatible with that largest possible set of CPU
+ // architectures. This is why the type "int" is used in this one case.
+ //
+ if (BaseListMarker == NULL) {
+ Value = VA_ARG (VaListMarker, int);
+ } else {
+ Value = BASE_ARG (BaseListMarker, int);
+ }
+ } else {
+ if (BaseListMarker == NULL) {
+ Value = VA_ARG (VaListMarker, INT64);
+ } else {
+ Value = BASE_ARG (BaseListMarker, INT64);
+ }
+ }
+
+ if ((Flags & PREFIX_BLANK) != 0) {
+ Prefix = ' ';
+ }
+
+ if ((Flags & PREFIX_SIGN) != 0) {
+ Prefix = '+';
+ }
+
+ if ((Flags & COMMA_TYPE) != 0) {
+ Comma = TRUE;
+ }
+
+ if ((Flags & RADIX_HEX) == 0) {
+ Radix = 10;
+ if (Comma) {
+ Flags &= ~((UINTN)PREFIX_ZERO);
+ Precision = 1;
+ }
+
+ if ((Value < 0) && ((Flags & UNSIGNED_TYPE) == 0)) {
+ Flags |= PREFIX_SIGN;
+ Prefix = '-';
+ Value = -Value;
+ } else if (((Flags & UNSIGNED_TYPE) != 0) && ((Flags & LONG_TYPE) == 0)) {
+ //
+ // 'd', 'u', 'x', and 'X' that are not preceded by 'l' or 'L' are assumed to be type "int".
+ // This assumption is made so the format string definition is compatible with the ANSI C
+ // Specification for formatted strings. It is recommended that the Base Types be used
+ // everywhere, but in this one case, compliance with ANSI C is more important, and
+ // provides an implementation that is compatible with that largest possible set of CPU
+ // architectures. This is why the type "unsigned int" is used in this one case.
+ //
+ Value = (unsigned int)Value;
+ }
+ } else {
+ Radix = 16;
+ Comma = FALSE;
+ if (((Flags & LONG_TYPE) == 0) && (Value < 0)) {
+ //
+ // 'd', 'u', 'x', and 'X' that are not preceded by 'l' or 'L' are assumed to be type "int".
+ // This assumption is made so the format string definition is compatible with the ANSI C
+ // Specification for formatted strings. It is recommended that the Base Types be used
+ // everywhere, but in this one case, compliance with ANSI C is more important, and
+ // provides an implementation that is compatible with that largest possible set of CPU
+ // architectures. This is why the type "unsigned int" is used in this one case.
+ //
+ Value = (unsigned int)Value;
+ }
+ }
+
//
- // 'd', 'u', 'x', and 'X' that are not preceded by 'l' or 'L' are assumed to be type "int".
- // This assumption is made so the format string definition is compatible with the ANSI C
- // Specification for formatted strings. It is recommended that the Base Types be used
- // everywhere, but in this one case, compliance with ANSI C is more important, and
- // provides an implementation that is compatible with that largest possible set of CPU
- // architectures. This is why the type "unsigned int" is used in this one case.
+ // Convert Value to a reversed string
//
- Value = (unsigned int)Value;
- }
- } else {
- Radix = 16;
- Comma = FALSE;
- if ((Flags & LONG_TYPE) == 0 && Value < 0) {
+ Count = BasePrintLibValueToString (ValueBuffer, Value, Radix) - ValueBuffer;
+ if ((Value == 0) && (Precision == 0)) {
+ Count = 0;
+ }
+
+ ArgumentString = (CHAR8 *)ValueBuffer + Count;
+
+ Digits = Count % 3;
+ if (Digits != 0) {
+ Digits = 3 - Digits;
+ }
+
+ if (Comma && (Count != 0)) {
+ Count += ((Count - 1) / 3);
+ }
+
+ if (Prefix != 0) {
+ Count++;
+ Precision++;
+ }
+
+ Flags |= ARGUMENT_REVERSED;
+ ZeroPad = TRUE;
+ if ((Flags & PREFIX_ZERO) != 0) {
+ if ((Flags & LEFT_JUSTIFY) == 0) {
+ if ((Flags & PAD_TO_WIDTH) != 0) {
+ if ((Flags & PRECISION) == 0) {
+ Precision = Width;
+ }
+ }
+ }
+ }
+
+ break;
+
+ case 's':
+ case 'S':
+ Flags |= ARGUMENT_UNICODE;
+ //
+ // break skipped on purpose
+ //
+ case 'a':
+ if (BaseListMarker == NULL) {
+ ArgumentString = VA_ARG (VaListMarker, CHAR8 *);
+ } else {
+ ArgumentString = BASE_ARG (BaseListMarker, CHAR8 *);
+ }
+
+ if (ArgumentString == NULL) {
+ Flags &= ~((UINTN)ARGUMENT_UNICODE);
+ ArgumentString = "<null string>";
+ }
+
//
- // 'd', 'u', 'x', and 'X' that are not preceded by 'l' or 'L' are assumed to be type "int".
- // This assumption is made so the format string definition is compatible with the ANSI C
- // Specification for formatted strings. It is recommended that the Base Types be used
- // everywhere, but in this one case, compliance with ANSI C is more important, and
- // provides an implementation that is compatible with that largest possible set of CPU
- // architectures. This is why the type "unsigned int" is used in this one case.
+ // Set the default precision for string to be zero if not specified.
//
- Value = (unsigned int)Value;
- }
- }
- //
- // Convert Value to a reversed string
- //
- Count = BasePrintLibValueToString (ValueBuffer, Value, Radix) - ValueBuffer;
- if (Value == 0 && Precision == 0) {
- Count = 0;
- }
- ArgumentString = (CHAR8 *)ValueBuffer + Count;
+ if ((Flags & PRECISION) == 0) {
+ Precision = 0;
+ }
- Digits = Count % 3;
- if (Digits != 0) {
- Digits = 3 - Digits;
- }
- if (Comma && Count != 0) {
- Count += ((Count - 1) / 3);
- }
- if (Prefix != 0) {
- Count++;
- Precision++;
- }
- Flags |= ARGUMENT_REVERSED;
- ZeroPad = TRUE;
- if ((Flags & PREFIX_ZERO) != 0) {
- if ((Flags & LEFT_JUSTIFY) == 0) {
- if ((Flags & PAD_TO_WIDTH) != 0) {
- if ((Flags & PRECISION) == 0) {
- Precision = Width;
+ break;
+
+ case 'c':
+ if (BaseListMarker == NULL) {
+ Character = VA_ARG (VaListMarker, UINTN) & 0xffff;
+ } else {
+ Character = BASE_ARG (BaseListMarker, UINTN) & 0xffff;
+ }
+
+ ArgumentString = (CHAR8 *)&Character;
+ Flags |= ARGUMENT_UNICODE;
+ break;
+
+ case 'g':
+ if (BaseListMarker == NULL) {
+ TmpGuid = VA_ARG (VaListMarker, GUID *);
+ } else {
+ TmpGuid = BASE_ARG (BaseListMarker, GUID *);
+ }
+
+ if (TmpGuid == NULL) {
+ ArgumentString = "<null guid>";
+ } else {
+ GuidData1 = ReadUnaligned32 (&(TmpGuid->Data1));
+ GuidData2 = ReadUnaligned16 (&(TmpGuid->Data2));
+ GuidData3 = ReadUnaligned16 (&(TmpGuid->Data3));
+ BasePrintLibSPrint (
+ ValueBuffer,
+ MAXIMUM_VALUE_CHARACTERS,
+ 0,
+ "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+ GuidData1,
+ GuidData2,
+ GuidData3,
+ TmpGuid->Data4[0],
+ TmpGuid->Data4[1],
+ TmpGuid->Data4[2],
+ TmpGuid->Data4[3],
+ TmpGuid->Data4[4],
+ TmpGuid->Data4[5],
+ TmpGuid->Data4[6],
+ TmpGuid->Data4[7]
+ );
+ ArgumentString = ValueBuffer;
+ }
+
+ break;
+
+ case 't':
+ if (BaseListMarker == NULL) {
+ TmpTime = VA_ARG (VaListMarker, TIME *);
+ } else {
+ TmpTime = BASE_ARG (BaseListMarker, TIME *);
+ }
+
+ if (TmpTime == NULL) {
+ ArgumentString = "<null time>";
+ } else {
+ BasePrintLibSPrint (
+ ValueBuffer,
+ MAXIMUM_VALUE_CHARACTERS,
+ 0,
+ "%02d/%02d/%04d %02d:%02d",
+ TmpTime->Month,
+ TmpTime->Day,
+ TmpTime->Year,
+ TmpTime->Hour,
+ TmpTime->Minute
+ );
+ ArgumentString = ValueBuffer;
+ }
+
+ break;
+
+ case 'r':
+ if (BaseListMarker == NULL) {
+ Status = VA_ARG (VaListMarker, RETURN_STATUS);
+ } else {
+ Status = BASE_ARG (BaseListMarker, RETURN_STATUS);
+ }
+
+ ArgumentString = ValueBuffer;
+ if (RETURN_ERROR (Status)) {
+ //
+ // Clear error bit
+ //
+ Index = Status & ~MAX_BIT;
+ if ((Index > 0) && (Index <= ERROR_STATUS_NUMBER)) {
+ ArgumentString = mErrorString[Index - 1];
+ }
+ } else {
+ Index = Status;
+ if (Index <= WARNING_STATUS_NUMBER) {
+ ArgumentString = mWarningString[Index];
}
}
- }
- }
- break;
- case 's':
- case 'S':
- Flags |= ARGUMENT_UNICODE;
- //
- // break skipped on purpose
- //
- case 'a':
- if (BaseListMarker == NULL) {
- ArgumentString = VA_ARG (VaListMarker, CHAR8 *);
- } else {
- ArgumentString = BASE_ARG (BaseListMarker, CHAR8 *);
- }
- if (ArgumentString == NULL) {
- Flags &= ~((UINTN) ARGUMENT_UNICODE);
- ArgumentString = "<null string>";
- }
- //
- // Set the default precision for string to be zero if not specified.
- //
- if ((Flags & PRECISION) == 0) {
- Precision = 0;
- }
- break;
+ if (ArgumentString == ValueBuffer) {
+ BasePrintLibSPrint ((CHAR8 *)ValueBuffer, MAXIMUM_VALUE_CHARACTERS, 0, "%08X", Status);
+ }
- case 'c':
- if (BaseListMarker == NULL) {
- Character = VA_ARG (VaListMarker, UINTN) & 0xffff;
- } else {
- Character = BASE_ARG (BaseListMarker, UINTN) & 0xffff;
- }
- ArgumentString = (CHAR8 *)&Character;
- Flags |= ARGUMENT_UNICODE;
- break;
+ break;
- case 'g':
- if (BaseListMarker == NULL) {
- TmpGuid = VA_ARG (VaListMarker, GUID *);
- } else {
- TmpGuid = BASE_ARG (BaseListMarker, GUID *);
- }
- if (TmpGuid == NULL) {
- ArgumentString = "<null guid>";
- } else {
- GuidData1 = ReadUnaligned32 (&(TmpGuid->Data1));
- GuidData2 = ReadUnaligned16 (&(TmpGuid->Data2));
- GuidData3 = ReadUnaligned16 (&(TmpGuid->Data3));
- BasePrintLibSPrint (
- ValueBuffer,
- MAXIMUM_VALUE_CHARACTERS,
- 0,
- "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
- GuidData1,
- GuidData2,
- GuidData3,
- TmpGuid->Data4[0],
- TmpGuid->Data4[1],
- TmpGuid->Data4[2],
- TmpGuid->Data4[3],
- TmpGuid->Data4[4],
- TmpGuid->Data4[5],
- TmpGuid->Data4[6],
- TmpGuid->Data4[7]
- );
- ArgumentString = ValueBuffer;
- }
- break;
+ case '\r':
+ Format += BytesPerFormatCharacter;
+ FormatCharacter = ((*Format & 0xff) | ((BytesPerFormatCharacter == 1) ? 0 : (*(Format + 1) << 8))) & FormatMask;
+ if (FormatCharacter == '\n') {
+ //
+ // Translate '\r\n' to '\r\n'
+ //
+ ArgumentString = "\r\n";
+ } else {
+ //
+ // Translate '\r' to '\r'
+ //
+ ArgumentString = "\r";
+ Format -= BytesPerFormatCharacter;
+ }
- case 't':
- if (BaseListMarker == NULL) {
- TmpTime = VA_ARG (VaListMarker, TIME *);
- } else {
- TmpTime = BASE_ARG (BaseListMarker, TIME *);
- }
- if (TmpTime == NULL) {
- ArgumentString = "<null time>";
- } else {
- BasePrintLibSPrint (
- ValueBuffer,
- MAXIMUM_VALUE_CHARACTERS,
- 0,
- "%02d/%02d/%04d %02d:%02d",
- TmpTime->Month,
- TmpTime->Day,
- TmpTime->Year,
- TmpTime->Hour,
- TmpTime->Minute
- );
- ArgumentString = ValueBuffer;
- }
- break;
+ break;
- case 'r':
- if (BaseListMarker == NULL) {
- Status = VA_ARG (VaListMarker, RETURN_STATUS);
- } else {
- Status = BASE_ARG (BaseListMarker, RETURN_STATUS);
- }
- ArgumentString = ValueBuffer;
- if (RETURN_ERROR (Status)) {
- //
- // Clear error bit
- //
- Index = Status & ~MAX_BIT;
- if (Index > 0 && Index <= ERROR_STATUS_NUMBER) {
- ArgumentString = mErrorString [Index - 1];
- }
- } else {
- Index = Status;
- if (Index <= WARNING_STATUS_NUMBER) {
- ArgumentString = mWarningString [Index];
- }
- }
- if (ArgumentString == ValueBuffer) {
- BasePrintLibSPrint ((CHAR8 *) ValueBuffer, MAXIMUM_VALUE_CHARACTERS, 0, "%08X", Status);
+ case '\n':
+ //
+ // Translate '\n' to '\r\n' and '\n\r' to '\r\n'
+ //
+ ArgumentString = "\r\n";
+ Format += BytesPerFormatCharacter;
+ FormatCharacter = ((*Format & 0xff) | ((BytesPerFormatCharacter == 1) ? 0 : (*(Format + 1) << 8))) & FormatMask;
+ if (FormatCharacter != '\r') {
+ Format -= BytesPerFormatCharacter;
+ }
+
+ break;
+
+ case '%':
+ default:
+ //
+ // if the type is '%' or unknown, then print it to the screen
+ //
+ ArgumentString = (CHAR8 *)&FormatCharacter;
+ Flags |= ARGUMENT_UNICODE;
+ break;
}
+
break;
case '\r':
- Format += BytesPerFormatCharacter;
+ Format += BytesPerFormatCharacter;
FormatCharacter = ((*Format & 0xff) | ((BytesPerFormatCharacter == 1) ? 0 : (*(Format + 1) << 8))) & FormatMask;
if (FormatCharacter == '\n') {
//
@@ -1031,78 +1113,41 @@ BasePrintLibSPrintMarker (
// Translate '\r' to '\r'
//
ArgumentString = "\r";
- Format -= BytesPerFormatCharacter;
+ Format -= BytesPerFormatCharacter;
}
+
break;
case '\n':
//
// Translate '\n' to '\r\n' and '\n\r' to '\r\n'
//
- ArgumentString = "\r\n";
- Format += BytesPerFormatCharacter;
+ ArgumentString = "\r\n";
+ Format += BytesPerFormatCharacter;
FormatCharacter = ((*Format & 0xff) | ((BytesPerFormatCharacter == 1) ? 0 : (*(Format + 1) << 8))) & FormatMask;
if (FormatCharacter != '\r') {
- Format -= BytesPerFormatCharacter;
+ Format -= BytesPerFormatCharacter;
}
+
break;
- case '%':
default:
- //
- // if the type is '%' or unknown, then print it to the screen
- //
ArgumentString = (CHAR8 *)&FormatCharacter;
- Flags |= ARGUMENT_UNICODE;
+ Flags |= ARGUMENT_UNICODE;
break;
- }
- break;
-
- case '\r':
- Format += BytesPerFormatCharacter;
- FormatCharacter = ((*Format & 0xff) | ((BytesPerFormatCharacter == 1) ? 0 : (*(Format + 1) << 8))) & FormatMask;
- if (FormatCharacter == '\n') {
- //
- // Translate '\r\n' to '\r\n'
- //
- ArgumentString = "\r\n";
- } else {
- //
- // Translate '\r' to '\r'
- //
- ArgumentString = "\r";
- Format -= BytesPerFormatCharacter;
- }
- break;
-
- case '\n':
- //
- // Translate '\n' to '\r\n' and '\n\r' to '\r\n'
- //
- ArgumentString = "\r\n";
- Format += BytesPerFormatCharacter;
- FormatCharacter = ((*Format & 0xff) | ((BytesPerFormatCharacter == 1) ? 0 : (*(Format + 1) << 8))) & FormatMask;
- if (FormatCharacter != '\r') {
- Format -= BytesPerFormatCharacter;
- }
- break;
-
- default:
- ArgumentString = (CHAR8 *)&FormatCharacter;
- Flags |= ARGUMENT_UNICODE;
- break;
}
//
// Retrieve the ArgumentString attriubutes
//
if ((Flags & ARGUMENT_UNICODE) != 0) {
- ArgumentMask = 0xffff;
+ ArgumentMask = 0xffff;
BytesPerArgumentCharacter = 2;
} else {
- ArgumentMask = 0xff;
+ ArgumentMask = 0xff;
BytesPerArgumentCharacter = 1;
}
+
if ((Flags & ARGUMENT_REVERSED) != 0) {
BytesPerArgumentCharacter = -BytesPerArgumentCharacter;
} else {
@@ -1111,11 +1156,12 @@ BasePrintLibSPrintMarker (
// ArgumentString is either null-terminated, or it contains Precision characters
//
for (Count = 0;
- (ArgumentString[Count * BytesPerArgumentCharacter] != '\0' ||
- (BytesPerArgumentCharacter > 1 &&
- ArgumentString[Count * BytesPerArgumentCharacter + 1]!= '\0')) &&
- (Count < Precision || ((Flags & PRECISION) == 0));
- Count++) {
+ (ArgumentString[Count * BytesPerArgumentCharacter] != '\0' ||
+ (BytesPerArgumentCharacter > 1 &&
+ ArgumentString[Count * BytesPerArgumentCharacter + 1] != '\0')) &&
+ (Count < Precision || ((Flags & PRECISION) == 0));
+ Count++)
+ {
ArgumentCharacter = ((ArgumentString[Count * BytesPerArgumentCharacter] & 0xff) | ((ArgumentString[Count * BytesPerArgumentCharacter + 1]) << 8)) & ArgumentMask;
if (ArgumentCharacter == 0) {
break;
@@ -1132,7 +1178,7 @@ BasePrintLibSPrintMarker (
//
if ((Flags & (PAD_TO_WIDTH | LEFT_JUSTIFY)) == (PAD_TO_WIDTH)) {
LengthToReturn += ((Width - Precision) * BytesPerOutputCharacter);
- if ((Flags & COUNT_ONLY_NO_PRINT) == 0 && Buffer != NULL) {
+ if (((Flags & COUNT_ONLY_NO_PRINT) == 0) && (Buffer != NULL)) {
Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, Width - Precision, ' ', BytesPerOutputCharacter);
}
}
@@ -1140,22 +1186,24 @@ BasePrintLibSPrintMarker (
if (ZeroPad) {
if (Prefix != 0) {
LengthToReturn += (1 * BytesPerOutputCharacter);
- if ((Flags & COUNT_ONLY_NO_PRINT) == 0 && Buffer != NULL) {
+ if (((Flags & COUNT_ONLY_NO_PRINT) == 0) && (Buffer != NULL)) {
Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, Prefix, BytesPerOutputCharacter);
}
}
+
LengthToReturn += ((Precision - Count) * BytesPerOutputCharacter);
- if ((Flags & COUNT_ONLY_NO_PRINT) == 0 && Buffer != NULL) {
+ if (((Flags & COUNT_ONLY_NO_PRINT) == 0) && (Buffer != NULL)) {
Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, Precision - Count, '0', BytesPerOutputCharacter);
}
} else {
LengthToReturn += ((Precision - Count) * BytesPerOutputCharacter);
- if ((Flags & COUNT_ONLY_NO_PRINT) == 0 && Buffer != NULL) {
+ if (((Flags & COUNT_ONLY_NO_PRINT) == 0) && (Buffer != NULL)) {
Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, Precision - Count, ' ', BytesPerOutputCharacter);
}
+
if (Prefix != 0) {
LengthToReturn += (1 * BytesPerOutputCharacter);
- if ((Flags & COUNT_ONLY_NO_PRINT) == 0 && Buffer != NULL) {
+ if (((Flags & COUNT_ONLY_NO_PRINT) == 0) && (Buffer != NULL)) {
Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, Prefix, BytesPerOutputCharacter);
}
}
@@ -1174,14 +1222,16 @@ BasePrintLibSPrintMarker (
//
while (Index < Count &&
(ArgumentString[0] != '\0' ||
- (BytesPerArgumentCharacter > 1 && ArgumentString[1] != '\0'))) {
+ (BytesPerArgumentCharacter > 1 && ArgumentString[1] != '\0')))
+ {
ArgumentCharacter = ((*ArgumentString & 0xff) | (((UINT8)*(ArgumentString + 1)) << 8)) & ArgumentMask;
LengthToReturn += (1 * BytesPerOutputCharacter);
- if ((Flags & COUNT_ONLY_NO_PRINT) == 0 && Buffer != NULL) {
+ if (((Flags & COUNT_ONLY_NO_PRINT) == 0) && (Buffer != NULL)) {
Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, ArgumentCharacter, BytesPerOutputCharacter);
}
- ArgumentString += BytesPerArgumentCharacter;
+
+ ArgumentString += BytesPerArgumentCharacter;
Index++;
if (Comma) {
Digits++;
@@ -1190,7 +1240,7 @@ BasePrintLibSPrintMarker (
Index++;
if (Index < Count) {
LengthToReturn += (1 * BytesPerOutputCharacter);
- if ((Flags & COUNT_ONLY_NO_PRINT) == 0 && Buffer != NULL) {
+ if (((Flags & COUNT_ONLY_NO_PRINT) == 0) && (Buffer != NULL)) {
Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, ',', BytesPerOutputCharacter);
}
}
@@ -1203,7 +1253,7 @@ BasePrintLibSPrintMarker (
//
if ((Flags & (PAD_TO_WIDTH | LEFT_JUSTIFY)) == (PAD_TO_WIDTH | LEFT_JUSTIFY)) {
LengthToReturn += ((Width - Precision) * BytesPerOutputCharacter);
- if ((Flags & COUNT_ONLY_NO_PRINT) == 0 && Buffer != NULL) {
+ if (((Flags & COUNT_ONLY_NO_PRINT) == 0) && (Buffer != NULL)) {
Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, Width - Precision, ' ', BytesPerOutputCharacter);
}
}
diff --git a/MdePkg/Library/BasePrintLib/PrintLibInternal.h b/MdePkg/Library/BasePrintLib/PrintLibInternal.h
index 4ef7bc00aa..34d591c6fc 100644
--- a/MdePkg/Library/BasePrintLib/PrintLibInternal.h
+++ b/MdePkg/Library/BasePrintLib/PrintLibInternal.h
@@ -15,37 +15,36 @@
#include <Library/DebugLib.h>
#include <Library/PcdLib.h>
-
//
// Print primitives
//
-#define PREFIX_SIGN BIT1
-#define PREFIX_BLANK BIT2
-#define LONG_TYPE BIT4
-#define OUTPUT_UNICODE BIT6
-#define FORMAT_UNICODE BIT8
-#define PAD_TO_WIDTH BIT9
-#define ARGUMENT_UNICODE BIT10
-#define PRECISION BIT11
-#define ARGUMENT_REVERSED BIT12
-#define COUNT_ONLY_NO_PRINT BIT13
-#define UNSIGNED_TYPE BIT14
+#define PREFIX_SIGN BIT1
+#define PREFIX_BLANK BIT2
+#define LONG_TYPE BIT4
+#define OUTPUT_UNICODE BIT6
+#define FORMAT_UNICODE BIT8
+#define PAD_TO_WIDTH BIT9
+#define ARGUMENT_UNICODE BIT10
+#define PRECISION BIT11
+#define ARGUMENT_REVERSED BIT12
+#define COUNT_ONLY_NO_PRINT BIT13
+#define UNSIGNED_TYPE BIT14
//
// Record date and time information
//
typedef struct {
- UINT16 Year;
- UINT8 Month;
- UINT8 Day;
- UINT8 Hour;
- UINT8 Minute;
- UINT8 Second;
- UINT8 Pad1;
- UINT32 Nanosecond;
- INT16 TimeZone;
- UINT8 Daylight;
- UINT8 Pad2;
+ UINT16 Year;
+ UINT8 Month;
+ UINT8 Day;
+ UINT8 Hour;
+ UINT8 Minute;
+ UINT8 Second;
+ UINT8 Pad1;
+ UINT32 Nanosecond;
+ INT16 TimeZone;
+ UINT8 Daylight;
+ UINT8 Pad2;
} TIME;
/**
@@ -134,11 +133,11 @@ BasePrintLibSPrint (
**/
CHAR8 *
BasePrintLibFillBuffer (
- OUT CHAR8 *Buffer,
- IN CHAR8 *EndBuffer,
- IN INTN Length,
- IN UINTN Character,
- IN INTN Increment
+ OUT CHAR8 *Buffer,
+ IN CHAR8 *EndBuffer,
+ IN INTN Length,
+ IN UINTN Character,
+ IN INTN Increment
);
/**
@@ -200,11 +199,11 @@ BasePrintLibValueToString (
**/
UINTN
BasePrintLibConvertValueToString (
- IN OUT CHAR8 *Buffer,
- IN UINTN Flags,
- IN INT64 Value,
- IN UINTN Width,
- IN UINTN Increment
+ IN OUT CHAR8 *Buffer,
+ IN UINTN Flags,
+ IN INT64 Value,
+ IN UINTN Width,
+ IN UINTN Increment
);
/**
@@ -260,12 +259,12 @@ BasePrintLibConvertValueToString (
**/
RETURN_STATUS
BasePrintLibConvertValueToStringS (
- IN OUT CHAR8 *Buffer,
- IN UINTN BufferSize,
- IN UINTN Flags,
- IN INT64 Value,
- IN UINTN Width,
- IN UINTN Increment
+ IN OUT CHAR8 *Buffer,
+ IN UINTN BufferSize,
+ IN UINTN Flags,
+ IN INT64 Value,
+ IN UINTN Width,
+ IN UINTN Increment
);
#endif
diff --git a/MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLib.c b/MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLib.c
index 48ef2d6b3e..a1506a73e3 100644
--- a/MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLib.c
+++ b/MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLib.c
@@ -44,7 +44,6 @@ CodeTypeToPostCode (
return FALSE;
}
-
/**
Extracts ASSERT() information from a status code structure.
@@ -92,7 +91,6 @@ ReportStatusCodeExtractAssertInfo (
return FALSE;
}
-
/**
Extracts DEBUG() information from a status code structure.
@@ -139,7 +137,6 @@ ReportStatusCodeExtractDebugInfo (
return FALSE;
}
-
/**
Reports a status code.
@@ -171,7 +168,6 @@ ReportStatusCode (
return EFI_SUCCESS;
}
-
/**
Reports a status code with a Device Path Protocol as the extended data.
@@ -213,7 +209,6 @@ ReportStatusCodeWithDevicePath (
return EFI_SUCCESS;
}
-
/**
Reports a status code with an extended data buffer.
@@ -261,7 +256,6 @@ ReportStatusCodeWithExtendedData (
return EFI_SUCCESS;
}
-
/**
Reports a status code with full parameters.
@@ -318,7 +312,6 @@ ReportStatusCodeEx (
return EFI_SUCCESS;
}
-
/**
Returns TRUE if status codes of type EFI_PROGRESS_CODE are enabled
@@ -340,7 +333,6 @@ ReportProgressCodeEnabled (
return FALSE;
}
-
/**
Returns TRUE if status codes of type EFI_ERROR_CODE are enabled
@@ -362,7 +354,6 @@ ReportErrorCodeEnabled (
return FALSE;
}
-
/**
Returns TRUE if status codes of type EFI_DEBUG_CODE are enabled
@@ -383,4 +374,3 @@ ReportDebugCodeEnabled (
{
return FALSE;
}
-
diff --git a/MdePkg/Library/BaseRngLib/AArch64/ArmRng.h b/MdePkg/Library/BaseRngLib/AArch64/ArmRng.h
index e0a5673d32..2d6ef48ab9 100644
--- a/MdePkg/Library/BaseRngLib/AArch64/ArmRng.h
+++ b/MdePkg/Library/BaseRngLib/AArch64/ArmRng.h
@@ -24,7 +24,7 @@
BOOLEAN
EFIAPI
ArmRndr (
- OUT UINT64 *Rand
+ OUT UINT64 *Rand
);
/**
diff --git a/MdePkg/Library/BaseRngLib/AArch64/Rndr.c b/MdePkg/Library/BaseRngLib/AArch64/Rndr.c
index c9f8c813ed..20811bf3eb 100644
--- a/MdePkg/Library/BaseRngLib/AArch64/Rndr.c
+++ b/MdePkg/Library/BaseRngLib/AArch64/Rndr.c
@@ -17,12 +17,12 @@
#include "ArmRng.h"
#include "BaseRngLibInternals.h"
-STATIC BOOLEAN mRndrSupported;
+STATIC BOOLEAN mRndrSupported;
//
// Bit mask used to determine if RNDR instruction is supported.
//
-#define RNDR_MASK ((UINT64)MAX_UINT16 << 60U)
+#define RNDR_MASK ((UINT64)MAX_UINT16 << 60U)
/**
The constructor function checks whether or not RNDR instruction is supported
@@ -41,7 +41,8 @@ BaseRngLibConstructor (
VOID
)
{
- UINT64 Isar0;
+ UINT64 Isar0;
+
//
// Determine RNDR support by examining bits 63:60 of the ISAR0 register returned by
// MSR. A non-zero value indicates that the processor supports the RNDR instruction.
@@ -66,10 +67,10 @@ BaseRngLibConstructor (
BOOLEAN
EFIAPI
ArchGetRandomNumber16 (
- OUT UINT16 *Rand
+ OUT UINT16 *Rand
)
{
- UINT64 Rand64;
+ UINT64 Rand64;
if (ArchGetRandomNumber64 (&Rand64)) {
*Rand = Rand64 & MAX_UINT16;
@@ -91,10 +92,10 @@ ArchGetRandomNumber16 (
BOOLEAN
EFIAPI
ArchGetRandomNumber32 (
- OUT UINT32 *Rand
+ OUT UINT32 *Rand
)
{
- UINT64 Rand64;
+ UINT64 Rand64;
if (ArchGetRandomNumber64 (&Rand64)) {
*Rand = Rand64 & MAX_UINT32;
@@ -116,7 +117,7 @@ ArchGetRandomNumber32 (
BOOLEAN
EFIAPI
ArchGetRandomNumber64 (
- OUT UINT64 *Rand
+ OUT UINT64 *Rand
)
{
return ArmRndr (Rand);
diff --git a/MdePkg/Library/BaseRngLib/BaseRng.c b/MdePkg/Library/BaseRngLib/BaseRng.c
index 5b63d8f714..cbf405db81 100644
--- a/MdePkg/Library/BaseRngLib/BaseRng.c
+++ b/MdePkg/Library/BaseRngLib/BaseRng.c
@@ -19,8 +19,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
// Uses the recommended value defined in Section 7.3.17 of "Intel 64 and IA-32
// Architectures Software Developer's Manual".
//
-#define GETRANDOM_RETRY_LIMIT 10
-
+#define GETRANDOM_RETRY_LIMIT 10
/**
Generates a 16-bit random number.
@@ -36,7 +35,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
BOOLEAN
EFIAPI
GetRandomNumber16 (
- OUT UINT16 *Rand
+ OUT UINT16 *Rand
)
{
UINT32 Index;
@@ -77,7 +76,7 @@ GetRandomNumber16 (
BOOLEAN
EFIAPI
GetRandomNumber32 (
- OUT UINT32 *Rand
+ OUT UINT32 *Rand
)
{
UINT32 Index;
@@ -118,7 +117,7 @@ GetRandomNumber32 (
BOOLEAN
EFIAPI
GetRandomNumber64 (
- OUT UINT64 *Rand
+ OUT UINT64 *Rand
)
{
UINT32 Index;
@@ -159,7 +158,7 @@ GetRandomNumber64 (
BOOLEAN
EFIAPI
GetRandomNumber128 (
- OUT UINT64 *Rand
+ OUT UINT64 *Rand
)
{
ASSERT (Rand != NULL);
diff --git a/MdePkg/Library/BaseRngLib/BaseRngLibInternals.h b/MdePkg/Library/BaseRngLib/BaseRngLibInternals.h
index b6b4e9eef2..a9cbce1530 100644
--- a/MdePkg/Library/BaseRngLib/BaseRngLibInternals.h
+++ b/MdePkg/Library/BaseRngLib/BaseRngLibInternals.h
@@ -22,7 +22,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
BOOLEAN
EFIAPI
ArchGetRandomNumber16 (
- OUT UINT16 *Rand
+ OUT UINT16 *Rand
);
/**
@@ -37,7 +37,7 @@ ArchGetRandomNumber16 (
BOOLEAN
EFIAPI
ArchGetRandomNumber32 (
- OUT UINT32 *Rand
+ OUT UINT32 *Rand
);
/**
@@ -52,7 +52,7 @@ ArchGetRandomNumber32 (
BOOLEAN
EFIAPI
ArchGetRandomNumber64 (
- OUT UINT64 *Rand
+ OUT UINT64 *Rand
);
/**
@@ -71,8 +71,8 @@ ArchIsRngSupported (
#if defined (MDE_CPU_AARCH64)
// RNDR, Random Number
-#define RNDR S3_3_C2_C4_0
+#define RNDR S3_3_C2_C4_0
#endif
-#endif // BASE_RNGLIB_INTERNALS_H_
+#endif // BASE_RNGLIB_INTERNALS_H_
diff --git a/MdePkg/Library/BaseRngLib/Rand/RdRand.c b/MdePkg/Library/BaseRngLib/Rand/RdRand.c
index 09fb875ac3..070d41e255 100644
--- a/MdePkg/Library/BaseRngLib/Rand/RdRand.c
+++ b/MdePkg/Library/BaseRngLib/Rand/RdRand.c
@@ -18,10 +18,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// Bit mask used to determine if RdRand instruction is supported.
//
-#define RDRAND_MASK BIT30
+#define RDRAND_MASK BIT30
-
-STATIC BOOLEAN mRdRandSupported;
+STATIC BOOLEAN mRdRandSupported;
/**
The constructor function checks whether or not RDRAND instruction is supported
@@ -66,7 +65,7 @@ BaseRngLibConstructor (
BOOLEAN
EFIAPI
ArchGetRandomNumber16 (
- OUT UINT16 *Rand
+ OUT UINT16 *Rand
)
{
return AsmRdRand16 (Rand);
@@ -84,7 +83,7 @@ ArchGetRandomNumber16 (
BOOLEAN
EFIAPI
ArchGetRandomNumber32 (
- OUT UINT32 *Rand
+ OUT UINT32 *Rand
)
{
return AsmRdRand32 (Rand);
@@ -102,7 +101,7 @@ ArchGetRandomNumber32 (
BOOLEAN
EFIAPI
ArchGetRandomNumber64 (
- OUT UINT64 *Rand
+ OUT UINT64 *Rand
)
{
return AsmRdRand64 (Rand);
diff --git a/MdePkg/Library/BaseRngLibNull/BaseRngLibNull.c b/MdePkg/Library/BaseRngLibNull/BaseRngLibNull.c
index cad30599ea..efba5c851e 100644
--- a/MdePkg/Library/BaseRngLibNull/BaseRngLibNull.c
+++ b/MdePkg/Library/BaseRngLibNull/BaseRngLibNull.c
@@ -23,7 +23,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
BOOLEAN
EFIAPI
GetRandomNumber16 (
- OUT UINT16 *Rand
+ OUT UINT16 *Rand
)
{
ASSERT (FALSE);
@@ -44,7 +44,7 @@ GetRandomNumber16 (
BOOLEAN
EFIAPI
GetRandomNumber32 (
- OUT UINT32 *Rand
+ OUT UINT32 *Rand
)
{
ASSERT (FALSE);
@@ -65,7 +65,7 @@ GetRandomNumber32 (
BOOLEAN
EFIAPI
GetRandomNumber64 (
- OUT UINT64 *Rand
+ OUT UINT64 *Rand
)
{
ASSERT (FALSE);
@@ -86,7 +86,7 @@ GetRandomNumber64 (
BOOLEAN
EFIAPI
GetRandomNumber128 (
- OUT UINT64 *Rand
+ OUT UINT64 *Rand
)
{
ASSERT (FALSE);
diff --git a/MdePkg/Library/BaseRngLibTimerLib/RngLibTimer.c b/MdePkg/Library/BaseRngLibTimerLib/RngLibTimer.c
index 54d29d96f3..980854d67b 100644
--- a/MdePkg/Library/BaseRngLibTimerLib/RngLibTimer.c
+++ b/MdePkg/Library/BaseRngLibTimerLib/RngLibTimer.c
@@ -11,7 +11,7 @@
#include <Library/DebugLib.h>
#include <Library/TimerLib.h>
-#define DEFAULT_DELAY_TIME_IN_MICROSECONDS 10
+#define DEFAULT_DELAY_TIME_IN_MICROSECONDS 10
/**
Using the TimerLib GetPerformanceCounterProperties() we delay
@@ -26,22 +26,22 @@ CalculateMinimumDecentDelayInMicroseconds (
VOID
)
{
- UINT64 CounterHz;
+ UINT64 CounterHz;
// Get the counter properties
CounterHz = GetPerformanceCounterProperties (NULL, NULL);
// Make sure we won't divide by zero
if (CounterHz == 0) {
- ASSERT(CounterHz != 0); // Assert so the developer knows something is wrong
+ ASSERT (CounterHz != 0); // Assert so the developer knows something is wrong
return DEFAULT_DELAY_TIME_IN_MICROSECONDS;
}
+
// Calculate the minimum delay based on 1.5 microseconds divided by the hertz.
// We calculate the length of a cycle (1/CounterHz) and multiply it by 1.5 microseconds
// This ensures that the performance counter has increased by at least one
- return (UINT32)(MAX (DivU64x64Remainder (1500000,CounterHz, NULL), 1));
+ return (UINT32)(MAX (DivU64x64Remainder (1500000, CounterHz, NULL), 1));
}
-
/**
Generates a 16-bit random number.
@@ -56,11 +56,11 @@ CalculateMinimumDecentDelayInMicroseconds (
BOOLEAN
EFIAPI
GetRandomNumber16 (
- OUT UINT16 *Rand
+ OUT UINT16 *Rand
)
{
UINT32 Index;
- UINT8 *RandPtr;
+ UINT8 *RandPtr;
UINT32 DelayInMicroSeconds;
ASSERT (Rand != NULL);
@@ -68,15 +68,17 @@ GetRandomNumber16 (
if (Rand == NULL) {
return FALSE;
}
+
DelayInMicroSeconds = CalculateMinimumDecentDelayInMicroseconds ();
- RandPtr = (UINT8*)Rand;
+ RandPtr = (UINT8 *)Rand;
// Get 2 bytes of random ish data
- for (Index = 0; Index < sizeof(UINT16); Index ++) {
+ for (Index = 0; Index < sizeof (UINT16); Index++) {
*RandPtr = (UINT8)(GetPerformanceCounter () & 0xFF);
// Delay to give the performance counter a chance to change
MicroSecondDelay (DelayInMicroSeconds);
RandPtr++;
}
+
return TRUE;
}
@@ -94,11 +96,11 @@ GetRandomNumber16 (
BOOLEAN
EFIAPI
GetRandomNumber32 (
- OUT UINT32 *Rand
+ OUT UINT32 *Rand
)
{
UINT32 Index;
- UINT8 *RandPtr;
+ UINT8 *RandPtr;
UINT32 DelayInMicroSeconds;
ASSERT (Rand != NULL);
@@ -107,15 +109,16 @@ GetRandomNumber32 (
return FALSE;
}
- RandPtr = (UINT8 *) Rand;
+ RandPtr = (UINT8 *)Rand;
DelayInMicroSeconds = CalculateMinimumDecentDelayInMicroseconds ();
// Get 4 bytes of random ish data
- for (Index = 0; Index < sizeof(UINT32); Index ++) {
+ for (Index = 0; Index < sizeof (UINT32); Index++) {
*RandPtr = (UINT8)(GetPerformanceCounter () & 0xFF);
// Delay to give the performance counter a chance to change
MicroSecondDelay (DelayInMicroSeconds);
RandPtr++;
}
+
return TRUE;
}
@@ -133,11 +136,11 @@ GetRandomNumber32 (
BOOLEAN
EFIAPI
GetRandomNumber64 (
- OUT UINT64 *Rand
+ OUT UINT64 *Rand
)
{
UINT32 Index;
- UINT8 *RandPtr;
+ UINT8 *RandPtr;
UINT32 DelayInMicroSeconds;
ASSERT (Rand != NULL);
@@ -146,10 +149,10 @@ GetRandomNumber64 (
return FALSE;
}
- RandPtr = (UINT8 *)Rand;
+ RandPtr = (UINT8 *)Rand;
DelayInMicroSeconds = CalculateMinimumDecentDelayInMicroseconds ();
// Get 8 bytes of random ish data
- for (Index = 0; Index < sizeof(UINT64); Index ++) {
+ for (Index = 0; Index < sizeof (UINT64); Index++) {
*RandPtr = (UINT8)(GetPerformanceCounter () & 0xFF);
// Delay to give the performance counter a chance to change
MicroSecondDelay (DelayInMicroSeconds);
@@ -173,7 +176,7 @@ GetRandomNumber64 (
BOOLEAN
EFIAPI
GetRandomNumber128 (
- OUT UINT64 *Rand
+ OUT UINT64 *Rand
)
{
ASSERT (Rand != NULL);
diff --git a/MdePkg/Library/BaseS3BootScriptLibNull/BootScriptLib.c b/MdePkg/Library/BaseS3BootScriptLibNull/BootScriptLib.c
index f150e8b2e9..6436b95001 100644
--- a/MdePkg/Library/BaseS3BootScriptLibNull/BootScriptLib.c
+++ b/MdePkg/Library/BaseS3BootScriptLibNull/BootScriptLib.c
@@ -7,7 +7,6 @@
**/
-
#include <Base.h>
#include <Library/S3BootScriptLib.h>
@@ -25,10 +24,10 @@
RETURN_STATUS
EFIAPI
S3BootScriptSaveIoWrite (
- IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN VOID *Buffer
+ IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
+ IN UINT64 Address,
+ IN UINTN Count,
+ IN VOID *Buffer
)
{
return RETURN_SUCCESS;
@@ -48,10 +47,10 @@ S3BootScriptSaveIoWrite (
RETURN_STATUS
EFIAPI
S3BootScriptSaveIoReadWrite (
- IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
- IN UINT64 Address,
- IN VOID *Data,
- IN VOID *DataMask
+ IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
+ IN UINT64 Address,
+ IN VOID *Data,
+ IN VOID *DataMask
)
{
return RETURN_SUCCESS;
@@ -71,14 +70,15 @@ S3BootScriptSaveIoReadWrite (
RETURN_STATUS
EFIAPI
S3BootScriptSaveMemWrite (
- IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN VOID *Buffer
+ IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
+ IN UINT64 Address,
+ IN UINTN Count,
+ IN VOID *Buffer
)
{
return RETURN_SUCCESS;
}
+
/**
Adds a record for a memory modify operation into a specified boot script table.
@@ -93,14 +93,15 @@ S3BootScriptSaveMemWrite (
RETURN_STATUS
EFIAPI
S3BootScriptSaveMemReadWrite (
- IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
- IN UINT64 Address,
- IN VOID *Data,
- IN VOID *DataMask
+ IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
+ IN UINT64 Address,
+ IN VOID *Data,
+ IN VOID *DataMask
)
{
return RETURN_SUCCESS;
}
+
/**
Adds a record for a PCI configuration space write operation into a specified boot script table.
@@ -115,10 +116,10 @@ S3BootScriptSaveMemReadWrite (
RETURN_STATUS
EFIAPI
S3BootScriptSavePciCfgWrite (
- IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN VOID *Buffer
+ IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
+ IN UINT64 Address,
+ IN UINTN Count,
+ IN VOID *Buffer
)
{
return RETURN_SUCCESS;
@@ -138,14 +139,15 @@ S3BootScriptSavePciCfgWrite (
RETURN_STATUS
EFIAPI
S3BootScriptSavePciCfgReadWrite (
- IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
- IN UINT64 Address,
- IN VOID *Data,
- IN VOID *DataMask
+ IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
+ IN UINT64 Address,
+ IN VOID *Data,
+ IN VOID *DataMask
)
{
return RETURN_SUCCESS;
}
+
/**
Adds a record for a PCI configuration space modify operation into a specified boot script table.
@@ -161,15 +163,16 @@ S3BootScriptSavePciCfgReadWrite (
RETURN_STATUS
EFIAPI
S3BootScriptSavePciCfg2Write (
- IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
- IN UINT16 Segment,
- IN UINT64 Address,
- IN UINTN Count,
- IN VOID *Buffer
+ IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
+ IN UINT16 Segment,
+ IN UINT64 Address,
+ IN UINTN Count,
+ IN VOID *Buffer
)
{
return RETURN_SUCCESS;
}
+
/**
Adds a record for a PCI configuration space modify operation into a specified boot script table.
@@ -185,15 +188,16 @@ S3BootScriptSavePciCfg2Write (
RETURN_STATUS
EFIAPI
S3BootScriptSavePciCfg2ReadWrite (
- IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
- IN UINT16 Segment,
- IN UINT64 Address,
- IN VOID *Data,
- IN VOID *DataMask
+ IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
+ IN UINT16 Segment,
+ IN UINT64 Address,
+ IN VOID *Data,
+ IN VOID *DataMask
)
{
return RETURN_SUCCESS;
}
+
/**
Adds a record for an SMBus command execution into a specified boot script table.
@@ -209,14 +213,15 @@ S3BootScriptSavePciCfg2ReadWrite (
RETURN_STATUS
EFIAPI
S3BootScriptSaveSmbusExecute (
- IN UINTN SmBusAddress,
- IN EFI_SMBUS_OPERATION Operation,
- IN UINTN *Length,
- IN VOID *Buffer
+ IN UINTN SmBusAddress,
+ IN EFI_SMBUS_OPERATION Operation,
+ IN UINTN *Length,
+ IN VOID *Buffer
)
{
return RETURN_SUCCESS;
}
+
/**
Adds a record for an execution stall on the processor into a specified boot script table.
@@ -228,11 +233,12 @@ S3BootScriptSaveSmbusExecute (
RETURN_STATUS
EFIAPI
S3BootScriptSaveStall (
- IN UINTN Duration
+ IN UINTN Duration
)
{
return RETURN_SUCCESS;
}
+
/**
Adds a record for dispatching specified arbitrary code into a specified boot script table.
@@ -244,11 +250,12 @@ S3BootScriptSaveStall (
RETURN_STATUS
EFIAPI
S3BootScriptSaveDispatch (
- IN VOID *EntryPoint
+ IN VOID *EntryPoint
)
{
return RETURN_SUCCESS;
}
+
/**
Adds a record for dispatching specified arbitrary code into a specified boot script table.
@@ -261,8 +268,8 @@ S3BootScriptSaveDispatch (
RETURN_STATUS
EFIAPI
S3BootScriptSaveDispatch2 (
- IN VOID *EntryPoint,
- IN VOID *Context
+ IN VOID *EntryPoint,
+ IN VOID *Context
)
{
return RETURN_SUCCESS;
@@ -291,12 +298,12 @@ S3BootScriptSaveDispatch2 (
RETURN_STATUS
EFIAPI
S3BootScriptSaveMemPoll (
- IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
- IN UINT64 Address,
- IN VOID *BitMask,
- IN VOID *BitValue,
- IN UINTN Duration,
- IN UINT64 LoopTimes
+ IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
+ IN UINT64 Address,
+ IN VOID *BitMask,
+ IN VOID *BitValue,
+ IN UINTN Duration,
+ IN UINT64 LoopTimes
)
{
return RETURN_SUCCESS;
@@ -317,12 +324,13 @@ S3BootScriptSaveMemPoll (
RETURN_STATUS
EFIAPI
S3BootScriptSaveInformation (
- IN UINT32 InformationLength,
- IN VOID *Information
+ IN UINT32 InformationLength,
+ IN VOID *Information
)
{
return RETURN_SUCCESS;
}
+
/**
Adds a record for I/O reads the I/O location and continues when the exit criteria is satisfied or after a
defined duration.
@@ -342,11 +350,11 @@ S3BootScriptSaveInformation (
RETURN_STATUS
EFIAPI
S3BootScriptSaveIoPoll (
- IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
- IN UINT64 Address,
+ IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
+ IN UINT64 Address,
IN VOID *Data,
IN VOID *DataMask,
- IN UINT64 Delay
+ IN UINT64 Delay
)
{
return RETURN_SUCCESS;
@@ -371,15 +379,16 @@ S3BootScriptSaveIoPoll (
RETURN_STATUS
EFIAPI
S3BootScriptSavePciPoll (
- IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
- IN UINT64 Address,
- IN VOID *Data,
- IN VOID *DataMask,
- IN UINT64 Delay
- )
+ IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
+ IN UINT64 Address,
+ IN VOID *Data,
+ IN VOID *DataMask,
+ IN UINT64 Delay
+ )
{
return RETURN_SUCCESS;
}
+
/**
Adds a record for PCI configuration space reads and continues when the exit criteria is satisfied or
after a defined duration.
@@ -403,16 +412,17 @@ S3BootScriptSavePciPoll (
RETURN_STATUS
EFIAPI
S3BootScriptSavePci2Poll (
- IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
- IN UINT16 Segment,
- IN UINT64 Address,
- IN VOID *Data,
- IN VOID *DataMask,
- IN UINT64 Delay
+ IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
+ IN UINT16 Segment,
+ IN UINT64 Address,
+ IN VOID *Data,
+ IN VOID *DataMask,
+ IN UINT64 Delay
)
{
return RETURN_SUCCESS;
}
+
/**
Save ASCII string information specified by Buffer to
boot script with opcode EFI_BOOT_SCRIPT_INFORMATION_OPCODE
@@ -426,11 +436,12 @@ S3BootScriptSavePci2Poll (
RETURN_STATUS
EFIAPI
S3BootScriptSaveInformationAsciiString (
- IN CONST CHAR8 *String
+ IN CONST CHAR8 *String
)
{
return RETURN_SUCCESS;
}
+
/**
This is an function to close the S3 boot script table. The function could only be called in
BOOT time phase. To comply with the Framework spec definition on
@@ -456,7 +467,7 @@ S3BootScriptSaveInformationAsciiString (
@return the base address of the new copy of the boot script table.
**/
-UINT8*
+UINT8 *
EFIAPI
S3BootScriptCloseTable (
VOID
@@ -464,6 +475,7 @@ S3BootScriptCloseTable (
{
return 0;
}
+
/**
Executes the S3 boot script table.
@@ -473,11 +485,12 @@ S3BootScriptCloseTable (
RETURN_STATUS
EFIAPI
S3BootScriptExecute (
- VOID
+ VOID
)
{
return RETURN_SUCCESS;
}
+
/**
Move the last boot script entry to the position
@@ -496,12 +509,13 @@ S3BootScriptExecute (
RETURN_STATUS
EFIAPI
S3BootScriptMoveLastOpcode (
- IN BOOLEAN BeforeOrAfter,
- IN OUT VOID **Position OPTIONAL
-)
+ IN BOOLEAN BeforeOrAfter,
+ IN OUT VOID **Position OPTIONAL
+ )
{
return RETURN_SUCCESS;
}
+
/**
Find a label within the boot script table and, if not present, optionally create it.
@@ -527,14 +541,15 @@ S3BootScriptMoveLastOpcode (
RETURN_STATUS
EFIAPI
S3BootScriptLabel (
- IN BOOLEAN BeforeOrAfter,
- IN BOOLEAN CreateIfNotFound,
- IN OUT VOID **Position OPTIONAL,
- IN CONST CHAR8 *Label
+ IN BOOLEAN BeforeOrAfter,
+ IN BOOLEAN CreateIfNotFound,
+ IN OUT VOID **Position OPTIONAL,
+ IN CONST CHAR8 *Label
)
{
return RETURN_SUCCESS;
}
+
/**
Compare two positions in the boot script table and return their relative position.
@param Position1 The positions in the boot script table to compare
@@ -552,9 +567,9 @@ S3BootScriptLabel (
RETURN_STATUS
EFIAPI
S3BootScriptCompare (
- IN UINT8 *Position1,
- IN UINT8 *Position2,
- OUT UINTN *RelativePosition
+ IN UINT8 *Position1,
+ IN UINT8 *Position2,
+ OUT UINTN *RelativePosition
)
{
return RETURN_SUCCESS;
diff --git a/MdePkg/Library/BaseS3IoLib/S3IoLib.c b/MdePkg/Library/BaseS3IoLib/S3IoLib.c
index c68a43329b..1525826386 100644
--- a/MdePkg/Library/BaseS3IoLib/S3IoLib.c
+++ b/MdePkg/Library/BaseS3IoLib/S3IoLib.c
@@ -15,7 +15,6 @@
#include <Library/IoLib.h>
#include <Library/S3BootScriptLib.h>
-
/**
Saves an I/O port value to the boot script.
@@ -32,11 +31,11 @@
VOID
InternalSaveIoWriteValueToBootScript (
IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
- IN UINTN Port,
- IN VOID *Buffer
+ IN UINTN Port,
+ IN VOID *Buffer
)
{
- RETURN_STATUS Status;
+ RETURN_STATUS Status;
Status = S3BootScriptSaveIoWrite (
Width,
@@ -63,8 +62,8 @@ InternalSaveIoWriteValueToBootScript (
**/
UINT8
InternalSaveIoWrite8ValueToBootScript (
- IN UINTN Port,
- IN UINT8 Value
+ IN UINTN Port,
+ IN UINT8 Value
)
{
InternalSaveIoWriteValueToBootScript (S3BootScriptWidthUint8, Port, &Value);
@@ -90,7 +89,7 @@ InternalSaveIoWrite8ValueToBootScript (
UINT8
EFIAPI
S3IoRead8 (
- IN UINTN Port
+ IN UINTN Port
)
{
return InternalSaveIoWrite8ValueToBootScript (Port, IoRead8 (Port));
@@ -115,8 +114,8 @@ S3IoRead8 (
UINT8
EFIAPI
S3IoWrite8 (
- IN UINTN Port,
- IN UINT8 Value
+ IN UINTN Port,
+ IN UINT8 Value
)
{
return InternalSaveIoWrite8ValueToBootScript (Port, IoWrite8 (Port, Value));
@@ -144,8 +143,8 @@ S3IoWrite8 (
UINT8
EFIAPI
S3IoOr8 (
- IN UINTN Port,
- IN UINT8 OrData
+ IN UINTN Port,
+ IN UINT8 OrData
)
{
return InternalSaveIoWrite8ValueToBootScript (Port, IoOr8 (Port, OrData));
@@ -173,8 +172,8 @@ S3IoOr8 (
UINT8
EFIAPI
S3IoAnd8 (
- IN UINTN Port,
- IN UINT8 AndData
+ IN UINTN Port,
+ IN UINT8 AndData
)
{
return InternalSaveIoWrite8ValueToBootScript (Port, IoAnd8 (Port, AndData));
@@ -204,9 +203,9 @@ S3IoAnd8 (
UINT8
EFIAPI
S3IoAndThenOr8 (
- IN UINTN Port,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Port,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
return InternalSaveIoWrite8ValueToBootScript (Port, IoAndThenOr8 (Port, AndData, OrData));
@@ -236,9 +235,9 @@ S3IoAndThenOr8 (
UINT8
EFIAPI
S3IoBitFieldRead8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return InternalSaveIoWrite8ValueToBootScript (Port, IoBitFieldRead8 (Port, StartBit, EndBit));
@@ -272,10 +271,10 @@ S3IoBitFieldRead8 (
UINT8
EFIAPI
S3IoBitFieldWrite8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
return InternalSaveIoWrite8ValueToBootScript (Port, IoBitFieldWrite8 (Port, StartBit, EndBit, Value));
@@ -311,10 +310,10 @@ S3IoBitFieldWrite8 (
UINT8
EFIAPI
S3IoBitFieldOr8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
return InternalSaveIoWrite8ValueToBootScript (Port, IoBitFieldOr8 (Port, StartBit, EndBit, OrData));
@@ -350,10 +349,10 @@ S3IoBitFieldOr8 (
UINT8
EFIAPI
S3IoBitFieldAnd8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
return InternalSaveIoWrite8ValueToBootScript (Port, IoBitFieldAnd8 (Port, StartBit, EndBit, AndData));
@@ -392,11 +391,11 @@ S3IoBitFieldAnd8 (
UINT8
EFIAPI
S3IoBitFieldAndThenOr8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
return InternalSaveIoWrite8ValueToBootScript (Port, IoBitFieldAndThenOr8 (Port, StartBit, EndBit, AndData, OrData));
@@ -418,8 +417,8 @@ S3IoBitFieldAndThenOr8 (
**/
UINT16
InternalSaveIoWrite16ValueToBootScript (
- IN UINTN Port,
- IN UINT16 Value
+ IN UINTN Port,
+ IN UINT16 Value
)
{
InternalSaveIoWriteValueToBootScript (S3BootScriptWidthUint16, Port, &Value);
@@ -445,7 +444,7 @@ InternalSaveIoWrite16ValueToBootScript (
UINT16
EFIAPI
S3IoRead16 (
- IN UINTN Port
+ IN UINTN Port
)
{
return InternalSaveIoWrite16ValueToBootScript (Port, IoRead16 (Port));
@@ -470,8 +469,8 @@ S3IoRead16 (
UINT16
EFIAPI
S3IoWrite16 (
- IN UINTN Port,
- IN UINT16 Value
+ IN UINTN Port,
+ IN UINT16 Value
)
{
return InternalSaveIoWrite16ValueToBootScript (Port, IoWrite16 (Port, Value));
@@ -499,8 +498,8 @@ S3IoWrite16 (
UINT16
EFIAPI
S3IoOr16 (
- IN UINTN Port,
- IN UINT16 OrData
+ IN UINTN Port,
+ IN UINT16 OrData
)
{
return InternalSaveIoWrite16ValueToBootScript (Port, IoOr16 (Port, OrData));
@@ -528,8 +527,8 @@ S3IoOr16 (
UINT16
EFIAPI
S3IoAnd16 (
- IN UINTN Port,
- IN UINT16 AndData
+ IN UINTN Port,
+ IN UINT16 AndData
)
{
return InternalSaveIoWrite16ValueToBootScript (Port, IoAnd16 (Port, AndData));
@@ -559,9 +558,9 @@ S3IoAnd16 (
UINT16
EFIAPI
S3IoAndThenOr16 (
- IN UINTN Port,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Port,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
return InternalSaveIoWrite16ValueToBootScript (Port, IoAndThenOr16 (Port, AndData, OrData));
@@ -591,9 +590,9 @@ S3IoAndThenOr16 (
UINT16
EFIAPI
S3IoBitFieldRead16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return InternalSaveIoWrite16ValueToBootScript (Port, IoBitFieldRead16 (Port, StartBit, EndBit));
@@ -627,10 +626,10 @@ S3IoBitFieldRead16 (
UINT16
EFIAPI
S3IoBitFieldWrite16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
return InternalSaveIoWrite16ValueToBootScript (Port, IoBitFieldWrite16 (Port, StartBit, EndBit, Value));
@@ -666,10 +665,10 @@ S3IoBitFieldWrite16 (
UINT16
EFIAPI
S3IoBitFieldOr16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
return InternalSaveIoWrite16ValueToBootScript (Port, IoBitFieldOr16 (Port, StartBit, EndBit, OrData));
@@ -705,10 +704,10 @@ S3IoBitFieldOr16 (
UINT16
EFIAPI
S3IoBitFieldAnd16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
return InternalSaveIoWrite16ValueToBootScript (Port, IoBitFieldAnd16 (Port, StartBit, EndBit, AndData));
@@ -748,11 +747,11 @@ S3IoBitFieldAnd16 (
UINT16
EFIAPI
S3IoBitFieldAndThenOr16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
return InternalSaveIoWrite16ValueToBootScript (Port, IoBitFieldAndThenOr16 (Port, StartBit, EndBit, AndData, OrData));
@@ -774,8 +773,8 @@ S3IoBitFieldAndThenOr16 (
**/
UINT32
InternalSaveIoWrite32ValueToBootScript (
- IN UINTN Port,
- IN UINT32 Value
+ IN UINTN Port,
+ IN UINT32 Value
)
{
InternalSaveIoWriteValueToBootScript (S3BootScriptWidthUint32, Port, &Value);
@@ -801,7 +800,7 @@ InternalSaveIoWrite32ValueToBootScript (
UINT32
EFIAPI
S3IoRead32 (
- IN UINTN Port
+ IN UINTN Port
)
{
return InternalSaveIoWrite32ValueToBootScript (Port, IoRead32 (Port));
@@ -826,8 +825,8 @@ S3IoRead32 (
UINT32
EFIAPI
S3IoWrite32 (
- IN UINTN Port,
- IN UINT32 Value
+ IN UINTN Port,
+ IN UINT32 Value
)
{
return InternalSaveIoWrite32ValueToBootScript (Port, IoWrite32 (Port, Value));
@@ -855,8 +854,8 @@ S3IoWrite32 (
UINT32
EFIAPI
S3IoOr32 (
- IN UINTN Port,
- IN UINT32 OrData
+ IN UINTN Port,
+ IN UINT32 OrData
)
{
return InternalSaveIoWrite32ValueToBootScript (Port, IoOr32 (Port, OrData));
@@ -884,8 +883,8 @@ S3IoOr32 (
UINT32
EFIAPI
S3IoAnd32 (
- IN UINTN Port,
- IN UINT32 AndData
+ IN UINTN Port,
+ IN UINT32 AndData
)
{
return InternalSaveIoWrite32ValueToBootScript (Port, IoAnd32 (Port, AndData));
@@ -915,9 +914,9 @@ S3IoAnd32 (
UINT32
EFIAPI
S3IoAndThenOr32 (
- IN UINTN Port,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Port,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return InternalSaveIoWrite32ValueToBootScript (Port, IoAndThenOr32 (Port, AndData, OrData));
@@ -947,9 +946,9 @@ S3IoAndThenOr32 (
UINT32
EFIAPI
S3IoBitFieldRead32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return InternalSaveIoWrite32ValueToBootScript (Port, IoBitFieldRead32 (Port, StartBit, EndBit));
@@ -983,10 +982,10 @@ S3IoBitFieldRead32 (
UINT32
EFIAPI
S3IoBitFieldWrite32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
return InternalSaveIoWrite32ValueToBootScript (Port, IoBitFieldWrite32 (Port, StartBit, EndBit, Value));
@@ -1022,10 +1021,10 @@ S3IoBitFieldWrite32 (
UINT32
EFIAPI
S3IoBitFieldOr32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
return InternalSaveIoWrite32ValueToBootScript (Port, IoBitFieldOr32 (Port, StartBit, EndBit, OrData));
@@ -1061,10 +1060,10 @@ S3IoBitFieldOr32 (
UINT32
EFIAPI
S3IoBitFieldAnd32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
return InternalSaveIoWrite32ValueToBootScript (Port, IoBitFieldAnd32 (Port, StartBit, EndBit, AndData));
@@ -1104,11 +1103,11 @@ S3IoBitFieldAnd32 (
UINT32
EFIAPI
S3IoBitFieldAndThenOr32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return InternalSaveIoWrite32ValueToBootScript (Port, IoBitFieldAndThenOr32 (Port, StartBit, EndBit, AndData, OrData));
@@ -1130,8 +1129,8 @@ S3IoBitFieldAndThenOr32 (
**/
UINT64
InternalSaveIoWrite64ValueToBootScript (
- IN UINTN Port,
- IN UINT64 Value
+ IN UINTN Port,
+ IN UINT64 Value
)
{
InternalSaveIoWriteValueToBootScript (S3BootScriptWidthUint64, Port, &Value);
@@ -1157,7 +1156,7 @@ InternalSaveIoWrite64ValueToBootScript (
UINT64
EFIAPI
S3IoRead64 (
- IN UINTN Port
+ IN UINTN Port
)
{
return InternalSaveIoWrite64ValueToBootScript (Port, IoRead64 (Port));
@@ -1182,8 +1181,8 @@ S3IoRead64 (
UINT64
EFIAPI
S3IoWrite64 (
- IN UINTN Port,
- IN UINT64 Value
+ IN UINTN Port,
+ IN UINT64 Value
)
{
return InternalSaveIoWrite64ValueToBootScript (Port, IoWrite64 (Port, Value));
@@ -1211,8 +1210,8 @@ S3IoWrite64 (
UINT64
EFIAPI
S3IoOr64 (
- IN UINTN Port,
- IN UINT64 OrData
+ IN UINTN Port,
+ IN UINT64 OrData
)
{
return InternalSaveIoWrite64ValueToBootScript (Port, IoOr64 (Port, OrData));
@@ -1240,8 +1239,8 @@ S3IoOr64 (
UINT64
EFIAPI
S3IoAnd64 (
- IN UINTN Port,
- IN UINT64 AndData
+ IN UINTN Port,
+ IN UINT64 AndData
)
{
return InternalSaveIoWrite64ValueToBootScript (Port, IoAnd64 (Port, AndData));
@@ -1271,9 +1270,9 @@ S3IoAnd64 (
UINT64
EFIAPI
S3IoAndThenOr64 (
- IN UINTN Port,
- IN UINT64 AndData,
- IN UINT64 OrData
+ IN UINTN Port,
+ IN UINT64 AndData,
+ IN UINT64 OrData
)
{
return InternalSaveIoWrite64ValueToBootScript (Port, IoAndThenOr64 (Port, AndData, OrData));
@@ -1303,9 +1302,9 @@ S3IoAndThenOr64 (
UINT64
EFIAPI
S3IoBitFieldRead64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return InternalSaveIoWrite64ValueToBootScript (Port, IoBitFieldRead64 (Port, StartBit, EndBit));
@@ -1339,10 +1338,10 @@ S3IoBitFieldRead64 (
UINT64
EFIAPI
S3IoBitFieldWrite64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 Value
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 Value
)
{
return InternalSaveIoWrite64ValueToBootScript (Port, IoBitFieldWrite64 (Port, StartBit, EndBit, Value));
@@ -1378,10 +1377,10 @@ S3IoBitFieldWrite64 (
UINT64
EFIAPI
S3IoBitFieldOr64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 OrData
)
{
return InternalSaveIoWrite64ValueToBootScript (Port, IoBitFieldOr64 (Port, StartBit, EndBit, OrData));
@@ -1417,10 +1416,10 @@ S3IoBitFieldOr64 (
UINT64
EFIAPI
S3IoBitFieldAnd64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData
)
{
return InternalSaveIoWrite64ValueToBootScript (Port, IoBitFieldAnd64 (Port, StartBit, EndBit, AndData));
@@ -1460,11 +1459,11 @@ S3IoBitFieldAnd64 (
UINT64
EFIAPI
S3IoBitFieldAndThenOr64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData,
- IN UINT64 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData,
+ IN UINT64 OrData
)
{
return InternalSaveIoWrite64ValueToBootScript (Port, IoBitFieldAndThenOr64 (Port, StartBit, EndBit, AndData, OrData));
@@ -1486,11 +1485,11 @@ S3IoBitFieldAndThenOr64 (
VOID
InternalSaveMmioWriteValueToBootScript (
IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
- IN UINTN Address,
- IN VOID *Buffer
+ IN UINTN Address,
+ IN VOID *Buffer
)
{
- RETURN_STATUS Status;
+ RETURN_STATUS Status;
Status = S3BootScriptSaveMemWrite (
Width,
@@ -1517,8 +1516,8 @@ InternalSaveMmioWriteValueToBootScript (
**/
UINT8
InternalSaveMmioWrite8ValueToBootScript (
- IN UINTN Address,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINT8 Value
)
{
InternalSaveMmioWriteValueToBootScript (S3BootScriptWidthUint8, Address, &Value);
@@ -1544,7 +1543,7 @@ InternalSaveMmioWrite8ValueToBootScript (
UINT8
EFIAPI
S3MmioRead8 (
- IN UINTN Address
+ IN UINTN Address
)
{
return InternalSaveMmioWrite8ValueToBootScript (Address, MmioRead8 (Address));
@@ -1569,8 +1568,8 @@ S3MmioRead8 (
UINT8
EFIAPI
S3MmioWrite8 (
- IN UINTN Address,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINT8 Value
)
{
return InternalSaveMmioWrite8ValueToBootScript (Address, MmioWrite8 (Address, Value));
@@ -1598,8 +1597,8 @@ S3MmioWrite8 (
UINT8
EFIAPI
S3MmioOr8 (
- IN UINTN Address,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 OrData
)
{
return InternalSaveMmioWrite8ValueToBootScript (Address, MmioOr8 (Address, OrData));
@@ -1627,8 +1626,8 @@ S3MmioOr8 (
UINT8
EFIAPI
S3MmioAnd8 (
- IN UINTN Address,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINT8 AndData
)
{
return InternalSaveMmioWrite8ValueToBootScript (Address, MmioAnd8 (Address, AndData));
@@ -1658,9 +1657,9 @@ S3MmioAnd8 (
UINT8
EFIAPI
S3MmioAndThenOr8 (
- IN UINTN Address,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
return InternalSaveMmioWrite8ValueToBootScript (Address, MmioAndThenOr8 (Address, AndData, OrData));
@@ -1690,9 +1689,9 @@ S3MmioAndThenOr8 (
UINT8
EFIAPI
S3MmioBitFieldRead8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return InternalSaveMmioWrite8ValueToBootScript (Address, MmioBitFieldRead8 (Address, StartBit, EndBit));
@@ -1725,10 +1724,10 @@ S3MmioBitFieldRead8 (
UINT8
EFIAPI
S3MmioBitFieldWrite8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
return InternalSaveMmioWrite8ValueToBootScript (Address, MmioBitFieldWrite8 (Address, StartBit, EndBit, Value));
@@ -1765,10 +1764,10 @@ S3MmioBitFieldWrite8 (
UINT8
EFIAPI
S3MmioBitFieldOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
return InternalSaveMmioWrite8ValueToBootScript (Address, MmioBitFieldOr8 (Address, StartBit, EndBit, OrData));
@@ -1805,10 +1804,10 @@ S3MmioBitFieldOr8 (
UINT8
EFIAPI
S3MmioBitFieldAnd8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
return InternalSaveMmioWrite8ValueToBootScript (Address, MmioBitFieldAnd8 (Address, StartBit, EndBit, AndData));
@@ -1848,11 +1847,11 @@ S3MmioBitFieldAnd8 (
UINT8
EFIAPI
S3MmioBitFieldAndThenOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
return InternalSaveMmioWrite8ValueToBootScript (Address, MmioBitFieldAndThenOr8 (Address, StartBit, EndBit, AndData, OrData));
@@ -1874,8 +1873,8 @@ S3MmioBitFieldAndThenOr8 (
**/
UINT16
InternalSaveMmioWrite16ValueToBootScript (
- IN UINTN Address,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINT16 Value
)
{
InternalSaveMmioWriteValueToBootScript (S3BootScriptWidthUint16, Address, &Value);
@@ -1901,7 +1900,7 @@ InternalSaveMmioWrite16ValueToBootScript (
UINT16
EFIAPI
S3MmioRead16 (
- IN UINTN Address
+ IN UINTN Address
)
{
return InternalSaveMmioWrite16ValueToBootScript (Address, MmioRead16 (Address));
@@ -1927,8 +1926,8 @@ S3MmioRead16 (
UINT16
EFIAPI
S3MmioWrite16 (
- IN UINTN Address,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINT16 Value
)
{
return InternalSaveMmioWrite16ValueToBootScript (Address, MmioWrite16 (Address, Value));
@@ -1956,8 +1955,8 @@ S3MmioWrite16 (
UINT16
EFIAPI
S3MmioOr16 (
- IN UINTN Address,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 OrData
)
{
return InternalSaveMmioWrite16ValueToBootScript (Address, MmioOr16 (Address, OrData));
@@ -1985,8 +1984,8 @@ S3MmioOr16 (
UINT16
EFIAPI
S3MmioAnd16 (
- IN UINTN Address,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINT16 AndData
)
{
return InternalSaveMmioWrite16ValueToBootScript (Address, MmioAnd16 (Address, AndData));
@@ -2016,9 +2015,9 @@ S3MmioAnd16 (
UINT16
EFIAPI
S3MmioAndThenOr16 (
- IN UINTN Address,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
return InternalSaveMmioWrite16ValueToBootScript (Address, MmioAndThenOr16 (Address, AndData, OrData));
@@ -2048,9 +2047,9 @@ S3MmioAndThenOr16 (
UINT16
EFIAPI
S3MmioBitFieldRead16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return InternalSaveMmioWrite16ValueToBootScript (Address, MmioBitFieldRead16 (Address, StartBit, EndBit));
@@ -2083,10 +2082,10 @@ S3MmioBitFieldRead16 (
UINT16
EFIAPI
S3MmioBitFieldWrite16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
return InternalSaveMmioWrite16ValueToBootScript (Address, MmioBitFieldWrite16 (Address, StartBit, EndBit, Value));
@@ -2123,10 +2122,10 @@ S3MmioBitFieldWrite16 (
UINT16
EFIAPI
S3MmioBitFieldOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
return InternalSaveMmioWrite16ValueToBootScript (Address, MmioBitFieldOr16 (Address, StartBit, EndBit, OrData));
@@ -2163,10 +2162,10 @@ S3MmioBitFieldOr16 (
UINT16
EFIAPI
S3MmioBitFieldAnd16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
return InternalSaveMmioWrite16ValueToBootScript (Address, MmioBitFieldAnd16 (Address, StartBit, EndBit, AndData));
@@ -2206,11 +2205,11 @@ S3MmioBitFieldAnd16 (
UINT16
EFIAPI
S3MmioBitFieldAndThenOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
return InternalSaveMmioWrite16ValueToBootScript (Address, MmioBitFieldAndThenOr16 (Address, StartBit, EndBit, AndData, OrData));
@@ -2232,8 +2231,8 @@ S3MmioBitFieldAndThenOr16 (
**/
UINT32
InternalSaveMmioWrite32ValueToBootScript (
- IN UINTN Address,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINT32 Value
)
{
InternalSaveMmioWriteValueToBootScript (S3BootScriptWidthUint32, Address, &Value);
@@ -2259,7 +2258,7 @@ InternalSaveMmioWrite32ValueToBootScript (
UINT32
EFIAPI
S3MmioRead32 (
- IN UINTN Address
+ IN UINTN Address
)
{
return InternalSaveMmioWrite32ValueToBootScript (Address, MmioRead32 (Address));
@@ -2284,8 +2283,8 @@ S3MmioRead32 (
UINT32
EFIAPI
S3MmioWrite32 (
- IN UINTN Address,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINT32 Value
)
{
return InternalSaveMmioWrite32ValueToBootScript (Address, MmioWrite32 (Address, Value));
@@ -2313,8 +2312,8 @@ S3MmioWrite32 (
UINT32
EFIAPI
S3MmioOr32 (
- IN UINTN Address,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 OrData
)
{
return InternalSaveMmioWrite32ValueToBootScript (Address, MmioOr32 (Address, OrData));
@@ -2342,8 +2341,8 @@ S3MmioOr32 (
UINT32
EFIAPI
S3MmioAnd32 (
- IN UINTN Address,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINT32 AndData
)
{
return InternalSaveMmioWrite32ValueToBootScript (Address, MmioAnd32 (Address, AndData));
@@ -2373,9 +2372,9 @@ S3MmioAnd32 (
UINT32
EFIAPI
S3MmioAndThenOr32 (
- IN UINTN Address,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return InternalSaveMmioWrite32ValueToBootScript (Address, MmioAndThenOr32 (Address, AndData, OrData));
@@ -2405,9 +2404,9 @@ S3MmioAndThenOr32 (
UINT32
EFIAPI
S3MmioBitFieldRead32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return InternalSaveMmioWrite32ValueToBootScript (Address, MmioBitFieldRead32 (Address, StartBit, EndBit));
@@ -2440,10 +2439,10 @@ S3MmioBitFieldRead32 (
UINT32
EFIAPI
S3MmioBitFieldWrite32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
return InternalSaveMmioWrite32ValueToBootScript (Address, MmioBitFieldWrite32 (Address, StartBit, EndBit, Value));
@@ -2480,10 +2479,10 @@ S3MmioBitFieldWrite32 (
UINT32
EFIAPI
S3MmioBitFieldOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
return InternalSaveMmioWrite32ValueToBootScript (Address, MmioBitFieldOr32 (Address, StartBit, EndBit, OrData));
@@ -2520,10 +2519,10 @@ S3MmioBitFieldOr32 (
UINT32
EFIAPI
S3MmioBitFieldAnd32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
return InternalSaveMmioWrite32ValueToBootScript (Address, MmioBitFieldAnd32 (Address, StartBit, EndBit, AndData));
@@ -2563,11 +2562,11 @@ S3MmioBitFieldAnd32 (
UINT32
EFIAPI
S3MmioBitFieldAndThenOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return InternalSaveMmioWrite32ValueToBootScript (Address, MmioBitFieldAndThenOr32 (Address, StartBit, EndBit, AndData, OrData));
@@ -2589,8 +2588,8 @@ S3MmioBitFieldAndThenOr32 (
**/
UINT64
InternalSaveMmioWrite64ValueToBootScript (
- IN UINTN Address,
- IN UINT64 Value
+ IN UINTN Address,
+ IN UINT64 Value
)
{
InternalSaveMmioWriteValueToBootScript (S3BootScriptWidthUint64, Address, &Value);
@@ -2616,7 +2615,7 @@ InternalSaveMmioWrite64ValueToBootScript (
UINT64
EFIAPI
S3MmioRead64 (
- IN UINTN Address
+ IN UINTN Address
)
{
return InternalSaveMmioWrite64ValueToBootScript (Address, MmioRead64 (Address));
@@ -2641,8 +2640,8 @@ S3MmioRead64 (
UINT64
EFIAPI
S3MmioWrite64 (
- IN UINTN Address,
- IN UINT64 Value
+ IN UINTN Address,
+ IN UINT64 Value
)
{
return InternalSaveMmioWrite64ValueToBootScript (Address, MmioWrite64 (Address, Value));
@@ -2670,8 +2669,8 @@ S3MmioWrite64 (
UINT64
EFIAPI
S3MmioOr64 (
- IN UINTN Address,
- IN UINT64 OrData
+ IN UINTN Address,
+ IN UINT64 OrData
)
{
return InternalSaveMmioWrite64ValueToBootScript (Address, MmioOr64 (Address, OrData));
@@ -2699,8 +2698,8 @@ S3MmioOr64 (
UINT64
EFIAPI
S3MmioAnd64 (
- IN UINTN Address,
- IN UINT64 AndData
+ IN UINTN Address,
+ IN UINT64 AndData
)
{
return InternalSaveMmioWrite64ValueToBootScript (Address, MmioAnd64 (Address, AndData));
@@ -2730,9 +2729,9 @@ S3MmioAnd64 (
UINT64
EFIAPI
S3MmioAndThenOr64 (
- IN UINTN Address,
- IN UINT64 AndData,
- IN UINT64 OrData
+ IN UINTN Address,
+ IN UINT64 AndData,
+ IN UINT64 OrData
)
{
return InternalSaveMmioWrite64ValueToBootScript (Address, MmioAndThenOr64 (Address, AndData, OrData));
@@ -2762,9 +2761,9 @@ S3MmioAndThenOr64 (
UINT64
EFIAPI
S3MmioBitFieldRead64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return InternalSaveMmioWrite64ValueToBootScript (Address, MmioBitFieldRead64 (Address, StartBit, EndBit));
@@ -2797,10 +2796,10 @@ S3MmioBitFieldRead64 (
UINT64
EFIAPI
S3MmioBitFieldWrite64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 Value
)
{
return InternalSaveMmioWrite64ValueToBootScript (Address, MmioBitFieldWrite64 (Address, StartBit, EndBit, Value));
@@ -2837,10 +2836,10 @@ S3MmioBitFieldWrite64 (
UINT64
EFIAPI
S3MmioBitFieldOr64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 OrData
)
{
return InternalSaveMmioWrite64ValueToBootScript (Address, MmioBitFieldOr64 (Address, StartBit, EndBit, OrData));
@@ -2877,10 +2876,10 @@ S3MmioBitFieldOr64 (
UINT64
EFIAPI
S3MmioBitFieldAnd64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData
)
{
return InternalSaveMmioWrite64ValueToBootScript (Address, MmioBitFieldAnd64 (Address, StartBit, EndBit, AndData));
@@ -2920,11 +2919,11 @@ S3MmioBitFieldAnd64 (
UINT64
EFIAPI
S3MmioBitFieldAndThenOr64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData,
- IN UINT64 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData,
+ IN UINT64 OrData
)
{
return InternalSaveMmioWrite64ValueToBootScript (Address, MmioBitFieldAndThenOr64 (Address, StartBit, EndBit, AndData, OrData));
@@ -2952,12 +2951,12 @@ S3MmioBitFieldAndThenOr64 (
UINT8 *
EFIAPI
S3MmioReadBuffer8 (
- IN UINTN StartAddress,
- IN UINTN Length,
- OUT UINT8 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ OUT UINT8 *Buffer
)
{
- UINT8 *ReturnBuffer;
+ UINT8 *ReturnBuffer;
RETURN_STATUS Status;
ReturnBuffer = MmioReadBuffer8 (StartAddress, Length, Buffer);
@@ -2999,13 +2998,13 @@ S3MmioReadBuffer8 (
UINT16 *
EFIAPI
S3MmioReadBuffer16 (
- IN UINTN StartAddress,
- IN UINTN Length,
- OUT UINT16 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ OUT UINT16 *Buffer
)
{
- UINT16 *ReturnBuffer;
- RETURN_STATUS Status;
+ UINT16 *ReturnBuffer;
+ RETURN_STATUS Status;
ReturnBuffer = MmioReadBuffer16 (StartAddress, Length, Buffer);
@@ -3046,12 +3045,12 @@ S3MmioReadBuffer16 (
UINT32 *
EFIAPI
S3MmioReadBuffer32 (
- IN UINTN StartAddress,
- IN UINTN Length,
- OUT UINT32 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ OUT UINT32 *Buffer
)
{
- UINT32 *ReturnBuffer;
+ UINT32 *ReturnBuffer;
RETURN_STATUS Status;
ReturnBuffer = MmioReadBuffer32 (StartAddress, Length, Buffer);
@@ -3093,12 +3092,12 @@ S3MmioReadBuffer32 (
UINT64 *
EFIAPI
S3MmioReadBuffer64 (
- IN UINTN StartAddress,
- IN UINTN Length,
- OUT UINT64 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ OUT UINT64 *Buffer
)
{
- UINT64 *ReturnBuffer;
+ UINT64 *ReturnBuffer;
RETURN_STATUS Status;
ReturnBuffer = MmioReadBuffer64 (StartAddress, Length, Buffer);
@@ -3114,7 +3113,6 @@ S3MmioReadBuffer64 (
return ReturnBuffer;
}
-
/**
Copy data from system memory to MMIO region by using 8-bit access
and saves the value in the S3 script to be replayed on S3 resume.
@@ -3137,12 +3135,12 @@ S3MmioReadBuffer64 (
UINT8 *
EFIAPI
S3MmioWriteBuffer8 (
- IN UINTN StartAddress,
- IN UINTN Length,
- IN CONST UINT8 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ IN CONST UINT8 *Buffer
)
{
- UINT8 *ReturnBuffer;
+ UINT8 *ReturnBuffer;
RETURN_STATUS Status;
ReturnBuffer = MmioWriteBuffer8 (StartAddress, Length, Buffer);
@@ -3185,12 +3183,12 @@ S3MmioWriteBuffer8 (
UINT16 *
EFIAPI
S3MmioWriteBuffer16 (
- IN UINTN StartAddress,
- IN UINTN Length,
- IN CONST UINT16 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ IN CONST UINT16 *Buffer
)
{
- UINT16 *ReturnBuffer;
+ UINT16 *ReturnBuffer;
RETURN_STATUS Status;
ReturnBuffer = MmioWriteBuffer16 (StartAddress, Length, Buffer);
@@ -3206,7 +3204,6 @@ S3MmioWriteBuffer16 (
return ReturnBuffer;
}
-
/**
Copy data from system memory to MMIO region by using 32-bit access
and saves the value in the S3 script to be replayed on S3 resume.
@@ -3234,12 +3231,12 @@ S3MmioWriteBuffer16 (
UINT32 *
EFIAPI
S3MmioWriteBuffer32 (
- IN UINTN StartAddress,
- IN UINTN Length,
- IN CONST UINT32 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ IN CONST UINT32 *Buffer
)
{
- UINT32 *ReturnBuffer;
+ UINT32 *ReturnBuffer;
RETURN_STATUS Status;
ReturnBuffer = MmioWriteBuffer32 (StartAddress, Length, Buffer);
@@ -3282,12 +3279,12 @@ S3MmioWriteBuffer32 (
UINT64 *
EFIAPI
S3MmioWriteBuffer64 (
- IN UINTN StartAddress,
- IN UINTN Length,
- IN CONST UINT64 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ IN CONST UINT64 *Buffer
)
{
- UINT64 *ReturnBuffer;
+ UINT64 *ReturnBuffer;
RETURN_STATUS Status;
ReturnBuffer = MmioWriteBuffer64 (StartAddress, Length, Buffer);
@@ -3302,4 +3299,3 @@ S3MmioWriteBuffer64 (
return ReturnBuffer;
}
-
diff --git a/MdePkg/Library/BaseS3PciLib/S3PciLib.c b/MdePkg/Library/BaseS3PciLib/S3PciLib.c
index cae12a1f66..6530d38da9 100644
--- a/MdePkg/Library/BaseS3PciLib/S3PciLib.c
+++ b/MdePkg/Library/BaseS3PciLib/S3PciLib.c
@@ -9,7 +9,6 @@
**/
-
#include <Base.h>
#include <Library/DebugLib.h>
@@ -37,15 +36,15 @@
VOID
InternalSavePciWriteValueToBootScript (
IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
- IN UINTN Address,
- IN VOID *Buffer
+ IN UINTN Address,
+ IN VOID *Buffer
)
{
- RETURN_STATUS Status;
+ RETURN_STATUS Status;
Status = S3BootScriptSavePciCfgWrite (
Width,
- PCILIB_TO_COMMON_ADDRESS(Address),
+ PCILIB_TO_COMMON_ADDRESS (Address),
1,
Buffer
);
@@ -69,8 +68,8 @@ InternalSavePciWriteValueToBootScript (
**/
UINT8
InternalSavePciWrite8ValueToBootScript (
- IN UINTN Address,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINT8 Value
)
{
InternalSavePciWriteValueToBootScript (S3BootScriptWidthUint8, Address, &Value);
@@ -97,7 +96,7 @@ InternalSavePciWrite8ValueToBootScript (
UINT8
EFIAPI
S3PciRead8 (
- IN UINTN Address
+ IN UINTN Address
)
{
return InternalSavePciWrite8ValueToBootScript (Address, PciRead8 (Address));
@@ -123,8 +122,8 @@ S3PciRead8 (
UINT8
EFIAPI
S3PciWrite8 (
- IN UINTN Address,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINT8 Value
)
{
return InternalSavePciWrite8ValueToBootScript (Address, PciWrite8 (Address, Value));
@@ -153,8 +152,8 @@ S3PciWrite8 (
UINT8
EFIAPI
S3PciOr8 (
- IN UINTN Address,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 OrData
)
{
return InternalSavePciWrite8ValueToBootScript (Address, PciOr8 (Address, OrData));
@@ -183,8 +182,8 @@ S3PciOr8 (
UINT8
EFIAPI
S3PciAnd8 (
- IN UINTN Address,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINT8 AndData
)
{
return InternalSavePciWrite8ValueToBootScript (Address, PciAnd8 (Address, AndData));
@@ -216,9 +215,9 @@ S3PciAnd8 (
UINT8
EFIAPI
S3PciAndThenOr8 (
- IN UINTN Address,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
return InternalSavePciWrite8ValueToBootScript (Address, PciAndThenOr8 (Address, AndData, OrData));
@@ -249,9 +248,9 @@ S3PciAndThenOr8 (
UINT8
EFIAPI
S3PciBitFieldRead8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return InternalSavePciWrite8ValueToBootScript (Address, PciBitFieldRead8 (Address, StartBit, EndBit));
@@ -285,10 +284,10 @@ S3PciBitFieldRead8 (
UINT8
EFIAPI
S3PciBitFieldWrite8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
return InternalSavePciWrite8ValueToBootScript (Address, PciBitFieldWrite8 (Address, StartBit, EndBit, Value));
@@ -325,10 +324,10 @@ S3PciBitFieldWrite8 (
UINT8
EFIAPI
S3PciBitFieldOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
return InternalSavePciWrite8ValueToBootScript (Address, PciBitFieldOr8 (Address, StartBit, EndBit, OrData));
@@ -365,10 +364,10 @@ S3PciBitFieldOr8 (
UINT8
EFIAPI
S3PciBitFieldAnd8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
return InternalSavePciWrite8ValueToBootScript (Address, PciBitFieldAnd8 (Address, StartBit, EndBit, AndData));
@@ -408,11 +407,11 @@ S3PciBitFieldAnd8 (
UINT8
EFIAPI
S3PciBitFieldAndThenOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
return InternalSavePciWrite8ValueToBootScript (Address, PciBitFieldAndThenOr8 (Address, StartBit, EndBit, AndData, OrData));
@@ -435,8 +434,8 @@ S3PciBitFieldAndThenOr8 (
**/
UINT16
InternalSavePciWrite16ValueToBootScript (
- IN UINTN Address,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINT16 Value
)
{
InternalSavePciWriteValueToBootScript (S3BootScriptWidthUint16, Address, &Value);
@@ -464,7 +463,7 @@ InternalSavePciWrite16ValueToBootScript (
UINT16
EFIAPI
S3PciRead16 (
- IN UINTN Address
+ IN UINTN Address
)
{
return InternalSavePciWrite16ValueToBootScript (Address, PciRead16 (Address));
@@ -491,8 +490,8 @@ S3PciRead16 (
UINT16
EFIAPI
S3PciWrite16 (
- IN UINTN Address,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINT16 Value
)
{
return InternalSavePciWrite16ValueToBootScript (Address, PciWrite16 (Address, Value));
@@ -522,8 +521,8 @@ S3PciWrite16 (
UINT16
EFIAPI
S3PciOr16 (
- IN UINTN Address,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 OrData
)
{
return InternalSavePciWrite16ValueToBootScript (Address, PciOr16 (Address, OrData));
@@ -553,8 +552,8 @@ S3PciOr16 (
UINT16
EFIAPI
S3PciAnd16 (
- IN UINTN Address,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINT16 AndData
)
{
return InternalSavePciWrite16ValueToBootScript (Address, PciAnd16 (Address, AndData));
@@ -587,9 +586,9 @@ S3PciAnd16 (
UINT16
EFIAPI
S3PciAndThenOr16 (
- IN UINTN Address,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
return InternalSavePciWrite16ValueToBootScript (Address, PciAndThenOr16 (Address, AndData, OrData));
@@ -621,9 +620,9 @@ S3PciAndThenOr16 (
UINT16
EFIAPI
S3PciBitFieldRead16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return InternalSavePciWrite16ValueToBootScript (Address, PciBitFieldRead16 (Address, StartBit, EndBit));
@@ -658,10 +657,10 @@ S3PciBitFieldRead16 (
UINT16
EFIAPI
S3PciBitFieldWrite16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
return InternalSavePciWrite16ValueToBootScript (Address, PciBitFieldWrite16 (Address, StartBit, EndBit, Value));
@@ -699,10 +698,10 @@ S3PciBitFieldWrite16 (
UINT16
EFIAPI
S3PciBitFieldOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
return InternalSavePciWrite16ValueToBootScript (Address, PciBitFieldOr16 (Address, StartBit, EndBit, OrData));
@@ -740,10 +739,10 @@ S3PciBitFieldOr16 (
UINT16
EFIAPI
S3PciBitFieldAnd16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
return InternalSavePciWrite16ValueToBootScript (Address, PciBitFieldAnd16 (Address, StartBit, EndBit, AndData));
@@ -784,11 +783,11 @@ S3PciBitFieldAnd16 (
UINT16
EFIAPI
S3PciBitFieldAndThenOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
return InternalSavePciWrite16ValueToBootScript (Address, PciBitFieldAndThenOr16 (Address, StartBit, EndBit, AndData, OrData));
@@ -811,8 +810,8 @@ S3PciBitFieldAndThenOr16 (
**/
UINT32
InternalSavePciWrite32ValueToBootScript (
- IN UINTN Address,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINT32 Value
)
{
InternalSavePciWriteValueToBootScript (S3BootScriptWidthUint32, Address, &Value);
@@ -840,7 +839,7 @@ InternalSavePciWrite32ValueToBootScript (
UINT32
EFIAPI
S3PciRead32 (
- IN UINTN Address
+ IN UINTN Address
)
{
return InternalSavePciWrite32ValueToBootScript (Address, PciRead32 (Address));
@@ -867,8 +866,8 @@ S3PciRead32 (
UINT32
EFIAPI
S3PciWrite32 (
- IN UINTN Address,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINT32 Value
)
{
return InternalSavePciWrite32ValueToBootScript (Address, PciWrite32 (Address, Value));
@@ -898,8 +897,8 @@ S3PciWrite32 (
UINT32
EFIAPI
S3PciOr32 (
- IN UINTN Address,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 OrData
)
{
return InternalSavePciWrite32ValueToBootScript (Address, PciOr32 (Address, OrData));
@@ -929,8 +928,8 @@ S3PciOr32 (
UINT32
EFIAPI
S3PciAnd32 (
- IN UINTN Address,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINT32 AndData
)
{
return InternalSavePciWrite32ValueToBootScript (Address, PciAnd32 (Address, AndData));
@@ -963,9 +962,9 @@ S3PciAnd32 (
UINT32
EFIAPI
S3PciAndThenOr32 (
- IN UINTN Address,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return InternalSavePciWrite32ValueToBootScript (Address, PciAndThenOr32 (Address, AndData, OrData));
@@ -997,9 +996,9 @@ S3PciAndThenOr32 (
UINT32
EFIAPI
S3PciBitFieldRead32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return InternalSavePciWrite32ValueToBootScript (Address, PciBitFieldRead32 (Address, StartBit, EndBit));
@@ -1034,10 +1033,10 @@ S3PciBitFieldRead32 (
UINT32
EFIAPI
S3PciBitFieldWrite32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
return InternalSavePciWrite32ValueToBootScript (Address, PciBitFieldWrite32 (Address, StartBit, EndBit, Value));
@@ -1075,10 +1074,10 @@ S3PciBitFieldWrite32 (
UINT32
EFIAPI
S3PciBitFieldOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
return InternalSavePciWrite32ValueToBootScript (Address, PciBitFieldOr32 (Address, StartBit, EndBit, OrData));
@@ -1116,10 +1115,10 @@ S3PciBitFieldOr32 (
UINT32
EFIAPI
S3PciBitFieldAnd32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
return InternalSavePciWrite32ValueToBootScript (Address, PciBitFieldAnd32 (Address, StartBit, EndBit, AndData));
@@ -1160,11 +1159,11 @@ S3PciBitFieldAnd32 (
UINT32
EFIAPI
S3PciBitFieldAndThenOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return InternalSavePciWrite32ValueToBootScript (Address, PciBitFieldAndThenOr32 (Address, StartBit, EndBit, AndData, OrData));
@@ -1197,12 +1196,12 @@ S3PciBitFieldAndThenOr32 (
UINTN
EFIAPI
S3PciReadBuffer (
- IN UINTN StartAddress,
- IN UINTN Size,
- OUT VOID *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Size,
+ OUT VOID *Buffer
)
{
- RETURN_STATUS Status;
+ RETURN_STATUS Status;
Status = S3BootScriptSavePciCfgWrite (
S3BootScriptWidthUint8,
@@ -1210,7 +1209,7 @@ S3PciReadBuffer (
PciReadBuffer (StartAddress, Size, Buffer),
Buffer
);
- ASSERT (Status == RETURN_SUCCESS);
+ ASSERT (Status == RETURN_SUCCESS);
return Size;
}
@@ -1243,12 +1242,12 @@ S3PciReadBuffer (
UINTN
EFIAPI
S3PciWriteBuffer (
- IN UINTN StartAddress,
- IN UINTN Size,
- IN VOID *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Size,
+ IN VOID *Buffer
)
{
- RETURN_STATUS Status;
+ RETURN_STATUS Status;
Status = S3BootScriptSavePciCfgWrite (
S3BootScriptWidthUint8,
diff --git a/MdePkg/Library/BaseS3PciSegmentLib/S3PciSegmentLib.c b/MdePkg/Library/BaseS3PciSegmentLib/S3PciSegmentLib.c
index 60d7ba24c6..28a64c1899 100644
--- a/MdePkg/Library/BaseS3PciSegmentLib/S3PciSegmentLib.c
+++ b/MdePkg/Library/BaseS3PciSegmentLib/S3PciSegmentLib.c
@@ -8,7 +8,6 @@
**/
-
#include <Base.h>
#include <Library/DebugLib.h>
@@ -46,11 +45,11 @@
VOID
InternalSavePciSegmentWriteValueToBootScript (
IN S3_BOOT_SCRIPT_LIB_WIDTH Width,
- IN UINT64 Address,
- IN VOID *Buffer
+ IN UINT64 Address,
+ IN VOID *Buffer
)
{
- RETURN_STATUS Status;
+ RETURN_STATUS Status;
Status = S3BootScriptSavePciCfg2Write (
Width,
@@ -79,8 +78,8 @@ InternalSavePciSegmentWriteValueToBootScript (
**/
UINT8
InternalSavePciSegmentWrite8ValueToBootScript (
- IN UINT64 Address,
- IN UINT8 Value
+ IN UINT64 Address,
+ IN UINT8 Value
)
{
InternalSavePciSegmentWriteValueToBootScript (S3BootScriptWidthUint8, Address, &Value);
@@ -105,7 +104,7 @@ InternalSavePciSegmentWrite8ValueToBootScript (
UINT8
EFIAPI
S3PciSegmentRead8 (
- IN UINT64 Address
+ IN UINT64 Address
)
{
return InternalSavePciSegmentWrite8ValueToBootScript (Address, PciSegmentRead8 (Address));
@@ -129,8 +128,8 @@ S3PciSegmentRead8 (
UINT8
EFIAPI
S3PciSegmentWrite8 (
- IN UINT64 Address,
- IN UINT8 Value
+ IN UINT64 Address,
+ IN UINT8 Value
)
{
return InternalSavePciSegmentWrite8ValueToBootScript (Address, PciSegmentWrite8 (Address, Value));
@@ -157,8 +156,8 @@ S3PciSegmentWrite8 (
UINT8
EFIAPI
S3PciSegmentOr8 (
- IN UINT64 Address,
- IN UINT8 OrData
+ IN UINT64 Address,
+ IN UINT8 OrData
)
{
return InternalSavePciSegmentWrite8ValueToBootScript (Address, PciSegmentOr8 (Address, OrData));
@@ -184,8 +183,8 @@ S3PciSegmentOr8 (
UINT8
EFIAPI
S3PciSegmentAnd8 (
- IN UINT64 Address,
- IN UINT8 AndData
+ IN UINT64 Address,
+ IN UINT8 AndData
)
{
return InternalSavePciSegmentWrite8ValueToBootScript (Address, PciSegmentAnd8 (Address, AndData));
@@ -215,9 +214,9 @@ S3PciSegmentAnd8 (
UINT8
EFIAPI
S3PciSegmentAndThenOr8 (
- IN UINT64 Address,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINT64 Address,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
return InternalSavePciSegmentWrite8ValueToBootScript (Address, PciSegmentAndThenOr8 (Address, AndData, OrData));
@@ -248,9 +247,9 @@ S3PciSegmentAndThenOr8 (
UINT8
EFIAPI
S3PciSegmentBitFieldRead8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return InternalSavePciSegmentWrite8ValueToBootScript (Address, PciSegmentBitFieldRead8 (Address, StartBit, EndBit));
@@ -284,10 +283,10 @@ S3PciSegmentBitFieldRead8 (
UINT8
EFIAPI
S3PciSegmentBitFieldWrite8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
return InternalSavePciSegmentWrite8ValueToBootScript (Address, PciSegmentBitFieldWrite8 (Address, StartBit, EndBit, Value));
@@ -324,10 +323,10 @@ S3PciSegmentBitFieldWrite8 (
UINT8
EFIAPI
S3PciSegmentBitFieldOr8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
return InternalSavePciSegmentWrite8ValueToBootScript (Address, PciSegmentBitFieldOr8 (Address, StartBit, EndBit, OrData));
@@ -364,10 +363,10 @@ S3PciSegmentBitFieldOr8 (
UINT8
EFIAPI
S3PciSegmentBitFieldAnd8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
return InternalSavePciSegmentWrite8ValueToBootScript (Address, PciSegmentBitFieldAnd8 (Address, StartBit, EndBit, AndData));
@@ -407,11 +406,11 @@ S3PciSegmentBitFieldAnd8 (
UINT8
EFIAPI
S3PciSegmentBitFieldAndThenOr8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
return InternalSavePciSegmentWrite8ValueToBootScript (Address, PciSegmentBitFieldAndThenOr8 (Address, StartBit, EndBit, AndData, OrData));
@@ -434,8 +433,8 @@ S3PciSegmentBitFieldAndThenOr8 (
**/
UINT16
InternalSavePciSegmentWrite16ValueToBootScript (
- IN UINT64 Address,
- IN UINT16 Value
+ IN UINT64 Address,
+ IN UINT16 Value
)
{
InternalSavePciSegmentWriteValueToBootScript (S3BootScriptWidthUint16, Address, &Value);
@@ -461,7 +460,7 @@ InternalSavePciSegmentWrite16ValueToBootScript (
UINT16
EFIAPI
S3PciSegmentRead16 (
- IN UINT64 Address
+ IN UINT64 Address
)
{
return InternalSavePciSegmentWrite16ValueToBootScript (Address, PciSegmentRead16 (Address));
@@ -486,8 +485,8 @@ S3PciSegmentRead16 (
UINT16
EFIAPI
S3PciSegmentWrite16 (
- IN UINT64 Address,
- IN UINT16 Value
+ IN UINT64 Address,
+ IN UINT16 Value
)
{
return InternalSavePciSegmentWrite16ValueToBootScript (Address, PciSegmentWrite16 (Address, Value));
@@ -516,8 +515,8 @@ S3PciSegmentWrite16 (
UINT16
EFIAPI
S3PciSegmentOr16 (
- IN UINT64 Address,
- IN UINT16 OrData
+ IN UINT64 Address,
+ IN UINT16 OrData
)
{
return InternalSavePciSegmentWrite16ValueToBootScript (Address, PciSegmentOr16 (Address, OrData));
@@ -545,8 +544,8 @@ S3PciSegmentOr16 (
UINT16
EFIAPI
S3PciSegmentAnd16 (
- IN UINT64 Address,
- IN UINT16 AndData
+ IN UINT64 Address,
+ IN UINT16 AndData
)
{
return InternalSavePciSegmentWrite16ValueToBootScript (Address, PciSegmentAnd16 (Address, AndData));
@@ -577,9 +576,9 @@ S3PciSegmentAnd16 (
UINT16
EFIAPI
S3PciSegmentAndThenOr16 (
- IN UINT64 Address,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINT64 Address,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
return InternalSavePciSegmentWrite16ValueToBootScript (Address, PciSegmentAndThenOr16 (Address, AndData, OrData));
@@ -611,9 +610,9 @@ S3PciSegmentAndThenOr16 (
UINT16
EFIAPI
S3PciSegmentBitFieldRead16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return InternalSavePciSegmentWrite16ValueToBootScript (Address, PciSegmentBitFieldRead16 (Address, StartBit, EndBit));
@@ -648,10 +647,10 @@ S3PciSegmentBitFieldRead16 (
UINT16
EFIAPI
S3PciSegmentBitFieldWrite16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
return InternalSavePciSegmentWrite16ValueToBootScript (Address, PciSegmentBitFieldWrite16 (Address, StartBit, EndBit, Value));
@@ -689,10 +688,10 @@ S3PciSegmentBitFieldWrite16 (
UINT16
EFIAPI
S3PciSegmentBitFieldOr16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
return InternalSavePciSegmentWrite16ValueToBootScript (Address, PciSegmentBitFieldOr16 (Address, StartBit, EndBit, OrData));
@@ -730,10 +729,10 @@ S3PciSegmentBitFieldOr16 (
UINT16
EFIAPI
S3PciSegmentBitFieldAnd16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
return InternalSavePciSegmentWrite16ValueToBootScript (Address, PciSegmentBitFieldAnd16 (Address, StartBit, EndBit, AndData));
@@ -773,18 +772,16 @@ S3PciSegmentBitFieldAnd16 (
UINT16
EFIAPI
S3PciSegmentBitFieldAndThenOr16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
return InternalSavePciSegmentWrite16ValueToBootScript (Address, PciSegmentBitFieldAndThenOr16 (Address, StartBit, EndBit, AndData, OrData));
}
-
-
/**
Saves a 32-bit PCI configuration value to the boot script.
@@ -802,8 +799,8 @@ S3PciSegmentBitFieldAndThenOr16 (
**/
UINT32
InternalSavePciSegmentWrite32ValueToBootScript (
- IN UINT64 Address,
- IN UINT32 Value
+ IN UINT64 Address,
+ IN UINT32 Value
)
{
InternalSavePciSegmentWriteValueToBootScript (S3BootScriptWidthUint32, Address, &Value);
@@ -829,7 +826,7 @@ InternalSavePciSegmentWrite32ValueToBootScript (
UINT32
EFIAPI
S3PciSegmentRead32 (
- IN UINT64 Address
+ IN UINT64 Address
)
{
return InternalSavePciSegmentWrite32ValueToBootScript (Address, PciSegmentRead32 (Address));
@@ -854,8 +851,8 @@ S3PciSegmentRead32 (
UINT32
EFIAPI
S3PciSegmentWrite32 (
- IN UINT64 Address,
- IN UINT32 Value
+ IN UINT64 Address,
+ IN UINT32 Value
)
{
return InternalSavePciSegmentWrite32ValueToBootScript (Address, PciSegmentWrite32 (Address, Value));
@@ -884,8 +881,8 @@ S3PciSegmentWrite32 (
UINT32
EFIAPI
S3PciSegmentOr32 (
- IN UINT64 Address,
- IN UINT32 OrData
+ IN UINT64 Address,
+ IN UINT32 OrData
)
{
return InternalSavePciSegmentWrite32ValueToBootScript (Address, PciSegmentOr32 (Address, OrData));
@@ -913,8 +910,8 @@ S3PciSegmentOr32 (
UINT32
EFIAPI
S3PciSegmentAnd32 (
- IN UINT64 Address,
- IN UINT32 AndData
+ IN UINT64 Address,
+ IN UINT32 AndData
)
{
return InternalSavePciSegmentWrite32ValueToBootScript (Address, PciSegmentAnd32 (Address, AndData));
@@ -945,9 +942,9 @@ S3PciSegmentAnd32 (
UINT32
EFIAPI
S3PciSegmentAndThenOr32 (
- IN UINT64 Address,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINT64 Address,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return InternalSavePciSegmentWrite32ValueToBootScript (Address, PciSegmentAndThenOr32 (Address, AndData, OrData));
@@ -979,9 +976,9 @@ S3PciSegmentAndThenOr32 (
UINT32
EFIAPI
S3PciSegmentBitFieldRead32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return InternalSavePciSegmentWrite32ValueToBootScript (Address, PciSegmentBitFieldRead32 (Address, StartBit, EndBit));
@@ -1016,10 +1013,10 @@ S3PciSegmentBitFieldRead32 (
UINT32
EFIAPI
S3PciSegmentBitFieldWrite32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
return InternalSavePciSegmentWrite32ValueToBootScript (Address, PciSegmentBitFieldWrite32 (Address, StartBit, EndBit, Value));
@@ -1057,10 +1054,10 @@ S3PciSegmentBitFieldWrite32 (
UINT32
EFIAPI
S3PciSegmentBitFieldOr32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
return InternalSavePciSegmentWrite32ValueToBootScript (Address, PciSegmentBitFieldOr32 (Address, StartBit, EndBit, OrData));
@@ -1098,10 +1095,10 @@ S3PciSegmentBitFieldOr32 (
UINT32
EFIAPI
S3PciSegmentBitFieldAnd32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
return InternalSavePciSegmentWrite32ValueToBootScript (Address, PciSegmentBitFieldAnd32 (Address, StartBit, EndBit, AndData));
@@ -1141,11 +1138,11 @@ S3PciSegmentBitFieldAnd32 (
UINT32
EFIAPI
S3PciSegmentBitFieldAndThenOr32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return InternalSavePciSegmentWrite32ValueToBootScript (Address, PciSegmentBitFieldAndThenOr32 (Address, StartBit, EndBit, AndData, OrData));
@@ -1178,12 +1175,12 @@ S3PciSegmentBitFieldAndThenOr32 (
UINTN
EFIAPI
S3PciSegmentReadBuffer (
- IN UINT64 StartAddress,
- IN UINTN Size,
- OUT VOID *Buffer
+ IN UINT64 StartAddress,
+ IN UINTN Size,
+ OUT VOID *Buffer
)
{
- RETURN_STATUS Status;
+ RETURN_STATUS Status;
Status = S3BootScriptSavePciCfg2Write (
S3BootScriptWidthUint8,
@@ -1224,12 +1221,12 @@ S3PciSegmentReadBuffer (
UINTN
EFIAPI
S3PciSegmentWriteBuffer (
- IN UINT64 StartAddress,
- IN UINTN Size,
- IN VOID *Buffer
+ IN UINT64 StartAddress,
+ IN UINTN Size,
+ IN VOID *Buffer
)
{
- RETURN_STATUS Status;
+ RETURN_STATUS Status;
Status = S3BootScriptSavePciCfg2Write (
S3BootScriptWidthUint8,
diff --git a/MdePkg/Library/BaseS3SmbusLib/S3SmbusLib.c b/MdePkg/Library/BaseS3SmbusLib/S3SmbusLib.c
index 1a3c2bc82c..3ba28eda3e 100644
--- a/MdePkg/Library/BaseS3SmbusLib/S3SmbusLib.c
+++ b/MdePkg/Library/BaseS3SmbusLib/S3SmbusLib.c
@@ -9,7 +9,6 @@
**/
-
#include <Base.h>
#include <Library/DebugLib.h>
@@ -36,18 +35,18 @@
**/
VOID
InternalSaveSmBusExecToBootScript (
- IN EFI_SMBUS_OPERATION SmbusOperation,
- IN UINTN SmBusAddress,
- IN UINTN Length,
- IN OUT VOID *Buffer
+ IN EFI_SMBUS_OPERATION SmbusOperation,
+ IN UINTN SmBusAddress,
+ IN UINTN Length,
+ IN OUT VOID *Buffer
)
{
- RETURN_STATUS Status;
+ RETURN_STATUS Status;
Status = S3BootScriptSaveSmbusExecute (
SmBusAddress,
SmbusOperation,
- &Length,
+ &Length,
Buffer
);
ASSERT (Status == RETURN_SUCCESS);
@@ -74,8 +73,8 @@ InternalSaveSmBusExecToBootScript (
VOID
EFIAPI
S3SmBusQuickRead (
- IN UINTN SmBusAddress,
- OUT RETURN_STATUS *Status OPTIONAL
+ IN UINTN SmBusAddress,
+ OUT RETURN_STATUS *Status OPTIONAL
)
{
SmBusQuickRead (SmBusAddress, Status);
@@ -104,8 +103,8 @@ S3SmBusQuickRead (
VOID
EFIAPI
S3SmBusQuickWrite (
- IN UINTN SmBusAddress,
- OUT RETURN_STATUS *Status OPTIONAL
+ IN UINTN SmBusAddress,
+ OUT RETURN_STATUS *Status OPTIONAL
)
{
SmBusQuickWrite (SmBusAddress, Status);
@@ -140,7 +139,7 @@ S3SmBusReceiveByte (
OUT RETURN_STATUS *Status OPTIONAL
)
{
- UINT8 Byte;
+ UINT8 Byte;
Byte = SmBusReceiveByte (SmBusAddress, Status);
@@ -178,7 +177,7 @@ S3SmBusSendByte (
OUT RETURN_STATUS *Status OPTIONAL
)
{
- UINT8 Byte;
+ UINT8 Byte;
Byte = SmBusSendByte (SmBusAddress, Value, Status);
@@ -213,7 +212,7 @@ S3SmBusReadDataByte (
OUT RETURN_STATUS *Status OPTIONAL
)
{
- UINT8 Byte;
+ UINT8 Byte;
Byte = SmBusReadDataByte (SmBusAddress, Status);
@@ -251,7 +250,7 @@ S3SmBusWriteDataByte (
OUT RETURN_STATUS *Status OPTIONAL
)
{
- UINT8 Byte;
+ UINT8 Byte;
Byte = SmBusWriteDataByte (SmBusAddress, Value, Status);
@@ -403,7 +402,7 @@ S3SmBusReadBlock (
OUT RETURN_STATUS *Status OPTIONAL
)
{
- UINTN Length;
+ UINTN Length;
Length = SmBusReadBlock (SmBusAddress, Buffer, Status);
@@ -485,7 +484,7 @@ S3SmBusBlockProcessCall (
OUT RETURN_STATUS *Status OPTIONAL
)
{
- UINTN Length;
+ UINTN Length;
Length = SmBusBlockProcessCall (SmBusAddress, WriteBuffer, ReadBuffer, Status);
diff --git a/MdePkg/Library/BaseS3StallLib/S3StallLib.c b/MdePkg/Library/BaseS3StallLib/S3StallLib.c
index f1f3388442..ea886ca61c 100644
--- a/MdePkg/Library/BaseS3StallLib/S3StallLib.c
+++ b/MdePkg/Library/BaseS3StallLib/S3StallLib.c
@@ -16,7 +16,6 @@
#include <Library/S3BootScriptLib.h>
#include <Library/S3StallLib.h>
-
/**
Stalls the CPU for at least the given number of microseconds and and saves
the value in the S3 script to be replayed on S3 resume.
@@ -31,15 +30,13 @@
UINTN
EFIAPI
S3Stall (
- IN UINTN MicroSeconds
+ IN UINTN MicroSeconds
)
{
- RETURN_STATUS Status;
+ RETURN_STATUS Status;
Status = S3BootScriptSaveStall (MicroSecondDelay (MicroSeconds));
ASSERT (Status == RETURN_SUCCESS);
return MicroSeconds;
}
-
-
diff --git a/MdePkg/Library/BaseSafeIntLib/SafeIntLib.c b/MdePkg/Library/BaseSafeIntLib/SafeIntLib.c
index eec8ac1ffd..13fe84d4b3 100644
--- a/MdePkg/Library/BaseSafeIntLib/SafeIntLib.c
+++ b/MdePkg/Library/BaseSafeIntLib/SafeIntLib.c
@@ -13,11 +13,10 @@
#include <Library/SafeIntLib.h>
#include <Library/BaseLib.h>
-
//
// Magnitude of MIN_INT64 as expressed by a UINT64 number.
//
-#define MIN_INT64_MAGNITUDE (((UINT64)(- (MIN_INT64 + 1))) + 1)
+#define MIN_INT64_MAGNITUDE (((UINT64)(- (MIN_INT64 + 1))) + 1)
//
// Conversion functions
@@ -69,10 +68,10 @@ SafeInt8ToUint8 (
if (Operand >= 0) {
*Result = (UINT8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -113,10 +112,10 @@ SafeInt8ToChar8 (
if (Operand >= 0) {
*Result = (CHAR8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = CHAR8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -157,10 +156,10 @@ SafeInt8ToUint16 (
if (Operand >= 0) {
*Result = (UINT16)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT16_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -201,10 +200,10 @@ SafeInt8ToUint32 (
if (Operand >= 0) {
*Result = (UINT32)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT32_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -245,10 +244,10 @@ SafeInt8ToUintn (
if (Operand >= 0) {
*Result = (UINTN)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINTN_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -289,10 +288,10 @@ SafeInt8ToUint64 (
if (Operand >= 0) {
*Result = (UINT64)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT64_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -333,10 +332,10 @@ SafeUint8ToInt8 (
if (Operand <= MAX_INT8) {
*Result = (INT8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = INT8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -377,10 +376,10 @@ SafeUint8ToChar8 (
if (Operand <= MAX_INT8) {
*Result = (CHAR8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = CHAR8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -421,10 +420,10 @@ SafeInt16ToInt8 (
if ((Operand >= MIN_INT8) && (Operand <= MAX_INT8)) {
*Result = (INT8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = INT8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -465,10 +464,10 @@ SafeInt16ToChar8 (
if ((Operand >= 0) && (Operand <= MAX_INT8)) {
*Result = (CHAR8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = CHAR8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -509,10 +508,10 @@ SafeInt16ToUint8 (
if ((Operand >= 0) && (Operand <= MAX_UINT8)) {
*Result = (UINT8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -553,10 +552,10 @@ SafeInt16ToUint16 (
if (Operand >= 0) {
*Result = (UINT16)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT16_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -597,10 +596,10 @@ SafeInt16ToUint32 (
if (Operand >= 0) {
*Result = (UINT32)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT32_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -641,10 +640,10 @@ SafeInt16ToUintn (
if (Operand >= 0) {
*Result = (UINTN)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINTN_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -685,10 +684,10 @@ SafeInt16ToUint64 (
if (Operand >= 0) {
*Result = (UINT64)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT64_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -729,10 +728,10 @@ SafeUint16ToInt8 (
if (Operand <= MAX_INT8) {
*Result = (INT8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = INT8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -773,10 +772,10 @@ SafeUint16ToChar8 (
if (Operand <= MAX_INT8) {
*Result = (INT8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = CHAR8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -817,10 +816,10 @@ SafeUint16ToUint8 (
if (Operand <= MAX_UINT8) {
*Result = (UINT8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -861,10 +860,10 @@ SafeUint16ToInt16 (
if (Operand <= MAX_INT16) {
*Result = (INT16)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = INT16_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -905,10 +904,10 @@ SafeInt32ToInt8 (
if ((Operand >= MIN_INT8) && (Operand <= MAX_INT8)) {
*Result = (INT8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = INT8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -949,10 +948,10 @@ SafeInt32ToChar8 (
if ((Operand >= 0) && (Operand <= MAX_INT8)) {
*Result = (CHAR8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = CHAR8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -993,10 +992,10 @@ SafeInt32ToUint8 (
if ((Operand >= 0) && (Operand <= MAX_UINT8)) {
*Result = (UINT8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -1037,10 +1036,10 @@ SafeInt32ToInt16 (
if ((Operand >= MIN_INT16) && (Operand <= MAX_INT16)) {
*Result = (INT16)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = INT16_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -1081,10 +1080,10 @@ SafeInt32ToUint16 (
if ((Operand >= 0) && (Operand <= MAX_UINT16)) {
*Result = (UINT16)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT16_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -1125,10 +1124,10 @@ SafeInt32ToUint32 (
if (Operand >= 0) {
*Result = (UINT32)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT32_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -1169,10 +1168,10 @@ SafeInt32ToUint64 (
if (Operand >= 0) {
*Result = (UINT64)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT64_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -1213,10 +1212,10 @@ SafeUint32ToInt8 (
if (Operand <= MAX_INT8) {
*Result = (INT8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = INT8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -1257,10 +1256,10 @@ SafeUint32ToChar8 (
if (Operand <= MAX_INT8) {
*Result = (INT8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = CHAR8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -1301,10 +1300,10 @@ SafeUint32ToUint8 (
if (Operand <= MAX_UINT8) {
*Result = (UINT8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -1345,10 +1344,10 @@ SafeUint32ToInt16 (
if (Operand <= MAX_INT16) {
*Result = (INT16)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = INT16_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -1389,10 +1388,10 @@ SafeUint32ToUint16 (
if (Operand <= MAX_UINT16) {
*Result = (UINT16)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT16_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -1433,10 +1432,10 @@ SafeUint32ToInt32 (
if (Operand <= MAX_INT32) {
*Result = (INT32)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = INT32_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -1477,10 +1476,10 @@ SafeIntnToInt8 (
if ((Operand >= MIN_INT8) && (Operand <= MAX_INT8)) {
*Result = (INT8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = INT8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -1521,10 +1520,10 @@ SafeIntnToChar8 (
if ((Operand >= 0) && (Operand <= MAX_INT8)) {
*Result = (CHAR8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = CHAR8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -1565,10 +1564,10 @@ SafeIntnToUint8 (
if ((Operand >= 0) && (Operand <= MAX_UINT8)) {
*Result = (UINT8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -1609,10 +1608,10 @@ SafeIntnToInt16 (
if ((Operand >= MIN_INT16) && (Operand <= MAX_INT16)) {
*Result = (INT16)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = INT16_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -1653,10 +1652,10 @@ SafeIntnToUint16 (
if ((Operand >= 0) && (Operand <= MAX_UINT16)) {
*Result = (UINT16)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT16_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -1697,10 +1696,10 @@ SafeIntnToUintn (
if (Operand >= 0) {
*Result = (UINTN)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINTN_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -1741,10 +1740,10 @@ SafeIntnToUint64 (
if (Operand >= 0) {
*Result = (UINT64)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT64_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -1785,10 +1784,10 @@ SafeUintnToInt8 (
if (Operand <= MAX_INT8) {
*Result = (INT8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = INT8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -1829,10 +1828,10 @@ SafeUintnToChar8 (
if (Operand <= MAX_INT8) {
*Result = (INT8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = CHAR8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -1873,10 +1872,10 @@ SafeUintnToUint8 (
if (Operand <= MAX_UINT8) {
*Result = (UINT8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -1917,10 +1916,10 @@ SafeUintnToInt16 (
if (Operand <= MAX_INT16) {
*Result = (INT16)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = INT16_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -1961,10 +1960,10 @@ SafeUintnToUint16 (
if (Operand <= MAX_UINT16) {
*Result = (UINT16)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT16_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -2005,10 +2004,10 @@ SafeUintnToInt32 (
if (Operand <= MAX_INT32) {
*Result = (INT32)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = INT32_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -2049,10 +2048,10 @@ SafeUintnToIntn (
if (Operand <= MAX_INTN) {
*Result = (INTN)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = INTN_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -2093,10 +2092,10 @@ SafeInt64ToInt8 (
if ((Operand >= MIN_INT8) && (Operand <= MAX_INT8)) {
*Result = (INT8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = INT8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -2137,10 +2136,10 @@ SafeInt64ToChar8 (
if ((Operand >= 0) && (Operand <= MAX_INT8)) {
*Result = (CHAR8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = CHAR8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -2181,10 +2180,10 @@ SafeInt64ToUint8 (
if ((Operand >= 0) && (Operand <= MAX_UINT8)) {
*Result = (UINT8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -2225,10 +2224,10 @@ SafeInt64ToInt16 (
if ((Operand >= MIN_INT16) && (Operand <= MAX_INT16)) {
*Result = (INT16)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = INT16_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -2269,10 +2268,10 @@ SafeInt64ToUint16 (
if ((Operand >= 0) && (Operand <= MAX_UINT16)) {
*Result = (UINT16)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT16_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -2313,10 +2312,10 @@ SafeInt64ToInt32 (
if ((Operand >= MIN_INT32) && (Operand <= MAX_INT32)) {
*Result = (INT32)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = INT32_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -2357,10 +2356,10 @@ SafeInt64ToUint32 (
if ((Operand >= 0) && (Operand <= MAX_UINT32)) {
*Result = (UINT32)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT32_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -2401,10 +2400,10 @@ SafeInt64ToUint64 (
if (Operand >= 0) {
*Result = (UINT64)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT64_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -2445,10 +2444,10 @@ SafeUint64ToInt8 (
if (Operand <= MAX_INT8) {
*Result = (INT8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = INT8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -2489,10 +2488,10 @@ SafeUint64ToChar8 (
if (Operand <= MAX_INT8) {
*Result = (INT8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = CHAR8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -2533,10 +2532,10 @@ SafeUint64ToUint8 (
if (Operand <= MAX_UINT8) {
*Result = (UINT8)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -2577,10 +2576,10 @@ SafeUint64ToInt16 (
if (Operand <= MAX_INT16) {
*Result = (INT16)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = INT16_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -2621,10 +2620,10 @@ SafeUint64ToUint16 (
if (Operand <= MAX_UINT16) {
*Result = (UINT16)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT16_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -2665,10 +2664,10 @@ SafeUint64ToInt32 (
if (Operand <= MAX_INT32) {
*Result = (INT32)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = INT32_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -2709,10 +2708,10 @@ SafeUint64ToUint32 (
if (Operand <= MAX_UINT32) {
*Result = (UINT32)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT32_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -2753,10 +2752,10 @@ SafeUint64ToIntn (
if (Operand <= MAX_INTN) {
*Result = (INTN)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = INTN_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -2797,10 +2796,10 @@ SafeUint64ToInt64 (
if (Operand <= MAX_INT64) {
*Result = (INT64)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = INT64_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -2847,10 +2846,10 @@ SafeUint8Add (
if (((UINT8)(Augend + Addend)) >= Augend) {
*Result = (UINT8)(Augend + Addend);
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -2893,10 +2892,10 @@ SafeUint16Add (
if (((UINT16)(Augend + Addend)) >= Augend) {
*Result = (UINT16)(Augend + Addend);
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT16_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -2939,10 +2938,10 @@ SafeUint32Add (
if ((Augend + Addend) >= Augend) {
*Result = (Augend + Addend);
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT32_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -2985,10 +2984,10 @@ SafeUint64Add (
if ((Augend + Addend) >= Augend) {
*Result = (Augend + Addend);
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT64_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -3035,10 +3034,10 @@ SafeUint8Sub (
if (Minuend >= Subtrahend) {
*Result = (UINT8)(Minuend - Subtrahend);
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT8_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -3081,10 +3080,10 @@ SafeUint16Sub (
if (Minuend >= Subtrahend) {
*Result = (UINT16)(Minuend - Subtrahend);
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT16_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -3127,10 +3126,10 @@ SafeUint32Sub (
if (Minuend >= Subtrahend) {
*Result = (Minuend - Subtrahend);
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT32_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -3173,10 +3172,10 @@ SafeUint64Sub (
if (Minuend >= Subtrahend) {
*Result = (Minuend - Subtrahend);
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT64_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -3289,7 +3288,7 @@ SafeUint32Mult (
{
UINT64 IntermediateResult;
- IntermediateResult = ((UINT64) Multiplicand) *((UINT64) Multiplier);
+ IntermediateResult = ((UINT64)Multiplicand) *((UINT64)Multiplier);
return SafeUint64ToUint32 (IntermediateResult, Result);
}
@@ -3337,11 +3336,11 @@ SafeUint64Mult (
return RETURN_INVALID_PARAMETER;
}
- ProductAD = 0;
- ProductBC = 0;
- ProductBD = 0;
+ ProductAD = 0;
+ ProductBC = 0;
+ ProductBD = 0;
UnsignedResult = 0;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
//
// 64x64 into 128 is like 32.32 x 32.32.
@@ -3368,13 +3367,14 @@ SafeUint64Mult (
DwordD = (UINT32)Multiplier;
*Result = (((UINT64)DwordB) *(UINT64)DwordD);
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
//
// a * c must be 0 or there would be bits set in the high 64-bits
//
if ((DwordA == 0) ||
- (DwordC == 0)) {
+ (DwordC == 0))
+ {
DwordD = (UINT32)Multiplier;
//
@@ -3401,7 +3401,7 @@ SafeUint64Mult (
if (!RETURN_ERROR (SafeUint64Add (UnsignedResult, ProductBD, &UnsignedResult))) {
*Result = UnsignedResult;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
}
}
}
@@ -3412,6 +3412,7 @@ SafeUint64Mult (
if (RETURN_ERROR (Status)) {
*Result = UINT64_ERROR;
}
+
return Status;
}
@@ -3509,11 +3510,12 @@ SafeChar8Add (
Augend32 = (INT32)Augend;
Addend32 = (INT32)Addend;
- if (Augend32 < 0 || Augend32 > MAX_INT8) {
+ if ((Augend32 < 0) || (Augend32 > MAX_INT8)) {
*Result = CHAR8_ERROR;
return RETURN_BUFFER_TOO_SMALL;
}
- if (Addend32 < 0 || Addend32 > MAX_INT8) {
+
+ if ((Addend32 < 0) || (Addend32 > MAX_INT8)) {
*Result = CHAR8_ERROR;
return RETURN_BUFFER_TOO_SMALL;
}
@@ -3666,12 +3668,13 @@ SafeInt64Add (
// 0 >= (MIN_INT64 - Addend) > MIN_INT64
//
if (((Addend > 0) && (Augend > (MAX_INT64 - Addend))) ||
- ((Addend < 0) && (Augend < (MIN_INT64 - Addend)))) {
+ ((Addend < 0) && (Augend < (MIN_INT64 - Addend))))
+ {
*Result = INT64_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
} else {
*Result = Augend + Addend;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
}
return Status;
@@ -3751,11 +3754,12 @@ SafeChar8Sub (
Minuend32 = (INT32)Minuend;
Subtrahend32 = (INT32)Subtrahend;
- if (Minuend32 < 0 || Minuend32 > MAX_INT8) {
+ if ((Minuend32 < 0) || (Minuend32 > MAX_INT8)) {
*Result = CHAR8_ERROR;
return RETURN_BUFFER_TOO_SMALL;
}
- if (Subtrahend32 < 0 || Subtrahend32 > MAX_INT8) {
+
+ if ((Subtrahend32 < 0) || (Subtrahend32 > MAX_INT8)) {
*Result = CHAR8_ERROR;
return RETURN_BUFFER_TOO_SMALL;
}
@@ -3901,12 +3905,13 @@ SafeInt64Sub (
// -1 = (MAX_INT64 + MIN_INT64) <= (MAX_INT64 + Subtrahend) < MAX_INT64
//
if (((Subtrahend > 0) && (Minuend < (MIN_INT64 + Subtrahend))) ||
- ((Subtrahend < 0) && (Minuend > (MAX_INT64 + Subtrahend)))) {
+ ((Subtrahend < 0) && (Minuend > (MAX_INT64 + Subtrahend))))
+ {
*Result = INT64_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
} else {
*Result = Minuend - Subtrahend;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
}
return Status;
@@ -3986,11 +3991,12 @@ SafeChar8Mult (
Multiplicand32 = (INT32)Multiplicand;
Multiplier32 = (INT32)Multiplier;
- if (Multiplicand32 < 0 || Multiplicand32 > MAX_INT8) {
+ if ((Multiplicand32 < 0) || (Multiplicand32 > MAX_INT8)) {
*Result = CHAR8_ERROR;
return RETURN_BUFFER_TOO_SMALL;
}
- if (Multiplier32 < 0 || Multiplier32 > MAX_INT8) {
+
+ if ((Multiplier32 < 0) || (Multiplier32 > MAX_INT8)) {
*Result = CHAR8_ERROR;
return RETURN_BUFFER_TOO_SMALL;
}
@@ -4107,7 +4113,7 @@ SafeInt64Mult (
//
// Avoid negating the most negative number.
//
- UnsignedMultiplicand = ((UINT64)(- (Multiplicand + 1))) + 1;
+ UnsignedMultiplicand = ((UINT64)(-(Multiplicand + 1))) + 1;
} else {
UnsignedMultiplicand = (UINT64)Multiplicand;
}
@@ -4116,7 +4122,7 @@ SafeInt64Mult (
//
// Avoid negating the most negative number.
//
- UnsignedMultiplier = ((UINT64)(- (Multiplier + 1))) + 1;
+ UnsignedMultiplier = ((UINT64)(-(Multiplier + 1))) + 1;
} else {
UnsignedMultiplier = (UINT64)Multiplier;
}
@@ -4126,16 +4132,16 @@ SafeInt64Mult (
if ((Multiplicand < 0) != (Multiplier < 0)) {
if (UnsignedResult > MIN_INT64_MAGNITUDE) {
*Result = INT64_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
} else if (UnsignedResult == MIN_INT64_MAGNITUDE) {
*Result = MIN_INT64;
} else {
- *Result = - ((INT64)UnsignedResult);
+ *Result = -((INT64)UnsignedResult);
}
} else {
if (UnsignedResult > MAX_INT64) {
*Result = INT64_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
} else {
*Result = (INT64)UnsignedResult;
}
@@ -4143,6 +4149,6 @@ SafeInt64Mult (
} else {
*Result = INT64_ERROR;
}
+
return Status;
}
-
diff --git a/MdePkg/Library/BaseSafeIntLib/SafeIntLib32.c b/MdePkg/Library/BaseSafeIntLib/SafeIntLib32.c
index 39bf1c3c22..a3900fb14a 100644
--- a/MdePkg/Library/BaseSafeIntLib/SafeIntLib32.c
+++ b/MdePkg/Library/BaseSafeIntLib/SafeIntLib32.c
@@ -143,10 +143,10 @@ SafeIntnToUint32 (
if (Operand >= 0) {
*Result = (UINT32)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT32_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -309,7 +309,7 @@ SafeUint64ToUintn (
OUT UINTN *Result
)
{
- return SafeUint64ToUint32 ((UINT64) Operand, (UINT32 *)Result);
+ return SafeUint64ToUint32 ((UINT64)Operand, (UINT32 *)Result);
}
/**
@@ -349,10 +349,10 @@ SafeUintnAdd (
if ((Augend + Addend) >= Augend) {
*Result = (Augend + Addend);
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINTN_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -395,10 +395,10 @@ SafeUintnSub (
if (Minuend >= Subtrahend) {
*Result = (Minuend - Subtrahend);
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINTN_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
@@ -435,7 +435,7 @@ SafeUintnMult (
{
UINT64 IntermediateResult;
- IntermediateResult = ((UINT64) Multiplicand) *((UINT64) Multiplier);
+ IntermediateResult = ((UINT64)Multiplicand) *((UINT64)Multiplier);
return SafeUint64ToUintn (IntermediateResult, Result);
}
@@ -535,4 +535,3 @@ SafeIntnMult (
{
return SafeInt64ToIntn (MultS64x64 (Multiplicand, Multiplier), Result);
}
-
diff --git a/MdePkg/Library/BaseSafeIntLib/SafeIntLib64.c b/MdePkg/Library/BaseSafeIntLib/SafeIntLib64.c
index 44e0a625aa..bf216c23b4 100644
--- a/MdePkg/Library/BaseSafeIntLib/SafeIntLib64.c
+++ b/MdePkg/Library/BaseSafeIntLib/SafeIntLib64.c
@@ -39,7 +39,7 @@ SafeInt32ToUintn (
OUT UINTN *Result
)
{
- return SafeInt32ToUint64 (Operand, (UINT64 *) Result);
+ return SafeInt32ToUint64 (Operand, (UINT64 *)Result);
}
/**
@@ -104,7 +104,7 @@ SafeIntnToInt32 (
OUT INT32 *Result
)
{
- return SafeInt64ToInt32 ((INT64) Operand, Result);
+ return SafeInt64ToInt32 ((INT64)Operand, Result);
}
/**
@@ -488,4 +488,3 @@ SafeIntnMult (
{
return SafeInt64Mult ((INT64)Multiplicand, (INT64)Multiplier, (INT64 *)Result);
}
-
diff --git a/MdePkg/Library/BaseSafeIntLib/SafeIntLibEbc.c b/MdePkg/Library/BaseSafeIntLib/SafeIntLibEbc.c
index de28bec977..93071cd946 100644
--- a/MdePkg/Library/BaseSafeIntLib/SafeIntLibEbc.c
+++ b/MdePkg/Library/BaseSafeIntLib/SafeIntLibEbc.c
@@ -42,7 +42,8 @@ SafeInt32ToUintn (
if (sizeof (UINTN) == sizeof (UINT32)) {
return SafeInt32ToUint32 (Operand, (UINT32 *)Result);
}
- return SafeInt32ToUint64 (Operand, (UINT64 *) Result);
+
+ return SafeInt32ToUint64 (Operand, (UINT64 *)Result);
}
/**
@@ -79,6 +80,7 @@ SafeUint32ToIntn (
if (sizeof (UINTN) == sizeof (UINT32)) {
return SafeUint32ToInt32 (Operand, (INT32 *)Result);
}
+
*Result = Operand;
return RETURN_SUCCESS;
}
@@ -118,7 +120,8 @@ SafeIntnToInt32 (
*Result = (INT32)Operand;
return RETURN_SUCCESS;
}
- return SafeInt64ToInt32 ((INT64) Operand, Result);
+
+ return SafeInt64ToInt32 ((INT64)Operand, Result);
}
/**
@@ -157,14 +160,15 @@ SafeIntnToUint32 (
if (sizeof (UINTN) == sizeof (UINT32)) {
if (Operand >= 0) {
*Result = (UINT32)Operand;
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINT32_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
}
+
return SafeInt64ToUint32 ((INT64)Operand, Result);
}
@@ -203,6 +207,7 @@ SafeUintnToUint32 (
*Result = (UINT32)Operand;
return RETURN_SUCCESS;
}
+
return SafeUint64ToUint32 ((UINT64)Operand, Result);
}
@@ -241,6 +246,7 @@ SafeUintnToInt64 (
*Result = (INT64)Operand;
return RETURN_SUCCESS;
}
+
return SafeUint64ToInt64 ((UINT64)Operand, Result);
}
@@ -278,6 +284,7 @@ SafeInt64ToIntn (
if (sizeof (UINTN) == sizeof (UINT32)) {
return SafeInt64ToInt32 (Operand, (INT32 *)Result);
}
+
*Result = (INTN)Operand;
return RETURN_SUCCESS;
}
@@ -312,6 +319,7 @@ SafeInt64ToUintn (
if (sizeof (UINTN) == sizeof (UINT32)) {
return SafeInt64ToUint32 (Operand, (UINT32 *)Result);
}
+
return SafeInt64ToUint64 (Operand, (UINT64 *)Result);
}
@@ -347,8 +355,9 @@ SafeUint64ToUintn (
}
if (sizeof (UINTN) == sizeof (UINT32)) {
- return SafeUint64ToUint32 ((UINT64) Operand, (UINT32 *)Result);
+ return SafeUint64ToUint32 ((UINT64)Operand, (UINT32 *)Result);
}
+
*Result = Operand;
return RETURN_SUCCESS;
}
@@ -391,14 +400,15 @@ SafeUintnAdd (
if (sizeof (UINTN) == sizeof (UINT32)) {
if ((UINT32)(Augend + Addend) >= Augend) {
*Result = (Augend + Addend);
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINTN_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
}
+
return SafeUint64Add ((UINT64)Augend, (UINT64)Addend, (UINT64 *)Result);
}
@@ -440,14 +450,15 @@ SafeUintnSub (
if (sizeof (UINTN) == sizeof (UINT32)) {
if (Minuend >= Subtrahend) {
*Result = (Minuend - Subtrahend);
- Status = RETURN_SUCCESS;
+ Status = RETURN_SUCCESS;
} else {
*Result = UINTN_ERROR;
- Status = RETURN_BUFFER_TOO_SMALL;
+ Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
}
+
return SafeUint64Sub ((UINT64)Minuend, (UINT64)Subtrahend, (UINT64 *)Result);
}
@@ -483,10 +494,11 @@ SafeUintnMult (
UINT64 IntermediateResult;
if (sizeof (UINTN) == sizeof (UINT32)) {
- IntermediateResult = ((UINT64) Multiplicand) *((UINT64) Multiplier);
+ IntermediateResult = ((UINT64)Multiplicand) *((UINT64)Multiplier);
return SafeUint64ToUintn (IntermediateResult, Result);
}
+
return SafeUint64Mult ((UINT64)Multiplicand, (UINT64)Multiplier, (UINT64 *)Result);
}
@@ -522,6 +534,7 @@ SafeIntnAdd (
if (sizeof (UINTN) == sizeof (UINT32)) {
return SafeInt64ToIntn (((INT64)Augend) + ((INT64)Addend), Result);
}
+
return SafeInt64Add ((INT64)Augend, (INT64)Addend, (INT64 *)Result);
}
@@ -557,6 +570,7 @@ SafeIntnSub (
if (sizeof (UINTN) == sizeof (UINT32)) {
return SafeInt64ToIntn (((INT64)Minuend) - ((INT64)Subtrahend), Result);
}
+
return SafeInt64Sub ((INT64)Minuend, (INT64)Subtrahend, (INT64 *)Result);
}
@@ -592,6 +606,6 @@ SafeIntnMult (
if (sizeof (UINTN) == sizeof (UINT32)) {
return SafeInt64ToIntn (((INT64)Multiplicand) *((INT64)Multiplier), Result);
}
+
return SafeInt64Mult ((INT64)Multiplicand, (INT64)Multiplier, (INT64 *)Result);
}
-
diff --git a/MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.c b/MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.c
index 4f70827f1e..f42e90cac8 100644
--- a/MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.c
+++ b/MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.c
@@ -6,7 +6,6 @@
**/
-
#include <Base.h>
#include <Library/SerialPortLib.h>
@@ -50,14 +49,13 @@ SerialPortInitialize (
UINTN
EFIAPI
SerialPortWrite (
- IN UINT8 *Buffer,
- IN UINTN NumberOfBytes
-)
+ IN UINT8 *Buffer,
+ IN UINTN NumberOfBytes
+ )
{
return 0;
}
-
/**
Read data from serial device and save the datas in buffer.
@@ -77,9 +75,9 @@ SerialPortWrite (
UINTN
EFIAPI
SerialPortRead (
- OUT UINT8 *Buffer,
- IN UINTN NumberOfBytes
-)
+ OUT UINT8 *Buffer,
+ IN UINTN NumberOfBytes
+ )
{
return 0;
}
@@ -117,7 +115,7 @@ SerialPortPoll (
RETURN_STATUS
EFIAPI
SerialPortSetControl (
- IN UINT32 Control
+ IN UINT32 Control
)
{
return RETURN_UNSUPPORTED;
@@ -136,7 +134,7 @@ SerialPortSetControl (
RETURN_STATUS
EFIAPI
SerialPortGetControl (
- OUT UINT32 *Control
+ OUT UINT32 *Control
)
{
return RETURN_UNSUPPORTED;
@@ -178,14 +176,13 @@ SerialPortGetControl (
RETURN_STATUS
EFIAPI
SerialPortSetAttributes (
- IN OUT UINT64 *BaudRate,
- IN OUT UINT32 *ReceiveFifoDepth,
- IN OUT UINT32 *Timeout,
- IN OUT EFI_PARITY_TYPE *Parity,
- IN OUT UINT8 *DataBits,
- IN OUT EFI_STOP_BITS_TYPE *StopBits
+ IN OUT UINT64 *BaudRate,
+ IN OUT UINT32 *ReceiveFifoDepth,
+ IN OUT UINT32 *Timeout,
+ IN OUT EFI_PARITY_TYPE *Parity,
+ IN OUT UINT8 *DataBits,
+ IN OUT EFI_STOP_BITS_TYPE *StopBits
)
{
return RETURN_UNSUPPORTED;
}
-
diff --git a/MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.c b/MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.c
index 42da5c0e6c..5393d96cd2 100644
--- a/MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.c
+++ b/MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.c
@@ -37,8 +37,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
VOID
EFIAPI
SmBusQuickRead (
- IN UINTN SmBusAddress,
- OUT RETURN_STATUS *Status OPTIONAL
+ IN UINTN SmBusAddress,
+ OUT RETURN_STATUS *Status OPTIONAL
)
{
ASSERT (!SMBUS_LIB_PEC (SmBusAddress));
@@ -77,8 +77,8 @@ SmBusQuickRead (
VOID
EFIAPI
SmBusQuickWrite (
- IN UINTN SmBusAddress,
- OUT RETURN_STATUS *Status OPTIONAL
+ IN UINTN SmBusAddress,
+ OUT RETURN_STATUS *Status OPTIONAL
)
{
ASSERT (!SMBUS_LIB_PEC (SmBusAddress));
@@ -130,6 +130,7 @@ SmBusReceiveByte (
if (Status != NULL) {
*Status = RETURN_UNSUPPORTED;
}
+
return 0;
}
@@ -175,6 +176,7 @@ SmBusSendByte (
if (Status != NULL) {
*Status = RETURN_UNSUPPORTED;
}
+
return 0;
}
@@ -216,6 +218,7 @@ SmBusReadDataByte (
if (Status != NULL) {
*Status = RETURN_UNSUPPORTED;
}
+
return 0;
}
@@ -260,6 +263,7 @@ SmBusWriteDataByte (
if (Status != NULL) {
*Status = RETURN_UNSUPPORTED;
}
+
return 0;
}
@@ -301,6 +305,7 @@ SmBusReadDataWord (
if (Status != NULL) {
*Status = RETURN_UNSUPPORTED;
}
+
return 0;
}
@@ -345,6 +350,7 @@ SmBusWriteDataWord (
if (Status != NULL) {
*Status = RETURN_UNSUPPORTED;
}
+
return 0;
}
@@ -389,6 +395,7 @@ SmBusProcessCall (
if (Status != NULL) {
*Status = RETURN_UNSUPPORTED;
}
+
return 0;
}
@@ -437,6 +444,7 @@ SmBusReadBlock (
if (Status != NULL) {
*Status = RETURN_UNSUPPORTED;
}
+
return 0;
}
@@ -483,6 +491,7 @@ SmBusWriteBlock (
if (Status != NULL) {
*Status = RETURN_UNSUPPORTED;
}
+
return 0;
}
@@ -534,5 +543,6 @@ SmBusBlockProcessCall (
if (Status != NULL) {
*Status = RETURN_UNSUPPORTED;
}
+
return 0;
}
diff --git a/MdePkg/Library/BaseStackCheckLib/BaseStackCheckGcc.c b/MdePkg/Library/BaseStackCheckLib/BaseStackCheckGcc.c
index d3efb8e462..0d2918668e 100644
--- a/MdePkg/Library/BaseStackCheckLib/BaseStackCheckGcc.c
+++ b/MdePkg/Library/BaseStackCheckLib/BaseStackCheckGcc.c
@@ -17,10 +17,10 @@
#include <Library/PcdLib.h>
/// "canary" value that is inserted by the compiler into the stack frame.
-VOID *__stack_chk_guard = (VOID*)0x0AFF;
+VOID *__stack_chk_guard = (VOID *)0x0AFF;
// If ASLR was enabled we could use
-//void (*__stack_chk_guard)(void) = __stack_chk_fail;
+// void (*__stack_chk_guard)(void) = __stack_chk_fail;
/**
Error path for compiler generated stack "canary" value check code. If the
@@ -29,12 +29,12 @@ VOID *__stack_chk_guard = (VOID*)0x0AFF;
**/
VOID
__stack_chk_fail (
- VOID
- )
+ VOID
+ )
{
- UINT8 DebugPropertyMask;
+ UINT8 DebugPropertyMask;
- DEBUG ((DEBUG_ERROR, "STACK FAULT: Buffer Overflow in function %a.\n", __builtin_return_address(0)));
+ DEBUG ((DEBUG_ERROR, "STACK FAULT: Buffer Overflow in function %a.\n", __builtin_return_address (0)));
//
// Generate a Breakpoint, DeadLoop, or NOP based on PCD settings even if
@@ -44,6 +44,6 @@ __stack_chk_fail (
if ((DebugPropertyMask & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {
CpuBreakpoint ();
} else if ((DebugPropertyMask & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {
- CpuDeadLoop ();
+ CpuDeadLoop ();
}
}
diff --git a/MdePkg/Library/BaseStackCheckLib/BaseStackCheckNull.c b/MdePkg/Library/BaseStackCheckLib/BaseStackCheckNull.c
index 7032b78b33..32932002fa 100644
--- a/MdePkg/Library/BaseStackCheckLib/BaseStackCheckNull.c
+++ b/MdePkg/Library/BaseStackCheckLib/BaseStackCheckNull.c
@@ -6,4 +6,4 @@
**/
-extern int __BaseStackCheckNull;
+extern int __BaseStackCheckNull;
diff --git a/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLibInternals.h b/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLibInternals.h
index 4e2bcbc6cd..9a67079750 100644
--- a/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLibInternals.h
+++ b/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLibInternals.h
@@ -31,10 +31,9 @@
UINT32
EFIAPI
InternalSyncIncrement (
- IN volatile UINT32 *Value
+ IN volatile UINT32 *Value
);
-
/**
Performs an atomic decrement of an 32-bit unsigned integer.
@@ -50,10 +49,9 @@ InternalSyncIncrement (
UINT32
EFIAPI
InternalSyncDecrement (
- IN volatile UINT32 *Value
+ IN volatile UINT32 *Value
);
-
/**
Performs an atomic compare exchange operation on a 16-bit unsigned integer.
@@ -74,12 +72,11 @@ InternalSyncDecrement (
UINT16
EFIAPI
InternalSyncCompareExchange16 (
- IN volatile UINT16 *Value,
- IN UINT16 CompareValue,
- IN UINT16 ExchangeValue
+ IN volatile UINT16 *Value,
+ IN UINT16 CompareValue,
+ IN UINT16 ExchangeValue
);
-
/**
Performs an atomic compare exchange operation on a 32-bit unsigned integer.
@@ -100,12 +97,11 @@ InternalSyncCompareExchange16 (
UINT32
EFIAPI
InternalSyncCompareExchange32 (
- IN volatile UINT32 *Value,
- IN UINT32 CompareValue,
- IN UINT32 ExchangeValue
+ IN volatile UINT32 *Value,
+ IN UINT32 CompareValue,
+ IN UINT32 ExchangeValue
);
-
/**
Performs an atomic compare exchange operation on a 64-bit unsigned integer.
@@ -125,9 +121,9 @@ InternalSyncCompareExchange32 (
UINT64
EFIAPI
InternalSyncCompareExchange64 (
- IN volatile UINT64 *Value,
- IN UINT64 CompareValue,
- IN UINT64 ExchangeValue
+ IN volatile UINT64 *Value,
+ IN UINT64 CompareValue,
+ IN UINT64 ExchangeValue
);
/**
diff --git a/MdePkg/Library/BaseSynchronizationLib/Ebc/Synchronization.c b/MdePkg/Library/BaseSynchronizationLib/Ebc/Synchronization.c
index a45f509e64..11898d7d15 100644
--- a/MdePkg/Library/BaseSynchronizationLib/Ebc/Synchronization.c
+++ b/MdePkg/Library/BaseSynchronizationLib/Ebc/Synchronization.c
@@ -28,13 +28,13 @@
UINT16
EFIAPI
InternalSyncCompareExchange16 (
- IN volatile UINT16 *Value,
- IN UINT16 CompareValue,
- IN UINT16 ExchangeValue
+ IN volatile UINT16 *Value,
+ IN UINT16 CompareValue,
+ IN UINT16 ExchangeValue
)
{
return *Value != CompareValue ? *Value :
- ((*Value = ExchangeValue), CompareValue);
+ ((*Value = ExchangeValue), CompareValue);
}
/**
@@ -59,13 +59,13 @@ InternalSyncCompareExchange16 (
UINT32
EFIAPI
InternalSyncCompareExchange32 (
- IN volatile UINT32 *Value,
- IN UINT32 CompareValue,
- IN UINT32 ExchangeValue
+ IN volatile UINT32 *Value,
+ IN UINT32 CompareValue,
+ IN UINT32 ExchangeValue
)
{
return *Value != CompareValue ? *Value :
- ((*Value = ExchangeValue), CompareValue);
+ ((*Value = ExchangeValue), CompareValue);
}
/**
@@ -87,13 +87,13 @@ InternalSyncCompareExchange32 (
UINT64
EFIAPI
InternalSyncCompareExchange64 (
- IN volatile UINT64 *Value,
- IN UINT64 CompareValue,
- IN UINT64 ExchangeValue
+ IN volatile UINT64 *Value,
+ IN UINT64 CompareValue,
+ IN UINT64 ExchangeValue
)
{
return *Value != CompareValue ? *Value :
- ((*Value = ExchangeValue), CompareValue);
+ ((*Value = ExchangeValue), CompareValue);
}
/**
@@ -112,7 +112,7 @@ InternalSyncCompareExchange64 (
UINT32
EFIAPI
InternalSyncIncrement (
- IN volatile UINT32 *Value
+ IN volatile UINT32 *Value
)
{
return ++*Value;
@@ -134,7 +134,7 @@ InternalSyncIncrement (
UINT32
EFIAPI
InternalSyncDecrement (
- IN volatile UINT32 *Value
+ IN volatile UINT32 *Value
)
{
return --*Value;
diff --git a/MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c b/MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c
index 1d15287450..c400dd5240 100644
--- a/MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c
+++ b/MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c
@@ -7,8 +7,6 @@
**/
-
-
/**
Performs an atomic increment of an 32-bit unsigned integer.
@@ -24,7 +22,7 @@
UINT32
EFIAPI
InternalSyncIncrement (
- IN volatile UINT32 *Value
+ IN volatile UINT32 *Value
)
{
UINT32 Result;
@@ -39,12 +37,11 @@ InternalSyncIncrement (
: // no inputs that aren't also outputs
: "memory",
"cc"
- );
+ );
return Result;
}
-
/**
Performs an atomic decrement of an 32-bit unsigned integer.
@@ -60,10 +57,10 @@ InternalSyncIncrement (
UINT32
EFIAPI
InternalSyncDecrement (
- IN volatile UINT32 *Value
+ IN volatile UINT32 *Value
)
{
- UINT32 Result;
+ UINT32 Result;
__asm__ __volatile__ (
"movl $-1, %%eax \n\t"
@@ -75,12 +72,11 @@ InternalSyncDecrement (
: // no inputs that aren't also outputs
: "memory",
"cc"
- );
+ );
return Result;
}
-
/**
Performs an atomic compare exchange operation on a 16-bit unsigned integer.
@@ -102,9 +98,9 @@ InternalSyncDecrement (
UINT16
EFIAPI
InternalSyncCompareExchange16 (
- IN OUT volatile UINT16 *Value,
- IN UINT16 CompareValue,
- IN UINT16 ExchangeValue
+ IN OUT volatile UINT16 *Value,
+ IN UINT16 CompareValue,
+ IN UINT16 ExchangeValue
)
{
__asm__ __volatile__ (
@@ -115,12 +111,11 @@ InternalSyncCompareExchange16 (
: "q" (ExchangeValue) // %2
: "memory",
"cc"
- );
+ );
return CompareValue;
}
-
/**
Performs an atomic compare exchange operation on a 32-bit unsigned integer.
@@ -142,9 +137,9 @@ InternalSyncCompareExchange16 (
UINT32
EFIAPI
InternalSyncCompareExchange32 (
- IN OUT volatile UINT32 *Value,
- IN UINT32 CompareValue,
- IN UINT32 ExchangeValue
+ IN OUT volatile UINT32 *Value,
+ IN UINT32 CompareValue,
+ IN UINT32 ExchangeValue
)
{
__asm__ __volatile__ (
@@ -155,12 +150,11 @@ InternalSyncCompareExchange32 (
: "q" (ExchangeValue) // %2
: "memory",
"cc"
- );
+ );
return CompareValue;
}
-
/**
Performs an atomic compare exchange operation on a 64-bit unsigned integer.
@@ -181,9 +175,9 @@ InternalSyncCompareExchange32 (
UINT64
EFIAPI
InternalSyncCompareExchange64 (
- IN OUT volatile UINT64 *Value,
- IN UINT64 CompareValue,
- IN UINT64 ExchangeValue
+ IN OUT volatile UINT64 *Value,
+ IN UINT64 CompareValue,
+ IN UINT64 ExchangeValue
)
{
__asm__ __volatile__ (
@@ -195,7 +189,7 @@ InternalSyncCompareExchange64 (
"c" ((UINT32) (ExchangeValue >> 32)) // %3
: "memory",
"cc"
- );
+ );
return CompareValue;
}
diff --git a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.c b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.c
index fef9d3bf58..4fbbb9f0ea 100644
--- a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.c
+++ b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.c
@@ -7,9 +7,6 @@
**/
-
-
-
/**
Performs an atomic compare exchange operation on a 16-bit unsigned integer.
@@ -30,9 +27,9 @@
UINT16
EFIAPI
InternalSyncCompareExchange16 (
- IN volatile UINT16 *Value,
- IN UINT16 CompareValue,
- IN UINT16 ExchangeValue
+ IN volatile UINT16 *Value,
+ IN UINT16 CompareValue,
+ IN UINT16 ExchangeValue
)
{
_asm {
@@ -42,4 +39,3 @@ InternalSyncCompareExchange16 (
lock cmpxchg [ecx], dx
}
}
-
diff --git a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.c b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.c
index 1aa1c8eeed..cbd4992fce 100644
--- a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.c
+++ b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Performs an atomic compare exchange operation on a 32-bit unsigned integer.
@@ -29,9 +26,9 @@
UINT32
EFIAPI
InternalSyncCompareExchange32 (
- IN volatile UINT32 *Value,
- IN UINT32 CompareValue,
- IN UINT32 ExchangeValue
+ IN volatile UINT32 *Value,
+ IN UINT32 CompareValue,
+ IN UINT32 ExchangeValue
)
{
_asm {
@@ -41,4 +38,3 @@ InternalSyncCompareExchange32 (
lock cmpxchg [ecx], edx
}
}
-
diff --git a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.c b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.c
index 33cb2a047a..310e3bd8e0 100644
--- a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.c
+++ b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Performs an atomic compare exchange operation on a 64-bit unsigned integer.
@@ -28,9 +25,9 @@
UINT64
EFIAPI
InternalSyncCompareExchange64 (
- IN volatile UINT64 *Value,
- IN UINT64 CompareValue,
- IN UINT64 ExchangeValue
+ IN volatile UINT64 *Value,
+ IN UINT64 CompareValue,
+ IN UINT64 ExchangeValue
)
{
_asm {
diff --git a/MdePkg/Library/BaseSynchronizationLib/Ia32/InternalGetSpinLockProperties.c b/MdePkg/Library/BaseSynchronizationLib/Ia32/InternalGetSpinLockProperties.c
index 3e270a171c..aba0825c7c 100644
--- a/MdePkg/Library/BaseSynchronizationLib/Ia32/InternalGetSpinLockProperties.c
+++ b/MdePkg/Library/BaseSynchronizationLib/Ia32/InternalGetSpinLockProperties.c
@@ -44,7 +44,7 @@ InternalGetSpinLockProperties (
// In processors based on Intel NetBurst microarchitecture, use two cache lines
//
ModelId = ModelId | ((RegEax >> 12) & 0xf0);
- if (ModelId <= 0x04 || ModelId == 0x06) {
+ if ((ModelId <= 0x04) || (ModelId == 0x06)) {
CacheLineSize *= 2;
}
}
@@ -55,4 +55,3 @@ InternalGetSpinLockProperties (
return CacheLineSize;
}
-
diff --git a/MdePkg/Library/BaseSynchronizationLib/InterlockedDecrementMsc.c b/MdePkg/Library/BaseSynchronizationLib/InterlockedDecrementMsc.c
index 7317bc2a92..69db307107 100644
--- a/MdePkg/Library/BaseSynchronizationLib/InterlockedDecrementMsc.c
+++ b/MdePkg/Library/BaseSynchronizationLib/InterlockedDecrementMsc.c
@@ -10,9 +10,10 @@
Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics.
**/
-long _InterlockedDecrement(
- long * lpAddend
-);
+long
+_InterlockedDecrement (
+ long *lpAddend
+ );
#pragma intrinsic(_InterlockedDecrement)
@@ -32,9 +33,8 @@ long _InterlockedDecrement(
UINT32
EFIAPI
InternalSyncDecrement (
- IN volatile UINT32 *Value
+ IN volatile UINT32 *Value
)
{
return _InterlockedDecrement ((long *)(Value));
}
-
diff --git a/MdePkg/Library/BaseSynchronizationLib/InterlockedIncrementMsc.c b/MdePkg/Library/BaseSynchronizationLib/InterlockedIncrementMsc.c
index bb51ec56d9..f8b0eaa46d 100644
--- a/MdePkg/Library/BaseSynchronizationLib/InterlockedIncrementMsc.c
+++ b/MdePkg/Library/BaseSynchronizationLib/InterlockedIncrementMsc.c
@@ -10,9 +10,10 @@
Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics.
**/
-long _InterlockedIncrement(
- long * lpAddend
-);
+long
+_InterlockedIncrement (
+ long *lpAddend
+ );
#pragma intrinsic(_InterlockedIncrement)
@@ -32,9 +33,8 @@ long _InterlockedIncrement(
UINT32
EFIAPI
InternalSyncIncrement (
- IN volatile UINT32 *Value
+ IN volatile UINT32 *Value
)
{
return _InterlockedIncrement ((long *)(Value));
}
-
diff --git a/MdePkg/Library/BaseSynchronizationLib/Synchronization.c b/MdePkg/Library/BaseSynchronizationLib/Synchronization.c
index 3f7a0c7af6..54eb19d895 100644
--- a/MdePkg/Library/BaseSynchronizationLib/Synchronization.c
+++ b/MdePkg/Library/BaseSynchronizationLib/Synchronization.c
@@ -8,8 +8,8 @@
#include "BaseSynchronizationLibInternals.h"
-#define SPIN_LOCK_RELEASED ((UINTN) 1)
-#define SPIN_LOCK_ACQUIRED ((UINTN) 2)
+#define SPIN_LOCK_RELEASED ((UINTN) 1)
+#define SPIN_LOCK_ACQUIRED ((UINTN) 2)
/**
Retrieves the architecture specific spin lock alignment requirements for
@@ -55,7 +55,7 @@ GetSpinLockProperties (
SPIN_LOCK *
EFIAPI
InitializeSpinLock (
- OUT SPIN_LOCK *SpinLock
+ OUT SPIN_LOCK *SpinLock
)
{
ASSERT (SpinLock != NULL);
@@ -86,7 +86,7 @@ InitializeSpinLock (
SPIN_LOCK *
EFIAPI
AcquireSpinLock (
- IN OUT SPIN_LOCK *SpinLock
+ IN OUT SPIN_LOCK *SpinLock
)
{
UINT64 Current;
@@ -106,7 +106,7 @@ AcquireSpinLock (
//
// Get the current timer value
//
- Current = GetPerformanceCounter();
+ Current = GetPerformanceCounter ();
//
// Initialize local variables
@@ -130,23 +130,27 @@ AcquireSpinLock (
if (Cycle < 0) {
Cycle = -Cycle;
}
+
Cycle++;
while (!AcquireSpinLockOrFail (SpinLock)) {
CpuPause ();
Previous = Current;
- Current = GetPerformanceCounter();
- Delta = (INT64) (Current - Previous);
+ Current = GetPerformanceCounter ();
+ Delta = (INT64)(Current - Previous);
if (Start > End) {
Delta = -Delta;
}
+
if (Delta < 0) {
Delta += Cycle;
}
+
Total += Delta;
ASSERT (Total < Timeout);
}
}
+
return SpinLock;
}
@@ -170,10 +174,10 @@ AcquireSpinLock (
BOOLEAN
EFIAPI
AcquireSpinLockOrFail (
- IN OUT SPIN_LOCK *SpinLock
+ IN OUT SPIN_LOCK *SpinLock
)
{
- SPIN_LOCK LockValue;
+ SPIN_LOCK LockValue;
ASSERT (SpinLock != NULL);
@@ -181,12 +185,12 @@ AcquireSpinLockOrFail (
ASSERT (SPIN_LOCK_ACQUIRED == LockValue || SPIN_LOCK_RELEASED == LockValue);
return (BOOLEAN)(
- InterlockedCompareExchangePointer (
- (VOID**)SpinLock,
- (VOID*)SPIN_LOCK_RELEASED,
- (VOID*)SPIN_LOCK_ACQUIRED
- ) == (VOID*)SPIN_LOCK_RELEASED
- );
+ InterlockedCompareExchangePointer (
+ (VOID **)SpinLock,
+ (VOID *)SPIN_LOCK_RELEASED,
+ (VOID *)SPIN_LOCK_ACQUIRED
+ ) == (VOID *)SPIN_LOCK_RELEASED
+ );
}
/**
@@ -206,10 +210,10 @@ AcquireSpinLockOrFail (
SPIN_LOCK *
EFIAPI
ReleaseSpinLock (
- IN OUT SPIN_LOCK *SpinLock
+ IN OUT SPIN_LOCK *SpinLock
)
{
- SPIN_LOCK LockValue;
+ SPIN_LOCK LockValue;
ASSERT (SpinLock != NULL);
@@ -237,7 +241,7 @@ ReleaseSpinLock (
UINT32
EFIAPI
InterlockedIncrement (
- IN volatile UINT32 *Value
+ IN volatile UINT32 *Value
)
{
ASSERT (Value != NULL);
@@ -261,7 +265,7 @@ InterlockedIncrement (
UINT32
EFIAPI
InterlockedDecrement (
- IN volatile UINT32 *Value
+ IN volatile UINT32 *Value
)
{
ASSERT (Value != NULL);
@@ -290,9 +294,9 @@ InterlockedDecrement (
UINT16
EFIAPI
InterlockedCompareExchange16 (
- IN OUT volatile UINT16 *Value,
- IN UINT16 CompareValue,
- IN UINT16 ExchangeValue
+ IN OUT volatile UINT16 *Value,
+ IN UINT16 CompareValue,
+ IN UINT16 ExchangeValue
)
{
ASSERT (Value != NULL);
@@ -321,9 +325,9 @@ InterlockedCompareExchange16 (
UINT32
EFIAPI
InterlockedCompareExchange32 (
- IN OUT volatile UINT32 *Value,
- IN UINT32 CompareValue,
- IN UINT32 ExchangeValue
+ IN OUT volatile UINT32 *Value,
+ IN UINT32 CompareValue,
+ IN UINT32 ExchangeValue
)
{
ASSERT (Value != NULL);
@@ -351,9 +355,9 @@ InterlockedCompareExchange32 (
UINT64
EFIAPI
InterlockedCompareExchange64 (
- IN OUT volatile UINT64 *Value,
- IN UINT64 CompareValue,
- IN UINT64 ExchangeValue
+ IN OUT volatile UINT64 *Value,
+ IN UINT64 CompareValue,
+ IN UINT64 ExchangeValue
)
{
ASSERT (Value != NULL);
@@ -381,9 +385,9 @@ InterlockedCompareExchange64 (
VOID *
EFIAPI
InterlockedCompareExchangePointer (
- IN OUT VOID * volatile *Value,
- IN VOID *CompareValue,
- IN VOID *ExchangeValue
+ IN OUT VOID *volatile *Value,
+ IN VOID *CompareValue,
+ IN VOID *ExchangeValue
)
{
UINT8 SizeOfValue;
@@ -392,17 +396,17 @@ InterlockedCompareExchangePointer (
switch (SizeOfValue) {
case sizeof (UINT32):
- return (VOID*)(UINTN)InterlockedCompareExchange32 (
- (volatile UINT32 *)Value,
- (UINT32)(UINTN)CompareValue,
- (UINT32)(UINTN)ExchangeValue
- );
+ return (VOID *)(UINTN)InterlockedCompareExchange32 (
+ (volatile UINT32 *)Value,
+ (UINT32)(UINTN)CompareValue,
+ (UINT32)(UINTN)ExchangeValue
+ );
case sizeof (UINT64):
- return (VOID*)(UINTN)InterlockedCompareExchange64 (
- (volatile UINT64 *)Value,
- (UINT64)(UINTN)CompareValue,
- (UINT64)(UINTN)ExchangeValue
- );
+ return (VOID *)(UINTN)InterlockedCompareExchange64 (
+ (volatile UINT64 *)Value,
+ (UINT64)(UINTN)CompareValue,
+ (UINT64)(UINTN)ExchangeValue
+ );
default:
ASSERT (FALSE);
return NULL;
diff --git a/MdePkg/Library/BaseSynchronizationLib/SynchronizationGcc.c b/MdePkg/Library/BaseSynchronizationLib/SynchronizationGcc.c
index 466775e602..9f47983919 100644
--- a/MdePkg/Library/BaseSynchronizationLib/SynchronizationGcc.c
+++ b/MdePkg/Library/BaseSynchronizationLib/SynchronizationGcc.c
@@ -12,10 +12,10 @@
//
// GCC inline assembly for Read Write Barrier
//
-#define _ReadWriteBarrier() do { __asm__ __volatile__ ("": : : "memory"); } while(0)
+#define _ReadWriteBarrier() do { __asm__ __volatile__ ("": : : "memory"); } while(0)
-#define SPIN_LOCK_RELEASED ((UINTN) 1)
-#define SPIN_LOCK_ACQUIRED ((UINTN) 2)
+#define SPIN_LOCK_RELEASED ((UINTN) 1)
+#define SPIN_LOCK_ACQUIRED ((UINTN) 2)
/**
Retrieves the architecture specific spin lock alignment requirements for
@@ -61,14 +61,14 @@ GetSpinLockProperties (
SPIN_LOCK *
EFIAPI
InitializeSpinLock (
- OUT SPIN_LOCK *SpinLock
+ OUT SPIN_LOCK *SpinLock
)
{
ASSERT (SpinLock != NULL);
- _ReadWriteBarrier();
+ _ReadWriteBarrier ();
*SpinLock = SPIN_LOCK_RELEASED;
- _ReadWriteBarrier();
+ _ReadWriteBarrier ();
return SpinLock;
}
@@ -96,7 +96,7 @@ InitializeSpinLock (
SPIN_LOCK *
EFIAPI
AcquireSpinLock (
- IN OUT SPIN_LOCK *SpinLock
+ IN OUT SPIN_LOCK *SpinLock
)
{
UINT64 Current;
@@ -116,7 +116,7 @@ AcquireSpinLock (
//
// Get the current timer value
//
- Current = GetPerformanceCounter();
+ Current = GetPerformanceCounter ();
//
// Initialize local variables
@@ -140,23 +140,27 @@ AcquireSpinLock (
if (Cycle < 0) {
Cycle = -Cycle;
}
+
Cycle++;
while (!AcquireSpinLockOrFail (SpinLock)) {
CpuPause ();
Previous = Current;
- Current = GetPerformanceCounter();
- Delta = (INT64) (Current - Previous);
+ Current = GetPerformanceCounter ();
+ Delta = (INT64)(Current - Previous);
if (Start > End) {
Delta = -Delta;
}
+
if (Delta < 0) {
Delta += Cycle;
}
+
Total += Delta;
ASSERT (Total < Timeout);
}
}
+
return SpinLock;
}
@@ -180,11 +184,11 @@ AcquireSpinLock (
BOOLEAN
EFIAPI
AcquireSpinLockOrFail (
- IN OUT SPIN_LOCK *SpinLock
+ IN OUT SPIN_LOCK *SpinLock
)
{
- SPIN_LOCK LockValue;
- VOID *Result;
+ SPIN_LOCK LockValue;
+ VOID *Result;
ASSERT (SpinLock != NULL);
@@ -193,13 +197,13 @@ AcquireSpinLockOrFail (
_ReadWriteBarrier ();
Result = InterlockedCompareExchangePointer (
- (VOID**)SpinLock,
- (VOID*)SPIN_LOCK_RELEASED,
- (VOID*)SPIN_LOCK_ACQUIRED
- );
+ (VOID **)SpinLock,
+ (VOID *)SPIN_LOCK_RELEASED,
+ (VOID *)SPIN_LOCK_ACQUIRED
+ );
_ReadWriteBarrier ();
- return (BOOLEAN) (Result == (VOID*) SPIN_LOCK_RELEASED);
+ return (BOOLEAN)(Result == (VOID *)SPIN_LOCK_RELEASED);
}
/**
@@ -219,10 +223,10 @@ AcquireSpinLockOrFail (
SPIN_LOCK *
EFIAPI
ReleaseSpinLock (
- IN OUT SPIN_LOCK *SpinLock
+ IN OUT SPIN_LOCK *SpinLock
)
{
- SPIN_LOCK LockValue;
+ SPIN_LOCK LockValue;
ASSERT (SpinLock != NULL);
@@ -253,7 +257,7 @@ ReleaseSpinLock (
UINT32
EFIAPI
InterlockedIncrement (
- IN volatile UINT32 *Value
+ IN volatile UINT32 *Value
)
{
ASSERT (Value != NULL);
@@ -277,7 +281,7 @@ InterlockedIncrement (
UINT32
EFIAPI
InterlockedDecrement (
- IN volatile UINT32 *Value
+ IN volatile UINT32 *Value
)
{
ASSERT (Value != NULL);
@@ -306,9 +310,9 @@ InterlockedDecrement (
UINT16
EFIAPI
InterlockedCompareExchange16 (
- IN OUT volatile UINT16 *Value,
- IN UINT16 CompareValue,
- IN UINT16 ExchangeValue
+ IN OUT volatile UINT16 *Value,
+ IN UINT16 CompareValue,
+ IN UINT16 ExchangeValue
)
{
ASSERT (Value != NULL);
@@ -337,9 +341,9 @@ InterlockedCompareExchange16 (
UINT32
EFIAPI
InterlockedCompareExchange32 (
- IN OUT volatile UINT32 *Value,
- IN UINT32 CompareValue,
- IN UINT32 ExchangeValue
+ IN OUT volatile UINT32 *Value,
+ IN UINT32 CompareValue,
+ IN UINT32 ExchangeValue
)
{
ASSERT (Value != NULL);
@@ -367,9 +371,9 @@ InterlockedCompareExchange32 (
UINT64
EFIAPI
InterlockedCompareExchange64 (
- IN OUT volatile UINT64 *Value,
- IN UINT64 CompareValue,
- IN UINT64 ExchangeValue
+ IN OUT volatile UINT64 *Value,
+ IN UINT64 CompareValue,
+ IN UINT64 ExchangeValue
)
{
ASSERT (Value != NULL);
@@ -397,9 +401,9 @@ InterlockedCompareExchange64 (
VOID *
EFIAPI
InterlockedCompareExchangePointer (
- IN OUT VOID * volatile *Value,
- IN VOID *CompareValue,
- IN VOID *ExchangeValue
+ IN OUT VOID *volatile *Value,
+ IN VOID *CompareValue,
+ IN VOID *ExchangeValue
)
{
UINT8 SizeOfValue;
@@ -408,17 +412,17 @@ InterlockedCompareExchangePointer (
switch (SizeOfValue) {
case sizeof (UINT32):
- return (VOID*)(UINTN)InterlockedCompareExchange32 (
- (volatile UINT32 *)Value,
- (UINT32)(UINTN)CompareValue,
- (UINT32)(UINTN)ExchangeValue
- );
+ return (VOID *)(UINTN)InterlockedCompareExchange32 (
+ (volatile UINT32 *)Value,
+ (UINT32)(UINTN)CompareValue,
+ (UINT32)(UINTN)ExchangeValue
+ );
case sizeof (UINT64):
- return (VOID*)(UINTN)InterlockedCompareExchange64 (
- (volatile UINT64 *)Value,
- (UINT64)(UINTN)CompareValue,
- (UINT64)(UINTN)ExchangeValue
- );
+ return (VOID *)(UINTN)InterlockedCompareExchange64 (
+ (volatile UINT64 *)Value,
+ (UINT64)(UINTN)CompareValue,
+ (UINT64)(UINTN)ExchangeValue
+ );
default:
ASSERT (FALSE);
return NULL;
diff --git a/MdePkg/Library/BaseSynchronizationLib/SynchronizationMsc.c b/MdePkg/Library/BaseSynchronizationLib/SynchronizationMsc.c
index 12b01ff899..f99895a39c 100644
--- a/MdePkg/Library/BaseSynchronizationLib/SynchronizationMsc.c
+++ b/MdePkg/Library/BaseSynchronizationLib/SynchronizationMsc.c
@@ -12,12 +12,15 @@
Microsoft Visual Studio 7.1 Function Prototypes for read write barrier Intrinsics.
**/
-void _ReadWriteBarrier (void);
-#pragma intrinsic(_ReadWriteBarrier)
+void
+_ReadWriteBarrier (
+ void
+ );
+#pragma intrinsic(_ReadWriteBarrier)
-#define SPIN_LOCK_RELEASED ((UINTN) 1)
-#define SPIN_LOCK_ACQUIRED ((UINTN) 2)
+#define SPIN_LOCK_RELEASED ((UINTN) 1)
+#define SPIN_LOCK_ACQUIRED ((UINTN) 2)
/**
Retrieves the architecture specific spin lock alignment requirements for
@@ -63,14 +66,14 @@ GetSpinLockProperties (
SPIN_LOCK *
EFIAPI
InitializeSpinLock (
- OUT SPIN_LOCK *SpinLock
+ OUT SPIN_LOCK *SpinLock
)
{
ASSERT (SpinLock != NULL);
- _ReadWriteBarrier();
+ _ReadWriteBarrier ();
*SpinLock = SPIN_LOCK_RELEASED;
- _ReadWriteBarrier();
+ _ReadWriteBarrier ();
return SpinLock;
}
@@ -98,7 +101,7 @@ InitializeSpinLock (
SPIN_LOCK *
EFIAPI
AcquireSpinLock (
- IN OUT SPIN_LOCK *SpinLock
+ IN OUT SPIN_LOCK *SpinLock
)
{
UINT64 Current;
@@ -118,7 +121,7 @@ AcquireSpinLock (
//
// Get the current timer value
//
- Current = GetPerformanceCounter();
+ Current = GetPerformanceCounter ();
//
// Initialize local variables
@@ -142,23 +145,27 @@ AcquireSpinLock (
if (Cycle < 0) {
Cycle = -Cycle;
}
+
Cycle++;
while (!AcquireSpinLockOrFail (SpinLock)) {
CpuPause ();
Previous = Current;
- Current = GetPerformanceCounter();
- Delta = (INT64) (Current - Previous);
+ Current = GetPerformanceCounter ();
+ Delta = (INT64)(Current - Previous);
if (Start > End) {
Delta = -Delta;
}
+
if (Delta < 0) {
Delta += Cycle;
}
+
Total += Delta;
ASSERT (Total < Timeout);
}
}
+
return SpinLock;
}
@@ -182,11 +189,11 @@ AcquireSpinLock (
BOOLEAN
EFIAPI
AcquireSpinLockOrFail (
- IN OUT SPIN_LOCK *SpinLock
+ IN OUT SPIN_LOCK *SpinLock
)
{
- SPIN_LOCK LockValue;
- VOID *Result;
+ SPIN_LOCK LockValue;
+ VOID *Result;
ASSERT (SpinLock != NULL);
@@ -195,13 +202,13 @@ AcquireSpinLockOrFail (
_ReadWriteBarrier ();
Result = InterlockedCompareExchangePointer (
- (VOID**)SpinLock,
- (VOID*)SPIN_LOCK_RELEASED,
- (VOID*)SPIN_LOCK_ACQUIRED
- );
+ (VOID **)SpinLock,
+ (VOID *)SPIN_LOCK_RELEASED,
+ (VOID *)SPIN_LOCK_ACQUIRED
+ );
_ReadWriteBarrier ();
- return (BOOLEAN) (Result == (VOID*) SPIN_LOCK_RELEASED);
+ return (BOOLEAN)(Result == (VOID *)SPIN_LOCK_RELEASED);
}
/**
@@ -221,10 +228,10 @@ AcquireSpinLockOrFail (
SPIN_LOCK *
EFIAPI
ReleaseSpinLock (
- IN OUT SPIN_LOCK *SpinLock
+ IN OUT SPIN_LOCK *SpinLock
)
{
- SPIN_LOCK LockValue;
+ SPIN_LOCK LockValue;
ASSERT (SpinLock != NULL);
@@ -255,7 +262,7 @@ ReleaseSpinLock (
UINT32
EFIAPI
InterlockedIncrement (
- IN volatile UINT32 *Value
+ IN volatile UINT32 *Value
)
{
ASSERT (Value != NULL);
@@ -279,7 +286,7 @@ InterlockedIncrement (
UINT32
EFIAPI
InterlockedDecrement (
- IN volatile UINT32 *Value
+ IN volatile UINT32 *Value
)
{
ASSERT (Value != NULL);
@@ -308,9 +315,9 @@ InterlockedDecrement (
UINT16
EFIAPI
InterlockedCompareExchange16 (
- IN OUT volatile UINT16 *Value,
- IN UINT16 CompareValue,
- IN UINT16 ExchangeValue
+ IN OUT volatile UINT16 *Value,
+ IN UINT16 CompareValue,
+ IN UINT16 ExchangeValue
)
{
ASSERT (Value != NULL);
@@ -339,9 +346,9 @@ InterlockedCompareExchange16 (
UINT32
EFIAPI
InterlockedCompareExchange32 (
- IN OUT volatile UINT32 *Value,
- IN UINT32 CompareValue,
- IN UINT32 ExchangeValue
+ IN OUT volatile UINT32 *Value,
+ IN UINT32 CompareValue,
+ IN UINT32 ExchangeValue
)
{
ASSERT (Value != NULL);
@@ -369,9 +376,9 @@ InterlockedCompareExchange32 (
UINT64
EFIAPI
InterlockedCompareExchange64 (
- IN OUT volatile UINT64 *Value,
- IN UINT64 CompareValue,
- IN UINT64 ExchangeValue
+ IN OUT volatile UINT64 *Value,
+ IN UINT64 CompareValue,
+ IN UINT64 ExchangeValue
)
{
ASSERT (Value != NULL);
@@ -399,28 +406,28 @@ InterlockedCompareExchange64 (
VOID *
EFIAPI
InterlockedCompareExchangePointer (
- IN OUT VOID * volatile *Value,
- IN VOID *CompareValue,
- IN VOID *ExchangeValue
+ IN OUT VOID *volatile *Value,
+ IN VOID *CompareValue,
+ IN VOID *ExchangeValue
)
{
UINT8 SizeOfValue;
- SizeOfValue = (UINT8) sizeof (*Value);
+ SizeOfValue = (UINT8)sizeof (*Value);
switch (SizeOfValue) {
case sizeof (UINT32):
- return (VOID*)(UINTN)InterlockedCompareExchange32 (
- (volatile UINT32*)Value,
- (UINT32)(UINTN)CompareValue,
- (UINT32)(UINTN)ExchangeValue
- );
+ return (VOID *)(UINTN)InterlockedCompareExchange32 (
+ (volatile UINT32 *)Value,
+ (UINT32)(UINTN)CompareValue,
+ (UINT32)(UINTN)ExchangeValue
+ );
case sizeof (UINT64):
- return (VOID*)(UINTN)InterlockedCompareExchange64 (
- (volatile UINT64*)Value,
- (UINT64)(UINTN)CompareValue,
- (UINT64)(UINTN)ExchangeValue
- );
+ return (VOID *)(UINTN)InterlockedCompareExchange64 (
+ (volatile UINT64 *)Value,
+ (UINT64)(UINTN)CompareValue,
+ (UINT64)(UINTN)ExchangeValue
+ );
default:
ASSERT (FALSE);
return NULL;
diff --git a/MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c b/MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c
index be19219c2d..3a269359dd 100644
--- a/MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c
+++ b/MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c
@@ -7,8 +7,6 @@
**/
-
-
/**
Performs an atomic increment of an 32-bit unsigned integer.
@@ -24,7 +22,7 @@
UINT32
EFIAPI
InternalSyncIncrement (
- IN volatile UINT32 *Value
+ IN volatile UINT32 *Value
)
{
UINT32 Result;
@@ -39,12 +37,11 @@ InternalSyncIncrement (
: // no inputs that aren't also outputs
: "memory",
"cc"
- );
+ );
return Result;
}
-
/**
Performs an atomic decrement of an 32-bit unsigned integer.
@@ -60,10 +57,10 @@ InternalSyncIncrement (
UINT32
EFIAPI
InternalSyncDecrement (
- IN volatile UINT32 *Value
+ IN volatile UINT32 *Value
)
{
- UINT32 Result;
+ UINT32 Result;
__asm__ __volatile__ (
"movl $-1, %%eax \n\t"
@@ -75,12 +72,11 @@ InternalSyncDecrement (
: // no inputs that aren't also outputs
: "memory",
"cc"
- );
+ );
return Result;
}
-
/**
Performs an atomic compare exchange operation on a 16-bit unsigned integer.
@@ -102,9 +98,9 @@ InternalSyncDecrement (
UINT16
EFIAPI
InternalSyncCompareExchange16 (
- IN OUT volatile UINT16 *Value,
- IN UINT16 CompareValue,
- IN UINT16 ExchangeValue
+ IN OUT volatile UINT16 *Value,
+ IN UINT16 CompareValue,
+ IN UINT16 ExchangeValue
)
{
__asm__ __volatile__ (
@@ -115,12 +111,11 @@ InternalSyncCompareExchange16 (
: "r" (ExchangeValue) // %2
: "memory",
"cc"
- );
+ );
return CompareValue;
}
-
/**
Performs an atomic compare exchange operation on a 32-bit unsigned integer.
@@ -142,9 +137,9 @@ InternalSyncCompareExchange16 (
UINT32
EFIAPI
InternalSyncCompareExchange32 (
- IN OUT volatile UINT32 *Value,
- IN UINT32 CompareValue,
- IN UINT32 ExchangeValue
+ IN OUT volatile UINT32 *Value,
+ IN UINT32 CompareValue,
+ IN UINT32 ExchangeValue
)
{
__asm__ __volatile__ (
@@ -155,12 +150,11 @@ InternalSyncCompareExchange32 (
: "r" (ExchangeValue) // %2
: "memory",
"cc"
- );
+ );
return CompareValue;
}
-
/**
Performs an atomic compare exchange operation on a 64-bit unsigned integer.
@@ -181,9 +175,9 @@ InternalSyncCompareExchange32 (
UINT64
EFIAPI
InternalSyncCompareExchange64 (
- IN OUT volatile UINT64 *Value,
- IN UINT64 CompareValue,
- IN UINT64 ExchangeValue
+ IN OUT volatile UINT64 *Value,
+ IN UINT64 CompareValue,
+ IN UINT64 ExchangeValue
)
{
__asm__ __volatile__ (
@@ -194,7 +188,7 @@ InternalSyncCompareExchange64 (
: "r" (ExchangeValue) // %2
: "memory",
"cc"
- );
+ );
return CompareValue;
}
diff --git a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.c b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.c
index 4bbf190d59..3692dc5d8d 100644
--- a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.c
+++ b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.c
@@ -11,11 +11,12 @@
Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics.
**/
-__int16 _InterlockedCompareExchange16(
- __int16 volatile * Destination,
- __int16 Exchange,
- __int16 Comperand
-);
+__int16
+_InterlockedCompareExchange16 (
+ __int16 volatile *Destination,
+ __int16 Exchange,
+ __int16 Comperand
+ );
#pragma intrinsic(_InterlockedCompareExchange16)
@@ -38,11 +39,10 @@ __int16 _InterlockedCompareExchange16(
UINT16
EFIAPI
InternalSyncCompareExchange16 (
- IN volatile UINT16 *Value,
- IN UINT16 CompareValue,
- IN UINT16 ExchangeValue
+ IN volatile UINT16 *Value,
+ IN UINT16 CompareValue,
+ IN UINT16 ExchangeValue
)
{
return _InterlockedCompareExchange16 (Value, ExchangeValue, CompareValue);
}
-
diff --git a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.c b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.c
index c693a0640f..3a4cc23fbb 100644
--- a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.c
+++ b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.c
@@ -10,11 +10,12 @@
Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics.
**/
-long _InterlockedCompareExchange(
- long volatile * Destination,
- long Exchange,
- long Comperand
-);
+long
+_InterlockedCompareExchange (
+ long volatile *Destination,
+ long Exchange,
+ long Comperand
+ );
#pragma intrinsic(_InterlockedCompareExchange)
@@ -38,11 +39,10 @@ long _InterlockedCompareExchange(
UINT32
EFIAPI
InternalSyncCompareExchange32 (
- IN volatile UINT32 *Value,
- IN UINT32 CompareValue,
- IN UINT32 ExchangeValue
+ IN volatile UINT32 *Value,
+ IN UINT32 CompareValue,
+ IN UINT32 ExchangeValue
)
{
return _InterlockedCompareExchange (Value, ExchangeValue, CompareValue);
}
-
diff --git a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.c b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.c
index 4b9167c0d5..ef4e6085af 100644
--- a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.c
+++ b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.c
@@ -10,11 +10,12 @@
Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics.
**/
-__int64 _InterlockedCompareExchange64(
- __int64 volatile * Destination,
- __int64 Exchange,
- __int64 Comperand
-);
+__int64
+_InterlockedCompareExchange64 (
+ __int64 volatile *Destination,
+ __int64 Exchange,
+ __int64 Comperand
+ );
#pragma intrinsic(_InterlockedCompareExchange64)
@@ -37,11 +38,10 @@ __int64 _InterlockedCompareExchange64(
UINT64
EFIAPI
InternalSyncCompareExchange64 (
- IN volatile UINT64 *Value,
- IN UINT64 CompareValue,
- IN UINT64 ExchangeValue
+ IN volatile UINT64 *Value,
+ IN UINT64 CompareValue,
+ IN UINT64 ExchangeValue
)
{
return _InterlockedCompareExchange64 (Value, ExchangeValue, CompareValue);
}
-
diff --git a/MdePkg/Library/BaseTimerLibNullTemplate/TimerLibNull.c b/MdePkg/Library/BaseTimerLibNullTemplate/TimerLibNull.c
index ee8d306a94..58f5fb5713 100644
--- a/MdePkg/Library/BaseTimerLibNullTemplate/TimerLibNull.c
+++ b/MdePkg/Library/BaseTimerLibNullTemplate/TimerLibNull.c
@@ -23,7 +23,7 @@
UINTN
EFIAPI
MicroSecondDelay (
- IN UINTN MicroSeconds
+ IN UINTN MicroSeconds
)
{
ASSERT (FALSE);
@@ -43,7 +43,7 @@ MicroSecondDelay (
UINTN
EFIAPI
NanoSecondDelay (
- IN UINTN NanoSeconds
+ IN UINTN NanoSeconds
)
{
ASSERT (FALSE);
@@ -97,8 +97,8 @@ GetPerformanceCounter (
UINT64
EFIAPI
GetPerformanceCounterProperties (
- OUT UINT64 *StartValue OPTIONAL,
- OUT UINT64 *EndValue OPTIONAL
+ OUT UINT64 *StartValue OPTIONAL,
+ OUT UINT64 *EndValue OPTIONAL
)
{
ASSERT (FALSE);
@@ -120,7 +120,7 @@ GetPerformanceCounterProperties (
UINT64
EFIAPI
GetTimeInNanoSecond (
- IN UINT64 Ticks
+ IN UINT64 Ticks
)
{
ASSERT (FALSE);
diff --git a/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c b/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
index 28b4bf9d8b..2f0a0c8c45 100644
--- a/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
+++ b/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
@@ -27,37 +27,35 @@ FillBuf (
//
// Left shift NumOfBits of bits in advance
//
- Sd->mBitBuf = (UINT32) LShiftU64 (((UINT64)Sd->mBitBuf), NumOfBits);
+ Sd->mBitBuf = (UINT32)LShiftU64 (((UINT64)Sd->mBitBuf), NumOfBits);
//
// Copy data needed in bytes into mSbuBitBuf
//
while (NumOfBits > Sd->mBitCount) {
- NumOfBits = (UINT16) (NumOfBits - Sd->mBitCount);
- Sd->mBitBuf |= (UINT32) LShiftU64 (((UINT64)Sd->mSubBitBuf), NumOfBits);
+ NumOfBits = (UINT16)(NumOfBits - Sd->mBitCount);
+ Sd->mBitBuf |= (UINT32)LShiftU64 (((UINT64)Sd->mSubBitBuf), NumOfBits);
if (Sd->mCompSize > 0) {
//
// Get 1 byte into SubBitBuf
//
Sd->mCompSize--;
- Sd->mSubBitBuf = Sd->mSrcBase[Sd->mInBuf++];
- Sd->mBitCount = 8;
-
+ Sd->mSubBitBuf = Sd->mSrcBase[Sd->mInBuf++];
+ Sd->mBitCount = 8;
} else {
//
// No more bits from the source, just pad zero bit.
//
- Sd->mSubBitBuf = 0;
- Sd->mBitCount = 8;
-
+ Sd->mSubBitBuf = 0;
+ Sd->mBitCount = 8;
}
}
//
// Calculate additional bit count read to update mBitCount
//
- Sd->mBitCount = (UINT16) (Sd->mBitCount - NumOfBits);
+ Sd->mBitCount = (UINT16)(Sd->mBitCount - NumOfBits);
//
// Copy NumOfBits of bits from mSubBitBuf into mBitBuf
@@ -89,7 +87,7 @@ GetBits (
//
// Pop NumOfBits of Bits from Left
//
- OutBits = (UINT32) (Sd->mBitBuf >> (BITBUFSIZ - NumOfBits));
+ OutBits = (UINT32)(Sd->mBitBuf >> (BITBUFSIZ - NumOfBits));
//
// Fill up mBitBuf from source
@@ -153,8 +151,9 @@ MakeTable (
for (Index = 0; Index < NumOfChar; Index++) {
if (BitLen[Index] > 16) {
- return (UINT16) BAD_TABLE;
+ return (UINT16)BAD_TABLE;
}
+
Count[BitLen[Index]]++;
}
@@ -162,71 +161,67 @@ MakeTable (
Start[1] = 0;
for (Index = 1; Index <= 16; Index++) {
- WordOfStart = Start[Index];
- WordOfCount = Count[Index];
- Start[Index + 1] = (UINT16) (WordOfStart + (WordOfCount << (16 - Index)));
+ WordOfStart = Start[Index];
+ WordOfCount = Count[Index];
+ Start[Index + 1] = (UINT16)(WordOfStart + (WordOfCount << (16 - Index)));
}
if (Start[17] != 0) {
/*(1U << 16)*/
- return (UINT16) BAD_TABLE;
+ return (UINT16)BAD_TABLE;
}
- JuBits = (UINT16) (16 - TableBits);
+ JuBits = (UINT16)(16 - TableBits);
Weight[0] = 0;
for (Index = 1; Index <= TableBits; Index++) {
Start[Index] >>= JuBits;
- Weight[Index] = (UINT16) (1U << (TableBits - Index));
+ Weight[Index] = (UINT16)(1U << (TableBits - Index));
}
while (Index <= 16) {
- Weight[Index] = (UINT16) (1U << (16 - Index));
+ Weight[Index] = (UINT16)(1U << (16 - Index));
Index++;
}
- Index = (UINT16) (Start[TableBits + 1] >> JuBits);
+ Index = (UINT16)(Start[TableBits + 1] >> JuBits);
if (Index != 0) {
- Index3 = (UINT16) (1U << TableBits);
+ Index3 = (UINT16)(1U << TableBits);
if (Index < Index3) {
SetMem16 (Table + Index, (Index3 - Index) * sizeof (*Table), 0);
}
}
- Avail = NumOfChar;
- Mask = (UINT16) (1U << (15 - TableBits));
- MaxTableLength = (UINT16) (1U << TableBits);
+ Avail = NumOfChar;
+ Mask = (UINT16)(1U << (15 - TableBits));
+ MaxTableLength = (UINT16)(1U << TableBits);
for (Char = 0; Char < NumOfChar; Char++) {
-
Len = BitLen[Char];
- if (Len == 0 || Len >= 17) {
+ if ((Len == 0) || (Len >= 17)) {
continue;
}
- NextCode = (UINT16) (Start[Len] + Weight[Len]);
+ NextCode = (UINT16)(Start[Len] + Weight[Len]);
if (Len <= TableBits) {
-
- if (Start[Len] >= NextCode || NextCode > MaxTableLength){
- return (UINT16) BAD_TABLE;
+ if ((Start[Len] >= NextCode) || (NextCode > MaxTableLength)) {
+ return (UINT16)BAD_TABLE;
}
for (Index = Start[Len]; Index < NextCode; Index++) {
Table[Index] = Char;
}
-
} else {
-
Index3 = Start[Len];
Pointer = &Table[Index3 >> JuBits];
- Index = (UINT16) (Len - TableBits);
+ Index = (UINT16)(Len - TableBits);
while (Index != 0) {
- if (*Pointer == 0 && Avail < (2 * NC - 1)) {
+ if ((*Pointer == 0) && (Avail < (2 * NC - 1))) {
Sd->mRight[Avail] = Sd->mLeft[Avail] = 0;
- *Pointer = Avail++;
+ *Pointer = Avail++;
}
if (*Pointer < (2 * NC - 1)) {
@@ -242,11 +237,11 @@ MakeTable (
}
*Pointer = Char;
-
}
Start[Len] = NextCode;
}
+
//
// Succeeds
//
@@ -278,7 +273,6 @@ DecodeP (
Mask = 1U << (BITBUFSIZ - 1 - 8);
do {
-
if ((Sd->mBitBuf & Mask) != 0) {
Val = Sd->mRight[Val];
} else {
@@ -288,6 +282,7 @@ DecodeP (
Mask >>= 1;
} while (Val >= MAXNP);
}
+
//
// Advance what we have read
//
@@ -295,7 +290,7 @@ DecodeP (
Pos = Val;
if (Val > 1) {
- Pos = (UINT32) ((1U << (Val - 1)) + GetBits (Sd, (UINT16) (Val - 1)));
+ Pos = (UINT32)((1U << (Val - 1)) + GetBits (Sd, (UINT16)(Val - 1)));
}
return Pos;
@@ -333,15 +328,15 @@ ReadPTLen (
//
// Read Extra Set Code Length Array size
//
- Number = (UINT16) GetBits (Sd, nbit);
+ Number = (UINT16)GetBits (Sd, nbit);
if (Number == 0) {
//
// This represents only Huffman code used
//
- CharC = (UINT16) GetBits (Sd, nbit);
+ CharC = (UINT16)GetBits (Sd, nbit);
- SetMem16 (&Sd->mPTTable[0] , sizeof (Sd->mPTTable), CharC);
+ SetMem16 (&Sd->mPTTable[0], sizeof (Sd->mPTTable), CharC);
SetMem (Sd->mPTLen, nn, 0);
@@ -351,8 +346,7 @@ ReadPTLen (
Index = 0;
while (Index < Number && Index < NPT) {
-
- CharC = (UINT16) (Sd->mBitBuf >> (BITBUFSIZ - 3));
+ CharC = (UINT16)(Sd->mBitBuf >> (BITBUFSIZ - 3));
//
// If a code length is less than 7, then it is encoded as a 3-bit
@@ -367,9 +361,9 @@ ReadPTLen (
}
}
- FillBuf (Sd, (UINT16) ((CharC < 7) ? 3 : CharC - 3));
+ FillBuf (Sd, (UINT16)((CharC < 7) ? 3 : CharC - 3));
- Sd->mPTLen[Index++] = (UINT8) CharC;
+ Sd->mPTLen[Index++] = (UINT8)CharC;
//
// For Code&Len Set,
@@ -378,8 +372,8 @@ ReadPTLen (
// zero lengths after the third length.
//
if (Index == Special) {
- CharC = (UINT16) GetBits (Sd, 2);
- while ((INT16) (--CharC) >= 0 && Index < NPT) {
+ CharC = (UINT16)GetBits (Sd, 2);
+ while ((INT16)(--CharC) >= 0 && Index < NPT) {
Sd->mPTLen[Index++] = 0;
}
}
@@ -406,23 +400,23 @@ ReadCLen (
SCRATCH_DATA *Sd
)
{
- UINT16 Number;
- UINT16 CharC;
- UINT16 Index;
- UINT32 Mask;
+ UINT16 Number;
+ UINT16 CharC;
+ UINT16 Index;
+ UINT32 Mask;
- Number = (UINT16) GetBits (Sd, CBIT);
+ Number = (UINT16)GetBits (Sd, CBIT);
if (Number == 0) {
//
// This represents only Huffman code used
//
- CharC = (UINT16) GetBits (Sd, CBIT);
+ CharC = (UINT16)GetBits (Sd, CBIT);
SetMem (Sd->mCLen, NC, 0);
SetMem16 (&Sd->mCTable[0], sizeof (Sd->mCTable), CharC);
- return ;
+ return;
}
Index = 0;
@@ -432,7 +426,6 @@ ReadCLen (
Mask = 1U << (BITBUFSIZ - 1 - 8);
do {
-
if (Mask & Sd->mBitBuf) {
CharC = Sd->mRight[CharC];
} else {
@@ -440,32 +433,28 @@ ReadCLen (
}
Mask >>= 1;
-
} while (CharC >= NT);
}
+
//
// Advance what we have read
//
FillBuf (Sd, Sd->mPTLen[CharC]);
if (CharC <= 2) {
-
if (CharC == 0) {
CharC = 1;
} else if (CharC == 1) {
- CharC = (UINT16) (GetBits (Sd, 4) + 3);
+ CharC = (UINT16)(GetBits (Sd, 4) + 3);
} else if (CharC == 2) {
- CharC = (UINT16) (GetBits (Sd, CBIT) + 20);
+ CharC = (UINT16)(GetBits (Sd, CBIT) + 20);
}
- while ((INT16) (--CharC) >= 0 && Index < NC) {
+ while ((INT16)(--CharC) >= 0 && Index < NC) {
Sd->mCLen[Index++] = 0;
}
-
} else {
-
- Sd->mCLen[Index++] = (UINT8) (CharC - 2);
-
+ Sd->mCLen[Index++] = (UINT8)(CharC - 2);
}
}
@@ -473,7 +462,7 @@ ReadCLen (
MakeTable (Sd, NC, Sd->mCLen, 12, Sd->mCTable);
- return ;
+ return;
}
/**
@@ -501,7 +490,7 @@ DecodeC (
// Starting a new block
// Read BlockSize from block header
//
- Sd->mBlockSize = (UINT16) GetBits (Sd, 16);
+ Sd->mBlockSize = (UINT16)GetBits (Sd, 16);
//
// Read in the Extra Set Code Length Array,
@@ -522,7 +511,7 @@ DecodeC (
// Read in the Position Set Code Length Array,
// Generate the Huffman code mapping table for the Position Set.
//
- Sd->mBadTableFlag = ReadPTLen (Sd, MAXNP, Sd->mPBit, (UINT16) (-1));
+ Sd->mBadTableFlag = ReadPTLen (Sd, MAXNP, Sd->mPBit, (UINT16)(-1));
if (Sd->mBadTableFlag != 0) {
return 0;
}
@@ -547,6 +536,7 @@ DecodeC (
Mask >>= 1;
} while (Index2 >= NC);
}
+
//
// Advance what we have read
//
@@ -570,11 +560,11 @@ Decode (
UINT32 DataIdx;
UINT16 CharC;
- BytesRemain = (UINT16) (-1);
+ BytesRemain = (UINT16)(-1);
- DataIdx = 0;
+ DataIdx = 0;
- for (;;) {
+ for ( ; ;) {
//
// Get one code from mBitBuf
//
@@ -593,14 +583,13 @@ Decode (
//
// Write orignal character into mDstBase
//
- Sd->mDstBase[Sd->mOutBuf++] = (UINT8) CharC;
+ Sd->mDstBase[Sd->mOutBuf++] = (UINT8)CharC;
}
-
} else {
//
// Process a Pointer
//
- CharC = (UINT16) (CharC - (BIT8 - THRESHOLD));
+ CharC = (UINT16)(CharC - (BIT8 - THRESHOLD));
//
// Get string length
@@ -610,25 +599,28 @@ Decode (
//
// Locate string position
//
- DataIdx = Sd->mOutBuf - DecodeP (Sd) - 1;
+ DataIdx = Sd->mOutBuf - DecodeP (Sd) - 1;
//
// Write BytesRemain of bytes into mDstBase
//
BytesRemain--;
- while ((INT16) (BytesRemain) >= 0) {
+ while ((INT16)(BytesRemain) >= 0) {
if (Sd->mOutBuf >= Sd->mOrigSize) {
goto Done;
}
+
if (DataIdx >= Sd->mOrigSize) {
- Sd->mBadTableFlag = (UINT16) BAD_TABLE;
+ Sd->mBadTableFlag = (UINT16)BAD_TABLE;
goto Done;
}
+
Sd->mDstBase[Sd->mOutBuf++] = Sd->mDstBase[DataIdx++];
BytesRemain--;
}
+
//
// Once mOutBuf is fully filled, directly return
//
@@ -639,7 +631,7 @@ Decode (
}
Done:
- return ;
+ return;
}
/**
@@ -700,12 +692,12 @@ UefiDecompressGetInfo (
return RETURN_INVALID_PARAMETER;
}
- CompressedSize = ReadUnaligned32 ((UINT32 *)Source);
- if (SourceSize < (CompressedSize + 8) || (CompressedSize + 8) < 8) {
+ CompressedSize = ReadUnaligned32 ((UINT32 *)Source);
+ if ((SourceSize < (CompressedSize + 8)) || ((CompressedSize + 8) < 8)) {
return RETURN_INVALID_PARAMETER;
}
- *ScratchSize = sizeof (SCRATCH_DATA);
+ *ScratchSize = sizeof (SCRATCH_DATA);
*DestinationSize = ReadUnaligned32 ((UINT32 *)Source + 1);
return RETURN_SUCCESS;
@@ -750,24 +742,24 @@ UefiTianoDecompress (
IN UINT32 Version
)
{
- UINT32 CompSize;
- UINT32 OrigSize;
- SCRATCH_DATA *Sd;
- CONST UINT8 *Src;
- UINT8 *Dst;
+ UINT32 CompSize;
+ UINT32 OrigSize;
+ SCRATCH_DATA *Sd;
+ CONST UINT8 *Src;
+ UINT8 *Dst;
ASSERT (Source != NULL);
ASSERT (Destination != NULL);
ASSERT (Scratch != NULL);
ASSERT (Version == 1 || Version == 2);
- Src = Source;
- Dst = Destination;
+ Src = Source;
+ Dst = Destination;
- Sd = (SCRATCH_DATA *) Scratch;
+ Sd = (SCRATCH_DATA *)Scratch;
- CompSize = Src[0] + (Src[1] << 8) + (Src[2] << 16) + (Src[3] << 24);
- OrigSize = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24);
+ CompSize = Src[0] + (Src[1] << 8) + (Src[2] << 16) + (Src[3] << 24);
+ OrigSize = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24);
//
// If compressed file size is 0, return
@@ -785,17 +777,18 @@ UefiTianoDecompress (
// For Tiano de/compression algorithm(Version 2), mPBit = 5
//
switch (Version) {
- case 1 :
+ case 1:
Sd->mPBit = 4;
break;
- case 2 :
+ case 2:
Sd->mPBit = 5;
break;
default:
ASSERT (FALSE);
}
- Sd->mSrcBase = (UINT8 *)Src;
- Sd->mDstBase = Dst;
+
+ Sd->mSrcBase = (UINT8 *)Src;
+ Sd->mDstBase = Dst;
//
// CompSize and OrigSize are calculated in bytes
//
diff --git a/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLibInternals.h b/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLibInternals.h
index 4df3fa388d..cb08c2b14d 100644
--- a/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLibInternals.h
+++ b/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLibInternals.h
@@ -17,55 +17,55 @@
//
// Decompression algorithm begins here
//
-#define BITBUFSIZ 32
-#define MAXMATCH 256
-#define THRESHOLD 3
-#define CODE_BIT 16
-#define BAD_TABLE - 1
+#define BITBUFSIZ 32
+#define MAXMATCH 256
+#define THRESHOLD 3
+#define CODE_BIT 16
+#define BAD_TABLE - 1
//
// C: Char&Len Set; P: Position Set; T: exTra Set
//
-#define NC (0xff + MAXMATCH + 2 - THRESHOLD)
-#define CBIT 9
-#define MAXPBIT 5
-#define TBIT 5
-#define MAXNP ((1U << MAXPBIT) - 1)
-#define NT (CODE_BIT + 3)
+#define NC (0xff + MAXMATCH + 2 - THRESHOLD)
+#define CBIT 9
+#define MAXPBIT 5
+#define TBIT 5
+#define MAXNP ((1U << MAXPBIT) - 1)
+#define NT (CODE_BIT + 3)
#if NT > MAXNP
-#define NPT NT
+#define NPT NT
#else
-#define NPT MAXNP
+#define NPT MAXNP
#endif
typedef struct {
- UINT8 *mSrcBase; // The starting address of compressed data
- UINT8 *mDstBase; // The starting address of decompressed data
- UINT32 mOutBuf;
- UINT32 mInBuf;
-
- UINT16 mBitCount;
- UINT32 mBitBuf;
- UINT32 mSubBitBuf;
- UINT16 mBlockSize;
- UINT32 mCompSize;
- UINT32 mOrigSize;
-
- UINT16 mBadTableFlag;
-
- UINT16 mLeft[2 * NC - 1];
- UINT16 mRight[2 * NC - 1];
- UINT8 mCLen[NC];
- UINT8 mPTLen[NPT];
- UINT16 mCTable[4096];
- UINT16 mPTTable[256];
+ UINT8 *mSrcBase; // The starting address of compressed data
+ UINT8 *mDstBase; // The starting address of decompressed data
+ UINT32 mOutBuf;
+ UINT32 mInBuf;
+
+ UINT16 mBitCount;
+ UINT32 mBitBuf;
+ UINT32 mSubBitBuf;
+ UINT16 mBlockSize;
+ UINT32 mCompSize;
+ UINT32 mOrigSize;
+
+ UINT16 mBadTableFlag;
+
+ UINT16 mLeft[2 * NC - 1];
+ UINT16 mRight[2 * NC - 1];
+ UINT8 mCLen[NC];
+ UINT8 mPTLen[NPT];
+ UINT16 mCTable[4096];
+ UINT16 mPTTable[256];
///
/// The length of the field 'Position Set Code Length Array Size' in Block Header.
/// For UEFI 2.0 de/compression algorithm, mPBit = 4.
/// For Tiano de/compression algorithm, mPBit = 5.
///
- UINT8 mPBit;
+ UINT8 mPBit;
} SCRATCH_DATA;
/**
@@ -245,4 +245,5 @@ UefiTianoDecompress (
IN OUT VOID *Scratch,
IN UINT32 Version
);
+
#endif
diff --git a/MdePkg/Library/BaseUefiDecompressLib/BaseUefiTianoCustomDecompressLib.c b/MdePkg/Library/BaseUefiDecompressLib/BaseUefiTianoCustomDecompressLib.c
index 59e3b08456..503e3cac60 100644
--- a/MdePkg/Library/BaseUefiDecompressLib/BaseUefiTianoCustomDecompressLib.c
+++ b/MdePkg/Library/BaseUefiDecompressLib/BaseUefiTianoCustomDecompressLib.c
@@ -62,41 +62,47 @@ TianoDecompressGetInfo (
if (IS_SECTION2 (InputSection)) {
if (!CompareGuid (
- &gTianoCustomDecompressGuid,
- &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid))) {
+ &gTianoCustomDecompressGuid,
+ &(((EFI_GUID_DEFINED_SECTION2 *)InputSection)->SectionDefinitionGuid)
+ ))
+ {
return RETURN_INVALID_PARAMETER;
}
+
//
// Get guid attribute of guid section.
//
- *SectionAttribute = ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->Attributes;
+ *SectionAttribute = ((EFI_GUID_DEFINED_SECTION2 *)InputSection)->Attributes;
//
// Call Tiano GetInfo to get the required size info.
//
return UefiDecompressGetInfo (
- (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->DataOffset,
- SECTION2_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->DataOffset,
+ (UINT8 *)InputSection + ((EFI_GUID_DEFINED_SECTION2 *)InputSection)->DataOffset,
+ SECTION2_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION2 *)InputSection)->DataOffset,
OutputBufferSize,
ScratchBufferSize
);
} else {
if (!CompareGuid (
- &gTianoCustomDecompressGuid,
- &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {
+ &gTianoCustomDecompressGuid,
+ &(((EFI_GUID_DEFINED_SECTION *)InputSection)->SectionDefinitionGuid)
+ ))
+ {
return RETURN_INVALID_PARAMETER;
}
+
//
// Get guid attribute of guid section.
//
- *SectionAttribute = ((EFI_GUID_DEFINED_SECTION *) InputSection)->Attributes;
+ *SectionAttribute = ((EFI_GUID_DEFINED_SECTION *)InputSection)->Attributes;
//
// Call Tiano GetInfo to get the required size info.
//
return UefiDecompressGetInfo (
- (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,
- SECTION_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,
+ (UINT8 *)InputSection + ((EFI_GUID_DEFINED_SECTION *)InputSection)->DataOffset,
+ SECTION_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION *)InputSection)->DataOffset,
OutputBufferSize,
ScratchBufferSize
);
@@ -150,8 +156,10 @@ TianoDecompress (
if (IS_SECTION2 (InputSection)) {
if (!CompareGuid (
- &gTianoCustomDecompressGuid,
- &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid))) {
+ &gTianoCustomDecompressGuid,
+ &(((EFI_GUID_DEFINED_SECTION2 *)InputSection)->SectionDefinitionGuid)
+ ))
+ {
return RETURN_INVALID_PARAMETER;
}
@@ -164,15 +172,17 @@ TianoDecompress (
// Call Tiano Decompress to get the raw data
//
return UefiTianoDecompress (
- (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->DataOffset,
+ (UINT8 *)InputSection + ((EFI_GUID_DEFINED_SECTION2 *)InputSection)->DataOffset,
*OutputBuffer,
ScratchBuffer,
2
- );
+ );
} else {
if (!CompareGuid (
- &gTianoCustomDecompressGuid,
- &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {
+ &gTianoCustomDecompressGuid,
+ &(((EFI_GUID_DEFINED_SECTION *)InputSection)->SectionDefinitionGuid)
+ ))
+ {
return RETURN_INVALID_PARAMETER;
}
@@ -185,11 +195,11 @@ TianoDecompress (
// Call Tiano Decompress to get the raw data
//
return UefiTianoDecompress (
- (UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,
+ (UINT8 *)InputSection + ((EFI_GUID_DEFINED_SECTION *)InputSection)->DataOffset,
*OutputBuffer,
ScratchBuffer,
2
- );
+ );
}
}
@@ -203,11 +213,11 @@ RETURN_STATUS
EFIAPI
TianoDecompressLibConstructor (
VOID
-)
+ )
{
return ExtractGuidedSectionRegisterHandlers (
- &gTianoCustomDecompressGuid,
- TianoDecompressGetInfo,
- TianoDecompress
- );
+ &gTianoCustomDecompressGuid,
+ TianoDecompressGetInfo,
+ TianoDecompress
+ );
}
diff --git a/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.c b/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.c
index 3dda3520ae..3ac7cfb931 100644
--- a/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.c
+++ b/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.c
@@ -6,10 +6,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-
#include <PiDxe.h>
-
#include <Library/DxeCoreEntryPoint.h>
#include <Library/DebugLib.h>
#include <Library/BaseLib.h>
@@ -17,7 +15,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// Cache copy of HobList pointer.
//
-VOID *gHobList = NULL;
+VOID *gHobList = NULL;
/**
The entry point of PE/COFF Image for the DXE Core.
@@ -50,11 +48,10 @@ _ModuleEntryPoint (
//
// Should never return
//
- ASSERT(FALSE);
+ ASSERT (FALSE);
CpuDeadLoop ();
}
-
/**
Required by the EBC compiler and identical in functionality to _ModuleEntryPoint().
diff --git a/MdePkg/Library/DxeCoreHobLib/HobLib.c b/MdePkg/Library/DxeCoreHobLib/HobLib.c
index f07131311d..ff319475fa 100644
--- a/MdePkg/Library/DxeCoreHobLib/HobLib.c
+++ b/MdePkg/Library/DxeCoreHobLib/HobLib.c
@@ -59,15 +59,15 @@ GetHobList (
VOID *
EFIAPI
GetNextHob (
- IN UINT16 Type,
- IN CONST VOID *HobStart
+ IN UINT16 Type,
+ IN CONST VOID *HobStart
)
{
EFI_PEI_HOB_POINTERS Hob;
ASSERT (HobStart != NULL);
- Hob.Raw = (UINT8 *) HobStart;
+ Hob.Raw = (UINT8 *)HobStart;
//
// Parse the HOB list until end of list or matching type is found.
//
@@ -75,8 +75,10 @@ GetNextHob (
if (Hob.Header->HobType == Type) {
return Hob.Raw;
}
+
Hob.Raw = GET_NEXT_HOB (Hob);
}
+
return NULL;
}
@@ -96,10 +98,10 @@ GetNextHob (
VOID *
EFIAPI
GetFirstHob (
- IN UINT16 Type
+ IN UINT16 Type
)
{
- VOID *HobList;
+ VOID *HobList;
HobList = GetHobList ();
return GetNextHob (Type, HobList);
@@ -130,19 +132,21 @@ GetFirstHob (
VOID *
EFIAPI
GetNextGuidHob (
- IN CONST EFI_GUID *Guid,
- IN CONST VOID *HobStart
+ IN CONST EFI_GUID *Guid,
+ IN CONST VOID *HobStart
)
{
EFI_PEI_HOB_POINTERS GuidHob;
- GuidHob.Raw = (UINT8 *) HobStart;
+ GuidHob.Raw = (UINT8 *)HobStart;
while ((GuidHob.Raw = GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, GuidHob.Raw)) != NULL) {
if (CompareGuid (Guid, &GuidHob.Guid->Name)) {
break;
}
+
GuidHob.Raw = GET_NEXT_HOB (GuidHob);
}
+
return GuidHob.Raw;
}
@@ -167,10 +171,10 @@ GetNextGuidHob (
VOID *
EFIAPI
GetFirstGuidHob (
- IN CONST EFI_GUID *Guid
+ IN CONST EFI_GUID *Guid
)
{
- VOID *HobList;
+ VOID *HobList;
HobList = GetHobList ();
return GetNextGuidHob (Guid, HobList);
@@ -195,11 +199,11 @@ GetBootModeHob (
VOID
)
{
- EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;
+ EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;
- HandOffHob = (EFI_HOB_HANDOFF_INFO_TABLE *) GetHobList ();
+ HandOffHob = (EFI_HOB_HANDOFF_INFO_TABLE *)GetHobList ();
- return HandOffHob->BootMode;
+ return HandOffHob->BootMode;
}
/**
@@ -221,10 +225,10 @@ GetBootModeHob (
VOID
EFIAPI
BuildModuleHob (
- IN CONST EFI_GUID *ModuleName,
- IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule,
- IN UINT64 ModuleLength,
- IN EFI_PHYSICAL_ADDRESS EntryPoint
+ IN CONST EFI_GUID *ModuleName,
+ IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule,
+ IN UINT64 ModuleLength,
+ IN EFI_PHYSICAL_ADDRESS EntryPoint
)
{
//
@@ -320,8 +324,8 @@ BuildResourceDescriptorHob (
VOID *
EFIAPI
BuildGuidHob (
- IN CONST EFI_GUID *Guid,
- IN UINTN DataLength
+ IN CONST EFI_GUID *Guid,
+ IN UINTN DataLength
)
{
//
@@ -359,9 +363,9 @@ BuildGuidHob (
VOID *
EFIAPI
BuildGuidDataHob (
- IN CONST EFI_GUID *Guid,
- IN VOID *Data,
- IN UINTN DataLength
+ IN CONST EFI_GUID *Guid,
+ IN VOID *Data,
+ IN UINTN DataLength
)
{
//
@@ -388,8 +392,8 @@ BuildGuidDataHob (
VOID
EFIAPI
BuildFvHob (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length
)
{
//
@@ -417,10 +421,10 @@ BuildFvHob (
VOID
EFIAPI
BuildFv2Hob (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN CONST EFI_GUID *FvName,
- IN CONST EFI_GUID *FileName
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length,
+ IN CONST EFI_GUID *FvName,
+ IN CONST EFI_GUID *FileName
)
{
ASSERT (FALSE);
@@ -450,12 +454,12 @@ BuildFv2Hob (
VOID
EFIAPI
BuildFv3Hob (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN UINT32 AuthenticationStatus,
- IN BOOLEAN ExtractedFv,
- IN CONST EFI_GUID *FvName OPTIONAL,
- IN CONST EFI_GUID *FileName OPTIONAL
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length,
+ IN UINT32 AuthenticationStatus,
+ IN BOOLEAN ExtractedFv,
+ IN CONST EFI_GUID *FvName OPTIONAL,
+ IN CONST EFI_GUID *FileName OPTIONAL
)
{
ASSERT (FALSE);
@@ -478,8 +482,8 @@ BuildFv3Hob (
VOID
EFIAPI
BuildCvHob (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length
)
{
//
@@ -504,8 +508,8 @@ BuildCvHob (
VOID
EFIAPI
BuildCpuHob (
- IN UINT8 SizeOfMemorySpace,
- IN UINT8 SizeOfIoSpace
+ IN UINT8 SizeOfMemorySpace,
+ IN UINT8 SizeOfIoSpace
)
{
//
@@ -530,8 +534,8 @@ BuildCpuHob (
VOID
EFIAPI
BuildStackHob (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length
)
{
//
@@ -557,9 +561,9 @@ BuildStackHob (
VOID
EFIAPI
BuildBspStoreHob (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN EFI_MEMORY_TYPE MemoryType
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length,
+ IN EFI_MEMORY_TYPE MemoryType
)
{
//
@@ -585,9 +589,9 @@ BuildBspStoreHob (
VOID
EFIAPI
BuildMemoryAllocationHob (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN EFI_MEMORY_TYPE MemoryType
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length,
+ IN EFI_MEMORY_TYPE MemoryType
)
{
//
diff --git a/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c b/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c
index 995ef1dd7e..2634d2f44f 100644
--- a/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c
+++ b/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c
@@ -14,14 +14,14 @@
#include <Library/ExtractGuidedSectionLib.h>
#include <Library/UefiBootServicesTableLib.h>
-#define EXTRACT_HANDLER_TABLE_SIZE 0x10
+#define EXTRACT_HANDLER_TABLE_SIZE 0x10
-UINT32 mNumberOfExtractHandler = 0;
-UINT32 mMaxNumberOfExtractHandler = 0;
+UINT32 mNumberOfExtractHandler = 0;
+UINT32 mMaxNumberOfExtractHandler = 0;
-GUID *mExtractHandlerGuidTable = NULL;
-EXTRACT_GUIDED_SECTION_DECODE_HANDLER *mExtractDecodeHandlerTable = NULL;
-EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *mExtractGetInfoHandlerTable = NULL;
+GUID *mExtractHandlerGuidTable = NULL;
+EXTRACT_GUIDED_SECTION_DECODE_HANDLER *mExtractDecodeHandlerTable = NULL;
+EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *mExtractGetInfoHandlerTable = NULL;
/**
Reallocates more global memory to store the registered guid and Handler list.
@@ -42,7 +42,7 @@ ReallocateExtractHandlerTable (
mMaxNumberOfExtractHandler * sizeof (GUID),
(mMaxNumberOfExtractHandler + EXTRACT_HANDLER_TABLE_SIZE) * sizeof (GUID),
mExtractHandlerGuidTable
- );
+ );
if (mExtractHandlerGuidTable == NULL) {
goto Done;
@@ -52,10 +52,10 @@ ReallocateExtractHandlerTable (
// Reallocate memory for Decode handler Table
//
mExtractDecodeHandlerTable = ReallocatePool (
- mMaxNumberOfExtractHandler * sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER),
- (mMaxNumberOfExtractHandler + EXTRACT_HANDLER_TABLE_SIZE) * sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER),
- mExtractDecodeHandlerTable
- );
+ mMaxNumberOfExtractHandler * sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER),
+ (mMaxNumberOfExtractHandler + EXTRACT_HANDLER_TABLE_SIZE) * sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER),
+ mExtractDecodeHandlerTable
+ );
if (mExtractDecodeHandlerTable == NULL) {
goto Done;
@@ -65,10 +65,10 @@ ReallocateExtractHandlerTable (
// Reallocate memory for GetInfo handler Table
//
mExtractGetInfoHandlerTable = ReallocatePool (
- mMaxNumberOfExtractHandler * sizeof (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER),
- (mMaxNumberOfExtractHandler + EXTRACT_HANDLER_TABLE_SIZE) * sizeof (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER),
- mExtractGetInfoHandlerTable
- );
+ mMaxNumberOfExtractHandler * sizeof (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER),
+ (mMaxNumberOfExtractHandler + EXTRACT_HANDLER_TABLE_SIZE) * sizeof (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER),
+ mExtractGetInfoHandlerTable
+ );
if (mExtractGetInfoHandlerTable == NULL) {
goto Done;
@@ -84,15 +84,18 @@ Done:
if (mExtractHandlerGuidTable != NULL) {
FreePool (mExtractHandlerGuidTable);
}
+
if (mExtractDecodeHandlerTable != NULL) {
FreePool (mExtractDecodeHandlerTable);
}
+
if (mExtractGetInfoHandlerTable != NULL) {
FreePool (mExtractGetInfoHandlerTable);
}
return RETURN_OUT_OF_RESOURCES;
}
+
/**
Constructor allocates the global memory to store the registered guid and Handler list.
@@ -170,8 +173,8 @@ ExtractGuidedSectionRegisterHandlers (
IN EXTRACT_GUIDED_SECTION_DECODE_HANDLER DecodeHandler
)
{
- UINT32 Index;
- VOID *GuidData;
+ UINT32 Index;
+ VOID *GuidData;
//
// Check input parameter.
@@ -183,13 +186,13 @@ ExtractGuidedSectionRegisterHandlers (
//
// Search the match registered GetInfo handler for the input guided section.
//
- for (Index = 0; Index < mNumberOfExtractHandler; Index ++) {
+ for (Index = 0; Index < mNumberOfExtractHandler; Index++) {
if (CompareGuid (&mExtractHandlerGuidTable[Index], SectionGuid)) {
//
// If the guided handler has been registered before, only update its handler.
//
- mExtractDecodeHandlerTable [Index] = DecodeHandler;
- mExtractGetInfoHandlerTable [Index] = GetInfoHandler;
+ mExtractDecodeHandlerTable[Index] = DecodeHandler;
+ mExtractGetInfoHandlerTable[Index] = GetInfoHandler;
return RETURN_SUCCESS;
}
}
@@ -206,17 +209,17 @@ ExtractGuidedSectionRegisterHandlers (
//
// Register new Handler and guid value.
//
- CopyGuid (&mExtractHandlerGuidTable [mNumberOfExtractHandler], SectionGuid);
- mExtractDecodeHandlerTable [mNumberOfExtractHandler] = DecodeHandler;
- mExtractGetInfoHandlerTable [mNumberOfExtractHandler++] = GetInfoHandler;
+ CopyGuid (&mExtractHandlerGuidTable[mNumberOfExtractHandler], SectionGuid);
+ mExtractDecodeHandlerTable[mNumberOfExtractHandler] = DecodeHandler;
+ mExtractGetInfoHandlerTable[mNumberOfExtractHandler++] = GetInfoHandler;
//
// Install the Guided Section GUID configuration table to record the GUID itself.
// Then the content of the configuration table buffer will be the same as the GUID value itself.
//
- GuidData = AllocateCopyPool (sizeof (GUID), (VOID *) SectionGuid);
+ GuidData = AllocateCopyPool (sizeof (GUID), (VOID *)SectionGuid);
if (GuidData != NULL) {
- gBS->InstallConfigurationTable ((EFI_GUID *) SectionGuid, GuidData);
+ gBS->InstallConfigurationTable ((EFI_GUID *)SectionGuid, GuidData);
}
return RETURN_SUCCESS;
@@ -265,8 +268,8 @@ ExtractGuidedSectionGetInfo (
OUT UINT16 *SectionAttribute
)
{
- UINT32 Index;
- EFI_GUID *SectionDefinitionGuid;
+ UINT32 Index;
+ EFI_GUID *SectionDefinitionGuid;
ASSERT (InputSection != NULL);
ASSERT (OutputBufferSize != NULL);
@@ -274,25 +277,25 @@ ExtractGuidedSectionGetInfo (
ASSERT (SectionAttribute != NULL);
if (IS_SECTION2 (InputSection)) {
- SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *)InputSection)->SectionDefinitionGuid);
} else {
- SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *)InputSection)->SectionDefinitionGuid);
}
//
// Search the match registered GetInfo handler for the input guided section.
//
- for (Index = 0; Index < mNumberOfExtractHandler; Index ++) {
+ for (Index = 0; Index < mNumberOfExtractHandler; Index++) {
if (CompareGuid (&mExtractHandlerGuidTable[Index], SectionDefinitionGuid)) {
//
// Call the match handler to getinfo for the input section data.
//
- return mExtractGetInfoHandlerTable [Index] (
- InputSection,
- OutputBufferSize,
- ScratchBufferSize,
- SectionAttribute
- );
+ return mExtractGetInfoHandlerTable[Index](
+ InputSection,
+ OutputBufferSize,
+ ScratchBufferSize,
+ SectionAttribute
+ );
}
}
@@ -346,8 +349,8 @@ ExtractGuidedSectionDecode (
OUT UINT32 *AuthenticationStatus
)
{
- UINT32 Index;
- EFI_GUID *SectionDefinitionGuid;
+ UINT32 Index;
+ EFI_GUID *SectionDefinitionGuid;
//
// Check the input parameters
@@ -357,25 +360,25 @@ ExtractGuidedSectionDecode (
ASSERT (AuthenticationStatus != NULL);
if (IS_SECTION2 (InputSection)) {
- SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *)InputSection)->SectionDefinitionGuid);
} else {
- SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *)InputSection)->SectionDefinitionGuid);
}
//
// Search the match registered extract handler for the input guided section.
//
- for (Index = 0; Index < mNumberOfExtractHandler; Index ++) {
+ for (Index = 0; Index < mNumberOfExtractHandler; Index++) {
if (CompareGuid (&mExtractHandlerGuidTable[Index], SectionDefinitionGuid)) {
//
// Call the match handler to extract raw data for the input section data.
//
- return mExtractDecodeHandlerTable [Index] (
- InputSection,
- OutputBuffer,
- ScratchBuffer,
- AuthenticationStatus
- );
+ return mExtractDecodeHandlerTable[Index](
+ InputSection,
+ OutputBuffer,
+ ScratchBuffer,
+ AuthenticationStatus
+ );
}
}
@@ -420,7 +423,7 @@ ExtractGuidedSectionGetHandlers (
OUT EXTRACT_GUIDED_SECTION_DECODE_HANDLER *DecodeHandler OPTIONAL
)
{
- UINT32 Index;
+ UINT32 Index;
//
// Check input parameter.
@@ -430,20 +433,22 @@ ExtractGuidedSectionGetHandlers (
//
// Search the match registered GetInfo handler for the input guided section.
//
- for (Index = 0; Index < mNumberOfExtractHandler; Index ++) {
+ for (Index = 0; Index < mNumberOfExtractHandler; Index++) {
if (CompareGuid (&mExtractHandlerGuidTable[Index], SectionGuid)) {
-
//
// If the guided handler has been registered before, then return the registered handlers.
//
if (GetInfoHandler != NULL) {
*GetInfoHandler = mExtractGetInfoHandlerTable[Index];
}
+
if (DecodeHandler != NULL) {
*DecodeHandler = mExtractDecodeHandlerTable[Index];
}
+
return RETURN_SUCCESS;
}
}
+
return RETURN_NOT_FOUND;
}
diff --git a/MdePkg/Library/DxeHobLib/HobLib.c b/MdePkg/Library/DxeHobLib/HobLib.c
index 2039e5d13f..ed38674466 100644
--- a/MdePkg/Library/DxeHobLib/HobLib.c
+++ b/MdePkg/Library/DxeHobLib/HobLib.c
@@ -48,6 +48,7 @@ GetHobList (
ASSERT_EFI_ERROR (Status);
ASSERT (mHobList != NULL);
}
+
return mHobList;
}
@@ -93,15 +94,15 @@ HobLibConstructor (
VOID *
EFIAPI
GetNextHob (
- IN UINT16 Type,
- IN CONST VOID *HobStart
+ IN UINT16 Type,
+ IN CONST VOID *HobStart
)
{
EFI_PEI_HOB_POINTERS Hob;
ASSERT (HobStart != NULL);
- Hob.Raw = (UINT8 *) HobStart;
+ Hob.Raw = (UINT8 *)HobStart;
//
// Parse the HOB list until end of list or matching type is found.
//
@@ -109,8 +110,10 @@ GetNextHob (
if (Hob.Header->HobType == Type) {
return Hob.Raw;
}
+
Hob.Raw = GET_NEXT_HOB (Hob);
}
+
return NULL;
}
@@ -130,10 +133,10 @@ GetNextHob (
VOID *
EFIAPI
GetFirstHob (
- IN UINT16 Type
+ IN UINT16 Type
)
{
- VOID *HobList;
+ VOID *HobList;
HobList = GetHobList ();
return GetNextHob (Type, HobList);
@@ -164,19 +167,21 @@ GetFirstHob (
VOID *
EFIAPI
GetNextGuidHob (
- IN CONST EFI_GUID *Guid,
- IN CONST VOID *HobStart
+ IN CONST EFI_GUID *Guid,
+ IN CONST VOID *HobStart
)
{
EFI_PEI_HOB_POINTERS GuidHob;
- GuidHob.Raw = (UINT8 *) HobStart;
+ GuidHob.Raw = (UINT8 *)HobStart;
while ((GuidHob.Raw = GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, GuidHob.Raw)) != NULL) {
if (CompareGuid (Guid, &GuidHob.Guid->Name)) {
break;
}
+
GuidHob.Raw = GET_NEXT_HOB (GuidHob);
}
+
return GuidHob.Raw;
}
@@ -201,10 +206,10 @@ GetNextGuidHob (
VOID *
EFIAPI
GetFirstGuidHob (
- IN CONST EFI_GUID *Guid
+ IN CONST EFI_GUID *Guid
)
{
- VOID *HobList;
+ VOID *HobList;
HobList = GetHobList ();
return GetNextGuidHob (Guid, HobList);
@@ -229,11 +234,11 @@ GetBootModeHob (
VOID
)
{
- EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;
+ EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;
- HandOffHob = (EFI_HOB_HANDOFF_INFO_TABLE *) GetHobList ();
+ HandOffHob = (EFI_HOB_HANDOFF_INFO_TABLE *)GetHobList ();
- return HandOffHob->BootMode;
+ return HandOffHob->BootMode;
}
/**
@@ -255,10 +260,10 @@ GetBootModeHob (
VOID
EFIAPI
BuildModuleHob (
- IN CONST EFI_GUID *ModuleName,
- IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule,
- IN UINT64 ModuleLength,
- IN EFI_PHYSICAL_ADDRESS EntryPoint
+ IN CONST EFI_GUID *ModuleName,
+ IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule,
+ IN UINT64 ModuleLength,
+ IN EFI_PHYSICAL_ADDRESS EntryPoint
)
{
//
@@ -354,8 +359,8 @@ BuildResourceDescriptorHob (
VOID *
EFIAPI
BuildGuidHob (
- IN CONST EFI_GUID *Guid,
- IN UINTN DataLength
+ IN CONST EFI_GUID *Guid,
+ IN UINTN DataLength
)
{
//
@@ -393,9 +398,9 @@ BuildGuidHob (
VOID *
EFIAPI
BuildGuidDataHob (
- IN CONST EFI_GUID *Guid,
- IN VOID *Data,
- IN UINTN DataLength
+ IN CONST EFI_GUID *Guid,
+ IN VOID *Data,
+ IN UINTN DataLength
)
{
//
@@ -422,8 +427,8 @@ BuildGuidDataHob (
VOID
EFIAPI
BuildFvHob (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length
)
{
//
@@ -451,10 +456,10 @@ BuildFvHob (
VOID
EFIAPI
BuildFv2Hob (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN CONST EFI_GUID *FvName,
- IN CONST EFI_GUID *FileName
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length,
+ IN CONST EFI_GUID *FvName,
+ IN CONST EFI_GUID *FileName
)
{
ASSERT (FALSE);
@@ -484,12 +489,12 @@ BuildFv2Hob (
VOID
EFIAPI
BuildFv3Hob (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN UINT32 AuthenticationStatus,
- IN BOOLEAN ExtractedFv,
- IN CONST EFI_GUID *FvName OPTIONAL,
- IN CONST EFI_GUID *FileName OPTIONAL
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length,
+ IN UINT32 AuthenticationStatus,
+ IN BOOLEAN ExtractedFv,
+ IN CONST EFI_GUID *FvName OPTIONAL,
+ IN CONST EFI_GUID *FileName OPTIONAL
)
{
ASSERT (FALSE);
@@ -512,8 +517,8 @@ BuildFv3Hob (
VOID
EFIAPI
BuildCvHob (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length
)
{
//
@@ -538,8 +543,8 @@ BuildCvHob (
VOID
EFIAPI
BuildCpuHob (
- IN UINT8 SizeOfMemorySpace,
- IN UINT8 SizeOfIoSpace
+ IN UINT8 SizeOfMemorySpace,
+ IN UINT8 SizeOfIoSpace
)
{
//
@@ -564,8 +569,8 @@ BuildCpuHob (
VOID
EFIAPI
BuildStackHob (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length
)
{
//
@@ -591,9 +596,9 @@ BuildStackHob (
VOID
EFIAPI
BuildBspStoreHob (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN EFI_MEMORY_TYPE MemoryType
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length,
+ IN EFI_MEMORY_TYPE MemoryType
)
{
//
@@ -619,9 +624,9 @@ BuildBspStoreHob (
VOID
EFIAPI
BuildMemoryAllocationHob (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN EFI_MEMORY_TYPE MemoryType
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length,
+ IN EFI_MEMORY_TYPE MemoryType
)
{
//
diff --git a/MdePkg/Library/DxeHstiLib/HstiAip.c b/MdePkg/Library/DxeHstiLib/HstiAip.c
index 1a3dfc148d..a2454ffeaa 100644
--- a/MdePkg/Library/DxeHstiLib/HstiAip.c
+++ b/MdePkg/Library/DxeHstiLib/HstiAip.c
@@ -43,16 +43,18 @@ HstiAipGetInfo (
if ((This == NULL) || (InformationBlock == NULL) || (InformationBlockSize == NULL)) {
return EFI_INVALID_PARAMETER;
}
+
if (!CompareGuid (InformationType, &gAdapterInfoPlatformSecurityGuid)) {
return EFI_UNSUPPORTED;
}
- HstiAip = HSTI_AIP_PRIVATE_DATA_FROM_THIS(This);
+ HstiAip = HSTI_AIP_PRIVATE_DATA_FROM_THIS (This);
*InformationBlock = AllocateCopyPool (HstiAip->HstiSize, HstiAip->Hsti);
if (*InformationBlock == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
*InformationBlockSize = HstiAip->HstiSize;
return EFI_SUCCESS;
}
@@ -93,6 +95,7 @@ HstiAipSetInfo (
if ((This == NULL) || (InformationBlock == NULL)) {
return EFI_INVALID_PARAMETER;
}
+
if (!CompareGuid (InformationType, &gAdapterInfoPlatformSecurityGuid)) {
return EFI_UNSUPPORTED;
}
@@ -101,16 +104,17 @@ HstiAipSetInfo (
return EFI_VOLUME_CORRUPTED;
}
- HstiAip = HSTI_AIP_PRIVATE_DATA_FROM_THIS(This);
+ HstiAip = HSTI_AIP_PRIVATE_DATA_FROM_THIS (This);
if (InformationBlockSize > HstiAip->HstiMaxSize) {
NewHsti = AllocateZeroPool (InformationBlockSize);
if (NewHsti == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
FreePool (HstiAip->Hsti);
- HstiAip->Hsti = NewHsti;
- HstiAip->HstiSize = 0;
+ HstiAip->Hsti = NewHsti;
+ HstiAip->HstiSize = 0;
HstiAip->HstiMaxSize = InformationBlockSize;
}
@@ -153,16 +157,17 @@ HstiAipGetSupportedTypes (
return EFI_INVALID_PARAMETER;
}
- *InfoTypesBuffer = AllocateCopyPool (sizeof(gAdapterInfoPlatformSecurityGuid), &gAdapterInfoPlatformSecurityGuid);
+ *InfoTypesBuffer = AllocateCopyPool (sizeof (gAdapterInfoPlatformSecurityGuid), &gAdapterInfoPlatformSecurityGuid);
if (*InfoTypesBuffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
*InfoTypesBufferCount = 1;
return EFI_SUCCESS;
}
-EFI_ADAPTER_INFORMATION_PROTOCOL mAdapterInformationProtocol = {
+EFI_ADAPTER_INFORMATION_PROTOCOL mAdapterInformationProtocol = {
HstiAipGetInfo,
HstiAipSetInfo,
HstiAipGetSupportedTypes,
diff --git a/MdePkg/Library/DxeHstiLib/HstiDxe.c b/MdePkg/Library/DxeHstiLib/HstiDxe.c
index 3f4d8eb79c..d895599cd4 100644
--- a/MdePkg/Library/DxeHstiLib/HstiDxe.c
+++ b/MdePkg/Library/DxeHstiLib/HstiDxe.c
@@ -25,10 +25,10 @@
**/
VOID *
InternalHstiFindAip (
- IN UINT32 Role,
- IN CHAR16 *ImplementationID OPTIONAL,
- OUT VOID **HstiData OPTIONAL,
- OUT UINTN *HstiSize OPTIONAL
+ IN UINT32 Role,
+ IN CHAR16 *ImplementationID OPTIONAL,
+ OUT VOID **HstiData OPTIONAL,
+ OUT UINTN *HstiSize OPTIONAL
)
{
EFI_STATUS Status;
@@ -55,9 +55,9 @@ InternalHstiFindAip (
return NULL;
}
- Hsti = NULL;
- Aip = NULL;
- InformationBlock = NULL;
+ Hsti = NULL;
+ Aip = NULL;
+ InformationBlock = NULL;
InformationBlockSize = 0;
for (Index = 0; Index < NoHandles; Index++) {
Status = gBS->HandleProtocol (
@@ -88,6 +88,7 @@ InternalHstiFindAip (
break;
}
}
+
FreePool (InfoTypesBuffer);
if (AipCandidate == NULL) {
@@ -97,7 +98,7 @@ InternalHstiFindAip (
//
// Check HSTI Role
//
- Aip = AipCandidate;
+ Aip = AipCandidate;
Status = Aip->GetInformation (
Aip,
&gAdapterInfoPlatformSecurityGuid,
@@ -110,7 +111,8 @@ InternalHstiFindAip (
Hsti = InformationBlock;
if ((Hsti->Role == Role) &&
- ((ImplementationID == NULL) || (StrCmp (ImplementationID, Hsti->ImplementationID) == 0))) {
+ ((ImplementationID == NULL) || (StrCmp (ImplementationID, Hsti->ImplementationID) == 0)))
+ {
break;
} else {
Hsti = NULL;
@@ -118,6 +120,7 @@ InternalHstiFindAip (
continue;
}
}
+
FreePool (Handles);
if (Hsti == NULL) {
@@ -127,9 +130,11 @@ InternalHstiFindAip (
if (HstiData != NULL) {
*HstiData = InformationBlock;
}
+
if (HstiSize != NULL) {
*HstiSize = InformationBlockSize;
}
+
return Aip;
}
@@ -144,8 +149,8 @@ InternalHstiFindAip (
**/
BOOLEAN
InternalHstiIsValidTable (
- IN VOID *HstiData,
- IN UINTN HstiSize
+ IN VOID *HstiData,
+ IN UINTN HstiSize
)
{
ADAPTER_INFO_PLATFORM_SECURITY *Hsti;
@@ -164,11 +169,13 @@ InternalHstiIsValidTable (
DEBUG ((DEBUG_ERROR, "HstiData == NULL\n"));
return FALSE;
}
- if (HstiSize < sizeof(ADAPTER_INFO_PLATFORM_SECURITY)) {
+
+ if (HstiSize < sizeof (ADAPTER_INFO_PLATFORM_SECURITY)) {
DEBUG ((DEBUG_ERROR, "HstiSize < sizeof(ADAPTER_INFO_PLATFORM_SECURITY)\n"));
return FALSE;
}
- if (((HstiSize - sizeof(ADAPTER_INFO_PLATFORM_SECURITY)) / 3) < Hsti->SecurityFeaturesSize) {
+
+ if (((HstiSize - sizeof (ADAPTER_INFO_PLATFORM_SECURITY)) / 3) < Hsti->SecurityFeaturesSize) {
DEBUG ((DEBUG_ERROR, "((HstiSize - sizeof(ADAPTER_INFO_PLATFORM_SECURITY)) / 3) < SecurityFeaturesSize\n"));
return FALSE;
}
@@ -185,7 +192,8 @@ InternalHstiIsValidTable (
// Check Role
//
if ((Hsti->Role < PLATFORM_SECURITY_ROLE_PLATFORM_REFERENCE) ||
- (Hsti->Role > PLATFORM_SECURITY_ROLE_IMPLEMENTOR_ODM)) {
+ (Hsti->Role > PLATFORM_SECURITY_ROLE_IMPLEMENTOR_ODM))
+ {
DEBUG ((DEBUG_ERROR, "Role < PLATFORM_SECURITY_ROLE_PLATFORM_REFERENCE ||\n"));
DEBUG ((DEBUG_ERROR, "Role > PLATFORM_SECURITY_ROLE_IMPLEMENTOR_ODM\n"));
return FALSE;
@@ -194,18 +202,19 @@ InternalHstiIsValidTable (
//
// Check ImplementationID
//
- for (Index = 0; Index < sizeof(Hsti->ImplementationID)/sizeof(Hsti->ImplementationID[0]); Index++) {
+ for (Index = 0; Index < sizeof (Hsti->ImplementationID)/sizeof (Hsti->ImplementationID[0]); Index++) {
if (Hsti->ImplementationID[Index] == 0) {
break;
}
}
- if (Index == sizeof(Hsti->ImplementationID)/sizeof(Hsti->ImplementationID[0])) {
+
+ if (Index == sizeof (Hsti->ImplementationID)/sizeof (Hsti->ImplementationID[0])) {
DEBUG ((DEBUG_ERROR, "ImplementationID has no NUL CHAR\n"));
return FALSE;
}
- ErrorStringSize = HstiSize - sizeof(ADAPTER_INFO_PLATFORM_SECURITY) - Hsti->SecurityFeaturesSize * 3;
- ErrorString = (CHAR16 *)((UINTN)Hsti + sizeof(ADAPTER_INFO_PLATFORM_SECURITY) + Hsti->SecurityFeaturesSize * 3);
+ ErrorStringSize = HstiSize - sizeof (ADAPTER_INFO_PLATFORM_SECURITY) - Hsti->SecurityFeaturesSize * 3;
+ ErrorString = (CHAR16 *)((UINTN)Hsti + sizeof (ADAPTER_INFO_PLATFORM_SECURITY) + Hsti->SecurityFeaturesSize * 3);
//
// basic check for ErrorString
@@ -214,6 +223,7 @@ InternalHstiIsValidTable (
DEBUG ((DEBUG_ERROR, "ErrorStringSize == 0\n"));
return FALSE;
}
+
if ((ErrorStringSize & BIT0) != 0) {
DEBUG ((DEBUG_ERROR, "(ErrorStringSize & BIT0) != 0\n"));
return FALSE;
@@ -222,10 +232,10 @@ InternalHstiIsValidTable (
//
// ErrorString might not be CHAR16 aligned.
//
- CopyMem (&ErrorChar, ErrorString, sizeof(ErrorChar));
+ CopyMem (&ErrorChar, ErrorString, sizeof (ErrorChar));
for (ErrorStringLength = 0; (ErrorChar != 0) && (ErrorStringLength < (ErrorStringSize/2)); ErrorStringLength++) {
ErrorString++;
- CopyMem (&ErrorChar, ErrorString, sizeof(ErrorChar));
+ CopyMem (&ErrorChar, ErrorString, sizeof (ErrorChar));
}
//
@@ -235,6 +245,7 @@ InternalHstiIsValidTable (
DEBUG ((DEBUG_ERROR, "ErrorString has no NUL CHAR\n"));
return FALSE;
}
+
if (ErrorStringLength == (ErrorStringSize/2)) {
DEBUG ((DEBUG_ERROR, "ErrorString Length incorrect\n"));
return FALSE;
@@ -262,48 +273,50 @@ InternalHstiIsValidTable (
EFI_STATUS
EFIAPI
HstiLibSetTable (
- IN VOID *Hsti,
- IN UINTN HstiSize
+ IN VOID *Hsti,
+ IN UINTN HstiSize
)
{
- EFI_STATUS Status;
- EFI_HANDLE Handle;
- HSTI_AIP_PRIVATE_DATA *HstiAip;
- EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;
- UINT32 Role;
- CHAR16 *ImplementationID;
- UINT32 SecurityFeaturesSize;
- UINT8 *SecurityFeaturesRequired;
+ EFI_STATUS Status;
+ EFI_HANDLE Handle;
+ HSTI_AIP_PRIVATE_DATA *HstiAip;
+ EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;
+ UINT32 Role;
+ CHAR16 *ImplementationID;
+ UINT32 SecurityFeaturesSize;
+ UINT8 *SecurityFeaturesRequired;
if (!InternalHstiIsValidTable (Hsti, HstiSize)) {
return EFI_VOLUME_CORRUPTED;
}
- Role = ((ADAPTER_INFO_PLATFORM_SECURITY *)Hsti)->Role;
+ Role = ((ADAPTER_INFO_PLATFORM_SECURITY *)Hsti)->Role;
ImplementationID = ((ADAPTER_INFO_PLATFORM_SECURITY *)Hsti)->ImplementationID;
- Aip = InternalHstiFindAip (Role, ImplementationID, NULL, NULL);
+ Aip = InternalHstiFindAip (Role, ImplementationID, NULL, NULL);
if (Aip != NULL) {
return EFI_ALREADY_STARTED;
}
- HstiAip = AllocateZeroPool (sizeof(HSTI_AIP_PRIVATE_DATA));
+ HstiAip = AllocateZeroPool (sizeof (HSTI_AIP_PRIVATE_DATA));
if (HstiAip == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
HstiAip->Hsti = AllocateCopyPool (HstiSize, Hsti);
if (HstiAip->Hsti == NULL) {
FreePool (HstiAip);
return EFI_OUT_OF_RESOURCES;
}
+
if (Role != PLATFORM_SECURITY_ROLE_PLATFORM_REFERENCE) {
- SecurityFeaturesRequired = (UINT8 *)HstiAip->Hsti + sizeof(ADAPTER_INFO_PLATFORM_SECURITY);
- SecurityFeaturesSize = ((ADAPTER_INFO_PLATFORM_SECURITY *)Hsti)->SecurityFeaturesSize;
+ SecurityFeaturesRequired = (UINT8 *)HstiAip->Hsti + sizeof (ADAPTER_INFO_PLATFORM_SECURITY);
+ SecurityFeaturesSize = ((ADAPTER_INFO_PLATFORM_SECURITY *)Hsti)->SecurityFeaturesSize;
ZeroMem (SecurityFeaturesRequired, SecurityFeaturesSize);
}
HstiAip->Signature = HSTI_AIP_PRIVATE_SIGNATURE;
- CopyMem (&HstiAip->Aip, &mAdapterInformationProtocol, sizeof(EFI_ADAPTER_INFORMATION_PROTOCOL));
- HstiAip->HstiSize = HstiSize;
+ CopyMem (&HstiAip->Aip, &mAdapterInformationProtocol, sizeof (EFI_ADAPTER_INFORMATION_PROTOCOL));
+ HstiAip->HstiSize = HstiSize;
HstiAip->HstiMaxSize = HstiSize;
Handle = NULL;
@@ -340,18 +353,19 @@ HstiLibSetTable (
EFI_STATUS
EFIAPI
HstiLibGetTable (
- IN UINT32 Role,
- IN CHAR16 *ImplementationID OPTIONAL,
- OUT VOID **Hsti,
- OUT UINTN *HstiSize
+ IN UINT32 Role,
+ IN CHAR16 *ImplementationID OPTIONAL,
+ OUT VOID **Hsti,
+ OUT UINTN *HstiSize
)
{
- EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;
+ EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;
Aip = InternalHstiFindAip (Role, ImplementationID, Hsti, HstiSize);
if (Aip == NULL) {
return EFI_NOT_FOUND;
}
+
return EFI_SUCCESS;
}
@@ -374,18 +388,18 @@ HstiLibGetTable (
**/
EFI_STATUS
InternalHstiRecordFeaturesVerified (
- IN UINT32 Role,
- IN CHAR16 *ImplementationID OPTIONAL,
- IN UINT32 ByteIndex,
- IN UINT8 Bit,
- IN BOOLEAN Set
+ IN UINT32 Role,
+ IN CHAR16 *ImplementationID OPTIONAL,
+ IN UINT32 ByteIndex,
+ IN UINT8 Bit,
+ IN BOOLEAN Set
)
{
- EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;
- ADAPTER_INFO_PLATFORM_SECURITY *Hsti;
- UINTN HstiSize;
- UINT8 *SecurityFeaturesVerified;
- EFI_STATUS Status;
+ EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;
+ ADAPTER_INFO_PLATFORM_SECURITY *Hsti;
+ UINTN HstiSize;
+ UINT8 *SecurityFeaturesVerified;
+ EFI_STATUS Status;
Aip = InternalHstiFindAip (Role, ImplementationID, (VOID **)&Hsti, &HstiSize);
if (Aip == NULL) {
@@ -396,7 +410,7 @@ InternalHstiRecordFeaturesVerified (
return EFI_UNSUPPORTED;
}
- SecurityFeaturesVerified = (UINT8 *)((UINTN)Hsti + sizeof(ADAPTER_INFO_PLATFORM_SECURITY) + Hsti->SecurityFeaturesSize * 2);
+ SecurityFeaturesVerified = (UINT8 *)((UINTN)Hsti + sizeof (ADAPTER_INFO_PLATFORM_SECURITY) + Hsti->SecurityFeaturesSize * 2);
if (Set) {
SecurityFeaturesVerified[ByteIndex] = (UINT8)(SecurityFeaturesVerified[ByteIndex] | (Bit));
@@ -432,10 +446,10 @@ InternalHstiRecordFeaturesVerified (
EFI_STATUS
EFIAPI
HstiLibSetFeaturesVerified (
- IN UINT32 Role,
- IN CHAR16 *ImplementationID OPTIONAL,
- IN UINT32 ByteIndex,
- IN UINT8 BitMask
+ IN UINT32 Role,
+ IN CHAR16 *ImplementationID OPTIONAL,
+ IN UINT32 ByteIndex,
+ IN UINT8 BitMask
)
{
return InternalHstiRecordFeaturesVerified (
@@ -465,10 +479,10 @@ HstiLibSetFeaturesVerified (
EFI_STATUS
EFIAPI
HstiLibClearFeaturesVerified (
- IN UINT32 Role,
- IN CHAR16 *ImplementationID OPTIONAL,
- IN UINT32 ByteIndex,
- IN UINT8 BitMask
+ IN UINT32 Role,
+ IN CHAR16 *ImplementationID OPTIONAL,
+ IN UINT32 ByteIndex,
+ IN UINT8 BitMask
)
{
return InternalHstiRecordFeaturesVerified (
@@ -498,20 +512,20 @@ HstiLibClearFeaturesVerified (
**/
EFI_STATUS
InternalHstiRecordErrorString (
- IN UINT32 Role,
- IN CHAR16 *ImplementationID OPTIONAL,
- IN CHAR16 *ErrorString,
- IN BOOLEAN Append
+ IN UINT32 Role,
+ IN CHAR16 *ImplementationID OPTIONAL,
+ IN CHAR16 *ErrorString,
+ IN BOOLEAN Append
)
{
- EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;
- ADAPTER_INFO_PLATFORM_SECURITY *Hsti;
- UINTN HstiSize;
- UINTN StringSize;
- VOID *NewHsti;
- UINTN NewHstiSize;
- UINTN Offset;
- EFI_STATUS Status;
+ EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;
+ ADAPTER_INFO_PLATFORM_SECURITY *Hsti;
+ UINTN HstiSize;
+ UINTN StringSize;
+ VOID *NewHsti;
+ UINTN NewHstiSize;
+ UINTN Offset;
+ EFI_STATUS Status;
Aip = InternalHstiFindAip (Role, ImplementationID, (VOID **)&Hsti, &HstiSize);
if (Aip == NULL) {
@@ -519,14 +533,15 @@ InternalHstiRecordErrorString (
}
if (Append) {
- Offset = HstiSize - sizeof(CHAR16);
+ Offset = HstiSize - sizeof (CHAR16);
} else {
- Offset = sizeof(ADAPTER_INFO_PLATFORM_SECURITY) + Hsti->SecurityFeaturesSize * 3;
+ Offset = sizeof (ADAPTER_INFO_PLATFORM_SECURITY) + Hsti->SecurityFeaturesSize * 3;
}
+
StringSize = StrSize (ErrorString);
NewHstiSize = Offset + StringSize;
- NewHsti = AllocatePool (NewHstiSize);
+ NewHsti = AllocatePool (NewHstiSize);
if (NewHsti == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@@ -562,9 +577,9 @@ InternalHstiRecordErrorString (
EFI_STATUS
EFIAPI
HstiLibAppendErrorString (
- IN UINT32 Role,
- IN CHAR16 *ImplementationID OPTIONAL,
- IN CHAR16 *ErrorString
+ IN UINT32 Role,
+ IN CHAR16 *ImplementationID OPTIONAL,
+ IN CHAR16 *ErrorString
)
{
return InternalHstiRecordErrorString (
@@ -592,9 +607,9 @@ HstiLibAppendErrorString (
EFI_STATUS
EFIAPI
HstiLibSetErrorString (
- IN UINT32 Role,
- IN CHAR16 *ImplementationID OPTIONAL,
- IN CHAR16 *ErrorString
+ IN UINT32 Role,
+ IN CHAR16 *ImplementationID OPTIONAL,
+ IN CHAR16 *ErrorString
)
{
return InternalHstiRecordErrorString (
diff --git a/MdePkg/Library/DxeHstiLib/HstiDxe.h b/MdePkg/Library/DxeHstiLib/HstiDxe.h
index 218297a3b2..e6556997a9 100644
--- a/MdePkg/Library/DxeHstiLib/HstiDxe.h
+++ b/MdePkg/Library/DxeHstiLib/HstiDxe.h
@@ -22,12 +22,12 @@
#define HSTI_AIP_PRIVATE_SIGNATURE SIGNATURE_32('H', 'S', 'T', 'I')
typedef struct {
- UINT32 Signature;
- LIST_ENTRY Link;
- EFI_ADAPTER_INFORMATION_PROTOCOL Aip;
- VOID *Hsti;
- UINTN HstiSize;
- UINTN HstiMaxSize;
+ UINT32 Signature;
+ LIST_ENTRY Link;
+ EFI_ADAPTER_INFORMATION_PROTOCOL Aip;
+ VOID *Hsti;
+ UINTN HstiSize;
+ UINTN HstiMaxSize;
} HSTI_AIP_PRIVATE_DATA;
#define HSTI_AIP_PRIVATE_DATA_FROM_THIS(a) \
@@ -39,7 +39,7 @@ typedef struct {
#define HSTI_DEFAULT_ERROR_STRING_LEN 255
-extern EFI_ADAPTER_INFORMATION_PROTOCOL mAdapterInformationProtocol;
+extern EFI_ADAPTER_INFORMATION_PROTOCOL mAdapterInformationProtocol;
/**
Return if input HSTI data follows HSTI specification.
@@ -52,8 +52,8 @@ extern EFI_ADAPTER_INFORMATION_PROTOCOL mAdapterInformationProtocol;
**/
BOOLEAN
InternalHstiIsValidTable (
- IN VOID *HstiData,
- IN UINTN HstiSize
+ IN VOID *HstiData,
+ IN UINTN HstiSize
);
#endif
diff --git a/MdePkg/Library/DxeIoLibCpuIo2/DxeCpuIo2LibInternal.h b/MdePkg/Library/DxeIoLibCpuIo2/DxeCpuIo2LibInternal.h
index b6797c358f..5beff18343 100644
--- a/MdePkg/Library/DxeIoLibCpuIo2/DxeCpuIo2LibInternal.h
+++ b/MdePkg/Library/DxeIoLibCpuIo2/DxeCpuIo2LibInternal.h
@@ -20,7 +20,6 @@
#include <Library/DebugLib.h>
#include <Library/BaseLib.h>
-
/**
Reads registers in the EFI CPU I/O space.
@@ -136,8 +135,8 @@ IoWriteFifoWorker (
UINT64
EFIAPI
MmioReadWorker (
- IN UINTN Address,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width
+ IN UINTN Address,
+ IN EFI_CPU_IO_PROTOCOL_WIDTH Width
);
/**
@@ -158,9 +157,9 @@ MmioReadWorker (
UINT64
EFIAPI
MmioWriteWorker (
- IN UINTN Address,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Data
+ IN UINTN Address,
+ IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 Data
);
#endif
diff --git a/MdePkg/Library/DxeIoLibCpuIo2/IoHighLevel.c b/MdePkg/Library/DxeIoLibCpuIo2/IoHighLevel.c
index ac4d3a6849..94d4786d82 100644
--- a/MdePkg/Library/DxeIoLibCpuIo2/IoHighLevel.c
+++ b/MdePkg/Library/DxeIoLibCpuIo2/IoHighLevel.c
@@ -9,7 +9,6 @@
**/
-
#include "DxeCpuIo2LibInternal.h"
/**
@@ -33,11 +32,11 @@
UINT8
EFIAPI
IoOr8 (
- IN UINTN Port,
- IN UINT8 OrData
+ IN UINTN Port,
+ IN UINT8 OrData
)
{
- return IoWrite8 (Port, (UINT8) (IoRead8 (Port) | OrData));
+ return IoWrite8 (Port, (UINT8)(IoRead8 (Port) | OrData));
}
/**
@@ -61,11 +60,11 @@ IoOr8 (
UINT8
EFIAPI
IoAnd8 (
- IN UINTN Port,
- IN UINT8 AndData
+ IN UINTN Port,
+ IN UINT8 AndData
)
{
- return IoWrite8 (Port, (UINT8) (IoRead8 (Port) & AndData));
+ return IoWrite8 (Port, (UINT8)(IoRead8 (Port) & AndData));
}
/**
@@ -91,12 +90,12 @@ IoAnd8 (
UINT8
EFIAPI
IoAndThenOr8 (
- IN UINTN Port,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Port,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
- return IoWrite8 (Port, (UINT8) ((IoRead8 (Port) & AndData) | OrData));
+ return IoWrite8 (Port, (UINT8)((IoRead8 (Port) & AndData) | OrData));
}
/**
@@ -122,9 +121,9 @@ IoAndThenOr8 (
UINT8
EFIAPI
IoBitFieldRead8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead8 (IoRead8 (Port), StartBit, EndBit);
@@ -157,10 +156,10 @@ IoBitFieldRead8 (
UINT8
EFIAPI
IoBitFieldWrite8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
return IoWrite8 (
@@ -198,10 +197,10 @@ IoBitFieldWrite8 (
UINT8
EFIAPI
IoBitFieldOr8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
return IoWrite8 (
@@ -239,10 +238,10 @@ IoBitFieldOr8 (
UINT8
EFIAPI
IoBitFieldAnd8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
return IoWrite8 (
@@ -284,11 +283,11 @@ IoBitFieldAnd8 (
UINT8
EFIAPI
IoBitFieldAndThenOr8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
return IoWrite8 (
@@ -318,11 +317,11 @@ IoBitFieldAndThenOr8 (
UINT16
EFIAPI
IoOr16 (
- IN UINTN Port,
- IN UINT16 OrData
+ IN UINTN Port,
+ IN UINT16 OrData
)
{
- return IoWrite16 (Port, (UINT16) (IoRead16 (Port) | OrData));
+ return IoWrite16 (Port, (UINT16)(IoRead16 (Port) | OrData));
}
/**
@@ -346,11 +345,11 @@ IoOr16 (
UINT16
EFIAPI
IoAnd16 (
- IN UINTN Port,
- IN UINT16 AndData
+ IN UINTN Port,
+ IN UINT16 AndData
)
{
- return IoWrite16 (Port, (UINT16) (IoRead16 (Port) & AndData));
+ return IoWrite16 (Port, (UINT16)(IoRead16 (Port) & AndData));
}
/**
@@ -376,12 +375,12 @@ IoAnd16 (
UINT16
EFIAPI
IoAndThenOr16 (
- IN UINTN Port,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Port,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
- return IoWrite16 (Port, (UINT16) ((IoRead16 (Port) & AndData) | OrData));
+ return IoWrite16 (Port, (UINT16)((IoRead16 (Port) & AndData) | OrData));
}
/**
@@ -407,9 +406,9 @@ IoAndThenOr16 (
UINT16
EFIAPI
IoBitFieldRead16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead16 (IoRead16 (Port), StartBit, EndBit);
@@ -442,10 +441,10 @@ IoBitFieldRead16 (
UINT16
EFIAPI
IoBitFieldWrite16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
return IoWrite16 (
@@ -483,10 +482,10 @@ IoBitFieldWrite16 (
UINT16
EFIAPI
IoBitFieldOr16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
return IoWrite16 (
@@ -524,10 +523,10 @@ IoBitFieldOr16 (
UINT16
EFIAPI
IoBitFieldAnd16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
return IoWrite16 (
@@ -569,11 +568,11 @@ IoBitFieldAnd16 (
UINT16
EFIAPI
IoBitFieldAndThenOr16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
return IoWrite16 (
@@ -603,8 +602,8 @@ IoBitFieldAndThenOr16 (
UINT32
EFIAPI
IoOr32 (
- IN UINTN Port,
- IN UINT32 OrData
+ IN UINTN Port,
+ IN UINT32 OrData
)
{
return IoWrite32 (Port, IoRead32 (Port) | OrData);
@@ -631,8 +630,8 @@ IoOr32 (
UINT32
EFIAPI
IoAnd32 (
- IN UINTN Port,
- IN UINT32 AndData
+ IN UINTN Port,
+ IN UINT32 AndData
)
{
return IoWrite32 (Port, IoRead32 (Port) & AndData);
@@ -661,9 +660,9 @@ IoAnd32 (
UINT32
EFIAPI
IoAndThenOr32 (
- IN UINTN Port,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Port,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return IoWrite32 (Port, (IoRead32 (Port) & AndData) | OrData);
@@ -692,9 +691,9 @@ IoAndThenOr32 (
UINT32
EFIAPI
IoBitFieldRead32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead32 (IoRead32 (Port), StartBit, EndBit);
@@ -727,10 +726,10 @@ IoBitFieldRead32 (
UINT32
EFIAPI
IoBitFieldWrite32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
return IoWrite32 (
@@ -768,10 +767,10 @@ IoBitFieldWrite32 (
UINT32
EFIAPI
IoBitFieldOr32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
return IoWrite32 (
@@ -809,10 +808,10 @@ IoBitFieldOr32 (
UINT32
EFIAPI
IoBitFieldAnd32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
return IoWrite32 (
@@ -854,11 +853,11 @@ IoBitFieldAnd32 (
UINT32
EFIAPI
IoBitFieldAndThenOr32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return IoWrite32 (
@@ -888,8 +887,8 @@ IoBitFieldAndThenOr32 (
UINT64
EFIAPI
IoOr64 (
- IN UINTN Port,
- IN UINT64 OrData
+ IN UINTN Port,
+ IN UINT64 OrData
)
{
return IoWrite64 (Port, IoRead64 (Port) | OrData);
@@ -916,8 +915,8 @@ IoOr64 (
UINT64
EFIAPI
IoAnd64 (
- IN UINTN Port,
- IN UINT64 AndData
+ IN UINTN Port,
+ IN UINT64 AndData
)
{
return IoWrite64 (Port, IoRead64 (Port) & AndData);
@@ -946,9 +945,9 @@ IoAnd64 (
UINT64
EFIAPI
IoAndThenOr64 (
- IN UINTN Port,
- IN UINT64 AndData,
- IN UINT64 OrData
+ IN UINTN Port,
+ IN UINT64 AndData,
+ IN UINT64 OrData
)
{
return IoWrite64 (Port, (IoRead64 (Port) & AndData) | OrData);
@@ -977,9 +976,9 @@ IoAndThenOr64 (
UINT64
EFIAPI
IoBitFieldRead64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead64 (IoRead64 (Port), StartBit, EndBit);
@@ -1012,10 +1011,10 @@ IoBitFieldRead64 (
UINT64
EFIAPI
IoBitFieldWrite64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 Value
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 Value
)
{
return IoWrite64 (
@@ -1053,10 +1052,10 @@ IoBitFieldWrite64 (
UINT64
EFIAPI
IoBitFieldOr64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 OrData
)
{
return IoWrite64 (
@@ -1094,10 +1093,10 @@ IoBitFieldOr64 (
UINT64
EFIAPI
IoBitFieldAnd64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData
)
{
return IoWrite64 (
@@ -1139,11 +1138,11 @@ IoBitFieldAnd64 (
UINT64
EFIAPI
IoBitFieldAndThenOr64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData,
- IN UINT64 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData,
+ IN UINT64 OrData
)
{
return IoWrite64 (
@@ -1173,11 +1172,11 @@ IoBitFieldAndThenOr64 (
UINT8
EFIAPI
MmioOr8 (
- IN UINTN Address,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 OrData
)
{
- return MmioWrite8 (Address, (UINT8) (MmioRead8 (Address) | OrData));
+ return MmioWrite8 (Address, (UINT8)(MmioRead8 (Address) | OrData));
}
/**
@@ -1201,11 +1200,11 @@ MmioOr8 (
UINT8
EFIAPI
MmioAnd8 (
- IN UINTN Address,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINT8 AndData
)
{
- return MmioWrite8 (Address, (UINT8) (MmioRead8 (Address) & AndData));
+ return MmioWrite8 (Address, (UINT8)(MmioRead8 (Address) & AndData));
}
/**
@@ -1232,12 +1231,12 @@ MmioAnd8 (
UINT8
EFIAPI
MmioAndThenOr8 (
- IN UINTN Address,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
- return MmioWrite8 (Address, (UINT8) ((MmioRead8 (Address) & AndData) | OrData));
+ return MmioWrite8 (Address, (UINT8)((MmioRead8 (Address) & AndData) | OrData));
}
/**
@@ -1263,9 +1262,9 @@ MmioAndThenOr8 (
UINT8
EFIAPI
MmioBitFieldRead8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead8 (MmioRead8 (Address), StartBit, EndBit);
@@ -1297,10 +1296,10 @@ MmioBitFieldRead8 (
UINT8
EFIAPI
MmioBitFieldWrite8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
return MmioWrite8 (
@@ -1339,10 +1338,10 @@ MmioBitFieldWrite8 (
UINT8
EFIAPI
MmioBitFieldOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
return MmioWrite8 (
@@ -1381,10 +1380,10 @@ MmioBitFieldOr8 (
UINT8
EFIAPI
MmioBitFieldAnd8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
return MmioWrite8 (
@@ -1426,11 +1425,11 @@ MmioBitFieldAnd8 (
UINT8
EFIAPI
MmioBitFieldAndThenOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
return MmioWrite8 (
@@ -1460,11 +1459,11 @@ MmioBitFieldAndThenOr8 (
UINT16
EFIAPI
MmioOr16 (
- IN UINTN Address,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 OrData
)
{
- return MmioWrite16 (Address, (UINT16) (MmioRead16 (Address) | OrData));
+ return MmioWrite16 (Address, (UINT16)(MmioRead16 (Address) | OrData));
}
/**
@@ -1488,11 +1487,11 @@ MmioOr16 (
UINT16
EFIAPI
MmioAnd16 (
- IN UINTN Address,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINT16 AndData
)
{
- return MmioWrite16 (Address, (UINT16) (MmioRead16 (Address) & AndData));
+ return MmioWrite16 (Address, (UINT16)(MmioRead16 (Address) & AndData));
}
/**
@@ -1519,12 +1518,12 @@ MmioAnd16 (
UINT16
EFIAPI
MmioAndThenOr16 (
- IN UINTN Address,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
- return MmioWrite16 (Address, (UINT16) ((MmioRead16 (Address) & AndData) | OrData));
+ return MmioWrite16 (Address, (UINT16)((MmioRead16 (Address) & AndData) | OrData));
}
/**
@@ -1550,9 +1549,9 @@ MmioAndThenOr16 (
UINT16
EFIAPI
MmioBitFieldRead16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead16 (MmioRead16 (Address), StartBit, EndBit);
@@ -1584,10 +1583,10 @@ MmioBitFieldRead16 (
UINT16
EFIAPI
MmioBitFieldWrite16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
return MmioWrite16 (
@@ -1626,10 +1625,10 @@ MmioBitFieldWrite16 (
UINT16
EFIAPI
MmioBitFieldOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
return MmioWrite16 (
@@ -1668,10 +1667,10 @@ MmioBitFieldOr16 (
UINT16
EFIAPI
MmioBitFieldAnd16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
return MmioWrite16 (
@@ -1713,11 +1712,11 @@ MmioBitFieldAnd16 (
UINT16
EFIAPI
MmioBitFieldAndThenOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
return MmioWrite16 (
@@ -1747,8 +1746,8 @@ MmioBitFieldAndThenOr16 (
UINT32
EFIAPI
MmioOr32 (
- IN UINTN Address,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 OrData
)
{
return MmioWrite32 (Address, MmioRead32 (Address) | OrData);
@@ -1775,8 +1774,8 @@ MmioOr32 (
UINT32
EFIAPI
MmioAnd32 (
- IN UINTN Address,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINT32 AndData
)
{
return MmioWrite32 (Address, MmioRead32 (Address) & AndData);
@@ -1806,9 +1805,9 @@ MmioAnd32 (
UINT32
EFIAPI
MmioAndThenOr32 (
- IN UINTN Address,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return MmioWrite32 (Address, (MmioRead32 (Address) & AndData) | OrData);
@@ -1837,9 +1836,9 @@ MmioAndThenOr32 (
UINT32
EFIAPI
MmioBitFieldRead32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead32 (MmioRead32 (Address), StartBit, EndBit);
@@ -1871,10 +1870,10 @@ MmioBitFieldRead32 (
UINT32
EFIAPI
MmioBitFieldWrite32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
return MmioWrite32 (
@@ -1913,10 +1912,10 @@ MmioBitFieldWrite32 (
UINT32
EFIAPI
MmioBitFieldOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
return MmioWrite32 (
@@ -1955,10 +1954,10 @@ MmioBitFieldOr32 (
UINT32
EFIAPI
MmioBitFieldAnd32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
return MmioWrite32 (
@@ -2000,11 +1999,11 @@ MmioBitFieldAnd32 (
UINT32
EFIAPI
MmioBitFieldAndThenOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return MmioWrite32 (
@@ -2034,8 +2033,8 @@ MmioBitFieldAndThenOr32 (
UINT64
EFIAPI
MmioOr64 (
- IN UINTN Address,
- IN UINT64 OrData
+ IN UINTN Address,
+ IN UINT64 OrData
)
{
return MmioWrite64 (Address, MmioRead64 (Address) | OrData);
@@ -2062,8 +2061,8 @@ MmioOr64 (
UINT64
EFIAPI
MmioAnd64 (
- IN UINTN Address,
- IN UINT64 AndData
+ IN UINTN Address,
+ IN UINT64 AndData
)
{
return MmioWrite64 (Address, MmioRead64 (Address) & AndData);
@@ -2093,9 +2092,9 @@ MmioAnd64 (
UINT64
EFIAPI
MmioAndThenOr64 (
- IN UINTN Address,
- IN UINT64 AndData,
- IN UINT64 OrData
+ IN UINTN Address,
+ IN UINT64 AndData,
+ IN UINT64 OrData
)
{
return MmioWrite64 (Address, (MmioRead64 (Address) & AndData) | OrData);
@@ -2124,9 +2123,9 @@ MmioAndThenOr64 (
UINT64
EFIAPI
MmioBitFieldRead64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead64 (MmioRead64 (Address), StartBit, EndBit);
@@ -2158,10 +2157,10 @@ MmioBitFieldRead64 (
UINT64
EFIAPI
MmioBitFieldWrite64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 Value
)
{
return MmioWrite64 (
@@ -2200,10 +2199,10 @@ MmioBitFieldWrite64 (
UINT64
EFIAPI
MmioBitFieldOr64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 OrData
)
{
return MmioWrite64 (
@@ -2242,10 +2241,10 @@ MmioBitFieldOr64 (
UINT64
EFIAPI
MmioBitFieldAnd64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData
)
{
return MmioWrite64 (
@@ -2287,11 +2286,11 @@ MmioBitFieldAnd64 (
UINT64
EFIAPI
MmioBitFieldAndThenOr64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData,
- IN UINT64 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData,
+ IN UINT64 OrData
)
{
return MmioWrite64 (
diff --git a/MdePkg/Library/DxeIoLibCpuIo2/IoLib.c b/MdePkg/Library/DxeIoLibCpuIo2/IoLib.c
index 21f88d9852..9849d06bd6 100644
--- a/MdePkg/Library/DxeIoLibCpuIo2/IoLib.c
+++ b/MdePkg/Library/DxeIoLibCpuIo2/IoLib.c
@@ -30,13 +30,13 @@ EFI_CPU_IO2_PROTOCOL *mCpuIo = NULL;
EFI_STATUS
EFIAPI
IoLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
- Status = gBS->LocateProtocol (&gEfiCpuIo2ProtocolGuid, NULL, (VOID **) &mCpuIo);
+ Status = gBS->LocateProtocol (&gEfiCpuIo2ProtocolGuid, NULL, (VOID **)&mCpuIo);
ASSERT_EFI_ERROR (Status);
return Status;
@@ -247,7 +247,7 @@ MmioWriteWorker (
UINT8
EFIAPI
IoRead8 (
- IN UINTN Port
+ IN UINTN Port
)
{
return (UINT8)IoReadWorker (Port, EfiCpuIoWidthUint8);
@@ -271,8 +271,8 @@ IoRead8 (
UINT8
EFIAPI
IoWrite8 (
- IN UINTN Port,
- IN UINT8 Value
+ IN UINTN Port,
+ IN UINT8 Value
)
{
return (UINT8)IoWriteWorker (Port, EfiCpuIoWidthUint8, Value);
@@ -297,7 +297,7 @@ IoWrite8 (
UINT16
EFIAPI
IoRead16 (
- IN UINTN Port
+ IN UINTN Port
)
{
//
@@ -327,8 +327,8 @@ IoRead16 (
UINT16
EFIAPI
IoWrite16 (
- IN UINTN Port,
- IN UINT16 Value
+ IN UINTN Port,
+ IN UINT16 Value
)
{
//
@@ -357,7 +357,7 @@ IoWrite16 (
UINT32
EFIAPI
IoRead32 (
- IN UINTN Port
+ IN UINTN Port
)
{
//
@@ -387,8 +387,8 @@ IoRead32 (
UINT32
EFIAPI
IoWrite32 (
- IN UINTN Port,
- IN UINT32 Value
+ IN UINTN Port,
+ IN UINT32 Value
)
{
//
@@ -417,7 +417,7 @@ IoWrite32 (
UINT64
EFIAPI
IoRead64 (
- IN UINTN Port
+ IN UINTN Port
)
{
//
@@ -447,8 +447,8 @@ IoRead64 (
UINT64
EFIAPI
IoWrite64 (
- IN UINTN Port,
- IN UINT64 Value
+ IN UINTN Port,
+ IN UINT64 Value
)
{
//
@@ -478,9 +478,9 @@ IoWrite64 (
VOID
EFIAPI
IoReadFifo8 (
- IN UINTN Port,
- IN UINTN Count,
- OUT VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ OUT VOID *Buffer
)
{
IoReadFifoWorker (Port, EfiCpuIoWidthFifoUint8, Count, Buffer);
@@ -506,9 +506,9 @@ IoReadFifo8 (
VOID
EFIAPI
IoWriteFifo8 (
- IN UINTN Port,
- IN UINTN Count,
- IN VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ IN VOID *Buffer
)
{
IoWriteFifoWorker (Port, EfiCpuIoWidthFifoUint8, Count, Buffer);
@@ -534,9 +534,9 @@ IoWriteFifo8 (
VOID
EFIAPI
IoReadFifo16 (
- IN UINTN Port,
- IN UINTN Count,
- OUT VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ OUT VOID *Buffer
)
{
//
@@ -566,9 +566,9 @@ IoReadFifo16 (
VOID
EFIAPI
IoWriteFifo16 (
- IN UINTN Port,
- IN UINTN Count,
- IN VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ IN VOID *Buffer
)
{
//
@@ -598,9 +598,9 @@ IoWriteFifo16 (
VOID
EFIAPI
IoReadFifo32 (
- IN UINTN Port,
- IN UINTN Count,
- OUT VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ OUT VOID *Buffer
)
{
//
@@ -630,9 +630,9 @@ IoReadFifo32 (
VOID
EFIAPI
IoWriteFifo32 (
- IN UINTN Port,
- IN UINTN Count,
- IN VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ IN VOID *Buffer
)
{
//
@@ -659,7 +659,7 @@ IoWriteFifo32 (
UINT8
EFIAPI
MmioRead8 (
- IN UINTN Address
+ IN UINTN Address
)
{
return (UINT8)MmioReadWorker (Address, EfiCpuIoWidthUint8);
@@ -681,8 +681,8 @@ MmioRead8 (
UINT8
EFIAPI
MmioWrite8 (
- IN UINTN Address,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINT8 Value
)
{
return (UINT8)MmioWriteWorker (Address, EfiCpuIoWidthUint8, Value);
@@ -707,7 +707,7 @@ MmioWrite8 (
UINT16
EFIAPI
MmioRead16 (
- IN UINTN Address
+ IN UINTN Address
)
{
//
@@ -735,8 +735,8 @@ MmioRead16 (
UINT16
EFIAPI
MmioWrite16 (
- IN UINTN Address,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINT16 Value
)
{
//
@@ -765,7 +765,7 @@ MmioWrite16 (
UINT32
EFIAPI
MmioRead32 (
- IN UINTN Address
+ IN UINTN Address
)
{
//
@@ -793,8 +793,8 @@ MmioRead32 (
UINT32
EFIAPI
MmioWrite32 (
- IN UINTN Address,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINT32 Value
)
{
//
@@ -823,7 +823,7 @@ MmioWrite32 (
UINT64
EFIAPI
MmioRead64 (
- IN UINTN Address
+ IN UINTN Address
)
{
//
@@ -851,8 +851,8 @@ MmioRead64 (
UINT64
EFIAPI
MmioWrite64 (
- IN UINTN Address,
- IN UINT64 Value
+ IN UINTN Address,
+ IN UINT64 Value
)
{
//
diff --git a/MdePkg/Library/DxeIoLibCpuIo2/IoLibMmioBuffer.c b/MdePkg/Library/DxeIoLibCpuIo2/IoLibMmioBuffer.c
index 2731bcdac3..a5d5e7856d 100644
--- a/MdePkg/Library/DxeIoLibCpuIo2/IoLibMmioBuffer.c
+++ b/MdePkg/Library/DxeIoLibCpuIo2/IoLibMmioBuffer.c
@@ -29,15 +29,15 @@
UINT8 *
EFIAPI
MmioReadBuffer8 (
- IN UINTN StartAddress,
- IN UINTN Length,
- OUT UINT8 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ OUT UINT8 *Buffer
)
{
- UINT8 *ReturnBuffer;
+ UINT8 *ReturnBuffer;
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ReturnBuffer = Buffer;
@@ -74,27 +74,27 @@ MmioReadBuffer8 (
UINT16 *
EFIAPI
MmioReadBuffer16 (
- IN UINTN StartAddress,
- IN UINTN Length,
- OUT UINT16 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ OUT UINT16 *Buffer
)
{
- UINT16 *ReturnBuffer;
+ UINT16 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT16) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT16) - 1)) == 0);
+ ASSERT (((UINTN)Buffer & (sizeof (UINT16) - 1)) == 0);
ReturnBuffer = Buffer;
while (Length > 0) {
- *(Buffer++) = MmioRead16 (StartAddress);
+ *(Buffer++) = MmioRead16 (StartAddress);
StartAddress += sizeof (UINT16);
- Length -= sizeof (UINT16);
+ Length -= sizeof (UINT16);
}
return ReturnBuffer;
@@ -125,27 +125,27 @@ MmioReadBuffer16 (
UINT32 *
EFIAPI
MmioReadBuffer32 (
- IN UINTN StartAddress,
- IN UINTN Length,
- OUT UINT32 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ OUT UINT32 *Buffer
)
{
- UINT32 *ReturnBuffer;
+ UINT32 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT32) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0);
+ ASSERT (((UINTN)Buffer & (sizeof (UINT32) - 1)) == 0);
ReturnBuffer = Buffer;
while (Length > 0) {
- *(Buffer++) = MmioRead32 (StartAddress);
+ *(Buffer++) = MmioRead32 (StartAddress);
StartAddress += sizeof (UINT32);
- Length -= sizeof (UINT32);
+ Length -= sizeof (UINT32);
}
return ReturnBuffer;
@@ -177,33 +177,32 @@ MmioReadBuffer32 (
UINT64 *
EFIAPI
MmioReadBuffer64 (
- IN UINTN StartAddress,
- IN UINTN Length,
- OUT UINT64 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ OUT UINT64 *Buffer
)
{
- UINT64 *ReturnBuffer;
+ UINT64 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT64) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT64) - 1)) == 0);
+ ASSERT (((UINTN)Buffer & (sizeof (UINT64) - 1)) == 0);
ReturnBuffer = Buffer;
while (Length > 0) {
- *(Buffer++) = MmioRead64 (StartAddress);
+ *(Buffer++) = MmioRead64 (StartAddress);
StartAddress += sizeof (UINT64);
- Length -= sizeof (UINT64);
+ Length -= sizeof (UINT64);
}
return ReturnBuffer;
}
-
/**
Copy data from system memory to MMIO region by using 8-bit access.
@@ -225,24 +224,23 @@ MmioReadBuffer64 (
UINT8 *
EFIAPI
MmioWriteBuffer8 (
- IN UINTN StartAddress,
- IN UINTN Length,
- IN CONST UINT8 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ IN CONST UINT8 *Buffer
)
{
- VOID* ReturnBuffer;
+ VOID *ReturnBuffer;
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
- ReturnBuffer = (UINT8 *) Buffer;
+ ReturnBuffer = (UINT8 *)Buffer;
while (Length-- > 0) {
- MmioWrite8 (StartAddress++, *(Buffer++));
+ MmioWrite8 (StartAddress++, *(Buffer++));
}
return ReturnBuffer;
-
}
/**
@@ -271,34 +269,33 @@ MmioWriteBuffer8 (
UINT16 *
EFIAPI
MmioWriteBuffer16 (
- IN UINTN StartAddress,
- IN UINTN Length,
- IN CONST UINT16 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ IN CONST UINT16 *Buffer
)
{
- UINT16 *ReturnBuffer;
+ UINT16 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT16) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT16) - 1)) == 0);
+ ASSERT (((UINTN)Buffer & (sizeof (UINT16) - 1)) == 0);
- ReturnBuffer = (UINT16 *) Buffer;
+ ReturnBuffer = (UINT16 *)Buffer;
while (Length > 0) {
MmioWrite16 (StartAddress, *(Buffer++));
StartAddress += sizeof (UINT16);
- Length -= sizeof (UINT16);
+ Length -= sizeof (UINT16);
}
return ReturnBuffer;
}
-
/**
Copy data from system memory to MMIO region by using 32-bit access.
@@ -325,28 +322,28 @@ MmioWriteBuffer16 (
UINT32 *
EFIAPI
MmioWriteBuffer32 (
- IN UINTN StartAddress,
- IN UINTN Length,
- IN CONST UINT32 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ IN CONST UINT32 *Buffer
)
{
- UINT32 *ReturnBuffer;
+ UINT32 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT32) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0);
+ ASSERT (((UINTN)Buffer & (sizeof (UINT32) - 1)) == 0);
- ReturnBuffer = (UINT32 *) Buffer;
+ ReturnBuffer = (UINT32 *)Buffer;
while (Length > 0) {
MmioWrite32 (StartAddress, *(Buffer++));
StartAddress += sizeof (UINT32);
- Length -= sizeof (UINT32);
+ Length -= sizeof (UINT32);
}
return ReturnBuffer;
@@ -378,30 +375,29 @@ MmioWriteBuffer32 (
UINT64 *
EFIAPI
MmioWriteBuffer64 (
- IN UINTN StartAddress,
- IN UINTN Length,
- IN CONST UINT64 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ IN CONST UINT64 *Buffer
)
{
- UINT64 *ReturnBuffer;
+ UINT64 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT64) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT64) - 1)) == 0);
+ ASSERT (((UINTN)Buffer & (sizeof (UINT64) - 1)) == 0);
- ReturnBuffer = (UINT64 *) Buffer;
+ ReturnBuffer = (UINT64 *)Buffer;
while (Length > 0) {
MmioWrite64 (StartAddress, *(Buffer++));
StartAddress += sizeof (UINT64);
- Length -= sizeof (UINT64);
+ Length -= sizeof (UINT64);
}
return ReturnBuffer;
}
-
diff --git a/MdePkg/Library/DxePcdLib/DxePcdLib.c b/MdePkg/Library/DxePcdLib/DxePcdLib.c
index 21ebc88276..b2a8bf22a3 100644
--- a/MdePkg/Library/DxePcdLib/DxePcdLib.c
+++ b/MdePkg/Library/DxePcdLib/DxePcdLib.c
@@ -7,7 +7,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-
#include <PiDxe.h>
#include <Protocol/Pcd.h>
@@ -20,10 +19,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseMemoryLib.h>
-PCD_PROTOCOL *mPcd = NULL;
-EFI_PCD_PROTOCOL *mPiPcd = NULL;
-GET_PCD_INFO_PROTOCOL *mPcdInfo = NULL;
-EFI_GET_PCD_INFO_PROTOCOL *mPiPcdInfo = NULL;
+PCD_PROTOCOL *mPcd = NULL;
+EFI_PCD_PROTOCOL *mPiPcd = NULL;
+GET_PCD_INFO_PROTOCOL *mPcdInfo = NULL;
+EFI_GET_PCD_INFO_PROTOCOL *mPiPcdInfo = NULL;
/**
Retrieves the PI PCD protocol from the handle database.
@@ -43,10 +42,11 @@ GetPiPcdProtocol (
// PI Pcd protocol defined in PI 1.2 vol3 should be installed before the module
// access DynamicEx type PCD.
//
- Status = gBS->LocateProtocol (&gEfiPcdProtocolGuid, NULL, (VOID **) &mPiPcd);
+ Status = gBS->LocateProtocol (&gEfiPcdProtocolGuid, NULL, (VOID **)&mPiPcd);
ASSERT_EFI_ERROR (Status);
ASSERT (mPiPcd != NULL);
}
+
return mPiPcd;
}
@@ -72,6 +72,7 @@ GetPcdProtocol (
ASSERT_EFI_ERROR (Status);
ASSERT (mPcd != NULL);
}
+
return mPcd;
}
@@ -92,6 +93,7 @@ GetPiPcdInfoProtocolPointer (
ASSERT_EFI_ERROR (Status);
ASSERT (mPiPcdInfo != NULL);
}
+
return mPiPcdInfo;
}
@@ -112,6 +114,7 @@ GetPcdInfoProtocolPointer (
ASSERT_EFI_ERROR (Status);
ASSERT (mPcdInfo != NULL);
}
+
return mPcdInfo;
}
@@ -129,16 +132,14 @@ GetPcdInfoProtocolPointer (
UINTN
EFIAPI
LibPcdSetSku (
- IN UINTN SkuId
+ IN UINTN SkuId
)
{
- GetPcdProtocol()->SetSku (SkuId);
+ GetPcdProtocol ()->SetSku (SkuId);
return SkuId;
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -152,14 +153,12 @@ LibPcdSetSku (
UINT8
EFIAPI
LibPcdGet8 (
- IN UINTN TokenNumber
+ IN UINTN TokenNumber
)
{
- return GetPcdProtocol()->Get8 (TokenNumber);
+ return GetPcdProtocol ()->Get8 (TokenNumber);
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -173,14 +172,12 @@ LibPcdGet8 (
UINT16
EFIAPI
LibPcdGet16 (
- IN UINTN TokenNumber
+ IN UINTN TokenNumber
)
{
- return GetPcdProtocol()->Get16 (TokenNumber);
+ return GetPcdProtocol ()->Get16 (TokenNumber);
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -194,14 +191,12 @@ LibPcdGet16 (
UINT32
EFIAPI
LibPcdGet32 (
- IN UINTN TokenNumber
+ IN UINTN TokenNumber
)
{
- return GetPcdProtocol()->Get32 (TokenNumber);
+ return GetPcdProtocol ()->Get32 (TokenNumber);
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -215,14 +210,12 @@ LibPcdGet32 (
UINT64
EFIAPI
LibPcdGet64 (
- IN UINTN TokenNumber
+ IN UINTN TokenNumber
)
{
- return GetPcdProtocol()->Get64 (TokenNumber);
+ return GetPcdProtocol ()->Get64 (TokenNumber);
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -236,14 +229,12 @@ LibPcdGet64 (
VOID *
EFIAPI
LibPcdGetPtr (
- IN UINTN TokenNumber
+ IN UINTN TokenNumber
)
{
- return GetPcdProtocol()->GetPtr (TokenNumber);
+ return GetPcdProtocol ()->GetPtr (TokenNumber);
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -257,14 +248,12 @@ LibPcdGetPtr (
BOOLEAN
EFIAPI
LibPcdGetBool (
- IN UINTN TokenNumber
+ IN UINTN TokenNumber
)
{
- return GetPcdProtocol()->GetBool (TokenNumber);
+ return GetPcdProtocol ()->GetBool (TokenNumber);
}
-
-
/**
This function provides a means by which to retrieve the size of a given PCD token.
@@ -276,14 +265,12 @@ LibPcdGetBool (
UINTN
EFIAPI
LibPcdGetSize (
- IN UINTN TokenNumber
+ IN UINTN TokenNumber
)
{
- return GetPcdProtocol()->GetSize (TokenNumber);
+ return GetPcdProtocol ()->GetSize (TokenNumber);
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -301,16 +288,15 @@ LibPcdGetSize (
UINT8
EFIAPI
LibPcdGetEx8 (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber
)
{
ASSERT (Guid != NULL);
- return GetPiPcdProtocol()->Get8 (Guid, TokenNumber);
+ return GetPiPcdProtocol ()->Get8 (Guid, TokenNumber);
}
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -328,16 +314,15 @@ LibPcdGetEx8 (
UINT16
EFIAPI
LibPcdGetEx16 (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber
)
{
ASSERT (Guid != NULL);
- return GetPiPcdProtocol()->Get16 (Guid, TokenNumber);
+ return GetPiPcdProtocol ()->Get16 (Guid, TokenNumber);
}
-
/**
Returns the 32-bit value for the token specified by TokenNumber and Guid.
If Guid is NULL, then ASSERT().
@@ -352,17 +337,15 @@ LibPcdGetEx16 (
UINT32
EFIAPI
LibPcdGetEx32 (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber
)
{
ASSERT (Guid != NULL);
- return GetPiPcdProtocol()->Get32 (Guid, TokenNumber);
+ return GetPiPcdProtocol ()->Get32 (Guid, TokenNumber);
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -380,17 +363,15 @@ LibPcdGetEx32 (
UINT64
EFIAPI
LibPcdGetEx64 (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber
)
{
ASSERT (Guid != NULL);
- return GetPiPcdProtocol()->Get64 (Guid, TokenNumber);
+ return GetPiPcdProtocol ()->Get64 (Guid, TokenNumber);
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -408,17 +389,15 @@ LibPcdGetEx64 (
VOID *
EFIAPI
LibPcdGetExPtr (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber
)
{
ASSERT (Guid != NULL);
- return GetPiPcdProtocol()->GetPtr (Guid, TokenNumber);
+ return GetPiPcdProtocol ()->GetPtr (Guid, TokenNumber);
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -436,17 +415,15 @@ LibPcdGetExPtr (
BOOLEAN
EFIAPI
LibPcdGetExBool (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber
)
{
ASSERT (Guid != NULL);
- return GetPiPcdProtocol()->GetBool (Guid, TokenNumber);
+ return GetPiPcdProtocol ()->GetBool (Guid, TokenNumber);
}
-
-
/**
This function provides a means by which to retrieve the size of a given PCD token.
@@ -464,16 +441,15 @@ LibPcdGetExBool (
UINTN
EFIAPI
LibPcdGetExSize (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber
)
{
ASSERT (Guid != NULL);
- return GetPiPcdProtocol()->GetSize (Guid, TokenNumber);
+ return GetPiPcdProtocol ()->GetSize (Guid, TokenNumber);
}
-
/**
This function provides a means by which to set a value for a given PCD token.
@@ -489,11 +465,11 @@ LibPcdGetExSize (
RETURN_STATUS
EFIAPI
LibPcdSet8S (
- IN UINTN TokenNumber,
- IN UINT8 Value
+ IN UINTN TokenNumber,
+ IN UINT8 Value
)
{
- return GetPcdProtocol()->Set8 (TokenNumber, Value);
+ return GetPcdProtocol ()->Set8 (TokenNumber, Value);
}
/**
@@ -511,11 +487,11 @@ LibPcdSet8S (
RETURN_STATUS
EFIAPI
LibPcdSet16S (
- IN UINTN TokenNumber,
- IN UINT16 Value
+ IN UINTN TokenNumber,
+ IN UINT16 Value
)
{
- return GetPcdProtocol()->Set16 (TokenNumber, Value);
+ return GetPcdProtocol ()->Set16 (TokenNumber, Value);
}
/**
@@ -533,11 +509,11 @@ LibPcdSet16S (
RETURN_STATUS
EFIAPI
LibPcdSet32S (
- IN UINTN TokenNumber,
- IN UINT32 Value
+ IN UINTN TokenNumber,
+ IN UINT32 Value
)
{
- return GetPcdProtocol()->Set32 (TokenNumber, Value);
+ return GetPcdProtocol ()->Set32 (TokenNumber, Value);
}
/**
@@ -555,11 +531,11 @@ LibPcdSet32S (
RETURN_STATUS
EFIAPI
LibPcdSet64S (
- IN UINTN TokenNumber,
- IN UINT64 Value
+ IN UINTN TokenNumber,
+ IN UINT64 Value
)
{
- return GetPcdProtocol()->Set64 (TokenNumber, Value);
+ return GetPcdProtocol ()->Set64 (TokenNumber, Value);
}
/**
@@ -587,9 +563,9 @@ LibPcdSet64S (
RETURN_STATUS
EFIAPI
LibPcdSetPtrS (
- IN UINTN TokenNumber,
- IN OUT UINTN *SizeOfBuffer,
- IN CONST VOID *Buffer
+ IN UINTN TokenNumber,
+ IN OUT UINTN *SizeOfBuffer,
+ IN CONST VOID *Buffer
)
{
ASSERT (SizeOfBuffer != NULL);
@@ -598,7 +574,7 @@ LibPcdSetPtrS (
ASSERT (Buffer != NULL);
}
- return GetPcdProtocol()->SetPtr (TokenNumber, SizeOfBuffer, (VOID *) Buffer);
+ return GetPcdProtocol ()->SetPtr (TokenNumber, SizeOfBuffer, (VOID *)Buffer);
}
/**
@@ -616,11 +592,11 @@ LibPcdSetPtrS (
RETURN_STATUS
EFIAPI
LibPcdSetBoolS (
- IN UINTN TokenNumber,
- IN BOOLEAN Value
+ IN UINTN TokenNumber,
+ IN BOOLEAN Value
)
{
- return GetPcdProtocol()->SetBool (TokenNumber, Value);
+ return GetPcdProtocol ()->SetBool (TokenNumber, Value);
}
/**
@@ -642,14 +618,14 @@ LibPcdSetBoolS (
RETURN_STATUS
EFIAPI
LibPcdSetEx8S (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber,
- IN UINT8 Value
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ IN UINT8 Value
)
{
ASSERT (Guid != NULL);
- return GetPiPcdProtocol()->Set8 (Guid, TokenNumber, Value);
+ return GetPiPcdProtocol ()->Set8 (Guid, TokenNumber, Value);
}
/**
@@ -671,14 +647,14 @@ LibPcdSetEx8S (
RETURN_STATUS
EFIAPI
LibPcdSetEx16S (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber,
- IN UINT16 Value
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ IN UINT16 Value
)
{
ASSERT (Guid != NULL);
- return GetPiPcdProtocol()->Set16 (Guid, TokenNumber, Value);
+ return GetPiPcdProtocol ()->Set16 (Guid, TokenNumber, Value);
}
/**
@@ -700,14 +676,14 @@ LibPcdSetEx16S (
RETURN_STATUS
EFIAPI
LibPcdSetEx32S (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber,
- IN UINT32 Value
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ IN UINT32 Value
)
{
ASSERT (Guid != NULL);
- return GetPiPcdProtocol()->Set32 (Guid, TokenNumber, Value);
+ return GetPiPcdProtocol ()->Set32 (Guid, TokenNumber, Value);
}
/**
@@ -729,14 +705,14 @@ LibPcdSetEx32S (
RETURN_STATUS
EFIAPI
LibPcdSetEx64S (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber,
- IN UINT64 Value
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ IN UINT64 Value
)
{
ASSERT (Guid != NULL);
- return GetPiPcdProtocol()->Set64 (Guid, TokenNumber, Value);
+ return GetPiPcdProtocol ()->Set64 (Guid, TokenNumber, Value);
}
/**
@@ -764,10 +740,10 @@ LibPcdSetEx64S (
RETURN_STATUS
EFIAPI
LibPcdSetExPtrS (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber,
- IN OUT UINTN *SizeOfBuffer,
- IN VOID *Buffer
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ IN OUT UINTN *SizeOfBuffer,
+ IN VOID *Buffer
)
{
ASSERT (Guid != NULL);
@@ -778,7 +754,7 @@ LibPcdSetExPtrS (
ASSERT (Buffer != NULL);
}
- return GetPiPcdProtocol()->SetPtr (Guid, TokenNumber, SizeOfBuffer, Buffer);
+ return GetPiPcdProtocol ()->SetPtr (Guid, TokenNumber, SizeOfBuffer, Buffer);
}
/**
@@ -800,14 +776,14 @@ LibPcdSetExPtrS (
RETURN_STATUS
EFIAPI
LibPcdSetExBoolS (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber,
- IN BOOLEAN Value
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ IN BOOLEAN Value
)
{
ASSERT (Guid != NULL);
- return GetPiPcdProtocol()->SetBool (Guid, TokenNumber, Value);
+ return GetPiPcdProtocol ()->SetBool (Guid, TokenNumber, Value);
}
/**
@@ -829,23 +805,21 @@ LibPcdSetExBoolS (
VOID
EFIAPI
LibPcdCallbackOnSet (
- IN CONST GUID *Guid OPTIONAL,
- IN UINTN TokenNumber,
- IN PCD_CALLBACK NotificationFunction
+ IN CONST GUID *Guid OPTIONAL,
+ IN UINTN TokenNumber,
+ IN PCD_CALLBACK NotificationFunction
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
ASSERT (NotificationFunction != NULL);
- Status = GetPiPcdProtocol()->CallbackOnSet (Guid, TokenNumber, (EFI_PCD_PROTOCOL_CALLBACK) NotificationFunction);
+ Status = GetPiPcdProtocol ()->CallbackOnSet (Guid, TokenNumber, (EFI_PCD_PROTOCOL_CALLBACK)NotificationFunction);
ASSERT_EFI_ERROR (Status);
return;
}
-
-
/**
Disable a notification function that was established with LibPcdCallbackonSet().
@@ -862,23 +836,21 @@ LibPcdCallbackOnSet (
VOID
EFIAPI
LibPcdCancelCallback (
- IN CONST GUID *Guid OPTIONAL,
- IN UINTN TokenNumber,
- IN PCD_CALLBACK NotificationFunction
+ IN CONST GUID *Guid OPTIONAL,
+ IN UINTN TokenNumber,
+ IN PCD_CALLBACK NotificationFunction
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
ASSERT (NotificationFunction != NULL);
- Status = GetPiPcdProtocol()->CancelCallback (Guid, TokenNumber, (EFI_PCD_PROTOCOL_CALLBACK) NotificationFunction);
+ Status = GetPiPcdProtocol ()->CancelCallback (Guid, TokenNumber, (EFI_PCD_PROTOCOL_CALLBACK)NotificationFunction);
ASSERT_EFI_ERROR (Status);
return;
}
-
-
/**
Retrieves the next token in a token space.
@@ -901,20 +873,18 @@ LibPcdCancelCallback (
UINTN
EFIAPI
LibPcdGetNextToken (
- IN CONST GUID *Guid OPTIONAL,
- IN UINTN TokenNumber
+ IN CONST GUID *Guid OPTIONAL,
+ IN UINTN TokenNumber
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- Status = GetPiPcdProtocol()->GetNextToken (Guid, &TokenNumber);
+ Status = GetPiPcdProtocol ()->GetNextToken (Guid, &TokenNumber);
ASSERT (!EFI_ERROR (Status) || TokenNumber == 0);
return TokenNumber;
}
-
-
/**
Used to retrieve the list of available PCD token space GUIDs.
@@ -934,12 +904,11 @@ LibPcdGetNextTokenSpace (
IN CONST GUID *TokenSpaceGuid
)
{
- GetPiPcdProtocol()->GetNextTokenSpace (&TokenSpaceGuid);
+ GetPiPcdProtocol ()->GetNextTokenSpace (&TokenSpaceGuid);
return (GUID *)TokenSpaceGuid;
}
-
/**
Sets a value of a patchable PCD entry that is type pointer.
@@ -966,10 +935,10 @@ LibPcdGetNextTokenSpace (
VOID *
EFIAPI
LibPatchPcdSetPtr (
- OUT VOID *PatchVariable,
- IN UINTN MaximumDatumSize,
- IN OUT UINTN *SizeOfBuffer,
- IN CONST VOID *Buffer
+ OUT VOID *PatchVariable,
+ IN UINTN MaximumDatumSize,
+ IN OUT UINTN *SizeOfBuffer,
+ IN CONST VOID *Buffer
)
{
ASSERT (PatchVariable != NULL);
@@ -980,14 +949,15 @@ LibPatchPcdSetPtr (
}
if ((*SizeOfBuffer > MaximumDatumSize) ||
- (*SizeOfBuffer == MAX_ADDRESS)) {
+ (*SizeOfBuffer == MAX_ADDRESS))
+ {
*SizeOfBuffer = MaximumDatumSize;
return NULL;
}
CopyMem (PatchVariable, Buffer, *SizeOfBuffer);
- return (VOID *) Buffer;
+ return (VOID *)Buffer;
}
/**
@@ -1016,10 +986,10 @@ LibPatchPcdSetPtr (
RETURN_STATUS
EFIAPI
LibPatchPcdSetPtrS (
- OUT VOID *PatchVariable,
- IN UINTN MaximumDatumSize,
- IN OUT UINTN *SizeOfBuffer,
- IN CONST VOID *Buffer
+ OUT VOID *PatchVariable,
+ IN UINTN MaximumDatumSize,
+ IN OUT UINTN *SizeOfBuffer,
+ IN CONST VOID *Buffer
)
{
ASSERT (PatchVariable != NULL);
@@ -1030,7 +1000,8 @@ LibPatchPcdSetPtrS (
}
if ((*SizeOfBuffer > MaximumDatumSize) ||
- (*SizeOfBuffer == MAX_ADDRESS)) {
+ (*SizeOfBuffer == MAX_ADDRESS))
+ {
*SizeOfBuffer = MaximumDatumSize;
return RETURN_INVALID_PARAMETER;
}
@@ -1040,7 +1011,6 @@ LibPatchPcdSetPtrS (
return RETURN_SUCCESS;
}
-
/**
Sets a value and size of a patchable PCD entry that is type pointer.
@@ -1069,11 +1039,11 @@ LibPatchPcdSetPtrS (
VOID *
EFIAPI
LibPatchPcdSetPtrAndSize (
- OUT VOID *PatchVariable,
- OUT UINTN *SizeOfPatchVariable,
- IN UINTN MaximumDatumSize,
- IN OUT UINTN *SizeOfBuffer,
- IN CONST VOID *Buffer
+ OUT VOID *PatchVariable,
+ OUT UINTN *SizeOfPatchVariable,
+ IN UINTN MaximumDatumSize,
+ IN OUT UINTN *SizeOfBuffer,
+ IN CONST VOID *Buffer
)
{
ASSERT (PatchVariable != NULL);
@@ -1085,7 +1055,8 @@ LibPatchPcdSetPtrAndSize (
}
if ((*SizeOfBuffer > MaximumDatumSize) ||
- (*SizeOfBuffer == MAX_ADDRESS)) {
+ (*SizeOfBuffer == MAX_ADDRESS))
+ {
*SizeOfBuffer = MaximumDatumSize;
return NULL;
}
@@ -1093,7 +1064,7 @@ LibPatchPcdSetPtrAndSize (
CopyMem (PatchVariable, Buffer, *SizeOfBuffer);
*SizeOfPatchVariable = *SizeOfBuffer;
- return (VOID *) Buffer;
+ return (VOID *)Buffer;
}
/**
@@ -1124,11 +1095,11 @@ LibPatchPcdSetPtrAndSize (
RETURN_STATUS
EFIAPI
LibPatchPcdSetPtrAndSizeS (
- OUT VOID *PatchVariable,
- OUT UINTN *SizeOfPatchVariable,
- IN UINTN MaximumDatumSize,
- IN OUT UINTN *SizeOfBuffer,
- IN CONST VOID *Buffer
+ OUT VOID *PatchVariable,
+ OUT UINTN *SizeOfPatchVariable,
+ IN UINTN MaximumDatumSize,
+ IN OUT UINTN *SizeOfBuffer,
+ IN CONST VOID *Buffer
)
{
ASSERT (PatchVariable != NULL);
@@ -1140,7 +1111,8 @@ LibPatchPcdSetPtrAndSizeS (
}
if ((*SizeOfBuffer > MaximumDatumSize) ||
- (*SizeOfBuffer == MAX_ADDRESS)) {
+ (*SizeOfBuffer == MAX_ADDRESS))
+ {
*SizeOfBuffer = MaximumDatumSize;
return RETURN_INVALID_PARAMETER;
}
@@ -1166,13 +1138,13 @@ LibPatchPcdSetPtrAndSizeS (
VOID
EFIAPI
LibPcdGetInfo (
- IN UINTN TokenNumber,
- OUT PCD_INFO *PcdInfo
+ IN UINTN TokenNumber,
+ OUT PCD_INFO *PcdInfo
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- Status = GetPcdInfoProtocolPointer()->GetInfo (TokenNumber, (EFI_PCD_INFO *) PcdInfo);
+ Status = GetPcdInfoProtocolPointer ()->GetInfo (TokenNumber, (EFI_PCD_INFO *)PcdInfo);
ASSERT_EFI_ERROR (Status);
}
@@ -1192,14 +1164,14 @@ LibPcdGetInfo (
VOID
EFIAPI
LibPcdGetInfoEx (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber,
- OUT PCD_INFO *PcdInfo
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ OUT PCD_INFO *PcdInfo
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- Status = GetPiPcdInfoProtocolPointer()->GetInfo (Guid, TokenNumber, (EFI_PCD_INFO *) PcdInfo);
+ Status = GetPiPcdInfoProtocolPointer ()->GetInfo (Guid, TokenNumber, (EFI_PCD_INFO *)PcdInfo);
ASSERT_EFI_ERROR (Status);
}
@@ -1216,5 +1188,5 @@ LibPcdGetSku (
VOID
)
{
- return GetPiPcdInfoProtocolPointer()->GetSku ();
+ return GetPiPcdInfoProtocolPointer ()->GetSku ();
}
diff --git a/MdePkg/Library/DxeRngLib/DxeRngLib.c b/MdePkg/Library/DxeRngLib/DxeRngLib.c
index 9c3d67b5a6..82129aa445 100644
--- a/MdePkg/Library/DxeRngLib/DxeRngLib.c
+++ b/MdePkg/Library/DxeRngLib/DxeRngLib.c
@@ -37,46 +37,47 @@ GenerateRandomNumberViaNist800Algorithm (
RngProtocol = NULL;
if (Buffer == NULL) {
- DEBUG((DEBUG_ERROR, "%a: Buffer == NULL.\n", __FUNCTION__));
- return EFI_INVALID_PARAMETER;
+ DEBUG ((DEBUG_ERROR, "%a: Buffer == NULL.\n", __FUNCTION__));
+ return EFI_INVALID_PARAMETER;
}
Status = gBS->LocateProtocol (&gEfiRngProtocolGuid, NULL, (VOID **)&RngProtocol);
- if (EFI_ERROR (Status) || RngProtocol == NULL) {
- DEBUG((DEBUG_ERROR, "%a: Could not locate RNG prototocol, Status = %r\n", __FUNCTION__, Status));
- return Status;
+ if (EFI_ERROR (Status) || (RngProtocol == NULL)) {
+ DEBUG ((DEBUG_ERROR, "%a: Could not locate RNG prototocol, Status = %r\n", __FUNCTION__, Status));
+ return Status;
}
Status = RngProtocol->GetRNG (RngProtocol, &gEfiRngAlgorithmSp80090Ctr256Guid, BufferSize, Buffer);
- DEBUG((DEBUG_INFO, "%a: GetRNG algorithm CTR-256 - Status = %r\n", __FUNCTION__, Status));
+ DEBUG ((DEBUG_INFO, "%a: GetRNG algorithm CTR-256 - Status = %r\n", __FUNCTION__, Status));
if (!EFI_ERROR (Status)) {
return Status;
}
Status = RngProtocol->GetRNG (RngProtocol, &gEfiRngAlgorithmSp80090Hmac256Guid, BufferSize, Buffer);
- DEBUG((DEBUG_INFO, "%a: GetRNG algorithm HMAC-256 - Status = %r\n", __FUNCTION__, Status));
+ DEBUG ((DEBUG_INFO, "%a: GetRNG algorithm HMAC-256 - Status = %r\n", __FUNCTION__, Status));
if (!EFI_ERROR (Status)) {
return Status;
}
Status = RngProtocol->GetRNG (RngProtocol, &gEfiRngAlgorithmSp80090Hash256Guid, BufferSize, Buffer);
- DEBUG((DEBUG_INFO, "%a: GetRNG algorithm Hash-256 - Status = %r\n", __FUNCTION__, Status));
+ DEBUG ((DEBUG_INFO, "%a: GetRNG algorithm Hash-256 - Status = %r\n", __FUNCTION__, Status));
if (!EFI_ERROR (Status)) {
return Status;
}
+
// If all the other methods have failed, use the default method from the RngProtocol
Status = RngProtocol->GetRNG (RngProtocol, NULL, BufferSize, Buffer);
- DEBUG((DEBUG_INFO, "%a: GetRNG algorithm Hash-256 - Status = %r\n", __FUNCTION__, Status));
+ DEBUG ((DEBUG_INFO, "%a: GetRNG algorithm Hash-256 - Status = %r\n", __FUNCTION__, Status));
if (!EFI_ERROR (Status)) {
return Status;
}
+
// If we get to this point, we have failed
- DEBUG((DEBUG_ERROR, "%a: GetRNG() failed, staus = %r\n", __FUNCTION__, Status));
+ DEBUG ((DEBUG_ERROR, "%a: GetRNG() failed, staus = %r\n", __FUNCTION__, Status));
return Status;
}// GenerateRandomNumberViaNist800Algorithm()
-
/**
Generates a 16-bit random number.
@@ -94,17 +95,17 @@ GetRandomNumber16 (
OUT UINT16 *Rand
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- if (Rand == NULL)
- {
+ if (Rand == NULL) {
return FALSE;
}
- Status = GenerateRandomNumberViaNist800Algorithm ((UINT8 *)Rand, sizeof(UINT16));
+ Status = GenerateRandomNumberViaNist800Algorithm ((UINT8 *)Rand, sizeof (UINT16));
if (EFI_ERROR (Status)) {
return FALSE;
}
+
return TRUE;
}
@@ -122,19 +123,20 @@ GetRandomNumber16 (
BOOLEAN
EFIAPI
GetRandomNumber32 (
- OUT UINT32 *Rand
+ OUT UINT32 *Rand
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
if (Rand == NULL) {
return FALSE;
}
- Status = GenerateRandomNumberViaNist800Algorithm ((UINT8*)Rand, sizeof(UINT32));
+ Status = GenerateRandomNumberViaNist800Algorithm ((UINT8 *)Rand, sizeof (UINT32));
if (EFI_ERROR (Status)) {
return FALSE;
}
+
return TRUE;
}
@@ -152,19 +154,20 @@ GetRandomNumber32 (
BOOLEAN
EFIAPI
GetRandomNumber64 (
- OUT UINT64 *Rand
+ OUT UINT64 *Rand
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
if (Rand == NULL) {
return FALSE;
}
- Status = GenerateRandomNumberViaNist800Algorithm ((UINT8*)Rand, sizeof(UINT64));
+ Status = GenerateRandomNumberViaNist800Algorithm ((UINT8 *)Rand, sizeof (UINT64));
if (EFI_ERROR (Status)) {
return FALSE;
}
+
return TRUE;
}
@@ -182,18 +185,19 @@ GetRandomNumber64 (
BOOLEAN
EFIAPI
GetRandomNumber128 (
- OUT UINT64 *Rand
+ OUT UINT64 *Rand
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
if (Rand == NULL) {
return FALSE;
}
- Status = GenerateRandomNumberViaNist800Algorithm ((UINT8*)Rand, 2 * sizeof(UINT64));
+ Status = GenerateRandomNumberViaNist800Algorithm ((UINT8 *)Rand, 2 * sizeof (UINT64));
if (EFI_ERROR (Status)) {
return FALSE;
}
+
return TRUE;
}
diff --git a/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c b/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c
index cc79843b1c..11d188d07f 100644
--- a/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c
+++ b/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c
@@ -20,8 +20,8 @@
#include <Library/BaseMemoryLib.h>
#include <Library/SerialPortLib.h>
-STATIC EFI_EVENT mEfiExitBootServicesEvent;
-STATIC BOOLEAN mEfiAtRuntime = FALSE;
+STATIC EFI_EVENT mEfiExitBootServicesEvent;
+STATIC BOOLEAN mEfiAtRuntime = FALSE;
//
// Define the maximum debug and assert message length that this library supports
@@ -32,7 +32,7 @@ STATIC BOOLEAN mEfiAtRuntime = FALSE;
// VA_LIST can not initialize to NULL for all compiler, so we use this to
// indicate a null VA_LIST
//
-VA_LIST mVaListNull;
+VA_LIST mVaListNull;
/**
Set AtRuntime flag as TRUE after ExitBootServices.
@@ -45,8 +45,8 @@ STATIC
VOID
EFIAPI
ExitBootServicesEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
mEfiAtRuntime = TRUE;
@@ -70,16 +70,20 @@ DxeRuntimeDebugLibSerialPortConstructor (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
Status = SerialPortInitialize ();
if (EFI_ERROR (Status)) {
return Status;
}
- return SystemTable->BootServices->CreateEvent (EVT_SIGNAL_EXIT_BOOT_SERVICES,
- TPL_NOTIFY, ExitBootServicesEvent, NULL,
- &mEfiExitBootServicesEvent);
+ return SystemTable->BootServices->CreateEvent (
+ EVT_SIGNAL_EXIT_BOOT_SERVICES,
+ TPL_NOTIFY,
+ ExitBootServicesEvent,
+ NULL,
+ &mEfiExitBootServicesEvent
+ );
}
/**
@@ -125,14 +129,13 @@ DebugPrint (
...
)
{
- VA_LIST Marker;
+ VA_LIST Marker;
VA_START (Marker, Format);
DebugVPrint (ErrorLevel, Format, Marker);
VA_END (Marker);
}
-
/**
Prints a debug message to the debug output device if the specified
error level is enabled base on Null-terminated format string and a
@@ -152,13 +155,13 @@ DebugPrint (
**/
VOID
DebugPrintMarker (
- IN UINTN ErrorLevel,
- IN CONST CHAR8 *Format,
- IN VA_LIST VaListMarker,
- IN BASE_LIST BaseListMarker
+ IN UINTN ErrorLevel,
+ IN CONST CHAR8 *Format,
+ IN VA_LIST VaListMarker,
+ IN BASE_LIST BaseListMarker
)
{
- CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];
+ CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];
if (mEfiAtRuntime) {
return;
@@ -191,7 +194,6 @@ DebugPrintMarker (
SerialPortWrite ((UINT8 *)Buffer, AsciiStrLen (Buffer));
}
-
/**
Prints a debug message to the debug output device if the specified
error level is enabled.
@@ -210,15 +212,14 @@ DebugPrintMarker (
VOID
EFIAPI
DebugVPrint (
- IN UINTN ErrorLevel,
- IN CONST CHAR8 *Format,
- IN VA_LIST VaListMarker
+ IN UINTN ErrorLevel,
+ IN CONST CHAR8 *Format,
+ IN VA_LIST VaListMarker
)
{
DebugPrintMarker (ErrorLevel, Format, VaListMarker, NULL);
}
-
/**
Prints a debug message to the debug output device if the specified
error level is enabled.
@@ -239,15 +240,14 @@ DebugVPrint (
VOID
EFIAPI
DebugBPrint (
- IN UINTN ErrorLevel,
- IN CONST CHAR8 *Format,
- IN BASE_LIST BaseListMarker
+ IN UINTN ErrorLevel,
+ IN CONST CHAR8 *Format,
+ IN BASE_LIST BaseListMarker
)
{
DebugPrintMarker (ErrorLevel, Format, mVaListNull, BaseListMarker);
}
-
/**
Prints an assert message containing a filename, line number, and description.
This may be followed by a breakpoint or a dead loop.
@@ -282,8 +282,15 @@ DebugAssert (
//
// Generate the ASSERT() message in Ascii format
//
- AsciiSPrint (Buffer, sizeof (Buffer), "ASSERT [%a] %a(%d): %a\n",
- gEfiCallerBaseName, FileName, LineNumber, Description);
+ AsciiSPrint (
+ Buffer,
+ sizeof (Buffer),
+ "ASSERT [%a] %a(%d): %a\n",
+ gEfiCallerBaseName,
+ FileName,
+ LineNumber,
+ Description
+ );
if (!mEfiAtRuntime) {
//
@@ -295,14 +302,13 @@ DebugAssert (
//
// Generate a Breakpoint, DeadLoop, or NOP based on PCD settings
//
- if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {
+ if ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {
CpuBreakpoint ();
- } else if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {
+ } else if ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {
CpuDeadLoop ();
}
}
-
/**
Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer.
@@ -333,10 +339,9 @@ DebugClearMemory (
//
// SetMem() checks for the the ASSERT() condition on Length and returns Buffer
//
- return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue));
+ return SetMem (Buffer, Length, PcdGet8 (PcdDebugClearMemoryValue));
}
-
/**
Returns TRUE if ASSERT() macros are enabled.
@@ -353,10 +358,9 @@ DebugAssertEnabled (
VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
}
-
/**
Returns TRUE if DEBUG() macros are enabled.
@@ -373,10 +377,9 @@ DebugPrintEnabled (
VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
}
-
/**
Returns TRUE if DEBUG_CODE() macros are enabled.
@@ -393,10 +396,9 @@ DebugCodeEnabled (
VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
}
-
/**
Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
@@ -413,7 +415,7 @@ DebugClearMemoryEnabled (
VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
}
/**
@@ -428,8 +430,8 @@ DebugClearMemoryEnabled (
BOOLEAN
EFIAPI
DebugPrintLevelEnabled (
- IN CONST UINTN ErrorLevel
+ IN CONST UINTN ErrorLevel
)
{
- return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0);
+ return (BOOLEAN)((ErrorLevel & PcdGet32 (PcdFixedDebugPrintErrorLevel)) != 0);
}
diff --git a/MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c b/MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c
index cb80725c5f..a9f380776c 100644
--- a/MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c
+++ b/MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c
@@ -10,7 +10,6 @@
**/
-
#include <PiDxe.h>
#include <Guid/EventGroup.h>
@@ -39,25 +38,25 @@
/// Define table for mapping PCI Express MMIO physical addresses to virtual addresses at OS runtime
///
typedef struct {
- UINTN PhysicalAddress;
- UINTN VirtualAddress;
+ UINTN PhysicalAddress;
+ UINTN VirtualAddress;
} PCI_EXPRESS_RUNTIME_REGISTRATION_TABLE;
///
/// Set Virtual Address Map Event
///
-EFI_EVENT mDxeRuntimePciExpressLibVirtualNotifyEvent = NULL;
+EFI_EVENT mDxeRuntimePciExpressLibVirtualNotifyEvent = NULL;
///
/// Module global that contains the base physical address and size of the PCI Express MMIO range.
///
-UINTN mDxeRuntimePciExpressLibPciExpressBaseAddress = 0;
-UINTN mDxeRuntimePciExpressLibPciExpressBaseSize = 0;
+UINTN mDxeRuntimePciExpressLibPciExpressBaseAddress = 0;
+UINTN mDxeRuntimePciExpressLibPciExpressBaseSize = 0;
///
/// The number of PCI devices that have been registered for runtime access.
///
-UINTN mDxeRuntimePciExpressLibNumberOfRuntimeRanges = 0;
+UINTN mDxeRuntimePciExpressLibNumberOfRuntimeRanges = 0;
///
/// The table of PCI devices that have been registered for runtime access.
@@ -67,8 +66,7 @@ PCI_EXPRESS_RUNTIME_REGISTRATION_TABLE *mDxeRuntimePciExpressLibRegistrationTab
///
/// The table index of the most recent virtual address lookup.
///
-UINTN mDxeRuntimePciExpressLibLastRuntimeRange = 0;
-
+UINTN mDxeRuntimePciExpressLibLastRuntimeRange = 0;
/**
Convert the physical PCI Express MMIO addresses for all registered PCI devices
@@ -98,13 +96,13 @@ DxeRuntimePciExpressLibVirtualNotify (
// virtual addresses.
//
for (Index = 0; Index < mDxeRuntimePciExpressLibNumberOfRuntimeRanges; Index++) {
- EfiConvertPointer (0, (VOID **) &(mDxeRuntimePciExpressLibRegistrationTable[Index].VirtualAddress));
+ EfiConvertPointer (0, (VOID **)&(mDxeRuntimePciExpressLibRegistrationTable[Index].VirtualAddress));
}
//
// Convert table pointer that is allocated from EfiRuntimeServicesData to a virtual address.
//
- EfiConvertPointer (0, (VOID **) &mDxeRuntimePciExpressLibRegistrationTable);
+ EfiConvertPointer (0, (VOID **)&mDxeRuntimePciExpressLibRegistrationTable);
}
/**
@@ -130,8 +128,8 @@ DxeRuntimePciExpressLibConstructor (
//
// Cache the physical address of the PCI Express MMIO range into a module global variable
//
- mDxeRuntimePciExpressLibPciExpressBaseAddress = (UINTN) PcdGet64 (PcdPciExpressBaseAddress);
- mDxeRuntimePciExpressLibPciExpressBaseSize = (UINTN) PcdGet64 (PcdPciExpressBaseSize);
+ mDxeRuntimePciExpressLibPciExpressBaseAddress = (UINTN)PcdGet64 (PcdPciExpressBaseAddress);
+ mDxeRuntimePciExpressLibPciExpressBaseSize = (UINTN)PcdGet64 (PcdPciExpressBaseSize);
//
// Register SetVirtualAddressMap () notify function
@@ -215,7 +213,7 @@ GetPciExpressAddress (
// Make sure the Address is in MMCONF address space
//
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINTN) -1;
+ return (UINTN)-1;
}
//
@@ -259,7 +257,7 @@ GetPciExpressAddress (
//
// No match was found. This is a critical error at OS runtime, so ASSERT() and force a breakpoint.
//
- CpuBreakpoint();
+ CpuBreakpoint ();
//
// Return the physical address
@@ -310,7 +308,7 @@ PciExpressRegisterForRuntimeAccess (
//
// Make sure Address is valid
//
- ASSERT_INVALID_PCI_ADDRESS (Address);
+ ASSERT_INVALID_PCI_ADDRESS (Address);
//
// Make sure the Address is in MMCONF address space
@@ -363,7 +361,8 @@ PciExpressRegisterForRuntimeAccess (
if (NewTable == NULL) {
return RETURN_OUT_OF_RESOURCES;
}
- mDxeRuntimePciExpressLibRegistrationTable = NewTable;
+
+ mDxeRuntimePciExpressLibRegistrationTable = NewTable;
mDxeRuntimePciExpressLibRegistrationTable[mDxeRuntimePciExpressLibNumberOfRuntimeRanges].PhysicalAddress = Address;
mDxeRuntimePciExpressLibRegistrationTable[mDxeRuntimePciExpressLibNumberOfRuntimeRanges].VirtualAddress = Address;
mDxeRuntimePciExpressLibNumberOfRuntimeRanges++;
@@ -371,7 +370,6 @@ PciExpressRegisterForRuntimeAccess (
return RETURN_SUCCESS;
}
-
/**
Reads an 8-bit PCI configuration register.
@@ -390,13 +388,14 @@ PciExpressRegisterForRuntimeAccess (
UINT8
EFIAPI
PciExpressRead8 (
- IN UINTN Address
+ IN UINTN Address
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT8) -1;
+ return (UINT8)-1;
}
+
return MmioRead8 (GetPciExpressAddress (Address));
}
@@ -420,13 +419,14 @@ PciExpressRead8 (
UINT8
EFIAPI
PciExpressWrite8 (
- IN UINTN Address,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINT8 Value
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT8) -1;
+ return (UINT8)-1;
}
+
return MmioWrite8 (GetPciExpressAddress (Address), Value);
}
@@ -454,13 +454,14 @@ PciExpressWrite8 (
UINT8
EFIAPI
PciExpressOr8 (
- IN UINTN Address,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 OrData
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT8) -1;
+ return (UINT8)-1;
}
+
return MmioOr8 (GetPciExpressAddress (Address), OrData);
}
@@ -488,13 +489,14 @@ PciExpressOr8 (
UINT8
EFIAPI
PciExpressAnd8 (
- IN UINTN Address,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINT8 AndData
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT8) -1;
+ return (UINT8)-1;
}
+
return MmioAnd8 (GetPciExpressAddress (Address), AndData);
}
@@ -524,14 +526,15 @@ PciExpressAnd8 (
UINT8
EFIAPI
PciExpressAndThenOr8 (
- IN UINTN Address,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT8) -1;
+ return (UINT8)-1;
}
+
return MmioAndThenOr8 (
GetPciExpressAddress (Address),
AndData,
@@ -564,14 +567,15 @@ PciExpressAndThenOr8 (
UINT8
EFIAPI
PciExpressBitFieldRead8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT8) -1;
+ return (UINT8)-1;
}
+
return MmioBitFieldRead8 (
GetPciExpressAddress (Address),
StartBit,
@@ -607,15 +611,16 @@ PciExpressBitFieldRead8 (
UINT8
EFIAPI
PciExpressBitFieldWrite8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT8) -1;
+ return (UINT8)-1;
}
+
return MmioBitFieldWrite8 (
GetPciExpressAddress (Address),
StartBit,
@@ -655,15 +660,16 @@ PciExpressBitFieldWrite8 (
UINT8
EFIAPI
PciExpressBitFieldOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT8) -1;
+ return (UINT8)-1;
}
+
return MmioBitFieldOr8 (
GetPciExpressAddress (Address),
StartBit,
@@ -703,15 +709,16 @@ PciExpressBitFieldOr8 (
UINT8
EFIAPI
PciExpressBitFieldAnd8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT8) -1;
+ return (UINT8)-1;
}
+
return MmioBitFieldAnd8 (
GetPciExpressAddress (Address),
StartBit,
@@ -755,16 +762,17 @@ PciExpressBitFieldAnd8 (
UINT8
EFIAPI
PciExpressBitFieldAndThenOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT8) -1;
+ return (UINT8)-1;
}
+
return MmioBitFieldAndThenOr8 (
GetPciExpressAddress (Address),
StartBit,
@@ -794,12 +802,13 @@ PciExpressBitFieldAndThenOr8 (
UINT16
EFIAPI
PciExpressRead16 (
- IN UINTN Address
+ IN UINTN Address
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT16) -1;
+ return (UINT16)-1;
}
+
return MmioRead16 (GetPciExpressAddress (Address));
}
@@ -824,13 +833,14 @@ PciExpressRead16 (
UINT16
EFIAPI
PciExpressWrite16 (
- IN UINTN Address,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINT16 Value
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT16) -1;
+ return (UINT16)-1;
}
+
return MmioWrite16 (GetPciExpressAddress (Address), Value);
}
@@ -859,13 +869,14 @@ PciExpressWrite16 (
UINT16
EFIAPI
PciExpressOr16 (
- IN UINTN Address,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 OrData
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT16) -1;
+ return (UINT16)-1;
}
+
return MmioOr16 (GetPciExpressAddress (Address), OrData);
}
@@ -894,13 +905,14 @@ PciExpressOr16 (
UINT16
EFIAPI
PciExpressAnd16 (
- IN UINTN Address,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINT16 AndData
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT16) -1;
+ return (UINT16)-1;
}
+
return MmioAnd16 (GetPciExpressAddress (Address), AndData);
}
@@ -931,14 +943,15 @@ PciExpressAnd16 (
UINT16
EFIAPI
PciExpressAndThenOr16 (
- IN UINTN Address,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT16) -1;
+ return (UINT16)-1;
}
+
return MmioAndThenOr16 (
GetPciExpressAddress (Address),
AndData,
@@ -972,14 +985,15 @@ PciExpressAndThenOr16 (
UINT16
EFIAPI
PciExpressBitFieldRead16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT16) -1;
+ return (UINT16)-1;
}
+
return MmioBitFieldRead16 (
GetPciExpressAddress (Address),
StartBit,
@@ -1016,15 +1030,16 @@ PciExpressBitFieldRead16 (
UINT16
EFIAPI
PciExpressBitFieldWrite16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT16) -1;
+ return (UINT16)-1;
}
+
return MmioBitFieldWrite16 (
GetPciExpressAddress (Address),
StartBit,
@@ -1065,15 +1080,16 @@ PciExpressBitFieldWrite16 (
UINT16
EFIAPI
PciExpressBitFieldOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT16) -1;
+ return (UINT16)-1;
}
+
return MmioBitFieldOr16 (
GetPciExpressAddress (Address),
StartBit,
@@ -1114,15 +1130,16 @@ PciExpressBitFieldOr16 (
UINT16
EFIAPI
PciExpressBitFieldAnd16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT16) -1;
+ return (UINT16)-1;
}
+
return MmioBitFieldAnd16 (
GetPciExpressAddress (Address),
StartBit,
@@ -1167,16 +1184,17 @@ PciExpressBitFieldAnd16 (
UINT16
EFIAPI
PciExpressBitFieldAndThenOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT16) -1;
+ return (UINT16)-1;
}
+
return MmioBitFieldAndThenOr16 (
GetPciExpressAddress (Address),
StartBit,
@@ -1206,12 +1224,13 @@ PciExpressBitFieldAndThenOr16 (
UINT32
EFIAPI
PciExpressRead32 (
- IN UINTN Address
+ IN UINTN Address
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT32) -1;
+ return (UINT32)-1;
}
+
return MmioRead32 (GetPciExpressAddress (Address));
}
@@ -1236,13 +1255,14 @@ PciExpressRead32 (
UINT32
EFIAPI
PciExpressWrite32 (
- IN UINTN Address,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINT32 Value
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT32) -1;
+ return (UINT32)-1;
}
+
return MmioWrite32 (GetPciExpressAddress (Address), Value);
}
@@ -1271,13 +1291,14 @@ PciExpressWrite32 (
UINT32
EFIAPI
PciExpressOr32 (
- IN UINTN Address,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 OrData
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT32) -1;
+ return (UINT32)-1;
}
+
return MmioOr32 (GetPciExpressAddress (Address), OrData);
}
@@ -1306,13 +1327,14 @@ PciExpressOr32 (
UINT32
EFIAPI
PciExpressAnd32 (
- IN UINTN Address,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINT32 AndData
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT32) -1;
+ return (UINT32)-1;
}
+
return MmioAnd32 (GetPciExpressAddress (Address), AndData);
}
@@ -1343,14 +1365,15 @@ PciExpressAnd32 (
UINT32
EFIAPI
PciExpressAndThenOr32 (
- IN UINTN Address,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT32) -1;
+ return (UINT32)-1;
}
+
return MmioAndThenOr32 (
GetPciExpressAddress (Address),
AndData,
@@ -1384,14 +1407,15 @@ PciExpressAndThenOr32 (
UINT32
EFIAPI
PciExpressBitFieldRead32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT32) -1;
+ return (UINT32)-1;
}
+
return MmioBitFieldRead32 (
GetPciExpressAddress (Address),
StartBit,
@@ -1428,15 +1452,16 @@ PciExpressBitFieldRead32 (
UINT32
EFIAPI
PciExpressBitFieldWrite32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT32) -1;
+ return (UINT32)-1;
}
+
return MmioBitFieldWrite32 (
GetPciExpressAddress (Address),
StartBit,
@@ -1477,15 +1502,16 @@ PciExpressBitFieldWrite32 (
UINT32
EFIAPI
PciExpressBitFieldOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT32) -1;
+ return (UINT32)-1;
}
+
return MmioBitFieldOr32 (
GetPciExpressAddress (Address),
StartBit,
@@ -1526,15 +1552,16 @@ PciExpressBitFieldOr32 (
UINT32
EFIAPI
PciExpressBitFieldAnd32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT32) -1;
+ return (UINT32)-1;
}
+
return MmioBitFieldAnd32 (
GetPciExpressAddress (Address),
StartBit,
@@ -1579,16 +1606,17 @@ PciExpressBitFieldAnd32 (
UINT32
EFIAPI
PciExpressBitFieldAndThenOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINT32) -1;
+ return (UINT32)-1;
}
+
return MmioBitFieldAndThenOr32 (
GetPciExpressAddress (Address),
StartBit,
@@ -1625,12 +1653,12 @@ PciExpressBitFieldAndThenOr32 (
UINTN
EFIAPI
PciExpressReadBuffer (
- IN UINTN StartAddress,
- IN UINTN Size,
- OUT VOID *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Size,
+ OUT VOID *Buffer
)
{
- UINTN ReturnValue;
+ UINTN ReturnValue;
//
// Make sure Address is valid
@@ -1642,7 +1670,7 @@ PciExpressReadBuffer (
// Make sure the Address is in MMCONF address space
//
if (StartAddress >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINTN) -1;
+ return (UINTN)-1;
}
if (Size == 0) {
@@ -1661,41 +1689,41 @@ PciExpressReadBuffer (
// Read a byte if StartAddress is byte aligned
//
*(volatile UINT8 *)Buffer = PciExpressRead8 (StartAddress);
- StartAddress += sizeof (UINT8);
- Size -= sizeof (UINT8);
- Buffer = (UINT8*)Buffer + 1;
+ StartAddress += sizeof (UINT8);
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *)Buffer + 1;
}
- if (Size >= sizeof (UINT16) && (StartAddress & 2) != 0) {
+ if ((Size >= sizeof (UINT16)) && ((StartAddress & 2) != 0)) {
//
// Read a word if StartAddress is word aligned
//
- WriteUnaligned16 ((UINT16 *) Buffer, (UINT16) PciExpressRead16 (StartAddress));
+ WriteUnaligned16 ((UINT16 *)Buffer, (UINT16)PciExpressRead16 (StartAddress));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
while (Size >= sizeof (UINT32)) {
//
// Read as many double words as possible
//
- WriteUnaligned32 ((UINT32 *) Buffer, (UINT32) PciExpressRead32 (StartAddress));
+ WriteUnaligned32 ((UINT32 *)Buffer, (UINT32)PciExpressRead32 (StartAddress));
StartAddress += sizeof (UINT32);
- Size -= sizeof (UINT32);
- Buffer = (UINT32*)Buffer + 1;
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *)Buffer + 1;
}
if (Size >= sizeof (UINT16)) {
//
// Read the last remaining word if exist
//
- WriteUnaligned16 ((UINT16 *) Buffer, (UINT16) PciExpressRead16 (StartAddress));
+ WriteUnaligned16 ((UINT16 *)Buffer, (UINT16)PciExpressRead16 (StartAddress));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
if (Size >= sizeof (UINT8)) {
@@ -1736,12 +1764,12 @@ PciExpressReadBuffer (
UINTN
EFIAPI
PciExpressWriteBuffer (
- IN UINTN StartAddress,
- IN UINTN Size,
- IN VOID *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Size,
+ IN VOID *Buffer
)
{
- UINTN ReturnValue;
+ UINTN ReturnValue;
//
// Make sure Address is valid
@@ -1753,7 +1781,7 @@ PciExpressWriteBuffer (
// Make sure the Address is in MMCONF address space
//
if (StartAddress >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
- return (UINTN) -1;
+ return (UINTN)-1;
}
if (Size == 0) {
@@ -1771,47 +1799,47 @@ PciExpressWriteBuffer (
//
// Write a byte if StartAddress is byte aligned
//
- PciExpressWrite8 (StartAddress, *(UINT8*)Buffer);
+ PciExpressWrite8 (StartAddress, *(UINT8 *)Buffer);
StartAddress += sizeof (UINT8);
- Size -= sizeof (UINT8);
- Buffer = (UINT8*)Buffer + 1;
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *)Buffer + 1;
}
- if (Size >= sizeof (UINT16) && (StartAddress & 2) != 0) {
+ if ((Size >= sizeof (UINT16)) && ((StartAddress & 2) != 0)) {
//
// Write a word if StartAddress is word aligned
//
- PciExpressWrite16 (StartAddress, ReadUnaligned16 ((UINT16*)Buffer));
+ PciExpressWrite16 (StartAddress, ReadUnaligned16 ((UINT16 *)Buffer));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
while (Size >= sizeof (UINT32)) {
//
// Write as many double words as possible
//
- PciExpressWrite32 (StartAddress, ReadUnaligned32 ((UINT32*)Buffer));
+ PciExpressWrite32 (StartAddress, ReadUnaligned32 ((UINT32 *)Buffer));
StartAddress += sizeof (UINT32);
- Size -= sizeof (UINT32);
- Buffer = (UINT32*)Buffer + 1;
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *)Buffer + 1;
}
if (Size >= sizeof (UINT16)) {
//
// Write the last remaining word if exist
//
- PciExpressWrite16 (StartAddress, ReadUnaligned16 ((UINT16*)Buffer));
+ PciExpressWrite16 (StartAddress, ReadUnaligned16 ((UINT16 *)Buffer));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
if (Size >= sizeof (UINT8)) {
//
// Write the last remaining byte if exist
//
- PciExpressWrite8 (StartAddress, *(UINT8*)Buffer);
+ PciExpressWrite8 (StartAddress, *(UINT8 *)Buffer);
}
return ReturnValue;
diff --git a/MdePkg/Library/DxeServicesLib/Allocate.c b/MdePkg/Library/DxeServicesLib/Allocate.c
index efb65768bb..26f249b410 100644
--- a/MdePkg/Library/DxeServicesLib/Allocate.c
+++ b/MdePkg/Library/DxeServicesLib/Allocate.c
@@ -33,8 +33,8 @@ AllocatePeiAccessiblePages (
IN UINTN Pages
)
{
- EFI_STATUS Status;
- EFI_PHYSICAL_ADDRESS Memory;
+ EFI_STATUS Status;
+ EFI_PHYSICAL_ADDRESS Memory;
if (Pages == 0) {
return NULL;
@@ -44,5 +44,6 @@ AllocatePeiAccessiblePages (
if (EFI_ERROR (Status)) {
return NULL;
}
+
return (VOID *)(UINTN)Memory;
}
diff --git a/MdePkg/Library/DxeServicesLib/DxeServicesLib.c b/MdePkg/Library/DxeServicesLib/DxeServicesLib.c
index 3e3bbf6055..8f5a15dedc 100644
--- a/MdePkg/Library/DxeServicesLib/DxeServicesLib.c
+++ b/MdePkg/Library/DxeServicesLib/DxeServicesLib.c
@@ -40,19 +40,19 @@
**/
EFI_HANDLE
InternalImageHandleToFvHandle (
- EFI_HANDLE ImageHandle
+ EFI_HANDLE ImageHandle
)
{
- EFI_STATUS Status;
- EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
+ EFI_STATUS Status;
+ EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
ASSERT (ImageHandle != NULL);
Status = gBS->HandleProtocol (
- ImageHandle,
- &gEfiLoadedImageProtocolGuid,
- (VOID **) &LoadedImage
- );
+ ImageHandle,
+ &gEfiLoadedImageProtocolGuid,
+ (VOID **)&LoadedImage
+ );
ASSERT_EFI_ERROR (Status);
@@ -63,7 +63,6 @@ InternalImageHandleToFvHandle (
// protocol is installed.
//
return LoadedImage->DeviceHandle;
-
}
/**
@@ -111,17 +110,17 @@ InternalImageHandleToFvHandle (
**/
EFI_STATUS
InternalGetSectionFromFv (
- IN EFI_HANDLE FvHandle,
- IN CONST EFI_GUID *NameGuid,
- IN EFI_SECTION_TYPE SectionType,
- IN UINTN SectionInstance,
- OUT VOID **Buffer,
- OUT UINTN *Size
+ IN EFI_HANDLE FvHandle,
+ IN CONST EFI_GUID *NameGuid,
+ IN EFI_SECTION_TYPE SectionType,
+ IN UINTN SectionInstance,
+ OUT VOID **Buffer,
+ OUT UINTN *Size
)
{
- EFI_STATUS Status;
- EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;
- UINT32 AuthenticationStatus;
+ EFI_STATUS Status;
+ EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;
+ UINT32 AuthenticationStatus;
ASSERT (NameGuid != NULL);
ASSERT (Buffer != NULL);
@@ -137,7 +136,7 @@ InternalGetSectionFromFv (
Status = gBS->HandleProtocol (
FvHandle,
&gEfiFirmwareVolume2ProtocolGuid,
- (VOID **) &Fv
+ (VOID **)&Fv
);
if (EFI_ERROR (Status)) {
return EFI_NOT_FOUND;
@@ -146,17 +145,17 @@ InternalGetSectionFromFv (
//
// Read desired section content in NameGuid file
//
- *Buffer = NULL;
- *Size = 0;
- Status = Fv->ReadSection (
- Fv,
- NameGuid,
- SectionType,
- SectionInstance,
- Buffer,
- Size,
- &AuthenticationStatus
- );
+ *Buffer = NULL;
+ *Size = 0;
+ Status = Fv->ReadSection (
+ Fv,
+ NameGuid,
+ SectionType,
+ SectionInstance,
+ Buffer,
+ Size,
+ &AuthenticationStatus
+ );
if (EFI_ERROR (Status) && (SectionType == EFI_SECTION_TE)) {
//
@@ -229,23 +228,23 @@ InternalGetSectionFromFv (
EFI_STATUS
EFIAPI
GetSectionFromAnyFvByFileType (
- IN EFI_FV_FILETYPE FileType,
- IN UINTN FileInstance,
- IN EFI_SECTION_TYPE SectionType,
- IN UINTN SectionInstance,
- OUT VOID **Buffer,
- OUT UINTN *Size
+ IN EFI_FV_FILETYPE FileType,
+ IN UINTN FileInstance,
+ IN EFI_SECTION_TYPE SectionType,
+ IN UINTN SectionInstance,
+ OUT VOID **Buffer,
+ OUT UINTN *Size
)
{
- EFI_STATUS Status;
- EFI_HANDLE *HandleBuffer;
- UINTN HandleCount;
- UINTN IndexFv;
- UINTN IndexFile;
- UINTN Key;
- EFI_GUID NameGuid;
- EFI_FV_FILE_ATTRIBUTES Attributes;
- EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;
+ EFI_STATUS Status;
+ EFI_HANDLE *HandleBuffer;
+ UINTN HandleCount;
+ UINTN IndexFv;
+ UINTN IndexFile;
+ UINTN Key;
+ EFI_GUID NameGuid;
+ EFI_FV_FILE_ATTRIBUTES Attributes;
+ EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;
ASSERT (Buffer != NULL);
ASSERT (Size != NULL);
@@ -254,13 +253,13 @@ GetSectionFromAnyFvByFileType (
// Locate all available FVs.
//
HandleBuffer = NULL;
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiFirmwareVolume2ProtocolGuid,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiFirmwareVolume2ProtocolGuid,
+ NULL,
+ &HandleCount,
+ &HandleBuffer
+ );
if (EFI_ERROR (Status)) {
return Status;
}
@@ -282,13 +281,14 @@ GetSectionFromAnyFvByFileType (
// Use Firmware Volume 2 Protocol to search for a file of type FileType in all FVs.
//
IndexFile = FileInstance + 1;
- Key = 0;
+ Key = 0;
do {
Status = Fv->GetNextFile (Fv, &Key, &FileType, &NameGuid, &Attributes, Size);
if (EFI_ERROR (Status)) {
break;
}
- IndexFile --;
+
+ IndexFile--;
} while (IndexFile > 0);
//
@@ -320,7 +320,7 @@ GetSectionFromAnyFvByFileType (
Done:
if (HandleBuffer != NULL) {
- FreePool(HandleBuffer);
+ FreePool (HandleBuffer);
}
return Status;
@@ -372,18 +372,18 @@ Done:
EFI_STATUS
EFIAPI
GetSectionFromAnyFv (
- IN CONST EFI_GUID *NameGuid,
- IN EFI_SECTION_TYPE SectionType,
- IN UINTN SectionInstance,
- OUT VOID **Buffer,
- OUT UINTN *Size
+ IN CONST EFI_GUID *NameGuid,
+ IN EFI_SECTION_TYPE SectionType,
+ IN UINTN SectionInstance,
+ OUT VOID **Buffer,
+ OUT UINTN *Size
)
{
- EFI_STATUS Status;
- EFI_HANDLE *HandleBuffer;
- UINTN HandleCount;
- UINTN Index;
- EFI_HANDLE FvHandle;
+ EFI_STATUS Status;
+ EFI_HANDLE *HandleBuffer;
+ UINTN HandleCount;
+ UINTN Index;
+ EFI_HANDLE FvHandle;
//
// Search the FV that contain the caller's FFS first.
@@ -392,26 +392,26 @@ GetSectionFromAnyFv (
// will locate the FFS faster.
//
FvHandle = InternalImageHandleToFvHandle (gImageHandle);
- Status = InternalGetSectionFromFv (
- FvHandle,
- NameGuid,
- SectionType,
- SectionInstance,
- Buffer,
- Size
- );
+ Status = InternalGetSectionFromFv (
+ FvHandle,
+ NameGuid,
+ SectionType,
+ SectionInstance,
+ Buffer,
+ Size
+ );
if (!EFI_ERROR (Status)) {
return EFI_SUCCESS;
}
HandleBuffer = NULL;
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiFirmwareVolume2ProtocolGuid,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiFirmwareVolume2ProtocolGuid,
+ NULL,
+ &HandleCount,
+ &HandleBuffer
+ );
if (EFI_ERROR (Status)) {
goto Done;
}
@@ -434,7 +434,6 @@ GetSectionFromAnyFv (
goto Done;
}
}
-
}
if (Index == HandleCount) {
@@ -444,10 +443,10 @@ GetSectionFromAnyFv (
Done:
if (HandleBuffer != NULL) {
- FreePool(HandleBuffer);
+ FreePool (HandleBuffer);
}
- return Status;
+ return Status;
}
/**
@@ -498,15 +497,15 @@ Done:
EFI_STATUS
EFIAPI
GetSectionFromFv (
- IN CONST EFI_GUID *NameGuid,
- IN EFI_SECTION_TYPE SectionType,
- IN UINTN SectionInstance,
- OUT VOID **Buffer,
- OUT UINTN *Size
- )
+ IN CONST EFI_GUID *NameGuid,
+ IN EFI_SECTION_TYPE SectionType,
+ IN UINTN SectionInstance,
+ OUT VOID **Buffer,
+ OUT UINTN *Size
+ )
{
return InternalGetSectionFromFv (
- InternalImageHandleToFvHandle(gImageHandle),
+ InternalImageHandleToFvHandle (gImageHandle),
NameGuid,
SectionType,
SectionInstance,
@@ -515,7 +514,6 @@ GetSectionFromFv (
);
}
-
/**
Searches the FFS file the currently executing module was loaded from and returns the first matching FFS section.
@@ -561,14 +559,14 @@ GetSectionFromFv (
EFI_STATUS
EFIAPI
GetSectionFromFfs (
- IN EFI_SECTION_TYPE SectionType,
- IN UINTN SectionInstance,
- OUT VOID **Buffer,
- OUT UINTN *Size
- )
+ IN EFI_SECTION_TYPE SectionType,
+ IN UINTN SectionInstance,
+ OUT VOID **Buffer,
+ OUT UINTN *Size
+ )
{
- return InternalGetSectionFromFv(
- InternalImageHandleToFvHandle(gImageHandle),
+ return InternalGetSectionFromFv (
+ InternalImageHandleToFvHandle (gImageHandle),
&gEfiCallerIdGuid,
SectionType,
SectionInstance,
@@ -577,7 +575,6 @@ GetSectionFromFfs (
);
}
-
/**
Get the image file buffer data and buffer size by its device path.
@@ -608,48 +605,48 @@ GetSectionFromFfs (
VOID *
EFIAPI
GetFileBufferByFilePath (
- IN BOOLEAN BootPolicy,
- IN CONST EFI_DEVICE_PATH_PROTOCOL *FilePath,
- OUT UINTN *FileSize,
- OUT UINT32 *AuthenticationStatus
+ IN BOOLEAN BootPolicy,
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *FilePath,
+ OUT UINTN *FileSize,
+ OUT UINT32 *AuthenticationStatus
)
{
- EFI_DEVICE_PATH_PROTOCOL *DevicePathNode;
- EFI_DEVICE_PATH_PROTOCOL *OrigDevicePathNode;
- EFI_DEVICE_PATH_PROTOCOL *TempDevicePathNode;
- EFI_HANDLE Handle;
- EFI_GUID *FvNameGuid;
- EFI_FIRMWARE_VOLUME2_PROTOCOL *FwVol;
- EFI_SECTION_TYPE SectionType;
- UINT8 *ImageBuffer;
- UINTN ImageBufferSize;
- EFI_FV_FILETYPE Type;
- EFI_FV_FILE_ATTRIBUTES Attrib;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Volume;
- EFI_FILE_HANDLE FileHandle;
- EFI_FILE_HANDLE LastHandle;
- EFI_FILE_INFO *FileInfo;
- UINTN FileInfoSize;
- EFI_LOAD_FILE_PROTOCOL *LoadFile;
- EFI_LOAD_FILE2_PROTOCOL *LoadFile2;
- EFI_STATUS Status;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePathNode;
+ EFI_DEVICE_PATH_PROTOCOL *OrigDevicePathNode;
+ EFI_DEVICE_PATH_PROTOCOL *TempDevicePathNode;
+ EFI_HANDLE Handle;
+ EFI_GUID *FvNameGuid;
+ EFI_FIRMWARE_VOLUME2_PROTOCOL *FwVol;
+ EFI_SECTION_TYPE SectionType;
+ UINT8 *ImageBuffer;
+ UINTN ImageBufferSize;
+ EFI_FV_FILETYPE Type;
+ EFI_FV_FILE_ATTRIBUTES Attrib;
+ EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Volume;
+ EFI_FILE_HANDLE FileHandle;
+ EFI_FILE_HANDLE LastHandle;
+ EFI_FILE_INFO *FileInfo;
+ UINTN FileInfoSize;
+ EFI_LOAD_FILE_PROTOCOL *LoadFile;
+ EFI_LOAD_FILE2_PROTOCOL *LoadFile2;
+ EFI_STATUS Status;
//
// Check input File device path.
//
- if (FilePath == NULL || FileSize == NULL || AuthenticationStatus == NULL) {
+ if ((FilePath == NULL) || (FileSize == NULL) || (AuthenticationStatus == NULL)) {
return NULL;
}
//
// Init local variable
//
- TempDevicePathNode = NULL;
- FvNameGuid = NULL;
- FileInfo = NULL;
- FileHandle = NULL;
- ImageBuffer = NULL;
- ImageBufferSize = 0;
+ TempDevicePathNode = NULL;
+ FvNameGuid = NULL;
+ FileInfo = NULL;
+ FileHandle = NULL;
+ ImageBuffer = NULL;
+ ImageBufferSize = 0;
*AuthenticationStatus = 0;
//
@@ -665,31 +662,31 @@ GetFileBufferByFilePath (
// Is so, this device path may contain a Image.
//
DevicePathNode = OrigDevicePathNode;
- Status = gBS->LocateDevicePath (&gEfiFirmwareVolume2ProtocolGuid, &DevicePathNode, &Handle);
+ Status = gBS->LocateDevicePath (&gEfiFirmwareVolume2ProtocolGuid, &DevicePathNode, &Handle);
if (!EFI_ERROR (Status)) {
//
// For FwVol File system there is only a single file name that is a GUID.
//
- FvNameGuid = EfiGetNameGuidFromFwVolDevicePathNode ((CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) DevicePathNode);
+ FvNameGuid = EfiGetNameGuidFromFwVolDevicePathNode ((CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)DevicePathNode);
if (FvNameGuid == NULL) {
Status = EFI_INVALID_PARAMETER;
} else {
//
// Read image from the firmware file
//
- Status = gBS->HandleProtocol (Handle, &gEfiFirmwareVolume2ProtocolGuid, (VOID**)&FwVol);
+ Status = gBS->HandleProtocol (Handle, &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&FwVol);
if (!EFI_ERROR (Status)) {
SectionType = EFI_SECTION_PE32;
ImageBuffer = NULL;
- Status = FwVol->ReadSection (
- FwVol,
- FvNameGuid,
- SectionType,
- 0,
- (VOID **)&ImageBuffer,
- &ImageBufferSize,
- AuthenticationStatus
- );
+ Status = FwVol->ReadSection (
+ FwVol,
+ FvNameGuid,
+ SectionType,
+ 0,
+ (VOID **)&ImageBuffer,
+ &ImageBufferSize,
+ AuthenticationStatus
+ );
if (EFI_ERROR (Status)) {
//
// Try a raw file, since a PE32 SECTION does not exist
@@ -698,19 +695,21 @@ GetFileBufferByFilePath (
FreePool (ImageBuffer);
*AuthenticationStatus = 0;
}
+
ImageBuffer = NULL;
- Status = FwVol->ReadFile (
- FwVol,
- FvNameGuid,
- (VOID **)&ImageBuffer,
- &ImageBufferSize,
- &Type,
- &Attrib,
- AuthenticationStatus
- );
+ Status = FwVol->ReadFile (
+ FwVol,
+ FvNameGuid,
+ (VOID **)&ImageBuffer,
+ &ImageBufferSize,
+ &Type,
+ &Attrib,
+ AuthenticationStatus
+ );
}
}
}
+
if (!EFI_ERROR (Status)) {
goto Finish;
}
@@ -720,9 +719,9 @@ GetFileBufferByFilePath (
// Attempt to access the file via a file system interface
//
DevicePathNode = OrigDevicePathNode;
- Status = gBS->LocateDevicePath (&gEfiSimpleFileSystemProtocolGuid, &DevicePathNode, &Handle);
+ Status = gBS->LocateDevicePath (&gEfiSimpleFileSystemProtocolGuid, &DevicePathNode, &Handle);
if (!EFI_ERROR (Status)) {
- Status = gBS->HandleProtocol (Handle, &gEfiSimpleFileSystemProtocolGuid, (VOID**)&Volume);
+ Status = gBS->HandleProtocol (Handle, &gEfiSimpleFileSystemProtocolGuid, (VOID **)&Volume);
if (!EFI_ERROR (Status)) {
//
// Open the Volume to get the File System handle
@@ -743,6 +742,7 @@ GetFileBufferByFilePath (
//
Status = EFI_OUT_OF_RESOURCES;
}
+
//
// Parse each MEDIA_FILEPATH_DP node. There may be more than one, since the
// directory information and filename can be separate. The goal is to inch
@@ -750,8 +750,9 @@ GetFileBufferByFilePath (
//
DevicePathNode = TempDevicePathNode;
while (!EFI_ERROR (Status) && !IsDevicePathEnd (DevicePathNode)) {
- if (DevicePathType (DevicePathNode) != MEDIA_DEVICE_PATH ||
- DevicePathSubType (DevicePathNode) != MEDIA_FILEPATH_DP) {
+ if ((DevicePathType (DevicePathNode) != MEDIA_DEVICE_PATH) ||
+ (DevicePathSubType (DevicePathNode) != MEDIA_FILEPATH_DP))
+ {
Status = EFI_UNSUPPORTED;
break;
}
@@ -760,12 +761,12 @@ GetFileBufferByFilePath (
FileHandle = NULL;
Status = LastHandle->Open (
- LastHandle,
- &FileHandle,
- ((FILEPATH_DEVICE_PATH *) DevicePathNode)->PathName,
- EFI_FILE_MODE_READ,
- 0
- );
+ LastHandle,
+ &FileHandle,
+ ((FILEPATH_DEVICE_PATH *)DevicePathNode)->PathName,
+ EFI_FILE_MODE_READ,
+ 0
+ );
//
// Close the previous node
@@ -780,14 +781,14 @@ GetFileBufferByFilePath (
// We have found the file. Now we need to read it. Before we can read the file we need to
// figure out how big the file is.
//
- FileInfo = NULL;
+ FileInfo = NULL;
FileInfoSize = 0;
- Status = FileHandle->GetInfo (
- FileHandle,
- &gEfiFileInfoGuid,
- &FileInfoSize,
- FileInfo
- );
+ Status = FileHandle->GetInfo (
+ FileHandle,
+ &gEfiFileInfoGuid,
+ &FileInfoSize,
+ FileInfo
+ );
if (Status == EFI_BUFFER_TOO_SMALL) {
FileInfo = AllocatePool (FileInfoSize);
@@ -795,11 +796,11 @@ GetFileBufferByFilePath (
Status = EFI_OUT_OF_RESOURCES;
} else {
Status = FileHandle->GetInfo (
- FileHandle,
- &gEfiFileInfoGuid,
- &FileInfoSize,
- FileInfo
- );
+ FileHandle,
+ &gEfiFileInfoGuid,
+ &FileInfoSize,
+ FileInfo
+ );
}
}
@@ -821,20 +822,24 @@ GetFileBufferByFilePath (
}
}
}
+
//
// Close the file and Free FileInfo and TempDevicePathNode since we are done
//
if (FileInfo != NULL) {
FreePool (FileInfo);
}
+
if (FileHandle != NULL) {
FileHandle->Close (FileHandle);
}
+
if (TempDevicePathNode != NULL) {
FreePool (TempDevicePathNode);
}
}
}
+
if (!EFI_ERROR (Status)) {
goto Finish;
}
@@ -845,37 +850,38 @@ GetFileBufferByFilePath (
//
if (!BootPolicy) {
DevicePathNode = OrigDevicePathNode;
- Status = gBS->LocateDevicePath (&gEfiLoadFile2ProtocolGuid, &DevicePathNode, &Handle);
+ Status = gBS->LocateDevicePath (&gEfiLoadFile2ProtocolGuid, &DevicePathNode, &Handle);
if (!EFI_ERROR (Status)) {
- Status = gBS->HandleProtocol (Handle, &gEfiLoadFile2ProtocolGuid, (VOID**)&LoadFile2);
+ Status = gBS->HandleProtocol (Handle, &gEfiLoadFile2ProtocolGuid, (VOID **)&LoadFile2);
if (!EFI_ERROR (Status)) {
//
// Call LoadFile2 with the correct buffer size
//
ImageBufferSize = 0;
ImageBuffer = NULL;
- Status = LoadFile2->LoadFile (
- LoadFile2,
- DevicePathNode,
- FALSE,
- &ImageBufferSize,
- ImageBuffer
- );
+ Status = LoadFile2->LoadFile (
+ LoadFile2,
+ DevicePathNode,
+ FALSE,
+ &ImageBufferSize,
+ ImageBuffer
+ );
if (Status == EFI_BUFFER_TOO_SMALL) {
ImageBuffer = AllocatePool (ImageBufferSize);
if (ImageBuffer == NULL) {
Status = EFI_OUT_OF_RESOURCES;
} else {
Status = LoadFile2->LoadFile (
- LoadFile2,
- DevicePathNode,
- FALSE,
- &ImageBufferSize,
- ImageBuffer
- );
+ LoadFile2,
+ DevicePathNode,
+ FALSE,
+ &ImageBufferSize,
+ ImageBuffer
+ );
}
}
}
+
if (!EFI_ERROR (Status)) {
goto Finish;
}
@@ -886,22 +892,22 @@ GetFileBufferByFilePath (
// Attempt to access the file via LoadFile interface
//
DevicePathNode = OrigDevicePathNode;
- Status = gBS->LocateDevicePath (&gEfiLoadFileProtocolGuid, &DevicePathNode, &Handle);
+ Status = gBS->LocateDevicePath (&gEfiLoadFileProtocolGuid, &DevicePathNode, &Handle);
if (!EFI_ERROR (Status)) {
- Status = gBS->HandleProtocol (Handle, &gEfiLoadFileProtocolGuid, (VOID**)&LoadFile);
+ Status = gBS->HandleProtocol (Handle, &gEfiLoadFileProtocolGuid, (VOID **)&LoadFile);
if (!EFI_ERROR (Status)) {
//
// Call LoadFile with the correct buffer size
//
ImageBufferSize = 0;
ImageBuffer = NULL;
- Status = LoadFile->LoadFile (
- LoadFile,
- DevicePathNode,
- BootPolicy,
- &ImageBufferSize,
- ImageBuffer
- );
+ Status = LoadFile->LoadFile (
+ LoadFile,
+ DevicePathNode,
+ BootPolicy,
+ &ImageBufferSize,
+ ImageBuffer
+ );
if (Status == EFI_BUFFER_TOO_SMALL) {
ImageBuffer = AllocatePool (ImageBufferSize);
if (ImageBuffer == NULL) {
@@ -926,6 +932,7 @@ Finish:
FreePool (ImageBuffer);
ImageBuffer = NULL;
}
+
*FileSize = 0;
} else {
*FileSize = ImageBufferSize;
@@ -978,15 +985,15 @@ GetFileDevicePathFromAnyFv (
OUT EFI_DEVICE_PATH_PROTOCOL **FvFileDevicePath
)
{
- EFI_STATUS Status;
- EFI_HANDLE *HandleBuffer;
- UINTN HandleCount;
- UINTN Index;
- EFI_HANDLE FvHandle;
- EFI_DEVICE_PATH_PROTOCOL *FvDevicePath;
- MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *TempFvFileDevicePath;
- VOID *Buffer;
- UINTN Size;
+ EFI_STATUS Status;
+ EFI_HANDLE *HandleBuffer;
+ UINTN HandleCount;
+ UINTN Index;
+ EFI_HANDLE FvHandle;
+ EFI_DEVICE_PATH_PROTOCOL *FvDevicePath;
+ MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *TempFvFileDevicePath;
+ VOID *Buffer;
+ UINTN Size;
if (FvFileDevicePath == NULL) {
return EFI_INVALID_PARAMETER;
@@ -1005,14 +1012,14 @@ GetFileDevicePathFromAnyFv (
// will locate the FFS faster.
//
FvHandle = InternalImageHandleToFvHandle (gImageHandle);
- Status = InternalGetSectionFromFv (
- FvHandle,
- NameGuid,
- SectionType,
- SectionInstance,
- &Buffer,
- &Size
- );
+ Status = InternalGetSectionFromFv (
+ FvHandle,
+ NameGuid,
+ SectionType,
+ SectionInstance,
+ &Buffer,
+ &Size
+ );
if (!EFI_ERROR (Status)) {
goto Done;
}
@@ -1070,7 +1077,8 @@ Done:
*FvFileDevicePath = NULL;
return EFI_OUT_OF_RESOURCES;
}
- EfiInitializeFwVolDevicepathNode ((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH*)TempFvFileDevicePath, NameGuid);
+
+ EfiInitializeFwVolDevicepathNode ((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)TempFvFileDevicePath, NameGuid);
SetDevicePathEndNode (NextDevicePathNode (TempFvFileDevicePath));
*FvFileDevicePath = AppendDevicePath (
FvDevicePath,
diff --git a/MdePkg/Library/DxeServicesLib/X64/Allocate.c b/MdePkg/Library/DxeServicesLib/X64/Allocate.c
index 41c4cea391..cb08e6b247 100644
--- a/MdePkg/Library/DxeServicesLib/X64/Allocate.c
+++ b/MdePkg/Library/DxeServicesLib/X64/Allocate.c
@@ -52,12 +52,13 @@ AllocatePeiAccessiblePages (
PhitHob = (EFI_HOB_HANDOFF_INFO_TABLE *)GetHobList ();
if (PhitHob->EfiFreeMemoryTop <= MAX_UINT32) {
AllocType = AllocateMaxAddress;
- Memory = MAX_UINT32;
+ Memory = MAX_UINT32;
}
Status = gBS->AllocatePages (AllocType, MemoryType, Pages, &Memory);
if (EFI_ERROR (Status)) {
return NULL;
}
+
return (VOID *)(UINTN)Memory;
}
diff --git a/MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.c b/MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.c
index 9acb1b79b3..7c379891be 100644
--- a/MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.c
+++ b/MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.c
@@ -26,7 +26,7 @@
//
// Cache copy of the DXE Services Table
//
-EFI_DXE_SERVICES *gDS = NULL;
+EFI_DXE_SERVICES *gDS = NULL;
/**
The constructor function caches the pointer of DXE Services Table.
@@ -54,7 +54,7 @@ DxeServicesTableLibConstructor (
//
// Cache copy of the DXE Services Table
//
- Status = EfiGetSystemConfigurationTable (&gEfiDxeServicesTableGuid, (VOID **) &gDS);
+ Status = EfiGetSystemConfigurationTable (&gEfiDxeServicesTableGuid, (VOID **)&gDS);
ASSERT_EFI_ERROR (Status);
ASSERT (gDS != NULL);
diff --git a/MdePkg/Library/DxeSmbusLib/DxeSmbusLib.c b/MdePkg/Library/DxeSmbusLib/DxeSmbusLib.c
index d9cca7eb5f..3e6706d38b 100644
--- a/MdePkg/Library/DxeSmbusLib/DxeSmbusLib.c
+++ b/MdePkg/Library/DxeSmbusLib/DxeSmbusLib.c
@@ -7,14 +7,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-
#include "InternalSmbusLib.h"
-
//
// Global variable to cache pointer to Smbus protocol.
//
-EFI_SMBUS_HC_PROTOCOL *mSmbus = NULL;
+EFI_SMBUS_HC_PROTOCOL *mSmbus = NULL;
/**
The constructor function caches the pointer to Smbus protocol.
@@ -31,13 +29,13 @@ EFI_SMBUS_HC_PROTOCOL *mSmbus = NULL;
EFI_STATUS
EFIAPI
SmbusLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
- Status = gBS->LocateProtocol (&gEfiSmbusHcProtocolGuid, NULL, (VOID**) &mSmbus);
+ Status = gBS->LocateProtocol (&gEfiSmbusHcProtocolGuid, NULL, (VOID **)&mSmbus);
ASSERT_EFI_ERROR (Status);
ASSERT (mSmbus != NULL);
@@ -69,11 +67,11 @@ SmbusLibConstructor (
**/
UINTN
InternalSmBusExec (
- IN EFI_SMBUS_OPERATION SmbusOperation,
- IN UINTN SmBusAddress,
- IN UINTN Length,
- IN OUT VOID *Buffer,
- OUT RETURN_STATUS *Status OPTIONAL
+ IN EFI_SMBUS_OPERATION SmbusOperation,
+ IN UINTN SmBusAddress,
+ IN UINTN Length,
+ IN OUT VOID *Buffer,
+ OUT RETURN_STATUS *Status OPTIONAL
)
{
RETURN_STATUS ReturnStatus;
diff --git a/MdePkg/Library/DxeSmbusLib/InternalSmbusLib.h b/MdePkg/Library/DxeSmbusLib/InternalSmbusLib.h
index dac6c4ceb7..0fbd577130 100644
--- a/MdePkg/Library/DxeSmbusLib/InternalSmbusLib.h
+++ b/MdePkg/Library/DxeSmbusLib/InternalSmbusLib.h
@@ -10,7 +10,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#ifndef __INTERNAL_SMBUS_LIB_H_
#define __INTERNAL_SMBUS_LIB_H_
-
#include <PiDxe.h>
#include <Protocol/SmbusHc.h>
@@ -25,6 +24,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// Declaration for internal functions
//
+
/**
Executes an SMBus operation to an SMBus controller.
@@ -50,11 +50,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
UINTN
InternalSmBusExec (
- IN EFI_SMBUS_OPERATION SmbusOperation,
- IN UINTN SmBusAddress,
- IN UINTN Length,
- IN OUT VOID *Buffer,
- OUT RETURN_STATUS *Status OPTIONAL
+ IN EFI_SMBUS_OPERATION SmbusOperation,
+ IN UINTN SmBusAddress,
+ IN UINTN Length,
+ IN OUT VOID *Buffer,
+ OUT RETURN_STATUS *Status OPTIONAL
);
/**
@@ -72,8 +72,8 @@ InternalSmBusExec (
EFI_STATUS
EFIAPI
SmbusLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
);
#endif
diff --git a/MdePkg/Library/DxeSmbusLib/SmbusLib.c b/MdePkg/Library/DxeSmbusLib/SmbusLib.c
index e16d3491f6..effe3a41b9 100644
--- a/MdePkg/Library/DxeSmbusLib/SmbusLib.c
+++ b/MdePkg/Library/DxeSmbusLib/SmbusLib.c
@@ -38,8 +38,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
VOID
EFIAPI
SmBusQuickRead (
- IN UINTN SmBusAddress,
- OUT RETURN_STATUS *Status OPTIONAL
+ IN UINTN SmBusAddress,
+ OUT RETURN_STATUS *Status OPTIONAL
)
{
ASSERT (!SMBUS_LIB_PEC (SmBusAddress));
@@ -79,8 +79,8 @@ SmBusQuickRead (
VOID
EFIAPI
SmBusQuickWrite (
- IN UINTN SmBusAddress,
- OUT RETURN_STATUS *Status OPTIONAL
+ IN UINTN SmBusAddress,
+ OUT RETURN_STATUS *Status OPTIONAL
)
{
ASSERT (!SMBUS_LIB_PEC (SmBusAddress));
@@ -127,7 +127,7 @@ SmBusReceiveByte (
OUT RETURN_STATUS *Status OPTIONAL
)
{
- UINT8 Byte;
+ UINT8 Byte;
ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0);
ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
@@ -176,13 +176,13 @@ SmBusSendByte (
OUT RETURN_STATUS *Status OPTIONAL
)
{
- UINT8 Byte;
+ UINT8 Byte;
ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0);
ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
- Byte = Value;
+ Byte = Value;
InternalSmBusExec (EfiSmbusSendByte, SmBusAddress, 1, &Byte, Status);
return Value;
@@ -223,7 +223,7 @@ SmBusReadDataByte (
OUT RETURN_STATUS *Status OPTIONAL
)
{
- UINT8 Byte;
+ UINT8 Byte;
ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
@@ -271,7 +271,7 @@ SmBusWriteDataByte (
OUT RETURN_STATUS *Status OPTIONAL
)
{
- UINT8 Byte;
+ UINT8 Byte;
ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
@@ -569,7 +569,7 @@ SmBusBlockProcessCall (
OUT RETURN_STATUS *Status OPTIONAL
)
{
- UINTN Length;
+ UINTN Length;
ASSERT (WriteBuffer != NULL);
ASSERT (ReadBuffer != NULL);
diff --git a/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.c b/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.c
index 27f9d526e3..9ba5168608 100644
--- a/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.c
+++ b/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.c
@@ -12,7 +12,7 @@
#include <Library/MmServicesTableLib.h>
#include <Library/DebugLib.h>
-EFI_MM_SYSTEM_TABLE *gMmst = NULL;
+EFI_MM_SYSTEM_TABLE *gMmst = NULL;
/**
The constructor function caches the pointer of the MM Services Table.
@@ -30,8 +30,8 @@ MmServicesTableLibConstructor (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- EFI_MM_BASE_PROTOCOL *InternalMmBase;
+ EFI_STATUS Status;
+ EFI_MM_BASE_PROTOCOL *InternalMmBase;
InternalMmBase = NULL;
//
diff --git a/MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.c b/MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.c
index b205c9122d..4cc7b23128 100644
--- a/MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.c
+++ b/MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.c
@@ -36,8 +36,8 @@
RETURN_STATUS
EFIAPI
MmUnblockMemoryRequest (
- IN PHYSICAL_ADDRESS UnblockAddress,
- IN UINT64 NumberOfPages
+ IN PHYSICAL_ADDRESS UnblockAddress,
+ IN UINT64 NumberOfPages
)
{
return RETURN_UNSUPPORTED;
diff --git a/MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLib.c b/MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLib.c
index b0d51c45be..deab86a47a 100644
--- a/MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLib.c
+++ b/MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLib.c
@@ -20,7 +20,7 @@
**/
UINTN
PciSegmentLibVirtualAddress (
- IN UINTN Address
+ IN UINTN Address
)
{
return Address;
@@ -59,6 +59,6 @@ PciSegmentRegisterForRuntimeAccess (
SegmentInfo = GetPciSegmentInfo (&Count);
PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count);
- );
+ );
return RETURN_SUCCESS;
}
diff --git a/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLib.c b/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLib.c
index 75931d46e0..a6860b471f 100644
--- a/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLib.c
+++ b/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLib.c
@@ -22,19 +22,19 @@
/// Define table for mapping PCI Segment MMIO physical addresses to virtual addresses at OS runtime
///
typedef struct {
- UINTN PhysicalAddress;
- UINTN VirtualAddress;
+ UINTN PhysicalAddress;
+ UINTN VirtualAddress;
} PCI_SEGMENT_RUNTIME_REGISTRATION_TABLE;
///
/// Set Virtual Address Map Event
///
-EFI_EVENT mDxeRuntimePciSegmentLibVirtualNotifyEvent = NULL;
+EFI_EVENT mDxeRuntimePciSegmentLibVirtualNotifyEvent = NULL;
///
/// The number of PCI devices that have been registered for runtime access.
///
-UINTN mDxeRuntimePciSegmentLibNumberOfRuntimeRanges = 0;
+UINTN mDxeRuntimePciSegmentLibNumberOfRuntimeRanges = 0;
///
/// The table of PCI devices that have been registered for runtime access.
@@ -44,7 +44,7 @@ PCI_SEGMENT_RUNTIME_REGISTRATION_TABLE *mDxeRuntimePciSegmentLibRegistrationTab
///
/// The table index of the most recent virtual address lookup.
///
-UINTN mDxeRuntimePciSegmentLibLastRuntimeRange = 0;
+UINTN mDxeRuntimePciSegmentLibLastRuntimeRange = 0;
/**
Convert the physical PCI Express MMIO addresses for all registered PCI devices
@@ -60,8 +60,8 @@ DxeRuntimePciSegmentLibVirtualNotify (
IN VOID *Context
)
{
- UINTN Index;
- EFI_STATUS Status;
+ UINTN Index;
+ EFI_STATUS Status;
//
// If there have been no runtime registrations, then just return
@@ -75,14 +75,14 @@ DxeRuntimePciSegmentLibVirtualNotify (
// virtual addresses.
//
for (Index = 0; Index < mDxeRuntimePciSegmentLibNumberOfRuntimeRanges; Index++) {
- Status = EfiConvertPointer (0, (VOID **) &(mDxeRuntimePciSegmentLibRegistrationTable[Index].VirtualAddress));
+ Status = EfiConvertPointer (0, (VOID **)&(mDxeRuntimePciSegmentLibRegistrationTable[Index].VirtualAddress));
ASSERT_EFI_ERROR (Status);
}
//
// Convert table pointer that is allocated from EfiRuntimeServicesData to a virtual address.
//
- Status = EfiConvertPointer (0, (VOID **) &mDxeRuntimePciSegmentLibRegistrationTable);
+ Status = EfiConvertPointer (0, (VOID **)&mDxeRuntimePciSegmentLibRegistrationTable);
ASSERT_EFI_ERROR (Status);
}
@@ -194,7 +194,7 @@ PciSegmentRegisterForRuntimeAccess (
// Convert Address to a ECAM address at the beginning of the PCI Configuration
// header for the specified PCI Bus/Dev/Func
//
- Address &= ~(UINTN)EFI_PAGE_MASK;
+ Address &= ~(UINTN)EFI_PAGE_MASK;
SegmentInfo = GetPciSegmentInfo (&Count);
EcamAddress = PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count);
@@ -204,9 +204,11 @@ PciSegmentRegisterForRuntimeAccess (
if (EfiAtRuntime ()) {
return RETURN_UNSUPPORTED;
}
+
if (sizeof (UINTN) == sizeof (UINT32)) {
ASSERT (EcamAddress < BASE_4GB);
}
+
Address = (UINTN)EcamAddress;
//
@@ -246,7 +248,8 @@ PciSegmentRegisterForRuntimeAccess (
if (NewTable == NULL) {
return RETURN_OUT_OF_RESOURCES;
}
- mDxeRuntimePciSegmentLibRegistrationTable = NewTable;
+
+ mDxeRuntimePciSegmentLibRegistrationTable = NewTable;
mDxeRuntimePciSegmentLibRegistrationTable[mDxeRuntimePciSegmentLibNumberOfRuntimeRanges].PhysicalAddress = Address;
mDxeRuntimePciSegmentLibRegistrationTable[mDxeRuntimePciSegmentLibNumberOfRuntimeRanges].VirtualAddress = Address;
mDxeRuntimePciSegmentLibNumberOfRuntimeRanges++;
@@ -263,10 +266,11 @@ PciSegmentRegisterForRuntimeAccess (
**/
UINTN
PciSegmentLibVirtualAddress (
- IN UINTN Address
+ IN UINTN Address
)
{
- UINTN Index;
+ UINTN Index;
+
//
// If SetVirtualAddressMap() has not been called, then just return the physical address
//
diff --git a/MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.c b/MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.c
index a76e9d9adf..c6cc32d463 100644
--- a/MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.c
+++ b/MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.c
@@ -10,13 +10,13 @@
#include "PciSegmentLibCommon.h"
typedef struct {
- UINT32 Register : 12;
- UINT32 Function : 3;
- UINT32 Device : 5;
- UINT32 Bus : 8;
- UINT32 Reserved1 : 4;
- UINT32 Segment : 16;
- UINT32 Reserved2 : 16;
+ UINT32 Register : 12;
+ UINT32 Function : 3;
+ UINT32 Device : 5;
+ UINT32 Bus : 8;
+ UINT32 Reserved1 : 4;
+ UINT32 Segment : 16;
+ UINT32 Reserved2 : 16;
} PCI_SEGMENT_LIB_ADDRESS_STRUCTURE;
/**
@@ -32,31 +32,34 @@ typedef struct {
**/
UINTN
PciSegmentLibGetEcamAddress (
- IN UINT64 Address,
- IN CONST PCI_SEGMENT_INFO *SegmentInfo,
- IN UINTN Count
+ IN UINT64 Address,
+ IN CONST PCI_SEGMENT_INFO *SegmentInfo,
+ IN UINTN Count
)
{
while (Count != 0) {
if (SegmentInfo->SegmentNumber == ((PCI_SEGMENT_LIB_ADDRESS_STRUCTURE *)&Address)->Segment) {
break;
}
+
SegmentInfo++;
Count--;
}
+
ASSERT (Count != 0);
ASSERT (
(((PCI_SEGMENT_LIB_ADDRESS_STRUCTURE *)&Address)->Reserved1 == 0) &&
(((PCI_SEGMENT_LIB_ADDRESS_STRUCTURE *)&Address)->Reserved2 == 0)
- );
+ );
ASSERT (((PCI_SEGMENT_LIB_ADDRESS_STRUCTURE *)&Address)->Bus >= SegmentInfo->StartBusNumber);
ASSERT (((PCI_SEGMENT_LIB_ADDRESS_STRUCTURE *)&Address)->Bus <= SegmentInfo->EndBusNumber);
Address = SegmentInfo->BaseAddress + PCI_ECAM_ADDRESS (
- ((PCI_SEGMENT_LIB_ADDRESS_STRUCTURE *)&Address)->Bus,
- ((PCI_SEGMENT_LIB_ADDRESS_STRUCTURE *)&Address)->Device,
- ((PCI_SEGMENT_LIB_ADDRESS_STRUCTURE *)&Address)->Function,
- ((PCI_SEGMENT_LIB_ADDRESS_STRUCTURE *)&Address)->Register);
+ ((PCI_SEGMENT_LIB_ADDRESS_STRUCTURE *)&Address)->Bus,
+ ((PCI_SEGMENT_LIB_ADDRESS_STRUCTURE *)&Address)->Device,
+ ((PCI_SEGMENT_LIB_ADDRESS_STRUCTURE *)&Address)->Function,
+ ((PCI_SEGMENT_LIB_ADDRESS_STRUCTURE *)&Address)->Register
+ );
if (sizeof (UINTN) == sizeof (UINT32)) {
ASSERT (Address < BASE_4GB);
@@ -81,11 +84,11 @@ PciSegmentLibGetEcamAddress (
UINT8
EFIAPI
PciSegmentRead8 (
- IN UINT64 Address
+ IN UINT64 Address
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioRead8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count));
@@ -108,12 +111,12 @@ PciSegmentRead8 (
UINT8
EFIAPI
PciSegmentWrite8 (
- IN UINT64 Address,
- IN UINT8 Value
+ IN UINT64 Address,
+ IN UINT8 Value
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioWrite8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), Value);
@@ -139,12 +142,12 @@ PciSegmentWrite8 (
UINT8
EFIAPI
PciSegmentOr8 (
- IN UINT64 Address,
- IN UINT8 OrData
+ IN UINT64 Address,
+ IN UINT8 OrData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioOr8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), OrData);
@@ -169,12 +172,12 @@ PciSegmentOr8 (
UINT8
EFIAPI
PciSegmentAnd8 (
- IN UINT64 Address,
- IN UINT8 AndData
+ IN UINT64 Address,
+ IN UINT8 AndData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioAnd8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), AndData);
@@ -203,13 +206,13 @@ PciSegmentAnd8 (
UINT8
EFIAPI
PciSegmentAndThenOr8 (
- IN UINT64 Address,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINT64 Address,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioAndThenOr8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), AndData, OrData);
@@ -239,13 +242,13 @@ PciSegmentAndThenOr8 (
UINT8
EFIAPI
PciSegmentBitFieldRead8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldRead8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit);
@@ -278,14 +281,14 @@ PciSegmentBitFieldRead8 (
UINT8
EFIAPI
PciSegmentBitFieldWrite8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldWrite8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, Value);
@@ -321,14 +324,14 @@ PciSegmentBitFieldWrite8 (
UINT8
EFIAPI
PciSegmentBitFieldOr8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldOr8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, OrData);
@@ -364,14 +367,14 @@ PciSegmentBitFieldOr8 (
UINT8
EFIAPI
PciSegmentBitFieldAnd8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldAnd8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, AndData);
@@ -410,15 +413,15 @@ PciSegmentBitFieldAnd8 (
UINT8
EFIAPI
PciSegmentBitFieldAndThenOr8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldAndThenOr8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, AndData, OrData);
@@ -441,11 +444,11 @@ PciSegmentBitFieldAndThenOr8 (
UINT16
EFIAPI
PciSegmentRead16 (
- IN UINT64 Address
+ IN UINT64 Address
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioRead16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count));
@@ -469,12 +472,12 @@ PciSegmentRead16 (
UINT16
EFIAPI
PciSegmentWrite16 (
- IN UINT64 Address,
- IN UINT16 Value
+ IN UINT64 Address,
+ IN UINT16 Value
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioWrite16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), Value);
@@ -503,12 +506,12 @@ PciSegmentWrite16 (
UINT16
EFIAPI
PciSegmentOr16 (
- IN UINT64 Address,
- IN UINT16 OrData
+ IN UINT64 Address,
+ IN UINT16 OrData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioOr16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), OrData);
@@ -535,12 +538,12 @@ PciSegmentOr16 (
UINT16
EFIAPI
PciSegmentAnd16 (
- IN UINT64 Address,
- IN UINT16 AndData
+ IN UINT64 Address,
+ IN UINT16 AndData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioAnd16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), AndData);
@@ -570,13 +573,13 @@ PciSegmentAnd16 (
UINT16
EFIAPI
PciSegmentAndThenOr16 (
- IN UINT64 Address,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINT64 Address,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioAndThenOr16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), AndData, OrData);
@@ -607,13 +610,13 @@ PciSegmentAndThenOr16 (
UINT16
EFIAPI
PciSegmentBitFieldRead16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldRead16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit);
@@ -647,14 +650,14 @@ PciSegmentBitFieldRead16 (
UINT16
EFIAPI
PciSegmentBitFieldWrite16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldWrite16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, Value);
@@ -691,14 +694,14 @@ PciSegmentBitFieldWrite16 (
UINT16
EFIAPI
PciSegmentBitFieldOr16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldOr16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, OrData);
@@ -735,14 +738,14 @@ PciSegmentBitFieldOr16 (
UINT16
EFIAPI
PciSegmentBitFieldAnd16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldAnd16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, AndData);
@@ -782,15 +785,16 @@ PciSegmentBitFieldAnd16 (
UINT16
EFIAPI
PciSegmentBitFieldAndThenOr16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
+
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldAndThenOr16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, AndData, OrData);
}
@@ -812,11 +816,11 @@ PciSegmentBitFieldAndThenOr16 (
UINT32
EFIAPI
PciSegmentRead32 (
- IN UINT64 Address
+ IN UINT64 Address
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioRead32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count));
@@ -840,12 +844,12 @@ PciSegmentRead32 (
UINT32
EFIAPI
PciSegmentWrite32 (
- IN UINT64 Address,
- IN UINT32 Value
+ IN UINT64 Address,
+ IN UINT32 Value
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioWrite32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), Value);
@@ -872,12 +876,12 @@ PciSegmentWrite32 (
UINT32
EFIAPI
PciSegmentOr32 (
- IN UINT64 Address,
- IN UINT32 OrData
+ IN UINT64 Address,
+ IN UINT32 OrData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioOr32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), OrData);
@@ -904,12 +908,12 @@ PciSegmentOr32 (
UINT32
EFIAPI
PciSegmentAnd32 (
- IN UINT64 Address,
- IN UINT32 AndData
+ IN UINT64 Address,
+ IN UINT32 AndData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioAnd32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), AndData);
@@ -939,13 +943,13 @@ PciSegmentAnd32 (
UINT32
EFIAPI
PciSegmentAndThenOr32 (
- IN UINT64 Address,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINT64 Address,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioAndThenOr32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), AndData, OrData);
@@ -976,13 +980,13 @@ PciSegmentAndThenOr32 (
UINT32
EFIAPI
PciSegmentBitFieldRead32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldRead32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit);
@@ -1016,14 +1020,14 @@ PciSegmentBitFieldRead32 (
UINT32
EFIAPI
PciSegmentBitFieldWrite32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldWrite32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, Value);
@@ -1059,14 +1063,14 @@ PciSegmentBitFieldWrite32 (
UINT32
EFIAPI
PciSegmentBitFieldOr32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldOr32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, OrData);
@@ -1102,14 +1106,14 @@ PciSegmentBitFieldOr32 (
UINT32
EFIAPI
PciSegmentBitFieldAnd32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldAnd32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, AndData);
@@ -1149,15 +1153,16 @@ PciSegmentBitFieldAnd32 (
UINT32
EFIAPI
PciSegmentBitFieldAndThenOr32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
+
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldAndThenOr32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, AndData, OrData);
}
@@ -1188,20 +1193,20 @@ PciSegmentBitFieldAndThenOr32 (
UINTN
EFIAPI
PciSegmentReadBuffer (
- IN UINT64 StartAddress,
- IN UINTN Size,
- OUT VOID *Buffer
+ IN UINT64 StartAddress,
+ IN UINTN Size,
+ OUT VOID *Buffer
)
{
- UINTN ReturnValue;
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
- UINTN Address;
+ UINTN ReturnValue;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Address;
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
SegmentInfo = GetPciSegmentInfo (&Count);
- Address = PciSegmentLibGetEcamAddress (StartAddress, SegmentInfo, Count);
+ Address = PciSegmentLibGetEcamAddress (StartAddress, SegmentInfo, Count);
if (Size == 0) {
return 0;
@@ -1219,19 +1224,19 @@ PciSegmentReadBuffer (
// Read a byte if StartAddress is byte aligned
//
*(volatile UINT8 *)Buffer = MmioRead8 (Address);
- Address += sizeof (UINT8);
- Size -= sizeof (UINT8);
- Buffer = (UINT8*)Buffer + 1;
+ Address += sizeof (UINT8);
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *)Buffer + 1;
}
- if (Size >= sizeof (UINT16) && (Address & BIT1) != 0) {
+ if ((Size >= sizeof (UINT16)) && ((Address & BIT1) != 0)) {
//
// Read a word if StartAddress is word aligned
//
WriteUnaligned16 (Buffer, MmioRead16 (Address));
Address += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
while (Size >= sizeof (UINT32)) {
@@ -1240,8 +1245,8 @@ PciSegmentReadBuffer (
//
WriteUnaligned32 (Buffer, MmioRead32 (Address));
Address += sizeof (UINT32);
- Size -= sizeof (UINT32);
- Buffer = (UINT32*)Buffer + 1;
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *)Buffer + 1;
}
if (Size >= sizeof (UINT16)) {
@@ -1250,8 +1255,8 @@ PciSegmentReadBuffer (
//
WriteUnaligned16 (Buffer, MmioRead16 (Address));
Address += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
if (Size >= sizeof (UINT8)) {
@@ -1291,20 +1296,20 @@ PciSegmentReadBuffer (
UINTN
EFIAPI
PciSegmentWriteBuffer (
- IN UINT64 StartAddress,
- IN UINTN Size,
- IN VOID *Buffer
+ IN UINT64 StartAddress,
+ IN UINTN Size,
+ IN VOID *Buffer
)
{
- UINTN ReturnValue;
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
- UINTN Address;
+ UINTN ReturnValue;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Address;
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
SegmentInfo = GetPciSegmentInfo (&Count);
- Address = PciSegmentLibGetEcamAddress (StartAddress, SegmentInfo, Count);
+ Address = PciSegmentLibGetEcamAddress (StartAddress, SegmentInfo, Count);
if (Size == 0) {
return 0;
@@ -1321,20 +1326,20 @@ PciSegmentWriteBuffer (
//
// Write a byte if StartAddress is byte aligned
//
- MmioWrite8 (Address, *(UINT8*)Buffer);
+ MmioWrite8 (Address, *(UINT8 *)Buffer);
Address += sizeof (UINT8);
- Size -= sizeof (UINT8);
- Buffer = (UINT8*)Buffer + 1;
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *)Buffer + 1;
}
- if (Size >= sizeof (UINT16) && (Address & BIT1) != 0) {
+ if ((Size >= sizeof (UINT16)) && ((Address & BIT1) != 0)) {
//
// Write a word if StartAddress is word aligned
//
MmioWrite16 (Address, ReadUnaligned16 (Buffer));
Address += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
while (Size >= sizeof (UINT32)) {
@@ -1343,8 +1348,8 @@ PciSegmentWriteBuffer (
//
MmioWrite32 (Address, ReadUnaligned32 (Buffer));
Address += sizeof (UINT32);
- Size -= sizeof (UINT32);
- Buffer = (UINT32*)Buffer + 1;
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *)Buffer + 1;
}
if (Size >= sizeof (UINT16)) {
@@ -1353,15 +1358,15 @@ PciSegmentWriteBuffer (
//
MmioWrite16 (Address, ReadUnaligned16 (Buffer));
Address += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
if (Size >= sizeof (UINT8)) {
//
// Write the last remaining byte if exist
//
- MmioWrite8 (Address, *(UINT8*)Buffer);
+ MmioWrite8 (Address, *(UINT8 *)Buffer);
}
return ReturnValue;
diff --git a/MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.h b/MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.h
index 4668372816..f103bf6c26 100644
--- a/MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.h
+++ b/MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.h
@@ -27,7 +27,7 @@
**/
UINTN
PciSegmentLibVirtualAddress (
- IN UINTN Address
+ IN UINTN Address
);
/**
@@ -43,9 +43,9 @@ PciSegmentLibVirtualAddress (
**/
UINTN
PciSegmentLibGetEcamAddress (
- IN UINT64 Address,
- IN CONST PCI_SEGMENT_INFO *SegmentInfo,
- IN UINTN Count
+ IN UINT64 Address,
+ IN CONST PCI_SEGMENT_INFO *SegmentInfo,
+ IN UINTN Count
);
#endif
diff --git a/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.c b/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.c
index 85dee7f529..6465011530 100644
--- a/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.c
+++ b/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.c
@@ -6,7 +6,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-
#include <PiPei.h>
//
@@ -50,21 +49,20 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
VOID
EFIAPI
-_ModuleEntryPoint(
+_ModuleEntryPoint (
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,
IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList
-)
+ )
{
ProcessModuleEntryPointList (SecCoreData, PpiList, NULL);
//
// Should never return
//
- ASSERT(FALSE);
+ ASSERT (FALSE);
CpuDeadLoop ();
}
-
/**
Required by the EBC compiler and identical in functionality to _ModuleEntryPoint().
diff --git a/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PostCode.c b/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PostCode.c
index cccb706731..bf2da0c0cf 100644
--- a/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PostCode.c
+++ b/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PostCode.c
@@ -7,7 +7,6 @@
**/
-
#include <PiPei.h>
#include <Library/PostCodeLib.h>
@@ -58,7 +57,6 @@ PostCode (
return Value;
}
-
/**
Sends an 32-bit value to a POST and associated ASCII string.
@@ -107,7 +105,6 @@ PostCodeWithDescription (
return Value;
}
-
/**
Returns TRUE if POST Codes are enabled.
@@ -126,10 +123,9 @@ PostCodeEnabled (
VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);
}
-
/**
Returns TRUE if POST code descriptions are enabled.
@@ -148,6 +144,5 @@ PostCodeDescriptionEnabled (
VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED) != 0);
}
-
diff --git a/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c b/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c
index 5d12016bc7..c538f157a2 100644
--- a/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c
+++ b/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c
@@ -14,14 +14,14 @@
#include <Library/HobLib.h>
#include <Library/ExtractGuidedSectionLib.h>
-#define PEI_EXTRACT_HANDLER_INFO_SIGNATURE SIGNATURE_32 ('P', 'E', 'H', 'I')
+#define PEI_EXTRACT_HANDLER_INFO_SIGNATURE SIGNATURE_32 ('P', 'E', 'H', 'I')
typedef struct {
- UINT32 Signature;
- UINT32 NumberOfExtractHandler;
- GUID *ExtractHandlerGuidTable;
- EXTRACT_GUIDED_SECTION_DECODE_HANDLER *ExtractDecodeHandlerTable;
- EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *ExtractGetInfoHandlerTable;
+ UINT32 Signature;
+ UINT32 NumberOfExtractHandler;
+ GUID *ExtractHandlerGuidTable;
+ EXTRACT_GUIDED_SECTION_DECODE_HANDLER *ExtractDecodeHandlerTable;
+ EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *ExtractGetInfoHandlerTable;
} PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO;
/**
@@ -35,11 +35,11 @@ typedef struct {
**/
RETURN_STATUS
PeiGetExtractGuidedSectionHandlerInfo (
- IN OUT PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO **InfoPointer
+ IN OUT PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO **InfoPointer
)
{
- PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
- EFI_PEI_HOB_POINTERS Hob;
+ PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
+ EFI_PEI_HOB_POINTERS Hob;
//
// First try to get handler information from guid hob specified by CallerId.
@@ -47,23 +47,24 @@ PeiGetExtractGuidedSectionHandlerInfo (
Hob.Raw = GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, GetHobList ());
while (Hob.Raw != NULL) {
if (CompareGuid (&(Hob.Guid->Name), &gEfiCallerIdGuid)) {
- HandlerInfo = (PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *) GET_GUID_HOB_DATA (Hob.Guid);
+ HandlerInfo = (PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *)GET_GUID_HOB_DATA (Hob.Guid);
if (HandlerInfo->Signature == PEI_EXTRACT_HANDLER_INFO_SIGNATURE) {
//
// Update Table Pointer when hob start address is changed.
//
- if (HandlerInfo->ExtractHandlerGuidTable != (GUID *) (HandlerInfo + 1)) {
- HandlerInfo->ExtractHandlerGuidTable = (GUID *) (HandlerInfo + 1);
- HandlerInfo->ExtractDecodeHandlerTable = (EXTRACT_GUIDED_SECTION_DECODE_HANDLER *) (
- (UINT8 *)HandlerInfo->ExtractHandlerGuidTable +
- PcdGet32 (PcdMaximumGuidedExtractHandler) * sizeof (GUID)
- );
- HandlerInfo->ExtractGetInfoHandlerTable = (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *) (
- (UINT8 *)HandlerInfo->ExtractDecodeHandlerTable +
- PcdGet32 (PcdMaximumGuidedExtractHandler) *
- sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER)
- );
+ if (HandlerInfo->ExtractHandlerGuidTable != (GUID *)(HandlerInfo + 1)) {
+ HandlerInfo->ExtractHandlerGuidTable = (GUID *)(HandlerInfo + 1);
+ HandlerInfo->ExtractDecodeHandlerTable = (EXTRACT_GUIDED_SECTION_DECODE_HANDLER *)(
+ (UINT8 *)HandlerInfo->ExtractHandlerGuidTable +
+ PcdGet32 (PcdMaximumGuidedExtractHandler) * sizeof (GUID)
+ );
+ HandlerInfo->ExtractGetInfoHandlerTable = (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *)(
+ (UINT8 *)HandlerInfo->ExtractDecodeHandlerTable +
+ PcdGet32 (PcdMaximumGuidedExtractHandler) *
+ sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER)
+ );
}
+
//
// Return HandlerInfo pointer.
//
@@ -71,6 +72,7 @@ PeiGetExtractGuidedSectionHandlerInfo (
return EFI_SUCCESS;
}
}
+
Hob.Raw = GET_NEXT_HOB (Hob);
Hob.Raw = GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, Hob.Raw);
}
@@ -79,11 +81,11 @@ PeiGetExtractGuidedSectionHandlerInfo (
// If Guid Hob is not found, Build CallerId Guid hob to store Handler Info
//
HandlerInfo = BuildGuidHob (
- &gEfiCallerIdGuid,
- sizeof (PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO) +
- PcdGet32 (PcdMaximumGuidedExtractHandler) *
- (sizeof (GUID) + sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER) + sizeof (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER))
- );
+ &gEfiCallerIdGuid,
+ sizeof (PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO) +
+ PcdGet32 (PcdMaximumGuidedExtractHandler) *
+ (sizeof (GUID) + sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER) + sizeof (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER))
+ );
if (HandlerInfo == NULL) {
//
// No enough resource to build guid hob.
@@ -91,21 +93,22 @@ PeiGetExtractGuidedSectionHandlerInfo (
*InfoPointer = NULL;
return EFI_OUT_OF_RESOURCES;
}
+
//
// Init HandlerInfo structure
//
- HandlerInfo->Signature = PEI_EXTRACT_HANDLER_INFO_SIGNATURE;
- HandlerInfo->NumberOfExtractHandler = 0;
- HandlerInfo->ExtractHandlerGuidTable = (GUID *) (HandlerInfo + 1);
- HandlerInfo->ExtractDecodeHandlerTable = (EXTRACT_GUIDED_SECTION_DECODE_HANDLER *) (
- (UINT8 *)HandlerInfo->ExtractHandlerGuidTable +
- PcdGet32 (PcdMaximumGuidedExtractHandler) * sizeof (GUID)
- );
- HandlerInfo->ExtractGetInfoHandlerTable = (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *) (
- (UINT8 *)HandlerInfo->ExtractDecodeHandlerTable +
- PcdGet32 (PcdMaximumGuidedExtractHandler) *
- sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER)
- );
+ HandlerInfo->Signature = PEI_EXTRACT_HANDLER_INFO_SIGNATURE;
+ HandlerInfo->NumberOfExtractHandler = 0;
+ HandlerInfo->ExtractHandlerGuidTable = (GUID *)(HandlerInfo + 1);
+ HandlerInfo->ExtractDecodeHandlerTable = (EXTRACT_GUIDED_SECTION_DECODE_HANDLER *)(
+ (UINT8 *)HandlerInfo->ExtractHandlerGuidTable +
+ PcdGet32 (PcdMaximumGuidedExtractHandler) * sizeof (GUID)
+ );
+ HandlerInfo->ExtractGetInfoHandlerTable = (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *)(
+ (UINT8 *)HandlerInfo->ExtractDecodeHandlerTable +
+ PcdGet32 (PcdMaximumGuidedExtractHandler) *
+ sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER)
+ );
//
// return the created HandlerInfo.
//
@@ -133,8 +136,8 @@ ExtractGuidedSectionGetGuidList (
OUT GUID **ExtractHandlerGuidTable
)
{
- EFI_STATUS Status;
- PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
+ EFI_STATUS Status;
+ PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
ASSERT (ExtractHandlerGuidTable != NULL);
@@ -187,9 +190,9 @@ ExtractGuidedSectionRegisterHandlers (
IN EXTRACT_GUIDED_SECTION_DECODE_HANDLER DecodeHandler
)
{
- EFI_STATUS Status;
- UINT32 Index;
- PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
+ EFI_STATUS Status;
+ UINT32 Index;
+ PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
//
// Check input parameter
@@ -198,8 +201,6 @@ ExtractGuidedSectionRegisterHandlers (
ASSERT (GetInfoHandler != NULL);
ASSERT (DecodeHandler != NULL);
-
-
//
// Get the registered handler information
//
@@ -212,13 +213,13 @@ ExtractGuidedSectionRegisterHandlers (
// Search the match registered GetInfo handler for the input guided section.
//
ASSERT (HandlerInfo != NULL);
- for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
+ for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index++) {
if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionGuid)) {
//
// If the guided handler has been registered before, only update its handler.
//
- HandlerInfo->ExtractDecodeHandlerTable [Index] = DecodeHandler;
- HandlerInfo->ExtractGetInfoHandlerTable [Index] = GetInfoHandler;
+ HandlerInfo->ExtractDecodeHandlerTable[Index] = DecodeHandler;
+ HandlerInfo->ExtractGetInfoHandlerTable[Index] = GetInfoHandler;
return RETURN_SUCCESS;
}
}
@@ -234,16 +235,16 @@ ExtractGuidedSectionRegisterHandlers (
// Register new Handler and guid value.
//
CopyGuid (HandlerInfo->ExtractHandlerGuidTable + HandlerInfo->NumberOfExtractHandler, SectionGuid);
- HandlerInfo->ExtractDecodeHandlerTable [HandlerInfo->NumberOfExtractHandler] = DecodeHandler;
- HandlerInfo->ExtractGetInfoHandlerTable [HandlerInfo->NumberOfExtractHandler++] = GetInfoHandler;
+ HandlerInfo->ExtractDecodeHandlerTable[HandlerInfo->NumberOfExtractHandler] = DecodeHandler;
+ HandlerInfo->ExtractGetInfoHandlerTable[HandlerInfo->NumberOfExtractHandler++] = GetInfoHandler;
//
// Build the Guided Section GUID HOB to record the GUID itself.
// Then the content of the GUIDed HOB will be the same as the GUID value itself.
//
BuildGuidDataHob (
- (EFI_GUID *) SectionGuid,
- (VOID *) SectionGuid,
+ (EFI_GUID *)SectionGuid,
+ (VOID *)SectionGuid,
sizeof (GUID)
);
@@ -293,10 +294,10 @@ ExtractGuidedSectionGetInfo (
OUT UINT16 *SectionAttribute
)
{
- UINT32 Index;
- EFI_STATUS Status;
- PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
- EFI_GUID *SectionDefinitionGuid;
+ UINT32 Index;
+ EFI_STATUS Status;
+ PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
+ EFI_GUID *SectionDefinitionGuid;
//
// Check input parameter
@@ -315,26 +316,26 @@ ExtractGuidedSectionGetInfo (
}
if (IS_SECTION2 (InputSection)) {
- SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *)InputSection)->SectionDefinitionGuid);
} else {
- SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *)InputSection)->SectionDefinitionGuid);
}
//
// Search the match registered GetInfo handler for the input guided section.
//
ASSERT (HandlerInfo != NULL);
- for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
+ for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index++) {
if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {
//
// Call the match handler to get information for the input section data.
//
- return HandlerInfo->ExtractGetInfoHandlerTable [Index] (
- InputSection,
- OutputBufferSize,
- ScratchBufferSize,
- SectionAttribute
- );
+ return HandlerInfo->ExtractGetInfoHandlerTable[Index](
+ InputSection,
+ OutputBufferSize,
+ ScratchBufferSize,
+ SectionAttribute
+ );
}
}
@@ -388,10 +389,10 @@ ExtractGuidedSectionDecode (
OUT UINT32 *AuthenticationStatus
)
{
- UINT32 Index;
- EFI_STATUS Status;
- PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
- EFI_GUID *SectionDefinitionGuid;
+ UINT32 Index;
+ EFI_STATUS Status;
+ PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
+ EFI_GUID *SectionDefinitionGuid;
//
// Check input parameter
@@ -409,26 +410,26 @@ ExtractGuidedSectionDecode (
}
if (IS_SECTION2 (InputSection)) {
- SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *)InputSection)->SectionDefinitionGuid);
} else {
- SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *)InputSection)->SectionDefinitionGuid);
}
//
// Search the match registered Extract handler for the input guided section.
//
ASSERT (HandlerInfo != NULL);
- for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
+ for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index++) {
if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {
//
// Call the match handler to extract raw data for the input guided section.
//
- return HandlerInfo->ExtractDecodeHandlerTable [Index] (
- InputSection,
- OutputBuffer,
- ScratchBuffer,
- AuthenticationStatus
- );
+ return HandlerInfo->ExtractDecodeHandlerTable[Index](
+ InputSection,
+ OutputBuffer,
+ ScratchBuffer,
+ AuthenticationStatus
+ );
}
}
@@ -494,20 +495,22 @@ ExtractGuidedSectionGetHandlers (
// Search the match registered GetInfo handler for the input guided section.
//
ASSERT (HandlerInfo != NULL);
- for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
+ for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index++) {
if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionGuid)) {
-
//
// If the guided handler has been registered before, then return the registered handlers.
//
if (GetInfoHandler != NULL) {
*GetInfoHandler = HandlerInfo->ExtractGetInfoHandlerTable[Index];
}
+
if (DecodeHandler != NULL) {
*DecodeHandler = HandlerInfo->ExtractDecodeHandlerTable[Index];
}
+
return RETURN_SUCCESS;
}
}
+
return RETURN_NOT_FOUND;
}
diff --git a/MdePkg/Library/PeiHobLib/HobLib.c b/MdePkg/Library/PeiHobLib/HobLib.c
index 2b110a8aa6..4fecd19660 100644
--- a/MdePkg/Library/PeiHobLib/HobLib.c
+++ b/MdePkg/Library/PeiHobLib/HobLib.c
@@ -37,8 +37,8 @@ GetHobList (
VOID
)
{
- EFI_STATUS Status;
- VOID *HobList;
+ EFI_STATUS Status;
+ VOID *HobList;
Status = PeiServicesGetHobList (&HobList);
ASSERT_EFI_ERROR (Status);
@@ -67,15 +67,15 @@ GetHobList (
VOID *
EFIAPI
GetNextHob (
- IN UINT16 Type,
- IN CONST VOID *HobStart
+ IN UINT16 Type,
+ IN CONST VOID *HobStart
)
{
EFI_PEI_HOB_POINTERS Hob;
ASSERT (HobStart != NULL);
- Hob.Raw = (UINT8 *) HobStart;
+ Hob.Raw = (UINT8 *)HobStart;
//
// Parse the HOB list until end of list or matching type is found.
//
@@ -83,8 +83,10 @@ GetNextHob (
if (Hob.Header->HobType == Type) {
return Hob.Raw;
}
+
Hob.Raw = GET_NEXT_HOB (Hob);
}
+
return NULL;
}
@@ -104,10 +106,10 @@ GetNextHob (
VOID *
EFIAPI
GetFirstHob (
- IN UINT16 Type
+ IN UINT16 Type
)
{
- VOID *HobList;
+ VOID *HobList;
HobList = GetHobList ();
return GetNextHob (Type, HobList);
@@ -138,19 +140,21 @@ GetFirstHob (
VOID *
EFIAPI
GetNextGuidHob (
- IN CONST EFI_GUID *Guid,
- IN CONST VOID *HobStart
+ IN CONST EFI_GUID *Guid,
+ IN CONST VOID *HobStart
)
{
EFI_PEI_HOB_POINTERS GuidHob;
- GuidHob.Raw = (UINT8 *) HobStart;
+ GuidHob.Raw = (UINT8 *)HobStart;
while ((GuidHob.Raw = GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, GuidHob.Raw)) != NULL) {
if (CompareGuid (Guid, &GuidHob.Guid->Name)) {
break;
}
+
GuidHob.Raw = GET_NEXT_HOB (GuidHob);
}
+
return GuidHob.Raw;
}
@@ -175,10 +179,10 @@ GetNextGuidHob (
VOID *
EFIAPI
GetFirstGuidHob (
- IN CONST EFI_GUID *Guid
+ IN CONST EFI_GUID *Guid
)
{
- VOID *HobList;
+ VOID *HobList;
HobList = GetHobList ();
return GetNextGuidHob (Guid, HobList);
@@ -203,8 +207,8 @@ GetBootModeHob (
VOID
)
{
- EFI_STATUS Status;
- EFI_BOOT_MODE BootMode;
+ EFI_STATUS Status;
+ EFI_BOOT_MODE BootMode;
Status = PeiServicesGetBootMode (&BootMode);
ASSERT_EFI_ERROR (Status);
@@ -227,17 +231,18 @@ GetBootModeHob (
VOID *
EFIAPI
InternalPeiCreateHob (
- IN UINT16 Type,
- IN UINT16 Length
+ IN UINT16 Type,
+ IN UINT16 Length
)
{
- EFI_STATUS Status;
- VOID *Hob;
+ EFI_STATUS Status;
+ VOID *Hob;
Status = PeiServicesCreateHob (Type, Length, &Hob);
if (EFI_ERROR (Status)) {
Hob = NULL;
}
+
//
// Assume the process of HOB building is always successful.
//
@@ -264,18 +269,20 @@ InternalPeiCreateHob (
VOID
EFIAPI
BuildModuleHob (
- IN CONST EFI_GUID *ModuleName,
- IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule,
- IN UINT64 ModuleLength,
- IN EFI_PHYSICAL_ADDRESS EntryPoint
+ IN CONST EFI_GUID *ModuleName,
+ IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule,
+ IN UINT64 ModuleLength,
+ IN EFI_PHYSICAL_ADDRESS EntryPoint
)
{
EFI_HOB_MEMORY_ALLOCATION_MODULE *Hob;
- ASSERT (((MemoryAllocationModule & (EFI_PAGE_SIZE - 1)) == 0) &&
- ((ModuleLength & (EFI_PAGE_SIZE - 1)) == 0));
+ ASSERT (
+ ((MemoryAllocationModule & (EFI_PAGE_SIZE - 1)) == 0) &&
+ ((ModuleLength & (EFI_PAGE_SIZE - 1)) == 0)
+ );
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION_MODULE));
+ Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16)sizeof (EFI_HOB_MEMORY_ALLOCATION_MODULE));
if (Hob == NULL) {
return;
}
@@ -322,7 +329,7 @@ BuildResourceDescriptorWithOwnerHob (
{
EFI_HOB_RESOURCE_DESCRIPTOR *Hob;
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, (UINT16) sizeof (EFI_HOB_RESOURCE_DESCRIPTOR));
+ Hob = InternalPeiCreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, (UINT16)sizeof (EFI_HOB_RESOURCE_DESCRIPTOR));
if (Hob == NULL) {
return;
}
@@ -361,7 +368,7 @@ BuildResourceDescriptorHob (
{
EFI_HOB_RESOURCE_DESCRIPTOR *Hob;
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, (UINT16) sizeof (EFI_HOB_RESOURCE_DESCRIPTOR));
+ Hob = InternalPeiCreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, (UINT16)sizeof (EFI_HOB_RESOURCE_DESCRIPTOR));
if (Hob == NULL) {
return;
}
@@ -398,11 +405,11 @@ BuildResourceDescriptorHob (
VOID *
EFIAPI
BuildGuidHob (
- IN CONST EFI_GUID *Guid,
- IN UINTN DataLength
+ IN CONST EFI_GUID *Guid,
+ IN UINTN DataLength
)
{
- EFI_HOB_GUID_TYPE *Hob;
+ EFI_HOB_GUID_TYPE *Hob;
//
// Make sure Guid is valid
@@ -414,10 +421,11 @@ BuildGuidHob (
//
ASSERT (DataLength <= (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)));
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_GUID_EXTENSION, (UINT16) (sizeof (EFI_HOB_GUID_TYPE) + DataLength));
+ Hob = InternalPeiCreateHob (EFI_HOB_TYPE_GUID_EXTENSION, (UINT16)(sizeof (EFI_HOB_GUID_TYPE) + DataLength));
if (Hob == NULL) {
return Hob;
}
+
CopyGuid (&Hob->Name, Guid);
return Hob + 1;
}
@@ -450,9 +458,9 @@ BuildGuidHob (
VOID *
EFIAPI
BuildGuidDataHob (
- IN CONST EFI_GUID *Guid,
- IN VOID *Data,
- IN UINTN DataLength
+ IN CONST EFI_GUID *Guid,
+ IN VOID *Data,
+ IN UINTN DataLength
)
{
VOID *HobData;
@@ -479,15 +487,15 @@ BuildGuidDataHob (
**/
BOOLEAN
InternalCheckFvAlignment (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length
)
{
- EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
- UINT32 FvAlignment;
+ EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
+ UINT32 FvAlignment;
FvAlignment = 0;
- FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) BaseAddress;
+ FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)BaseAddress;
//
// If EFI_FVB2_WEAK_ALIGNMENT is set in the volume header then the first byte of the volume
@@ -505,6 +513,7 @@ InternalCheckFvAlignment (
if (FvAlignment < 8) {
FvAlignment = 8;
}
+
if ((UINTN)BaseAddress % FvAlignment != 0) {
//
// FvImage buffer is not at its required alignment.
@@ -540,8 +549,8 @@ InternalCheckFvAlignment (
VOID
EFIAPI
BuildFvHob (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length
)
{
EFI_HOB_FIRMWARE_VOLUME *Hob;
@@ -551,7 +560,7 @@ BuildFvHob (
return;
}
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV, (UINT16) sizeof (EFI_HOB_FIRMWARE_VOLUME));
+ Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV, (UINT16)sizeof (EFI_HOB_FIRMWARE_VOLUME));
if (Hob == NULL) {
return;
}
@@ -579,10 +588,10 @@ BuildFvHob (
VOID
EFIAPI
BuildFv2Hob (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN CONST EFI_GUID *FvName,
- IN CONST EFI_GUID *FileName
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length,
+ IN CONST EFI_GUID *FvName,
+ IN CONST EFI_GUID *FileName
)
{
EFI_HOB_FIRMWARE_VOLUME2 *Hob;
@@ -592,7 +601,7 @@ BuildFv2Hob (
return;
}
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV2, (UINT16) sizeof (EFI_HOB_FIRMWARE_VOLUME2));
+ Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV2, (UINT16)sizeof (EFI_HOB_FIRMWARE_VOLUME2));
if (Hob == NULL) {
return;
}
@@ -627,12 +636,12 @@ BuildFv2Hob (
VOID
EFIAPI
BuildFv3Hob (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN UINT32 AuthenticationStatus,
- IN BOOLEAN ExtractedFv,
- IN CONST EFI_GUID *FvName OPTIONAL,
- IN CONST EFI_GUID *FileName OPTIONAL
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length,
+ IN UINT32 AuthenticationStatus,
+ IN BOOLEAN ExtractedFv,
+ IN CONST EFI_GUID *FvName OPTIONAL,
+ IN CONST EFI_GUID *FileName OPTIONAL
)
{
EFI_HOB_FIRMWARE_VOLUME3 *Hob;
@@ -642,7 +651,7 @@ BuildFv3Hob (
return;
}
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV3, (UINT16) sizeof (EFI_HOB_FIRMWARE_VOLUME3));
+ Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV3, (UINT16)sizeof (EFI_HOB_FIRMWARE_VOLUME3));
if (Hob == NULL) {
return;
}
@@ -674,19 +683,19 @@ BuildFv3Hob (
VOID
EFIAPI
BuildCvHob (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length
)
{
EFI_HOB_UEFI_CAPSULE *Hob;
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_UEFI_CAPSULE, (UINT16) sizeof (EFI_HOB_UEFI_CAPSULE));
+ Hob = InternalPeiCreateHob (EFI_HOB_TYPE_UEFI_CAPSULE, (UINT16)sizeof (EFI_HOB_UEFI_CAPSULE));
if (Hob == NULL) {
return;
}
- Hob->BaseAddress = BaseAddress;
- Hob->Length = Length;
+ Hob->BaseAddress = BaseAddress;
+ Hob->Length = Length;
}
/**
@@ -705,13 +714,13 @@ BuildCvHob (
VOID
EFIAPI
BuildCpuHob (
- IN UINT8 SizeOfMemorySpace,
- IN UINT8 SizeOfIoSpace
+ IN UINT8 SizeOfMemorySpace,
+ IN UINT8 SizeOfIoSpace
)
{
EFI_HOB_CPU *Hob;
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_CPU, (UINT16) sizeof (EFI_HOB_CPU));
+ Hob = InternalPeiCreateHob (EFI_HOB_TYPE_CPU, (UINT16)sizeof (EFI_HOB_CPU));
if (Hob == NULL) {
return;
}
@@ -741,16 +750,18 @@ BuildCpuHob (
VOID
EFIAPI
BuildStackHob (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length
)
{
EFI_HOB_MEMORY_ALLOCATION_STACK *Hob;
- ASSERT (((BaseAddress & (EFI_PAGE_SIZE - 1)) == 0) &&
- ((Length & (EFI_PAGE_SIZE - 1)) == 0));
+ ASSERT (
+ ((BaseAddress & (EFI_PAGE_SIZE - 1)) == 0) &&
+ ((Length & (EFI_PAGE_SIZE - 1)) == 0)
+ );
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION_STACK));
+ Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16)sizeof (EFI_HOB_MEMORY_ALLOCATION_STACK));
if (Hob == NULL) {
return;
}
@@ -783,17 +794,19 @@ BuildStackHob (
VOID
EFIAPI
BuildBspStoreHob (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN EFI_MEMORY_TYPE MemoryType
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length,
+ IN EFI_MEMORY_TYPE MemoryType
)
{
EFI_HOB_MEMORY_ALLOCATION_BSP_STORE *Hob;
- ASSERT (((BaseAddress & (EFI_PAGE_SIZE - 1)) == 0) &&
- ((Length & (EFI_PAGE_SIZE - 1)) == 0));
+ ASSERT (
+ ((BaseAddress & (EFI_PAGE_SIZE - 1)) == 0) &&
+ ((Length & (EFI_PAGE_SIZE - 1)) == 0)
+ );
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION_BSP_STORE));
+ Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16)sizeof (EFI_HOB_MEMORY_ALLOCATION_BSP_STORE));
if (Hob == NULL) {
return;
}
@@ -826,17 +839,19 @@ BuildBspStoreHob (
VOID
EFIAPI
BuildMemoryAllocationHob (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN EFI_MEMORY_TYPE MemoryType
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length,
+ IN EFI_MEMORY_TYPE MemoryType
)
{
EFI_HOB_MEMORY_ALLOCATION *Hob;
- ASSERT (((BaseAddress & (EFI_PAGE_SIZE - 1)) == 0) &&
- ((Length & (EFI_PAGE_SIZE - 1)) == 0));
+ ASSERT (
+ ((BaseAddress & (EFI_PAGE_SIZE - 1)) == 0) &&
+ ((Length & (EFI_PAGE_SIZE - 1)) == 0)
+ );
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION));
+ Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16)sizeof (EFI_HOB_MEMORY_ALLOCATION));
if (Hob == NULL) {
return;
}
diff --git a/MdePkg/Library/PeiIoLibCpuIo/IoHighLevel.c b/MdePkg/Library/PeiIoLibCpuIo/IoHighLevel.c
index a136c4a9ab..04954957b0 100644
--- a/MdePkg/Library/PeiIoLibCpuIo/IoHighLevel.c
+++ b/MdePkg/Library/PeiIoLibCpuIo/IoHighLevel.c
@@ -9,7 +9,6 @@
**/
-
#include <PiPei.h>
#include <Library/IoLib.h>
@@ -38,11 +37,11 @@
UINT8
EFIAPI
IoOr8 (
- IN UINTN Port,
- IN UINT8 OrData
+ IN UINTN Port,
+ IN UINT8 OrData
)
{
- return IoWrite8 (Port, (UINT8) (IoRead8 (Port) | OrData));
+ return IoWrite8 (Port, (UINT8)(IoRead8 (Port) | OrData));
}
/**
@@ -66,11 +65,11 @@ IoOr8 (
UINT8
EFIAPI
IoAnd8 (
- IN UINTN Port,
- IN UINT8 AndData
+ IN UINTN Port,
+ IN UINT8 AndData
)
{
- return IoWrite8 (Port, (UINT8) (IoRead8 (Port) & AndData));
+ return IoWrite8 (Port, (UINT8)(IoRead8 (Port) & AndData));
}
/**
@@ -96,12 +95,12 @@ IoAnd8 (
UINT8
EFIAPI
IoAndThenOr8 (
- IN UINTN Port,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Port,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
- return IoWrite8 (Port, (UINT8) ((IoRead8 (Port) & AndData) | OrData));
+ return IoWrite8 (Port, (UINT8)((IoRead8 (Port) & AndData) | OrData));
}
/**
@@ -127,9 +126,9 @@ IoAndThenOr8 (
UINT8
EFIAPI
IoBitFieldRead8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead8 (IoRead8 (Port), StartBit, EndBit);
@@ -161,10 +160,10 @@ IoBitFieldRead8 (
UINT8
EFIAPI
IoBitFieldWrite8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
return IoWrite8 (
@@ -202,10 +201,10 @@ IoBitFieldWrite8 (
UINT8
EFIAPI
IoBitFieldOr8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
return IoWrite8 (
@@ -243,10 +242,10 @@ IoBitFieldOr8 (
UINT8
EFIAPI
IoBitFieldAnd8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
return IoWrite8 (
@@ -288,11 +287,11 @@ IoBitFieldAnd8 (
UINT8
EFIAPI
IoBitFieldAndThenOr8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
return IoWrite8 (
@@ -323,11 +322,11 @@ IoBitFieldAndThenOr8 (
UINT16
EFIAPI
IoOr16 (
- IN UINTN Port,
- IN UINT16 OrData
+ IN UINTN Port,
+ IN UINT16 OrData
)
{
- return IoWrite16 (Port, (UINT16) (IoRead16 (Port) | OrData));
+ return IoWrite16 (Port, (UINT16)(IoRead16 (Port) | OrData));
}
/**
@@ -352,11 +351,11 @@ IoOr16 (
UINT16
EFIAPI
IoAnd16 (
- IN UINTN Port,
- IN UINT16 AndData
+ IN UINTN Port,
+ IN UINT16 AndData
)
{
- return IoWrite16 (Port, (UINT16) (IoRead16 (Port) & AndData));
+ return IoWrite16 (Port, (UINT16)(IoRead16 (Port) & AndData));
}
/**
@@ -383,12 +382,12 @@ IoAnd16 (
UINT16
EFIAPI
IoAndThenOr16 (
- IN UINTN Port,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Port,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
- return IoWrite16 (Port, (UINT16) ((IoRead16 (Port) & AndData) | OrData));
+ return IoWrite16 (Port, (UINT16)((IoRead16 (Port) & AndData) | OrData));
}
/**
@@ -415,9 +414,9 @@ IoAndThenOr16 (
UINT16
EFIAPI
IoBitFieldRead16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead16 (IoRead16 (Port), StartBit, EndBit);
@@ -451,10 +450,10 @@ IoBitFieldRead16 (
UINT16
EFIAPI
IoBitFieldWrite16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
return IoWrite16 (
@@ -493,10 +492,10 @@ IoBitFieldWrite16 (
UINT16
EFIAPI
IoBitFieldOr16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
return IoWrite16 (
@@ -535,10 +534,10 @@ IoBitFieldOr16 (
UINT16
EFIAPI
IoBitFieldAnd16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
return IoWrite16 (
@@ -581,11 +580,11 @@ IoBitFieldAnd16 (
UINT16
EFIAPI
IoBitFieldAndThenOr16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
return IoWrite16 (
@@ -616,8 +615,8 @@ IoBitFieldAndThenOr16 (
UINT32
EFIAPI
IoOr32 (
- IN UINTN Port,
- IN UINT32 OrData
+ IN UINTN Port,
+ IN UINT32 OrData
)
{
return IoWrite32 (Port, IoRead32 (Port) | OrData);
@@ -645,8 +644,8 @@ IoOr32 (
UINT32
EFIAPI
IoAnd32 (
- IN UINTN Port,
- IN UINT32 AndData
+ IN UINTN Port,
+ IN UINT32 AndData
)
{
return IoWrite32 (Port, IoRead32 (Port) & AndData);
@@ -676,9 +675,9 @@ IoAnd32 (
UINT32
EFIAPI
IoAndThenOr32 (
- IN UINTN Port,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Port,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return IoWrite32 (Port, (IoRead32 (Port) & AndData) | OrData);
@@ -708,9 +707,9 @@ IoAndThenOr32 (
UINT32
EFIAPI
IoBitFieldRead32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead32 (IoRead32 (Port), StartBit, EndBit);
@@ -744,10 +743,10 @@ IoBitFieldRead32 (
UINT32
EFIAPI
IoBitFieldWrite32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
return IoWrite32 (
@@ -786,10 +785,10 @@ IoBitFieldWrite32 (
UINT32
EFIAPI
IoBitFieldOr32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
return IoWrite32 (
@@ -828,10 +827,10 @@ IoBitFieldOr32 (
UINT32
EFIAPI
IoBitFieldAnd32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
return IoWrite32 (
@@ -874,11 +873,11 @@ IoBitFieldAnd32 (
UINT32
EFIAPI
IoBitFieldAndThenOr32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return IoWrite32 (
@@ -909,8 +908,8 @@ IoBitFieldAndThenOr32 (
UINT64
EFIAPI
IoOr64 (
- IN UINTN Port,
- IN UINT64 OrData
+ IN UINTN Port,
+ IN UINT64 OrData
)
{
return IoWrite64 (Port, IoRead64 (Port) | OrData);
@@ -938,8 +937,8 @@ IoOr64 (
UINT64
EFIAPI
IoAnd64 (
- IN UINTN Port,
- IN UINT64 AndData
+ IN UINTN Port,
+ IN UINT64 AndData
)
{
return IoWrite64 (Port, IoRead64 (Port) & AndData);
@@ -969,9 +968,9 @@ IoAnd64 (
UINT64
EFIAPI
IoAndThenOr64 (
- IN UINTN Port,
- IN UINT64 AndData,
- IN UINT64 OrData
+ IN UINTN Port,
+ IN UINT64 AndData,
+ IN UINT64 OrData
)
{
return IoWrite64 (Port, (IoRead64 (Port) & AndData) | OrData);
@@ -1001,9 +1000,9 @@ IoAndThenOr64 (
UINT64
EFIAPI
IoBitFieldRead64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead64 (IoRead64 (Port), StartBit, EndBit);
@@ -1037,10 +1036,10 @@ IoBitFieldRead64 (
UINT64
EFIAPI
IoBitFieldWrite64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 Value
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 Value
)
{
return IoWrite64 (
@@ -1079,10 +1078,10 @@ IoBitFieldWrite64 (
UINT64
EFIAPI
IoBitFieldOr64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 OrData
)
{
return IoWrite64 (
@@ -1121,10 +1120,10 @@ IoBitFieldOr64 (
UINT64
EFIAPI
IoBitFieldAnd64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData
)
{
return IoWrite64 (
@@ -1167,11 +1166,11 @@ IoBitFieldAnd64 (
UINT64
EFIAPI
IoBitFieldAndThenOr64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData,
- IN UINT64 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData,
+ IN UINT64 OrData
)
{
return IoWrite64 (
@@ -1201,11 +1200,11 @@ IoBitFieldAndThenOr64 (
UINT8
EFIAPI
MmioOr8 (
- IN UINTN Address,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 OrData
)
{
- return MmioWrite8 (Address, (UINT8) (MmioRead8 (Address) | OrData));
+ return MmioWrite8 (Address, (UINT8)(MmioRead8 (Address) | OrData));
}
/**
@@ -1229,11 +1228,11 @@ MmioOr8 (
UINT8
EFIAPI
MmioAnd8 (
- IN UINTN Address,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINT8 AndData
)
{
- return MmioWrite8 (Address, (UINT8) (MmioRead8 (Address) & AndData));
+ return MmioWrite8 (Address, (UINT8)(MmioRead8 (Address) & AndData));
}
/**
@@ -1260,12 +1259,12 @@ MmioAnd8 (
UINT8
EFIAPI
MmioAndThenOr8 (
- IN UINTN Address,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
- return MmioWrite8 (Address, (UINT8) ((MmioRead8 (Address) & AndData) | OrData));
+ return MmioWrite8 (Address, (UINT8)((MmioRead8 (Address) & AndData) | OrData));
}
/**
@@ -1291,9 +1290,9 @@ MmioAndThenOr8 (
UINT8
EFIAPI
MmioBitFieldRead8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead8 (MmioRead8 (Address), StartBit, EndBit);
@@ -1325,10 +1324,10 @@ MmioBitFieldRead8 (
UINT8
EFIAPI
MmioBitFieldWrite8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
return MmioWrite8 (
@@ -1367,10 +1366,10 @@ MmioBitFieldWrite8 (
UINT8
EFIAPI
MmioBitFieldOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
return MmioWrite8 (
@@ -1409,10 +1408,10 @@ MmioBitFieldOr8 (
UINT8
EFIAPI
MmioBitFieldAnd8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
return MmioWrite8 (
@@ -1454,11 +1453,11 @@ MmioBitFieldAnd8 (
UINT8
EFIAPI
MmioBitFieldAndThenOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
return MmioWrite8 (
@@ -1489,11 +1488,11 @@ MmioBitFieldAndThenOr8 (
UINT16
EFIAPI
MmioOr16 (
- IN UINTN Address,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 OrData
)
{
- return MmioWrite16 (Address, (UINT16) (MmioRead16 (Address) | OrData));
+ return MmioWrite16 (Address, (UINT16)(MmioRead16 (Address) | OrData));
}
/**
@@ -1518,11 +1517,11 @@ MmioOr16 (
UINT16
EFIAPI
MmioAnd16 (
- IN UINTN Address,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINT16 AndData
)
{
- return MmioWrite16 (Address, (UINT16) (MmioRead16 (Address) & AndData));
+ return MmioWrite16 (Address, (UINT16)(MmioRead16 (Address) & AndData));
}
/**
@@ -1549,12 +1548,12 @@ MmioAnd16 (
UINT16
EFIAPI
MmioAndThenOr16 (
- IN UINTN Address,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
- return MmioWrite16 (Address, (UINT16) ((MmioRead16 (Address) & AndData) | OrData));
+ return MmioWrite16 (Address, (UINT16)((MmioRead16 (Address) & AndData) | OrData));
}
/**
@@ -1581,9 +1580,9 @@ MmioAndThenOr16 (
UINT16
EFIAPI
MmioBitFieldRead16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead16 (MmioRead16 (Address), StartBit, EndBit);
@@ -1616,10 +1615,10 @@ MmioBitFieldRead16 (
UINT16
EFIAPI
MmioBitFieldWrite16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
return MmioWrite16 (
@@ -1659,10 +1658,10 @@ MmioBitFieldWrite16 (
UINT16
EFIAPI
MmioBitFieldOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
return MmioWrite16 (
@@ -1702,10 +1701,10 @@ MmioBitFieldOr16 (
UINT16
EFIAPI
MmioBitFieldAnd16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
return MmioWrite16 (
@@ -1748,11 +1747,11 @@ MmioBitFieldAnd16 (
UINT16
EFIAPI
MmioBitFieldAndThenOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
return MmioWrite16 (
@@ -1783,8 +1782,8 @@ MmioBitFieldAndThenOr16 (
UINT32
EFIAPI
MmioOr32 (
- IN UINTN Address,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 OrData
)
{
return MmioWrite32 (Address, MmioRead32 (Address) | OrData);
@@ -1812,8 +1811,8 @@ MmioOr32 (
UINT32
EFIAPI
MmioAnd32 (
- IN UINTN Address,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINT32 AndData
)
{
return MmioWrite32 (Address, MmioRead32 (Address) & AndData);
@@ -1843,9 +1842,9 @@ MmioAnd32 (
UINT32
EFIAPI
MmioAndThenOr32 (
- IN UINTN Address,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return MmioWrite32 (Address, (MmioRead32 (Address) & AndData) | OrData);
@@ -1875,9 +1874,9 @@ MmioAndThenOr32 (
UINT32
EFIAPI
MmioBitFieldRead32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead32 (MmioRead32 (Address), StartBit, EndBit);
@@ -1910,10 +1909,10 @@ MmioBitFieldRead32 (
UINT32
EFIAPI
MmioBitFieldWrite32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
return MmioWrite32 (
@@ -1953,10 +1952,10 @@ MmioBitFieldWrite32 (
UINT32
EFIAPI
MmioBitFieldOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
return MmioWrite32 (
@@ -1996,10 +1995,10 @@ MmioBitFieldOr32 (
UINT32
EFIAPI
MmioBitFieldAnd32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
return MmioWrite32 (
@@ -2042,11 +2041,11 @@ MmioBitFieldAnd32 (
UINT32
EFIAPI
MmioBitFieldAndThenOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return MmioWrite32 (
@@ -2077,8 +2076,8 @@ MmioBitFieldAndThenOr32 (
UINT64
EFIAPI
MmioOr64 (
- IN UINTN Address,
- IN UINT64 OrData
+ IN UINTN Address,
+ IN UINT64 OrData
)
{
return MmioWrite64 (Address, MmioRead64 (Address) | OrData);
@@ -2106,8 +2105,8 @@ MmioOr64 (
UINT64
EFIAPI
MmioAnd64 (
- IN UINTN Address,
- IN UINT64 AndData
+ IN UINTN Address,
+ IN UINT64 AndData
)
{
return MmioWrite64 (Address, MmioRead64 (Address) & AndData);
@@ -2137,9 +2136,9 @@ MmioAnd64 (
UINT64
EFIAPI
MmioAndThenOr64 (
- IN UINTN Address,
- IN UINT64 AndData,
- IN UINT64 OrData
+ IN UINTN Address,
+ IN UINT64 AndData,
+ IN UINT64 OrData
)
{
return MmioWrite64 (Address, (MmioRead64 (Address) & AndData) | OrData);
@@ -2169,9 +2168,9 @@ MmioAndThenOr64 (
UINT64
EFIAPI
MmioBitFieldRead64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead64 (MmioRead64 (Address), StartBit, EndBit);
@@ -2204,10 +2203,10 @@ MmioBitFieldRead64 (
UINT64
EFIAPI
MmioBitFieldWrite64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 Value
)
{
return MmioWrite64 (
@@ -2247,10 +2246,10 @@ MmioBitFieldWrite64 (
UINT64
EFIAPI
MmioBitFieldOr64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 OrData
)
{
return MmioWrite64 (
@@ -2290,10 +2289,10 @@ MmioBitFieldOr64 (
UINT64
EFIAPI
MmioBitFieldAnd64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData
)
{
return MmioWrite64 (
@@ -2336,11 +2335,11 @@ MmioBitFieldAnd64 (
UINT64
EFIAPI
MmioBitFieldAndThenOr64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData,
- IN UINT64 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData,
+ IN UINT64 OrData
)
{
return MmioWrite64 (
diff --git a/MdePkg/Library/PeiIoLibCpuIo/IoLib.c b/MdePkg/Library/PeiIoLibCpuIo/IoLib.c
index 87002e428e..5390ff7a14 100644
--- a/MdePkg/Library/PeiIoLibCpuIo/IoLib.c
+++ b/MdePkg/Library/PeiIoLibCpuIo/IoLib.c
@@ -8,7 +8,6 @@
**/
-
#include <PiPei.h>
#include <Library/IoLib.h>
@@ -16,7 +15,6 @@
#include <Library/BaseLib.h>
#include <Library/PeiServicesTablePointerLib.h>
-
/**
Reads registers in the EFI CPU I/O space.
@@ -42,9 +40,9 @@ IoReadFifoWorker (
IN VOID *Buffer
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
- EFI_PEI_CPU_IO_PPI *CpuIo;
- EFI_STATUS Status;
+ CONST EFI_PEI_SERVICES **PeiServices;
+ EFI_PEI_CPU_IO_PPI *CpuIo;
+ EFI_STATUS Status;
PeiServices = GetPeiServicesTablePointer ();
CpuIo = (*PeiServices)->CpuIo;
@@ -79,9 +77,9 @@ IoWriteFifoWorker (
IN VOID *Buffer
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
- EFI_PEI_CPU_IO_PPI *CpuIo;
- EFI_STATUS Status;
+ CONST EFI_PEI_SERVICES **PeiServices;
+ EFI_PEI_CPU_IO_PPI *CpuIo;
+ EFI_STATUS Status;
PeiServices = GetPeiServicesTablePointer ();
CpuIo = (*PeiServices)->CpuIo;
@@ -108,17 +106,17 @@ IoWriteFifoWorker (
UINT8
EFIAPI
IoRead8 (
- IN UINTN Port
+ IN UINTN Port
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
- EFI_PEI_CPU_IO_PPI *CpuIo;
+ CONST EFI_PEI_SERVICES **PeiServices;
+ EFI_PEI_CPU_IO_PPI *CpuIo;
PeiServices = GetPeiServicesTablePointer ();
CpuIo = (*PeiServices)->CpuIo;
ASSERT (CpuIo != NULL);
- return CpuIo->IoRead8 (PeiServices, CpuIo, (UINT64) Port);
+ return CpuIo->IoRead8 (PeiServices, CpuIo, (UINT64)Port);
}
/**
@@ -139,18 +137,18 @@ IoRead8 (
UINT8
EFIAPI
IoWrite8 (
- IN UINTN Port,
- IN UINT8 Value
+ IN UINTN Port,
+ IN UINT8 Value
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
- EFI_PEI_CPU_IO_PPI *CpuIo;
+ CONST EFI_PEI_SERVICES **PeiServices;
+ EFI_PEI_CPU_IO_PPI *CpuIo;
PeiServices = GetPeiServicesTablePointer ();
CpuIo = (*PeiServices)->CpuIo;
ASSERT (CpuIo != NULL);
- CpuIo->IoWrite8 (PeiServices, CpuIo, (UINT64) Port, Value);
+ CpuIo->IoWrite8 (PeiServices, CpuIo, (UINT64)Port, Value);
return Value;
}
@@ -172,11 +170,11 @@ IoWrite8 (
UINT16
EFIAPI
IoRead16 (
- IN UINTN Port
+ IN UINTN Port
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
- EFI_PEI_CPU_IO_PPI *CpuIo;
+ CONST EFI_PEI_SERVICES **PeiServices;
+ EFI_PEI_CPU_IO_PPI *CpuIo;
PeiServices = GetPeiServicesTablePointer ();
CpuIo = (*PeiServices)->CpuIo;
@@ -185,7 +183,7 @@ IoRead16 (
// Make sure Port is aligned on a 16-bit boundary.
//
ASSERT ((Port & 1) == 0);
- return CpuIo->IoRead16 (PeiServices, CpuIo, (UINT64) Port);
+ return CpuIo->IoRead16 (PeiServices, CpuIo, (UINT64)Port);
}
/**
@@ -207,12 +205,12 @@ IoRead16 (
UINT16
EFIAPI
IoWrite16 (
- IN UINTN Port,
- IN UINT16 Value
+ IN UINTN Port,
+ IN UINT16 Value
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
- EFI_PEI_CPU_IO_PPI *CpuIo;
+ CONST EFI_PEI_SERVICES **PeiServices;
+ EFI_PEI_CPU_IO_PPI *CpuIo;
PeiServices = GetPeiServicesTablePointer ();
CpuIo = (*PeiServices)->CpuIo;
@@ -221,7 +219,7 @@ IoWrite16 (
// Make sure Port is aligned on a 16-bit boundary.
//
ASSERT ((Port & 1) == 0);
- CpuIo->IoWrite16 (PeiServices, CpuIo, (UINT64) Port, Value);
+ CpuIo->IoWrite16 (PeiServices, CpuIo, (UINT64)Port, Value);
return Value;
}
@@ -243,11 +241,11 @@ IoWrite16 (
UINT32
EFIAPI
IoRead32 (
- IN UINTN Port
+ IN UINTN Port
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
- EFI_PEI_CPU_IO_PPI *CpuIo;
+ CONST EFI_PEI_SERVICES **PeiServices;
+ EFI_PEI_CPU_IO_PPI *CpuIo;
PeiServices = GetPeiServicesTablePointer ();
CpuIo = (*PeiServices)->CpuIo;
@@ -256,7 +254,7 @@ IoRead32 (
// Make sure Port is aligned on a 32-bit boundary.
//
ASSERT ((Port & 3) == 0);
- return CpuIo->IoRead32 (PeiServices, CpuIo, (UINT64) Port);
+ return CpuIo->IoRead32 (PeiServices, CpuIo, (UINT64)Port);
}
/**
@@ -278,12 +276,12 @@ IoRead32 (
UINT32
EFIAPI
IoWrite32 (
- IN UINTN Port,
- IN UINT32 Value
+ IN UINTN Port,
+ IN UINT32 Value
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
- EFI_PEI_CPU_IO_PPI *CpuIo;
+ CONST EFI_PEI_SERVICES **PeiServices;
+ EFI_PEI_CPU_IO_PPI *CpuIo;
PeiServices = GetPeiServicesTablePointer ();
CpuIo = (*PeiServices)->CpuIo;
@@ -292,7 +290,7 @@ IoWrite32 (
// Make sure Port is aligned on a 32-bit boundary.
//
ASSERT ((Port & 3) == 0);
- CpuIo->IoWrite32 (PeiServices, CpuIo, (UINT64) Port, Value);
+ CpuIo->IoWrite32 (PeiServices, CpuIo, (UINT64)Port, Value);
return Value;
}
@@ -314,11 +312,11 @@ IoWrite32 (
UINT64
EFIAPI
IoRead64 (
- IN UINTN Port
+ IN UINTN Port
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
- EFI_PEI_CPU_IO_PPI *CpuIo;
+ CONST EFI_PEI_SERVICES **PeiServices;
+ EFI_PEI_CPU_IO_PPI *CpuIo;
PeiServices = GetPeiServicesTablePointer ();
CpuIo = (*PeiServices)->CpuIo;
@@ -327,7 +325,7 @@ IoRead64 (
// Make sure Port is aligned on a 64-bit boundary.
//
ASSERT ((Port & 7) == 0);
- return CpuIo->IoRead64 (PeiServices, CpuIo, (UINT64) Port);
+ return CpuIo->IoRead64 (PeiServices, CpuIo, (UINT64)Port);
}
/**
@@ -349,12 +347,12 @@ IoRead64 (
UINT64
EFIAPI
IoWrite64 (
- IN UINTN Port,
- IN UINT64 Value
+ IN UINTN Port,
+ IN UINT64 Value
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
- EFI_PEI_CPU_IO_PPI *CpuIo;
+ CONST EFI_PEI_SERVICES **PeiServices;
+ EFI_PEI_CPU_IO_PPI *CpuIo;
PeiServices = GetPeiServicesTablePointer ();
CpuIo = (*PeiServices)->CpuIo;
@@ -363,8 +361,8 @@ IoWrite64 (
// Make sure Port is aligned on a 64-bit boundary.
//
ASSERT ((Port & 7) == 0);
- CpuIo->IoWrite64 (PeiServices, CpuIo, (UINT64) Port, Value);
- return Value;;
+ CpuIo->IoWrite64 (PeiServices, CpuIo, (UINT64)Port, Value);
+ return Value;
}
/**
@@ -387,9 +385,9 @@ IoWrite64 (
VOID
EFIAPI
IoReadFifo8 (
- IN UINTN Port,
- IN UINTN Count,
- OUT VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ OUT VOID *Buffer
)
{
IoReadFifoWorker (Port, EfiPeiCpuIoWidthFifoUint8, Count, Buffer);
@@ -415,9 +413,9 @@ IoReadFifo8 (
VOID
EFIAPI
IoWriteFifo8 (
- IN UINTN Port,
- IN UINTN Count,
- IN VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ IN VOID *Buffer
)
{
IoWriteFifoWorker (Port, EfiPeiCpuIoWidthFifoUint8, Count, Buffer);
@@ -443,9 +441,9 @@ IoWriteFifo8 (
VOID
EFIAPI
IoReadFifo16 (
- IN UINTN Port,
- IN UINTN Count,
- OUT VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ OUT VOID *Buffer
)
{
//
@@ -475,9 +473,9 @@ IoReadFifo16 (
VOID
EFIAPI
IoWriteFifo16 (
- IN UINTN Port,
- IN UINTN Count,
- IN VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ IN VOID *Buffer
)
{
//
@@ -507,9 +505,9 @@ IoWriteFifo16 (
VOID
EFIAPI
IoReadFifo32 (
- IN UINTN Port,
- IN UINTN Count,
- OUT VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ OUT VOID *Buffer
)
{
//
@@ -539,9 +537,9 @@ IoReadFifo32 (
VOID
EFIAPI
IoWriteFifo32 (
- IN UINTN Port,
- IN UINTN Count,
- IN VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ IN VOID *Buffer
)
{
//
@@ -568,17 +566,17 @@ IoWriteFifo32 (
UINT8
EFIAPI
MmioRead8 (
- IN UINTN Address
+ IN UINTN Address
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
- EFI_PEI_CPU_IO_PPI *CpuIo;
+ CONST EFI_PEI_SERVICES **PeiServices;
+ EFI_PEI_CPU_IO_PPI *CpuIo;
PeiServices = GetPeiServicesTablePointer ();
CpuIo = (*PeiServices)->CpuIo;
ASSERT (CpuIo != NULL);
- return CpuIo->MemRead8 (PeiServices, CpuIo, (UINT64) Address);
+ return CpuIo->MemRead8 (PeiServices, CpuIo, (UINT64)Address);
}
/**
@@ -599,18 +597,18 @@ MmioRead8 (
UINT8
EFIAPI
MmioWrite8 (
- IN UINTN Address,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINT8 Value
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
- EFI_PEI_CPU_IO_PPI *CpuIo;
+ CONST EFI_PEI_SERVICES **PeiServices;
+ EFI_PEI_CPU_IO_PPI *CpuIo;
PeiServices = GetPeiServicesTablePointer ();
CpuIo = (*PeiServices)->CpuIo;
ASSERT (CpuIo != NULL);
- CpuIo->MemWrite8 (PeiServices, CpuIo, (UINT64) Address, Value);
+ CpuIo->MemWrite8 (PeiServices, CpuIo, (UINT64)Address, Value);
return Value;
}
@@ -632,11 +630,11 @@ MmioWrite8 (
UINT16
EFIAPI
MmioRead16 (
- IN UINTN Address
+ IN UINTN Address
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
- EFI_PEI_CPU_IO_PPI *CpuIo;
+ CONST EFI_PEI_SERVICES **PeiServices;
+ EFI_PEI_CPU_IO_PPI *CpuIo;
PeiServices = GetPeiServicesTablePointer ();
CpuIo = (*PeiServices)->CpuIo;
@@ -645,8 +643,7 @@ MmioRead16 (
// Make sure Address is aligned on a 16-bit boundary.
//
ASSERT ((Address & 1) == 0);
- return CpuIo->MemRead16 (PeiServices, CpuIo, (UINT64) Address);
-
+ return CpuIo->MemRead16 (PeiServices, CpuIo, (UINT64)Address);
}
/**
@@ -668,12 +665,12 @@ MmioRead16 (
UINT16
EFIAPI
MmioWrite16 (
- IN UINTN Address,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINT16 Value
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
- EFI_PEI_CPU_IO_PPI *CpuIo;
+ CONST EFI_PEI_SERVICES **PeiServices;
+ EFI_PEI_CPU_IO_PPI *CpuIo;
PeiServices = GetPeiServicesTablePointer ();
CpuIo = (*PeiServices)->CpuIo;
@@ -682,7 +679,7 @@ MmioWrite16 (
// Make sure Address is aligned on a 16-bit boundary.
//
ASSERT ((Address & 1) == 0);
- CpuIo->MemWrite16 (PeiServices, CpuIo, (UINT64) Address, Value);
+ CpuIo->MemWrite16 (PeiServices, CpuIo, (UINT64)Address, Value);
return Value;
}
@@ -704,11 +701,11 @@ MmioWrite16 (
UINT32
EFIAPI
MmioRead32 (
- IN UINTN Address
+ IN UINTN Address
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
- EFI_PEI_CPU_IO_PPI *CpuIo;
+ CONST EFI_PEI_SERVICES **PeiServices;
+ EFI_PEI_CPU_IO_PPI *CpuIo;
PeiServices = GetPeiServicesTablePointer ();
CpuIo = (*PeiServices)->CpuIo;
@@ -717,8 +714,7 @@ MmioRead32 (
// Make sure Address is aligned on a 32-bit boundary.
//
ASSERT ((Address & 3) == 0);
- return CpuIo->MemRead32 (PeiServices, CpuIo, (UINT64) Address);
-
+ return CpuIo->MemRead32 (PeiServices, CpuIo, (UINT64)Address);
}
/**
@@ -740,12 +736,12 @@ MmioRead32 (
UINT32
EFIAPI
MmioWrite32 (
- IN UINTN Address,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINT32 Value
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
- EFI_PEI_CPU_IO_PPI *CpuIo;
+ CONST EFI_PEI_SERVICES **PeiServices;
+ EFI_PEI_CPU_IO_PPI *CpuIo;
PeiServices = GetPeiServicesTablePointer ();
CpuIo = (*PeiServices)->CpuIo;
@@ -754,7 +750,7 @@ MmioWrite32 (
// Make sure Address is aligned on a 32-bit boundary.
//
ASSERT ((Address & 3) == 0);
- CpuIo->MemWrite32 (PeiServices, CpuIo, (UINT64) Address, Value);
+ CpuIo->MemWrite32 (PeiServices, CpuIo, (UINT64)Address, Value);
return Value;
}
@@ -776,11 +772,11 @@ MmioWrite32 (
UINT64
EFIAPI
MmioRead64 (
- IN UINTN Address
+ IN UINTN Address
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
- EFI_PEI_CPU_IO_PPI *CpuIo;
+ CONST EFI_PEI_SERVICES **PeiServices;
+ EFI_PEI_CPU_IO_PPI *CpuIo;
PeiServices = GetPeiServicesTablePointer ();
CpuIo = (*PeiServices)->CpuIo;
@@ -789,8 +785,7 @@ MmioRead64 (
// Make sure Address is aligned on a 64-bit boundary.
//
ASSERT ((Address & (sizeof (UINT64) - 1)) == 0);
- return CpuIo->MemRead64 (PeiServices, CpuIo, (UINT64) Address);
-
+ return CpuIo->MemRead64 (PeiServices, CpuIo, (UINT64)Address);
}
/**
@@ -810,12 +805,12 @@ MmioRead64 (
UINT64
EFIAPI
MmioWrite64 (
- IN UINTN Address,
- IN UINT64 Value
+ IN UINTN Address,
+ IN UINT64 Value
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
- EFI_PEI_CPU_IO_PPI *CpuIo;
+ CONST EFI_PEI_SERVICES **PeiServices;
+ EFI_PEI_CPU_IO_PPI *CpuIo;
PeiServices = GetPeiServicesTablePointer ();
CpuIo = (*PeiServices)->CpuIo;
@@ -824,6 +819,6 @@ MmioWrite64 (
// Make sure Address is aligned on a 64-bit boundary.
//
ASSERT ((Address & 7) == 0);
- CpuIo->MemWrite64 (PeiServices, CpuIo, (UINT64) Address, Value);
+ CpuIo->MemWrite64 (PeiServices, CpuIo, (UINT64)Address, Value);
return Value;
}
diff --git a/MdePkg/Library/PeiIoLibCpuIo/IoLibMmioBuffer.c b/MdePkg/Library/PeiIoLibCpuIo/IoLibMmioBuffer.c
index f4ee7c37f4..34813383c6 100644
--- a/MdePkg/Library/PeiIoLibCpuIo/IoLibMmioBuffer.c
+++ b/MdePkg/Library/PeiIoLibCpuIo/IoLibMmioBuffer.c
@@ -7,7 +7,6 @@
**/
-
#include <PiPei.h>
#include <Library/IoLib.h>
@@ -36,15 +35,15 @@
UINT8 *
EFIAPI
MmioReadBuffer8 (
- IN UINTN StartAddress,
- IN UINTN Length,
- OUT UINT8 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ OUT UINT8 *Buffer
)
{
- UINT8 *ReturnBuffer;
+ UINT8 *ReturnBuffer;
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ReturnBuffer = Buffer;
@@ -80,27 +79,27 @@ MmioReadBuffer8 (
UINT16 *
EFIAPI
MmioReadBuffer16 (
- IN UINTN StartAddress,
- IN UINTN Length,
- OUT UINT16 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ OUT UINT16 *Buffer
)
{
- UINT16 *ReturnBuffer;
+ UINT16 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT16) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT16) - 1)) == 0);
+ ASSERT (((UINTN)Buffer & (sizeof (UINT16) - 1)) == 0);
ReturnBuffer = Buffer;
while (Length != 0) {
- *(Buffer++) = MmioRead16 (StartAddress);
+ *(Buffer++) = MmioRead16 (StartAddress);
StartAddress += sizeof (UINT16);
- Length -= sizeof (UINT16);
+ Length -= sizeof (UINT16);
}
return ReturnBuffer;
@@ -131,27 +130,27 @@ MmioReadBuffer16 (
UINT32 *
EFIAPI
MmioReadBuffer32 (
- IN UINTN StartAddress,
- IN UINTN Length,
- OUT UINT32 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ OUT UINT32 *Buffer
)
{
- UINT32 *ReturnBuffer;
+ UINT32 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT32) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0);
+ ASSERT (((UINTN)Buffer & (sizeof (UINT32) - 1)) == 0);
ReturnBuffer = Buffer;
while (Length != 0) {
- *(Buffer++) = MmioRead32 (StartAddress);
+ *(Buffer++) = MmioRead32 (StartAddress);
StartAddress += sizeof (UINT32);
- Length -= sizeof (UINT32);
+ Length -= sizeof (UINT32);
}
return ReturnBuffer;
@@ -182,33 +181,32 @@ MmioReadBuffer32 (
UINT64 *
EFIAPI
MmioReadBuffer64 (
- IN UINTN StartAddress,
- IN UINTN Length,
- OUT UINT64 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ OUT UINT64 *Buffer
)
{
- UINT64 *ReturnBuffer;
+ UINT64 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT64) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT64) - 1)) == 0);
+ ASSERT (((UINTN)Buffer & (sizeof (UINT64) - 1)) == 0);
ReturnBuffer = Buffer;
while (Length != 0) {
- *(Buffer++) = MmioRead64 (StartAddress);
+ *(Buffer++) = MmioRead64 (StartAddress);
StartAddress += sizeof (UINT64);
- Length -= sizeof (UINT64);
+ Length -= sizeof (UINT64);
}
return ReturnBuffer;
}
-
/**
Copy data from system memory to MMIO region by using 8-bit access.
@@ -230,24 +228,23 @@ MmioReadBuffer64 (
UINT8 *
EFIAPI
MmioWriteBuffer8 (
- IN UINTN StartAddress,
- IN UINTN Length,
- IN CONST UINT8 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ IN CONST UINT8 *Buffer
)
{
- VOID* ReturnBuffer;
+ VOID *ReturnBuffer;
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
- ReturnBuffer = (UINT8 *) Buffer;
+ ReturnBuffer = (UINT8 *)Buffer;
while (Length-- != 0) {
- MmioWrite8 (StartAddress++, *(Buffer++));
+ MmioWrite8 (StartAddress++, *(Buffer++));
}
return ReturnBuffer;
-
}
/**
@@ -276,34 +273,33 @@ MmioWriteBuffer8 (
UINT16 *
EFIAPI
MmioWriteBuffer16 (
- IN UINTN StartAddress,
- IN UINTN Length,
- IN CONST UINT16 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ IN CONST UINT16 *Buffer
)
{
- UINT16 *ReturnBuffer;
+ UINT16 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT16) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT16) - 1)) == 0);
+ ASSERT (((UINTN)Buffer & (sizeof (UINT16) - 1)) == 0);
- ReturnBuffer = (UINT16 *) Buffer;
+ ReturnBuffer = (UINT16 *)Buffer;
while (Length != 0) {
MmioWrite16 (StartAddress, *(Buffer++));
StartAddress += sizeof (UINT16);
- Length -= sizeof (UINT16);
+ Length -= sizeof (UINT16);
}
return ReturnBuffer;
}
-
/**
Copy data from system memory to MMIO region by using 32-bit access.
@@ -330,28 +326,28 @@ MmioWriteBuffer16 (
UINT32 *
EFIAPI
MmioWriteBuffer32 (
- IN UINTN StartAddress,
- IN UINTN Length,
- IN CONST UINT32 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ IN CONST UINT32 *Buffer
)
{
- UINT32 *ReturnBuffer;
+ UINT32 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT32) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0);
+ ASSERT (((UINTN)Buffer & (sizeof (UINT32) - 1)) == 0);
- ReturnBuffer = (UINT32 *) Buffer;
+ ReturnBuffer = (UINT32 *)Buffer;
while (Length != 0) {
MmioWrite32 (StartAddress, *(Buffer++));
StartAddress += sizeof (UINT32);
- Length -= sizeof (UINT32);
+ Length -= sizeof (UINT32);
}
return ReturnBuffer;
@@ -383,30 +379,29 @@ MmioWriteBuffer32 (
UINT64 *
EFIAPI
MmioWriteBuffer64 (
- IN UINTN StartAddress,
- IN UINTN Length,
- IN CONST UINT64 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ IN CONST UINT64 *Buffer
)
{
- UINT64 *ReturnBuffer;
+ UINT64 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT64) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT64) - 1)) == 0);
+ ASSERT (((UINTN)Buffer & (sizeof (UINT64) - 1)) == 0);
- ReturnBuffer = (UINT64 *) Buffer;
+ ReturnBuffer = (UINT64 *)Buffer;
while (Length != 0) {
MmioWrite64 (StartAddress, *(Buffer++));
StartAddress += sizeof (UINT64);
- Length -= sizeof (UINT64);
+ Length -= sizeof (UINT64);
}
return ReturnBuffer;
}
-
diff --git a/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c b/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c
index b3f9df74f1..e540e06e00 100644
--- a/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c
+++ b/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c
@@ -7,17 +7,14 @@
**/
-
#include <PiPei.h>
-
#include <Library/MemoryAllocationLib.h>
#include <Library/PeiServicesLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/HobLib.h>
-
/**
Allocates one or more 4KB pages of a certain memory type.
@@ -49,7 +46,7 @@ InternalAllocatePages (
return NULL;
}
- return (VOID *) (UINTN) Memory;
+ return (VOID *)(UINTN)Memory;
}
/**
@@ -145,7 +142,7 @@ FreePages (
EFI_STATUS Status;
ASSERT (Pages != 0);
- Status = PeiServicesFreePages ((EFI_PHYSICAL_ADDRESS) (UINTN) Buffer, Pages);
+ Status = PeiServicesFreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, Pages);
ASSERT_EFI_ERROR (Status);
}
@@ -190,23 +187,25 @@ InternalAllocateAlignedPages (
if (Pages == 0) {
return NULL;
}
+
if (Alignment > EFI_PAGE_SIZE) {
//
// Calculate the total number of pages since alignment is larger than page size.
//
- AlignmentMask = Alignment - 1;
- RealPages = Pages + EFI_SIZE_TO_PAGES (Alignment);
+ AlignmentMask = Alignment - 1;
+ RealPages = Pages + EFI_SIZE_TO_PAGES (Alignment);
//
// Make sure that Pages plus EFI_SIZE_TO_PAGES (Alignment) does not overflow.
//
ASSERT (RealPages > Pages);
- Status = PeiServicesAllocatePages (MemoryType, RealPages, &Memory);
+ Status = PeiServicesAllocatePages (MemoryType, RealPages, &Memory);
if (EFI_ERROR (Status)) {
return NULL;
}
- AlignedMemory = ((UINTN) Memory + AlignmentMask) & ~AlignmentMask;
- UnalignedPages = EFI_SIZE_TO_PAGES (AlignedMemory - (UINTN) Memory);
+
+ AlignedMemory = ((UINTN)Memory + AlignmentMask) & ~AlignmentMask;
+ UnalignedPages = EFI_SIZE_TO_PAGES (AlignedMemory - (UINTN)Memory);
if (UnalignedPages > 0) {
//
// Free first unaligned page(s).
@@ -214,6 +213,7 @@ InternalAllocateAlignedPages (
Status = PeiServicesFreePages (Memory, UnalignedPages);
ASSERT_EFI_ERROR (Status);
}
+
Memory = AlignedMemory + EFI_PAGES_TO_SIZE (Pages);
UnalignedPages = RealPages - Pages - UnalignedPages;
if (UnalignedPages > 0) {
@@ -231,9 +231,11 @@ InternalAllocateAlignedPages (
if (EFI_ERROR (Status)) {
return NULL;
}
- AlignedMemory = (UINTN) Memory;
+
+ AlignedMemory = (UINTN)Memory;
}
- return (VOID *) AlignedMemory;
+
+ return (VOID *)AlignedMemory;
}
/**
@@ -350,7 +352,7 @@ FreeAlignedPages (
EFI_STATUS Status;
ASSERT (Pages != 0);
- Status = PeiServicesFreePages ((EFI_PHYSICAL_ADDRESS) (UINTN) Buffer, Pages);
+ Status = PeiServicesFreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, Pages);
ASSERT_EFI_ERROR (Status);
}
@@ -399,13 +401,14 @@ AllocatePool (
IN UINTN AllocationSize
)
{
- EFI_STATUS Status;
- VOID *Buffer;
+ EFI_STATUS Status;
+ VOID *Buffer;
Status = PeiServicesAllocatePool (AllocationSize, &Buffer);
if (EFI_ERROR (Status)) {
Buffer = NULL;
}
+
return Buffer;
}
@@ -477,6 +480,7 @@ InternalAllocateZeroPool (
if (Memory != NULL) {
Memory = ZeroMem (Memory, AllocationSize);
}
+
return Memory;
}
@@ -505,6 +509,7 @@ AllocateZeroPool (
if (Memory != NULL) {
Memory = ZeroMem (Memory, AllocationSize);
}
+
return Memory;
}
@@ -579,12 +584,13 @@ InternalAllocateCopyPool (
VOID *Memory;
ASSERT (Buffer != NULL);
- ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));
+ ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN)Buffer + 1));
Memory = InternalAllocatePool (PoolType, AllocationSize);
if (Memory != NULL) {
- Memory = CopyMem (Memory, Buffer, AllocationSize);
+ Memory = CopyMem (Memory, Buffer, AllocationSize);
}
+
return Memory;
}
@@ -615,12 +621,13 @@ AllocateCopyPool (
VOID *Memory;
ASSERT (Buffer != NULL);
- ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));
+ ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN)Buffer + 1));
Memory = AllocatePool (AllocationSize);
if (Memory != NULL) {
- Memory = CopyMem (Memory, Buffer, AllocationSize);
+ Memory = CopyMem (Memory, Buffer, AllocationSize);
}
+
return Memory;
}
@@ -711,10 +718,11 @@ InternalReallocatePool (
VOID *NewBuffer;
NewBuffer = InternalAllocateZeroPool (PoolType, NewSize);
- if (NewBuffer != NULL && OldBuffer != NULL) {
+ if ((NewBuffer != NULL) && (OldBuffer != NULL)) {
CopyMem (NewBuffer, OldBuffer, MIN (OldSize, NewSize));
FreePool (OldBuffer);
}
+
return NewBuffer;
}
@@ -831,12 +839,10 @@ ReallocateReservedPool (
VOID
EFIAPI
FreePool (
- IN VOID *Buffer
+ IN VOID *Buffer
)
{
//
// PEI phase does not support to free pool, so leave it as NOP.
//
}
-
-
diff --git a/MdePkg/Library/PeiMemoryLib/CompareMemWrapper.c b/MdePkg/Library/PeiMemoryLib/CompareMemWrapper.c
index 6c539a685e..5b65a1d264 100644
--- a/MdePkg/Library/PeiMemoryLib/CompareMemWrapper.c
+++ b/MdePkg/Library/PeiMemoryLib/CompareMemWrapper.c
@@ -48,9 +48,10 @@ CompareMem (
IN UINTN Length
)
{
- if (Length == 0 || DestinationBuffer == SourceBuffer) {
+ if ((Length == 0) || (DestinationBuffer == SourceBuffer)) {
return 0;
}
+
ASSERT (DestinationBuffer != NULL);
ASSERT (SourceBuffer != NULL);
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer));
diff --git a/MdePkg/Library/PeiMemoryLib/CopyMemWrapper.c b/MdePkg/Library/PeiMemoryLib/CopyMemWrapper.c
index 438abf4e86..dc48904766 100644
--- a/MdePkg/Library/PeiMemoryLib/CopyMemWrapper.c
+++ b/MdePkg/Library/PeiMemoryLib/CopyMemWrapper.c
@@ -47,11 +47,13 @@ CopyMem (
if (Length == 0) {
return DestinationBuffer;
}
+
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)SourceBuffer));
if (DestinationBuffer == SourceBuffer) {
return DestinationBuffer;
}
+
return InternalMemCopyMem (DestinationBuffer, SourceBuffer, Length);
}
diff --git a/MdePkg/Library/PeiMemoryLib/MemLib.c b/MdePkg/Library/PeiMemoryLib/MemLib.c
index 180c11bea2..2da7f1596a 100644
--- a/MdePkg/Library/PeiMemoryLib/MemLib.c
+++ b/MdePkg/Library/PeiMemoryLib/MemLib.c
@@ -23,14 +23,14 @@
VOID *
EFIAPI
InternalMemCopyMem (
- OUT VOID *Destination,
- IN CONST VOID *Source,
- IN UINTN Length
+ OUT VOID *Destination,
+ IN CONST VOID *Source,
+ IN UINTN Length
)
{
(*GetPeiServicesTablePointer ())->CopyMem (
Destination,
- (VOID*)Source,
+ (VOID *)Source,
Length
);
return Destination;
@@ -51,9 +51,9 @@ InternalMemCopyMem (
VOID *
EFIAPI
InternalMemSetMem (
- OUT VOID *Buffer,
- IN UINTN Size,
- IN UINT8 Value
+ OUT VOID *Buffer,
+ IN UINTN Size,
+ IN UINT8 Value
)
{
(*GetPeiServicesTablePointer ())->SetMem (
diff --git a/MdePkg/Library/PeiMemoryLib/MemLibGeneric.c b/MdePkg/Library/PeiMemoryLib/MemLibGeneric.c
index f646850ed8..8bc9321e66 100644
--- a/MdePkg/Library/PeiMemoryLib/MemLibGeneric.c
+++ b/MdePkg/Library/PeiMemoryLib/MemLibGeneric.c
@@ -26,14 +26,15 @@
VOID *
EFIAPI
InternalMemSetMem16 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT16 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT16 Value
)
{
- for (; Length != 0; Length--) {
- ((UINT16*)Buffer)[Length - 1] = Value;
+ for ( ; Length != 0; Length--) {
+ ((UINT16 *)Buffer)[Length - 1] = Value;
}
+
return Buffer;
}
@@ -50,14 +51,15 @@ InternalMemSetMem16 (
VOID *
EFIAPI
InternalMemSetMem32 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT32 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT32 Value
)
{
- for (; Length != 0; Length--) {
- ((UINT32*)Buffer)[Length - 1] = Value;
+ for ( ; Length != 0; Length--) {
+ ((UINT32 *)Buffer)[Length - 1] = Value;
}
+
return Buffer;
}
@@ -74,14 +76,15 @@ InternalMemSetMem32 (
VOID *
EFIAPI
InternalMemSetMem64 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT64 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT64 Value
)
{
- for (; Length != 0; Length--) {
- ((UINT64*)Buffer)[Length - 1] = Value;
+ for ( ; Length != 0; Length--) {
+ ((UINT64 *)Buffer)[Length - 1] = Value;
}
+
return Buffer;
}
@@ -97,8 +100,8 @@ InternalMemSetMem64 (
VOID *
EFIAPI
InternalMemZeroMem (
- OUT VOID *Buffer,
- IN UINTN Length
+ OUT VOID *Buffer,
+ IN UINTN Length
)
{
return InternalMemSetMem (Buffer, Length, 0);
@@ -120,17 +123,19 @@ InternalMemZeroMem (
INTN
EFIAPI
InternalMemCompareMem (
- IN CONST VOID *DestinationBuffer,
- IN CONST VOID *SourceBuffer,
- IN UINTN Length
+ IN CONST VOID *DestinationBuffer,
+ IN CONST VOID *SourceBuffer,
+ IN UINTN Length
)
{
while ((--Length != 0) &&
- (*(INT8*)DestinationBuffer == *(INT8*)SourceBuffer)) {
- DestinationBuffer = (INT8*)DestinationBuffer + 1;
- SourceBuffer = (INT8*)SourceBuffer + 1;
+ (*(INT8 *)DestinationBuffer == *(INT8 *)SourceBuffer))
+ {
+ DestinationBuffer = (INT8 *)DestinationBuffer + 1;
+ SourceBuffer = (INT8 *)SourceBuffer + 1;
}
- return (INTN)*(UINT8*)DestinationBuffer - (INTN)*(UINT8*)SourceBuffer;
+
+ return (INTN)*(UINT8 *)DestinationBuffer - (INTN)*(UINT8 *)SourceBuffer;
}
/**
@@ -147,19 +152,20 @@ InternalMemCompareMem (
CONST VOID *
EFIAPI
InternalMemScanMem8 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT8 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT8 Value
)
{
- CONST UINT8 *Pointer;
+ CONST UINT8 *Pointer;
- Pointer = (CONST UINT8*)Buffer;
+ Pointer = (CONST UINT8 *)Buffer;
do {
if (*(Pointer++) == Value) {
return --Pointer;
}
} while (--Length != 0);
+
return NULL;
}
@@ -177,19 +183,20 @@ InternalMemScanMem8 (
CONST VOID *
EFIAPI
InternalMemScanMem16 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT16 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT16 Value
)
{
- CONST UINT16 *Pointer;
+ CONST UINT16 *Pointer;
- Pointer = (CONST UINT16*)Buffer;
+ Pointer = (CONST UINT16 *)Buffer;
do {
if (*(Pointer++) == Value) {
return --Pointer;
}
} while (--Length != 0);
+
return NULL;
}
@@ -207,19 +214,20 @@ InternalMemScanMem16 (
CONST VOID *
EFIAPI
InternalMemScanMem32 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT32 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT32 Value
)
{
- CONST UINT32 *Pointer;
+ CONST UINT32 *Pointer;
- Pointer = (CONST UINT32*)Buffer;
+ Pointer = (CONST UINT32 *)Buffer;
do {
if (*(Pointer++) == Value) {
return --Pointer;
}
} while (--Length != 0);
+
return NULL;
}
@@ -237,19 +245,20 @@ InternalMemScanMem32 (
CONST VOID *
EFIAPI
InternalMemScanMem64 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT64 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT64 Value
)
{
- CONST UINT64 *Pointer;
+ CONST UINT64 *Pointer;
- Pointer = (CONST UINT64*)Buffer;
+ Pointer = (CONST UINT64 *)Buffer;
do {
if (*(Pointer++) == Value) {
return --Pointer;
}
} while (--Length != 0);
+
return NULL;
}
@@ -270,8 +279,8 @@ InternalMemIsZeroBuffer (
IN UINTN Length
)
{
- CONST UINT8 *BufferData;
- UINTN Index;
+ CONST UINT8 *BufferData;
+ UINTN Index;
BufferData = Buffer;
for (Index = 0; Index < Length; Index++) {
@@ -279,5 +288,6 @@ InternalMemIsZeroBuffer (
return FALSE;
}
}
+
return TRUE;
}
diff --git a/MdePkg/Library/PeiMemoryLib/MemLibGuid.c b/MdePkg/Library/PeiMemoryLib/MemLibGuid.c
index 319487dda9..9ded5ca0f1 100644
--- a/MdePkg/Library/PeiMemoryLib/MemLibGuid.c
+++ b/MdePkg/Library/PeiMemoryLib/MemLibGuid.c
@@ -42,12 +42,12 @@ CopyGuid (
)
{
WriteUnaligned64 (
- (UINT64*)DestinationGuid,
- ReadUnaligned64 ((CONST UINT64*)SourceGuid)
+ (UINT64 *)DestinationGuid,
+ ReadUnaligned64 ((CONST UINT64 *)SourceGuid)
);
WriteUnaligned64 (
- (UINT64*)DestinationGuid + 1,
- ReadUnaligned64 ((CONST UINT64*)SourceGuid + 1)
+ (UINT64 *)DestinationGuid + 1,
+ ReadUnaligned64 ((CONST UINT64 *)SourceGuid + 1)
);
return DestinationGuid;
}
@@ -80,12 +80,12 @@ CompareGuid (
UINT64 HighPartOfGuid1;
UINT64 HighPartOfGuid2;
- LowPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1);
- LowPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2);
- HighPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1 + 1);
- HighPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2 + 1);
+ LowPartOfGuid1 = ReadUnaligned64 ((CONST UINT64 *)Guid1);
+ LowPartOfGuid2 = ReadUnaligned64 ((CONST UINT64 *)Guid2);
+ HighPartOfGuid1 = ReadUnaligned64 ((CONST UINT64 *)Guid1 + 1);
+ HighPartOfGuid2 = ReadUnaligned64 ((CONST UINT64 *)Guid2 + 1);
- return (BOOLEAN) (LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2);
+ return (BOOLEAN)(LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2);
}
/**
@@ -118,20 +118,22 @@ ScanGuid (
IN CONST GUID *Guid
)
{
- CONST GUID *GuidPtr;
+ CONST GUID *GuidPtr;
ASSERT (((UINTN)Buffer & (sizeof (Guid->Data1) - 1)) == 0);
ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1));
ASSERT ((Length & (sizeof (*GuidPtr) - 1)) == 0);
- GuidPtr = (GUID*)Buffer;
+ GuidPtr = (GUID *)Buffer;
Buffer = GuidPtr + Length / sizeof (*GuidPtr);
- while (GuidPtr < (CONST GUID*)Buffer) {
+ while (GuidPtr < (CONST GUID *)Buffer) {
if (CompareGuid (GuidPtr, Guid)) {
- return (VOID*)GuidPtr;
+ return (VOID *)GuidPtr;
}
+
GuidPtr++;
}
+
return NULL;
}
@@ -158,8 +160,8 @@ IsZeroGuid (
UINT64 LowPartOfGuid;
UINT64 HighPartOfGuid;
- LowPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid);
- HighPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid + 1);
+ LowPartOfGuid = ReadUnaligned64 ((CONST UINT64 *)Guid);
+ HighPartOfGuid = ReadUnaligned64 ((CONST UINT64 *)Guid + 1);
- return (BOOLEAN) (LowPartOfGuid == 0 && HighPartOfGuid == 0);
+ return (BOOLEAN)(LowPartOfGuid == 0 && HighPartOfGuid == 0);
}
diff --git a/MdePkg/Library/PeiMemoryLib/MemLibInternals.h b/MdePkg/Library/PeiMemoryLib/MemLibInternals.h
index 43d555a987..c5e1e4dd60 100644
--- a/MdePkg/Library/PeiMemoryLib/MemLibInternals.h
+++ b/MdePkg/Library/PeiMemoryLib/MemLibInternals.h
@@ -31,9 +31,9 @@
VOID *
EFIAPI
InternalMemCopyMem (
- OUT VOID *Destination,
- IN CONST VOID *Source,
- IN UINTN Length
+ OUT VOID *Destination,
+ IN CONST VOID *Source,
+ IN UINTN Length
);
/**
@@ -51,9 +51,9 @@ InternalMemCopyMem (
VOID *
EFIAPI
InternalMemSetMem (
- OUT VOID *Buffer,
- IN UINTN Size,
- IN UINT8 Value
+ OUT VOID *Buffer,
+ IN UINTN Size,
+ IN UINT8 Value
);
/**
@@ -69,9 +69,9 @@ InternalMemSetMem (
VOID *
EFIAPI
InternalMemSetMem16 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT16 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT16 Value
);
/**
@@ -87,9 +87,9 @@ InternalMemSetMem16 (
VOID *
EFIAPI
InternalMemSetMem32 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT32 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT32 Value
);
/**
@@ -105,9 +105,9 @@ InternalMemSetMem32 (
VOID *
EFIAPI
InternalMemSetMem64 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT64 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT64 Value
);
/**
@@ -122,8 +122,8 @@ InternalMemSetMem64 (
VOID *
EFIAPI
InternalMemZeroMem (
- OUT VOID *Buffer,
- IN UINTN Length
+ OUT VOID *Buffer,
+ IN UINTN Length
);
/**
@@ -142,9 +142,9 @@ InternalMemZeroMem (
INTN
EFIAPI
InternalMemCompareMem (
- IN CONST VOID *DestinationBuffer,
- IN CONST VOID *SourceBuffer,
- IN UINTN Length
+ IN CONST VOID *DestinationBuffer,
+ IN CONST VOID *SourceBuffer,
+ IN UINTN Length
);
/**
@@ -161,9 +161,9 @@ InternalMemCompareMem (
CONST VOID *
EFIAPI
InternalMemScanMem8 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT8 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT8 Value
);
/**
@@ -180,9 +180,9 @@ InternalMemScanMem8 (
CONST VOID *
EFIAPI
InternalMemScanMem16 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT16 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT16 Value
);
/**
@@ -199,9 +199,9 @@ InternalMemScanMem16 (
CONST VOID *
EFIAPI
InternalMemScanMem32 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT32 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT32 Value
);
/**
@@ -218,9 +218,9 @@ InternalMemScanMem32 (
CONST VOID *
EFIAPI
InternalMemScanMem64 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT64 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT64 Value
);
/**
diff --git a/MdePkg/Library/PeiMemoryLib/ScanMem16Wrapper.c b/MdePkg/Library/PeiMemoryLib/ScanMem16Wrapper.c
index 8201313523..7eeb1a48be 100644
--- a/MdePkg/Library/PeiMemoryLib/ScanMem16Wrapper.c
+++ b/MdePkg/Library/PeiMemoryLib/ScanMem16Wrapper.c
@@ -57,5 +57,5 @@ ScanMem16 (
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
- return (VOID*)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value);
+ return (VOID *)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value);
}
diff --git a/MdePkg/Library/PeiMemoryLib/ScanMem32Wrapper.c b/MdePkg/Library/PeiMemoryLib/ScanMem32Wrapper.c
index 22c0c79ff6..bdcee0e2eb 100644
--- a/MdePkg/Library/PeiMemoryLib/ScanMem32Wrapper.c
+++ b/MdePkg/Library/PeiMemoryLib/ScanMem32Wrapper.c
@@ -56,5 +56,5 @@ ScanMem32 (
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
- return (VOID*)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value);
+ return (VOID *)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value);
}
diff --git a/MdePkg/Library/PeiMemoryLib/ScanMem64Wrapper.c b/MdePkg/Library/PeiMemoryLib/ScanMem64Wrapper.c
index a617d870a0..eb75390d24 100644
--- a/MdePkg/Library/PeiMemoryLib/ScanMem64Wrapper.c
+++ b/MdePkg/Library/PeiMemoryLib/ScanMem64Wrapper.c
@@ -57,5 +57,5 @@ ScanMem64 (
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
- return (VOID*)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value);
+ return (VOID *)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value);
}
diff --git a/MdePkg/Library/PeiMemoryLib/ScanMem8Wrapper.c b/MdePkg/Library/PeiMemoryLib/ScanMem8Wrapper.c
index f2bf7d6f68..aa0de6442f 100644
--- a/MdePkg/Library/PeiMemoryLib/ScanMem8Wrapper.c
+++ b/MdePkg/Library/PeiMemoryLib/ScanMem8Wrapper.c
@@ -49,10 +49,11 @@ ScanMem8 (
if (Length == 0) {
return NULL;
}
+
ASSERT (Buffer != NULL);
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
- return (VOID*)InternalMemScanMem8 (Buffer, Length, Value);
+ return (VOID *)InternalMemScanMem8 (Buffer, Length, Value);
}
/**
@@ -90,4 +91,3 @@ ScanMemN (
return ScanMem32 (Buffer, Length, (UINT32)Value);
}
}
-
diff --git a/MdePkg/Library/PeiPcdLib/PeiPcdLib.c b/MdePkg/Library/PeiPcdLib/PeiPcdLib.c
index 84edb9befd..166d4a6f32 100644
--- a/MdePkg/Library/PeiPcdLib/PeiPcdLib.c
+++ b/MdePkg/Library/PeiPcdLib/PeiPcdLib.c
@@ -7,9 +7,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-
-
-
#include <PiPei.h>
#include <Ppi/Pcd.h>
@@ -36,8 +33,8 @@ GetPcdPpiPointer (
VOID
)
{
- EFI_STATUS Status;
- PCD_PPI *PcdPpi;
+ EFI_STATUS Status;
+ PCD_PPI *PcdPpi;
Status = PeiServicesLocatePpi (&gPcdPpiGuid, 0, NULL, (VOID **)&PcdPpi);
ASSERT_EFI_ERROR (Status);
@@ -59,8 +56,8 @@ GetPiPcdPpiPointer (
VOID
)
{
- EFI_STATUS Status;
- EFI_PEI_PCD_PPI *PiPcdPpi;
+ EFI_STATUS Status;
+ EFI_PEI_PCD_PPI *PiPcdPpi;
Status = PeiServicesLocatePpi (&gEfiPeiPcdPpiGuid, 0, NULL, (VOID **)&PiPcdPpi);
ASSERT_EFI_ERROR (Status);
@@ -82,8 +79,8 @@ GetPcdInfoPpiPointer (
VOID
)
{
- EFI_STATUS Status;
- GET_PCD_INFO_PPI *PcdInfoPpi;
+ EFI_STATUS Status;
+ GET_PCD_INFO_PPI *PcdInfoPpi;
Status = PeiServicesLocatePpi (&gGetPcdInfoPpiGuid, 0, NULL, (VOID **)&PcdInfoPpi);
ASSERT_EFI_ERROR (Status);
@@ -128,16 +125,14 @@ GetPiPcdInfoPpiPointer (
UINTN
EFIAPI
LibPcdSetSku (
- IN UINTN SkuId
+ IN UINTN SkuId
)
{
- GetPiPcdPpiPointer()->SetSku (SkuId);
+ GetPiPcdPpiPointer ()->SetSku (SkuId);
return SkuId;
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -151,14 +146,12 @@ LibPcdSetSku (
UINT8
EFIAPI
LibPcdGet8 (
- IN UINTN TokenNumber
+ IN UINTN TokenNumber
)
{
return (GetPcdPpiPointer ())->Get8 (TokenNumber);
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -172,14 +165,12 @@ LibPcdGet8 (
UINT16
EFIAPI
LibPcdGet16 (
- IN UINTN TokenNumber
+ IN UINTN TokenNumber
)
{
return (GetPcdPpiPointer ())->Get16 (TokenNumber);
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -193,14 +184,12 @@ LibPcdGet16 (
UINT32
EFIAPI
LibPcdGet32 (
- IN UINTN TokenNumber
+ IN UINTN TokenNumber
)
{
return (GetPcdPpiPointer ())->Get32 (TokenNumber);
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -214,14 +203,12 @@ LibPcdGet32 (
UINT64
EFIAPI
LibPcdGet64 (
- IN UINTN TokenNumber
+ IN UINTN TokenNumber
)
{
return (GetPcdPpiPointer ())->Get64 (TokenNumber);
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -235,14 +222,12 @@ LibPcdGet64 (
VOID *
EFIAPI
LibPcdGetPtr (
- IN UINTN TokenNumber
+ IN UINTN TokenNumber
)
{
return (GetPcdPpiPointer ())->GetPtr (TokenNumber);
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -256,14 +241,12 @@ LibPcdGetPtr (
BOOLEAN
EFIAPI
LibPcdGetBool (
- IN UINTN TokenNumber
+ IN UINTN TokenNumber
)
{
return (GetPcdPpiPointer ())->GetBool (TokenNumber);
}
-
-
/**
This function provides a means by which to retrieve the size of a given PCD token.
@@ -275,14 +258,12 @@ LibPcdGetBool (
UINTN
EFIAPI
LibPcdGetSize (
- IN UINTN TokenNumber
+ IN UINTN TokenNumber
)
{
return (GetPcdPpiPointer ())->GetSize (TokenNumber);
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -300,8 +281,8 @@ LibPcdGetSize (
UINT8
EFIAPI
LibPcdGetEx8 (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber
)
{
ASSERT (Guid != NULL);
@@ -309,8 +290,6 @@ LibPcdGetEx8 (
return (GetPiPcdPpiPointer ())->Get8 (Guid, TokenNumber);
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -328,18 +307,15 @@ LibPcdGetEx8 (
UINT16
EFIAPI
LibPcdGetEx16 (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber
)
{
-
ASSERT (Guid != NULL);
return (GetPiPcdPpiPointer ())->Get16 (Guid, TokenNumber);
}
-
-
/**
Returns the 32-bit value for the token specified by TokenNumber and Guid.
If Guid is NULL, then ASSERT().
@@ -354,8 +330,8 @@ LibPcdGetEx16 (
UINT32
EFIAPI
LibPcdGetEx32 (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber
)
{
ASSERT (Guid != NULL);
@@ -363,9 +339,6 @@ LibPcdGetEx32 (
return (GetPiPcdPpiPointer ())->Get32 (Guid, TokenNumber);
}
-
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -383,16 +356,14 @@ LibPcdGetEx32 (
UINT64
EFIAPI
LibPcdGetEx64 (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber
)
{
ASSERT (Guid != NULL);
return (GetPiPcdPpiPointer ())->Get64 (Guid, TokenNumber);
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -410,8 +381,8 @@ LibPcdGetEx64 (
VOID *
EFIAPI
LibPcdGetExPtr (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber
)
{
ASSERT (Guid != NULL);
@@ -419,8 +390,6 @@ LibPcdGetExPtr (
return (GetPiPcdPpiPointer ())->GetPtr (Guid, TokenNumber);
}
-
-
/**
This function provides a means by which to retrieve a value for a given PCD token.
@@ -438,16 +407,14 @@ LibPcdGetExPtr (
BOOLEAN
EFIAPI
LibPcdGetExBool (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber
)
{
ASSERT (Guid != NULL);
return (GetPiPcdPpiPointer ())->GetBool (Guid, TokenNumber);
}
-
-
/**
This function provides a means by which to retrieve the size of a given PCD token.
@@ -465,15 +432,14 @@ LibPcdGetExBool (
UINTN
EFIAPI
LibPcdGetExSize (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber
)
{
ASSERT (Guid != NULL);
return (GetPiPcdPpiPointer ())->GetSize (Guid, TokenNumber);
}
-
/**
This function provides a means by which to set a value for a given PCD token.
@@ -489,8 +455,8 @@ LibPcdGetExSize (
RETURN_STATUS
EFIAPI
LibPcdSet8S (
- IN UINTN TokenNumber,
- IN UINT8 Value
+ IN UINTN TokenNumber,
+ IN UINT8 Value
)
{
return (GetPcdPpiPointer ())->Set8 (TokenNumber, Value);
@@ -511,8 +477,8 @@ LibPcdSet8S (
RETURN_STATUS
EFIAPI
LibPcdSet16S (
- IN UINTN TokenNumber,
- IN UINT16 Value
+ IN UINTN TokenNumber,
+ IN UINT16 Value
)
{
return (GetPcdPpiPointer ())->Set16 (TokenNumber, Value);
@@ -533,8 +499,8 @@ LibPcdSet16S (
RETURN_STATUS
EFIAPI
LibPcdSet32S (
- IN UINTN TokenNumber,
- IN UINT32 Value
+ IN UINTN TokenNumber,
+ IN UINT32 Value
)
{
return (GetPcdPpiPointer ())->Set32 (TokenNumber, Value);
@@ -555,8 +521,8 @@ LibPcdSet32S (
RETURN_STATUS
EFIAPI
LibPcdSet64S (
- IN UINTN TokenNumber,
- IN UINT64 Value
+ IN UINTN TokenNumber,
+ IN UINT64 Value
)
{
return (GetPcdPpiPointer ())->Set64 (TokenNumber, Value);
@@ -587,9 +553,9 @@ LibPcdSet64S (
RETURN_STATUS
EFIAPI
LibPcdSetPtrS (
- IN UINTN TokenNumber,
- IN OUT UINTN *SizeOfBuffer,
- IN CONST VOID *Buffer
+ IN UINTN TokenNumber,
+ IN OUT UINTN *SizeOfBuffer,
+ IN CONST VOID *Buffer
)
{
ASSERT (SizeOfBuffer != NULL);
@@ -598,7 +564,7 @@ LibPcdSetPtrS (
ASSERT (Buffer != NULL);
}
- return (GetPcdPpiPointer ())->SetPtr (TokenNumber, SizeOfBuffer, (VOID *) Buffer);
+ return (GetPcdPpiPointer ())->SetPtr (TokenNumber, SizeOfBuffer, (VOID *)Buffer);
}
/**
@@ -616,8 +582,8 @@ LibPcdSetPtrS (
RETURN_STATUS
EFIAPI
LibPcdSetBoolS (
- IN UINTN TokenNumber,
- IN BOOLEAN Value
+ IN UINTN TokenNumber,
+ IN BOOLEAN Value
)
{
return (GetPcdPpiPointer ())->SetBool (TokenNumber, Value);
@@ -642,9 +608,9 @@ LibPcdSetBoolS (
RETURN_STATUS
EFIAPI
LibPcdSetEx8S (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber,
- IN UINT8 Value
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ IN UINT8 Value
)
{
ASSERT (Guid != NULL);
@@ -671,9 +637,9 @@ LibPcdSetEx8S (
RETURN_STATUS
EFIAPI
LibPcdSetEx16S (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber,
- IN UINT16 Value
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ IN UINT16 Value
)
{
ASSERT (Guid != NULL);
@@ -700,9 +666,9 @@ LibPcdSetEx16S (
RETURN_STATUS
EFIAPI
LibPcdSetEx32S (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber,
- IN UINT32 Value
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ IN UINT32 Value
)
{
ASSERT (Guid != NULL);
@@ -729,9 +695,9 @@ LibPcdSetEx32S (
RETURN_STATUS
EFIAPI
LibPcdSetEx64S (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber,
- IN UINT64 Value
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ IN UINT64 Value
)
{
ASSERT (Guid != NULL);
@@ -764,10 +730,10 @@ LibPcdSetEx64S (
RETURN_STATUS
EFIAPI
LibPcdSetExPtrS (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber,
- IN OUT UINTN *SizeOfBuffer,
- IN VOID *Buffer
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ IN OUT UINTN *SizeOfBuffer,
+ IN VOID *Buffer
)
{
ASSERT (Guid != NULL);
@@ -800,9 +766,9 @@ LibPcdSetExPtrS (
RETURN_STATUS
EFIAPI
LibPcdSetExBoolS (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber,
- IN BOOLEAN Value
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ IN BOOLEAN Value
)
{
ASSERT (Guid != NULL);
@@ -829,24 +795,22 @@ LibPcdSetExBoolS (
VOID
EFIAPI
LibPcdCallbackOnSet (
- IN CONST GUID *Guid OPTIONAL,
- IN UINTN TokenNumber,
- IN PCD_CALLBACK NotificationFunction
+ IN CONST GUID *Guid OPTIONAL,
+ IN UINTN TokenNumber,
+ IN PCD_CALLBACK NotificationFunction
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
ASSERT (NotificationFunction != NULL);
- Status = (GetPiPcdPpiPointer ())->CallbackOnSet (Guid, TokenNumber, (EFI_PEI_PCD_PPI_CALLBACK) NotificationFunction);
+ Status = (GetPiPcdPpiPointer ())->CallbackOnSet (Guid, TokenNumber, (EFI_PEI_PCD_PPI_CALLBACK)NotificationFunction);
ASSERT_EFI_ERROR (Status);
return;
}
-
-
/**
Disable a notification function that was established with LibPcdCallbackonSet().
@@ -863,24 +827,22 @@ LibPcdCallbackOnSet (
VOID
EFIAPI
LibPcdCancelCallback (
- IN CONST GUID *Guid OPTIONAL,
- IN UINTN TokenNumber,
- IN PCD_CALLBACK NotificationFunction
+ IN CONST GUID *Guid OPTIONAL,
+ IN UINTN TokenNumber,
+ IN PCD_CALLBACK NotificationFunction
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
ASSERT (NotificationFunction != NULL);
- Status = (GetPiPcdPpiPointer ())->CancelCallback (Guid, TokenNumber, (EFI_PEI_PCD_PPI_CALLBACK) NotificationFunction);
+ Status = (GetPiPcdPpiPointer ())->CancelCallback (Guid, TokenNumber, (EFI_PEI_PCD_PPI_CALLBACK)NotificationFunction);
ASSERT_EFI_ERROR (Status);
return;
}
-
-
/**
Retrieves the next token in a token space.
@@ -903,11 +865,11 @@ LibPcdCancelCallback (
UINTN
EFIAPI
LibPcdGetNextToken (
- IN CONST GUID *Guid OPTIONAL,
- IN UINTN TokenNumber
+ IN CONST GUID *Guid OPTIONAL,
+ IN UINTN TokenNumber
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
Status = (GetPiPcdPpiPointer ())->GetNextToken (Guid, &TokenNumber);
ASSERT (!EFI_ERROR (Status) || TokenNumber == 0);
@@ -915,7 +877,6 @@ LibPcdGetNextToken (
return TokenNumber;
}
-
/**
Used to retrieve the list of available PCD token space GUIDs.
@@ -937,11 +898,9 @@ LibPcdGetNextTokenSpace (
{
(GetPiPcdPpiPointer ())->GetNextTokenSpace (&TokenSpaceGuid);
- return (GUID *) TokenSpaceGuid;
+ return (GUID *)TokenSpaceGuid;
}
-
-
/**
Sets a value of a patchable PCD entry that is type pointer.
@@ -968,10 +927,10 @@ LibPcdGetNextTokenSpace (
VOID *
EFIAPI
LibPatchPcdSetPtr (
- OUT VOID *PatchVariable,
- IN UINTN MaximumDatumSize,
- IN OUT UINTN *SizeOfBuffer,
- IN CONST VOID *Buffer
+ OUT VOID *PatchVariable,
+ IN UINTN MaximumDatumSize,
+ IN OUT UINTN *SizeOfBuffer,
+ IN CONST VOID *Buffer
)
{
ASSERT (PatchVariable != NULL);
@@ -982,14 +941,15 @@ LibPatchPcdSetPtr (
}
if ((*SizeOfBuffer > MaximumDatumSize) ||
- (*SizeOfBuffer == MAX_ADDRESS)) {
+ (*SizeOfBuffer == MAX_ADDRESS))
+ {
*SizeOfBuffer = MaximumDatumSize;
return NULL;
}
CopyMem (PatchVariable, Buffer, *SizeOfBuffer);
- return (VOID *) Buffer;
+ return (VOID *)Buffer;
}
/**
@@ -1018,10 +978,10 @@ LibPatchPcdSetPtr (
RETURN_STATUS
EFIAPI
LibPatchPcdSetPtrS (
- OUT VOID *PatchVariable,
- IN UINTN MaximumDatumSize,
- IN OUT UINTN *SizeOfBuffer,
- IN CONST VOID *Buffer
+ OUT VOID *PatchVariable,
+ IN UINTN MaximumDatumSize,
+ IN OUT UINTN *SizeOfBuffer,
+ IN CONST VOID *Buffer
)
{
ASSERT (PatchVariable != NULL);
@@ -1032,7 +992,8 @@ LibPatchPcdSetPtrS (
}
if ((*SizeOfBuffer > MaximumDatumSize) ||
- (*SizeOfBuffer == MAX_ADDRESS)) {
+ (*SizeOfBuffer == MAX_ADDRESS))
+ {
*SizeOfBuffer = MaximumDatumSize;
return RETURN_INVALID_PARAMETER;
}
@@ -1042,7 +1003,6 @@ LibPatchPcdSetPtrS (
return RETURN_SUCCESS;
}
-
/**
Sets a value and size of a patchable PCD entry that is type pointer.
@@ -1071,11 +1031,11 @@ LibPatchPcdSetPtrS (
VOID *
EFIAPI
LibPatchPcdSetPtrAndSize (
- OUT VOID *PatchVariable,
- OUT UINTN *SizeOfPatchVariable,
- IN UINTN MaximumDatumSize,
- IN OUT UINTN *SizeOfBuffer,
- IN CONST VOID *Buffer
+ OUT VOID *PatchVariable,
+ OUT UINTN *SizeOfPatchVariable,
+ IN UINTN MaximumDatumSize,
+ IN OUT UINTN *SizeOfBuffer,
+ IN CONST VOID *Buffer
)
{
ASSERT (PatchVariable != NULL);
@@ -1087,7 +1047,8 @@ LibPatchPcdSetPtrAndSize (
}
if ((*SizeOfBuffer > MaximumDatumSize) ||
- (*SizeOfBuffer == MAX_ADDRESS)) {
+ (*SizeOfBuffer == MAX_ADDRESS))
+ {
*SizeOfBuffer = MaximumDatumSize;
return NULL;
}
@@ -1095,7 +1056,7 @@ LibPatchPcdSetPtrAndSize (
CopyMem (PatchVariable, Buffer, *SizeOfBuffer);
*SizeOfPatchVariable = *SizeOfBuffer;
- return (VOID *) Buffer;
+ return (VOID *)Buffer;
}
/**
@@ -1126,11 +1087,11 @@ LibPatchPcdSetPtrAndSize (
RETURN_STATUS
EFIAPI
LibPatchPcdSetPtrAndSizeS (
- OUT VOID *PatchVariable,
- OUT UINTN *SizeOfPatchVariable,
- IN UINTN MaximumDatumSize,
- IN OUT UINTN *SizeOfBuffer,
- IN CONST VOID *Buffer
+ OUT VOID *PatchVariable,
+ OUT UINTN *SizeOfPatchVariable,
+ IN UINTN MaximumDatumSize,
+ IN OUT UINTN *SizeOfBuffer,
+ IN CONST VOID *Buffer
)
{
ASSERT (PatchVariable != NULL);
@@ -1142,7 +1103,8 @@ LibPatchPcdSetPtrAndSizeS (
}
if ((*SizeOfBuffer > MaximumDatumSize) ||
- (*SizeOfBuffer == MAX_ADDRESS)) {
+ (*SizeOfBuffer == MAX_ADDRESS))
+ {
*SizeOfBuffer = MaximumDatumSize;
return RETURN_INVALID_PARAMETER;
}
@@ -1168,13 +1130,13 @@ LibPatchPcdSetPtrAndSizeS (
VOID
EFIAPI
LibPcdGetInfo (
- IN UINTN TokenNumber,
- OUT PCD_INFO *PcdInfo
+ IN UINTN TokenNumber,
+ OUT PCD_INFO *PcdInfo
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- Status = GetPcdInfoPpiPointer()->GetInfo (TokenNumber, (EFI_PCD_INFO *) PcdInfo);
+ Status = GetPcdInfoPpiPointer ()->GetInfo (TokenNumber, (EFI_PCD_INFO *)PcdInfo);
ASSERT_EFI_ERROR (Status);
}
@@ -1194,14 +1156,14 @@ LibPcdGetInfo (
VOID
EFIAPI
LibPcdGetInfoEx (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber,
- OUT PCD_INFO *PcdInfo
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ OUT PCD_INFO *PcdInfo
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- Status = GetPiPcdInfoPpiPointer()->GetInfo (Guid, TokenNumber, (EFI_PCD_INFO *) PcdInfo);
+ Status = GetPiPcdInfoPpiPointer ()->GetInfo (Guid, TokenNumber, (EFI_PCD_INFO *)PcdInfo);
ASSERT_EFI_ERROR (Status);
}
@@ -1218,5 +1180,5 @@ LibPcdGetSku (
VOID
)
{
- return GetPiPcdInfoPpiPointer()->GetSku ();
+ return GetPiPcdInfoPpiPointer ()->GetSku ();
}
diff --git a/MdePkg/Library/PeiPciLibPciCfg2/PciLib.c b/MdePkg/Library/PeiPciLibPciCfg2/PciLib.c
index b9ed2d2d93..18823307e1 100644
--- a/MdePkg/Library/PeiPciLibPciCfg2/PciLib.c
+++ b/MdePkg/Library/PeiPciLibPciCfg2/PciLib.c
@@ -24,7 +24,7 @@
@param M Additional bits to assert to be zero.
**/
-#define ASSERT_INVALID_PCI_ADDRESS(A,M) \
+#define ASSERT_INVALID_PCI_ADDRESS(A, M) \
ASSERT (((A) & (~0xfffffff | (M))) == 0)
/**
@@ -53,16 +53,16 @@
**/
UINT32
PeiPciLibPciCfg2ReadWorker (
- IN UINTN Address,
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
+ IN UINTN Address,
+ IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
)
{
- EFI_STATUS Status;
- UINT32 Data;
- CONST EFI_PEI_PCI_CFG2_PPI *PciCfg2Ppi;
- UINT64 PciCfg2Address;
+ EFI_STATUS Status;
+ UINT32 Data;
+ CONST EFI_PEI_PCI_CFG2_PPI *PciCfg2Ppi;
+ UINT64 PciCfg2Address;
- Status = PeiServicesLocatePpi (&gEfiPciCfg2PpiGuid, 0, NULL, (VOID **) &PciCfg2Ppi);
+ Status = PeiServicesLocatePpi (&gEfiPciCfg2PpiGuid, 0, NULL, (VOID **)&PciCfg2Ppi);
ASSERT_EFI_ERROR (Status);
ASSERT (PciCfg2Ppi != NULL);
@@ -96,16 +96,16 @@ PeiPciLibPciCfg2ReadWorker (
**/
UINT32
PeiPciLibPciCfg2WriteWorker (
- IN UINTN Address,
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
- IN UINT32 Data
+ IN UINTN Address,
+ IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
+ IN UINT32 Data
)
{
- EFI_STATUS Status;
- CONST EFI_PEI_PCI_CFG2_PPI *PciCfg2Ppi;
- UINT64 PciCfg2Address;
+ EFI_STATUS Status;
+ CONST EFI_PEI_PCI_CFG2_PPI *PciCfg2Ppi;
+ UINT64 PciCfg2Address;
- Status = PeiServicesLocatePpi (&gEfiPciCfg2PpiGuid, 0, NULL, (VOID **) &PciCfg2Ppi);
+ Status = PeiServicesLocatePpi (&gEfiPciCfg2PpiGuid, 0, NULL, (VOID **)&PciCfg2Ppi);
ASSERT_EFI_ERROR (Status);
ASSERT (PciCfg2Ppi != NULL);
@@ -170,12 +170,12 @@ PciRegisterForRuntimeAccess (
UINT8
EFIAPI
PciRead8 (
- IN UINTN Address
+ IN UINTN Address
)
{
ASSERT_INVALID_PCI_ADDRESS (Address, 0);
- return (UINT8) PeiPciLibPciCfg2ReadWorker (Address, EfiPeiPciCfgWidthUint8);
+ return (UINT8)PeiPciLibPciCfg2ReadWorker (Address, EfiPeiPciCfgWidthUint8);
}
/**
@@ -197,13 +197,13 @@ PciRead8 (
UINT8
EFIAPI
PciWrite8 (
- IN UINTN Address,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINT8 Value
)
{
ASSERT_INVALID_PCI_ADDRESS (Address, 0);
- return (UINT8) PeiPciLibPciCfg2WriteWorker (Address, EfiPeiPciCfgWidthUint8, Value);
+ return (UINT8)PeiPciLibPciCfg2WriteWorker (Address, EfiPeiPciCfgWidthUint8, Value);
}
/**
@@ -229,11 +229,11 @@ PciWrite8 (
UINT8
EFIAPI
PciOr8 (
- IN UINTN Address,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 OrData
)
{
- return PciWrite8 (Address, (UINT8) (PciRead8 (Address) | OrData));
+ return PciWrite8 (Address, (UINT8)(PciRead8 (Address) | OrData));
}
/**
@@ -259,11 +259,11 @@ PciOr8 (
UINT8
EFIAPI
PciAnd8 (
- IN UINTN Address,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINT8 AndData
)
{
- return PciWrite8 (Address, (UINT8) (PciRead8 (Address) & AndData));
+ return PciWrite8 (Address, (UINT8)(PciRead8 (Address) & AndData));
}
/**
@@ -291,12 +291,12 @@ PciAnd8 (
UINT8
EFIAPI
PciAndThenOr8 (
- IN UINTN Address,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
- return PciWrite8 (Address, (UINT8) ((PciRead8 (Address) & AndData) | OrData));
+ return PciWrite8 (Address, (UINT8)((PciRead8 (Address) & AndData) | OrData));
}
/**
@@ -323,9 +323,9 @@ PciAndThenOr8 (
UINT8
EFIAPI
PciBitFieldRead8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead8 (PciRead8 (Address), StartBit, EndBit);
@@ -358,10 +358,10 @@ PciBitFieldRead8 (
UINT8
EFIAPI
PciBitFieldWrite8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
return PciWrite8 (
@@ -400,10 +400,10 @@ PciBitFieldWrite8 (
UINT8
EFIAPI
PciBitFieldOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
return PciWrite8 (
@@ -442,10 +442,10 @@ PciBitFieldOr8 (
UINT8
EFIAPI
PciBitFieldAnd8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
return PciWrite8 (
@@ -488,11 +488,11 @@ PciBitFieldAnd8 (
UINT8
EFIAPI
PciBitFieldAndThenOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
return PciWrite8 (
@@ -520,12 +520,12 @@ PciBitFieldAndThenOr8 (
UINT16
EFIAPI
PciRead16 (
- IN UINTN Address
+ IN UINTN Address
)
{
ASSERT_INVALID_PCI_ADDRESS (Address, 1);
- return (UINT16) PeiPciLibPciCfg2ReadWorker (Address, EfiPeiPciCfgWidthUint16);
+ return (UINT16)PeiPciLibPciCfg2ReadWorker (Address, EfiPeiPciCfgWidthUint16);
}
/**
@@ -548,13 +548,13 @@ PciRead16 (
UINT16
EFIAPI
PciWrite16 (
- IN UINTN Address,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINT16 Value
)
{
ASSERT_INVALID_PCI_ADDRESS (Address, 1);
- return (UINT16) PeiPciLibPciCfg2WriteWorker (Address, EfiPeiPciCfgWidthUint16, Value);
+ return (UINT16)PeiPciLibPciCfg2WriteWorker (Address, EfiPeiPciCfgWidthUint16, Value);
}
/**
@@ -581,11 +581,11 @@ PciWrite16 (
UINT16
EFIAPI
PciOr16 (
- IN UINTN Address,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 OrData
)
{
- return PciWrite16 (Address, (UINT16) (PciRead16 (Address) | OrData));
+ return PciWrite16 (Address, (UINT16)(PciRead16 (Address) | OrData));
}
/**
@@ -612,11 +612,11 @@ PciOr16 (
UINT16
EFIAPI
PciAnd16 (
- IN UINTN Address,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINT16 AndData
)
{
- return PciWrite16 (Address, (UINT16) (PciRead16 (Address) & AndData));
+ return PciWrite16 (Address, (UINT16)(PciRead16 (Address) & AndData));
}
/**
@@ -645,12 +645,12 @@ PciAnd16 (
UINT16
EFIAPI
PciAndThenOr16 (
- IN UINTN Address,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
- return PciWrite16 (Address, (UINT16) ((PciRead16 (Address) & AndData) | OrData));
+ return PciWrite16 (Address, (UINT16)((PciRead16 (Address) & AndData) | OrData));
}
/**
@@ -678,9 +678,9 @@ PciAndThenOr16 (
UINT16
EFIAPI
PciBitFieldRead16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead16 (PciRead16 (Address), StartBit, EndBit);
@@ -714,10 +714,10 @@ PciBitFieldRead16 (
UINT16
EFIAPI
PciBitFieldWrite16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
return PciWrite16 (
@@ -757,10 +757,10 @@ PciBitFieldWrite16 (
UINT16
EFIAPI
PciBitFieldOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
return PciWrite16 (
@@ -800,10 +800,10 @@ PciBitFieldOr16 (
UINT16
EFIAPI
PciBitFieldAnd16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
return PciWrite16 (
@@ -847,11 +847,11 @@ PciBitFieldAnd16 (
UINT16
EFIAPI
PciBitFieldAndThenOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
return PciWrite16 (
@@ -879,7 +879,7 @@ PciBitFieldAndThenOr16 (
UINT32
EFIAPI
PciRead32 (
- IN UINTN Address
+ IN UINTN Address
)
{
ASSERT_INVALID_PCI_ADDRESS (Address, 3);
@@ -907,8 +907,8 @@ PciRead32 (
UINT32
EFIAPI
PciWrite32 (
- IN UINTN Address,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINT32 Value
)
{
ASSERT_INVALID_PCI_ADDRESS (Address, 3);
@@ -940,8 +940,8 @@ PciWrite32 (
UINT32
EFIAPI
PciOr32 (
- IN UINTN Address,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 OrData
)
{
return PciWrite32 (Address, PciRead32 (Address) | OrData);
@@ -971,8 +971,8 @@ PciOr32 (
UINT32
EFIAPI
PciAnd32 (
- IN UINTN Address,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINT32 AndData
)
{
return PciWrite32 (Address, PciRead32 (Address) & AndData);
@@ -1004,9 +1004,9 @@ PciAnd32 (
UINT32
EFIAPI
PciAndThenOr32 (
- IN UINTN Address,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return PciWrite32 (Address, (PciRead32 (Address) & AndData) | OrData);
@@ -1037,9 +1037,9 @@ PciAndThenOr32 (
UINT32
EFIAPI
PciBitFieldRead32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead32 (PciRead32 (Address), StartBit, EndBit);
@@ -1073,10 +1073,10 @@ PciBitFieldRead32 (
UINT32
EFIAPI
PciBitFieldWrite32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
return PciWrite32 (
@@ -1116,10 +1116,10 @@ PciBitFieldWrite32 (
UINT32
EFIAPI
PciBitFieldOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
return PciWrite32 (
@@ -1159,10 +1159,10 @@ PciBitFieldOr32 (
UINT32
EFIAPI
PciBitFieldAnd32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
return PciWrite32 (
@@ -1206,11 +1206,11 @@ PciBitFieldAnd32 (
UINT32
EFIAPI
PciBitFieldAndThenOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return PciWrite32 (
@@ -1245,12 +1245,12 @@ PciBitFieldAndThenOr32 (
UINTN
EFIAPI
PciReadBuffer (
- IN UINTN StartAddress,
- IN UINTN Size,
- OUT VOID *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Size,
+ OUT VOID *Buffer
)
{
- UINTN ReturnValue;
+ UINTN ReturnValue;
ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
@@ -1271,19 +1271,19 @@ PciReadBuffer (
// Read a byte if StartAddress is byte aligned
//
*(volatile UINT8 *)Buffer = PciRead8 (StartAddress);
- StartAddress += sizeof (UINT8);
- Size -= sizeof (UINT8);
- Buffer = (UINT8*)Buffer + 1;
+ StartAddress += sizeof (UINT8);
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *)Buffer + 1;
}
- if (Size >= sizeof (UINT16) && (StartAddress & BIT1) != 0) {
+ if ((Size >= sizeof (UINT16)) && ((StartAddress & BIT1) != 0)) {
//
// Read a word if StartAddress is word aligned
//
WriteUnaligned16 (Buffer, PciRead16 (StartAddress));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
while (Size >= sizeof (UINT32)) {
@@ -1292,8 +1292,8 @@ PciReadBuffer (
//
WriteUnaligned32 (Buffer, PciRead32 (StartAddress));
StartAddress += sizeof (UINT32);
- Size -= sizeof (UINT32);
- Buffer = (UINT32*)Buffer + 1;
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *)Buffer + 1;
}
if (Size >= sizeof (UINT16)) {
@@ -1302,8 +1302,8 @@ PciReadBuffer (
//
WriteUnaligned16 (Buffer, PciRead16 (StartAddress));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
if (Size >= sizeof (UINT8)) {
@@ -1343,12 +1343,12 @@ PciReadBuffer (
UINTN
EFIAPI
PciWriteBuffer (
- IN UINTN StartAddress,
- IN UINTN Size,
- IN VOID *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Size,
+ IN VOID *Buffer
)
{
- UINTN ReturnValue;
+ UINTN ReturnValue;
ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
@@ -1368,20 +1368,20 @@ PciWriteBuffer (
//
// Write a byte if StartAddress is byte aligned
//
- PciWrite8 (StartAddress, *(UINT8*)Buffer);
+ PciWrite8 (StartAddress, *(UINT8 *)Buffer);
StartAddress += sizeof (UINT8);
- Size -= sizeof (UINT8);
- Buffer = (UINT8*)Buffer + 1;
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *)Buffer + 1;
}
- if (Size >= sizeof (UINT16) && (StartAddress & BIT1) != 0) {
+ if ((Size >= sizeof (UINT16)) && ((StartAddress & BIT1) != 0)) {
//
// Write a word if StartAddress is word aligned
//
PciWrite16 (StartAddress, ReadUnaligned16 (Buffer));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
while (Size >= sizeof (UINT32)) {
@@ -1390,8 +1390,8 @@ PciWriteBuffer (
//
PciWrite32 (StartAddress, ReadUnaligned32 (Buffer));
StartAddress += sizeof (UINT32);
- Size -= sizeof (UINT32);
- Buffer = (UINT32*)Buffer + 1;
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *)Buffer + 1;
}
if (Size >= sizeof (UINT16)) {
@@ -1400,15 +1400,15 @@ PciWriteBuffer (
//
PciWrite16 (StartAddress, ReadUnaligned16 (Buffer));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
if (Size >= sizeof (UINT8)) {
//
// Write the last remaining byte if exist
//
- PciWrite8 (StartAddress, *(UINT8*)Buffer);
+ PciWrite8 (StartAddress, *(UINT8 *)Buffer);
}
return ReturnValue;
diff --git a/MdePkg/Library/PeiPciSegmentLibPciCfg2/PciSegmentLib.c b/MdePkg/Library/PeiPciSegmentLibPciCfg2/PciSegmentLib.c
index 1128c917fa..80cddbefd3 100644
--- a/MdePkg/Library/PeiPciSegmentLibPciCfg2/PciSegmentLib.c
+++ b/MdePkg/Library/PeiPciSegmentLibPciCfg2/PciSegmentLib.c
@@ -24,7 +24,7 @@
@param M Additional bits to assert to be zero.
**/
-#define ASSERT_INVALID_PCI_SEGMENT_ADDRESS(A,M) \
+#define ASSERT_INVALID_PCI_SEGMENT_ADDRESS(A, M) \
ASSERT (((A) & (0xffff0000f0000000ULL | (M))) == 0)
/**
@@ -50,13 +50,13 @@
**/
EFI_PEI_PCI_CFG2_PPI *
InternalGetPciCfg2Ppi (
- IN UINT64 Address
+ IN UINT64 Address
)
{
- EFI_STATUS Status;
- UINTN Instance;
- EFI_PEI_PCI_CFG2_PPI *PciCfg2Ppi;
- UINT64 SegmentNumber;
+ EFI_STATUS Status;
+ UINTN Instance;
+ EFI_PEI_PCI_CFG2_PPI *PciCfg2Ppi;
+ UINT64 SegmentNumber;
Instance = 0;
PciCfg2Ppi = NULL;
@@ -66,11 +66,11 @@ InternalGetPciCfg2Ppi (
// Loop through all instances of the PPI and match segment number
//
do {
- Status = PeiServicesLocatePpi(
+ Status = PeiServicesLocatePpi (
&gEfiPciCfg2PpiGuid,
Instance,
NULL,
- (VOID**) &PciCfg2Ppi
+ (VOID **)&PciCfg2Ppi
);
ASSERT_EFI_ERROR (Status);
Instance++;
@@ -95,15 +95,15 @@ InternalGetPciCfg2Ppi (
**/
UINT32
PeiPciSegmentLibPciCfg2ReadWorker (
- IN UINT64 Address,
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
+ IN UINT64 Address,
+ IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
)
{
- UINT32 Data;
- CONST EFI_PEI_PCI_CFG2_PPI *PciCfg2Ppi;
- UINT64 PciCfg2Address;
+ UINT32 Data;
+ CONST EFI_PEI_PCI_CFG2_PPI *PciCfg2Ppi;
+ UINT64 PciCfg2Address;
- PciCfg2Ppi = InternalGetPciCfg2Ppi (Address);
+ PciCfg2Ppi = InternalGetPciCfg2Ppi (Address);
PciCfg2Address = PCI_TO_PCICFG2_ADDRESS (Address);
PciCfg2Ppi->Read (
GetPeiServicesTablePointer (),
@@ -134,15 +134,15 @@ PeiPciSegmentLibPciCfg2ReadWorker (
**/
UINT32
PeiPciSegmentLibPciCfg2WriteWorker (
- IN UINT64 Address,
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
- IN UINT32 Data
+ IN UINT64 Address,
+ IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
+ IN UINT32 Data
)
{
- CONST EFI_PEI_PCI_CFG2_PPI *PciCfg2Ppi;
- UINT64 PciCfg2Address;
+ CONST EFI_PEI_PCI_CFG2_PPI *PciCfg2Ppi;
+ UINT64 PciCfg2Address;
- PciCfg2Ppi = InternalGetPciCfg2Ppi (Address);
+ PciCfg2Ppi = InternalGetPciCfg2Ppi (Address);
PciCfg2Address = PCI_TO_PCICFG2_ADDRESS (Address);
PciCfg2Ppi->Write (
GetPeiServicesTablePointer (),
@@ -199,12 +199,12 @@ PciSegmentRegisterForRuntimeAccess (
UINT8
EFIAPI
PciSegmentRead8 (
- IN UINT64 Address
+ IN UINT64 Address
)
{
ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0);
- return (UINT8) PeiPciSegmentLibPciCfg2ReadWorker (Address, EfiPeiPciCfgWidthUint8);
+ return (UINT8)PeiPciSegmentLibPciCfg2ReadWorker (Address, EfiPeiPciCfgWidthUint8);
}
/**
@@ -224,13 +224,13 @@ PciSegmentRead8 (
UINT8
EFIAPI
PciSegmentWrite8 (
- IN UINT64 Address,
- IN UINT8 Value
+ IN UINT64 Address,
+ IN UINT8 Value
)
{
ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0);
- return (UINT8) PeiPciSegmentLibPciCfg2WriteWorker (Address, EfiPeiPciCfgWidthUint8, Value);
+ return (UINT8)PeiPciSegmentLibPciCfg2WriteWorker (Address, EfiPeiPciCfgWidthUint8, Value);
}
/**
@@ -253,11 +253,11 @@ PciSegmentWrite8 (
UINT8
EFIAPI
PciSegmentOr8 (
- IN UINT64 Address,
- IN UINT8 OrData
+ IN UINT64 Address,
+ IN UINT8 OrData
)
{
- return PciSegmentWrite8 (Address, (UINT8) (PciSegmentRead8 (Address) | OrData));
+ return PciSegmentWrite8 (Address, (UINT8)(PciSegmentRead8 (Address) | OrData));
}
/**
@@ -279,11 +279,11 @@ PciSegmentOr8 (
UINT8
EFIAPI
PciSegmentAnd8 (
- IN UINT64 Address,
- IN UINT8 AndData
+ IN UINT64 Address,
+ IN UINT8 AndData
)
{
- return PciSegmentWrite8 (Address, (UINT8) (PciSegmentRead8 (Address) & AndData));
+ return PciSegmentWrite8 (Address, (UINT8)(PciSegmentRead8 (Address) & AndData));
}
/**
@@ -309,12 +309,12 @@ PciSegmentAnd8 (
UINT8
EFIAPI
PciSegmentAndThenOr8 (
- IN UINT64 Address,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINT64 Address,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
- return PciSegmentWrite8 (Address, (UINT8) ((PciSegmentRead8 (Address) & AndData) | OrData));
+ return PciSegmentWrite8 (Address, (UINT8)((PciSegmentRead8 (Address) & AndData) | OrData));
}
/**
@@ -341,9 +341,9 @@ PciSegmentAndThenOr8 (
UINT8
EFIAPI
PciSegmentBitFieldRead8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead8 (PciSegmentRead8 (Address), StartBit, EndBit);
@@ -376,10 +376,10 @@ PciSegmentBitFieldRead8 (
UINT8
EFIAPI
PciSegmentBitFieldWrite8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
return PciSegmentWrite8 (
@@ -418,10 +418,10 @@ PciSegmentBitFieldWrite8 (
UINT8
EFIAPI
PciSegmentBitFieldOr8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
return PciSegmentWrite8 (
@@ -460,10 +460,10 @@ PciSegmentBitFieldOr8 (
UINT8
EFIAPI
PciSegmentBitFieldAnd8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
return PciSegmentWrite8 (
@@ -505,11 +505,11 @@ PciSegmentBitFieldAnd8 (
UINT8
EFIAPI
PciSegmentBitFieldAndThenOr8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
return PciSegmentWrite8 (
@@ -535,12 +535,12 @@ PciSegmentBitFieldAndThenOr8 (
UINT16
EFIAPI
PciSegmentRead16 (
- IN UINT64 Address
+ IN UINT64 Address
)
{
ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 1);
- return (UINT16) PeiPciSegmentLibPciCfg2ReadWorker (Address, EfiPeiPciCfgWidthUint16);
+ return (UINT16)PeiPciSegmentLibPciCfg2ReadWorker (Address, EfiPeiPciCfgWidthUint16);
}
/**
@@ -561,13 +561,13 @@ PciSegmentRead16 (
UINT16
EFIAPI
PciSegmentWrite16 (
- IN UINT64 Address,
- IN UINT16 Value
+ IN UINT64 Address,
+ IN UINT16 Value
)
{
ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 1);
- return (UINT16) PeiPciSegmentLibPciCfg2WriteWorker (Address, EfiPeiPciCfgWidthUint16, Value);
+ return (UINT16)PeiPciSegmentLibPciCfg2WriteWorker (Address, EfiPeiPciCfgWidthUint16, Value);
}
/**
@@ -593,11 +593,11 @@ PciSegmentWrite16 (
UINT16
EFIAPI
PciSegmentOr16 (
- IN UINT64 Address,
- IN UINT16 OrData
+ IN UINT64 Address,
+ IN UINT16 OrData
)
{
- return PciSegmentWrite16 (Address, (UINT16) (PciSegmentRead16 (Address) | OrData));
+ return PciSegmentWrite16 (Address, (UINT16)(PciSegmentRead16 (Address) | OrData));
}
/**
@@ -621,11 +621,11 @@ PciSegmentOr16 (
UINT16
EFIAPI
PciSegmentAnd16 (
- IN UINT64 Address,
- IN UINT16 AndData
+ IN UINT64 Address,
+ IN UINT16 AndData
)
{
- return PciSegmentWrite16 (Address, (UINT16) (PciSegmentRead16 (Address) & AndData));
+ return PciSegmentWrite16 (Address, (UINT16)(PciSegmentRead16 (Address) & AndData));
}
/**
@@ -652,12 +652,12 @@ PciSegmentAnd16 (
UINT16
EFIAPI
PciSegmentAndThenOr16 (
- IN UINT64 Address,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINT64 Address,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
- return PciSegmentWrite16 (Address, (UINT16) ((PciSegmentRead16 (Address) & AndData) | OrData));
+ return PciSegmentWrite16 (Address, (UINT16)((PciSegmentRead16 (Address) & AndData) | OrData));
}
/**
@@ -685,9 +685,9 @@ PciSegmentAndThenOr16 (
UINT16
EFIAPI
PciSegmentBitFieldRead16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead16 (PciSegmentRead16 (Address), StartBit, EndBit);
@@ -721,10 +721,10 @@ PciSegmentBitFieldRead16 (
UINT16
EFIAPI
PciSegmentBitFieldWrite16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
return PciSegmentWrite16 (
@@ -764,10 +764,10 @@ PciSegmentBitFieldWrite16 (
UINT16
EFIAPI
PciSegmentBitFieldOr16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
return PciSegmentWrite16 (
@@ -807,10 +807,10 @@ PciSegmentBitFieldOr16 (
UINT16
EFIAPI
PciSegmentBitFieldAnd16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
return PciSegmentWrite16 (
@@ -853,11 +853,11 @@ PciSegmentBitFieldAnd16 (
UINT16
EFIAPI
PciSegmentBitFieldAndThenOr16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
return PciSegmentWrite16 (
@@ -883,7 +883,7 @@ PciSegmentBitFieldAndThenOr16 (
UINT32
EFIAPI
PciSegmentRead32 (
- IN UINT64 Address
+ IN UINT64 Address
)
{
ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 3);
@@ -909,8 +909,8 @@ PciSegmentRead32 (
UINT32
EFIAPI
PciSegmentWrite32 (
- IN UINT64 Address,
- IN UINT32 Value
+ IN UINT64 Address,
+ IN UINT32 Value
)
{
ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 3);
@@ -939,8 +939,8 @@ PciSegmentWrite32 (
UINT32
EFIAPI
PciSegmentOr32 (
- IN UINT64 Address,
- IN UINT32 OrData
+ IN UINT64 Address,
+ IN UINT32 OrData
)
{
return PciSegmentWrite32 (Address, PciSegmentRead32 (Address) | OrData);
@@ -967,8 +967,8 @@ PciSegmentOr32 (
UINT32
EFIAPI
PciSegmentAnd32 (
- IN UINT64 Address,
- IN UINT32 AndData
+ IN UINT64 Address,
+ IN UINT32 AndData
)
{
return PciSegmentWrite32 (Address, PciSegmentRead32 (Address) & AndData);
@@ -998,9 +998,9 @@ PciSegmentAnd32 (
UINT32
EFIAPI
PciSegmentAndThenOr32 (
- IN UINT64 Address,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINT64 Address,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return PciSegmentWrite32 (Address, (PciSegmentRead32 (Address) & AndData) | OrData);
@@ -1031,9 +1031,9 @@ PciSegmentAndThenOr32 (
UINT32
EFIAPI
PciSegmentBitFieldRead32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead32 (PciSegmentRead32 (Address), StartBit, EndBit);
@@ -1067,10 +1067,10 @@ PciSegmentBitFieldRead32 (
UINT32
EFIAPI
PciSegmentBitFieldWrite32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
return PciSegmentWrite32 (
@@ -1109,10 +1109,10 @@ PciSegmentBitFieldWrite32 (
UINT32
EFIAPI
PciSegmentBitFieldOr32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
return PciSegmentWrite32 (
@@ -1151,10 +1151,10 @@ PciSegmentBitFieldOr32 (
UINT32
EFIAPI
PciSegmentBitFieldAnd32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
return PciSegmentWrite32 (
@@ -1197,11 +1197,11 @@ PciSegmentBitFieldAnd32 (
UINT32
EFIAPI
PciSegmentBitFieldAndThenOr32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return PciSegmentWrite32 (
@@ -1236,12 +1236,12 @@ PciSegmentBitFieldAndThenOr32 (
UINTN
EFIAPI
PciSegmentReadBuffer (
- IN UINT64 StartAddress,
- IN UINTN Size,
- OUT VOID *Buffer
+ IN UINT64 StartAddress,
+ IN UINTN Size,
+ OUT VOID *Buffer
)
{
- UINTN ReturnValue;
+ UINTN ReturnValue;
ASSERT_INVALID_PCI_SEGMENT_ADDRESS (StartAddress, 0);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
@@ -1262,19 +1262,19 @@ PciSegmentReadBuffer (
// Read a byte if StartAddress is byte aligned
//
*(volatile UINT8 *)Buffer = PciSegmentRead8 (StartAddress);
- StartAddress += sizeof (UINT8);
- Size -= sizeof (UINT8);
- Buffer = (UINT8*)Buffer + 1;
+ StartAddress += sizeof (UINT8);
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *)Buffer + 1;
}
- if (Size >= sizeof (UINT16) && (StartAddress & BIT1) != 0) {
+ if ((Size >= sizeof (UINT16)) && ((StartAddress & BIT1) != 0)) {
//
// Read a word if StartAddress is word aligned
//
WriteUnaligned16 (Buffer, PciSegmentRead16 (StartAddress));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
while (Size >= sizeof (UINT32)) {
@@ -1283,8 +1283,8 @@ PciSegmentReadBuffer (
//
WriteUnaligned32 (Buffer, PciSegmentRead32 (StartAddress));
StartAddress += sizeof (UINT32);
- Size -= sizeof (UINT32);
- Buffer = (UINT32*)Buffer + 1;
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *)Buffer + 1;
}
if (Size >= sizeof (UINT16)) {
@@ -1293,8 +1293,8 @@ PciSegmentReadBuffer (
//
WriteUnaligned16 (Buffer, PciSegmentRead16 (StartAddress));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
if (Size >= sizeof (UINT8)) {
@@ -1307,7 +1307,6 @@ PciSegmentReadBuffer (
return ReturnValue;
}
-
/**
Copies the data in a caller supplied buffer to a specified range of PCI
configuration space.
@@ -1335,12 +1334,12 @@ PciSegmentReadBuffer (
UINTN
EFIAPI
PciSegmentWriteBuffer (
- IN UINT64 StartAddress,
- IN UINTN Size,
- IN VOID *Buffer
+ IN UINT64 StartAddress,
+ IN UINTN Size,
+ IN VOID *Buffer
)
{
- UINTN ReturnValue;
+ UINTN ReturnValue;
ASSERT_INVALID_PCI_SEGMENT_ADDRESS (StartAddress, 0);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
@@ -1360,20 +1359,20 @@ PciSegmentWriteBuffer (
//
// Write a byte if StartAddress is byte aligned
//
- PciSegmentWrite8 (StartAddress, *(UINT8*)Buffer);
+ PciSegmentWrite8 (StartAddress, *(UINT8 *)Buffer);
StartAddress += sizeof (UINT8);
- Size -= sizeof (UINT8);
- Buffer = (UINT8*)Buffer + 1;
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *)Buffer + 1;
}
- if (Size >= sizeof (UINT16) && (StartAddress & BIT1) != 0) {
+ if ((Size >= sizeof (UINT16)) && ((StartAddress & BIT1) != 0)) {
//
// Write a word if StartAddress is word aligned
//
PciSegmentWrite16 (StartAddress, ReadUnaligned16 (Buffer));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
while (Size >= sizeof (UINT32)) {
@@ -1382,8 +1381,8 @@ PciSegmentWriteBuffer (
//
PciSegmentWrite32 (StartAddress, ReadUnaligned32 (Buffer));
StartAddress += sizeof (UINT32);
- Size -= sizeof (UINT32);
- Buffer = (UINT32*)Buffer + 1;
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *)Buffer + 1;
}
if (Size >= sizeof (UINT16)) {
@@ -1392,15 +1391,15 @@ PciSegmentWriteBuffer (
//
PciSegmentWrite16 (StartAddress, ReadUnaligned16 (Buffer));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
if (Size >= sizeof (UINT8)) {
//
// Write the last remaining byte if exist
//
- PciSegmentWrite8 (StartAddress, *(UINT8*)Buffer);
+ PciSegmentWrite8 (StartAddress, *(UINT8 *)Buffer);
}
return ReturnValue;
diff --git a/MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.c b/MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.c
index d2833585be..1a3abd8e15 100644
--- a/MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.c
+++ b/MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.c
@@ -6,16 +6,12 @@
**/
-
-
#include <PiPei.h>
-
#include <Library/ResourcePublicationLib.h>
#include <Library/PeiServicesLib.h>
#include <Library/DebugLib.h>
-
/**
Declares the presence of permanent system memory in the platform.
@@ -36,17 +32,16 @@
RETURN_STATUS
EFIAPI
PublishSystemMemory (
- IN PHYSICAL_ADDRESS MemoryBegin,
- IN UINT64 MemoryLength
+ IN PHYSICAL_ADDRESS MemoryBegin,
+ IN UINT64 MemoryLength
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
ASSERT (MemoryLength > 0);
ASSERT (MemoryLength <= (MAX_ADDRESS - MemoryBegin + 1));
- Status = PeiServicesInstallPeiMemory (MemoryBegin, MemoryLength);
+ Status = PeiServicesInstallPeiMemory (MemoryBegin, MemoryLength);
- return (RETURN_STATUS) Status;
+ return (RETURN_STATUS)Status;
}
-
diff --git a/MdePkg/Library/PeiServicesLib/PeiServicesLib.c b/MdePkg/Library/PeiServicesLib/PeiServicesLib.c
index dce404f69d..98cc69c3a2 100644
--- a/MdePkg/Library/PeiServicesLib/PeiServicesLib.c
+++ b/MdePkg/Library/PeiServicesLib/PeiServicesLib.c
@@ -6,7 +6,6 @@
**/
-
#include <PiPei.h>
#include <Ppi/FirmwareVolumeInfo.h>
@@ -34,7 +33,7 @@
EFI_STATUS
EFIAPI
PeiServicesInstallPpi (
- IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList
+ IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList
)
{
CONST EFI_PEI_SERVICES **PeiServices;
@@ -61,11 +60,11 @@ PeiServicesInstallPpi (
EFI_STATUS
EFIAPI
PeiServicesReInstallPpi (
- IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi,
- IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi
+ IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi,
+ IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
+ CONST EFI_PEI_SERVICES **PeiServices;
PeiServices = GetPeiServicesTablePointer ();
return (*PeiServices)->ReInstallPpi (PeiServices, OldPpi, NewPpi);
@@ -87,13 +86,13 @@ PeiServicesReInstallPpi (
EFI_STATUS
EFIAPI
PeiServicesLocatePpi (
- IN CONST EFI_GUID *Guid,
- IN UINTN Instance,
- IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor OPTIONAL,
- IN OUT VOID **Ppi
+ IN CONST EFI_GUID *Guid,
+ IN UINTN Instance,
+ IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor OPTIONAL,
+ IN OUT VOID **Ppi
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
+ CONST EFI_PEI_SERVICES **PeiServices;
PeiServices = GetPeiServicesTablePointer ();
return (*PeiServices)->LocatePpi (PeiServices, Guid, Instance, PpiDescriptor, Ppi);
@@ -120,7 +119,7 @@ PeiServicesNotifyPpi (
IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
+ CONST EFI_PEI_SERVICES **PeiServices;
PeiServices = GetPeiServicesTablePointer ();
return (*PeiServices)->NotifyPpi (PeiServices, NotifyList);
@@ -138,10 +137,10 @@ PeiServicesNotifyPpi (
EFI_STATUS
EFIAPI
PeiServicesGetBootMode (
- OUT EFI_BOOT_MODE *BootMode
+ OUT EFI_BOOT_MODE *BootMode
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
+ CONST EFI_PEI_SERVICES **PeiServices;
PeiServices = GetPeiServicesTablePointer ();
return (*PeiServices)->GetBootMode (PeiServices, BootMode);
@@ -158,10 +157,10 @@ PeiServicesGetBootMode (
EFI_STATUS
EFIAPI
PeiServicesSetBootMode (
- IN EFI_BOOT_MODE BootMode
+ IN EFI_BOOT_MODE BootMode
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
+ CONST EFI_PEI_SERVICES **PeiServices;
PeiServices = GetPeiServicesTablePointer ();
return (*PeiServices)->SetBootMode (PeiServices, BootMode);
@@ -180,10 +179,10 @@ PeiServicesSetBootMode (
EFI_STATUS
EFIAPI
PeiServicesGetHobList (
- OUT VOID **HobList
+ OUT VOID **HobList
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
+ CONST EFI_PEI_SERVICES **PeiServices;
PeiServices = GetPeiServicesTablePointer ();
return (*PeiServices)->GetHobList (PeiServices, HobList);
@@ -204,12 +203,12 @@ PeiServicesGetHobList (
EFI_STATUS
EFIAPI
PeiServicesCreateHob (
- IN UINT16 Type,
- IN UINT16 Length,
- OUT VOID **Hob
+ IN UINT16 Type,
+ IN UINT16 Length,
+ OUT VOID **Hob
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
+ CONST EFI_PEI_SERVICES **PeiServices;
PeiServices = GetPeiServicesTablePointer ();
return (*PeiServices)->CreateHob (PeiServices, Type, Length, Hob);
@@ -231,11 +230,11 @@ PeiServicesCreateHob (
EFI_STATUS
EFIAPI
PeiServicesFfsFindNextVolume (
- IN UINTN Instance,
- IN OUT EFI_PEI_FV_HANDLE *VolumeHandle
+ IN UINTN Instance,
+ IN OUT EFI_PEI_FV_HANDLE *VolumeHandle
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
+ CONST EFI_PEI_SERVICES **PeiServices;
PeiServices = GetPeiServicesTablePointer ();
return (*PeiServices)->FfsFindNextVolume (PeiServices, Instance, VolumeHandle);
@@ -258,12 +257,12 @@ PeiServicesFfsFindNextVolume (
EFI_STATUS
EFIAPI
PeiServicesFfsFindNextFile (
- IN EFI_FV_FILETYPE SearchType,
- IN EFI_PEI_FV_HANDLE VolumeHandle,
- IN OUT EFI_PEI_FILE_HANDLE *FileHandle
+ IN EFI_FV_FILETYPE SearchType,
+ IN EFI_PEI_FV_HANDLE VolumeHandle,
+ IN OUT EFI_PEI_FILE_HANDLE *FileHandle
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
+ CONST EFI_PEI_SERVICES **PeiServices;
PeiServices = GetPeiServicesTablePointer ();
return (*PeiServices)->FfsFindNextFile (PeiServices, SearchType, VolumeHandle, FileHandle);
@@ -284,12 +283,12 @@ PeiServicesFfsFindNextFile (
EFI_STATUS
EFIAPI
PeiServicesFfsFindSectionData (
- IN EFI_SECTION_TYPE SectionType,
- IN EFI_PEI_FILE_HANDLE FileHandle,
- OUT VOID **SectionData
+ IN EFI_SECTION_TYPE SectionType,
+ IN EFI_PEI_FILE_HANDLE FileHandle,
+ OUT VOID **SectionData
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
+ CONST EFI_PEI_SERVICES **PeiServices;
PeiServices = GetPeiServicesTablePointer ();
return (*PeiServices)->FfsFindSectionData (PeiServices, SectionType, FileHandle, SectionData);
@@ -312,14 +311,14 @@ PeiServicesFfsFindSectionData (
EFI_STATUS
EFIAPI
PeiServicesFfsFindSectionData3 (
- IN EFI_SECTION_TYPE SectionType,
- IN UINTN SectionInstance,
- IN EFI_PEI_FILE_HANDLE FileHandle,
- OUT VOID **SectionData,
- OUT UINT32 *AuthenticationStatus
+ IN EFI_SECTION_TYPE SectionType,
+ IN UINTN SectionInstance,
+ IN EFI_PEI_FILE_HANDLE FileHandle,
+ OUT VOID **SectionData,
+ OUT UINT32 *AuthenticationStatus
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
+ CONST EFI_PEI_SERVICES **PeiServices;
PeiServices = GetPeiServicesTablePointer ();
return (*PeiServices)->FindSectionData3 (PeiServices, SectionType, SectionInstance, FileHandle, SectionData, AuthenticationStatus);
@@ -340,11 +339,11 @@ PeiServicesFfsFindSectionData3 (
EFI_STATUS
EFIAPI
PeiServicesInstallPeiMemory (
- IN EFI_PHYSICAL_ADDRESS MemoryBegin,
- IN UINT64 MemoryLength
+ IN EFI_PHYSICAL_ADDRESS MemoryBegin,
+ IN UINT64 MemoryLength
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
+ CONST EFI_PEI_SERVICES **PeiServices;
PeiServices = GetPeiServicesTablePointer ();
return (*PeiServices)->InstallPeiMemory (PeiServices, MemoryBegin, MemoryLength);
@@ -367,12 +366,12 @@ PeiServicesInstallPeiMemory (
EFI_STATUS
EFIAPI
PeiServicesAllocatePages (
- IN EFI_MEMORY_TYPE MemoryType,
- IN UINTN Pages,
- OUT EFI_PHYSICAL_ADDRESS *Memory
+ IN EFI_MEMORY_TYPE MemoryType,
+ IN UINTN Pages,
+ OUT EFI_PHYSICAL_ADDRESS *Memory
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
+ CONST EFI_PEI_SERVICES **PeiServices;
PeiServices = GetPeiServicesTablePointer ();
return (*PeiServices)->AllocatePages (PeiServices, MemoryType, Pages, Memory);
@@ -393,11 +392,11 @@ PeiServicesAllocatePages (
EFI_STATUS
EFIAPI
PeiServicesFreePages (
- IN EFI_PHYSICAL_ADDRESS Memory,
- IN UINTN Pages
+ IN EFI_PHYSICAL_ADDRESS Memory,
+ IN UINTN Pages
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
+ CONST EFI_PEI_SERVICES **PeiServices;
PeiServices = GetPeiServicesTablePointer ();
return (*PeiServices)->FreePages (PeiServices, Memory, Pages);
@@ -417,11 +416,11 @@ PeiServicesFreePages (
EFI_STATUS
EFIAPI
PeiServicesAllocatePool (
- IN UINTN Size,
- OUT VOID **Buffer
+ IN UINTN Size,
+ OUT VOID **Buffer
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
+ CONST EFI_PEI_SERVICES **PeiServices;
PeiServices = GetPeiServicesTablePointer ();
return (*PeiServices)->AllocatePool (PeiServices, Size, Buffer);
@@ -440,7 +439,7 @@ PeiServicesResetSystem (
VOID
)
{
- CONST EFI_PEI_SERVICES **PeiServices;
+ CONST EFI_PEI_SERVICES **PeiServices;
PeiServices = GetPeiServicesTablePointer ();
return (*PeiServices)->ResetSystem (PeiServices);
@@ -466,10 +465,10 @@ PeiServicesResetSystem (
EFI_STATUS
EFIAPI
PeiServicesRegisterForShadow (
- IN EFI_PEI_FILE_HANDLE FileHandle
+ IN EFI_PEI_FILE_HANDLE FileHandle
)
{
- return (*GetPeiServicesTablePointer())->RegisterForShadow (FileHandle);
+ return (*GetPeiServicesTablePointer ())->RegisterForShadow (FileHandle);
}
/**
@@ -493,11 +492,11 @@ PeiServicesRegisterForShadow (
EFI_STATUS
EFIAPI
PeiServicesFfsGetFileInfo (
- IN CONST EFI_PEI_FILE_HANDLE FileHandle,
- OUT EFI_FV_FILE_INFO *FileInfo
+ IN CONST EFI_PEI_FILE_HANDLE FileHandle,
+ OUT EFI_FV_FILE_INFO *FileInfo
)
{
- return (*GetPeiServicesTablePointer())->FfsGetFileInfo (FileHandle, FileInfo);
+ return (*GetPeiServicesTablePointer ())->FfsGetFileInfo (FileHandle, FileInfo);
}
/**
@@ -518,11 +517,11 @@ PeiServicesFfsGetFileInfo (
EFI_STATUS
EFIAPI
PeiServicesFfsGetFileInfo2 (
- IN CONST EFI_PEI_FILE_HANDLE FileHandle,
- OUT EFI_FV_FILE_INFO2 *FileInfo
+ IN CONST EFI_PEI_FILE_HANDLE FileHandle,
+ OUT EFI_FV_FILE_INFO2 *FileInfo
)
{
- return (*GetPeiServicesTablePointer())->FfsGetFileInfo2 (FileHandle, FileInfo);
+ return (*GetPeiServicesTablePointer ())->FfsGetFileInfo2 (FileHandle, FileInfo);
}
/**
@@ -549,15 +548,14 @@ PeiServicesFfsGetFileInfo2 (
EFI_STATUS
EFIAPI
PeiServicesFfsFindFileByName (
- IN CONST EFI_GUID *FileName,
- IN CONST EFI_PEI_FV_HANDLE VolumeHandle,
- OUT EFI_PEI_FILE_HANDLE *FileHandle
+ IN CONST EFI_GUID *FileName,
+ IN CONST EFI_PEI_FV_HANDLE VolumeHandle,
+ OUT EFI_PEI_FILE_HANDLE *FileHandle
)
{
- return (*GetPeiServicesTablePointer())->FfsFindFileByName (FileName, VolumeHandle, FileHandle);
+ return (*GetPeiServicesTablePointer ())->FfsFindFileByName (FileName, VolumeHandle, FileHandle);
}
-
/**
This service is a wrapper for the PEI Service FfsGetVolumeInfo(), except the pointer to the PEI Services
Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface
@@ -579,11 +577,11 @@ PeiServicesFfsFindFileByName (
EFI_STATUS
EFIAPI
PeiServicesFfsGetVolumeInfo (
- IN EFI_PEI_FV_HANDLE VolumeHandle,
- OUT EFI_FV_INFO *VolumeInfo
+ IN EFI_PEI_FV_HANDLE VolumeHandle,
+ OUT EFI_FV_INFO *VolumeInfo
)
{
- return (*GetPeiServicesTablePointer())->FfsGetVolumeInfo (VolumeHandle, VolumeInfo);
+ return (*GetPeiServicesTablePointer ())->FfsGetVolumeInfo (VolumeHandle, VolumeInfo);
}
/**
@@ -621,21 +619,21 @@ PeiServicesFfsGetVolumeInfo (
VOID
EFIAPI
InternalPeiServicesInstallFvInfoPpi (
- IN BOOLEAN InstallFvInfoPpi,
- IN CONST EFI_GUID *FvFormat OPTIONAL,
- IN CONST VOID *FvInfo,
- IN UINT32 FvInfoSize,
- IN CONST EFI_GUID *ParentFvName OPTIONAL,
- IN CONST EFI_GUID *ParentFileName OPTIONAL,
- IN UINT32 AuthenticationStatus
+ IN BOOLEAN InstallFvInfoPpi,
+ IN CONST EFI_GUID *FvFormat OPTIONAL,
+ IN CONST VOID *FvInfo,
+ IN UINT32 FvInfoSize,
+ IN CONST EFI_GUID *ParentFvName OPTIONAL,
+ IN CONST EFI_GUID *ParentFileName OPTIONAL,
+ IN UINT32 AuthenticationStatus
)
{
- EFI_STATUS Status;
- EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *FvInfoPpi;
- EFI_PEI_PPI_DESCRIPTOR *FvInfoPpiDescriptor;
- EFI_GUID *ParentFvNameValue;
- EFI_GUID *ParentFileNameValue;
- EFI_GUID *PpiGuid;
+ EFI_STATUS Status;
+ EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *FvInfoPpi;
+ EFI_PEI_PPI_DESCRIPTOR *FvInfoPpiDescriptor;
+ EFI_GUID *ParentFvNameValue;
+ EFI_GUID *ParentFileNameValue;
+ EFI_GUID *PpiGuid;
ParentFvNameValue = NULL;
ParentFileNameValue = NULL;
@@ -652,8 +650,8 @@ InternalPeiServicesInstallFvInfoPpi (
//
FvInfoPpi = AllocateZeroPool (sizeof (EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI));
ASSERT (FvInfoPpi != NULL);
- ((EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI *) FvInfoPpi)->AuthenticationStatus = AuthenticationStatus;
- PpiGuid = &gEfiPeiFirmwareVolumeInfo2PpiGuid;
+ ((EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI *)FvInfoPpi)->AuthenticationStatus = AuthenticationStatus;
+ PpiGuid = &gEfiPeiFirmwareVolumeInfo2PpiGuid;
}
if (FvFormat != NULL) {
@@ -669,15 +667,17 @@ InternalPeiServicesInstallFvInfoPpi (
// ((EFI_FIRMWARE_VOLUME_HEADER *) FvInfo)->FileSystemGuid can be just used for both
// firmware file system 2 and 3 format.
//
- ASSERT (CompareGuid (&(((EFI_FIRMWARE_VOLUME_HEADER *) FvInfo)->FileSystemGuid), &gEfiFirmwareFileSystem2Guid));
+ ASSERT (CompareGuid (&(((EFI_FIRMWARE_VOLUME_HEADER *)FvInfo)->FileSystemGuid), &gEfiFirmwareFileSystem2Guid));
}
- FvInfoPpi->FvInfo = (VOID *) FvInfo;
+
+ FvInfoPpi->FvInfo = (VOID *)FvInfo;
FvInfoPpi->FvInfoSize = FvInfoSize;
if (ParentFvName != NULL) {
ParentFvNameValue = AllocateCopyPool (sizeof (EFI_GUID), ParentFvName);
ASSERT (ParentFvNameValue != NULL);
FvInfoPpi->ParentFvName = ParentFvNameValue;
}
+
if (ParentFileName != NULL) {
ParentFileNameValue = AllocateCopyPool (sizeof (EFI_GUID), ParentFileName);
ASSERT (ParentFileNameValue != NULL);
@@ -689,10 +689,9 @@ InternalPeiServicesInstallFvInfoPpi (
FvInfoPpiDescriptor->Guid = PpiGuid;
FvInfoPpiDescriptor->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
- FvInfoPpiDescriptor->Ppi = (VOID *) FvInfoPpi;
- Status = PeiServicesInstallPpi (FvInfoPpiDescriptor);
+ FvInfoPpiDescriptor->Ppi = (VOID *)FvInfoPpi;
+ Status = PeiServicesInstallPpi (FvInfoPpiDescriptor);
ASSERT_EFI_ERROR (Status);
-
}
/**
@@ -728,11 +727,11 @@ InternalPeiServicesInstallFvInfoPpi (
VOID
EFIAPI
PeiServicesInstallFvInfoPpi (
- IN CONST EFI_GUID *FvFormat OPTIONAL,
- IN CONST VOID *FvInfo,
- IN UINT32 FvInfoSize,
- IN CONST EFI_GUID *ParentFvName OPTIONAL,
- IN CONST EFI_GUID *ParentFileName OPTIONAL
+ IN CONST EFI_GUID *FvFormat OPTIONAL,
+ IN CONST VOID *FvInfo,
+ IN UINT32 FvInfoSize,
+ IN CONST EFI_GUID *ParentFvName OPTIONAL,
+ IN CONST EFI_GUID *ParentFileName OPTIONAL
)
{
InternalPeiServicesInstallFvInfoPpi (TRUE, FvFormat, FvInfo, FvInfoSize, ParentFvName, ParentFileName, 0);
@@ -772,12 +771,12 @@ PeiServicesInstallFvInfoPpi (
VOID
EFIAPI
PeiServicesInstallFvInfo2Ppi (
- IN CONST EFI_GUID *FvFormat OPTIONAL,
- IN CONST VOID *FvInfo,
- IN UINT32 FvInfoSize,
- IN CONST EFI_GUID *ParentFvName OPTIONAL,
- IN CONST EFI_GUID *ParentFileName OPTIONAL,
- IN UINT32 AuthenticationStatus
+ IN CONST EFI_GUID *FvFormat OPTIONAL,
+ IN CONST VOID *FvInfo,
+ IN UINT32 FvInfoSize,
+ IN CONST EFI_GUID *ParentFvName OPTIONAL,
+ IN CONST EFI_GUID *ParentFileName OPTIONAL,
+ IN UINT32 AuthenticationStatus
)
{
InternalPeiServicesInstallFvInfoPpi (FALSE, FvFormat, FvInfo, FvInfoSize, ParentFvName, ParentFileName, AuthenticationStatus);
@@ -799,11 +798,11 @@ PeiServicesInstallFvInfo2Ppi (
VOID
EFIAPI
PeiServicesResetSystem2 (
- IN EFI_RESET_TYPE ResetType,
- IN EFI_STATUS ResetStatus,
- IN UINTN DataSize,
- IN VOID *ResetData OPTIONAL
+ IN EFI_RESET_TYPE ResetType,
+ IN EFI_STATUS ResetStatus,
+ IN UINTN DataSize,
+ IN VOID *ResetData OPTIONAL
)
{
- (*GetPeiServicesTablePointer())->ResetSystem2 (ResetType, ResetStatus, DataSize, ResetData);
+ (*GetPeiServicesTablePointer ())->ResetSystem2 (ResetType, ResetStatus, DataSize, ResetData);
}
diff --git a/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c b/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c
index 831564d71d..04c283f4a6 100644
--- a/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c
+++ b/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c
@@ -29,7 +29,7 @@ CONST EFI_PEI_SERVICES **gPeiServices;
VOID
EFIAPI
SetPeiServicesTablePointer (
- IN CONST EFI_PEI_SERVICES ** PeiServicesTablePointer
+ IN CONST EFI_PEI_SERVICES **PeiServicesTablePointer
)
{
ASSERT (PeiServicesTablePointer != NULL);
@@ -58,7 +58,6 @@ GetPeiServicesTablePointer (
return gPeiServices;
}
-
/**
The constructor function caches the pointer to PEI services.
@@ -74,8 +73,8 @@ GetPeiServicesTablePointer (
EFI_STATUS
EFIAPI
PeiServicesTablePointerLibConstructor (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
+ IN EFI_PEI_FILE_HANDLE FileHandle,
+ IN CONST EFI_PEI_SERVICES **PeiServices
)
{
gPeiServices = PeiServices;
diff --git a/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointer.c b/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointer.c
index dac31c9985..df12d36fc6 100644
--- a/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointer.c
+++ b/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointer.c
@@ -35,10 +35,10 @@ GetPeiServicesTablePointer (
)
{
CONST EFI_PEI_SERVICES **PeiServices;
- IA32_DESCRIPTOR Idtr;
+ IA32_DESCRIPTOR Idtr;
AsmReadIdtr (&Idtr);
- PeiServices = (CONST EFI_PEI_SERVICES **) (*(UINTN*)(Idtr.Base - sizeof (UINTN)));
+ PeiServices = (CONST EFI_PEI_SERVICES **)(*(UINTN *)(Idtr.Base - sizeof (UINTN)));
ASSERT (PeiServices != NULL);
return PeiServices;
}
@@ -59,14 +59,14 @@ GetPeiServicesTablePointer (
VOID
EFIAPI
SetPeiServicesTablePointer (
- IN CONST EFI_PEI_SERVICES ** PeiServicesTablePointer
+ IN CONST EFI_PEI_SERVICES **PeiServicesTablePointer
)
{
- IA32_DESCRIPTOR Idtr;
+ IA32_DESCRIPTOR Idtr;
ASSERT (PeiServicesTablePointer != NULL);
AsmReadIdtr (&Idtr);
- (*(UINTN*)(Idtr.Base - sizeof (UINTN))) = (UINTN)PeiServicesTablePointer;
+ (*(UINTN *)(Idtr.Base - sizeof (UINTN))) = (UINTN)PeiServicesTablePointer;
}
/**
@@ -91,35 +91,33 @@ MigratePeiServicesTablePointer (
VOID
)
{
- EFI_STATUS Status;
- IA32_DESCRIPTOR Idtr;
- EFI_PHYSICAL_ADDRESS IdtBase;
+ EFI_STATUS Status;
+ IA32_DESCRIPTOR Idtr;
+ EFI_PHYSICAL_ADDRESS IdtBase;
CONST EFI_PEI_SERVICES **PeiServices;
//
// Get PEI Services Table pointer
//
AsmReadIdtr (&Idtr);
- PeiServices = (CONST EFI_PEI_SERVICES **) (*(UINTN*)(Idtr.Base - sizeof (UINTN)));
+ PeiServices = (CONST EFI_PEI_SERVICES **)(*(UINTN *)(Idtr.Base - sizeof (UINTN)));
ASSERT (PeiServices != NULL);
//
// Allocate the permanent memory.
//
Status = (*PeiServices)->AllocatePages (
- PeiServices,
- EfiBootServicesCode,
- EFI_SIZE_TO_PAGES(Idtr.Limit + 1 + sizeof (UINTN)),
- &IdtBase
- );
+ PeiServices,
+ EfiBootServicesCode,
+ EFI_SIZE_TO_PAGES (Idtr.Limit + 1 + sizeof (UINTN)),
+ &IdtBase
+ );
ASSERT_EFI_ERROR (Status);
//
// Idt table needs to be migrated into memory.
//
- CopyMem ((VOID *) (UINTN) IdtBase, (VOID *) (Idtr.Base - sizeof (UINTN)), Idtr.Limit + 1 + sizeof (UINTN));
- Idtr.Base = (UINTN) IdtBase + sizeof (UINTN);
+ CopyMem ((VOID *)(UINTN)IdtBase, (VOID *)(Idtr.Base - sizeof (UINTN)), Idtr.Limit + 1 + sizeof (UINTN));
+ Idtr.Base = (UINTN)IdtBase + sizeof (UINTN);
AsmWriteIdtr (&Idtr);
return;
}
-
-
diff --git a/MdePkg/Library/PeiSmbusLibSmbus2Ppi/InternalSmbusLib.h b/MdePkg/Library/PeiSmbusLibSmbus2Ppi/InternalSmbusLib.h
index 1eb6bbe92c..b5052b8a61 100644
--- a/MdePkg/Library/PeiSmbusLibSmbus2Ppi/InternalSmbusLib.h
+++ b/MdePkg/Library/PeiSmbusLibSmbus2Ppi/InternalSmbusLib.h
@@ -10,7 +10,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#ifndef __INTERNAL_SMBUS_LIB_H_
#define __INTERNAL_SMBUS_LIB_H_
-
#include <PiPei.h>
#include <Ppi/Smbus2.h>
@@ -64,11 +63,11 @@ InternalGetSmbusPpi (
**/
UINTN
InternalSmBusExec (
- IN EFI_SMBUS_OPERATION SmbusOperation,
- IN UINTN SmBusAddress,
- IN UINTN Length,
- IN OUT VOID *Buffer,
- OUT RETURN_STATUS *Status OPTIONAL
+ IN EFI_SMBUS_OPERATION SmbusOperation,
+ IN UINTN SmBusAddress,
+ IN UINTN Length,
+ IN OUT VOID *Buffer,
+ OUT RETURN_STATUS *Status OPTIONAL
);
#endif
diff --git a/MdePkg/Library/PeiSmbusLibSmbus2Ppi/PeiSmbusLib.c b/MdePkg/Library/PeiSmbusLibSmbus2Ppi/PeiSmbusLib.c
index 06a5f67e25..adcef6bcfa 100644
--- a/MdePkg/Library/PeiSmbusLibSmbus2Ppi/PeiSmbusLib.c
+++ b/MdePkg/Library/PeiSmbusLibSmbus2Ppi/PeiSmbusLib.c
@@ -23,10 +23,10 @@ InternalGetSmbusPpi (
VOID
)
{
- EFI_STATUS Status;
- EFI_PEI_SMBUS2_PPI *SmbusPpi;
+ EFI_STATUS Status;
+ EFI_PEI_SMBUS2_PPI *SmbusPpi;
- Status = PeiServicesLocatePpi (&gEfiPeiSmbus2PpiGuid, 0, NULL, (VOID **) &SmbusPpi);
+ Status = PeiServicesLocatePpi (&gEfiPeiSmbus2PpiGuid, 0, NULL, (VOID **)&SmbusPpi);
ASSERT_EFI_ERROR (Status);
ASSERT (SmbusPpi != NULL);
@@ -58,18 +58,18 @@ InternalGetSmbusPpi (
**/
UINTN
InternalSmBusExec (
- IN EFI_SMBUS_OPERATION SmbusOperation,
- IN UINTN SmBusAddress,
- IN UINTN Length,
- IN OUT VOID *Buffer,
- OUT RETURN_STATUS *Status OPTIONAL
+ IN EFI_SMBUS_OPERATION SmbusOperation,
+ IN UINTN SmBusAddress,
+ IN UINTN Length,
+ IN OUT VOID *Buffer,
+ OUT RETURN_STATUS *Status OPTIONAL
)
{
EFI_PEI_SMBUS2_PPI *SmbusPpi;
RETURN_STATUS ReturnStatus;
EFI_SMBUS_DEVICE_ADDRESS SmbusDeviceAddress;
- SmbusPpi = InternalGetSmbusPpi ();
+ SmbusPpi = InternalGetSmbusPpi ();
SmbusDeviceAddress.SmbusDeviceAddress = SMBUS_LIB_SLAVE_ADDRESS (SmBusAddress);
ReturnStatus = SmbusPpi->Execute (
diff --git a/MdePkg/Library/PeiSmbusLibSmbus2Ppi/SmbusLib.c b/MdePkg/Library/PeiSmbusLibSmbus2Ppi/SmbusLib.c
index d644583ba7..5b237ad089 100644
--- a/MdePkg/Library/PeiSmbusLibSmbus2Ppi/SmbusLib.c
+++ b/MdePkg/Library/PeiSmbusLibSmbus2Ppi/SmbusLib.c
@@ -38,8 +38,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
VOID
EFIAPI
SmBusQuickRead (
- IN UINTN SmBusAddress,
- OUT RETURN_STATUS *Status OPTIONAL
+ IN UINTN SmBusAddress,
+ OUT RETURN_STATUS *Status OPTIONAL
)
{
ASSERT (!SMBUS_LIB_PEC (SmBusAddress));
@@ -79,8 +79,8 @@ SmBusQuickRead (
VOID
EFIAPI
SmBusQuickWrite (
- IN UINTN SmBusAddress,
- OUT RETURN_STATUS *Status OPTIONAL
+ IN UINTN SmBusAddress,
+ OUT RETURN_STATUS *Status OPTIONAL
)
{
ASSERT (!SMBUS_LIB_PEC (SmBusAddress));
@@ -127,7 +127,7 @@ SmBusReceiveByte (
OUT RETURN_STATUS *Status OPTIONAL
)
{
- UINT8 Byte;
+ UINT8 Byte;
ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0);
ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
@@ -176,13 +176,13 @@ SmBusSendByte (
OUT RETURN_STATUS *Status OPTIONAL
)
{
- UINT8 Byte;
+ UINT8 Byte;
ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0);
ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
- Byte = Value;
+ Byte = Value;
InternalSmBusExec (EfiSmbusSendByte, SmBusAddress, 1, &Byte, Status);
return Value;
@@ -223,7 +223,7 @@ SmBusReadDataByte (
OUT RETURN_STATUS *Status OPTIONAL
)
{
- UINT8 Byte;
+ UINT8 Byte;
ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
@@ -271,7 +271,7 @@ SmBusWriteDataByte (
OUT RETURN_STATUS *Status OPTIONAL
)
{
- UINT8 Byte;
+ UINT8 Byte;
ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
@@ -561,7 +561,7 @@ SmBusBlockProcessCall (
OUT RETURN_STATUS *Status OPTIONAL
)
{
- UINTN Length;
+ UINTN Length;
ASSERT (WriteBuffer != NULL);
ASSERT (ReadBuffer != NULL);
diff --git a/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.c b/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.c
index 524c2aaf7d..42aab62f5d 100644
--- a/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.c
+++ b/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.c
@@ -6,10 +6,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-
#include <PiPei.h>
-
#include <Library/PeimEntryPoint.h>
#include <Library/DebugLib.h>
@@ -29,8 +27,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
EFI_STATUS
EFIAPI
_ModuleEntryPoint (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
+ IN EFI_PEI_FILE_HANDLE FileHandle,
+ IN CONST EFI_PEI_SERVICES **PeiServices
)
{
if (_gPeimRevision != 0) {
@@ -51,7 +49,6 @@ _ModuleEntryPoint (
return ProcessModuleEntryPointList (FileHandle, PeiServices);
}
-
/**
Required by the EBC compiler and identical in functionality to _ModuleEntryPoint().
@@ -67,8 +64,8 @@ _ModuleEntryPoint (
EFI_STATUS
EFIAPI
EfiMain (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
+ IN EFI_PEI_FILE_HANDLE FileHandle,
+ IN CONST EFI_PEI_SERVICES **PeiServices
)
{
return _ModuleEntryPoint (FileHandle, PeiServices);
diff --git a/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.c b/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.c
index 7150f1ed5f..24dc510135 100644
--- a/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.c
+++ b/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.c
@@ -81,13 +81,13 @@ FilterBeforeIoWrite (
return TRUE;
}
- /**
- Trace IO Write operation after wirte IO port.
- It is used to trace IO operation.
+/**
+Trace IO Write operation after wirte IO port.
+It is used to trace IO operation.
- @param[in] Width Signifies the width of the I/O operation.
- @param[in] Address The base address of the I/O operation.
- @param[in] Buffer The source buffer from which to Write data.
+@param[in] Width Signifies the width of the I/O operation.
+@param[in] Address The base address of the I/O operation.
+@param[in] Buffer The source buffer from which to Write data.
**/
VOID
@@ -205,8 +205,8 @@ FilterAfterMmIoWrite (
BOOLEAN
EFIAPI
FilterBeforeMsrRead (
- IN UINT32 Index,
- IN OUT UINT64 *Value
+ IN UINT32 Index,
+ IN OUT UINT64 *Value
)
{
return TRUE;
@@ -222,8 +222,8 @@ FilterBeforeMsrRead (
VOID
EFIAPI
FilterAfterMsrRead (
- IN UINT32 Index,
- IN UINT64 *Value
+ IN UINT32 Index,
+ IN UINT64 *Value
)
{
return;
@@ -245,8 +245,8 @@ FilterAfterMsrRead (
BOOLEAN
EFIAPI
FilterBeforeMsrWrite (
- IN UINT32 Index,
- IN UINT64 *Value
+ IN UINT32 Index,
+ IN UINT64 *Value
)
{
return TRUE;
@@ -262,10 +262,9 @@ FilterBeforeMsrWrite (
VOID
EFIAPI
FilterAfterMsrWrite (
- IN UINT32 Index,
- IN UINT64 *Value
+ IN UINT32 Index,
+ IN UINT64 *Value
)
{
return;
}
-
diff --git a/MdePkg/Library/SecPeiDxeTimerLibCpu/X86TimerLib.c b/MdePkg/Library/SecPeiDxeTimerLibCpu/X86TimerLib.c
index 9f61d4d32a..c60589607f 100644
--- a/MdePkg/Library/SecPeiDxeTimerLibCpu/X86TimerLib.c
+++ b/MdePkg/Library/SecPeiDxeTimerLibCpu/X86TimerLib.c
@@ -13,18 +13,18 @@
#include <Library/PcdLib.h>
#include <Library/DebugLib.h>
-#define APIC_SVR 0x0f0
-#define APIC_LVTERR 0x370
-#define APIC_TMICT 0x380
-#define APIC_TMCCT 0x390
-#define APIC_TDCR 0x3e0
+#define APIC_SVR 0x0f0
+#define APIC_LVTERR 0x370
+#define APIC_TMICT 0x380
+#define APIC_TMCCT 0x390
+#define APIC_TDCR 0x3e0
//
// The following array is used in calculating the frequency of local APIC
// timer. Refer to IA-32 developers' manual for more details.
//
GLOBAL_REMOVE_IF_UNREFERENCED
-CONST UINT8 mTimerLibLocalApicDivisor[] = {
+CONST UINT8 mTimerLibLocalApicDivisor[] = {
0x02, 0x04, 0x08, 0x10,
0x02, 0x04, 0x08, 0x10,
0x20, 0x40, 0x80, 0x01,
@@ -48,10 +48,10 @@ InternalX86GetApicBase (
VOID
)
{
- UINTN MsrValue;
- UINTN ApicBase;
+ UINTN MsrValue;
+ UINTN ApicBase;
- MsrValue = (UINTN) AsmReadMsr64 (27);
+ MsrValue = (UINTN)AsmReadMsr64 (27);
ApicBase = MsrValue & 0xffffff000ULL;
//
@@ -87,11 +87,11 @@ InternalX86GetApicBase (
UINT32
EFIAPI
InternalX86GetTimerFrequency (
- IN UINTN ApicBase
+ IN UINTN ApicBase
)
{
return
- PcdGet32(PcdFSBClock) /
+ PcdGet32 (PcdFSBClock) /
mTimerLibLocalApicDivisor[MmioBitFieldRead32 (ApicBase + APIC_TDCR, 0, 3)];
}
@@ -106,7 +106,7 @@ InternalX86GetTimerFrequency (
INT32
EFIAPI
InternalX86GetTimerTick (
- IN UINTN ApicBase
+ IN UINTN ApicBase
)
{
return MmioRead32 (ApicBase + APIC_TMCCT);
@@ -122,7 +122,7 @@ InternalX86GetTimerTick (
**/
UINT32
InternalX86GetInitTimerCount (
- IN UINTN ApicBase
+ IN UINTN ApicBase
)
{
return MmioRead32 (ApicBase + APIC_TMICT);
@@ -144,14 +144,14 @@ InternalX86GetInitTimerCount (
VOID
EFIAPI
InternalX86Delay (
- IN UINTN ApicBase,
- IN UINT32 Delay
+ IN UINTN ApicBase,
+ IN UINT32 Delay
)
{
- INT32 Ticks;
- UINT32 Times;
- UINT32 InitCount;
- UINT32 StartTick;
+ INT32 Ticks;
+ UINT32 Times;
+ UINT32 InitCount;
+ UINT32 StartTick;
//
// In case Delay is too larger, separate it into several small delay slot.
@@ -162,13 +162,13 @@ InternalX86Delay (
//
InitCount = InternalX86GetInitTimerCount (ApicBase);
ASSERT (InitCount != 0);
- Times = Delay / (InitCount / 2);
- Delay = Delay % (InitCount / 2);
+ Times = Delay / (InitCount / 2);
+ Delay = Delay % (InitCount / 2);
//
// Get Start Tick and do delay
//
- StartTick = InternalX86GetTimerTick (ApicBase);
+ StartTick = InternalX86GetTimerTick (ApicBase);
do {
//
// Wait until time out by Delay value
@@ -208,10 +208,10 @@ InternalX86Delay (
UINTN
EFIAPI
MicroSecondDelay (
- IN UINTN MicroSeconds
+ IN UINTN MicroSeconds
)
{
- UINTN ApicBase;
+ UINTN ApicBase;
ApicBase = InternalX86GetApicBase ();
InternalX86Delay (
@@ -240,10 +240,10 @@ MicroSecondDelay (
UINTN
EFIAPI
NanoSecondDelay (
- IN UINTN NanoSeconds
+ IN UINTN NanoSeconds
)
{
- UINTN ApicBase;
+ UINTN ApicBase;
ApicBase = InternalX86GetApicBase ();
InternalX86Delay (
@@ -305,11 +305,11 @@ GetPerformanceCounter (
UINT64
EFIAPI
GetPerformanceCounterProperties (
- OUT UINT64 *StartValue OPTIONAL,
- OUT UINT64 *EndValue OPTIONAL
+ OUT UINT64 *StartValue OPTIONAL,
+ OUT UINT64 *EndValue OPTIONAL
)
{
- UINTN ApicBase;
+ UINTN ApicBase;
ApicBase = InternalX86GetApicBase ();
@@ -321,7 +321,7 @@ GetPerformanceCounterProperties (
*EndValue = 0;
}
- return (UINT64) InternalX86GetTimerFrequency (ApicBase);
+ return (UINT64)InternalX86GetTimerFrequency (ApicBase);
}
/**
@@ -338,7 +338,7 @@ GetPerformanceCounterProperties (
UINT64
EFIAPI
GetTimeInNanoSecond (
- IN UINT64 Ticks
+ IN UINT64 Ticks
)
{
UINT64 Frequency;
@@ -360,9 +360,9 @@ GetTimeInNanoSecond (
// Since 2^29 < 1,000,000,000 = 0x3B9ACA00 < 2^30, Remainder should < 2^(64-30) = 2^34,
// i.e. highest bit set in Remainder should <= 33.
//
- Shift = MAX (0, HighBitSet64 (Remainder) - 33);
- Remainder = RShiftU64 (Remainder, (UINTN) Shift);
- Frequency = RShiftU64 (Frequency, (UINTN) Shift);
+ Shift = MAX (0, HighBitSet64 (Remainder) - 33);
+ Remainder = RShiftU64 (Remainder, (UINTN)Shift);
+ Frequency = RShiftU64 (Frequency, (UINTN)Shift);
NanoSeconds += DivU64x64Remainder (MultU64x32 (Remainder, 1000000000u), Frequency, NULL);
return NanoSeconds;
diff --git a/MdePkg/Library/SmiHandlerProfileLibNull/SmiHandlerProfileLibNull.c b/MdePkg/Library/SmiHandlerProfileLibNull/SmiHandlerProfileLibNull.c
index 87559a4d6d..b7a5c96c7f 100644
--- a/MdePkg/Library/SmiHandlerProfileLibNull/SmiHandlerProfileLibNull.c
+++ b/MdePkg/Library/SmiHandlerProfileLibNull/SmiHandlerProfileLibNull.c
@@ -32,11 +32,11 @@
EFI_STATUS
EFIAPI
SmiHandlerProfileRegisterHandler (
- IN EFI_GUID *HandlerGuid,
- IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,
- IN PHYSICAL_ADDRESS CallerAddress,
- IN VOID *Context OPTIONAL,
- IN UINTN ContextSize OPTIONAL
+ IN EFI_GUID *HandlerGuid,
+ IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,
+ IN PHYSICAL_ADDRESS CallerAddress,
+ IN VOID *Context OPTIONAL,
+ IN UINTN ContextSize OPTIONAL
)
{
return EFI_UNSUPPORTED;
@@ -62,10 +62,10 @@ SmiHandlerProfileRegisterHandler (
EFI_STATUS
EFIAPI
SmiHandlerProfileUnregisterHandler (
- IN EFI_GUID *HandlerGuid,
- IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,
- IN VOID *Context OPTIONAL,
- IN UINTN ContextSize OPTIONAL
+ IN EFI_GUID *HandlerGuid,
+ IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,
+ IN VOID *Context OPTIONAL,
+ IN UINTN ContextSize OPTIONAL
)
{
return EFI_UNSUPPORTED;
diff --git a/MdePkg/Library/SmmIoLib/SmmIoLib.c b/MdePkg/Library/SmmIoLib/SmmIoLib.c
index 31b1bb3ec2..ad4bfff68c 100644
--- a/MdePkg/Library/SmmIoLib/SmmIoLib.c
+++ b/MdePkg/Library/SmmIoLib/SmmIoLib.c
@@ -10,7 +10,6 @@
**/
-
#include <PiSmm.h>
#include <Library/BaseLib.h>
@@ -24,15 +23,15 @@
#include <Protocol/SmmReadyToLock.h>
#include <Protocol/SmmEndOfDxe.h>
-EFI_GCD_MEMORY_SPACE_DESCRIPTOR *mSmmIoLibGcdMemSpace = NULL;
-UINTN mSmmIoLibGcdMemNumberOfDesc = 0;
+EFI_GCD_MEMORY_SPACE_DESCRIPTOR *mSmmIoLibGcdMemSpace = NULL;
+UINTN mSmmIoLibGcdMemNumberOfDesc = 0;
EFI_PHYSICAL_ADDRESS mSmmIoLibInternalMaximumSupportMemAddress = 0;
-VOID *mSmmIoLibRegistrationEndOfDxe;
-VOID *mSmmIoLibRegistrationReadyToLock;
+VOID *mSmmIoLibRegistrationEndOfDxe;
+VOID *mSmmIoLibRegistrationReadyToLock;
-BOOLEAN mSmmIoLibReadyToLock = FALSE;
+BOOLEAN mSmmIoLibReadyToLock = FALSE;
/**
Calculate and save the maximum support address.
@@ -43,25 +42,26 @@ SmmIoLibInternalCalculateMaximumSupportAddress (
VOID
)
{
- VOID *Hob;
- UINT32 RegEax;
- UINT8 MemPhysicalAddressBits;
+ VOID *Hob;
+ UINT32 RegEax;
+ UINT8 MemPhysicalAddressBits;
//
// Get physical address bits supported.
//
Hob = GetFirstHob (EFI_HOB_TYPE_CPU);
if (Hob != NULL) {
- MemPhysicalAddressBits = ((EFI_HOB_CPU *) Hob)->SizeOfMemorySpace;
+ MemPhysicalAddressBits = ((EFI_HOB_CPU *)Hob)->SizeOfMemorySpace;
} else {
AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);
if (RegEax >= 0x80000008) {
AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL);
- MemPhysicalAddressBits = (UINT8) RegEax;
+ MemPhysicalAddressBits = (UINT8)RegEax;
} else {
MemPhysicalAddressBits = 36;
}
}
+
//
// IA-32e paging translates 48-bit linear addresses to 52-bit physical addresses.
//
@@ -98,9 +98,9 @@ SmmIsMmioValid (
IN EFI_GUID *Owner OPTIONAL
)
{
- UINTN Index;
- EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Desc;
- BOOLEAN InValidRegion;
+ UINTN Index;
+ EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Desc;
+ BOOLEAN InValidRegion;
//
// Check override.
@@ -108,7 +108,8 @@ SmmIsMmioValid (
//
if ((Length > mSmmIoLibInternalMaximumSupportMemAddress) ||
(BaseAddress > mSmmIoLibInternalMaximumSupportMemAddress) ||
- ((Length != 0) && (BaseAddress > (mSmmIoLibInternalMaximumSupportMemAddress - (Length - 1)))) ) {
+ ((Length != 0) && (BaseAddress > (mSmmIoLibInternalMaximumSupportMemAddress - (Length - 1)))))
+ {
//
// Overflow happen
//
@@ -127,11 +128,12 @@ SmmIsMmioValid (
//
if (mSmmIoLibReadyToLock) {
InValidRegion = FALSE;
- for (Index = 0; Index < mSmmIoLibGcdMemNumberOfDesc; Index ++) {
+ for (Index = 0; Index < mSmmIoLibGcdMemNumberOfDesc; Index++) {
Desc = &mSmmIoLibGcdMemSpace[Index];
if ((Desc->GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo) &&
(BaseAddress >= Desc->BaseAddress) &&
- ((BaseAddress + Length) <= (Desc->BaseAddress + Desc->Length))) {
+ ((BaseAddress + Length) <= (Desc->BaseAddress + Desc->Length)))
+ {
InValidRegion = TRUE;
}
}
@@ -146,6 +148,7 @@ SmmIsMmioValid (
return FALSE;
}
}
+
return TRUE;
}
@@ -166,22 +169,23 @@ MergeGcdMmioEntry (
IN OUT UINTN *NumberOfDescriptors
)
{
- EFI_GCD_MEMORY_SPACE_DESCRIPTOR *GcdMemoryMapEntry;
- EFI_GCD_MEMORY_SPACE_DESCRIPTOR *GcdMemoryMapEnd;
- EFI_GCD_MEMORY_SPACE_DESCRIPTOR *NewGcdMemoryMapEntry;
- EFI_GCD_MEMORY_SPACE_DESCRIPTOR *NextGcdMemoryMapEntry;
+ EFI_GCD_MEMORY_SPACE_DESCRIPTOR *GcdMemoryMapEntry;
+ EFI_GCD_MEMORY_SPACE_DESCRIPTOR *GcdMemoryMapEnd;
+ EFI_GCD_MEMORY_SPACE_DESCRIPTOR *NewGcdMemoryMapEntry;
+ EFI_GCD_MEMORY_SPACE_DESCRIPTOR *NextGcdMemoryMapEntry;
- GcdMemoryMapEntry = GcdMemoryMap;
+ GcdMemoryMapEntry = GcdMemoryMap;
NewGcdMemoryMapEntry = GcdMemoryMap;
- GcdMemoryMapEnd = (EFI_GCD_MEMORY_SPACE_DESCRIPTOR *) ((UINT8 *) GcdMemoryMap + (*NumberOfDescriptors) * sizeof(EFI_GCD_MEMORY_SPACE_DESCRIPTOR));
+ GcdMemoryMapEnd = (EFI_GCD_MEMORY_SPACE_DESCRIPTOR *)((UINT8 *)GcdMemoryMap + (*NumberOfDescriptors) * sizeof (EFI_GCD_MEMORY_SPACE_DESCRIPTOR));
while ((UINTN)GcdMemoryMapEntry < (UINTN)GcdMemoryMapEnd) {
- CopyMem (NewGcdMemoryMapEntry, GcdMemoryMapEntry, sizeof(EFI_GCD_MEMORY_SPACE_DESCRIPTOR));
+ CopyMem (NewGcdMemoryMapEntry, GcdMemoryMapEntry, sizeof (EFI_GCD_MEMORY_SPACE_DESCRIPTOR));
NextGcdMemoryMapEntry = GcdMemoryMapEntry + 1;
do {
if (((UINTN)NextGcdMemoryMapEntry < (UINTN)GcdMemoryMapEnd) &&
(GcdMemoryMapEntry->GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo) && (NextGcdMemoryMapEntry->GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo) &&
- ((GcdMemoryMapEntry->BaseAddress + GcdMemoryMapEntry->Length) == NextGcdMemoryMapEntry->BaseAddress)) {
+ ((GcdMemoryMapEntry->BaseAddress + GcdMemoryMapEntry->Length) == NextGcdMemoryMapEntry->BaseAddress))
+ {
GcdMemoryMapEntry->Length += NextGcdMemoryMapEntry->Length;
if (NewGcdMemoryMapEntry != GcdMemoryMapEntry) {
NewGcdMemoryMapEntry->Length += NextGcdMemoryMapEntry->Length;
@@ -195,13 +199,13 @@ MergeGcdMmioEntry (
}
} while (TRUE);
- GcdMemoryMapEntry = GcdMemoryMapEntry + 1;
+ GcdMemoryMapEntry = GcdMemoryMapEntry + 1;
NewGcdMemoryMapEntry = NewGcdMemoryMapEntry + 1;
}
- *NumberOfDescriptors = ((UINTN)NewGcdMemoryMapEntry - (UINTN)GcdMemoryMap) / sizeof(EFI_GCD_MEMORY_SPACE_DESCRIPTOR);
+ *NumberOfDescriptors = ((UINTN)NewGcdMemoryMapEntry - (UINTN)GcdMemoryMap) / sizeof (EFI_GCD_MEMORY_SPACE_DESCRIPTOR);
- return ;
+ return;
}
/**
@@ -228,7 +232,6 @@ SmmIoLibInternalEndOfDxeNotify (
Status = gDS->GetMemorySpaceMap (&NumberOfDescriptors, &MemSpaceMap);
if (!EFI_ERROR (Status)) {
-
MergeGcdMmioEntry (MemSpaceMap, &NumberOfDescriptors);
mSmmIoLibGcdMemSpace = AllocateCopyPool (NumberOfDescriptors * sizeof (EFI_GCD_MEMORY_SPACE_DESCRIPTOR), MemSpaceMap);
@@ -282,7 +285,7 @@ SmmIoLibConstructor (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
//
// Calculate and save maximum support address
diff --git a/MdePkg/Library/SmmIoLibSmmCpuIo2/IoHighLevel.c b/MdePkg/Library/SmmIoLibSmmCpuIo2/IoHighLevel.c
index 9262c88dc8..501c97183e 100644
--- a/MdePkg/Library/SmmIoLibSmmCpuIo2/IoHighLevel.c
+++ b/MdePkg/Library/SmmIoLibSmmCpuIo2/IoHighLevel.c
@@ -38,11 +38,11 @@
UINT8
EFIAPI
IoOr8 (
- IN UINTN Port,
- IN UINT8 OrData
+ IN UINTN Port,
+ IN UINT8 OrData
)
{
- return IoWrite8 (Port, (UINT8) (IoRead8 (Port) | OrData));
+ return IoWrite8 (Port, (UINT8)(IoRead8 (Port) | OrData));
}
/**
@@ -66,11 +66,11 @@ IoOr8 (
UINT8
EFIAPI
IoAnd8 (
- IN UINTN Port,
- IN UINT8 AndData
+ IN UINTN Port,
+ IN UINT8 AndData
)
{
- return IoWrite8 (Port, (UINT8) (IoRead8 (Port) & AndData));
+ return IoWrite8 (Port, (UINT8)(IoRead8 (Port) & AndData));
}
/**
@@ -96,12 +96,12 @@ IoAnd8 (
UINT8
EFIAPI
IoAndThenOr8 (
- IN UINTN Port,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Port,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
- return IoWrite8 (Port, (UINT8) ((IoRead8 (Port) & AndData) | OrData));
+ return IoWrite8 (Port, (UINT8)((IoRead8 (Port) & AndData) | OrData));
}
/**
@@ -127,9 +127,9 @@ IoAndThenOr8 (
UINT8
EFIAPI
IoBitFieldRead8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead8 (IoRead8 (Port), StartBit, EndBit);
@@ -162,10 +162,10 @@ IoBitFieldRead8 (
UINT8
EFIAPI
IoBitFieldWrite8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
return IoWrite8 (
@@ -203,10 +203,10 @@ IoBitFieldWrite8 (
UINT8
EFIAPI
IoBitFieldOr8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
return IoWrite8 (
@@ -244,10 +244,10 @@ IoBitFieldOr8 (
UINT8
EFIAPI
IoBitFieldAnd8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
return IoWrite8 (
@@ -289,11 +289,11 @@ IoBitFieldAnd8 (
UINT8
EFIAPI
IoBitFieldAndThenOr8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
return IoWrite8 (
@@ -323,11 +323,11 @@ IoBitFieldAndThenOr8 (
UINT16
EFIAPI
IoOr16 (
- IN UINTN Port,
- IN UINT16 OrData
+ IN UINTN Port,
+ IN UINT16 OrData
)
{
- return IoWrite16 (Port, (UINT16) (IoRead16 (Port) | OrData));
+ return IoWrite16 (Port, (UINT16)(IoRead16 (Port) | OrData));
}
/**
@@ -351,11 +351,11 @@ IoOr16 (
UINT16
EFIAPI
IoAnd16 (
- IN UINTN Port,
- IN UINT16 AndData
+ IN UINTN Port,
+ IN UINT16 AndData
)
{
- return IoWrite16 (Port, (UINT16) (IoRead16 (Port) & AndData));
+ return IoWrite16 (Port, (UINT16)(IoRead16 (Port) & AndData));
}
/**
@@ -381,12 +381,12 @@ IoAnd16 (
UINT16
EFIAPI
IoAndThenOr16 (
- IN UINTN Port,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Port,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
- return IoWrite16 (Port, (UINT16) ((IoRead16 (Port) & AndData) | OrData));
+ return IoWrite16 (Port, (UINT16)((IoRead16 (Port) & AndData) | OrData));
}
/**
@@ -412,9 +412,9 @@ IoAndThenOr16 (
UINT16
EFIAPI
IoBitFieldRead16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead16 (IoRead16 (Port), StartBit, EndBit);
@@ -447,10 +447,10 @@ IoBitFieldRead16 (
UINT16
EFIAPI
IoBitFieldWrite16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
return IoWrite16 (
@@ -488,10 +488,10 @@ IoBitFieldWrite16 (
UINT16
EFIAPI
IoBitFieldOr16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
return IoWrite16 (
@@ -529,10 +529,10 @@ IoBitFieldOr16 (
UINT16
EFIAPI
IoBitFieldAnd16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
return IoWrite16 (
@@ -574,11 +574,11 @@ IoBitFieldAnd16 (
UINT16
EFIAPI
IoBitFieldAndThenOr16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
return IoWrite16 (
@@ -608,8 +608,8 @@ IoBitFieldAndThenOr16 (
UINT32
EFIAPI
IoOr32 (
- IN UINTN Port,
- IN UINT32 OrData
+ IN UINTN Port,
+ IN UINT32 OrData
)
{
return IoWrite32 (Port, IoRead32 (Port) | OrData);
@@ -636,8 +636,8 @@ IoOr32 (
UINT32
EFIAPI
IoAnd32 (
- IN UINTN Port,
- IN UINT32 AndData
+ IN UINTN Port,
+ IN UINT32 AndData
)
{
return IoWrite32 (Port, IoRead32 (Port) & AndData);
@@ -666,9 +666,9 @@ IoAnd32 (
UINT32
EFIAPI
IoAndThenOr32 (
- IN UINTN Port,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Port,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return IoWrite32 (Port, (IoRead32 (Port) & AndData) | OrData);
@@ -697,9 +697,9 @@ IoAndThenOr32 (
UINT32
EFIAPI
IoBitFieldRead32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead32 (IoRead32 (Port), StartBit, EndBit);
@@ -732,10 +732,10 @@ IoBitFieldRead32 (
UINT32
EFIAPI
IoBitFieldWrite32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
return IoWrite32 (
@@ -773,10 +773,10 @@ IoBitFieldWrite32 (
UINT32
EFIAPI
IoBitFieldOr32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
return IoWrite32 (
@@ -814,10 +814,10 @@ IoBitFieldOr32 (
UINT32
EFIAPI
IoBitFieldAnd32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
return IoWrite32 (
@@ -859,11 +859,11 @@ IoBitFieldAnd32 (
UINT32
EFIAPI
IoBitFieldAndThenOr32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return IoWrite32 (
@@ -893,8 +893,8 @@ IoBitFieldAndThenOr32 (
UINT64
EFIAPI
IoOr64 (
- IN UINTN Port,
- IN UINT64 OrData
+ IN UINTN Port,
+ IN UINT64 OrData
)
{
return IoWrite64 (Port, IoRead64 (Port) | OrData);
@@ -921,8 +921,8 @@ IoOr64 (
UINT64
EFIAPI
IoAnd64 (
- IN UINTN Port,
- IN UINT64 AndData
+ IN UINTN Port,
+ IN UINT64 AndData
)
{
return IoWrite64 (Port, IoRead64 (Port) & AndData);
@@ -951,9 +951,9 @@ IoAnd64 (
UINT64
EFIAPI
IoAndThenOr64 (
- IN UINTN Port,
- IN UINT64 AndData,
- IN UINT64 OrData
+ IN UINTN Port,
+ IN UINT64 AndData,
+ IN UINT64 OrData
)
{
return IoWrite64 (Port, (IoRead64 (Port) & AndData) | OrData);
@@ -982,9 +982,9 @@ IoAndThenOr64 (
UINT64
EFIAPI
IoBitFieldRead64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead64 (IoRead64 (Port), StartBit, EndBit);
@@ -1017,10 +1017,10 @@ IoBitFieldRead64 (
UINT64
EFIAPI
IoBitFieldWrite64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 Value
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 Value
)
{
return IoWrite64 (
@@ -1058,10 +1058,10 @@ IoBitFieldWrite64 (
UINT64
EFIAPI
IoBitFieldOr64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 OrData
)
{
return IoWrite64 (
@@ -1099,10 +1099,10 @@ IoBitFieldOr64 (
UINT64
EFIAPI
IoBitFieldAnd64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData
)
{
return IoWrite64 (
@@ -1144,11 +1144,11 @@ IoBitFieldAnd64 (
UINT64
EFIAPI
IoBitFieldAndThenOr64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData,
- IN UINT64 OrData
+ IN UINTN Port,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData,
+ IN UINT64 OrData
)
{
return IoWrite64 (
@@ -1178,11 +1178,11 @@ IoBitFieldAndThenOr64 (
UINT8
EFIAPI
MmioOr8 (
- IN UINTN Address,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 OrData
)
{
- return MmioWrite8 (Address, (UINT8) (MmioRead8 (Address) | OrData));
+ return MmioWrite8 (Address, (UINT8)(MmioRead8 (Address) | OrData));
}
/**
@@ -1206,11 +1206,11 @@ MmioOr8 (
UINT8
EFIAPI
MmioAnd8 (
- IN UINTN Address,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINT8 AndData
)
{
- return MmioWrite8 (Address, (UINT8) (MmioRead8 (Address) & AndData));
+ return MmioWrite8 (Address, (UINT8)(MmioRead8 (Address) & AndData));
}
/**
@@ -1237,12 +1237,12 @@ MmioAnd8 (
UINT8
EFIAPI
MmioAndThenOr8 (
- IN UINTN Address,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
- return MmioWrite8 (Address, (UINT8) ((MmioRead8 (Address) & AndData) | OrData));
+ return MmioWrite8 (Address, (UINT8)((MmioRead8 (Address) & AndData) | OrData));
}
/**
@@ -1268,9 +1268,9 @@ MmioAndThenOr8 (
UINT8
EFIAPI
MmioBitFieldRead8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead8 (MmioRead8 (Address), StartBit, EndBit);
@@ -1302,10 +1302,10 @@ MmioBitFieldRead8 (
UINT8
EFIAPI
MmioBitFieldWrite8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
return MmioWrite8 (
@@ -1344,10 +1344,10 @@ MmioBitFieldWrite8 (
UINT8
EFIAPI
MmioBitFieldOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
return MmioWrite8 (
@@ -1386,10 +1386,10 @@ MmioBitFieldOr8 (
UINT8
EFIAPI
MmioBitFieldAnd8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
return MmioWrite8 (
@@ -1431,11 +1431,11 @@ MmioBitFieldAnd8 (
UINT8
EFIAPI
MmioBitFieldAndThenOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
return MmioWrite8 (
@@ -1465,11 +1465,11 @@ MmioBitFieldAndThenOr8 (
UINT16
EFIAPI
MmioOr16 (
- IN UINTN Address,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 OrData
)
{
- return MmioWrite16 (Address, (UINT16) (MmioRead16 (Address) | OrData));
+ return MmioWrite16 (Address, (UINT16)(MmioRead16 (Address) | OrData));
}
/**
@@ -1493,11 +1493,11 @@ MmioOr16 (
UINT16
EFIAPI
MmioAnd16 (
- IN UINTN Address,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINT16 AndData
)
{
- return MmioWrite16 (Address, (UINT16) (MmioRead16 (Address) & AndData));
+ return MmioWrite16 (Address, (UINT16)(MmioRead16 (Address) & AndData));
}
/**
@@ -1524,12 +1524,12 @@ MmioAnd16 (
UINT16
EFIAPI
MmioAndThenOr16 (
- IN UINTN Address,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
- return MmioWrite16 (Address, (UINT16) ((MmioRead16 (Address) & AndData) | OrData));
+ return MmioWrite16 (Address, (UINT16)((MmioRead16 (Address) & AndData) | OrData));
}
/**
@@ -1555,9 +1555,9 @@ MmioAndThenOr16 (
UINT16
EFIAPI
MmioBitFieldRead16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead16 (MmioRead16 (Address), StartBit, EndBit);
@@ -1589,10 +1589,10 @@ MmioBitFieldRead16 (
UINT16
EFIAPI
MmioBitFieldWrite16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
return MmioWrite16 (
@@ -1631,10 +1631,10 @@ MmioBitFieldWrite16 (
UINT16
EFIAPI
MmioBitFieldOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
return MmioWrite16 (
@@ -1673,10 +1673,10 @@ MmioBitFieldOr16 (
UINT16
EFIAPI
MmioBitFieldAnd16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
return MmioWrite16 (
@@ -1718,11 +1718,11 @@ MmioBitFieldAnd16 (
UINT16
EFIAPI
MmioBitFieldAndThenOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
return MmioWrite16 (
@@ -1752,8 +1752,8 @@ MmioBitFieldAndThenOr16 (
UINT32
EFIAPI
MmioOr32 (
- IN UINTN Address,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 OrData
)
{
return MmioWrite32 (Address, MmioRead32 (Address) | OrData);
@@ -1780,8 +1780,8 @@ MmioOr32 (
UINT32
EFIAPI
MmioAnd32 (
- IN UINTN Address,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINT32 AndData
)
{
return MmioWrite32 (Address, MmioRead32 (Address) & AndData);
@@ -1811,9 +1811,9 @@ MmioAnd32 (
UINT32
EFIAPI
MmioAndThenOr32 (
- IN UINTN Address,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return MmioWrite32 (Address, (MmioRead32 (Address) & AndData) | OrData);
@@ -1842,9 +1842,9 @@ MmioAndThenOr32 (
UINT32
EFIAPI
MmioBitFieldRead32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead32 (MmioRead32 (Address), StartBit, EndBit);
@@ -1876,10 +1876,10 @@ MmioBitFieldRead32 (
UINT32
EFIAPI
MmioBitFieldWrite32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
return MmioWrite32 (
@@ -1918,10 +1918,10 @@ MmioBitFieldWrite32 (
UINT32
EFIAPI
MmioBitFieldOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
return MmioWrite32 (
@@ -1960,10 +1960,10 @@ MmioBitFieldOr32 (
UINT32
EFIAPI
MmioBitFieldAnd32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
return MmioWrite32 (
@@ -2005,11 +2005,11 @@ MmioBitFieldAnd32 (
UINT32
EFIAPI
MmioBitFieldAndThenOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return MmioWrite32 (
@@ -2039,8 +2039,8 @@ MmioBitFieldAndThenOr32 (
UINT64
EFIAPI
MmioOr64 (
- IN UINTN Address,
- IN UINT64 OrData
+ IN UINTN Address,
+ IN UINT64 OrData
)
{
return MmioWrite64 (Address, MmioRead64 (Address) | OrData);
@@ -2067,8 +2067,8 @@ MmioOr64 (
UINT64
EFIAPI
MmioAnd64 (
- IN UINTN Address,
- IN UINT64 AndData
+ IN UINTN Address,
+ IN UINT64 AndData
)
{
return MmioWrite64 (Address, MmioRead64 (Address) & AndData);
@@ -2098,9 +2098,9 @@ MmioAnd64 (
UINT64
EFIAPI
MmioAndThenOr64 (
- IN UINTN Address,
- IN UINT64 AndData,
- IN UINT64 OrData
+ IN UINTN Address,
+ IN UINT64 AndData,
+ IN UINT64 OrData
)
{
return MmioWrite64 (Address, (MmioRead64 (Address) & AndData) | OrData);
@@ -2129,9 +2129,9 @@ MmioAndThenOr64 (
UINT64
EFIAPI
MmioBitFieldRead64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead64 (MmioRead64 (Address), StartBit, EndBit);
@@ -2163,10 +2163,10 @@ MmioBitFieldRead64 (
UINT64
EFIAPI
MmioBitFieldWrite64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 Value
)
{
return MmioWrite64 (
@@ -2205,10 +2205,10 @@ MmioBitFieldWrite64 (
UINT64
EFIAPI
MmioBitFieldOr64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 OrData
)
{
return MmioWrite64 (
@@ -2247,10 +2247,10 @@ MmioBitFieldOr64 (
UINT64
EFIAPI
MmioBitFieldAnd64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData
)
{
return MmioWrite64 (
@@ -2292,11 +2292,11 @@ MmioBitFieldAnd64 (
UINT64
EFIAPI
MmioBitFieldAndThenOr64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData,
- IN UINT64 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData,
+ IN UINT64 OrData
)
{
return MmioWrite64 (
diff --git a/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c b/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c
index 9163890b47..d73a699fb8 100644
--- a/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c
+++ b/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c
@@ -29,12 +29,12 @@
UINT64
EFIAPI
IoReadWorker (
- IN UINTN Port,
- IN EFI_SMM_IO_WIDTH Width
+ IN UINTN Port,
+ IN EFI_SMM_IO_WIDTH Width
)
{
- EFI_STATUS Status;
- UINT64 Data;
+ EFI_STATUS Status;
+ UINT64 Data;
Status = gSmst->SmmIo.Io.Read (&gSmst->SmmIo, Width, Port, 1, &Data);
ASSERT_EFI_ERROR (Status);
@@ -60,12 +60,12 @@ IoReadWorker (
UINT64
EFIAPI
IoWriteWorker (
- IN UINTN Port,
- IN EFI_SMM_IO_WIDTH Width,
- IN UINT64 Data
+ IN UINTN Port,
+ IN EFI_SMM_IO_WIDTH Width,
+ IN UINT64 Data
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
Status = gSmst->SmmIo.Io.Write (&gSmst->SmmIo, Width, Port, 1, &Data);
ASSERT_EFI_ERROR (Status);
@@ -90,12 +90,12 @@ IoWriteWorker (
UINT64
EFIAPI
MmioReadWorker (
- IN UINTN Address,
- IN EFI_SMM_IO_WIDTH Width
+ IN UINTN Address,
+ IN EFI_SMM_IO_WIDTH Width
)
{
- EFI_STATUS Status;
- UINT64 Data;
+ EFI_STATUS Status;
+ UINT64 Data;
Status = gSmst->SmmIo.Mem.Read (&gSmst->SmmIo, Width, Address, 1, &Data);
ASSERT_EFI_ERROR (Status);
@@ -121,12 +121,12 @@ MmioReadWorker (
UINT64
EFIAPI
MmioWriteWorker (
- IN UINTN Address,
- IN EFI_SMM_IO_WIDTH Width,
- IN UINT64 Data
+ IN UINTN Address,
+ IN EFI_SMM_IO_WIDTH Width,
+ IN UINT64 Data
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
Status = gSmst->SmmIo.Mem.Write (&gSmst->SmmIo, Width, Address, 1, &Data);
ASSERT_EFI_ERROR (Status);
@@ -151,7 +151,7 @@ MmioWriteWorker (
UINT8
EFIAPI
IoRead8 (
- IN UINTN Port
+ IN UINTN Port
)
{
return (UINT8)IoReadWorker (Port, SMM_IO_UINT8);
@@ -175,8 +175,8 @@ IoRead8 (
UINT8
EFIAPI
IoWrite8 (
- IN UINTN Port,
- IN UINT8 Value
+ IN UINTN Port,
+ IN UINT8 Value
)
{
return (UINT8)IoWriteWorker (Port, SMM_IO_UINT8, Value);
@@ -201,7 +201,7 @@ IoWrite8 (
UINT16
EFIAPI
IoRead16 (
- IN UINTN Port
+ IN UINTN Port
)
{
//
@@ -231,8 +231,8 @@ IoRead16 (
UINT16
EFIAPI
IoWrite16 (
- IN UINTN Port,
- IN UINT16 Value
+ IN UINTN Port,
+ IN UINT16 Value
)
{
//
@@ -261,7 +261,7 @@ IoWrite16 (
UINT32
EFIAPI
IoRead32 (
- IN UINTN Port
+ IN UINTN Port
)
{
//
@@ -291,8 +291,8 @@ IoRead32 (
UINT32
EFIAPI
IoWrite32 (
- IN UINTN Port,
- IN UINT32 Value
+ IN UINTN Port,
+ IN UINT32 Value
)
{
//
@@ -321,7 +321,7 @@ IoWrite32 (
UINT64
EFIAPI
IoRead64 (
- IN UINTN Port
+ IN UINTN Port
)
{
//
@@ -351,8 +351,8 @@ IoRead64 (
UINT64
EFIAPI
IoWrite64 (
- IN UINTN Port,
- IN UINT64 Value
+ IN UINTN Port,
+ IN UINT64 Value
)
{
//
@@ -382,12 +382,12 @@ IoWrite64 (
VOID
EFIAPI
IoReadFifo8 (
- IN UINTN Port,
- IN UINTN Count,
- OUT VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ OUT VOID *Buffer
)
{
- UINT8 *Buffer8;
+ UINT8 *Buffer8;
Buffer8 = (UINT8 *)Buffer;
while (Count-- > 0) {
@@ -415,12 +415,12 @@ IoReadFifo8 (
VOID
EFIAPI
IoWriteFifo8 (
- IN UINTN Port,
- IN UINTN Count,
- IN VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ IN VOID *Buffer
)
{
- UINT8 *Buffer8;
+ UINT8 *Buffer8;
Buffer8 = (UINT8 *)Buffer;
while (Count-- > 0) {
@@ -448,12 +448,12 @@ IoWriteFifo8 (
VOID
EFIAPI
IoReadFifo16 (
- IN UINTN Port,
- IN UINTN Count,
- OUT VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ OUT VOID *Buffer
)
{
- UINT16 *Buffer16;
+ UINT16 *Buffer16;
//
// Make sure Port is aligned on a 16-bit boundary.
@@ -485,12 +485,12 @@ IoReadFifo16 (
VOID
EFIAPI
IoWriteFifo16 (
- IN UINTN Port,
- IN UINTN Count,
- IN VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ IN VOID *Buffer
)
{
- UINT16 *Buffer16;
+ UINT16 *Buffer16;
//
// Make sure Port is aligned on a 16-bit boundary.
@@ -522,12 +522,12 @@ IoWriteFifo16 (
VOID
EFIAPI
IoReadFifo32 (
- IN UINTN Port,
- IN UINTN Count,
- OUT VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ OUT VOID *Buffer
)
{
- UINT32 *Buffer32;
+ UINT32 *Buffer32;
//
// Make sure Port is aligned on a 32-bit boundary.
@@ -559,12 +559,12 @@ IoReadFifo32 (
VOID
EFIAPI
IoWriteFifo32 (
- IN UINTN Port,
- IN UINTN Count,
- IN VOID *Buffer
+ IN UINTN Port,
+ IN UINTN Count,
+ IN VOID *Buffer
)
{
- UINT32 *Buffer32;
+ UINT32 *Buffer32;
//
// Make sure Port is aligned on a 32-bit boundary.
@@ -593,7 +593,7 @@ IoWriteFifo32 (
UINT8
EFIAPI
MmioRead8 (
- IN UINTN Address
+ IN UINTN Address
)
{
return (UINT8)MmioReadWorker (Address, SMM_IO_UINT8);
@@ -615,8 +615,8 @@ MmioRead8 (
UINT8
EFIAPI
MmioWrite8 (
- IN UINTN Address,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINT8 Value
)
{
return (UINT8)MmioWriteWorker (Address, SMM_IO_UINT8, Value);
@@ -641,7 +641,7 @@ MmioWrite8 (
UINT16
EFIAPI
MmioRead16 (
- IN UINTN Address
+ IN UINTN Address
)
{
//
@@ -669,8 +669,8 @@ MmioRead16 (
UINT16
EFIAPI
MmioWrite16 (
- IN UINTN Address,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINT16 Value
)
{
//
@@ -699,7 +699,7 @@ MmioWrite16 (
UINT32
EFIAPI
MmioRead32 (
- IN UINTN Address
+ IN UINTN Address
)
{
//
@@ -727,8 +727,8 @@ MmioRead32 (
UINT32
EFIAPI
MmioWrite32 (
- IN UINTN Address,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINT32 Value
)
{
//
@@ -757,7 +757,7 @@ MmioWrite32 (
UINT64
EFIAPI
MmioRead64 (
- IN UINTN Address
+ IN UINTN Address
)
{
//
@@ -785,8 +785,8 @@ MmioRead64 (
UINT64
EFIAPI
MmioWrite64 (
- IN UINTN Address,
- IN UINT64 Value
+ IN UINTN Address,
+ IN UINT64 Value
)
{
//
diff --git a/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLibMmioBuffer.c b/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLibMmioBuffer.c
index 2436c0524f..5b8ef4402d 100644
--- a/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLibMmioBuffer.c
+++ b/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLibMmioBuffer.c
@@ -29,15 +29,15 @@
UINT8 *
EFIAPI
MmioReadBuffer8 (
- IN UINTN StartAddress,
- IN UINTN Length,
- OUT UINT8 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ OUT UINT8 *Buffer
)
{
- UINT8 *ReturnBuffer;
+ UINT8 *ReturnBuffer;
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ReturnBuffer = Buffer;
@@ -74,27 +74,27 @@ MmioReadBuffer8 (
UINT16 *
EFIAPI
MmioReadBuffer16 (
- IN UINTN StartAddress,
- IN UINTN Length,
- OUT UINT16 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ OUT UINT16 *Buffer
)
{
- UINT16 *ReturnBuffer;
+ UINT16 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT16) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT16) - 1)) == 0);
+ ASSERT (((UINTN)Buffer & (sizeof (UINT16) - 1)) == 0);
ReturnBuffer = Buffer;
while (Length > 0) {
- *(Buffer++) = MmioRead16 (StartAddress);
+ *(Buffer++) = MmioRead16 (StartAddress);
StartAddress += sizeof (UINT16);
- Length -= sizeof (UINT16);
+ Length -= sizeof (UINT16);
}
return ReturnBuffer;
@@ -125,27 +125,27 @@ MmioReadBuffer16 (
UINT32 *
EFIAPI
MmioReadBuffer32 (
- IN UINTN StartAddress,
- IN UINTN Length,
- OUT UINT32 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ OUT UINT32 *Buffer
)
{
- UINT32 *ReturnBuffer;
+ UINT32 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT32) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0);
+ ASSERT (((UINTN)Buffer & (sizeof (UINT32) - 1)) == 0);
ReturnBuffer = Buffer;
while (Length > 0) {
- *(Buffer++) = MmioRead32 (StartAddress);
+ *(Buffer++) = MmioRead32 (StartAddress);
StartAddress += sizeof (UINT32);
- Length -= sizeof (UINT32);
+ Length -= sizeof (UINT32);
}
return ReturnBuffer;
@@ -177,33 +177,32 @@ MmioReadBuffer32 (
UINT64 *
EFIAPI
MmioReadBuffer64 (
- IN UINTN StartAddress,
- IN UINTN Length,
- OUT UINT64 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ OUT UINT64 *Buffer
)
{
- UINT64 *ReturnBuffer;
+ UINT64 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT64) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT64) - 1)) == 0);
+ ASSERT (((UINTN)Buffer & (sizeof (UINT64) - 1)) == 0);
ReturnBuffer = Buffer;
while (Length > 0) {
- *(Buffer++) = MmioRead64 (StartAddress);
+ *(Buffer++) = MmioRead64 (StartAddress);
StartAddress += sizeof (UINT64);
- Length -= sizeof (UINT64);
+ Length -= sizeof (UINT64);
}
return ReturnBuffer;
}
-
/**
Copy data from system memory to MMIO region by using 8-bit access.
@@ -226,24 +225,23 @@ MmioReadBuffer64 (
UINT8 *
EFIAPI
MmioWriteBuffer8 (
- IN UINTN StartAddress,
- IN UINTN Length,
- IN CONST UINT8 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ IN CONST UINT8 *Buffer
)
{
- VOID* ReturnBuffer;
+ VOID *ReturnBuffer;
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
- ReturnBuffer = (UINT8 *) Buffer;
+ ReturnBuffer = (UINT8 *)Buffer;
while (Length-- > 0) {
- MmioWrite8 (StartAddress++, *(Buffer++));
+ MmioWrite8 (StartAddress++, *(Buffer++));
}
return ReturnBuffer;
-
}
/**
@@ -273,34 +271,33 @@ MmioWriteBuffer8 (
UINT16 *
EFIAPI
MmioWriteBuffer16 (
- IN UINTN StartAddress,
- IN UINTN Length,
- IN CONST UINT16 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ IN CONST UINT16 *Buffer
)
{
- UINT16 *ReturnBuffer;
+ UINT16 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT16) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT16) - 1)) == 0);
+ ASSERT (((UINTN)Buffer & (sizeof (UINT16) - 1)) == 0);
- ReturnBuffer = (UINT16 *) Buffer;
+ ReturnBuffer = (UINT16 *)Buffer;
while (Length > 0) {
MmioWrite16 (StartAddress, *(Buffer++));
StartAddress += sizeof (UINT16);
- Length -= sizeof (UINT16);
+ Length -= sizeof (UINT16);
}
return ReturnBuffer;
}
-
/**
Copy data from system memory to MMIO region by using 32-bit access.
@@ -328,28 +325,28 @@ MmioWriteBuffer16 (
UINT32 *
EFIAPI
MmioWriteBuffer32 (
- IN UINTN StartAddress,
- IN UINTN Length,
- IN CONST UINT32 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ IN CONST UINT32 *Buffer
)
{
- UINT32 *ReturnBuffer;
+ UINT32 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT32) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0);
+ ASSERT (((UINTN)Buffer & (sizeof (UINT32) - 1)) == 0);
- ReturnBuffer = (UINT32 *) Buffer;
+ ReturnBuffer = (UINT32 *)Buffer;
while (Length > 0) {
MmioWrite32 (StartAddress, *(Buffer++));
StartAddress += sizeof (UINT32);
- Length -= sizeof (UINT32);
+ Length -= sizeof (UINT32);
}
return ReturnBuffer;
@@ -382,30 +379,29 @@ MmioWriteBuffer32 (
UINT64 *
EFIAPI
MmioWriteBuffer64 (
- IN UINTN StartAddress,
- IN UINTN Length,
- IN CONST UINT64 *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ IN CONST UINT64 *Buffer
)
{
- UINT64 *ReturnBuffer;
+ UINT64 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT64) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT64) - 1)) == 0);
+ ASSERT (((UINTN)Buffer & (sizeof (UINT64) - 1)) == 0);
- ReturnBuffer = (UINT64 *) Buffer;
+ ReturnBuffer = (UINT64 *)Buffer;
while (Length > 0) {
MmioWrite64 (StartAddress, *(Buffer++));
StartAddress += sizeof (UINT64);
- Length -= sizeof (UINT64);
+ Length -= sizeof (UINT64);
}
return ReturnBuffer;
}
-
diff --git a/MdePkg/Library/SmmIoLibSmmCpuIo2/SmmCpuIoLibInternal.h b/MdePkg/Library/SmmIoLibSmmCpuIo2/SmmCpuIoLibInternal.h
index 51953e30f1..7a71a5a267 100644
--- a/MdePkg/Library/SmmIoLibSmmCpuIo2/SmmCpuIoLibInternal.h
+++ b/MdePkg/Library/SmmIoLibSmmCpuIo2/SmmCpuIoLibInternal.h
@@ -20,7 +20,6 @@
#include <Library/BaseLib.h>
#include <Library/SmmServicesTableLib.h>
-
/**
Reads registers in the EFI CPU I/O space.
@@ -38,8 +37,8 @@
UINT64
EFIAPI
IoReadWorker (
- IN UINTN Port,
- IN EFI_SMM_IO_WIDTH Width
+ IN UINTN Port,
+ IN EFI_SMM_IO_WIDTH Width
);
/**
@@ -60,9 +59,9 @@ IoReadWorker (
UINT64
EFIAPI
IoWriteWorker (
- IN UINTN Port,
- IN EFI_SMM_IO_WIDTH Width,
- IN UINT64 Data
+ IN UINTN Port,
+ IN EFI_SMM_IO_WIDTH Width,
+ IN UINT64 Data
);
/**
@@ -82,8 +81,8 @@ IoWriteWorker (
UINT64
EFIAPI
MmioReadWorker (
- IN UINTN Address,
- IN EFI_SMM_IO_WIDTH Width
+ IN UINTN Address,
+ IN EFI_SMM_IO_WIDTH Width
);
/**
@@ -104,9 +103,9 @@ MmioReadWorker (
UINT64
EFIAPI
MmioWriteWorker (
- IN UINTN Address,
- IN EFI_SMM_IO_WIDTH Width,
- IN UINT64 Data
+ IN UINTN Address,
+ IN EFI_SMM_IO_WIDTH Width,
+ IN UINT64 Data
);
#endif
diff --git a/MdePkg/Library/SmmLibNull/SmmLibNull.c b/MdePkg/Library/SmmLibNull/SmmLibNull.c
index 28c4f2fda7..797ad38da3 100644
--- a/MdePkg/Library/SmmLibNull/SmmLibNull.c
+++ b/MdePkg/Library/SmmLibNull/SmmLibNull.c
@@ -24,7 +24,6 @@ TriggerBootServiceSoftwareSmi (
return;
}
-
/**
Triggers an SMI at run time.
@@ -40,8 +39,6 @@ TriggerRuntimeSoftwareSmi (
return;
}
-
-
/**
Test if a boot time software SMI happened.
@@ -62,7 +59,6 @@ IsBootServiceSoftwareSmi (
return FALSE;
}
-
/**
Test if a run time software SMI happened.
diff --git a/MdePkg/Library/SmmMemLib/SmmMemLib.c b/MdePkg/Library/SmmMemLib/SmmMemLib.c
index d1fc9e3e46..ef087d0f05 100644
--- a/MdePkg/Library/SmmMemLib/SmmMemLib.c
+++ b/MdePkg/Library/SmmMemLib/SmmMemLib.c
@@ -11,7 +11,6 @@
**/
-
#include <PiSmm.h>
#include <Library/BaseLib.h>
@@ -35,27 +34,27 @@
#define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL
#define EFI_MEMORY_TESTED 0x0400000000000000ULL
-EFI_SMRAM_DESCRIPTOR *mSmmMemLibInternalSmramRanges;
-UINTN mSmmMemLibInternalSmramCount;
+EFI_SMRAM_DESCRIPTOR *mSmmMemLibInternalSmramRanges;
+UINTN mSmmMemLibInternalSmramCount;
//
// Maximum support address used to check input buffer
//
EFI_PHYSICAL_ADDRESS mSmmMemLibInternalMaximumSupportAddress = 0;
-UINTN mMemoryMapEntryCount;
-EFI_MEMORY_DESCRIPTOR *mMemoryMap;
-UINTN mDescriptorSize;
+UINTN mMemoryMapEntryCount;
+EFI_MEMORY_DESCRIPTOR *mMemoryMap;
+UINTN mDescriptorSize;
-EFI_GCD_MEMORY_SPACE_DESCRIPTOR *mSmmMemLibGcdMemSpace = NULL;
-UINTN mSmmMemLibGcdMemNumberOfDesc = 0;
+EFI_GCD_MEMORY_SPACE_DESCRIPTOR *mSmmMemLibGcdMemSpace = NULL;
+UINTN mSmmMemLibGcdMemNumberOfDesc = 0;
EFI_MEMORY_ATTRIBUTES_TABLE *mSmmMemLibMemoryAttributesTable = NULL;
-VOID *mRegistrationEndOfDxe;
-VOID *mRegistrationReadyToLock;
+VOID *mRegistrationEndOfDxe;
+VOID *mRegistrationReadyToLock;
-BOOLEAN mSmmMemLibSmmReadyToLock = FALSE;
+BOOLEAN mSmmMemLibSmmReadyToLock = FALSE;
/**
Calculate and save the maximum support address.
@@ -66,25 +65,26 @@ SmmMemLibInternalCalculateMaximumSupportAddress (
VOID
)
{
- VOID *Hob;
- UINT32 RegEax;
- UINT8 PhysicalAddressBits;
+ VOID *Hob;
+ UINT32 RegEax;
+ UINT8 PhysicalAddressBits;
//
// Get physical address bits supported.
//
Hob = GetFirstHob (EFI_HOB_TYPE_CPU);
if (Hob != NULL) {
- PhysicalAddressBits = ((EFI_HOB_CPU *) Hob)->SizeOfMemorySpace;
+ PhysicalAddressBits = ((EFI_HOB_CPU *)Hob)->SizeOfMemorySpace;
} else {
AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);
if (RegEax >= 0x80000008) {
AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL);
- PhysicalAddressBits = (UINT8) RegEax;
+ PhysicalAddressBits = (UINT8)RegEax;
} else {
PhysicalAddressBits = 36;
}
}
+
//
// IA-32e paging translates 48-bit linear addresses to 52-bit physical addresses.
//
@@ -124,7 +124,8 @@ SmmIsBufferOutsideSmmValid (
//
if ((Length > mSmmMemLibInternalMaximumSupportAddress) ||
(Buffer > mSmmMemLibInternalMaximumSupportAddress) ||
- ((Length != 0) && (Buffer > (mSmmMemLibInternalMaximumSupportAddress - (Length - 1)))) ) {
+ ((Length != 0) && (Buffer > (mSmmMemLibInternalMaximumSupportAddress - (Length - 1)))))
+ {
//
// Overflow happen
//
@@ -138,9 +139,10 @@ SmmIsBufferOutsideSmmValid (
return FALSE;
}
- for (Index = 0; Index < mSmmMemLibInternalSmramCount; Index ++) {
+ for (Index = 0; Index < mSmmMemLibInternalSmramCount; Index++) {
if (((Buffer >= mSmmMemLibInternalSmramRanges[Index].CpuStart) && (Buffer < mSmmMemLibInternalSmramRanges[Index].CpuStart + mSmmMemLibInternalSmramRanges[Index].PhysicalSize)) ||
- ((mSmmMemLibInternalSmramRanges[Index].CpuStart >= Buffer) && (mSmmMemLibInternalSmramRanges[Index].CpuStart < Buffer + Length))) {
+ ((mSmmMemLibInternalSmramRanges[Index].CpuStart >= Buffer) && (mSmmMemLibInternalSmramRanges[Index].CpuStart < Buffer + Length)))
+ {
DEBUG ((
DEBUG_ERROR,
"SmmIsBufferOutsideSmmValid: Overlap: Buffer (0x%lx) - Length (0x%lx), ",
@@ -161,17 +163,19 @@ SmmIsBufferOutsideSmmValid (
// Check override for Valid Communication Region
//
if (mSmmMemLibSmmReadyToLock) {
- EFI_MEMORY_DESCRIPTOR *MemoryMap;
- BOOLEAN InValidCommunicationRegion;
+ EFI_MEMORY_DESCRIPTOR *MemoryMap;
+ BOOLEAN InValidCommunicationRegion;
InValidCommunicationRegion = FALSE;
- MemoryMap = mMemoryMap;
+ MemoryMap = mMemoryMap;
for (Index = 0; Index < mMemoryMapEntryCount; Index++) {
if ((Buffer >= MemoryMap->PhysicalStart) &&
- (Buffer + Length <= MemoryMap->PhysicalStart + LShiftU64 (MemoryMap->NumberOfPages, EFI_PAGE_SHIFT))) {
+ (Buffer + Length <= MemoryMap->PhysicalStart + LShiftU64 (MemoryMap->NumberOfPages, EFI_PAGE_SHIFT)))
+ {
InValidCommunicationRegion = TRUE;
}
- MemoryMap = NEXT_MEMORY_DESCRIPTOR(MemoryMap, mDescriptorSize);
+
+ MemoryMap = NEXT_MEMORY_DESCRIPTOR (MemoryMap, mDescriptorSize);
}
if (!InValidCommunicationRegion) {
@@ -189,7 +193,8 @@ SmmIsBufferOutsideSmmValid (
//
for (Index = 0; Index < mSmmMemLibGcdMemNumberOfDesc; Index++) {
if (((Buffer >= mSmmMemLibGcdMemSpace[Index].BaseAddress) && (Buffer < mSmmMemLibGcdMemSpace[Index].BaseAddress + mSmmMemLibGcdMemSpace[Index].Length)) ||
- ((mSmmMemLibGcdMemSpace[Index].BaseAddress >= Buffer) && (mSmmMemLibGcdMemSpace[Index].BaseAddress < Buffer + Length))) {
+ ((mSmmMemLibGcdMemSpace[Index].BaseAddress >= Buffer) && (mSmmMemLibGcdMemSpace[Index].BaseAddress < Buffer + Length)))
+ {
DEBUG ((
DEBUG_ERROR,
"SmmIsBufferOutsideSmmValid: In Untested Memory Region: Buffer (0x%lx) - Length (0x%lx)\n",
@@ -204,14 +209,15 @@ SmmIsBufferOutsideSmmValid (
// Check UEFI runtime memory with EFI_MEMORY_RO as invalid communication buffer.
//
if (mSmmMemLibMemoryAttributesTable != NULL) {
- EFI_MEMORY_DESCRIPTOR *Entry;
+ EFI_MEMORY_DESCRIPTOR *Entry;
Entry = (EFI_MEMORY_DESCRIPTOR *)(mSmmMemLibMemoryAttributesTable + 1);
for (Index = 0; Index < mSmmMemLibMemoryAttributesTable->NumberOfEntries; Index++) {
- if (Entry->Type == EfiRuntimeServicesCode || Entry->Type == EfiRuntimeServicesData) {
+ if ((Entry->Type == EfiRuntimeServicesCode) || (Entry->Type == EfiRuntimeServicesData)) {
if ((Entry->Attribute & EFI_MEMORY_RO) != 0) {
if (((Buffer >= Entry->PhysicalStart) && (Buffer < Entry->PhysicalStart + LShiftU64 (Entry->NumberOfPages, EFI_PAGE_SHIFT))) ||
- ((Entry->PhysicalStart >= Buffer) && (Entry->PhysicalStart < Buffer + Length))) {
+ ((Entry->PhysicalStart >= Buffer) && (Entry->PhysicalStart < Buffer + Length)))
+ {
DEBUG ((
DEBUG_ERROR,
"SmmIsBufferOutsideSmmValid: In RuntimeCode Region: Buffer (0x%lx) - Length (0x%lx)\n",
@@ -222,10 +228,12 @@ SmmIsBufferOutsideSmmValid (
}
}
}
+
Entry = NEXT_MEMORY_DESCRIPTOR (Entry, mSmmMemLibMemoryAttributesTable->DescriptorSize);
}
}
}
+
return TRUE;
}
@@ -258,6 +266,7 @@ SmmCopyMemToSmram (
DEBUG ((DEBUG_ERROR, "SmmCopyMemToSmram: Security Violation: Source (0x%x), Length (0x%x)\n", SourceBuffer, Length));
return EFI_SECURITY_VIOLATION;
}
+
CopyMem (DestinationBuffer, SourceBuffer, Length);
return EFI_SUCCESS;
}
@@ -291,6 +300,7 @@ SmmCopyMemFromSmram (
DEBUG ((DEBUG_ERROR, "SmmCopyMemFromSmram: Security Violation: Destination (0x%x), Length (0x%x)\n", DestinationBuffer, Length));
return EFI_SECURITY_VIOLATION;
}
+
CopyMem (DestinationBuffer, SourceBuffer, Length);
return EFI_SUCCESS;
}
@@ -325,10 +335,12 @@ SmmCopyMem (
DEBUG ((DEBUG_ERROR, "SmmCopyMem: Security Violation: Destination (0x%x), Length (0x%x)\n", DestinationBuffer, Length));
return EFI_SECURITY_VIOLATION;
}
+
if (!SmmIsBufferOutsideSmmValid ((EFI_PHYSICAL_ADDRESS)(UINTN)SourceBuffer, Length)) {
DEBUG ((DEBUG_ERROR, "SmmCopyMem: Security Violation: Source (0x%x), Length (0x%x)\n", SourceBuffer, Length));
return EFI_SECURITY_VIOLATION;
}
+
CopyMem (DestinationBuffer, SourceBuffer, Length);
return EFI_SUCCESS;
}
@@ -361,6 +373,7 @@ SmmSetMem (
DEBUG ((DEBUG_ERROR, "SmmSetMem: Security Violation: Source (0x%x), Length (0x%x)\n", Buffer, Length));
return EFI_SECURITY_VIOLATION;
}
+
SetMem (Buffer, Length, Value);
return EFI_SUCCESS;
}
@@ -381,15 +394,16 @@ SmmMemLibInternalGetGcdMemoryMap (
Status = gDS->GetMemorySpaceMap (&NumberOfDescriptors, &MemSpaceMap);
if (EFI_ERROR (Status)) {
- return ;
+ return;
}
mSmmMemLibGcdMemNumberOfDesc = 0;
for (Index = 0; Index < NumberOfDescriptors; Index++) {
- if (MemSpaceMap[Index].GcdMemoryType == EfiGcdMemoryTypeReserved &&
- (MemSpaceMap[Index].Capabilities & (EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED | EFI_MEMORY_TESTED)) ==
- (EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED)
- ) {
+ if ((MemSpaceMap[Index].GcdMemoryType == EfiGcdMemoryTypeReserved) &&
+ ((MemSpaceMap[Index].Capabilities & (EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED | EFI_MEMORY_TESTED)) ==
+ (EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED))
+ )
+ {
mSmmMemLibGcdMemNumberOfDesc++;
}
}
@@ -399,19 +413,20 @@ SmmMemLibInternalGetGcdMemoryMap (
if (mSmmMemLibGcdMemSpace == NULL) {
mSmmMemLibGcdMemNumberOfDesc = 0;
gBS->FreePool (MemSpaceMap);
- return ;
+ return;
}
mSmmMemLibGcdMemNumberOfDesc = 0;
for (Index = 0; Index < NumberOfDescriptors; Index++) {
- if (MemSpaceMap[Index].GcdMemoryType == EfiGcdMemoryTypeReserved &&
- (MemSpaceMap[Index].Capabilities & (EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED | EFI_MEMORY_TESTED)) ==
- (EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED)
- ) {
+ if ((MemSpaceMap[Index].GcdMemoryType == EfiGcdMemoryTypeReserved) &&
+ ((MemSpaceMap[Index].Capabilities & (EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED | EFI_MEMORY_TESTED)) ==
+ (EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED))
+ )
+ {
CopyMem (
&mSmmMemLibGcdMemSpace[mSmmMemLibGcdMemNumberOfDesc],
&MemSpaceMap[Index],
- sizeof(EFI_GCD_MEMORY_SPACE_DESCRIPTOR)
+ sizeof (EFI_GCD_MEMORY_SPACE_DESCRIPTOR)
);
mSmmMemLibGcdMemNumberOfDesc++;
}
@@ -434,7 +449,7 @@ SmmMemLibInternalGetUefiMemoryAttributesTable (
Status = EfiGetSystemConfigurationTable (&gEfiMemoryAttributesTableGuid, (VOID **)&MemoryAttributesTable);
if (!EFI_ERROR (Status) && (MemoryAttributesTable != NULL)) {
- MemoryAttributesTableSize = sizeof(EFI_MEMORY_ATTRIBUTES_TABLE) + MemoryAttributesTable->DescriptorSize * MemoryAttributesTable->NumberOfEntries;
+ MemoryAttributesTableSize = sizeof (EFI_MEMORY_ATTRIBUTES_TABLE) + MemoryAttributesTable->DescriptorSize * MemoryAttributesTable->NumberOfEntries;
mSmmMemLibMemoryAttributesTable = AllocateCopyPool (MemoryAttributesTableSize, MemoryAttributesTable);
ASSERT (mSmmMemLibMemoryAttributesTable != NULL);
}
@@ -457,26 +472,26 @@ SmmLibInternalEndOfDxeNotify (
IN EFI_HANDLE Handle
)
{
- EFI_STATUS Status;
- UINTN MapKey;
- UINTN MemoryMapSize;
- EFI_MEMORY_DESCRIPTOR *MemoryMap;
- EFI_MEMORY_DESCRIPTOR *MemoryMapStart;
- EFI_MEMORY_DESCRIPTOR *SmmMemoryMapStart;
- UINTN MemoryMapEntryCount;
- UINTN DescriptorSize;
- UINT32 DescriptorVersion;
- UINTN Index;
+ EFI_STATUS Status;
+ UINTN MapKey;
+ UINTN MemoryMapSize;
+ EFI_MEMORY_DESCRIPTOR *MemoryMap;
+ EFI_MEMORY_DESCRIPTOR *MemoryMapStart;
+ EFI_MEMORY_DESCRIPTOR *SmmMemoryMapStart;
+ UINTN MemoryMapEntryCount;
+ UINTN DescriptorSize;
+ UINT32 DescriptorVersion;
+ UINTN Index;
MemoryMapSize = 0;
- MemoryMap = NULL;
- Status = gBS->GetMemoryMap (
- &MemoryMapSize,
- MemoryMap,
- &MapKey,
- &DescriptorSize,
- &DescriptorVersion
- );
+ MemoryMap = NULL;
+ Status = gBS->GetMemoryMap (
+ &MemoryMapSize,
+ MemoryMap,
+ &MapKey,
+ &DescriptorSize,
+ &DescriptorVersion
+ );
ASSERT (Status == EFI_BUFFER_TOO_SMALL);
do {
@@ -484,12 +499,12 @@ SmmLibInternalEndOfDxeNotify (
ASSERT (MemoryMap != NULL);
Status = gBS->GetMemoryMap (
- &MemoryMapSize,
- MemoryMap,
- &MapKey,
- &DescriptorSize,
- &DescriptorVersion
- );
+ &MemoryMapSize,
+ MemoryMap,
+ &MapKey,
+ &DescriptorSize,
+ &DescriptorVersion
+ );
if (EFI_ERROR (Status)) {
gBS->FreePool (MemoryMap);
}
@@ -498,21 +513,23 @@ SmmLibInternalEndOfDxeNotify (
//
// Get Count
//
- mDescriptorSize = DescriptorSize;
- MemoryMapEntryCount = MemoryMapSize/DescriptorSize;
- MemoryMapStart = MemoryMap;
+ mDescriptorSize = DescriptorSize;
+ MemoryMapEntryCount = MemoryMapSize/DescriptorSize;
+ MemoryMapStart = MemoryMap;
mMemoryMapEntryCount = 0;
for (Index = 0; Index < MemoryMapEntryCount; Index++) {
switch (MemoryMap->Type) {
- case EfiReservedMemoryType:
- case EfiRuntimeServicesCode:
- case EfiRuntimeServicesData:
- case EfiACPIMemoryNVS:
- mMemoryMapEntryCount++;
- break;
+ case EfiReservedMemoryType:
+ case EfiRuntimeServicesCode:
+ case EfiRuntimeServicesData:
+ case EfiACPIMemoryNVS:
+ mMemoryMapEntryCount++;
+ break;
}
- MemoryMap = NEXT_MEMORY_DESCRIPTOR(MemoryMap, DescriptorSize);
+
+ MemoryMap = NEXT_MEMORY_DESCRIPTOR (MemoryMap, DescriptorSize);
}
+
MemoryMap = MemoryMapStart;
//
@@ -523,18 +540,20 @@ SmmLibInternalEndOfDxeNotify (
SmmMemoryMapStart = mMemoryMap;
for (Index = 0; Index < MemoryMapEntryCount; Index++) {
switch (MemoryMap->Type) {
- case EfiReservedMemoryType:
- case EfiRuntimeServicesCode:
- case EfiRuntimeServicesData:
- case EfiACPIMemoryNVS:
- CopyMem (mMemoryMap, MemoryMap, DescriptorSize);
- mMemoryMap = NEXT_MEMORY_DESCRIPTOR(mMemoryMap, DescriptorSize);
- break;
+ case EfiReservedMemoryType:
+ case EfiRuntimeServicesCode:
+ case EfiRuntimeServicesData:
+ case EfiACPIMemoryNVS:
+ CopyMem (mMemoryMap, MemoryMap, DescriptorSize);
+ mMemoryMap = NEXT_MEMORY_DESCRIPTOR (mMemoryMap, DescriptorSize);
+ break;
}
- MemoryMap = NEXT_MEMORY_DESCRIPTOR(MemoryMap, DescriptorSize);
+
+ MemoryMap = NEXT_MEMORY_DESCRIPTOR (MemoryMap, DescriptorSize);
}
+
mMemoryMap = SmmMemoryMapStart;
- MemoryMap = MemoryMapStart;
+ MemoryMap = MemoryMapStart;
gBS->FreePool (MemoryMap);
@@ -571,6 +590,7 @@ SmmLibInternalReadyToLockNotify (
mSmmMemLibSmmReadyToLock = TRUE;
return EFI_SUCCESS;
}
+
/**
The constructor function initializes the Smm Mem library
@@ -587,9 +607,9 @@ SmmMemLibConstructor (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- EFI_SMM_ACCESS2_PROTOCOL *SmmAccess;
- UINTN Size;
+ EFI_STATUS Status;
+ EFI_SMM_ACCESS2_PROTOCOL *SmmAccess;
+ UINTN Size;
//
// Get SMRAM information
@@ -597,7 +617,7 @@ SmmMemLibConstructor (
Status = gBS->LocateProtocol (&gEfiSmmAccess2ProtocolGuid, NULL, (VOID **)&SmmAccess);
ASSERT_EFI_ERROR (Status);
- Size = 0;
+ Size = 0;
Status = SmmAccess->GetCapabilities (SmmAccess, &Size, NULL);
ASSERT (Status == EFI_BUFFER_TOO_SMALL);
diff --git a/MdePkg/Library/SmmMemoryAllocationLib/MemoryAllocationLib.c b/MdePkg/Library/SmmMemoryAllocationLib/MemoryAllocationLib.c
index c0247a3a42..3ab2c1ebfd 100644
--- a/MdePkg/Library/SmmMemoryAllocationLib/MemoryAllocationLib.c
+++ b/MdePkg/Library/SmmMemoryAllocationLib/MemoryAllocationLib.c
@@ -67,11 +67,11 @@ SmmMemoryAllocationLibConstructor (
//
// Get SMRAM range information
//
- Size = 0;
+ Size = 0;
Status = SmmAccess->GetCapabilities (SmmAccess, &Size, NULL);
ASSERT (Status == EFI_BUFFER_TOO_SMALL);
- mSmramRanges = (EFI_SMRAM_DESCRIPTOR *) AllocatePool (Size);
+ mSmramRanges = (EFI_SMRAM_DESCRIPTOR *)AllocatePool (Size);
ASSERT (mSmramRanges != NULL);
Status = SmmAccess->GetCapabilities (SmmAccess, &Size, mSmramRanges);
@@ -114,14 +114,15 @@ SmmMemoryAllocationLibDestructor (
BOOLEAN
EFIAPI
BufferInSmram (
- IN VOID *Buffer
+ IN VOID *Buffer
)
{
UINTN Index;
- for (Index = 0; Index < mSmramRangeCount; Index ++) {
- if (((EFI_PHYSICAL_ADDRESS) (UINTN) Buffer >= mSmramRanges[Index].CpuStart) &&
- ((EFI_PHYSICAL_ADDRESS) (UINTN) Buffer < (mSmramRanges[Index].CpuStart + mSmramRanges[Index].PhysicalSize))) {
+ for (Index = 0; Index < mSmramRangeCount; Index++) {
+ if (((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer >= mSmramRanges[Index].CpuStart) &&
+ ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer < (mSmramRanges[Index].CpuStart + mSmramRanges[Index].PhysicalSize)))
+ {
return TRUE;
}
}
@@ -160,7 +161,8 @@ InternalAllocatePages (
if (EFI_ERROR (Status)) {
return NULL;
}
- return (VOID *) (UINTN) Memory;
+
+ return (VOID *)(UINTN)Memory;
}
/**
@@ -261,14 +263,15 @@ FreePages (
// When Buffer is in SMRAM range, it should be allocated by gSmst->SmmAllocatePages() service.
// So, gSmst->SmmFreePages() service is used to free it.
//
- Status = gSmst->SmmFreePages ((EFI_PHYSICAL_ADDRESS) (UINTN) Buffer, Pages);
+ Status = gSmst->SmmFreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, Pages);
} else {
//
// When Buffer is out of SMRAM range, it should be allocated by gBS->AllocatePages() service.
// So, gBS->FreePages() service is used to free it.
//
- Status = gBS->FreePages ((EFI_PHYSICAL_ADDRESS) (UINTN) Buffer, Pages);
+ Status = gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, Pages);
}
+
ASSERT_EFI_ERROR (Status);
}
@@ -313,23 +316,25 @@ InternalAllocateAlignedPages (
if (Pages == 0) {
return NULL;
}
+
if (Alignment > EFI_PAGE_SIZE) {
//
// Calculate the total number of pages since alignment is larger than page size.
//
- AlignmentMask = Alignment - 1;
- RealPages = Pages + EFI_SIZE_TO_PAGES (Alignment);
+ AlignmentMask = Alignment - 1;
+ RealPages = Pages + EFI_SIZE_TO_PAGES (Alignment);
//
// Make sure that Pages plus EFI_SIZE_TO_PAGES (Alignment) does not overflow.
//
ASSERT (RealPages > Pages);
- Status = gSmst->SmmAllocatePages (AllocateAnyPages, MemoryType, RealPages, &Memory);
+ Status = gSmst->SmmAllocatePages (AllocateAnyPages, MemoryType, RealPages, &Memory);
if (EFI_ERROR (Status)) {
return NULL;
}
- AlignedMemory = ((UINTN) Memory + AlignmentMask) & ~AlignmentMask;
- UnalignedPages = EFI_SIZE_TO_PAGES (AlignedMemory - (UINTN) Memory);
+
+ AlignedMemory = ((UINTN)Memory + AlignmentMask) & ~AlignmentMask;
+ UnalignedPages = EFI_SIZE_TO_PAGES (AlignedMemory - (UINTN)Memory);
if (UnalignedPages > 0) {
//
// Free first unaligned page(s).
@@ -337,6 +342,7 @@ InternalAllocateAlignedPages (
Status = gSmst->SmmFreePages (Memory, UnalignedPages);
ASSERT_EFI_ERROR (Status);
}
+
Memory = AlignedMemory + EFI_PAGES_TO_SIZE (Pages);
UnalignedPages = RealPages - Pages - UnalignedPages;
if (UnalignedPages > 0) {
@@ -354,9 +360,11 @@ InternalAllocateAlignedPages (
if (EFI_ERROR (Status)) {
return NULL;
}
- AlignedMemory = (UINTN) Memory;
+
+ AlignedMemory = (UINTN)Memory;
}
- return (VOID *) AlignedMemory;
+
+ return (VOID *)AlignedMemory;
}
/**
@@ -478,14 +486,15 @@ FreeAlignedPages (
// When Buffer is in SMRAM range, it should be allocated by gSmst->SmmAllocatePages() service.
// So, gSmst->SmmFreePages() service is used to free it.
//
- Status = gSmst->SmmFreePages ((EFI_PHYSICAL_ADDRESS) (UINTN) Buffer, Pages);
+ Status = gSmst->SmmFreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, Pages);
} else {
//
// When Buffer is out of SMRAM range, it should be allocated by gBS->AllocatePages() service.
// So, gBS->FreePages() service is used to free it.
//
- Status = gBS->FreePages ((EFI_PHYSICAL_ADDRESS) (UINTN) Buffer, Pages);
+ Status = gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, Pages);
}
+
ASSERT_EFI_ERROR (Status);
}
@@ -516,6 +525,7 @@ InternalAllocatePool (
if (EFI_ERROR (Status)) {
Memory = NULL;
}
+
return Memory;
}
@@ -611,6 +621,7 @@ InternalAllocateZeroPool (
if (Memory != NULL) {
Memory = ZeroMem (Memory, AllocationSize);
}
+
return Memory;
}
@@ -707,12 +718,13 @@ InternalAllocateCopyPool (
VOID *Memory;
ASSERT (Buffer != NULL);
- ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));
+ ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN)Buffer + 1));
Memory = InternalAllocatePool (PoolType, AllocationSize);
if (Memory != NULL) {
- Memory = CopyMem (Memory, Buffer, AllocationSize);
+ Memory = CopyMem (Memory, Buffer, AllocationSize);
}
+
return Memory;
}
@@ -833,10 +845,11 @@ InternalReallocatePool (
VOID *NewBuffer;
NewBuffer = InternalAllocateZeroPool (PoolType, NewSize);
- if (NewBuffer != NULL && OldBuffer != NULL) {
+ if ((NewBuffer != NULL) && (OldBuffer != NULL)) {
CopyMem (NewBuffer, OldBuffer, MIN (OldSize, NewSize));
FreePool (OldBuffer);
}
+
return NewBuffer;
}
@@ -954,10 +967,10 @@ ReallocateReservedPool (
VOID
EFIAPI
FreePool (
- IN VOID *Buffer
+ IN VOID *Buffer
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
if (BufferInSmram (Buffer)) {
//
@@ -972,5 +985,6 @@ FreePool (
//
Status = gBS->FreePool (Buffer);
}
+
ASSERT_EFI_ERROR (Status);
}
diff --git a/MdePkg/Library/SmmPciExpressLib/PciExpressLib.c b/MdePkg/Library/SmmPciExpressLib/PciExpressLib.c
index 97bd32c8d2..d7876a9fb3 100644
--- a/MdePkg/Library/SmmPciExpressLib/PciExpressLib.c
+++ b/MdePkg/Library/SmmPciExpressLib/PciExpressLib.c
@@ -22,8 +22,8 @@
///
/// Module global that contains the base physical address and size of the PCI Express MMIO range.
///
-UINTN mSmmPciExpressLibPciExpressBaseAddress = 0;
-UINTN mSmmPciExpressLibPciExpressBaseSize = 0;
+UINTN mSmmPciExpressLibPciExpressBaseAddress = 0;
+UINTN mSmmPciExpressLibPciExpressBaseSize = 0;
/**
The constructor function caches the PCI Express Base Address
@@ -36,17 +36,17 @@ UINTN mSmmPciExpressLibPciExpressBaseSize = 0;
EFI_STATUS
EFIAPI
SmmPciExpressLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
{
- //
- // Cache the physical address and size of the PCI Express MMIO range into a module global variable
- //
- mSmmPciExpressLibPciExpressBaseAddress = (UINTN) PcdGet64 (PcdPciExpressBaseAddress);
- mSmmPciExpressLibPciExpressBaseSize = (UINTN) PcdGet64 (PcdPciExpressBaseSize);
+ //
+ // Cache the physical address and size of the PCI Express MMIO range into a module global variable
+ //
+ mSmmPciExpressLibPciExpressBaseAddress = (UINTN)PcdGet64 (PcdPciExpressBaseAddress);
+ mSmmPciExpressLibPciExpressBaseSize = (UINTN)PcdGet64 (PcdPciExpressBaseSize);
- return EFI_SUCCESS;
+ return EFI_SUCCESS;
}
/**
@@ -84,11 +84,11 @@ SmmPciExpressLibConstructor (
RETURN_STATUS
EFIAPI
PciExpressRegisterForRuntimeAccess (
- IN UINTN Address
- )
+ IN UINTN Address
+ )
{
- ASSERT_INVALID_PCI_ADDRESS (Address);
- return RETURN_UNSUPPORTED;
+ ASSERT_INVALID_PCI_ADDRESS (Address);
+ return RETURN_UNSUPPORTED;
}
/**
@@ -109,20 +109,21 @@ PciExpressRegisterForRuntimeAccess (
**/
UINTN
GetPciExpressAddress (
- IN UINTN Address
- )
+ IN UINTN Address
+ )
{
- //
- // Make sure Address is valid
- //
- ASSERT_INVALID_PCI_ADDRESS (Address);
- //
- // Make sure the Address is in MMCONF address space
- //
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINTN) -1;
- }
- return mSmmPciExpressLibPciExpressBaseAddress + Address;
+ //
+ // Make sure Address is valid
+ //
+ ASSERT_INVALID_PCI_ADDRESS (Address);
+ //
+ // Make sure the Address is in MMCONF address space
+ //
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINTN)-1;
+ }
+
+ return mSmmPciExpressLibPciExpressBaseAddress + Address;
}
/**
@@ -144,13 +145,14 @@ GetPciExpressAddress (
UINT8
EFIAPI
PciExpressRead8 (
- IN UINTN Address
- )
+ IN UINTN Address
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT8) -1;
- }
- return MmioRead8 (GetPciExpressAddress (Address));
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT8)-1;
+ }
+
+ return MmioRead8 (GetPciExpressAddress (Address));
}
/**
@@ -173,14 +175,15 @@ PciExpressRead8 (
UINT8
EFIAPI
PciExpressWrite8 (
- IN UINTN Address,
- IN UINT8 Value
- )
+ IN UINTN Address,
+ IN UINT8 Value
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT8) -1;
- }
- return MmioWrite8 (GetPciExpressAddress (Address), Value);
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT8)-1;
+ }
+
+ return MmioWrite8 (GetPciExpressAddress (Address), Value);
}
/**
@@ -207,14 +210,15 @@ PciExpressWrite8 (
UINT8
EFIAPI
PciExpressOr8 (
- IN UINTN Address,
- IN UINT8 OrData
- )
+ IN UINTN Address,
+ IN UINT8 OrData
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT8) -1;
- }
- return MmioOr8 (GetPciExpressAddress (Address), OrData);
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT8)-1;
+ }
+
+ return MmioOr8 (GetPciExpressAddress (Address), OrData);
}
/**
@@ -241,14 +245,15 @@ PciExpressOr8 (
UINT8
EFIAPI
PciExpressAnd8 (
- IN UINTN Address,
- IN UINT8 AndData
- )
+ IN UINTN Address,
+ IN UINT8 AndData
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT8) -1;
- }
- return MmioAnd8 (GetPciExpressAddress (Address), AndData);
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT8)-1;
+ }
+
+ return MmioAnd8 (GetPciExpressAddress (Address), AndData);
}
/**
@@ -277,19 +282,20 @@ PciExpressAnd8 (
UINT8
EFIAPI
PciExpressAndThenOr8 (
- IN UINTN Address,
- IN UINT8 AndData,
- IN UINT8 OrData
- )
+ IN UINTN Address,
+ IN UINT8 AndData,
+ IN UINT8 OrData
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT8) -1;
- }
- return MmioAndThenOr8 (
- GetPciExpressAddress (Address),
- AndData,
- OrData
- );
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT8)-1;
+ }
+
+ return MmioAndThenOr8 (
+ GetPciExpressAddress (Address),
+ AndData,
+ OrData
+ );
}
/**
@@ -317,19 +323,20 @@ PciExpressAndThenOr8 (
UINT8
EFIAPI
PciExpressBitFieldRead8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
- )
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT8) -1;
- }
- return MmioBitFieldRead8 (
- GetPciExpressAddress (Address),
- StartBit,
- EndBit
- );
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT8)-1;
+ }
+
+ return MmioBitFieldRead8 (
+ GetPciExpressAddress (Address),
+ StartBit,
+ EndBit
+ );
}
/**
@@ -360,21 +367,22 @@ PciExpressBitFieldRead8 (
UINT8
EFIAPI
PciExpressBitFieldWrite8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
- )
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT8) -1;
- }
- return MmioBitFieldWrite8 (
- GetPciExpressAddress (Address),
- StartBit,
- EndBit,
- Value
- );
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT8)-1;
+ }
+
+ return MmioBitFieldWrite8 (
+ GetPciExpressAddress (Address),
+ StartBit,
+ EndBit,
+ Value
+ );
}
/**
@@ -408,21 +416,22 @@ PciExpressBitFieldWrite8 (
UINT8
EFIAPI
PciExpressBitFieldOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
- )
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT8) -1;
- }
- return MmioBitFieldOr8 (
- GetPciExpressAddress (Address),
- StartBit,
- EndBit,
- OrData
- );
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT8)-1;
+ }
+
+ return MmioBitFieldOr8 (
+ GetPciExpressAddress (Address),
+ StartBit,
+ EndBit,
+ OrData
+ );
}
/**
@@ -456,21 +465,22 @@ PciExpressBitFieldOr8 (
UINT8
EFIAPI
PciExpressBitFieldAnd8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
- )
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT8) -1;
- }
- return MmioBitFieldAnd8 (
- GetPciExpressAddress (Address),
- StartBit,
- EndBit,
- AndData
- );
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT8)-1;
+ }
+
+ return MmioBitFieldAnd8 (
+ GetPciExpressAddress (Address),
+ StartBit,
+ EndBit,
+ AndData
+ );
}
/**
@@ -508,23 +518,24 @@ PciExpressBitFieldAnd8 (
UINT8
EFIAPI
PciExpressBitFieldAndThenOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
- )
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT8) -1;
- }
- return MmioBitFieldAndThenOr8 (
- GetPciExpressAddress (Address),
- StartBit,
- EndBit,
- AndData,
- OrData
- );
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT8)-1;
+ }
+
+ return MmioBitFieldAndThenOr8 (
+ GetPciExpressAddress (Address),
+ StartBit,
+ EndBit,
+ AndData,
+ OrData
+ );
}
/**
@@ -547,13 +558,14 @@ PciExpressBitFieldAndThenOr8 (
UINT16
EFIAPI
PciExpressRead16 (
- IN UINTN Address
- )
+ IN UINTN Address
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT16) -1;
- }
- return MmioRead16 (GetPciExpressAddress (Address));
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT16)-1;
+ }
+
+ return MmioRead16 (GetPciExpressAddress (Address));
}
/**
@@ -577,14 +589,15 @@ PciExpressRead16 (
UINT16
EFIAPI
PciExpressWrite16 (
- IN UINTN Address,
- IN UINT16 Value
- )
+ IN UINTN Address,
+ IN UINT16 Value
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT16) -1;
- }
- return MmioWrite16 (GetPciExpressAddress (Address), Value);
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT16)-1;
+ }
+
+ return MmioWrite16 (GetPciExpressAddress (Address), Value);
}
/**
@@ -612,14 +625,15 @@ PciExpressWrite16 (
UINT16
EFIAPI
PciExpressOr16 (
- IN UINTN Address,
- IN UINT16 OrData
- )
+ IN UINTN Address,
+ IN UINT16 OrData
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT16) -1;
- }
- return MmioOr16 (GetPciExpressAddress (Address), OrData);
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT16)-1;
+ }
+
+ return MmioOr16 (GetPciExpressAddress (Address), OrData);
}
/**
@@ -647,14 +661,15 @@ PciExpressOr16 (
UINT16
EFIAPI
PciExpressAnd16 (
- IN UINTN Address,
- IN UINT16 AndData
- )
+ IN UINTN Address,
+ IN UINT16 AndData
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT16) -1;
- }
- return MmioAnd16 (GetPciExpressAddress (Address), AndData);
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT16)-1;
+ }
+
+ return MmioAnd16 (GetPciExpressAddress (Address), AndData);
}
/**
@@ -684,19 +699,20 @@ PciExpressAnd16 (
UINT16
EFIAPI
PciExpressAndThenOr16 (
- IN UINTN Address,
- IN UINT16 AndData,
- IN UINT16 OrData
- )
+ IN UINTN Address,
+ IN UINT16 AndData,
+ IN UINT16 OrData
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT16) -1;
- }
- return MmioAndThenOr16 (
- GetPciExpressAddress (Address),
- AndData,
- OrData
- );
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT16)-1;
+ }
+
+ return MmioAndThenOr16 (
+ GetPciExpressAddress (Address),
+ AndData,
+ OrData
+ );
}
/**
@@ -725,19 +741,20 @@ PciExpressAndThenOr16 (
UINT16
EFIAPI
PciExpressBitFieldRead16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
- )
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT16) -1;
- }
- return MmioBitFieldRead16 (
- GetPciExpressAddress (Address),
- StartBit,
- EndBit
- );
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT16)-1;
+ }
+
+ return MmioBitFieldRead16 (
+ GetPciExpressAddress (Address),
+ StartBit,
+ EndBit
+ );
}
/**
@@ -769,21 +786,22 @@ PciExpressBitFieldRead16 (
UINT16
EFIAPI
PciExpressBitFieldWrite16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
- )
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT16) -1;
- }
- return MmioBitFieldWrite16 (
- GetPciExpressAddress (Address),
- StartBit,
- EndBit,
- Value
- );
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT16)-1;
+ }
+
+ return MmioBitFieldWrite16 (
+ GetPciExpressAddress (Address),
+ StartBit,
+ EndBit,
+ Value
+ );
}
/**
@@ -818,21 +836,22 @@ PciExpressBitFieldWrite16 (
UINT16
EFIAPI
PciExpressBitFieldOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
- )
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT16) -1;
- }
- return MmioBitFieldOr16 (
- GetPciExpressAddress (Address),
- StartBit,
- EndBit,
- OrData
- );
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT16)-1;
+ }
+
+ return MmioBitFieldOr16 (
+ GetPciExpressAddress (Address),
+ StartBit,
+ EndBit,
+ OrData
+ );
}
/**
@@ -867,21 +886,22 @@ PciExpressBitFieldOr16 (
UINT16
EFIAPI
PciExpressBitFieldAnd16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
- )
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT16) -1;
- }
- return MmioBitFieldAnd16 (
- GetPciExpressAddress (Address),
- StartBit,
- EndBit,
- AndData
- );
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT16)-1;
+ }
+
+ return MmioBitFieldAnd16 (
+ GetPciExpressAddress (Address),
+ StartBit,
+ EndBit,
+ AndData
+ );
}
/**
@@ -920,23 +940,24 @@ PciExpressBitFieldAnd16 (
UINT16
EFIAPI
PciExpressBitFieldAndThenOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
- )
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT16) -1;
- }
- return MmioBitFieldAndThenOr16 (
- GetPciExpressAddress (Address),
- StartBit,
- EndBit,
- AndData,
- OrData
- );
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT16)-1;
+ }
+
+ return MmioBitFieldAndThenOr16 (
+ GetPciExpressAddress (Address),
+ StartBit,
+ EndBit,
+ AndData,
+ OrData
+ );
}
/**
@@ -959,13 +980,14 @@ PciExpressBitFieldAndThenOr16 (
UINT32
EFIAPI
PciExpressRead32 (
- IN UINTN Address
- )
+ IN UINTN Address
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT32) -1;
- }
- return MmioRead32 (GetPciExpressAddress (Address));
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT32)-1;
+ }
+
+ return MmioRead32 (GetPciExpressAddress (Address));
}
/**
@@ -989,14 +1011,15 @@ PciExpressRead32 (
UINT32
EFIAPI
PciExpressWrite32 (
- IN UINTN Address,
- IN UINT32 Value
- )
+ IN UINTN Address,
+ IN UINT32 Value
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT32) -1;
- }
- return MmioWrite32 (GetPciExpressAddress (Address), Value);
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT32)-1;
+ }
+
+ return MmioWrite32 (GetPciExpressAddress (Address), Value);
}
/**
@@ -1024,14 +1047,15 @@ PciExpressWrite32 (
UINT32
EFIAPI
PciExpressOr32 (
- IN UINTN Address,
- IN UINT32 OrData
- )
+ IN UINTN Address,
+ IN UINT32 OrData
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT32) -1;
- }
- return MmioOr32 (GetPciExpressAddress (Address), OrData);
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT32)-1;
+ }
+
+ return MmioOr32 (GetPciExpressAddress (Address), OrData);
}
/**
@@ -1059,14 +1083,15 @@ PciExpressOr32 (
UINT32
EFIAPI
PciExpressAnd32 (
- IN UINTN Address,
- IN UINT32 AndData
- )
+ IN UINTN Address,
+ IN UINT32 AndData
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT32) -1;
- }
- return MmioAnd32 (GetPciExpressAddress (Address), AndData);
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT32)-1;
+ }
+
+ return MmioAnd32 (GetPciExpressAddress (Address), AndData);
}
/**
@@ -1096,19 +1121,20 @@ PciExpressAnd32 (
UINT32
EFIAPI
PciExpressAndThenOr32 (
- IN UINTN Address,
- IN UINT32 AndData,
- IN UINT32 OrData
- )
+ IN UINTN Address,
+ IN UINT32 AndData,
+ IN UINT32 OrData
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT32) -1;
- }
- return MmioAndThenOr32 (
- GetPciExpressAddress (Address),
- AndData,
- OrData
- );
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT32)-1;
+ }
+
+ return MmioAndThenOr32 (
+ GetPciExpressAddress (Address),
+ AndData,
+ OrData
+ );
}
/**
@@ -1137,19 +1163,20 @@ PciExpressAndThenOr32 (
UINT32
EFIAPI
PciExpressBitFieldRead32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
- )
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT32) -1;
- }
- return MmioBitFieldRead32 (
- GetPciExpressAddress (Address),
- StartBit,
- EndBit
- );
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT32)-1;
+ }
+
+ return MmioBitFieldRead32 (
+ GetPciExpressAddress (Address),
+ StartBit,
+ EndBit
+ );
}
/**
@@ -1181,21 +1208,22 @@ PciExpressBitFieldRead32 (
UINT32
EFIAPI
PciExpressBitFieldWrite32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
- )
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT32) -1;
- }
- return MmioBitFieldWrite32 (
- GetPciExpressAddress (Address),
- StartBit,
- EndBit,
- Value
- );
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT32)-1;
+ }
+
+ return MmioBitFieldWrite32 (
+ GetPciExpressAddress (Address),
+ StartBit,
+ EndBit,
+ Value
+ );
}
/**
@@ -1230,21 +1258,22 @@ PciExpressBitFieldWrite32 (
UINT32
EFIAPI
PciExpressBitFieldOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
- )
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT32) -1;
- }
- return MmioBitFieldOr32 (
- GetPciExpressAddress (Address),
- StartBit,
- EndBit,
- OrData
- );
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT32)-1;
+ }
+
+ return MmioBitFieldOr32 (
+ GetPciExpressAddress (Address),
+ StartBit,
+ EndBit,
+ OrData
+ );
}
/**
@@ -1279,21 +1308,22 @@ PciExpressBitFieldOr32 (
UINT32
EFIAPI
PciExpressBitFieldAnd32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
- )
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT32) -1;
- }
- return MmioBitFieldAnd32 (
- GetPciExpressAddress (Address),
- StartBit,
- EndBit,
- AndData
- );
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT32)-1;
+ }
+
+ return MmioBitFieldAnd32 (
+ GetPciExpressAddress (Address),
+ StartBit,
+ EndBit,
+ AndData
+ );
}
/**
@@ -1332,23 +1362,24 @@ PciExpressBitFieldAnd32 (
UINT32
EFIAPI
PciExpressBitFieldAndThenOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
- )
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
+ )
{
- if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINT32) -1;
- }
- return MmioBitFieldAndThenOr32 (
- GetPciExpressAddress (Address),
- StartBit,
- EndBit,
- AndData,
- OrData
- );
+ if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINT32)-1;
+ }
+
+ return MmioBitFieldAndThenOr32 (
+ GetPciExpressAddress (Address),
+ StartBit,
+ EndBit,
+ AndData,
+ OrData
+ );
}
/**
@@ -1378,87 +1409,87 @@ PciExpressBitFieldAndThenOr32 (
UINTN
EFIAPI
PciExpressReadBuffer (
- IN UINTN StartAddress,
- IN UINTN Size,
- OUT VOID *Buffer
- )
+ IN UINTN StartAddress,
+ IN UINTN Size,
+ OUT VOID *Buffer
+ )
{
- UINTN ReturnValue;
-
- //
- // Make sure Address is valid
- //
- ASSERT_INVALID_PCI_ADDRESS (StartAddress);
- ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
-
- //
- // Make sure the Address is in MMCONF address space
- //
- if (StartAddress >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINTN) -1;
- }
-
- if (Size == 0) {
- return Size;
- }
-
- ASSERT (Buffer != NULL);
-
- //
- // Save Size for return
- //
- ReturnValue = Size;
-
- if ((StartAddress & 1) != 0) {
- //
- // Read a byte if StartAddress is byte aligned
- //
- *(volatile UINT8 *)Buffer = PciExpressRead8 (StartAddress);
- StartAddress += sizeof (UINT8);
- Size -= sizeof (UINT8);
- Buffer = (UINT8*)Buffer + 1;
- }
-
- if (Size >= sizeof (UINT16) && (StartAddress & 2) != 0) {
- //
- // Read a word if StartAddress is word aligned
- //
- WriteUnaligned16 ((UINT16 *) Buffer, (UINT16) PciExpressRead16 (StartAddress));
-
- StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
- }
-
- while (Size >= sizeof (UINT32)) {
- //
- // Read as many double words as possible
- //
- WriteUnaligned32 ((UINT32 *) Buffer, (UINT32) PciExpressRead32 (StartAddress));
-
- StartAddress += sizeof (UINT32);
- Size -= sizeof (UINT32);
- Buffer = (UINT32*)Buffer + 1;
- }
-
- if (Size >= sizeof (UINT16)) {
- //
- // Read the last remaining word if exist
- //
- WriteUnaligned16 ((UINT16 *) Buffer, (UINT16) PciExpressRead16 (StartAddress));
- StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
- }
-
- if (Size >= sizeof (UINT8)) {
- //
- // Read the last remaining byte if exist
- //
- *(volatile UINT8 *)Buffer = PciExpressRead8 (StartAddress);
- }
-
- return ReturnValue;
+ UINTN ReturnValue;
+
+ //
+ // Make sure Address is valid
+ //
+ ASSERT_INVALID_PCI_ADDRESS (StartAddress);
+ ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
+
+ //
+ // Make sure the Address is in MMCONF address space
+ //
+ if (StartAddress >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINTN)-1;
+ }
+
+ if (Size == 0) {
+ return Size;
+ }
+
+ ASSERT (Buffer != NULL);
+
+ //
+ // Save Size for return
+ //
+ ReturnValue = Size;
+
+ if ((StartAddress & 1) != 0) {
+ //
+ // Read a byte if StartAddress is byte aligned
+ //
+ *(volatile UINT8 *)Buffer = PciExpressRead8 (StartAddress);
+ StartAddress += sizeof (UINT8);
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *)Buffer + 1;
+ }
+
+ if ((Size >= sizeof (UINT16)) && ((StartAddress & 2) != 0)) {
+ //
+ // Read a word if StartAddress is word aligned
+ //
+ WriteUnaligned16 ((UINT16 *)Buffer, (UINT16)PciExpressRead16 (StartAddress));
+
+ StartAddress += sizeof (UINT16);
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
+ }
+
+ while (Size >= sizeof (UINT32)) {
+ //
+ // Read as many double words as possible
+ //
+ WriteUnaligned32 ((UINT32 *)Buffer, (UINT32)PciExpressRead32 (StartAddress));
+
+ StartAddress += sizeof (UINT32);
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *)Buffer + 1;
+ }
+
+ if (Size >= sizeof (UINT16)) {
+ //
+ // Read the last remaining word if exist
+ //
+ WriteUnaligned16 ((UINT16 *)Buffer, (UINT16)PciExpressRead16 (StartAddress));
+ StartAddress += sizeof (UINT16);
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
+ }
+
+ if (Size >= sizeof (UINT8)) {
+ //
+ // Read the last remaining byte if exist
+ //
+ *(volatile UINT8 *)Buffer = PciExpressRead8 (StartAddress);
+ }
+
+ return ReturnValue;
}
/**
@@ -1489,84 +1520,83 @@ PciExpressReadBuffer (
UINTN
EFIAPI
PciExpressWriteBuffer (
- IN UINTN StartAddress,
- IN UINTN Size,
- IN VOID *Buffer
- )
+ IN UINTN StartAddress,
+ IN UINTN Size,
+ IN VOID *Buffer
+ )
{
- UINTN ReturnValue;
-
- //
- // Make sure Address is valid
- //
- ASSERT_INVALID_PCI_ADDRESS (StartAddress);
- ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
-
- //
- // Make sure the Address is in MMCONF address space
- //
- if (StartAddress >= mSmmPciExpressLibPciExpressBaseSize) {
- return (UINTN) -1;
- }
-
-
- if (Size == 0) {
- return 0;
- }
-
- ASSERT (Buffer != NULL);
-
- //
- // Save Size for return
- //
- ReturnValue = Size;
-
- if ((StartAddress & 1) != 0) {
- //
- // Write a byte if StartAddress is byte aligned
- //
- PciExpressWrite8 (StartAddress, *(UINT8*)Buffer);
- StartAddress += sizeof (UINT8);
- Size -= sizeof (UINT8);
- Buffer = (UINT8*)Buffer + 1;
- }
-
- if (Size >= sizeof (UINT16) && (StartAddress & 2) != 0) {
- //
- // Write a word if StartAddress is word aligned
- //
- PciExpressWrite16 (StartAddress, ReadUnaligned16 ((UINT16*)Buffer));
- StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
- }
-
- while (Size >= sizeof (UINT32)) {
- //
- // Write as many double words as possible
- //
- PciExpressWrite32 (StartAddress, ReadUnaligned32 ((UINT32*)Buffer));
- StartAddress += sizeof (UINT32);
- Size -= sizeof (UINT32);
- Buffer = (UINT32*)Buffer + 1;
- }
-
- if (Size >= sizeof (UINT16)) {
- //
- // Write the last remaining word if exist
- //
- PciExpressWrite16 (StartAddress, ReadUnaligned16 ((UINT16*)Buffer));
- StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
- }
-
- if (Size >= sizeof (UINT8)) {
- //
- // Write the last remaining byte if exist
- //
- PciExpressWrite8 (StartAddress, *(UINT8*)Buffer);
- }
-
- return ReturnValue;
+ UINTN ReturnValue;
+
+ //
+ // Make sure Address is valid
+ //
+ ASSERT_INVALID_PCI_ADDRESS (StartAddress);
+ ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
+
+ //
+ // Make sure the Address is in MMCONF address space
+ //
+ if (StartAddress >= mSmmPciExpressLibPciExpressBaseSize) {
+ return (UINTN)-1;
+ }
+
+ if (Size == 0) {
+ return 0;
+ }
+
+ ASSERT (Buffer != NULL);
+
+ //
+ // Save Size for return
+ //
+ ReturnValue = Size;
+
+ if ((StartAddress & 1) != 0) {
+ //
+ // Write a byte if StartAddress is byte aligned
+ //
+ PciExpressWrite8 (StartAddress, *(UINT8 *)Buffer);
+ StartAddress += sizeof (UINT8);
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *)Buffer + 1;
+ }
+
+ if ((Size >= sizeof (UINT16)) && ((StartAddress & 2) != 0)) {
+ //
+ // Write a word if StartAddress is word aligned
+ //
+ PciExpressWrite16 (StartAddress, ReadUnaligned16 ((UINT16 *)Buffer));
+ StartAddress += sizeof (UINT16);
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
+ }
+
+ while (Size >= sizeof (UINT32)) {
+ //
+ // Write as many double words as possible
+ //
+ PciExpressWrite32 (StartAddress, ReadUnaligned32 ((UINT32 *)Buffer));
+ StartAddress += sizeof (UINT32);
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *)Buffer + 1;
+ }
+
+ if (Size >= sizeof (UINT16)) {
+ //
+ // Write the last remaining word if exist
+ //
+ PciExpressWrite16 (StartAddress, ReadUnaligned16 ((UINT16 *)Buffer));
+ StartAddress += sizeof (UINT16);
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
+ }
+
+ if (Size >= sizeof (UINT8)) {
+ //
+ // Write the last remaining byte if exist
+ //
+ PciExpressWrite8 (StartAddress, *(UINT8 *)Buffer);
+ }
+
+ return ReturnValue;
}
diff --git a/MdePkg/Library/SmmPciLibPciRootBridgeIo/PciLib.c b/MdePkg/Library/SmmPciLibPciRootBridgeIo/PciLib.c
index 49ea99ce1f..1503ebb3fd 100644
--- a/MdePkg/Library/SmmPciLibPciRootBridgeIo/PciLib.c
+++ b/MdePkg/Library/SmmPciLibPciRootBridgeIo/PciLib.c
@@ -12,7 +12,6 @@
#include <Library/BaseLib.h>
#include <Library/SmmServicesTableLib.h>
-
/**
Assert the validity of a PCI address. A valid PCI address should contain 1's
only in the low 28 bits.
@@ -21,7 +20,7 @@
@param M Additional bits to assert to be zero.
**/
-#define ASSERT_INVALID_PCI_ADDRESS(A,M) \
+#define ASSERT_INVALID_PCI_ADDRESS(A, M) \
ASSERT (((A) & (~0xfffffff | (M))) == 0)
/**
@@ -37,7 +36,7 @@
//
// Global variable to cache pointer to PCI Root Bridge I/O protocol.
//
-EFI_SMM_PCI_ROOT_BRIDGE_IO_PROTOCOL *mSmmPciRootBridgeIo = NULL;
+EFI_SMM_PCI_ROOT_BRIDGE_IO_PROTOCOL *mSmmPciRootBridgeIo = NULL;
/**
The constructor function caches the pointer to PCI Root Bridge I/O protocol.
@@ -54,13 +53,13 @@ EFI_SMM_PCI_ROOT_BRIDGE_IO_PROTOCOL *mSmmPciRootBridgeIo = NULL;
EFI_STATUS
EFIAPI
PciLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
- Status = gSmst->SmmLocateProtocol (&gEfiSmmPciRootBridgeIoProtocolGuid, NULL, (VOID**) &mSmmPciRootBridgeIo);
+ Status = gSmst->SmmLocateProtocol (&gEfiSmmPciRootBridgeIoProtocolGuid, NULL, (VOID **)&mSmmPciRootBridgeIo);
ASSERT_EFI_ERROR (Status);
ASSERT (mSmmPciRootBridgeIo != NULL);
@@ -90,12 +89,12 @@ SmmPciLibPciRootBridgeIoReadWorker (
UINT32 Data;
mSmmPciRootBridgeIo->Pci.Read (
- mSmmPciRootBridgeIo,
- Width,
- PCI_TO_PCI_ROOT_BRIDGE_IO_ADDRESS (Address),
- 1,
- &Data
- );
+ mSmmPciRootBridgeIo,
+ Width,
+ PCI_TO_PCI_ROOT_BRIDGE_IO_ADDRESS (Address),
+ 1,
+ &Data
+ );
return Data;
}
@@ -124,12 +123,12 @@ SmmPciLibPciRootBridgeIoWriteWorker (
)
{
mSmmPciRootBridgeIo->Pci.Write (
- mSmmPciRootBridgeIo,
- Width,
- PCI_TO_PCI_ROOT_BRIDGE_IO_ADDRESS (Address),
- 1,
- &Data
- );
+ mSmmPciRootBridgeIo,
+ Width,
+ PCI_TO_PCI_ROOT_BRIDGE_IO_ADDRESS (Address),
+ 1,
+ &Data
+ );
return Data;
}
@@ -182,12 +181,12 @@ PciRegisterForRuntimeAccess (
UINT8
EFIAPI
PciRead8 (
- IN UINTN Address
+ IN UINTN Address
)
{
ASSERT_INVALID_PCI_ADDRESS (Address, 0);
- return (UINT8) SmmPciLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint8);
+ return (UINT8)SmmPciLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint8);
}
/**
@@ -209,13 +208,13 @@ PciRead8 (
UINT8
EFIAPI
PciWrite8 (
- IN UINTN Address,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINT8 Value
)
{
ASSERT_INVALID_PCI_ADDRESS (Address, 0);
- return (UINT8) SmmPciLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint8, Value);
+ return (UINT8)SmmPciLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint8, Value);
}
/**
@@ -241,11 +240,11 @@ PciWrite8 (
UINT8
EFIAPI
PciOr8 (
- IN UINTN Address,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 OrData
)
{
- return PciWrite8 (Address, (UINT8) (PciRead8 (Address) | OrData));
+ return PciWrite8 (Address, (UINT8)(PciRead8 (Address) | OrData));
}
/**
@@ -271,11 +270,11 @@ PciOr8 (
UINT8
EFIAPI
PciAnd8 (
- IN UINTN Address,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINT8 AndData
)
{
- return PciWrite8 (Address, (UINT8) (PciRead8 (Address) & AndData));
+ return PciWrite8 (Address, (UINT8)(PciRead8 (Address) & AndData));
}
/**
@@ -303,12 +302,12 @@ PciAnd8 (
UINT8
EFIAPI
PciAndThenOr8 (
- IN UINTN Address,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
- return PciWrite8 (Address, (UINT8) ((PciRead8 (Address) & AndData) | OrData));
+ return PciWrite8 (Address, (UINT8)((PciRead8 (Address) & AndData) | OrData));
}
/**
@@ -335,9 +334,9 @@ PciAndThenOr8 (
UINT8
EFIAPI
PciBitFieldRead8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead8 (PciRead8 (Address), StartBit, EndBit);
@@ -370,10 +369,10 @@ PciBitFieldRead8 (
UINT8
EFIAPI
PciBitFieldWrite8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
return PciWrite8 (
@@ -412,10 +411,10 @@ PciBitFieldWrite8 (
UINT8
EFIAPI
PciBitFieldOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
return PciWrite8 (
@@ -454,10 +453,10 @@ PciBitFieldOr8 (
UINT8
EFIAPI
PciBitFieldAnd8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
return PciWrite8 (
@@ -500,11 +499,11 @@ PciBitFieldAnd8 (
UINT8
EFIAPI
PciBitFieldAndThenOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
return PciWrite8 (
@@ -532,12 +531,12 @@ PciBitFieldAndThenOr8 (
UINT16
EFIAPI
PciRead16 (
- IN UINTN Address
+ IN UINTN Address
)
{
ASSERT_INVALID_PCI_ADDRESS (Address, 1);
- return (UINT16) SmmPciLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint16);
+ return (UINT16)SmmPciLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint16);
}
/**
@@ -560,13 +559,13 @@ PciRead16 (
UINT16
EFIAPI
PciWrite16 (
- IN UINTN Address,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINT16 Value
)
{
ASSERT_INVALID_PCI_ADDRESS (Address, 1);
- return (UINT16) SmmPciLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint16, Value);
+ return (UINT16)SmmPciLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint16, Value);
}
/**
@@ -593,11 +592,11 @@ PciWrite16 (
UINT16
EFIAPI
PciOr16 (
- IN UINTN Address,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 OrData
)
{
- return PciWrite16 (Address, (UINT16) (PciRead16 (Address) | OrData));
+ return PciWrite16 (Address, (UINT16)(PciRead16 (Address) | OrData));
}
/**
@@ -624,11 +623,11 @@ PciOr16 (
UINT16
EFIAPI
PciAnd16 (
- IN UINTN Address,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINT16 AndData
)
{
- return PciWrite16 (Address, (UINT16) (PciRead16 (Address) & AndData));
+ return PciWrite16 (Address, (UINT16)(PciRead16 (Address) & AndData));
}
/**
@@ -657,12 +656,12 @@ PciAnd16 (
UINT16
EFIAPI
PciAndThenOr16 (
- IN UINTN Address,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
- return PciWrite16 (Address, (UINT16) ((PciRead16 (Address) & AndData) | OrData));
+ return PciWrite16 (Address, (UINT16)((PciRead16 (Address) & AndData) | OrData));
}
/**
@@ -690,9 +689,9 @@ PciAndThenOr16 (
UINT16
EFIAPI
PciBitFieldRead16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead16 (PciRead16 (Address), StartBit, EndBit);
@@ -726,10 +725,10 @@ PciBitFieldRead16 (
UINT16
EFIAPI
PciBitFieldWrite16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
return PciWrite16 (
@@ -769,10 +768,10 @@ PciBitFieldWrite16 (
UINT16
EFIAPI
PciBitFieldOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
return PciWrite16 (
@@ -812,10 +811,10 @@ PciBitFieldOr16 (
UINT16
EFIAPI
PciBitFieldAnd16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
return PciWrite16 (
@@ -859,11 +858,11 @@ PciBitFieldAnd16 (
UINT16
EFIAPI
PciBitFieldAndThenOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
return PciWrite16 (
@@ -891,7 +890,7 @@ PciBitFieldAndThenOr16 (
UINT32
EFIAPI
PciRead32 (
- IN UINTN Address
+ IN UINTN Address
)
{
ASSERT_INVALID_PCI_ADDRESS (Address, 3);
@@ -919,8 +918,8 @@ PciRead32 (
UINT32
EFIAPI
PciWrite32 (
- IN UINTN Address,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINT32 Value
)
{
ASSERT_INVALID_PCI_ADDRESS (Address, 3);
@@ -952,8 +951,8 @@ PciWrite32 (
UINT32
EFIAPI
PciOr32 (
- IN UINTN Address,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 OrData
)
{
return PciWrite32 (Address, PciRead32 (Address) | OrData);
@@ -983,8 +982,8 @@ PciOr32 (
UINT32
EFIAPI
PciAnd32 (
- IN UINTN Address,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINT32 AndData
)
{
return PciWrite32 (Address, PciRead32 (Address) & AndData);
@@ -1016,9 +1015,9 @@ PciAnd32 (
UINT32
EFIAPI
PciAndThenOr32 (
- IN UINTN Address,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return PciWrite32 (Address, (PciRead32 (Address) & AndData) | OrData);
@@ -1049,9 +1048,9 @@ PciAndThenOr32 (
UINT32
EFIAPI
PciBitFieldRead32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead32 (PciRead32 (Address), StartBit, EndBit);
@@ -1085,10 +1084,10 @@ PciBitFieldRead32 (
UINT32
EFIAPI
PciBitFieldWrite32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
return PciWrite32 (
@@ -1128,10 +1127,10 @@ PciBitFieldWrite32 (
UINT32
EFIAPI
PciBitFieldOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
return PciWrite32 (
@@ -1171,10 +1170,10 @@ PciBitFieldOr32 (
UINT32
EFIAPI
PciBitFieldAnd32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
return PciWrite32 (
@@ -1218,11 +1217,11 @@ PciBitFieldAnd32 (
UINT32
EFIAPI
PciBitFieldAndThenOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return PciWrite32 (
@@ -1257,12 +1256,12 @@ PciBitFieldAndThenOr32 (
UINTN
EFIAPI
PciReadBuffer (
- IN UINTN StartAddress,
- IN UINTN Size,
- OUT VOID *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Size,
+ OUT VOID *Buffer
)
{
- UINTN ReturnValue;
+ UINTN ReturnValue;
ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
@@ -1283,19 +1282,19 @@ PciReadBuffer (
// Read a byte if StartAddress is byte aligned
//
*(volatile UINT8 *)Buffer = PciRead8 (StartAddress);
- StartAddress += sizeof (UINT8);
- Size -= sizeof (UINT8);
- Buffer = (UINT8*)Buffer + 1;
+ StartAddress += sizeof (UINT8);
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *)Buffer + 1;
}
- if (Size >= sizeof (UINT16) && (StartAddress & BIT1) != 0) {
+ if ((Size >= sizeof (UINT16)) && ((StartAddress & BIT1) != 0)) {
//
// Read a word if StartAddress is word aligned
//
WriteUnaligned16 (Buffer, PciRead16 (StartAddress));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
while (Size >= sizeof (UINT32)) {
@@ -1304,8 +1303,8 @@ PciReadBuffer (
//
WriteUnaligned32 (Buffer, PciRead32 (StartAddress));
StartAddress += sizeof (UINT32);
- Size -= sizeof (UINT32);
- Buffer = (UINT32*)Buffer + 1;
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *)Buffer + 1;
}
if (Size >= sizeof (UINT16)) {
@@ -1314,8 +1313,8 @@ PciReadBuffer (
//
WriteUnaligned16 (Buffer, PciRead16 (StartAddress));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
if (Size >= sizeof (UINT8)) {
@@ -1355,12 +1354,12 @@ PciReadBuffer (
UINTN
EFIAPI
PciWriteBuffer (
- IN UINTN StartAddress,
- IN UINTN Size,
- IN VOID *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Size,
+ IN VOID *Buffer
)
{
- UINTN ReturnValue;
+ UINTN ReturnValue;
ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
@@ -1380,20 +1379,20 @@ PciWriteBuffer (
//
// Write a byte if StartAddress is byte aligned
//
- PciWrite8 (StartAddress, *(UINT8*)Buffer);
+ PciWrite8 (StartAddress, *(UINT8 *)Buffer);
StartAddress += sizeof (UINT8);
- Size -= sizeof (UINT8);
- Buffer = (UINT8*)Buffer + 1;
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *)Buffer + 1;
}
- if (Size >= sizeof (UINT16) && (StartAddress & BIT1) != 0) {
+ if ((Size >= sizeof (UINT16)) && ((StartAddress & BIT1) != 0)) {
//
// Write a word if StartAddress is word aligned
//
PciWrite16 (StartAddress, ReadUnaligned16 (Buffer));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
while (Size >= sizeof (UINT32)) {
@@ -1402,8 +1401,8 @@ PciWriteBuffer (
//
PciWrite32 (StartAddress, ReadUnaligned32 (Buffer));
StartAddress += sizeof (UINT32);
- Size -= sizeof (UINT32);
- Buffer = (UINT32*)Buffer + 1;
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *)Buffer + 1;
}
if (Size >= sizeof (UINT16)) {
@@ -1412,15 +1411,15 @@ PciWriteBuffer (
//
PciWrite16 (StartAddress, ReadUnaligned16 (Buffer));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
if (Size >= sizeof (UINT8)) {
//
// Write the last remaining byte if exist
//
- PciWrite8 (StartAddress, *(UINT8*)Buffer);
+ PciWrite8 (StartAddress, *(UINT8 *)Buffer);
}
return ReturnValue;
diff --git a/MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.c b/MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.c
index 838fe42fe8..ff143f00ab 100644
--- a/MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.c
+++ b/MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.c
@@ -38,104 +38,104 @@ typedef struct {
///
/// Signature value that must be set to PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT_SIGNATURE
///
- UINT32 Signature;
+ UINT32 Signature;
///
/// The link entry to be inserted to the list of periodic SMI handlers.
///
- LIST_ENTRY Link;
+ LIST_ENTRY Link;
///
/// The dispatch function to called to invoke an enabled periodic SMI handler.
///
- PERIODIC_SMI_LIBRARY_HANDLER DispatchFunction;
+ PERIODIC_SMI_LIBRARY_HANDLER DispatchFunction;
///
/// The context to pass into DispatchFunction
///
- VOID *Context;
+ VOID *Context;
///
/// The tick period in 100 ns units that DispatchFunction should be called.
///
- UINT64 TickPeriod;
+ UINT64 TickPeriod;
///
/// The Cpu number that is required to execute DispatchFunction. If Cpu is
/// set to PERIODIC_SMI_LIBRARY_ANY_CPU, then DispatchFunction may be executed
/// on any CPU.
///
- UINTN Cpu;
+ UINTN Cpu;
///
/// The size, in bytes, of the stack allocated for a periodic SMI handler.
/// This value must be a multiple of EFI_PAGE_SIZE.
///
- UINTN StackSize;
+ UINTN StackSize;
///
/// A pointer to the stack allocated using AllocatePages(). This field will
/// be NULL if StackSize is 0.
///
- VOID *Stack;
+ VOID *Stack;
///
/// Spin lock used to wait for an AP to complete the execution of a periodic SMI handler
///
- SPIN_LOCK DispatchLock;
+ SPIN_LOCK DispatchLock;
///
/// The rate in Hz of the performance counter that is used to measure the
/// amount of time that a periodic SMI handler executes.
///
- UINT64 PerfomanceCounterRate;
+ UINT64 PerfomanceCounterRate;
///
/// The start count value of the performance counter that is used to measure
/// the amount of time that a periodic SMI handler executes.
///
- UINT64 PerfomanceCounterStartValue;
+ UINT64 PerfomanceCounterStartValue;
///
/// The end count value of the performance counter that is used to measure
/// the amount of time that a periodic SMI handler executes.
///
- UINT64 PerfomanceCounterEndValue;
+ UINT64 PerfomanceCounterEndValue;
///
/// The context record passed into the Register() function of the SMM Periodic
/// Timer Dispatch Protocol when a periodic SMI handler is enabled.
///
- EFI_SMM_PERIODIC_TIMER_REGISTER_CONTEXT RegisterContext;
+ EFI_SMM_PERIODIC_TIMER_REGISTER_CONTEXT RegisterContext;
///
/// The handle returned from the Register() function of the SMM Periodic
/// Timer Dispatch Protocol when a periodic SMI handler is enabled.
///
- EFI_HANDLE DispatchHandle;
+ EFI_HANDLE DispatchHandle;
///
/// The total number of performance counter ticks that the periodic SMI handler
/// has been executing in its current invocation.
///
- UINT64 DispatchTotalTime;
+ UINT64 DispatchTotalTime;
///
/// The performance counter value that was captured the last time that the
/// periodic SMI handler called PeriodicSmiExecutionTime(). This allows the
/// time value returned by PeriodicSmiExecutionTime() to be accurate even when
/// the performance counter rolls over.
///
- UINT64 DispatchCheckPointTime;
+ UINT64 DispatchCheckPointTime;
///
/// Buffer used to save the context when control is transfer from this library
/// to an enabled periodic SMI handler. This saved context is used when the
/// periodic SMI handler exits or yields.
///
- BASE_LIBRARY_JUMP_BUFFER DispatchJumpBuffer;
+ BASE_LIBRARY_JUMP_BUFFER DispatchJumpBuffer;
///
/// Flag that is set to TRUE when a periodic SMI handler requests to yield
/// using PeriodicSmiYield(). When this flag IS TRUE, YieldJumpBuffer is
/// valid. When this flag is FALSE, YieldJumpBuffer is not valid.
///
- BOOLEAN YieldFlag;
+ BOOLEAN YieldFlag;
///
/// Buffer used to save the context when a periodic SMI handler requests to
/// yield using PeriodicSmiYield(). This context is used to resume the
/// execution of a periodic SMI handler the next time control is transferred
/// to the periodic SMI handler that yielded.
///
- BASE_LIBRARY_JUMP_BUFFER YieldJumpBuffer;
+ BASE_LIBRARY_JUMP_BUFFER YieldJumpBuffer;
///
/// The amount of time, in 100 ns units, that have elapsed since the last
/// time the periodic SMI handler was invoked.
///
- UINT64 ElapsedTime;
+ UINT64 ElapsedTime;
} PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT;
/**
@@ -154,7 +154,7 @@ typedef struct {
///
/// Pointer to the SMM Periodic Timer Dispatch Protocol that was located in the constructor.
///
-EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL *gSmmPeriodicTimerDispatch2 = NULL;
+EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL *gSmmPeriodicTimerDispatch2 = NULL;
///
/// Pointer to a table of supported periodic SMI tick periods in 100 ns units
@@ -163,25 +163,25 @@ EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL *gSmmPeriodicTimerDispatch2
/// in based on the values returned from the SMM Periodic Timer Dispatch 2 Protocol
/// function GetNextShorterInterval().
///
-UINT64 *gSmiTickPeriodTable = NULL;
+UINT64 *gSmiTickPeriodTable = NULL;
///
/// Linked list of free periodic SMI handlers that this library can use.
///
-LIST_ENTRY gFreePeriodicSmiLibraryHandlers =
- INITIALIZE_LIST_HEAD_VARIABLE (gFreePeriodicSmiLibraryHandlers);
+LIST_ENTRY gFreePeriodicSmiLibraryHandlers =
+ INITIALIZE_LIST_HEAD_VARIABLE (gFreePeriodicSmiLibraryHandlers);
///
/// Linked list of periodic SMI handlers that this library is currently managing.
///
-LIST_ENTRY gPeriodicSmiLibraryHandlers =
- INITIALIZE_LIST_HEAD_VARIABLE (gPeriodicSmiLibraryHandlers);
+LIST_ENTRY gPeriodicSmiLibraryHandlers =
+ INITIALIZE_LIST_HEAD_VARIABLE (gPeriodicSmiLibraryHandlers);
///
/// Pointer to the periodic SMI handler that is currently being executed.
/// Is set to NULL if no periodic SMI handler is currently being executed.
///
-PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *gActivePeriodicSmiLibraryHandler = NULL;
+PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *gActivePeriodicSmiLibraryHandler = NULL;
/**
Internal worker function that returns a pointer to the
@@ -226,7 +226,7 @@ GetActivePeriodicSmiLibraryHandler (
**/
PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *
LookupPeriodicSmiLibraryHandler (
- IN EFI_HANDLE DispatchHandle OPTIONAL
+ IN EFI_HANDLE DispatchHandle OPTIONAL
)
{
LIST_ENTRY *Link;
@@ -243,9 +243,10 @@ LookupPeriodicSmiLibraryHandler (
// Search the periodic SMI handler entries for a a matching DispatchHandle
//
for ( Link = GetFirstNode (&gPeriodicSmiLibraryHandlers)
- ; !IsNull (&gPeriodicSmiLibraryHandlers, Link)
- ; Link = GetNextNode (&gPeriodicSmiLibraryHandlers, Link)
- ) {
+ ; !IsNull (&gPeriodicSmiLibraryHandlers, Link)
+ ; Link = GetNextNode (&gPeriodicSmiLibraryHandlers, Link)
+ )
+ {
PeriodicSmiLibraryHandler = PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT_FROM_LINK (Link);
if (PeriodicSmiLibraryHandler->DispatchHandle == DispatchHandle) {
@@ -279,7 +280,7 @@ LookupPeriodicSmiLibraryHandler (
**/
PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *
SetActivePeriodicSmiLibraryHandler (
- IN EFI_HANDLE DispatchHandle OPTIONAL
+ IN EFI_HANDLE DispatchHandle OPTIONAL
)
{
if (DispatchHandle == NULL) {
@@ -287,6 +288,7 @@ SetActivePeriodicSmiLibraryHandler (
} else {
gActivePeriodicSmiLibraryHandler = LookupPeriodicSmiLibraryHandler (DispatchHandle);
}
+
return gActivePeriodicSmiLibraryHandler;
}
@@ -298,7 +300,7 @@ SetActivePeriodicSmiLibraryHandler (
**/
VOID
ReclaimPeriodicSmiLibraryHandler (
- PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *PeriodicSmiLibraryHandler
+ PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *PeriodicSmiLibraryHandler
)
{
ASSERT (PeriodicSmiLibraryHandler->DispatchHandle == NULL);
@@ -309,6 +311,7 @@ ReclaimPeriodicSmiLibraryHandler (
);
PeriodicSmiLibraryHandler->Stack = NULL;
}
+
RemoveEntryList (&PeriodicSmiLibraryHandler->Link);
InsertHeadList (&gFreePeriodicSmiLibraryHandlers, &PeriodicSmiLibraryHandler->Link);
}
@@ -337,11 +340,12 @@ EnlargeFreePeriodicSmiLibraryHandlerList (
if (PeriodicSmiLibraryHandler == NULL) {
break;
}
+
PeriodicSmiLibraryHandler->Signature = PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT_SIGNATURE;
InsertHeadList (&gFreePeriodicSmiLibraryHandlers, &PeriodicSmiLibraryHandler->Link);
}
- return (BOOLEAN) (Index > 0);
+ return (BOOLEAN)(Index > 0);
}
/**
@@ -515,7 +519,7 @@ PeriodicSmiExit (
// Must never return
//
ASSERT (FALSE);
- CpuDeadLoop();
+ CpuDeadLoop ();
}
/**
@@ -623,9 +627,9 @@ PeriodicSmiDispatchFunctionSwitchStack (
// periodic SMI handler was dispatched.
//
PeriodicSmiLibraryHandler->DispatchFunction (
- PeriodicSmiLibraryHandler->Context,
- PeriodicSmiLibraryHandler->ElapsedTime
- );
+ PeriodicSmiLibraryHandler->Context,
+ PeriodicSmiLibraryHandler->ElapsedTime
+ );
//
// If this DispatchFunction() returns, then unconditionally call PeriodicSmiExit()
@@ -667,7 +671,7 @@ PeriodicSmiDispatchFunctionOnCpu (
// calculated.
//
PeriodicSmiLibraryHandler->DispatchTotalTime = 0;
- PeriodicSmiLibraryHandler->DispatchCheckPointTime = GetPerformanceCounter();
+ PeriodicSmiLibraryHandler->DispatchCheckPointTime = GetPerformanceCounter ();
if (PeriodicSmiLibraryHandler->YieldFlag) {
//
@@ -682,9 +686,9 @@ PeriodicSmiDispatchFunctionOnCpu (
// elapsed since the previous time this periodic SMI handler was dispatched.
//
PeriodicSmiLibraryHandler->DispatchFunction (
- PeriodicSmiLibraryHandler->Context,
- PeriodicSmiLibraryHandler->ElapsedTime
- );
+ PeriodicSmiLibraryHandler->Context,
+ PeriodicSmiLibraryHandler->ElapsedTime
+ );
//
// If this DispatchFunction() returns, then unconditionally call PeriodicSmiExit()
@@ -707,7 +711,7 @@ PeriodicSmiDispatchFunctionOnCpu (
// Must never return
//
ASSERT (FALSE);
- CpuDeadLoop();
+ CpuDeadLoop ();
}
/**
@@ -794,7 +798,7 @@ PeriodicSmiDispatchFunction (
//
PeriodicSmiLibraryHandler->ElapsedTime = 0;
if (CommBuffer != NULL) {
- TimerContext = (EFI_SMM_PERIODIC_TIMER_CONTEXT *)CommBuffer;
+ TimerContext = (EFI_SMM_PERIODIC_TIMER_CONTEXT *)CommBuffer;
PeriodicSmiLibraryHandler->ElapsedTime = TimerContext->ElapsedTime;
}
@@ -802,7 +806,8 @@ PeriodicSmiDispatchFunction (
// Dispatch the periodic SMI handler
//
if ((PeriodicSmiLibraryHandler->Cpu == PERIODIC_SMI_LIBRARY_ANY_CPU) ||
- (PeriodicSmiLibraryHandler->Cpu == gSmst->CurrentlyExecutingCpu) ) {
+ (PeriodicSmiLibraryHandler->Cpu == gSmst->CurrentlyExecutingCpu))
+ {
//
// Dispatch on the currently execution CPU if the CPU specified in PeriodicSmiEnable()
// was PERIODIC_SMI_LIBRARY_ANY_CPU or the currently executing CPU matches the CPU
@@ -922,18 +927,19 @@ PeriodicSmiEnable (
break;
}
}
+
if (gSmiTickPeriodTable[Index] == 0) {
return EFI_UNSUPPORTED;
}
- if (Cpu != PERIODIC_SMI_LIBRARY_ANY_CPU && Cpu >= gSmst->NumberOfCpus) {
+ if ((Cpu != PERIODIC_SMI_LIBRARY_ANY_CPU) && (Cpu >= gSmst->NumberOfCpus)) {
return EFI_INVALID_PARAMETER;
}
//
// Find a free periodic SMI handler entry
//
- PeriodicSmiLibraryHandler = FindFreePeriodicSmiLibraryHandler();
+ PeriodicSmiLibraryHandler = FindFreePeriodicSmiLibraryHandler ();
if (PeriodicSmiLibraryHandler == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@@ -952,10 +958,12 @@ PeriodicSmiEnable (
if (PeriodicSmiLibraryHandler->Stack == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
ZeroMem (PeriodicSmiLibraryHandler->Stack, PeriodicSmiLibraryHandler->StackSize);
} else {
PeriodicSmiLibraryHandler->Stack = NULL;
}
+
InitializeSpinLock (&PeriodicSmiLibraryHandler->DispatchLock);
PeriodicSmiLibraryHandler->PerfomanceCounterRate = GetPerformanceCounterProperties (
&PeriodicSmiLibraryHandler->PerfomanceCounterStartValue,
@@ -963,12 +971,12 @@ PeriodicSmiEnable (
);
PeriodicSmiLibraryHandler->RegisterContext.Period = TickPeriod;
PeriodicSmiLibraryHandler->RegisterContext.SmiTickInterval = TickPeriod;
- Status = gSmmPeriodicTimerDispatch2->Register (
- gSmmPeriodicTimerDispatch2,
- PeriodicSmiDispatchFunction,
- &PeriodicSmiLibraryHandler->RegisterContext,
- &PeriodicSmiLibraryHandler->DispatchHandle
- );
+ Status = gSmmPeriodicTimerDispatch2->Register (
+ gSmmPeriodicTimerDispatch2,
+ PeriodicSmiDispatchFunction,
+ &PeriodicSmiLibraryHandler->RegisterContext,
+ &PeriodicSmiLibraryHandler->DispatchHandle
+ );
if (EFI_ERROR (Status)) {
PeriodicSmiLibraryHandler->DispatchHandle = NULL;
ReclaimPeriodicSmiLibraryHandler (PeriodicSmiLibraryHandler);
@@ -981,6 +989,7 @@ PeriodicSmiEnable (
if (DispatchHandle != NULL) {
*DispatchHandle = PeriodicSmiLibraryHandler->DispatchHandle;
}
+
return EFI_SUCCESS;
}
@@ -1080,7 +1089,7 @@ SmmPeriodicSmiLibConstructor (
// Dispatch 2 Protocol supports.
//
SmiTickInterval = NULL;
- Count = 0;
+ Count = 0;
do {
Status = gSmmPeriodicTimerDispatch2->GetNextShorterInterval (
gSmmPeriodicTimerDispatch2,
@@ -1099,16 +1108,17 @@ SmmPeriodicSmiLibConstructor (
// Fill in the table of supported periodic SMI tick periods.
//
SmiTickInterval = NULL;
- Count = 0;
+ Count = 0;
do {
gSmiTickPeriodTable[Count] = 0;
- Status = gSmmPeriodicTimerDispatch2->GetNextShorterInterval (
- gSmmPeriodicTimerDispatch2,
- &SmiTickInterval
- );
+ Status = gSmmPeriodicTimerDispatch2->GetNextShorterInterval (
+ gSmmPeriodicTimerDispatch2,
+ &SmiTickInterval
+ );
if (SmiTickInterval != NULL) {
gSmiTickPeriodTable[Count] = *SmiTickInterval;
}
+
Count++;
} while (SmiTickInterval != NULL);
@@ -1152,7 +1162,7 @@ SmmPeriodicSmiLibDestructor (
//
for (Link = GetFirstNode (&gPeriodicSmiLibraryHandlers); !IsNull (&gPeriodicSmiLibraryHandlers, Link);) {
PeriodicSmiLibraryHandler = PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT_FROM_LINK (Link);
- Link = GetNextNode (&gPeriodicSmiLibraryHandlers, Link);
+ Link = GetNextNode (&gPeriodicSmiLibraryHandlers, Link);
PeriodicSmiDisable (PeriodicSmiLibraryHandler->DispatchHandle);
}
@@ -1161,7 +1171,7 @@ SmmPeriodicSmiLibDestructor (
//
for (Link = GetFirstNode (&gFreePeriodicSmiLibraryHandlers); !IsNull (&gFreePeriodicSmiLibraryHandlers, Link);) {
PeriodicSmiLibraryHandler = PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT_FROM_LINK (Link);
- Link = RemoveEntryList (Link);
+ Link = RemoveEntryList (Link);
FreePool (PeriodicSmiLibraryHandler);
}
diff --git a/MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.c b/MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.c
index 0f611cd25d..73e76af219 100644
--- a/MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.c
+++ b/MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.c
@@ -11,7 +11,7 @@
#include <Library/SmmServicesTableLib.h>
#include <Library/DebugLib.h>
-EFI_SMM_SYSTEM_TABLE2 *gSmst = NULL;
+EFI_SMM_SYSTEM_TABLE2 *gSmst = NULL;
/**
The constructor function caches the pointer of SMM Services Table.
diff --git a/MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.c b/MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.c
index d74c9bdfed..ff1c53b185 100644
--- a/MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.c
+++ b/MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.c
@@ -31,7 +31,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
EFI_STATUS
EFIAPI
_DriverUnloadHandler (
- EFI_HANDLE ImageHandle
+ EFI_HANDLE ImageHandle
)
{
EFI_STATUS Status;
@@ -81,8 +81,8 @@ _DriverUnloadHandler (
EFI_STATUS
EFIAPI
_ModuleEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN IN EFI_MM_SYSTEM_TABLE *MmSystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN IN EFI_MM_SYSTEM_TABLE *MmSystemTable
)
{
EFI_STATUS Status;
diff --git a/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c b/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c
index 70b4d10ef6..e3f677db19 100644
--- a/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c
+++ b/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c
@@ -11,7 +11,7 @@
#include <Library/MmServicesTableLib.h>
#include <Library/DebugLib.h>
-EFI_MM_SYSTEM_TABLE *gMmst = NULL;
+EFI_MM_SYSTEM_TABLE *gMmst = NULL;
/**
The constructor function caches the pointer of the MM Services Table.
diff --git a/MdePkg/Library/UefiApplicationEntryPoint/ApplicationEntryPoint.c b/MdePkg/Library/UefiApplicationEntryPoint/ApplicationEntryPoint.c
index 324e88c906..0a33e7a223 100644
--- a/MdePkg/Library/UefiApplicationEntryPoint/ApplicationEntryPoint.c
+++ b/MdePkg/Library/UefiApplicationEntryPoint/ApplicationEntryPoint.c
@@ -12,7 +12,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h>
-
/**
Entry point to UEFI Application.
@@ -37,7 +36,7 @@ _ModuleEntryPoint (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
if (_gUefiDriverRevision != 0) {
//
@@ -69,7 +68,6 @@ _ModuleEntryPoint (
return Status;
}
-
/**
Invokes the library destructors for all dependent libraries and terminates
the UEFI Application.
@@ -92,7 +90,6 @@ Exit (
gBS->Exit (gImageHandle, Status, 0, NULL);
}
-
/**
Required by the EBC compiler and identical in functionality to _ModuleEntryPoint().
diff --git a/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.c b/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.c
index 4fb6bc8fbd..d4a70cb523 100644
--- a/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.c
+++ b/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.c
@@ -7,7 +7,6 @@
**/
-
#include <Uefi.h>
#include <Library/UefiBootServicesTableLib.h>
diff --git a/MdePkg/Library/UefiDebugLibConOut/DebugLib.c b/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
index 8ea38ea7cc..65c8dc2b46 100644
--- a/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
+++ b/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
@@ -24,10 +24,10 @@
// VA_LIST can not initialize to NULL for all compiler, so we use this to
// indicate a null VA_LIST
//
-VA_LIST mVaListNull;
+VA_LIST mVaListNull;
-extern BOOLEAN mPostEBS;
-extern EFI_SYSTEM_TABLE *mDebugST;
+extern BOOLEAN mPostEBS;
+extern EFI_SYSTEM_TABLE *mDebugST;
/**
Prints a debug message to the debug output device if the specified error level is enabled.
@@ -59,7 +59,6 @@ DebugPrint (
VA_END (Marker);
}
-
/**
Prints a debug message to the debug output device if the specified
error level is enabled base on Null-terminated format string and a
@@ -79,13 +78,13 @@ DebugPrint (
**/
VOID
DebugPrintMarker (
- IN UINTN ErrorLevel,
- IN CONST CHAR8 *Format,
- IN VA_LIST VaListMarker,
- IN BASE_LIST BaseListMarker
+ IN UINTN ErrorLevel,
+ IN CONST CHAR8 *Format,
+ IN VA_LIST VaListMarker,
+ IN BASE_LIST BaseListMarker
)
{
- CHAR16 Buffer[MAX_DEBUG_MESSAGE_LENGTH];
+ CHAR16 Buffer[MAX_DEBUG_MESSAGE_LENGTH];
if (!mPostEBS) {
//
@@ -109,7 +108,6 @@ DebugPrintMarker (
UnicodeBSPrintAsciiFormat (Buffer, sizeof (Buffer), Format, BaseListMarker);
}
-
//
// Send the print string to the Console Output device
//
@@ -119,7 +117,6 @@ DebugPrintMarker (
}
}
-
/**
Prints a debug message to the debug output device if the specified
error level is enabled.
@@ -138,15 +135,14 @@ DebugPrintMarker (
VOID
EFIAPI
DebugVPrint (
- IN UINTN ErrorLevel,
- IN CONST CHAR8 *Format,
- IN VA_LIST VaListMarker
+ IN UINTN ErrorLevel,
+ IN CONST CHAR8 *Format,
+ IN VA_LIST VaListMarker
)
{
DebugPrintMarker (ErrorLevel, Format, VaListMarker, NULL);
}
-
/**
Prints a debug message to the debug output device if the specified
error level is enabled.
@@ -167,15 +163,14 @@ DebugVPrint (
VOID
EFIAPI
DebugBPrint (
- IN UINTN ErrorLevel,
- IN CONST CHAR8 *Format,
- IN BASE_LIST BaseListMarker
+ IN UINTN ErrorLevel,
+ IN CONST CHAR8 *Format,
+ IN BASE_LIST BaseListMarker
)
{
DebugPrintMarker (ErrorLevel, Format, mVaListNull, BaseListMarker);
}
-
/**
Prints an assert message containing a filename, line number, and description.
This may be followed by a breakpoint or a dead loop.
@@ -233,15 +228,14 @@ DebugAssert (
//
// Generate a Breakpoint, DeadLoop, or NOP based on PCD settings
//
- if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {
+ if ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {
CpuBreakpoint ();
- } else if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {
+ } else if ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {
CpuDeadLoop ();
}
}
}
-
/**
Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer.
@@ -272,10 +266,9 @@ DebugClearMemory (
//
// SetMem() checks for the the ASSERT() condition on Length and returns Buffer
//
- return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue));
+ return SetMem (Buffer, Length, PcdGet8 (PcdDebugClearMemoryValue));
}
-
/**
Returns TRUE if ASSERT() macros are enabled.
@@ -292,10 +285,9 @@ DebugAssertEnabled (
VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
}
-
/**
Returns TRUE if DEBUG() macros are enabled.
@@ -312,10 +304,9 @@ DebugPrintEnabled (
VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
}
-
/**
Returns TRUE if DEBUG_CODE() macros are enabled.
@@ -332,10 +323,9 @@ DebugCodeEnabled (
VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
}
-
/**
Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
@@ -352,7 +342,7 @@ DebugClearMemoryEnabled (
VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
}
/**
@@ -367,8 +357,8 @@ DebugClearMemoryEnabled (
BOOLEAN
EFIAPI
DebugPrintLevelEnabled (
- IN CONST UINTN ErrorLevel
+ IN CONST UINTN ErrorLevel
)
{
- return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0);
+ return (BOOLEAN)((ErrorLevel & PcdGet32 (PcdFixedDebugPrintErrorLevel)) != 0);
}
diff --git a/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c b/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c
index b4ac17cf55..103f9f03be 100644
--- a/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c
+++ b/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c
@@ -15,16 +15,16 @@
//
// BOOLEAN value to indicate if it is at the post ExitBootServices pahse
//
-BOOLEAN mPostEBS = FALSE;
+BOOLEAN mPostEBS = FALSE;
-static EFI_EVENT mExitBootServicesEvent;
+static EFI_EVENT mExitBootServicesEvent;
//
// Pointer to SystemTable
// This library instance may have a cycle consume with UefiBootServicesTableLib
// because of the constructors.
//
-EFI_SYSTEM_TABLE *mDebugST;
+EFI_SYSTEM_TABLE *mDebugST;
/**
This routine sets the mPostEBS for exit boot servies true
@@ -37,8 +37,8 @@ EFI_SYSTEM_TABLE *mDebugST;
VOID
EFIAPI
ExitBootServicesCallback (
- EFI_EVENT Event,
- VOID* Context
+ EFI_EVENT Event,
+ VOID *Context
)
{
mPostEBS = TRUE;
@@ -57,20 +57,20 @@ ExitBootServicesCallback (
**/
EFI_STATUS
EFIAPI
-DxeDebugLibConstructor(
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+DxeDebugLibConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
mDebugST = SystemTable;
SystemTable->BootServices->CreateEvent (
- EVT_SIGNAL_EXIT_BOOT_SERVICES,
- TPL_NOTIFY,
- ExitBootServicesCallback,
- NULL,
- &mExitBootServicesEvent
- );
+ EVT_SIGNAL_EXIT_BOOT_SERVICES,
+ TPL_NOTIFY,
+ ExitBootServicesCallback,
+ NULL,
+ &mExitBootServicesEvent
+ );
return EFI_SUCCESS;
}
@@ -86,9 +86,9 @@ DxeDebugLibConstructor(
**/
EFI_STATUS
EFIAPI
-DxeDebugLibDestructor(
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+DxeDebugLibDestructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
if (mExitBootServicesEvent != NULL) {
diff --git a/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c b/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c
index cd7e2abbd3..c25199b53f 100644
--- a/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c
+++ b/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c
@@ -25,19 +25,18 @@
//
// Define the timeout for EFI_DEBUGPORT_PROTOCOL.Write
//
-#define WRITE_TIMEOUT 1000
+#define WRITE_TIMEOUT 1000
-
-EFI_DEBUGPORT_PROTOCOL *mDebugPort = NULL;
+EFI_DEBUGPORT_PROTOCOL *mDebugPort = NULL;
//
// VA_LIST can not initialize to NULL for all compiler, so we use this to
// indicate a null VA_LIST
//
-VA_LIST mVaListNull;
+VA_LIST mVaListNull;
-extern BOOLEAN mPostEBS;
-extern EFI_BOOT_SERVICES *mDebugBS;
+extern BOOLEAN mPostEBS;
+extern EFI_BOOT_SERVICES *mDebugBS;
/**
Send message to DebugPort Protocol.
@@ -55,20 +54,20 @@ UefiDebugLibDebugPortProtocolWrite (
IN UINTN BufferLength
)
{
- UINTN Length;
- EFI_STATUS Status;
+ UINTN Length;
+ EFI_STATUS Status;
if (!mPostEBS) {
//
// If mDebugPort is NULL, initialize first.
//
if (mDebugPort == NULL) {
- Status = mDebugBS->LocateProtocol (&gEfiDebugPortProtocolGuid, NULL, (VOID **)&mDebugPort);
- if (EFI_ERROR (Status)) {
- return;
- }
+ Status = mDebugBS->LocateProtocol (&gEfiDebugPortProtocolGuid, NULL, (VOID **)&mDebugPort);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
- mDebugPort->Reset (mDebugPort);
+ mDebugPort->Reset (mDebugPort);
}
//
@@ -77,12 +76,12 @@ UefiDebugLibDebugPortProtocolWrite (
while (BufferLength > 0) {
Length = BufferLength;
- Status = mDebugPort->Write (mDebugPort, WRITE_TIMEOUT, &Length, (VOID *) Buffer);
- if (EFI_ERROR (Status) || BufferLength < Length) {
+ Status = mDebugPort->Write (mDebugPort, WRITE_TIMEOUT, &Length, (VOID *)Buffer);
+ if (EFI_ERROR (Status) || (BufferLength < Length)) {
break;
}
- Buffer += Length;
+ Buffer += Length;
BufferLength -= Length;
}
}
@@ -111,14 +110,13 @@ DebugPrint (
...
)
{
- VA_LIST Marker;
+ VA_LIST Marker;
VA_START (Marker, Format);
DebugVPrint (ErrorLevel, Format, Marker);
VA_END (Marker);
}
-
/**
Prints a debug message to the debug output device if the specified
error level is enabled base on Null-terminated format string and a
@@ -138,13 +136,13 @@ DebugPrint (
**/
VOID
DebugPrintMarker (
- IN UINTN ErrorLevel,
- IN CONST CHAR8 *Format,
- IN VA_LIST VaListMarker,
- IN BASE_LIST BaseListMarker
+ IN UINTN ErrorLevel,
+ IN CONST CHAR8 *Format,
+ IN VA_LIST VaListMarker,
+ IN BASE_LIST BaseListMarker
)
{
- CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];
+ CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];
if (!mPostEBS) {
//
@@ -175,7 +173,6 @@ DebugPrintMarker (
}
}
-
/**
Prints a debug message to the debug output device if the specified
error level is enabled.
@@ -194,15 +191,14 @@ DebugPrintMarker (
VOID
EFIAPI
DebugVPrint (
- IN UINTN ErrorLevel,
- IN CONST CHAR8 *Format,
- IN VA_LIST VaListMarker
+ IN UINTN ErrorLevel,
+ IN CONST CHAR8 *Format,
+ IN VA_LIST VaListMarker
)
{
DebugPrintMarker (ErrorLevel, Format, VaListMarker, NULL);
}
-
/**
Prints a debug message to the debug output device if the specified
error level is enabled.
@@ -223,15 +219,14 @@ DebugVPrint (
VOID
EFIAPI
DebugBPrint (
- IN UINTN ErrorLevel,
- IN CONST CHAR8 *Format,
- IN BASE_LIST BaseListMarker
+ IN UINTN ErrorLevel,
+ IN CONST CHAR8 *Format,
+ IN BASE_LIST BaseListMarker
)
{
DebugPrintMarker (ErrorLevel, Format, mVaListNull, BaseListMarker);
}
-
/**
Prints an assert message containing a filename, line number, and description.
This may be followed by a breakpoint or a dead loop.
@@ -287,15 +282,14 @@ DebugAssert (
//
// Generate a Breakpoint, DeadLoop, or NOP based on PCD settings
//
- if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {
+ if ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {
CpuBreakpoint ();
- } else if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {
+ } else if ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {
CpuDeadLoop ();
}
}
}
-
/**
Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer.
@@ -326,10 +320,9 @@ DebugClearMemory (
//
// SetMem() checks for the the ASSERT() condition on Length and returns Buffer
//
- return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue));
+ return SetMem (Buffer, Length, PcdGet8 (PcdDebugClearMemoryValue));
}
-
/**
Returns TRUE if ASSERT() macros are enabled.
@@ -346,10 +339,9 @@ DebugAssertEnabled (
VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
}
-
/**
Returns TRUE if DEBUG() macros are enabled.
@@ -366,10 +358,9 @@ DebugPrintEnabled (
VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
}
-
/**
Returns TRUE if DEBUG_CODE() macros are enabled.
@@ -386,10 +377,9 @@ DebugCodeEnabled (
VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
}
-
/**
Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
@@ -406,7 +396,7 @@ DebugClearMemoryEnabled (
VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
}
/**
@@ -421,9 +411,8 @@ DebugClearMemoryEnabled (
BOOLEAN
EFIAPI
DebugPrintLevelEnabled (
- IN CONST UINTN ErrorLevel
+ IN CONST UINTN ErrorLevel
)
{
- return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0);
+ return (BOOLEAN)((ErrorLevel & PcdGet32 (PcdFixedDebugPrintErrorLevel)) != 0);
}
-
diff --git a/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLibConstructor.c b/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLibConstructor.c
index 96fc1c422f..298d17c6a0 100644
--- a/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLibConstructor.c
+++ b/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLibConstructor.c
@@ -15,16 +15,16 @@
//
// BOOLEAN value to indicate if it is at the post ExitBootServices pahse
//
-BOOLEAN mPostEBS = FALSE;
+BOOLEAN mPostEBS = FALSE;
-static EFI_EVENT mExitBootServicesEvent;
+static EFI_EVENT mExitBootServicesEvent;
//
// Pointer to SystemTable
// This library instance may have a cycle consume with UefiBootServicesTableLib
// because of the constructors.
//
-EFI_BOOT_SERVICES *mDebugBS;
+EFI_BOOT_SERVICES *mDebugBS;
/**
This routine sets the mPostEBS for exit boot servies true
@@ -37,8 +37,8 @@ EFI_BOOT_SERVICES *mDebugBS;
VOID
EFIAPI
ExitBootServicesCallback (
- EFI_EVENT Event,
- VOID* Context
+ EFI_EVENT Event,
+ VOID *Context
)
{
mPostEBS = TRUE;
@@ -57,9 +57,9 @@ ExitBootServicesCallback (
**/
EFI_STATUS
EFIAPI
-DxeDebugLibConstructor(
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+DxeDebugLibConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
mDebugBS = SystemTable->BootServices;
@@ -86,9 +86,9 @@ DxeDebugLibConstructor(
**/
EFI_STATUS
EFIAPI
-DxeDebugLibDestructor(
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+DxeDebugLibDestructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
if (mExitBootServicesEvent != NULL) {
diff --git a/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c b/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
index fcfdafede0..5b28cd10ae 100644
--- a/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
+++ b/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
@@ -6,7 +6,6 @@
**/
-
#include <Uefi.h>
#include <Library/DebugLib.h>
@@ -21,15 +20,14 @@
//
#define MAX_DEBUG_MESSAGE_LENGTH 0x100
-
//
// VA_LIST can not initialize to NULL for all compiler, so we use this to
// indicate a null VA_LIST
//
-VA_LIST mVaListNull;
+VA_LIST mVaListNull;
-extern BOOLEAN mPostEBS;
-extern EFI_SYSTEM_TABLE *mDebugST;
+extern BOOLEAN mPostEBS;
+extern EFI_SYSTEM_TABLE *mDebugST;
/**
Prints a debug message to the debug output device if the specified error level is enabled.
@@ -54,14 +52,13 @@ DebugPrint (
...
)
{
- VA_LIST Marker;
+ VA_LIST Marker;
VA_START (Marker, Format);
DebugVPrint (ErrorLevel, Format, Marker);
VA_END (Marker);
}
-
/**
Prints a debug message to the debug output device if the specified
error level is enabled base on Null-terminated format string and a
@@ -81,13 +78,13 @@ DebugPrint (
**/
VOID
DebugPrintMarker (
- IN UINTN ErrorLevel,
- IN CONST CHAR8 *Format,
- IN VA_LIST VaListMarker,
- IN BASE_LIST BaseListMarker
+ IN UINTN ErrorLevel,
+ IN CONST CHAR8 *Format,
+ IN VA_LIST VaListMarker,
+ IN BASE_LIST BaseListMarker
)
{
- CHAR16 Buffer[MAX_DEBUG_MESSAGE_LENGTH];
+ CHAR16 Buffer[MAX_DEBUG_MESSAGE_LENGTH];
if (!mPostEBS) {
//
@@ -120,7 +117,6 @@ DebugPrintMarker (
}
}
-
/**
Prints a debug message to the debug output device if the specified
error level is enabled.
@@ -139,15 +135,14 @@ DebugPrintMarker (
VOID
EFIAPI
DebugVPrint (
- IN UINTN ErrorLevel,
- IN CONST CHAR8 *Format,
- IN VA_LIST VaListMarker
+ IN UINTN ErrorLevel,
+ IN CONST CHAR8 *Format,
+ IN VA_LIST VaListMarker
)
{
DebugPrintMarker (ErrorLevel, Format, VaListMarker, NULL);
}
-
/**
Prints a debug message to the debug output device if the specified
error level is enabled.
@@ -168,15 +163,14 @@ DebugVPrint (
VOID
EFIAPI
DebugBPrint (
- IN UINTN ErrorLevel,
- IN CONST CHAR8 *Format,
- IN BASE_LIST BaseListMarker
+ IN UINTN ErrorLevel,
+ IN CONST CHAR8 *Format,
+ IN BASE_LIST BaseListMarker
)
{
DebugPrintMarker (ErrorLevel, Format, mVaListNull, BaseListMarker);
}
-
/**
Prints an assert message containing a filename, line number, and description.
This may be followed by a breakpoint or a dead loop.
@@ -234,15 +228,14 @@ DebugAssert (
//
// Generate a Breakpoint, DeadLoop, or NOP based on PCD settings
//
- if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {
+ if ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {
CpuBreakpoint ();
- } else if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {
+ } else if ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {
CpuDeadLoop ();
}
}
}
-
/**
Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer.
@@ -273,10 +266,9 @@ DebugClearMemory (
//
// SetMem() checks for the the ASSERT() condition on Length and returns Buffer
//
- return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue));
+ return SetMem (Buffer, Length, PcdGet8 (PcdDebugClearMemoryValue));
}
-
/**
Returns TRUE if ASSERT() macros are enabled.
@@ -293,10 +285,9 @@ DebugAssertEnabled (
VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
}
-
/**
Returns TRUE if DEBUG() macros are enabled.
@@ -313,10 +304,9 @@ DebugPrintEnabled (
VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
}
-
/**
Returns TRUE if DEBUG_CODE() macros are enabled.
@@ -333,10 +323,9 @@ DebugCodeEnabled (
VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
}
-
/**
Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
@@ -353,7 +342,7 @@ DebugClearMemoryEnabled (
VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
}
/**
@@ -368,8 +357,8 @@ DebugClearMemoryEnabled (
BOOLEAN
EFIAPI
DebugPrintLevelEnabled (
- IN CONST UINTN ErrorLevel
+ IN CONST UINTN ErrorLevel
)
{
- return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0);
+ return (BOOLEAN)((ErrorLevel & PcdGet32 (PcdFixedDebugPrintErrorLevel)) != 0);
}
diff --git a/MdePkg/Library/UefiDebugLibStdErr/DebugLibConstructor.c b/MdePkg/Library/UefiDebugLibStdErr/DebugLibConstructor.c
index b4ac17cf55..103f9f03be 100644
--- a/MdePkg/Library/UefiDebugLibStdErr/DebugLibConstructor.c
+++ b/MdePkg/Library/UefiDebugLibStdErr/DebugLibConstructor.c
@@ -15,16 +15,16 @@
//
// BOOLEAN value to indicate if it is at the post ExitBootServices pahse
//
-BOOLEAN mPostEBS = FALSE;
+BOOLEAN mPostEBS = FALSE;
-static EFI_EVENT mExitBootServicesEvent;
+static EFI_EVENT mExitBootServicesEvent;
//
// Pointer to SystemTable
// This library instance may have a cycle consume with UefiBootServicesTableLib
// because of the constructors.
//
-EFI_SYSTEM_TABLE *mDebugST;
+EFI_SYSTEM_TABLE *mDebugST;
/**
This routine sets the mPostEBS for exit boot servies true
@@ -37,8 +37,8 @@ EFI_SYSTEM_TABLE *mDebugST;
VOID
EFIAPI
ExitBootServicesCallback (
- EFI_EVENT Event,
- VOID* Context
+ EFI_EVENT Event,
+ VOID *Context
)
{
mPostEBS = TRUE;
@@ -57,20 +57,20 @@ ExitBootServicesCallback (
**/
EFI_STATUS
EFIAPI
-DxeDebugLibConstructor(
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+DxeDebugLibConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
mDebugST = SystemTable;
SystemTable->BootServices->CreateEvent (
- EVT_SIGNAL_EXIT_BOOT_SERVICES,
- TPL_NOTIFY,
- ExitBootServicesCallback,
- NULL,
- &mExitBootServicesEvent
- );
+ EVT_SIGNAL_EXIT_BOOT_SERVICES,
+ TPL_NOTIFY,
+ ExitBootServicesCallback,
+ NULL,
+ &mExitBootServicesEvent
+ );
return EFI_SUCCESS;
}
@@ -86,9 +86,9 @@ DxeDebugLibConstructor(
**/
EFI_STATUS
EFIAPI
-DxeDebugLibDestructor(
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+DxeDebugLibDestructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
if (mExitBootServicesEvent != NULL) {
diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
index 1515d2d590..1aaa968d6f 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
@@ -38,8 +38,8 @@ UefiDevicePathLibStrDuplicate (
**/
CHAR16 *
GetParamByNodeName (
- IN CHAR16 *Str,
- IN CHAR16 *NodeName
+ IN CHAR16 *Str,
+ IN CHAR16 *NodeName
)
{
CHAR16 *ParamStr;
@@ -65,14 +65,16 @@ GetParamByNodeName (
//
ParamStr++;
ParameterLength = 0;
- StrPointer = ParamStr;
+ StrPointer = ParamStr;
while (!IS_NULL (*StrPointer)) {
if (IS_RIGHT_PARENTH (*StrPointer)) {
break;
}
+
StrPointer++;
ParameterLength++;
}
+
if (IS_NULL (*StrPointer)) {
//
// ')' not found
@@ -84,6 +86,7 @@ GetParamByNodeName (
if (ParamStr == NULL) {
return NULL;
}
+
//
// Terminate the parameter string
//
@@ -106,14 +109,14 @@ GetParamByNodeName (
**/
CHAR16 *
SplitStr (
- IN OUT CHAR16 **List,
- IN CHAR16 Separator
+ IN OUT CHAR16 **List,
+ IN CHAR16 Separator
)
{
CHAR16 *Str;
CHAR16 *ReturnStr;
- Str = *List;
+ Str = *List;
ReturnStr = Str;
if (IS_NULL (*Str)) {
@@ -127,6 +130,7 @@ SplitStr (
if (*Str == Separator) {
break;
}
+
Str++;
}
@@ -156,7 +160,7 @@ SplitStr (
**/
CHAR16 *
GetNextParamStr (
- IN OUT CHAR16 **List
+ IN OUT CHAR16 **List
)
{
//
@@ -196,9 +200,11 @@ GetNextDeviceNodeStr (
if (!IS_SLASH (*Str) &&
!IS_COMMA (*Str) &&
!IS_LEFT_PARENTH (*Str) &&
- !IS_RIGHT_PARENTH (*Str)) {
+ !IS_RIGHT_PARENTH (*Str))
+ {
break;
}
+
Str++;
}
@@ -231,7 +237,7 @@ GetNextDeviceNodeStr (
if (IS_COMMA (*Str)) {
*IsInstanceEnd = TRUE;
- *Str = L'\0';
+ *Str = L'\0';
Str++;
} else {
*IsInstanceEnd = FALSE;
@@ -246,7 +252,6 @@ GetNextDeviceNodeStr (
return ReturnStr;
}
-
/**
Return whether the integer string is a hex string.
@@ -258,23 +263,24 @@ GetNextDeviceNodeStr (
**/
BOOLEAN
IsHexStr (
- IN CHAR16 *Str
+ IN CHAR16 *Str
)
{
//
// skip preceeding white space
//
while ((*Str != 0) && *Str == L' ') {
- Str ++;
+ Str++;
}
+
//
// skip preceeding zeros
//
while ((*Str != 0) && *Str == L'0') {
- Str ++;
+ Str++;
}
- return (BOOLEAN) (*Str == L'x' || *Str == L'X');
+ return (BOOLEAN)(*Str == L'x' || *Str == L'X');
}
/**
@@ -329,16 +335,17 @@ Strtoi64 (
**/
VOID
StrToAscii (
- IN CHAR16 *Str,
- IN OUT CHAR8 **AsciiStr
+ IN CHAR16 *Str,
+ IN OUT CHAR8 **AsciiStr
)
{
- CHAR8 *Dest;
+ CHAR8 *Dest;
Dest = *AsciiStr;
while (!IS_NULL (*Str)) {
- *(Dest++) = (CHAR8) *(Str++);
+ *(Dest++) = (CHAR8)*(Str++);
}
+
*Dest = 0;
//
@@ -357,14 +364,14 @@ StrToAscii (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextGenericPath (
- IN UINT8 Type,
- IN CHAR16 *TextDeviceNode
+ IN UINT8 Type,
+ IN CHAR16 *TextDeviceNode
)
{
- EFI_DEVICE_PATH_PROTOCOL *Node;
- CHAR16 *SubtypeStr;
- CHAR16 *DataStr;
- UINTN DataLength;
+ EFI_DEVICE_PATH_PROTOCOL *Node;
+ CHAR16 *SubtypeStr;
+ CHAR16 *DataStr;
+ UINTN DataLength;
SubtypeStr = GetNextParamStr (&TextDeviceNode);
DataStr = GetNextParamStr (&TextDeviceNode);
@@ -374,13 +381,14 @@ DevPathFromTextGenericPath (
} else {
DataLength = StrLen (DataStr) / 2;
}
+
Node = CreateDeviceNode (
Type,
- (UINT8) Strtoi (SubtypeStr),
- (UINT16) (sizeof (EFI_DEVICE_PATH_PROTOCOL) + DataLength)
+ (UINT8)Strtoi (SubtypeStr),
+ (UINT16)(sizeof (EFI_DEVICE_PATH_PROTOCOL) + DataLength)
);
- StrHexToBytes (DataStr, DataLength * 2, (UINT8 *) (Node + 1), DataLength);
+ StrHexToBytes (DataStr, DataLength * 2, (UINT8 *)(Node + 1), DataLength);
return Node;
}
@@ -394,14 +402,14 @@ DevPathFromTextGenericPath (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextPath (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
- CHAR16 *TypeStr;
+ CHAR16 *TypeStr;
- TypeStr = GetNextParamStr (&TextDeviceNode);
+ TypeStr = GetNextParamStr (&TextDeviceNode);
- return DevPathFromTextGenericPath ((UINT8) Strtoi (TypeStr), TextDeviceNode);
+ return DevPathFromTextGenericPath ((UINT8)Strtoi (TypeStr), TextDeviceNode);
}
/**
@@ -414,7 +422,7 @@ DevPathFromTextPath (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextHardwarePath (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
return DevPathFromTextGenericPath (HARDWARE_DEVICE_PATH, TextDeviceNode);
@@ -430,25 +438,25 @@ DevPathFromTextHardwarePath (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextPci (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
- CHAR16 *FunctionStr;
- CHAR16 *DeviceStr;
- PCI_DEVICE_PATH *Pci;
+ CHAR16 *FunctionStr;
+ CHAR16 *DeviceStr;
+ PCI_DEVICE_PATH *Pci;
DeviceStr = GetNextParamStr (&TextDeviceNode);
FunctionStr = GetNextParamStr (&TextDeviceNode);
- Pci = (PCI_DEVICE_PATH *) CreateDeviceNode (
- HARDWARE_DEVICE_PATH,
- HW_PCI_DP,
- (UINT16) sizeof (PCI_DEVICE_PATH)
- );
+ Pci = (PCI_DEVICE_PATH *)CreateDeviceNode (
+ HARDWARE_DEVICE_PATH,
+ HW_PCI_DP,
+ (UINT16)sizeof (PCI_DEVICE_PATH)
+ );
- Pci->Function = (UINT8) Strtoi (FunctionStr);
- Pci->Device = (UINT8) Strtoi (DeviceStr);
+ Pci->Function = (UINT8)Strtoi (FunctionStr);
+ Pci->Device = (UINT8)Strtoi (DeviceStr);
- return (EFI_DEVICE_PATH_PROTOCOL *) Pci;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Pci;
}
/**
@@ -461,22 +469,22 @@ DevPathFromTextPci (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextPcCard (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
CHAR16 *FunctionNumberStr;
PCCARD_DEVICE_PATH *Pccard;
FunctionNumberStr = GetNextParamStr (&TextDeviceNode);
- Pccard = (PCCARD_DEVICE_PATH *) CreateDeviceNode (
- HARDWARE_DEVICE_PATH,
- HW_PCCARD_DP,
- (UINT16) sizeof (PCCARD_DEVICE_PATH)
- );
+ Pccard = (PCCARD_DEVICE_PATH *)CreateDeviceNode (
+ HARDWARE_DEVICE_PATH,
+ HW_PCCARD_DP,
+ (UINT16)sizeof (PCCARD_DEVICE_PATH)
+ );
- Pccard->FunctionNumber = (UINT8) Strtoi (FunctionNumberStr);
+ Pccard->FunctionNumber = (UINT8)Strtoi (FunctionNumberStr);
- return (EFI_DEVICE_PATH_PROTOCOL *) Pccard;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Pccard;
}
/**
@@ -489,7 +497,7 @@ DevPathFromTextPcCard (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextMemoryMapped (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
CHAR16 *MemoryTypeStr;
@@ -500,17 +508,17 @@ DevPathFromTextMemoryMapped (
MemoryTypeStr = GetNextParamStr (&TextDeviceNode);
StartingAddressStr = GetNextParamStr (&TextDeviceNode);
EndingAddressStr = GetNextParamStr (&TextDeviceNode);
- MemMap = (MEMMAP_DEVICE_PATH *) CreateDeviceNode (
+ MemMap = (MEMMAP_DEVICE_PATH *)CreateDeviceNode (
HARDWARE_DEVICE_PATH,
HW_MEMMAP_DP,
- (UINT16) sizeof (MEMMAP_DEVICE_PATH)
+ (UINT16)sizeof (MEMMAP_DEVICE_PATH)
);
- MemMap->MemoryType = (UINT32) Strtoi (MemoryTypeStr);
+ MemMap->MemoryType = (UINT32)Strtoi (MemoryTypeStr);
Strtoi64 (StartingAddressStr, &MemMap->StartingAddress);
Strtoi64 (EndingAddressStr, &MemMap->EndingAddress);
- return (EFI_DEVICE_PATH_PROTOCOL *) MemMap;
+ return (EFI_DEVICE_PATH_PROTOCOL *)MemMap;
}
/**
@@ -526,9 +534,9 @@ DevPathFromTextMemoryMapped (
**/
EFI_DEVICE_PATH_PROTOCOL *
ConvertFromTextVendor (
- IN CHAR16 *TextDeviceNode,
- IN UINT8 Type,
- IN UINT8 SubType
+ IN CHAR16 *TextDeviceNode,
+ IN UINT8 Type,
+ IN UINT8 SubType
)
{
CHAR16 *GuidStr;
@@ -543,18 +551,18 @@ ConvertFromTextVendor (
//
// Two hex characters make up 1 buffer byte
//
- Length = (Length + 1) / 2;
+ Length = (Length + 1) / 2;
- Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
- Type,
- SubType,
- (UINT16) (sizeof (VENDOR_DEVICE_PATH) + Length)
- );
+ Vendor = (VENDOR_DEVICE_PATH *)CreateDeviceNode (
+ Type,
+ SubType,
+ (UINT16)(sizeof (VENDOR_DEVICE_PATH) + Length)
+ );
StrToGuid (GuidStr, &Vendor->Guid);
- StrHexToBytes (DataStr, Length * 2, (UINT8 *) (Vendor + 1), Length);
+ StrHexToBytes (DataStr, Length * 2, (UINT8 *)(Vendor + 1), Length);
- return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Vendor;
}
/**
@@ -567,7 +575,7 @@ ConvertFromTextVendor (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextVenHw (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
return ConvertFromTextVendor (
@@ -587,21 +595,21 @@ DevPathFromTextVenHw (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextCtrl (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
CHAR16 *ControllerStr;
CONTROLLER_DEVICE_PATH *Controller;
ControllerStr = GetNextParamStr (&TextDeviceNode);
- Controller = (CONTROLLER_DEVICE_PATH *) CreateDeviceNode (
- HARDWARE_DEVICE_PATH,
- HW_CONTROLLER_DP,
- (UINT16) sizeof (CONTROLLER_DEVICE_PATH)
- );
- Controller->ControllerNumber = (UINT32) Strtoi (ControllerStr);
+ Controller = (CONTROLLER_DEVICE_PATH *)CreateDeviceNode (
+ HARDWARE_DEVICE_PATH,
+ HW_CONTROLLER_DP,
+ (UINT16)sizeof (CONTROLLER_DEVICE_PATH)
+ );
+ Controller->ControllerNumber = (UINT32)Strtoi (ControllerStr);
- return (EFI_DEVICE_PATH_PROTOCOL *) Controller;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Controller;
}
/**
@@ -614,28 +622,28 @@ DevPathFromTextCtrl (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextBmc (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
- CHAR16 *InterfaceTypeStr;
- CHAR16 *BaseAddressStr;
- BMC_DEVICE_PATH *BmcDp;
+ CHAR16 *InterfaceTypeStr;
+ CHAR16 *BaseAddressStr;
+ BMC_DEVICE_PATH *BmcDp;
InterfaceTypeStr = GetNextParamStr (&TextDeviceNode);
BaseAddressStr = GetNextParamStr (&TextDeviceNode);
- BmcDp = (BMC_DEVICE_PATH *) CreateDeviceNode (
- HARDWARE_DEVICE_PATH,
- HW_BMC_DP,
- (UINT16) sizeof (BMC_DEVICE_PATH)
- );
+ BmcDp = (BMC_DEVICE_PATH *)CreateDeviceNode (
+ HARDWARE_DEVICE_PATH,
+ HW_BMC_DP,
+ (UINT16)sizeof (BMC_DEVICE_PATH)
+ );
- BmcDp->InterfaceType = (UINT8) Strtoi (InterfaceTypeStr);
+ BmcDp->InterfaceType = (UINT8)Strtoi (InterfaceTypeStr);
WriteUnaligned64 (
- (UINT64 *) (&BmcDp->BaseAddress),
+ (UINT64 *)(&BmcDp->BaseAddress),
StrHexToUint64 (BaseAddressStr)
);
- return (EFI_DEVICE_PATH_PROTOCOL *) BmcDp;
+ return (EFI_DEVICE_PATH_PROTOCOL *)BmcDp;
}
/**
@@ -648,7 +656,7 @@ DevPathFromTextBmc (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextAcpiPath (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
return DevPathFromTextGenericPath (ACPI_DEVICE_PATH, TextDeviceNode);
@@ -663,14 +671,14 @@ DevPathFromTextAcpiPath (
**/
UINT32
EisaIdFromText (
- IN CHAR16 *Text
+ IN CHAR16 *Text
)
{
return (((Text[0] - 'A' + 1) & 0x1f) << 10)
- + (((Text[1] - 'A' + 1) & 0x1f) << 5)
- + (((Text[2] - 'A' + 1) & 0x1f) << 0)
- + (UINT32) (StrHexToUintn (&Text[3]) << 16)
- ;
+ + (((Text[1] - 'A' + 1) & 0x1f) << 5)
+ + (((Text[2] - 'A' + 1) & 0x1f) << 0)
+ + (UINT32)(StrHexToUintn (&Text[3]) << 16)
+ ;
}
/**
@@ -683,7 +691,7 @@ EisaIdFromText (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextAcpi (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
CHAR16 *HIDStr;
@@ -692,16 +700,16 @@ DevPathFromTextAcpi (
HIDStr = GetNextParamStr (&TextDeviceNode);
UIDStr = GetNextParamStr (&TextDeviceNode);
- Acpi = (ACPI_HID_DEVICE_PATH *) CreateDeviceNode (
- ACPI_DEVICE_PATH,
- ACPI_DP,
- (UINT16) sizeof (ACPI_HID_DEVICE_PATH)
- );
+ Acpi = (ACPI_HID_DEVICE_PATH *)CreateDeviceNode (
+ ACPI_DEVICE_PATH,
+ ACPI_DP,
+ (UINT16)sizeof (ACPI_HID_DEVICE_PATH)
+ );
Acpi->HID = EisaIdFromText (HIDStr);
- Acpi->UID = (UINT32) Strtoi (UIDStr);
+ Acpi->UID = (UINT32)Strtoi (UIDStr);
- return (EFI_DEVICE_PATH_PROTOCOL *) Acpi;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Acpi;
}
/**
@@ -715,7 +723,7 @@ DevPathFromTextAcpi (
**/
EFI_DEVICE_PATH_PROTOCOL *
ConvertFromTextAcpi (
- IN CHAR16 *TextDeviceNode,
+ IN CHAR16 *TextDeviceNode,
IN UINT32 PnPId
)
{
@@ -723,16 +731,16 @@ ConvertFromTextAcpi (
ACPI_HID_DEVICE_PATH *Acpi;
UIDStr = GetNextParamStr (&TextDeviceNode);
- Acpi = (ACPI_HID_DEVICE_PATH *) CreateDeviceNode (
- ACPI_DEVICE_PATH,
- ACPI_DP,
- (UINT16) sizeof (ACPI_HID_DEVICE_PATH)
- );
+ Acpi = (ACPI_HID_DEVICE_PATH *)CreateDeviceNode (
+ ACPI_DEVICE_PATH,
+ ACPI_DP,
+ (UINT16)sizeof (ACPI_HID_DEVICE_PATH)
+ );
Acpi->HID = EFI_PNP_ID (PnPId);
- Acpi->UID = (UINT32) Strtoi (UIDStr);
+ Acpi->UID = (UINT32)Strtoi (UIDStr);
- return (EFI_DEVICE_PATH_PROTOCOL *) Acpi;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Acpi;
}
/**
@@ -745,7 +753,7 @@ ConvertFromTextAcpi (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextPciRoot (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
return ConvertFromTextAcpi (TextDeviceNode, 0x0a03);
@@ -761,7 +769,7 @@ DevPathFromTextPciRoot (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextPcieRoot (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
return ConvertFromTextAcpi (TextDeviceNode, 0x0a08);
@@ -777,7 +785,7 @@ DevPathFromTextPcieRoot (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextFloppy (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
return ConvertFromTextAcpi (TextDeviceNode, 0x0604);
@@ -793,7 +801,7 @@ DevPathFromTextFloppy (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextKeyboard (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
return ConvertFromTextAcpi (TextDeviceNode, 0x0301);
@@ -809,7 +817,7 @@ DevPathFromTextKeyboard (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextSerial (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
return ConvertFromTextAcpi (TextDeviceNode, 0x0501);
@@ -825,7 +833,7 @@ DevPathFromTextSerial (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextParallelPort (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
return ConvertFromTextAcpi (TextDeviceNode, 0x0401);
@@ -841,7 +849,7 @@ DevPathFromTextParallelPort (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextAcpiEx (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
CHAR16 *HIDStr;
@@ -861,25 +869,25 @@ DevPathFromTextAcpiEx (
CIDSTRStr = GetNextParamStr (&TextDeviceNode);
UIDSTRStr = GetNextParamStr (&TextDeviceNode);
- Length = (UINT16) (sizeof (ACPI_EXTENDED_HID_DEVICE_PATH) + StrLen (HIDSTRStr) + 1);
- Length = (UINT16) (Length + StrLen (UIDSTRStr) + 1);
- Length = (UINT16) (Length + StrLen (CIDSTRStr) + 1);
- AcpiEx = (ACPI_EXTENDED_HID_DEVICE_PATH *) CreateDeviceNode (
- ACPI_DEVICE_PATH,
- ACPI_EXTENDED_DP,
- Length
- );
+ Length = (UINT16)(sizeof (ACPI_EXTENDED_HID_DEVICE_PATH) + StrLen (HIDSTRStr) + 1);
+ Length = (UINT16)(Length + StrLen (UIDSTRStr) + 1);
+ Length = (UINT16)(Length + StrLen (CIDSTRStr) + 1);
+ AcpiEx = (ACPI_EXTENDED_HID_DEVICE_PATH *)CreateDeviceNode (
+ ACPI_DEVICE_PATH,
+ ACPI_EXTENDED_DP,
+ Length
+ );
AcpiEx->HID = EisaIdFromText (HIDStr);
AcpiEx->CID = EisaIdFromText (CIDStr);
- AcpiEx->UID = (UINT32) Strtoi (UIDStr);
+ AcpiEx->UID = (UINT32)Strtoi (UIDStr);
- AsciiStr = (CHAR8 *) ((UINT8 *)AcpiEx + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH));
+ AsciiStr = (CHAR8 *)((UINT8 *)AcpiEx + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH));
StrToAscii (HIDSTRStr, &AsciiStr);
StrToAscii (UIDSTRStr, &AsciiStr);
StrToAscii (CIDSTRStr, &AsciiStr);
- return (EFI_DEVICE_PATH_PROTOCOL *) AcpiEx;
+ return (EFI_DEVICE_PATH_PROTOCOL *)AcpiEx;
}
/**
@@ -892,7 +900,7 @@ DevPathFromTextAcpiEx (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextAcpiExp (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
CHAR16 *HIDStr;
@@ -905,12 +913,12 @@ DevPathFromTextAcpiExp (
HIDStr = GetNextParamStr (&TextDeviceNode);
CIDStr = GetNextParamStr (&TextDeviceNode);
UIDSTRStr = GetNextParamStr (&TextDeviceNode);
- Length = (UINT16) (sizeof (ACPI_EXTENDED_HID_DEVICE_PATH) + StrLen (UIDSTRStr) + 3);
- AcpiEx = (ACPI_EXTENDED_HID_DEVICE_PATH *) CreateDeviceNode (
- ACPI_DEVICE_PATH,
- ACPI_EXTENDED_DP,
- Length
- );
+ Length = (UINT16)(sizeof (ACPI_EXTENDED_HID_DEVICE_PATH) + StrLen (UIDSTRStr) + 3);
+ AcpiEx = (ACPI_EXTENDED_HID_DEVICE_PATH *)CreateDeviceNode (
+ ACPI_DEVICE_PATH,
+ ACPI_EXTENDED_DP,
+ Length
+ );
AcpiEx->HID = EisaIdFromText (HIDStr);
//
@@ -918,14 +926,15 @@ DevPathFromTextAcpiExp (
// So when the CID parametr is not specified or specified as 0 in the text device node.
// Set the CID to 0 in the ACPI extension device path structure.
//
- if (*CIDStr == L'\0' || *CIDStr == L'0') {
+ if ((*CIDStr == L'\0') || (*CIDStr == L'0')) {
AcpiEx->CID = 0;
} else {
AcpiEx->CID = EisaIdFromText (CIDStr);
}
+
AcpiEx->UID = 0;
- AsciiStr = (CHAR8 *) ((UINT8 *)AcpiEx + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH));
+ AsciiStr = (CHAR8 *)((UINT8 *)AcpiEx + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH));
//
// HID string is NULL
//
@@ -940,7 +949,7 @@ DevPathFromTextAcpiExp (
//
*AsciiStr = '\0';
- return (EFI_DEVICE_PATH_PROTOCOL *) AcpiEx;
+ return (EFI_DEVICE_PATH_PROTOCOL *)AcpiEx;
}
/**
@@ -953,7 +962,7 @@ DevPathFromTextAcpiExp (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextAcpiAdr (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
CHAR16 *DisplayDeviceStr;
@@ -961,11 +970,11 @@ DevPathFromTextAcpiAdr (
UINTN Index;
UINTN Length;
- AcpiAdr = (ACPI_ADR_DEVICE_PATH *) CreateDeviceNode (
- ACPI_DEVICE_PATH,
- ACPI_ADR_DP,
- (UINT16) sizeof (ACPI_ADR_DEVICE_PATH)
- );
+ AcpiAdr = (ACPI_ADR_DEVICE_PATH *)CreateDeviceNode (
+ ACPI_DEVICE_PATH,
+ ACPI_ADR_DP,
+ (UINT16)sizeof (ACPI_ADR_DEVICE_PATH)
+ );
ASSERT (AcpiAdr != NULL);
for (Index = 0; ; Index++) {
@@ -973,6 +982,7 @@ DevPathFromTextAcpiAdr (
if (IS_NULL (*DisplayDeviceStr)) {
break;
}
+
if (Index > 0) {
Length = DevicePathNodeLength (AcpiAdr);
AcpiAdr = ReallocatePool (
@@ -984,10 +994,10 @@ DevPathFromTextAcpiAdr (
SetDevicePathNodeLength (AcpiAdr, Length + sizeof (UINT32));
}
- (&AcpiAdr->ADR)[Index] = (UINT32) Strtoi (DisplayDeviceStr);
+ (&AcpiAdr->ADR)[Index] = (UINT32)Strtoi (DisplayDeviceStr);
}
- return (EFI_DEVICE_PATH_PROTOCOL *) AcpiAdr;
+ return (EFI_DEVICE_PATH_PROTOCOL *)AcpiAdr;
}
/**
@@ -1000,7 +1010,7 @@ DevPathFromTextAcpiAdr (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextMsg (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
return DevPathFromTextGenericPath (MESSAGING_DEVICE_PATH, TextDeviceNode);
@@ -1016,19 +1026,19 @@ DevPathFromTextMsg (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextAta (
-IN CHAR16 *TextDeviceNode
-)
+ IN CHAR16 *TextDeviceNode
+ )
{
- CHAR16 *PrimarySecondaryStr;
- CHAR16 *SlaveMasterStr;
- CHAR16 *LunStr;
- ATAPI_DEVICE_PATH *Atapi;
+ CHAR16 *PrimarySecondaryStr;
+ CHAR16 *SlaveMasterStr;
+ CHAR16 *LunStr;
+ ATAPI_DEVICE_PATH *Atapi;
- Atapi = (ATAPI_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_ATAPI_DP,
- (UINT16) sizeof (ATAPI_DEVICE_PATH)
- );
+ Atapi = (ATAPI_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_ATAPI_DP,
+ (UINT16)sizeof (ATAPI_DEVICE_PATH)
+ );
PrimarySecondaryStr = GetNextParamStr (&TextDeviceNode);
SlaveMasterStr = GetNextParamStr (&TextDeviceNode);
@@ -1039,19 +1049,20 @@ IN CHAR16 *TextDeviceNode
} else if (StrCmp (PrimarySecondaryStr, L"Secondary") == 0) {
Atapi->PrimarySecondary = 1;
} else {
- Atapi->PrimarySecondary = (UINT8) Strtoi (PrimarySecondaryStr);
+ Atapi->PrimarySecondary = (UINT8)Strtoi (PrimarySecondaryStr);
}
+
if (StrCmp (SlaveMasterStr, L"Master") == 0) {
- Atapi->SlaveMaster = 0;
+ Atapi->SlaveMaster = 0;
} else if (StrCmp (SlaveMasterStr, L"Slave") == 0) {
- Atapi->SlaveMaster = 1;
+ Atapi->SlaveMaster = 1;
} else {
- Atapi->SlaveMaster = (UINT8) Strtoi (SlaveMasterStr);
+ Atapi->SlaveMaster = (UINT8)Strtoi (SlaveMasterStr);
}
- Atapi->Lun = (UINT16) Strtoi (LunStr);
+ Atapi->Lun = (UINT16)Strtoi (LunStr);
- return (EFI_DEVICE_PATH_PROTOCOL *) Atapi;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Atapi;
}
/**
@@ -1064,7 +1075,7 @@ IN CHAR16 *TextDeviceNode
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextScsi (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
CHAR16 *PunStr;
@@ -1073,16 +1084,16 @@ DevPathFromTextScsi (
PunStr = GetNextParamStr (&TextDeviceNode);
LunStr = GetNextParamStr (&TextDeviceNode);
- Scsi = (SCSI_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_SCSI_DP,
- (UINT16) sizeof (SCSI_DEVICE_PATH)
- );
+ Scsi = (SCSI_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_SCSI_DP,
+ (UINT16)sizeof (SCSI_DEVICE_PATH)
+ );
- Scsi->Pun = (UINT16) Strtoi (PunStr);
- Scsi->Lun = (UINT16) Strtoi (LunStr);
+ Scsi->Pun = (UINT16)Strtoi (PunStr);
+ Scsi->Lun = (UINT16)Strtoi (LunStr);
- return (EFI_DEVICE_PATH_PROTOCOL *) Scsi;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Scsi;
}
/**
@@ -1095,7 +1106,7 @@ DevPathFromTextScsi (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextFibre (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
CHAR16 *WWNStr;
@@ -1104,17 +1115,17 @@ DevPathFromTextFibre (
WWNStr = GetNextParamStr (&TextDeviceNode);
LunStr = GetNextParamStr (&TextDeviceNode);
- Fibre = (FIBRECHANNEL_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_FIBRECHANNEL_DP,
- (UINT16) sizeof (FIBRECHANNEL_DEVICE_PATH)
- );
+ Fibre = (FIBRECHANNEL_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_FIBRECHANNEL_DP,
+ (UINT16)sizeof (FIBRECHANNEL_DEVICE_PATH)
+ );
Fibre->Reserved = 0;
Strtoi64 (WWNStr, &Fibre->WWN);
Strtoi64 (LunStr, &Fibre->Lun);
- return (EFI_DEVICE_PATH_PROTOCOL *) Fibre;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Fibre;
}
/**
@@ -1127,7 +1138,7 @@ DevPathFromTextFibre (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextFibreEx (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
CHAR16 *WWNStr;
@@ -1136,20 +1147,20 @@ DevPathFromTextFibreEx (
WWNStr = GetNextParamStr (&TextDeviceNode);
LunStr = GetNextParamStr (&TextDeviceNode);
- FibreEx = (FIBRECHANNELEX_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_FIBRECHANNELEX_DP,
- (UINT16) sizeof (FIBRECHANNELEX_DEVICE_PATH)
- );
+ FibreEx = (FIBRECHANNELEX_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_FIBRECHANNELEX_DP,
+ (UINT16)sizeof (FIBRECHANNELEX_DEVICE_PATH)
+ );
FibreEx->Reserved = 0;
- Strtoi64 (WWNStr, (UINT64 *) (&FibreEx->WWN));
- Strtoi64 (LunStr, (UINT64 *) (&FibreEx->Lun));
+ Strtoi64 (WWNStr, (UINT64 *)(&FibreEx->WWN));
+ Strtoi64 (LunStr, (UINT64 *)(&FibreEx->Lun));
- *(UINT64 *) (&FibreEx->WWN) = SwapBytes64 (*(UINT64 *) (&FibreEx->WWN));
- *(UINT64 *) (&FibreEx->Lun) = SwapBytes64 (*(UINT64 *) (&FibreEx->Lun));
+ *(UINT64 *)(&FibreEx->WWN) = SwapBytes64 (*(UINT64 *)(&FibreEx->WWN));
+ *(UINT64 *)(&FibreEx->Lun) = SwapBytes64 (*(UINT64 *)(&FibreEx->Lun));
- return (EFI_DEVICE_PATH_PROTOCOL *) FibreEx;
+ return (EFI_DEVICE_PATH_PROTOCOL *)FibreEx;
}
/**
@@ -1162,23 +1173,23 @@ DevPathFromTextFibreEx (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromText1394 (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
- CHAR16 *GuidStr;
- F1394_DEVICE_PATH *F1394DevPath;
+ CHAR16 *GuidStr;
+ F1394_DEVICE_PATH *F1394DevPath;
- GuidStr = GetNextParamStr (&TextDeviceNode);
- F1394DevPath = (F1394_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_1394_DP,
- (UINT16) sizeof (F1394_DEVICE_PATH)
- );
+ GuidStr = GetNextParamStr (&TextDeviceNode);
+ F1394DevPath = (F1394_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_1394_DP,
+ (UINT16)sizeof (F1394_DEVICE_PATH)
+ );
F1394DevPath->Reserved = 0;
F1394DevPath->Guid = StrHexToUint64 (GuidStr);
- return (EFI_DEVICE_PATH_PROTOCOL *) F1394DevPath;
+ return (EFI_DEVICE_PATH_PROTOCOL *)F1394DevPath;
}
/**
@@ -1191,25 +1202,25 @@ DevPathFromText1394 (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextUsb (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
- CHAR16 *PortStr;
- CHAR16 *InterfaceStr;
- USB_DEVICE_PATH *Usb;
+ CHAR16 *PortStr;
+ CHAR16 *InterfaceStr;
+ USB_DEVICE_PATH *Usb;
- PortStr = GetNextParamStr (&TextDeviceNode);
- InterfaceStr = GetNextParamStr (&TextDeviceNode);
- Usb = (USB_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_USB_DP,
- (UINT16) sizeof (USB_DEVICE_PATH)
- );
+ PortStr = GetNextParamStr (&TextDeviceNode);
+ InterfaceStr = GetNextParamStr (&TextDeviceNode);
+ Usb = (USB_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_USB_DP,
+ (UINT16)sizeof (USB_DEVICE_PATH)
+ );
- Usb->ParentPortNumber = (UINT8) Strtoi (PortStr);
- Usb->InterfaceNumber = (UINT8) Strtoi (InterfaceStr);
+ Usb->ParentPortNumber = (UINT8)Strtoi (PortStr);
+ Usb->InterfaceNumber = (UINT8)Strtoi (InterfaceStr);
- return (EFI_DEVICE_PATH_PROTOCOL *) Usb;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Usb;
}
/**
@@ -1222,22 +1233,22 @@ DevPathFromTextUsb (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextI2O (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
- CHAR16 *TIDStr;
- I2O_DEVICE_PATH *I2ODevPath;
+ CHAR16 *TIDStr;
+ I2O_DEVICE_PATH *I2ODevPath;
TIDStr = GetNextParamStr (&TextDeviceNode);
- I2ODevPath = (I2O_DEVICE_PATH *) CreateDeviceNode (
+ I2ODevPath = (I2O_DEVICE_PATH *)CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_I2O_DP,
- (UINT16) sizeof (I2O_DEVICE_PATH)
+ (UINT16)sizeof (I2O_DEVICE_PATH)
);
- I2ODevPath->Tid = (UINT32) Strtoi (TIDStr);
+ I2ODevPath->Tid = (UINT32)Strtoi (TIDStr);
- return (EFI_DEVICE_PATH_PROTOCOL *) I2ODevPath;
+ return (EFI_DEVICE_PATH_PROTOCOL *)I2ODevPath;
}
/**
@@ -1250,7 +1261,7 @@ DevPathFromTextI2O (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextInfiniband (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
CHAR16 *FlagsStr;
@@ -1265,19 +1276,19 @@ DevPathFromTextInfiniband (
SidStr = GetNextParamStr (&TextDeviceNode);
TidStr = GetNextParamStr (&TextDeviceNode);
DidStr = GetNextParamStr (&TextDeviceNode);
- InfiniBand = (INFINIBAND_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_INFINIBAND_DP,
- (UINT16) sizeof (INFINIBAND_DEVICE_PATH)
- );
+ InfiniBand = (INFINIBAND_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_INFINIBAND_DP,
+ (UINT16)sizeof (INFINIBAND_DEVICE_PATH)
+ );
- InfiniBand->ResourceFlags = (UINT32) Strtoi (FlagsStr);
- StrToGuid (GuidStr, (EFI_GUID *) InfiniBand->PortGid);
+ InfiniBand->ResourceFlags = (UINT32)Strtoi (FlagsStr);
+ StrToGuid (GuidStr, (EFI_GUID *)InfiniBand->PortGid);
Strtoi64 (SidStr, &InfiniBand->ServiceId);
Strtoi64 (TidStr, &InfiniBand->TargetPortId);
Strtoi64 (DidStr, &InfiniBand->DeviceId);
- return (EFI_DEVICE_PATH_PROTOCOL *) InfiniBand;
+ return (EFI_DEVICE_PATH_PROTOCOL *)InfiniBand;
}
/**
@@ -1290,14 +1301,14 @@ DevPathFromTextInfiniband (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextVenMsg (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
return ConvertFromTextVendor (
- TextDeviceNode,
- MESSAGING_DEVICE_PATH,
- MSG_VENDOR_DP
- );
+ TextDeviceNode,
+ MESSAGING_DEVICE_PATH,
+ MSG_VENDOR_DP
+ );
}
/**
@@ -1310,18 +1321,19 @@ DevPathFromTextVenMsg (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextVenPcAnsi (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
VENDOR_DEVICE_PATH *Vendor;
- Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_VENDOR_DP,
- (UINT16) sizeof (VENDOR_DEVICE_PATH));
+ Vendor = (VENDOR_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_VENDOR_DP,
+ (UINT16)sizeof (VENDOR_DEVICE_PATH)
+ );
CopyGuid (&Vendor->Guid, &gEfiPcAnsiGuid);
- return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Vendor;
}
/**
@@ -1334,18 +1346,19 @@ DevPathFromTextVenPcAnsi (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextVenVt100 (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
VENDOR_DEVICE_PATH *Vendor;
- Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_VENDOR_DP,
- (UINT16) sizeof (VENDOR_DEVICE_PATH));
+ Vendor = (VENDOR_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_VENDOR_DP,
+ (UINT16)sizeof (VENDOR_DEVICE_PATH)
+ );
CopyGuid (&Vendor->Guid, &gEfiVT100Guid);
- return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Vendor;
}
/**
@@ -1358,18 +1371,19 @@ DevPathFromTextVenVt100 (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextVenVt100Plus (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
VENDOR_DEVICE_PATH *Vendor;
- Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_VENDOR_DP,
- (UINT16) sizeof (VENDOR_DEVICE_PATH));
+ Vendor = (VENDOR_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_VENDOR_DP,
+ (UINT16)sizeof (VENDOR_DEVICE_PATH)
+ );
CopyGuid (&Vendor->Guid, &gEfiVT100PlusGuid);
- return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Vendor;
}
/**
@@ -1382,18 +1396,19 @@ DevPathFromTextVenVt100Plus (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextVenUtf8 (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
VENDOR_DEVICE_PATH *Vendor;
- Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_VENDOR_DP,
- (UINT16) sizeof (VENDOR_DEVICE_PATH));
+ Vendor = (VENDOR_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_VENDOR_DP,
+ (UINT16)sizeof (VENDOR_DEVICE_PATH)
+ );
CopyGuid (&Vendor->Guid, &gEfiVTUTF8Guid);
- return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Vendor;
}
/**
@@ -1406,18 +1421,18 @@ DevPathFromTextVenUtf8 (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextUartFlowCtrl (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
- CHAR16 *ValueStr;
- UART_FLOW_CONTROL_DEVICE_PATH *UartFlowControl;
+ CHAR16 *ValueStr;
+ UART_FLOW_CONTROL_DEVICE_PATH *UartFlowControl;
ValueStr = GetNextParamStr (&TextDeviceNode);
- UartFlowControl = (UART_FLOW_CONTROL_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_VENDOR_DP,
- (UINT16) sizeof (UART_FLOW_CONTROL_DEVICE_PATH)
- );
+ UartFlowControl = (UART_FLOW_CONTROL_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_VENDOR_DP,
+ (UINT16)sizeof (UART_FLOW_CONTROL_DEVICE_PATH)
+ );
CopyGuid (&UartFlowControl->Guid, &gEfiUartDevicePathGuid);
if (StrCmp (ValueStr, L"XonXoff") == 0) {
@@ -1428,7 +1443,7 @@ DevPathFromTextUartFlowCtrl (
UartFlowControl->FlowControlMap = 0;
}
- return (EFI_DEVICE_PATH_PROTOCOL *) UartFlowControl;
+ return (EFI_DEVICE_PATH_PROTOCOL *)UartFlowControl;
}
/**
@@ -1441,20 +1456,20 @@ DevPathFromTextUartFlowCtrl (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextSAS (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
- CHAR16 *AddressStr;
- CHAR16 *LunStr;
- CHAR16 *RTPStr;
- CHAR16 *SASSATAStr;
- CHAR16 *LocationStr;
- CHAR16 *ConnectStr;
- CHAR16 *DriveBayStr;
- CHAR16 *ReservedStr;
- UINT16 Info;
- UINT16 Uint16;
- SAS_DEVICE_PATH *Sas;
+ CHAR16 *AddressStr;
+ CHAR16 *LunStr;
+ CHAR16 *RTPStr;
+ CHAR16 *SASSATAStr;
+ CHAR16 *LocationStr;
+ CHAR16 *ConnectStr;
+ CHAR16 *DriveBayStr;
+ CHAR16 *ReservedStr;
+ UINT16 Info;
+ UINT16 Uint16;
+ SAS_DEVICE_PATH *Sas;
AddressStr = GetNextParamStr (&TextDeviceNode);
LunStr = GetNextParamStr (&TextDeviceNode);
@@ -1464,27 +1479,25 @@ DevPathFromTextSAS (
ConnectStr = GetNextParamStr (&TextDeviceNode);
DriveBayStr = GetNextParamStr (&TextDeviceNode);
ReservedStr = GetNextParamStr (&TextDeviceNode);
- Sas = (SAS_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_VENDOR_DP,
- (UINT16) sizeof (SAS_DEVICE_PATH)
- );
+ Sas = (SAS_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_VENDOR_DP,
+ (UINT16)sizeof (SAS_DEVICE_PATH)
+ );
CopyGuid (&Sas->Guid, &gEfiSasDevicePathGuid);
Strtoi64 (AddressStr, &Sas->SasAddress);
Strtoi64 (LunStr, &Sas->Lun);
- Sas->RelativeTargetPort = (UINT16) Strtoi (RTPStr);
+ Sas->RelativeTargetPort = (UINT16)Strtoi (RTPStr);
if (StrCmp (SASSATAStr, L"NoTopology") == 0) {
Info = 0x0;
-
} else if ((StrCmp (SASSATAStr, L"SATA") == 0) || (StrCmp (SASSATAStr, L"SAS") == 0)) {
-
- Uint16 = (UINT16) Strtoi (DriveBayStr);
+ Uint16 = (UINT16)Strtoi (DriveBayStr);
if (Uint16 == 0) {
Info = 0x1;
} else {
- Info = (UINT16) (0x2 | ((Uint16 - 1) << 8));
+ Info = (UINT16)(0x2 | ((Uint16 - 1) << 8));
}
if (StrCmp (SASSATAStr, L"SATA") == 0) {
@@ -1500,8 +1513,9 @@ DevPathFromTextSAS (
} else if (StrCmp (LocationStr, L"Internal") == 0) {
Uint16 = 0;
} else {
- Uint16 = ((UINT16) Strtoi (LocationStr) & BIT0);
+ Uint16 = ((UINT16)Strtoi (LocationStr) & BIT0);
}
+
Info |= (Uint16 << 5);
//
@@ -1513,18 +1527,18 @@ DevPathFromTextSAS (
} else if (StrCmp (ConnectStr, L"Direct") == 0) {
Uint16 = 0;
} else {
- Uint16 = ((UINT16) Strtoi (ConnectStr) & (BIT0 | BIT1));
+ Uint16 = ((UINT16)Strtoi (ConnectStr) & (BIT0 | BIT1));
}
- Info |= (Uint16 << 6);
+ Info |= (Uint16 << 6);
} else {
- Info = (UINT16) Strtoi (SASSATAStr);
+ Info = (UINT16)Strtoi (SASSATAStr);
}
Sas->DeviceTopology = Info;
- Sas->Reserved = (UINT32) Strtoi (ReservedStr);
+ Sas->Reserved = (UINT32)Strtoi (ReservedStr);
- return (EFI_DEVICE_PATH_PROTOCOL *) Sas;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Sas;
}
/**
@@ -1537,21 +1551,21 @@ DevPathFromTextSAS (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextSasEx (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *AddressStr;
- CHAR16 *LunStr;
- CHAR16 *RTPStr;
- CHAR16 *SASSATAStr;
- CHAR16 *LocationStr;
- CHAR16 *ConnectStr;
- CHAR16 *DriveBayStr;
- UINT16 Info;
- UINT16 Uint16;
- UINT64 SasAddress;
- UINT64 Lun;
- SASEX_DEVICE_PATH *SasEx;
+ IN CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *AddressStr;
+ CHAR16 *LunStr;
+ CHAR16 *RTPStr;
+ CHAR16 *SASSATAStr;
+ CHAR16 *LocationStr;
+ CHAR16 *ConnectStr;
+ CHAR16 *DriveBayStr;
+ UINT16 Info;
+ UINT16 Uint16;
+ UINT64 SasAddress;
+ UINT64 Lun;
+ SASEX_DEVICE_PATH *SasEx;
AddressStr = GetNextParamStr (&TextDeviceNode);
LunStr = GetNextParamStr (&TextDeviceNode);
@@ -1560,28 +1574,26 @@ DevPathFromTextSasEx (
LocationStr = GetNextParamStr (&TextDeviceNode);
ConnectStr = GetNextParamStr (&TextDeviceNode);
DriveBayStr = GetNextParamStr (&TextDeviceNode);
- SasEx = (SASEX_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_SASEX_DP,
- (UINT16) sizeof (SASEX_DEVICE_PATH)
- );
+ SasEx = (SASEX_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_SASEX_DP,
+ (UINT16)sizeof (SASEX_DEVICE_PATH)
+ );
Strtoi64 (AddressStr, &SasAddress);
- Strtoi64 (LunStr, &Lun);
- WriteUnaligned64 ((UINT64 *) &SasEx->SasAddress, SwapBytes64 (SasAddress));
- WriteUnaligned64 ((UINT64 *) &SasEx->Lun, SwapBytes64 (Lun));
- SasEx->RelativeTargetPort = (UINT16) Strtoi (RTPStr);
+ Strtoi64 (LunStr, &Lun);
+ WriteUnaligned64 ((UINT64 *)&SasEx->SasAddress, SwapBytes64 (SasAddress));
+ WriteUnaligned64 ((UINT64 *)&SasEx->Lun, SwapBytes64 (Lun));
+ SasEx->RelativeTargetPort = (UINT16)Strtoi (RTPStr);
if (StrCmp (SASSATAStr, L"NoTopology") == 0) {
Info = 0x0;
-
} else if ((StrCmp (SASSATAStr, L"SATA") == 0) || (StrCmp (SASSATAStr, L"SAS") == 0)) {
-
- Uint16 = (UINT16) Strtoi (DriveBayStr);
+ Uint16 = (UINT16)Strtoi (DriveBayStr);
if (Uint16 == 0) {
Info = 0x1;
} else {
- Info = (UINT16) (0x2 | ((Uint16 - 1) << 8));
+ Info = (UINT16)(0x2 | ((Uint16 - 1) << 8));
}
if (StrCmp (SASSATAStr, L"SATA") == 0) {
@@ -1597,8 +1609,9 @@ DevPathFromTextSasEx (
} else if (StrCmp (LocationStr, L"Internal") == 0) {
Uint16 = 0;
} else {
- Uint16 = ((UINT16) Strtoi (LocationStr) & BIT0);
+ Uint16 = ((UINT16)Strtoi (LocationStr) & BIT0);
}
+
Info |= (Uint16 << 5);
//
@@ -1610,17 +1623,17 @@ DevPathFromTextSasEx (
} else if (StrCmp (ConnectStr, L"Direct") == 0) {
Uint16 = 0;
} else {
- Uint16 = ((UINT16) Strtoi (ConnectStr) & (BIT0 | BIT1));
+ Uint16 = ((UINT16)Strtoi (ConnectStr) & (BIT0 | BIT1));
}
- Info |= (Uint16 << 6);
+ Info |= (Uint16 << 6);
} else {
- Info = (UINT16) Strtoi (SASSATAStr);
+ Info = (UINT16)Strtoi (SASSATAStr);
}
SasEx->DeviceTopology = Info;
- return (EFI_DEVICE_PATH_PROTOCOL *) SasEx;
+ return (EFI_DEVICE_PATH_PROTOCOL *)SasEx;
}
/**
@@ -1633,32 +1646,32 @@ DevPathFromTextSasEx (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextNVMe (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
- CHAR16 *NamespaceIdStr;
- CHAR16 *NamespaceUuidStr;
- NVME_NAMESPACE_DEVICE_PATH *Nvme;
- UINT8 *Uuid;
- UINTN Index;
+ CHAR16 *NamespaceIdStr;
+ CHAR16 *NamespaceUuidStr;
+ NVME_NAMESPACE_DEVICE_PATH *Nvme;
+ UINT8 *Uuid;
+ UINTN Index;
NamespaceIdStr = GetNextParamStr (&TextDeviceNode);
NamespaceUuidStr = GetNextParamStr (&TextDeviceNode);
- Nvme = (NVME_NAMESPACE_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_NVME_NAMESPACE_DP,
- (UINT16) sizeof (NVME_NAMESPACE_DEVICE_PATH)
- );
+ Nvme = (NVME_NAMESPACE_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_NVME_NAMESPACE_DP,
+ (UINT16)sizeof (NVME_NAMESPACE_DEVICE_PATH)
+ );
- Nvme->NamespaceId = (UINT32) Strtoi (NamespaceIdStr);
- Uuid = (UINT8 *) &Nvme->NamespaceUuid;
+ Nvme->NamespaceId = (UINT32)Strtoi (NamespaceIdStr);
+ Uuid = (UINT8 *)&Nvme->NamespaceUuid;
Index = sizeof (Nvme->NamespaceUuid) / sizeof (UINT8);
while (Index-- != 0) {
- Uuid[Index] = (UINT8) StrHexToUintn (SplitStr (&NamespaceUuidStr, L'-'));
+ Uuid[Index] = (UINT8)StrHexToUintn (SplitStr (&NamespaceUuidStr, L'-'));
}
- return (EFI_DEVICE_PATH_PROTOCOL *) Nvme;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Nvme;
}
/**
@@ -1671,25 +1684,25 @@ DevPathFromTextNVMe (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextUfs (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
- CHAR16 *PunStr;
- CHAR16 *LunStr;
- UFS_DEVICE_PATH *Ufs;
+ CHAR16 *PunStr;
+ CHAR16 *LunStr;
+ UFS_DEVICE_PATH *Ufs;
PunStr = GetNextParamStr (&TextDeviceNode);
LunStr = GetNextParamStr (&TextDeviceNode);
- Ufs = (UFS_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_UFS_DP,
- (UINT16) sizeof (UFS_DEVICE_PATH)
- );
+ Ufs = (UFS_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_UFS_DP,
+ (UINT16)sizeof (UFS_DEVICE_PATH)
+ );
- Ufs->Pun = (UINT8) Strtoi (PunStr);
- Ufs->Lun = (UINT8) Strtoi (LunStr);
+ Ufs->Pun = (UINT8)Strtoi (PunStr);
+ Ufs->Lun = (UINT8)Strtoi (LunStr);
- return (EFI_DEVICE_PATH_PROTOCOL *) Ufs;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Ufs;
}
/**
@@ -1702,22 +1715,22 @@ DevPathFromTextUfs (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextSd (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
- CHAR16 *SlotNumberStr;
- SD_DEVICE_PATH *Sd;
+ CHAR16 *SlotNumberStr;
+ SD_DEVICE_PATH *Sd;
SlotNumberStr = GetNextParamStr (&TextDeviceNode);
- Sd = (SD_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_SD_DP,
- (UINT16) sizeof (SD_DEVICE_PATH)
- );
+ Sd = (SD_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_SD_DP,
+ (UINT16)sizeof (SD_DEVICE_PATH)
+ );
- Sd->SlotNumber = (UINT8) Strtoi (SlotNumberStr);
+ Sd->SlotNumber = (UINT8)Strtoi (SlotNumberStr);
- return (EFI_DEVICE_PATH_PROTOCOL *) Sd;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Sd;
}
/**
@@ -1730,22 +1743,22 @@ DevPathFromTextSd (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextEmmc (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
CHAR16 *SlotNumberStr;
EMMC_DEVICE_PATH *Emmc;
SlotNumberStr = GetNextParamStr (&TextDeviceNode);
- Emmc = (EMMC_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_EMMC_DP,
- (UINT16) sizeof (EMMC_DEVICE_PATH)
- );
+ Emmc = (EMMC_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_EMMC_DP,
+ (UINT16)sizeof (EMMC_DEVICE_PATH)
+ );
- Emmc->SlotNumber = (UINT8) Strtoi (SlotNumberStr);
+ Emmc->SlotNumber = (UINT8)Strtoi (SlotNumberStr);
- return (EFI_DEVICE_PATH_PROTOCOL *) Emmc;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Emmc;
}
/**
@@ -1758,20 +1771,20 @@ DevPathFromTextEmmc (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextDebugPort (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
VENDOR_DEVICE_PATH *Vend;
- Vend = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_VENDOR_DP,
- (UINT16) sizeof (VENDOR_DEVICE_PATH)
- );
+ Vend = (VENDOR_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_VENDOR_DP,
+ (UINT16)sizeof (VENDOR_DEVICE_PATH)
+ );
CopyGuid (&Vend->Guid, &gEfiDebugPortProtocolGuid);
- return (EFI_DEVICE_PATH_PROTOCOL *) Vend;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Vend;
}
/**
@@ -1784,7 +1797,7 @@ DevPathFromTextDebugPort (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextMAC (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
CHAR16 *AddressStr;
@@ -1792,27 +1805,26 @@ DevPathFromTextMAC (
UINTN Length;
MAC_ADDR_DEVICE_PATH *MACDevPath;
- AddressStr = GetNextParamStr (&TextDeviceNode);
- IfTypeStr = GetNextParamStr (&TextDeviceNode);
- MACDevPath = (MAC_ADDR_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_MAC_ADDR_DP,
- (UINT16) sizeof (MAC_ADDR_DEVICE_PATH)
- );
+ AddressStr = GetNextParamStr (&TextDeviceNode);
+ IfTypeStr = GetNextParamStr (&TextDeviceNode);
+ MACDevPath = (MAC_ADDR_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_MAC_ADDR_DP,
+ (UINT16)sizeof (MAC_ADDR_DEVICE_PATH)
+ );
- MACDevPath->IfType = (UINT8) Strtoi (IfTypeStr);
+ MACDevPath->IfType = (UINT8)Strtoi (IfTypeStr);
Length = sizeof (EFI_MAC_ADDRESS);
- if (MACDevPath->IfType == 0x01 || MACDevPath->IfType == 0x00) {
+ if ((MACDevPath->IfType == 0x01) || (MACDevPath->IfType == 0x00)) {
Length = 6;
}
StrHexToBytes (AddressStr, Length * 2, MACDevPath->MacAddress.Addr, Length);
- return (EFI_DEVICE_PATH_PROTOCOL *) MACDevPath;
+ return (EFI_DEVICE_PATH_PROTOCOL *)MACDevPath;
}
-
/**
Converts a text format to the network protocol ID.
@@ -1823,7 +1835,7 @@ DevPathFromTextMAC (
**/
UINTN
NetworkProtocolFromText (
- IN CHAR16 *Text
+ IN CHAR16 *Text
)
{
if (StrCmp (Text, L"UDP") == 0) {
@@ -1837,7 +1849,6 @@ NetworkProtocolFromText (
return Strtoi (Text);
}
-
/**
Converts a text device path node to IPV4 device path structure.
@@ -1848,7 +1859,7 @@ NetworkProtocolFromText (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextIPv4 (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
CHAR16 *RemoteIPStr;
@@ -1859,20 +1870,20 @@ DevPathFromTextIPv4 (
CHAR16 *SubnetMaskStr;
IPv4_DEVICE_PATH *IPv4;
- RemoteIPStr = GetNextParamStr (&TextDeviceNode);
- ProtocolStr = GetNextParamStr (&TextDeviceNode);
- TypeStr = GetNextParamStr (&TextDeviceNode);
- LocalIPStr = GetNextParamStr (&TextDeviceNode);
- GatewayIPStr = GetNextParamStr (&TextDeviceNode);
- SubnetMaskStr = GetNextParamStr (&TextDeviceNode);
- IPv4 = (IPv4_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_IPv4_DP,
- (UINT16) sizeof (IPv4_DEVICE_PATH)
- );
+ RemoteIPStr = GetNextParamStr (&TextDeviceNode);
+ ProtocolStr = GetNextParamStr (&TextDeviceNode);
+ TypeStr = GetNextParamStr (&TextDeviceNode);
+ LocalIPStr = GetNextParamStr (&TextDeviceNode);
+ GatewayIPStr = GetNextParamStr (&TextDeviceNode);
+ SubnetMaskStr = GetNextParamStr (&TextDeviceNode);
+ IPv4 = (IPv4_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_IPv4_DP,
+ (UINT16)sizeof (IPv4_DEVICE_PATH)
+ );
StrToIpv4Address (RemoteIPStr, NULL, &IPv4->RemoteIpAddress, NULL);
- IPv4->Protocol = (UINT16) NetworkProtocolFromText (ProtocolStr);
+ IPv4->Protocol = (UINT16)NetworkProtocolFromText (ProtocolStr);
if (StrCmp (TypeStr, L"Static") == 0) {
IPv4->StaticIpAddress = TRUE;
} else {
@@ -1881,17 +1892,17 @@ DevPathFromTextIPv4 (
StrToIpv4Address (LocalIPStr, NULL, &IPv4->LocalIpAddress, NULL);
if (!IS_NULL (*GatewayIPStr) && !IS_NULL (*SubnetMaskStr)) {
- StrToIpv4Address (GatewayIPStr, NULL, &IPv4->GatewayIpAddress, NULL);
- StrToIpv4Address (SubnetMaskStr, NULL, &IPv4->SubnetMask, NULL);
+ StrToIpv4Address (GatewayIPStr, NULL, &IPv4->GatewayIpAddress, NULL);
+ StrToIpv4Address (SubnetMaskStr, NULL, &IPv4->SubnetMask, NULL);
} else {
ZeroMem (&IPv4->GatewayIpAddress, sizeof (IPv4->GatewayIpAddress));
- ZeroMem (&IPv4->SubnetMask, sizeof (IPv4->SubnetMask));
+ ZeroMem (&IPv4->SubnetMask, sizeof (IPv4->SubnetMask));
}
- IPv4->LocalPort = 0;
- IPv4->RemotePort = 0;
+ IPv4->LocalPort = 0;
+ IPv4->RemotePort = 0;
- return (EFI_DEVICE_PATH_PROTOCOL *) IPv4;
+ return (EFI_DEVICE_PATH_PROTOCOL *)IPv4;
}
/**
@@ -1904,7 +1915,7 @@ DevPathFromTextIPv4 (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextIPv6 (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
CHAR16 *RemoteIPStr;
@@ -1915,20 +1926,20 @@ DevPathFromTextIPv6 (
CHAR16 *PrefixLengthStr;
IPv6_DEVICE_PATH *IPv6;
- RemoteIPStr = GetNextParamStr (&TextDeviceNode);
- ProtocolStr = GetNextParamStr (&TextDeviceNode);
- TypeStr = GetNextParamStr (&TextDeviceNode);
- LocalIPStr = GetNextParamStr (&TextDeviceNode);
- PrefixLengthStr = GetNextParamStr (&TextDeviceNode);
- GatewayIPStr = GetNextParamStr (&TextDeviceNode);
- IPv6 = (IPv6_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_IPv6_DP,
- (UINT16) sizeof (IPv6_DEVICE_PATH)
- );
+ RemoteIPStr = GetNextParamStr (&TextDeviceNode);
+ ProtocolStr = GetNextParamStr (&TextDeviceNode);
+ TypeStr = GetNextParamStr (&TextDeviceNode);
+ LocalIPStr = GetNextParamStr (&TextDeviceNode);
+ PrefixLengthStr = GetNextParamStr (&TextDeviceNode);
+ GatewayIPStr = GetNextParamStr (&TextDeviceNode);
+ IPv6 = (IPv6_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_IPv6_DP,
+ (UINT16)sizeof (IPv6_DEVICE_PATH)
+ );
StrToIpv6Address (RemoteIPStr, NULL, &IPv6->RemoteIpAddress, NULL);
- IPv6->Protocol = (UINT16) NetworkProtocolFromText (ProtocolStr);
+ IPv6->Protocol = (UINT16)NetworkProtocolFromText (ProtocolStr);
if (StrCmp (TypeStr, L"Static") == 0) {
IPv6->IpAddressOrigin = 0;
} else if (StrCmp (TypeStr, L"StatelessAutoConfigure") == 0) {
@@ -1940,16 +1951,16 @@ DevPathFromTextIPv6 (
StrToIpv6Address (LocalIPStr, NULL, &IPv6->LocalIpAddress, NULL);
if (!IS_NULL (*GatewayIPStr) && !IS_NULL (*PrefixLengthStr)) {
StrToIpv6Address (GatewayIPStr, NULL, &IPv6->GatewayIpAddress, NULL);
- IPv6->PrefixLength = (UINT8) Strtoi (PrefixLengthStr);
+ IPv6->PrefixLength = (UINT8)Strtoi (PrefixLengthStr);
} else {
ZeroMem (&IPv6->GatewayIpAddress, sizeof (IPv6->GatewayIpAddress));
IPv6->PrefixLength = 0;
}
- IPv6->LocalPort = 0;
- IPv6->RemotePort = 0;
+ IPv6->LocalPort = 0;
+ IPv6->RemotePort = 0;
- return (EFI_DEVICE_PATH_PROTOCOL *) IPv6;
+ return (EFI_DEVICE_PATH_PROTOCOL *)IPv6;
}
/**
@@ -1962,7 +1973,7 @@ DevPathFromTextIPv6 (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextUart (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
CHAR16 *BaudStr;
@@ -1971,65 +1982,66 @@ DevPathFromTextUart (
CHAR16 *StopBitsStr;
UART_DEVICE_PATH *Uart;
- BaudStr = GetNextParamStr (&TextDeviceNode);
- DataBitsStr = GetNextParamStr (&TextDeviceNode);
- ParityStr = GetNextParamStr (&TextDeviceNode);
- StopBitsStr = GetNextParamStr (&TextDeviceNode);
- Uart = (UART_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_UART_DP,
- (UINT16) sizeof (UART_DEVICE_PATH)
- );
+ BaudStr = GetNextParamStr (&TextDeviceNode);
+ DataBitsStr = GetNextParamStr (&TextDeviceNode);
+ ParityStr = GetNextParamStr (&TextDeviceNode);
+ StopBitsStr = GetNextParamStr (&TextDeviceNode);
+ Uart = (UART_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_UART_DP,
+ (UINT16)sizeof (UART_DEVICE_PATH)
+ );
if (StrCmp (BaudStr, L"DEFAULT") == 0) {
Uart->BaudRate = 115200;
} else {
Strtoi64 (BaudStr, &Uart->BaudRate);
}
- Uart->DataBits = (UINT8) ((StrCmp (DataBitsStr, L"DEFAULT") == 0) ? 8 : Strtoi (DataBitsStr));
+
+ Uart->DataBits = (UINT8)((StrCmp (DataBitsStr, L"DEFAULT") == 0) ? 8 : Strtoi (DataBitsStr));
switch (*ParityStr) {
- case L'D':
- Uart->Parity = 0;
- break;
+ case L'D':
+ Uart->Parity = 0;
+ break;
- case L'N':
- Uart->Parity = 1;
- break;
+ case L'N':
+ Uart->Parity = 1;
+ break;
- case L'E':
- Uart->Parity = 2;
- break;
+ case L'E':
+ Uart->Parity = 2;
+ break;
- case L'O':
- Uart->Parity = 3;
- break;
+ case L'O':
+ Uart->Parity = 3;
+ break;
- case L'M':
- Uart->Parity = 4;
- break;
+ case L'M':
+ Uart->Parity = 4;
+ break;
- case L'S':
- Uart->Parity = 5;
- break;
+ case L'S':
+ Uart->Parity = 5;
+ break;
- default:
- Uart->Parity = (UINT8) Strtoi (ParityStr);
- break;
+ default:
+ Uart->Parity = (UINT8)Strtoi (ParityStr);
+ break;
}
if (StrCmp (StopBitsStr, L"D") == 0) {
- Uart->StopBits = (UINT8) 0;
+ Uart->StopBits = (UINT8)0;
} else if (StrCmp (StopBitsStr, L"1") == 0) {
- Uart->StopBits = (UINT8) 1;
+ Uart->StopBits = (UINT8)1;
} else if (StrCmp (StopBitsStr, L"1.5") == 0) {
- Uart->StopBits = (UINT8) 2;
+ Uart->StopBits = (UINT8)2;
} else if (StrCmp (StopBitsStr, L"2") == 0) {
- Uart->StopBits = (UINT8) 3;
+ Uart->StopBits = (UINT8)3;
} else {
- Uart->StopBits = (UINT8) Strtoi (StopBitsStr);
+ Uart->StopBits = (UINT8)Strtoi (StopBitsStr);
}
- return (EFI_DEVICE_PATH_PROTOCOL *) Uart;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Uart;
}
/**
@@ -2043,41 +2055,42 @@ DevPathFromTextUart (
**/
EFI_DEVICE_PATH_PROTOCOL *
ConvertFromTextUsbClass (
- IN CHAR16 *TextDeviceNode,
- IN USB_CLASS_TEXT *UsbClassText
+ IN CHAR16 *TextDeviceNode,
+ IN USB_CLASS_TEXT *UsbClassText
)
{
- CHAR16 *VIDStr;
- CHAR16 *PIDStr;
- CHAR16 *ClassStr;
- CHAR16 *SubClassStr;
- CHAR16 *ProtocolStr;
- USB_CLASS_DEVICE_PATH *UsbClass;
+ CHAR16 *VIDStr;
+ CHAR16 *PIDStr;
+ CHAR16 *ClassStr;
+ CHAR16 *SubClassStr;
+ CHAR16 *ProtocolStr;
+ USB_CLASS_DEVICE_PATH *UsbClass;
- UsbClass = (USB_CLASS_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_USB_CLASS_DP,
- (UINT16) sizeof (USB_CLASS_DEVICE_PATH)
- );
+ UsbClass = (USB_CLASS_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_USB_CLASS_DP,
+ (UINT16)sizeof (USB_CLASS_DEVICE_PATH)
+ );
- VIDStr = GetNextParamStr (&TextDeviceNode);
- PIDStr = GetNextParamStr (&TextDeviceNode);
+ VIDStr = GetNextParamStr (&TextDeviceNode);
+ PIDStr = GetNextParamStr (&TextDeviceNode);
if (UsbClassText->ClassExist) {
ClassStr = GetNextParamStr (&TextDeviceNode);
if (*ClassStr == L'\0') {
UsbClass->DeviceClass = 0xFF;
} else {
- UsbClass->DeviceClass = (UINT8) Strtoi (ClassStr);
+ UsbClass->DeviceClass = (UINT8)Strtoi (ClassStr);
}
} else {
UsbClass->DeviceClass = UsbClassText->Class;
}
+
if (UsbClassText->SubClassExist) {
SubClassStr = GetNextParamStr (&TextDeviceNode);
if (*SubClassStr == L'\0') {
UsbClass->DeviceSubClass = 0xFF;
} else {
- UsbClass->DeviceSubClass = (UINT8) Strtoi (SubClassStr);
+ UsbClass->DeviceSubClass = (UINT8)Strtoi (SubClassStr);
}
} else {
UsbClass->DeviceSubClass = UsbClassText->SubClass;
@@ -2086,25 +2099,26 @@ ConvertFromTextUsbClass (
ProtocolStr = GetNextParamStr (&TextDeviceNode);
if (*VIDStr == L'\0') {
- UsbClass->VendorId = 0xFFFF;
+ UsbClass->VendorId = 0xFFFF;
} else {
- UsbClass->VendorId = (UINT16) Strtoi (VIDStr);
+ UsbClass->VendorId = (UINT16)Strtoi (VIDStr);
}
+
if (*PIDStr == L'\0') {
- UsbClass->ProductId = 0xFFFF;
+ UsbClass->ProductId = 0xFFFF;
} else {
- UsbClass->ProductId = (UINT16) Strtoi (PIDStr);
+ UsbClass->ProductId = (UINT16)Strtoi (PIDStr);
}
+
if (*ProtocolStr == L'\0') {
- UsbClass->DeviceProtocol = 0xFF;
+ UsbClass->DeviceProtocol = 0xFF;
} else {
- UsbClass->DeviceProtocol = (UINT8) Strtoi (ProtocolStr);
+ UsbClass->DeviceProtocol = (UINT8)Strtoi (ProtocolStr);
}
- return (EFI_DEVICE_PATH_PROTOCOL *) UsbClass;
+ return (EFI_DEVICE_PATH_PROTOCOL *)UsbClass;
}
-
/**
Converts a text device path node to USB class device path structure.
@@ -2115,7 +2129,7 @@ ConvertFromTextUsbClass (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextUsbClass (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
USB_CLASS_TEXT UsbClassText;
@@ -2136,7 +2150,7 @@ DevPathFromTextUsbClass (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextUsbAudio (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
USB_CLASS_TEXT UsbClassText;
@@ -2158,7 +2172,7 @@ DevPathFromTextUsbAudio (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextUsbCDCControl (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
USB_CLASS_TEXT UsbClassText;
@@ -2180,7 +2194,7 @@ DevPathFromTextUsbCDCControl (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextUsbHID (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
USB_CLASS_TEXT UsbClassText;
@@ -2202,7 +2216,7 @@ DevPathFromTextUsbHID (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextUsbImage (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
USB_CLASS_TEXT UsbClassText;
@@ -2224,7 +2238,7 @@ DevPathFromTextUsbImage (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextUsbPrinter (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
USB_CLASS_TEXT UsbClassText;
@@ -2246,7 +2260,7 @@ DevPathFromTextUsbPrinter (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextUsbMassStorage (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
USB_CLASS_TEXT UsbClassText;
@@ -2268,7 +2282,7 @@ DevPathFromTextUsbMassStorage (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextUsbHub (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
USB_CLASS_TEXT UsbClassText;
@@ -2290,7 +2304,7 @@ DevPathFromTextUsbHub (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextUsbCDCData (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
USB_CLASS_TEXT UsbClassText;
@@ -2312,7 +2326,7 @@ DevPathFromTextUsbCDCData (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextUsbSmartCard (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
USB_CLASS_TEXT UsbClassText;
@@ -2334,7 +2348,7 @@ DevPathFromTextUsbSmartCard (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextUsbVideo (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
USB_CLASS_TEXT UsbClassText;
@@ -2356,7 +2370,7 @@ DevPathFromTextUsbVideo (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextUsbDiagnostic (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
USB_CLASS_TEXT UsbClassText;
@@ -2378,7 +2392,7 @@ DevPathFromTextUsbDiagnostic (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextUsbWireless (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
USB_CLASS_TEXT UsbClassText;
@@ -2400,7 +2414,7 @@ DevPathFromTextUsbWireless (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextUsbDeviceFirmwareUpdate (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
USB_CLASS_TEXT UsbClassText;
@@ -2423,7 +2437,7 @@ DevPathFromTextUsbDeviceFirmwareUpdate (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextUsbIrdaBridge (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
USB_CLASS_TEXT UsbClassText;
@@ -2446,7 +2460,7 @@ DevPathFromTextUsbIrdaBridge (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextUsbTestAndMeasurement (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
USB_CLASS_TEXT UsbClassText;
@@ -2469,7 +2483,7 @@ DevPathFromTextUsbTestAndMeasurement (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextUsbWwid (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
CHAR16 *VIDStr;
@@ -2479,39 +2493,41 @@ DevPathFromTextUsbWwid (
USB_WWID_DEVICE_PATH *UsbWwid;
UINTN SerialNumberStrLen;
- VIDStr = GetNextParamStr (&TextDeviceNode);
- PIDStr = GetNextParamStr (&TextDeviceNode);
- InterfaceNumStr = GetNextParamStr (&TextDeviceNode);
- SerialNumberStr = GetNextParamStr (&TextDeviceNode);
- SerialNumberStrLen = StrLen (SerialNumberStr);
- if (SerialNumberStrLen >= 2 &&
- SerialNumberStr[0] == L'\"' &&
- SerialNumberStr[SerialNumberStrLen - 1] == L'\"'
- ) {
+ VIDStr = GetNextParamStr (&TextDeviceNode);
+ PIDStr = GetNextParamStr (&TextDeviceNode);
+ InterfaceNumStr = GetNextParamStr (&TextDeviceNode);
+ SerialNumberStr = GetNextParamStr (&TextDeviceNode);
+ SerialNumberStrLen = StrLen (SerialNumberStr);
+ if ((SerialNumberStrLen >= 2) &&
+ (SerialNumberStr[0] == L'\"') &&
+ (SerialNumberStr[SerialNumberStrLen - 1] == L'\"')
+ )
+ {
SerialNumberStr[SerialNumberStrLen - 1] = L'\0';
SerialNumberStr++;
SerialNumberStrLen -= 2;
}
- UsbWwid = (USB_WWID_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_USB_WWID_DP,
- (UINT16) (sizeof (USB_WWID_DEVICE_PATH) + SerialNumberStrLen * sizeof (CHAR16))
- );
- UsbWwid->VendorId = (UINT16) Strtoi (VIDStr);
- UsbWwid->ProductId = (UINT16) Strtoi (PIDStr);
- UsbWwid->InterfaceNumber = (UINT16) Strtoi (InterfaceNumStr);
+
+ UsbWwid = (USB_WWID_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_USB_WWID_DP,
+ (UINT16)(sizeof (USB_WWID_DEVICE_PATH) + SerialNumberStrLen * sizeof (CHAR16))
+ );
+ UsbWwid->VendorId = (UINT16)Strtoi (VIDStr);
+ UsbWwid->ProductId = (UINT16)Strtoi (PIDStr);
+ UsbWwid->InterfaceNumber = (UINT16)Strtoi (InterfaceNumStr);
//
// There is no memory allocated in UsbWwid for the '\0' in SerialNumberStr.
// Therefore, the '\0' will not be copied.
//
CopyMem (
- (UINT8 *) UsbWwid + sizeof (USB_WWID_DEVICE_PATH),
+ (UINT8 *)UsbWwid + sizeof (USB_WWID_DEVICE_PATH),
SerialNumberStr,
SerialNumberStrLen * sizeof (CHAR16)
);
- return (EFI_DEVICE_PATH_PROTOCOL *) UsbWwid;
+ return (EFI_DEVICE_PATH_PROTOCOL *)UsbWwid;
}
/**
@@ -2524,22 +2540,22 @@ DevPathFromTextUsbWwid (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextUnit (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
- CHAR16 *LunStr;
- DEVICE_LOGICAL_UNIT_DEVICE_PATH *LogicalUnit;
+ CHAR16 *LunStr;
+ DEVICE_LOGICAL_UNIT_DEVICE_PATH *LogicalUnit;
LunStr = GetNextParamStr (&TextDeviceNode);
- LogicalUnit = (DEVICE_LOGICAL_UNIT_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_DEVICE_LOGICAL_UNIT_DP,
- (UINT16) sizeof (DEVICE_LOGICAL_UNIT_DEVICE_PATH)
- );
+ LogicalUnit = (DEVICE_LOGICAL_UNIT_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_DEVICE_LOGICAL_UNIT_DP,
+ (UINT16)sizeof (DEVICE_LOGICAL_UNIT_DEVICE_PATH)
+ );
- LogicalUnit->Lun = (UINT8) Strtoi (LunStr);
+ LogicalUnit->Lun = (UINT8)Strtoi (LunStr);
- return (EFI_DEVICE_PATH_PROTOCOL *) LogicalUnit;
+ return (EFI_DEVICE_PATH_PROTOCOL *)LogicalUnit;
}
/**
@@ -2552,20 +2568,20 @@ DevPathFromTextUnit (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextiSCSI (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
- UINT16 Options;
- CHAR16 *NameStr;
- CHAR16 *PortalGroupStr;
- CHAR16 *LunStr;
- CHAR16 *HeaderDigestStr;
- CHAR16 *DataDigestStr;
- CHAR16 *AuthenticationStr;
- CHAR16 *ProtocolStr;
- CHAR8 *AsciiStr;
- ISCSI_DEVICE_PATH_WITH_NAME *ISCSIDevPath;
- UINT64 Lun;
+ UINT16 Options;
+ CHAR16 *NameStr;
+ CHAR16 *PortalGroupStr;
+ CHAR16 *LunStr;
+ CHAR16 *HeaderDigestStr;
+ CHAR16 *DataDigestStr;
+ CHAR16 *AuthenticationStr;
+ CHAR16 *ProtocolStr;
+ CHAR8 *AsciiStr;
+ ISCSI_DEVICE_PATH_WITH_NAME *ISCSIDevPath;
+ UINT64 Lun;
NameStr = GetNextParamStr (&TextDeviceNode);
PortalGroupStr = GetNextParamStr (&TextDeviceNode);
@@ -2574,18 +2590,18 @@ DevPathFromTextiSCSI (
DataDigestStr = GetNextParamStr (&TextDeviceNode);
AuthenticationStr = GetNextParamStr (&TextDeviceNode);
ProtocolStr = GetNextParamStr (&TextDeviceNode);
- ISCSIDevPath = (ISCSI_DEVICE_PATH_WITH_NAME *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_ISCSI_DP,
- (UINT16) (sizeof (ISCSI_DEVICE_PATH_WITH_NAME) + StrLen (NameStr))
- );
+ ISCSIDevPath = (ISCSI_DEVICE_PATH_WITH_NAME *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_ISCSI_DP,
+ (UINT16)(sizeof (ISCSI_DEVICE_PATH_WITH_NAME) + StrLen (NameStr))
+ );
AsciiStr = ISCSIDevPath->TargetName;
StrToAscii (NameStr, &AsciiStr);
- ISCSIDevPath->TargetPortalGroupTag = (UINT16) Strtoi (PortalGroupStr);
+ ISCSIDevPath->TargetPortalGroupTag = (UINT16)Strtoi (PortalGroupStr);
Strtoi64 (LunStr, &Lun);
- WriteUnaligned64 ((UINT64 *) &ISCSIDevPath->Lun, SwapBytes64 (Lun));
+ WriteUnaligned64 ((UINT64 *)&ISCSIDevPath->Lun, SwapBytes64 (Lun));
Options = 0x0000;
if (StrCmp (HeaderDigestStr, L"CRC32C") == 0) {
@@ -2604,7 +2620,7 @@ DevPathFromTextiSCSI (
Options |= 0x1000;
}
- ISCSIDevPath->LoginOption = (UINT16) Options;
+ ISCSIDevPath->LoginOption = (UINT16)Options;
if (IS_NULL (*ProtocolStr) || (StrCmp (ProtocolStr, L"TCP") == 0)) {
ISCSIDevPath->NetworkProtocol = 0;
@@ -2615,7 +2631,7 @@ DevPathFromTextiSCSI (
ISCSIDevPath->NetworkProtocol = 1;
}
- return (EFI_DEVICE_PATH_PROTOCOL *) ISCSIDevPath;
+ return (EFI_DEVICE_PATH_PROTOCOL *)ISCSIDevPath;
}
/**
@@ -2628,22 +2644,22 @@ DevPathFromTextiSCSI (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextVlan (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
CHAR16 *VlanStr;
VLAN_DEVICE_PATH *Vlan;
VlanStr = GetNextParamStr (&TextDeviceNode);
- Vlan = (VLAN_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_VLAN_DP,
- (UINT16) sizeof (VLAN_DEVICE_PATH)
- );
+ Vlan = (VLAN_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_VLAN_DP,
+ (UINT16)sizeof (VLAN_DEVICE_PATH)
+ );
- Vlan->VlanId = (UINT16) Strtoi (VlanStr);
+ Vlan->VlanId = (UINT16)Strtoi (VlanStr);
- return (EFI_DEVICE_PATH_PROTOCOL *) Vlan;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Vlan;
}
/**
@@ -2656,25 +2672,25 @@ DevPathFromTextVlan (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextBluetooth (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
- CHAR16 *BluetoothStr;
- BLUETOOTH_DEVICE_PATH *BluetoothDp;
+ CHAR16 *BluetoothStr;
+ BLUETOOTH_DEVICE_PATH *BluetoothDp;
BluetoothStr = GetNextParamStr (&TextDeviceNode);
- BluetoothDp = (BLUETOOTH_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_BLUETOOTH_DP,
- (UINT16) sizeof (BLUETOOTH_DEVICE_PATH)
- );
+ BluetoothDp = (BLUETOOTH_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_BLUETOOTH_DP,
+ (UINT16)sizeof (BLUETOOTH_DEVICE_PATH)
+ );
StrHexToBytes (
BluetoothStr,
sizeof (BLUETOOTH_ADDRESS) * 2,
BluetoothDp->BD_ADDR.Address,
sizeof (BLUETOOTH_ADDRESS)
);
- return (EFI_DEVICE_PATH_PROTOCOL *) BluetoothDp;
+ return (EFI_DEVICE_PATH_PROTOCOL *)BluetoothDp;
}
/**
@@ -2687,20 +2703,20 @@ DevPathFromTextBluetooth (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextWiFi (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
- CHAR16 *SSIdStr;
- CHAR8 AsciiStr[33];
- UINTN DataLen;
- WIFI_DEVICE_PATH *WiFiDp;
+ CHAR16 *SSIdStr;
+ CHAR8 AsciiStr[33];
+ UINTN DataLen;
+ WIFI_DEVICE_PATH *WiFiDp;
SSIdStr = GetNextParamStr (&TextDeviceNode);
- WiFiDp = (WIFI_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_WIFI_DP,
- (UINT16) sizeof (WIFI_DEVICE_PATH)
- );
+ WiFiDp = (WIFI_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_WIFI_DP,
+ (UINT16)sizeof (WIFI_DEVICE_PATH)
+ );
if (NULL != SSIdStr) {
DataLen = StrLen (SSIdStr);
@@ -2713,7 +2729,7 @@ DevPathFromTextWiFi (
CopyMem (WiFiDp->SSId, AsciiStr, DataLen);
}
- return (EFI_DEVICE_PATH_PROTOCOL *) WiFiDp;
+ return (EFI_DEVICE_PATH_PROTOCOL *)WiFiDp;
}
/**
@@ -2726,27 +2742,29 @@ DevPathFromTextWiFi (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextBluetoothLE (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
- CHAR16 *BluetoothLeAddrStr;
- CHAR16 *BluetoothLeAddrTypeStr;
- BLUETOOTH_LE_DEVICE_PATH *BluetoothLeDp;
+ CHAR16 *BluetoothLeAddrStr;
+ CHAR16 *BluetoothLeAddrTypeStr;
+ BLUETOOTH_LE_DEVICE_PATH *BluetoothLeDp;
BluetoothLeAddrStr = GetNextParamStr (&TextDeviceNode);
BluetoothLeAddrTypeStr = GetNextParamStr (&TextDeviceNode);
- BluetoothLeDp = (BLUETOOTH_LE_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_BLUETOOTH_LE_DP,
- (UINT16) sizeof (BLUETOOTH_LE_DEVICE_PATH)
- );
+ BluetoothLeDp = (BLUETOOTH_LE_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_BLUETOOTH_LE_DP,
+ (UINT16)sizeof (BLUETOOTH_LE_DEVICE_PATH)
+ );
- BluetoothLeDp->Address.Type = (UINT8) Strtoi (BluetoothLeAddrTypeStr);
+ BluetoothLeDp->Address.Type = (UINT8)Strtoi (BluetoothLeAddrTypeStr);
StrHexToBytes (
- BluetoothLeAddrStr, sizeof (BluetoothLeDp->Address.Address) * 2,
- BluetoothLeDp->Address.Address, sizeof (BluetoothLeDp->Address.Address)
+ BluetoothLeAddrStr,
+ sizeof (BluetoothLeDp->Address.Address) * 2,
+ BluetoothLeDp->Address.Address,
+ sizeof (BluetoothLeDp->Address.Address)
);
- return (EFI_DEVICE_PATH_PROTOCOL *) BluetoothLeDp;
+ return (EFI_DEVICE_PATH_PROTOCOL *)BluetoothLeDp;
}
/**
@@ -2759,17 +2777,16 @@ DevPathFromTextBluetoothLE (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextDns (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
- CHAR16 *DeviceNodeStr;
- CHAR16 *DeviceNodeStrPtr;
- UINT32 DnsServerIpCount;
- UINT16 DnsDeviceNodeLength;
- DNS_DEVICE_PATH *DnsDeviceNode;
- UINT32 DnsServerIpIndex;
- CHAR16 *DnsServerIp;
-
+ CHAR16 *DeviceNodeStr;
+ CHAR16 *DeviceNodeStrPtr;
+ UINT32 DnsServerIpCount;
+ UINT16 DnsDeviceNodeLength;
+ DNS_DEVICE_PATH *DnsDeviceNode;
+ UINT32 DnsServerIpIndex;
+ CHAR16 *DnsServerIp;
//
// Count the DNS server address number.
@@ -2784,7 +2801,7 @@ DevPathFromTextDns (
DnsServerIpCount = 0;
while (DeviceNodeStrPtr != NULL && *DeviceNodeStrPtr != L'\0') {
GetNextParamStr (&DeviceNodeStrPtr);
- DnsServerIpCount ++;
+ DnsServerIpCount++;
}
FreePool (DeviceNodeStr);
@@ -2801,12 +2818,12 @@ DevPathFromTextDns (
//
// Create the DNS DeviceNode.
//
- DnsDeviceNodeLength = (UINT16) (sizeof (EFI_DEVICE_PATH_PROTOCOL) + sizeof (UINT8) + DnsServerIpCount * sizeof (EFI_IP_ADDRESS));
- DnsDeviceNode = (DNS_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_DNS_DP,
- DnsDeviceNodeLength
- );
+ DnsDeviceNodeLength = (UINT16)(sizeof (EFI_DEVICE_PATH_PROTOCOL) + sizeof (UINT8) + DnsServerIpCount * sizeof (EFI_IP_ADDRESS));
+ DnsDeviceNode = (DNS_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_DNS_DP,
+ DnsDeviceNodeLength
+ );
if (DnsDeviceNode == NULL) {
return NULL;
}
@@ -2832,13 +2849,13 @@ DevPathFromTextDns (
for (DnsServerIpIndex = 0; DnsServerIpIndex < DnsServerIpCount; DnsServerIpIndex++) {
DnsServerIp = GetNextParamStr (&TextDeviceNode);
if (DnsDeviceNode->IsIPv6 == 0x00) {
- StrToIpv4Address (DnsServerIp, NULL, &(DnsDeviceNode->DnsServerIp[DnsServerIpIndex].v4), NULL);
+ StrToIpv4Address (DnsServerIp, NULL, &(DnsDeviceNode->DnsServerIp[DnsServerIpIndex].v4), NULL);
} else {
StrToIpv6Address (DnsServerIp, NULL, &(DnsDeviceNode->DnsServerIp[DnsServerIpIndex].v6), NULL);
}
}
- return (EFI_DEVICE_PATH_PROTOCOL *) DnsDeviceNode;
+ return (EFI_DEVICE_PATH_PROTOCOL *)DnsDeviceNode;
}
/**
@@ -2851,26 +2868,26 @@ DevPathFromTextDns (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextUri (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
CHAR16 *UriStr;
UINTN UriLength;
URI_DEVICE_PATH *Uri;
- UriStr = GetNextParamStr (&TextDeviceNode);
+ UriStr = GetNextParamStr (&TextDeviceNode);
UriLength = StrnLenS (UriStr, MAX_UINT16 - sizeof (URI_DEVICE_PATH));
- Uri = (URI_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_URI_DP,
- (UINT16) (sizeof (URI_DEVICE_PATH) + UriLength)
- );
+ Uri = (URI_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_URI_DP,
+ (UINT16)(sizeof (URI_DEVICE_PATH) + UriLength)
+ );
while (UriLength-- != 0) {
- Uri->Uri[UriLength] = (CHAR8) UriStr[UriLength];
+ Uri->Uri[UriLength] = (CHAR8)UriStr[UriLength];
}
- return (EFI_DEVICE_PATH_PROTOCOL *) Uri;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Uri;
}
/**
@@ -2883,7 +2900,7 @@ DevPathFromTextUri (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextMediaPath (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
return DevPathFromTextGenericPath (MEDIA_DEVICE_PATH, TextDeviceNode);
@@ -2899,52 +2916,52 @@ DevPathFromTextMediaPath (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextHD (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *PartitionStr;
- CHAR16 *TypeStr;
- CHAR16 *SignatureStr;
- CHAR16 *StartStr;
- CHAR16 *SizeStr;
- UINT32 Signature32;
- HARDDRIVE_DEVICE_PATH *Hd;
-
- PartitionStr = GetNextParamStr (&TextDeviceNode);
- TypeStr = GetNextParamStr (&TextDeviceNode);
- SignatureStr = GetNextParamStr (&TextDeviceNode);
- StartStr = GetNextParamStr (&TextDeviceNode);
- SizeStr = GetNextParamStr (&TextDeviceNode);
- Hd = (HARDDRIVE_DEVICE_PATH *) CreateDeviceNode (
- MEDIA_DEVICE_PATH,
- MEDIA_HARDDRIVE_DP,
- (UINT16) sizeof (HARDDRIVE_DEVICE_PATH)
- );
+ IN CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *PartitionStr;
+ CHAR16 *TypeStr;
+ CHAR16 *SignatureStr;
+ CHAR16 *StartStr;
+ CHAR16 *SizeStr;
+ UINT32 Signature32;
+ HARDDRIVE_DEVICE_PATH *Hd;
+
+ PartitionStr = GetNextParamStr (&TextDeviceNode);
+ TypeStr = GetNextParamStr (&TextDeviceNode);
+ SignatureStr = GetNextParamStr (&TextDeviceNode);
+ StartStr = GetNextParamStr (&TextDeviceNode);
+ SizeStr = GetNextParamStr (&TextDeviceNode);
+ Hd = (HARDDRIVE_DEVICE_PATH *)CreateDeviceNode (
+ MEDIA_DEVICE_PATH,
+ MEDIA_HARDDRIVE_DP,
+ (UINT16)sizeof (HARDDRIVE_DEVICE_PATH)
+ );
- Hd->PartitionNumber = (UINT32) Strtoi (PartitionStr);
+ Hd->PartitionNumber = (UINT32)Strtoi (PartitionStr);
ZeroMem (Hd->Signature, 16);
- Hd->MBRType = (UINT8) 0;
+ Hd->MBRType = (UINT8)0;
if (StrCmp (TypeStr, L"MBR") == 0) {
Hd->SignatureType = SIGNATURE_TYPE_MBR;
Hd->MBRType = 0x01;
- Signature32 = (UINT32) Strtoi (SignatureStr);
+ Signature32 = (UINT32)Strtoi (SignatureStr);
CopyMem (Hd->Signature, &Signature32, sizeof (UINT32));
} else if (StrCmp (TypeStr, L"GPT") == 0) {
Hd->SignatureType = SIGNATURE_TYPE_GUID;
Hd->MBRType = 0x02;
- StrToGuid (SignatureStr, (EFI_GUID *) Hd->Signature);
+ StrToGuid (SignatureStr, (EFI_GUID *)Hd->Signature);
} else {
- Hd->SignatureType = (UINT8) Strtoi (TypeStr);
+ Hd->SignatureType = (UINT8)Strtoi (TypeStr);
}
Strtoi64 (StartStr, &Hd->PartitionStart);
Strtoi64 (SizeStr, &Hd->PartitionSize);
- return (EFI_DEVICE_PATH_PROTOCOL *) Hd;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Hd;
}
/**
@@ -2957,28 +2974,28 @@ DevPathFromTextHD (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextCDROM (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
- CHAR16 *EntryStr;
- CHAR16 *StartStr;
- CHAR16 *SizeStr;
- CDROM_DEVICE_PATH *CDROMDevPath;
+ CHAR16 *EntryStr;
+ CHAR16 *StartStr;
+ CHAR16 *SizeStr;
+ CDROM_DEVICE_PATH *CDROMDevPath;
- EntryStr = GetNextParamStr (&TextDeviceNode);
- StartStr = GetNextParamStr (&TextDeviceNode);
- SizeStr = GetNextParamStr (&TextDeviceNode);
- CDROMDevPath = (CDROM_DEVICE_PATH *) CreateDeviceNode (
- MEDIA_DEVICE_PATH,
- MEDIA_CDROM_DP,
- (UINT16) sizeof (CDROM_DEVICE_PATH)
- );
+ EntryStr = GetNextParamStr (&TextDeviceNode);
+ StartStr = GetNextParamStr (&TextDeviceNode);
+ SizeStr = GetNextParamStr (&TextDeviceNode);
+ CDROMDevPath = (CDROM_DEVICE_PATH *)CreateDeviceNode (
+ MEDIA_DEVICE_PATH,
+ MEDIA_CDROM_DP,
+ (UINT16)sizeof (CDROM_DEVICE_PATH)
+ );
- CDROMDevPath->BootEntry = (UINT32) Strtoi (EntryStr);
+ CDROMDevPath->BootEntry = (UINT32)Strtoi (EntryStr);
Strtoi64 (StartStr, &CDROMDevPath->PartitionStart);
Strtoi64 (SizeStr, &CDROMDevPath->PartitionSize);
- return (EFI_DEVICE_PATH_PROTOCOL *) CDROMDevPath;
+ return (EFI_DEVICE_PATH_PROTOCOL *)CDROMDevPath;
}
/**
@@ -2991,7 +3008,7 @@ DevPathFromTextCDROM (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextVenMedia (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
return ConvertFromTextVendor (
@@ -3011,20 +3028,20 @@ DevPathFromTextVenMedia (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextFilePath (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
FILEPATH_DEVICE_PATH *File;
- File = (FILEPATH_DEVICE_PATH *) CreateDeviceNode (
- MEDIA_DEVICE_PATH,
- MEDIA_FILEPATH_DP,
- (UINT16) (sizeof (FILEPATH_DEVICE_PATH) + StrLen (TextDeviceNode) * 2)
- );
+ File = (FILEPATH_DEVICE_PATH *)CreateDeviceNode (
+ MEDIA_DEVICE_PATH,
+ MEDIA_FILEPATH_DP,
+ (UINT16)(sizeof (FILEPATH_DEVICE_PATH) + StrLen (TextDeviceNode) * 2)
+ );
StrCpyS (File->PathName, StrLen (TextDeviceNode) + 1, TextDeviceNode);
- return (EFI_DEVICE_PATH_PROTOCOL *) File;
+ return (EFI_DEVICE_PATH_PROTOCOL *)File;
}
/**
@@ -3037,22 +3054,22 @@ DevPathFromTextFilePath (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextMedia (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
CHAR16 *GuidStr;
MEDIA_PROTOCOL_DEVICE_PATH *Media;
GuidStr = GetNextParamStr (&TextDeviceNode);
- Media = (MEDIA_PROTOCOL_DEVICE_PATH *) CreateDeviceNode (
- MEDIA_DEVICE_PATH,
- MEDIA_PROTOCOL_DP,
- (UINT16) sizeof (MEDIA_PROTOCOL_DEVICE_PATH)
- );
+ Media = (MEDIA_PROTOCOL_DEVICE_PATH *)CreateDeviceNode (
+ MEDIA_DEVICE_PATH,
+ MEDIA_PROTOCOL_DP,
+ (UINT16)sizeof (MEDIA_PROTOCOL_DEVICE_PATH)
+ );
StrToGuid (GuidStr, &Media->Protocol);
- return (EFI_DEVICE_PATH_PROTOCOL *) Media;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Media;
}
/**
@@ -3065,22 +3082,22 @@ DevPathFromTextMedia (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextFv (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
CHAR16 *GuidStr;
MEDIA_FW_VOL_DEVICE_PATH *Fv;
GuidStr = GetNextParamStr (&TextDeviceNode);
- Fv = (MEDIA_FW_VOL_DEVICE_PATH *) CreateDeviceNode (
- MEDIA_DEVICE_PATH,
- MEDIA_PIWG_FW_VOL_DP,
- (UINT16) sizeof (MEDIA_FW_VOL_DEVICE_PATH)
- );
+ Fv = (MEDIA_FW_VOL_DEVICE_PATH *)CreateDeviceNode (
+ MEDIA_DEVICE_PATH,
+ MEDIA_PIWG_FW_VOL_DP,
+ (UINT16)sizeof (MEDIA_FW_VOL_DEVICE_PATH)
+ );
StrToGuid (GuidStr, &Fv->FvName);
- return (EFI_DEVICE_PATH_PROTOCOL *) Fv;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Fv;
}
/**
@@ -3093,22 +3110,22 @@ DevPathFromTextFv (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextFvFile (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
CHAR16 *GuidStr;
MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFile;
GuidStr = GetNextParamStr (&TextDeviceNode);
- FvFile = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) CreateDeviceNode (
- MEDIA_DEVICE_PATH,
- MEDIA_PIWG_FW_FILE_DP,
- (UINT16) sizeof (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH)
- );
+ FvFile = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)CreateDeviceNode (
+ MEDIA_DEVICE_PATH,
+ MEDIA_PIWG_FW_FILE_DP,
+ (UINT16)sizeof (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH)
+ );
StrToGuid (GuidStr, &FvFile->FvFileName);
- return (EFI_DEVICE_PATH_PROTOCOL *) FvFile;
+ return (EFI_DEVICE_PATH_PROTOCOL *)FvFile;
}
/**
@@ -3121,25 +3138,25 @@ DevPathFromTextFvFile (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextRelativeOffsetRange (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
- CHAR16 *StartingOffsetStr;
- CHAR16 *EndingOffsetStr;
- MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH *Offset;
+ CHAR16 *StartingOffsetStr;
+ CHAR16 *EndingOffsetStr;
+ MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH *Offset;
StartingOffsetStr = GetNextParamStr (&TextDeviceNode);
EndingOffsetStr = GetNextParamStr (&TextDeviceNode);
- Offset = (MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH *) CreateDeviceNode (
- MEDIA_DEVICE_PATH,
- MEDIA_RELATIVE_OFFSET_RANGE_DP,
- (UINT16) sizeof (MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH)
- );
+ Offset = (MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH *)CreateDeviceNode (
+ MEDIA_DEVICE_PATH,
+ MEDIA_RELATIVE_OFFSET_RANGE_DP,
+ (UINT16)sizeof (MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH)
+ );
Strtoi64 (StartingOffsetStr, &Offset->StartingOffset);
Strtoi64 (EndingOffsetStr, &Offset->EndingOffset);
- return (EFI_DEVICE_PATH_PROTOCOL *) Offset;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Offset;
}
/**
@@ -3152,35 +3169,35 @@ DevPathFromTextRelativeOffsetRange (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextRamDisk (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
- CHAR16 *StartingAddrStr;
- CHAR16 *EndingAddrStr;
- CHAR16 *TypeGuidStr;
- CHAR16 *InstanceStr;
- MEDIA_RAM_DISK_DEVICE_PATH *RamDisk;
- UINT64 StartingAddr;
- UINT64 EndingAddr;
+ CHAR16 *StartingAddrStr;
+ CHAR16 *EndingAddrStr;
+ CHAR16 *TypeGuidStr;
+ CHAR16 *InstanceStr;
+ MEDIA_RAM_DISK_DEVICE_PATH *RamDisk;
+ UINT64 StartingAddr;
+ UINT64 EndingAddr;
StartingAddrStr = GetNextParamStr (&TextDeviceNode);
EndingAddrStr = GetNextParamStr (&TextDeviceNode);
InstanceStr = GetNextParamStr (&TextDeviceNode);
TypeGuidStr = GetNextParamStr (&TextDeviceNode);
- RamDisk = (MEDIA_RAM_DISK_DEVICE_PATH *) CreateDeviceNode (
- MEDIA_DEVICE_PATH,
- MEDIA_RAM_DISK_DP,
- (UINT16) sizeof (MEDIA_RAM_DISK_DEVICE_PATH)
- );
+ RamDisk = (MEDIA_RAM_DISK_DEVICE_PATH *)CreateDeviceNode (
+ MEDIA_DEVICE_PATH,
+ MEDIA_RAM_DISK_DP,
+ (UINT16)sizeof (MEDIA_RAM_DISK_DEVICE_PATH)
+ );
Strtoi64 (StartingAddrStr, &StartingAddr);
- WriteUnaligned64 ((UINT64 *) &(RamDisk->StartingAddr[0]), StartingAddr);
+ WriteUnaligned64 ((UINT64 *)&(RamDisk->StartingAddr[0]), StartingAddr);
Strtoi64 (EndingAddrStr, &EndingAddr);
- WriteUnaligned64 ((UINT64 *) &(RamDisk->EndingAddr[0]), EndingAddr);
- RamDisk->Instance = (UINT16) Strtoi (InstanceStr);
+ WriteUnaligned64 ((UINT64 *)&(RamDisk->EndingAddr[0]), EndingAddr);
+ RamDisk->Instance = (UINT16)Strtoi (InstanceStr);
StrToGuid (TypeGuidStr, &RamDisk->TypeGuid);
- return (EFI_DEVICE_PATH_PROTOCOL *) RamDisk;
+ return (EFI_DEVICE_PATH_PROTOCOL *)RamDisk;
}
/**
@@ -3193,34 +3210,34 @@ DevPathFromTextRamDisk (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextVirtualDisk (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
- CHAR16 *StartingAddrStr;
- CHAR16 *EndingAddrStr;
- CHAR16 *InstanceStr;
- MEDIA_RAM_DISK_DEVICE_PATH *RamDisk;
- UINT64 StartingAddr;
- UINT64 EndingAddr;
+ CHAR16 *StartingAddrStr;
+ CHAR16 *EndingAddrStr;
+ CHAR16 *InstanceStr;
+ MEDIA_RAM_DISK_DEVICE_PATH *RamDisk;
+ UINT64 StartingAddr;
+ UINT64 EndingAddr;
StartingAddrStr = GetNextParamStr (&TextDeviceNode);
EndingAddrStr = GetNextParamStr (&TextDeviceNode);
InstanceStr = GetNextParamStr (&TextDeviceNode);
- RamDisk = (MEDIA_RAM_DISK_DEVICE_PATH *) CreateDeviceNode (
- MEDIA_DEVICE_PATH,
- MEDIA_RAM_DISK_DP,
- (UINT16) sizeof (MEDIA_RAM_DISK_DEVICE_PATH)
- );
+ RamDisk = (MEDIA_RAM_DISK_DEVICE_PATH *)CreateDeviceNode (
+ MEDIA_DEVICE_PATH,
+ MEDIA_RAM_DISK_DP,
+ (UINT16)sizeof (MEDIA_RAM_DISK_DEVICE_PATH)
+ );
Strtoi64 (StartingAddrStr, &StartingAddr);
- WriteUnaligned64 ((UINT64 *) &(RamDisk->StartingAddr[0]), StartingAddr);
+ WriteUnaligned64 ((UINT64 *)&(RamDisk->StartingAddr[0]), StartingAddr);
Strtoi64 (EndingAddrStr, &EndingAddr);
- WriteUnaligned64 ((UINT64 *) &(RamDisk->EndingAddr[0]), EndingAddr);
- RamDisk->Instance = (UINT16) Strtoi (InstanceStr);
+ WriteUnaligned64 ((UINT64 *)&(RamDisk->EndingAddr[0]), EndingAddr);
+ RamDisk->Instance = (UINT16)Strtoi (InstanceStr);
CopyGuid (&RamDisk->TypeGuid, &gEfiVirtualDiskGuid);
- return (EFI_DEVICE_PATH_PROTOCOL *) RamDisk;
+ return (EFI_DEVICE_PATH_PROTOCOL *)RamDisk;
}
/**
@@ -3233,34 +3250,34 @@ DevPathFromTextVirtualDisk (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextVirtualCd (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
- CHAR16 *StartingAddrStr;
- CHAR16 *EndingAddrStr;
- CHAR16 *InstanceStr;
- MEDIA_RAM_DISK_DEVICE_PATH *RamDisk;
- UINT64 StartingAddr;
- UINT64 EndingAddr;
+ CHAR16 *StartingAddrStr;
+ CHAR16 *EndingAddrStr;
+ CHAR16 *InstanceStr;
+ MEDIA_RAM_DISK_DEVICE_PATH *RamDisk;
+ UINT64 StartingAddr;
+ UINT64 EndingAddr;
StartingAddrStr = GetNextParamStr (&TextDeviceNode);
EndingAddrStr = GetNextParamStr (&TextDeviceNode);
InstanceStr = GetNextParamStr (&TextDeviceNode);
- RamDisk = (MEDIA_RAM_DISK_DEVICE_PATH *) CreateDeviceNode (
- MEDIA_DEVICE_PATH,
- MEDIA_RAM_DISK_DP,
- (UINT16) sizeof (MEDIA_RAM_DISK_DEVICE_PATH)
- );
+ RamDisk = (MEDIA_RAM_DISK_DEVICE_PATH *)CreateDeviceNode (
+ MEDIA_DEVICE_PATH,
+ MEDIA_RAM_DISK_DP,
+ (UINT16)sizeof (MEDIA_RAM_DISK_DEVICE_PATH)
+ );
Strtoi64 (StartingAddrStr, &StartingAddr);
- WriteUnaligned64 ((UINT64 *) &(RamDisk->StartingAddr[0]), StartingAddr);
+ WriteUnaligned64 ((UINT64 *)&(RamDisk->StartingAddr[0]), StartingAddr);
Strtoi64 (EndingAddrStr, &EndingAddr);
- WriteUnaligned64 ((UINT64 *) &(RamDisk->EndingAddr[0]), EndingAddr);
- RamDisk->Instance = (UINT16) Strtoi (InstanceStr);
+ WriteUnaligned64 ((UINT64 *)&(RamDisk->EndingAddr[0]), EndingAddr);
+ RamDisk->Instance = (UINT16)Strtoi (InstanceStr);
CopyGuid (&RamDisk->TypeGuid, &gEfiVirtualCdGuid);
- return (EFI_DEVICE_PATH_PROTOCOL *) RamDisk;
+ return (EFI_DEVICE_PATH_PROTOCOL *)RamDisk;
}
/**
@@ -3273,34 +3290,34 @@ DevPathFromTextVirtualCd (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextPersistentVirtualDisk (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
- CHAR16 *StartingAddrStr;
- CHAR16 *EndingAddrStr;
- CHAR16 *InstanceStr;
- MEDIA_RAM_DISK_DEVICE_PATH *RamDisk;
- UINT64 StartingAddr;
- UINT64 EndingAddr;
+ CHAR16 *StartingAddrStr;
+ CHAR16 *EndingAddrStr;
+ CHAR16 *InstanceStr;
+ MEDIA_RAM_DISK_DEVICE_PATH *RamDisk;
+ UINT64 StartingAddr;
+ UINT64 EndingAddr;
StartingAddrStr = GetNextParamStr (&TextDeviceNode);
EndingAddrStr = GetNextParamStr (&TextDeviceNode);
InstanceStr = GetNextParamStr (&TextDeviceNode);
- RamDisk = (MEDIA_RAM_DISK_DEVICE_PATH *) CreateDeviceNode (
- MEDIA_DEVICE_PATH,
- MEDIA_RAM_DISK_DP,
- (UINT16) sizeof (MEDIA_RAM_DISK_DEVICE_PATH)
- );
+ RamDisk = (MEDIA_RAM_DISK_DEVICE_PATH *)CreateDeviceNode (
+ MEDIA_DEVICE_PATH,
+ MEDIA_RAM_DISK_DP,
+ (UINT16)sizeof (MEDIA_RAM_DISK_DEVICE_PATH)
+ );
Strtoi64 (StartingAddrStr, &StartingAddr);
- WriteUnaligned64 ((UINT64 *) &(RamDisk->StartingAddr[0]), StartingAddr);
+ WriteUnaligned64 ((UINT64 *)&(RamDisk->StartingAddr[0]), StartingAddr);
Strtoi64 (EndingAddrStr, &EndingAddr);
- WriteUnaligned64 ((UINT64 *) &(RamDisk->EndingAddr[0]), EndingAddr);
- RamDisk->Instance = (UINT16) Strtoi (InstanceStr);
+ WriteUnaligned64 ((UINT64 *)&(RamDisk->EndingAddr[0]), EndingAddr);
+ RamDisk->Instance = (UINT16)Strtoi (InstanceStr);
CopyGuid (&RamDisk->TypeGuid, &gEfiPersistentVirtualDiskGuid);
- return (EFI_DEVICE_PATH_PROTOCOL *) RamDisk;
+ return (EFI_DEVICE_PATH_PROTOCOL *)RamDisk;
}
/**
@@ -3313,34 +3330,34 @@ DevPathFromTextPersistentVirtualDisk (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextPersistentVirtualCd (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
- CHAR16 *StartingAddrStr;
- CHAR16 *EndingAddrStr;
- CHAR16 *InstanceStr;
- MEDIA_RAM_DISK_DEVICE_PATH *RamDisk;
- UINT64 StartingAddr;
- UINT64 EndingAddr;
+ CHAR16 *StartingAddrStr;
+ CHAR16 *EndingAddrStr;
+ CHAR16 *InstanceStr;
+ MEDIA_RAM_DISK_DEVICE_PATH *RamDisk;
+ UINT64 StartingAddr;
+ UINT64 EndingAddr;
StartingAddrStr = GetNextParamStr (&TextDeviceNode);
EndingAddrStr = GetNextParamStr (&TextDeviceNode);
InstanceStr = GetNextParamStr (&TextDeviceNode);
- RamDisk = (MEDIA_RAM_DISK_DEVICE_PATH *) CreateDeviceNode (
- MEDIA_DEVICE_PATH,
- MEDIA_RAM_DISK_DP,
- (UINT16) sizeof (MEDIA_RAM_DISK_DEVICE_PATH)
- );
+ RamDisk = (MEDIA_RAM_DISK_DEVICE_PATH *)CreateDeviceNode (
+ MEDIA_DEVICE_PATH,
+ MEDIA_RAM_DISK_DP,
+ (UINT16)sizeof (MEDIA_RAM_DISK_DEVICE_PATH)
+ );
Strtoi64 (StartingAddrStr, &StartingAddr);
- WriteUnaligned64 ((UINT64 *) &(RamDisk->StartingAddr[0]), StartingAddr);
+ WriteUnaligned64 ((UINT64 *)&(RamDisk->StartingAddr[0]), StartingAddr);
Strtoi64 (EndingAddrStr, &EndingAddr);
- WriteUnaligned64 ((UINT64 *) &(RamDisk->EndingAddr[0]), EndingAddr);
- RamDisk->Instance = (UINT16) Strtoi (InstanceStr);
+ WriteUnaligned64 ((UINT64 *)&(RamDisk->EndingAddr[0]), EndingAddr);
+ RamDisk->Instance = (UINT16)Strtoi (InstanceStr);
CopyGuid (&RamDisk->TypeGuid, &gEfiPersistentVirtualCdGuid);
- return (EFI_DEVICE_PATH_PROTOCOL *) RamDisk;
+ return (EFI_DEVICE_PATH_PROTOCOL *)RamDisk;
}
/**
@@ -3353,7 +3370,7 @@ DevPathFromTextPersistentVirtualCd (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextBbsPath (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
return DevPathFromTextGenericPath (BBS_DEVICE_PATH, TextDeviceNode);
@@ -3369,23 +3386,23 @@ DevPathFromTextBbsPath (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextBBS (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *TypeStr;
- CHAR16 *IdStr;
- CHAR16 *FlagsStr;
- CHAR8 *AsciiStr;
- BBS_BBS_DEVICE_PATH *Bbs;
-
- TypeStr = GetNextParamStr (&TextDeviceNode);
- IdStr = GetNextParamStr (&TextDeviceNode);
- FlagsStr = GetNextParamStr (&TextDeviceNode);
- Bbs = (BBS_BBS_DEVICE_PATH *) CreateDeviceNode (
- BBS_DEVICE_PATH,
- BBS_BBS_DP,
- (UINT16) (sizeof (BBS_BBS_DEVICE_PATH) + StrLen (IdStr))
- );
+ IN CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *TypeStr;
+ CHAR16 *IdStr;
+ CHAR16 *FlagsStr;
+ CHAR8 *AsciiStr;
+ BBS_BBS_DEVICE_PATH *Bbs;
+
+ TypeStr = GetNextParamStr (&TextDeviceNode);
+ IdStr = GetNextParamStr (&TextDeviceNode);
+ FlagsStr = GetNextParamStr (&TextDeviceNode);
+ Bbs = (BBS_BBS_DEVICE_PATH *)CreateDeviceNode (
+ BBS_DEVICE_PATH,
+ BBS_BBS_DP,
+ (UINT16)(sizeof (BBS_BBS_DEVICE_PATH) + StrLen (IdStr))
+ );
if (StrCmp (TypeStr, L"Floppy") == 0) {
Bbs->DeviceType = BBS_TYPE_FLOPPY;
@@ -3400,15 +3417,15 @@ DevPathFromTextBBS (
} else if (StrCmp (TypeStr, L"Network") == 0) {
Bbs->DeviceType = BBS_TYPE_EMBEDDED_NETWORK;
} else {
- Bbs->DeviceType = (UINT16) Strtoi (TypeStr);
+ Bbs->DeviceType = (UINT16)Strtoi (TypeStr);
}
AsciiStr = Bbs->String;
StrToAscii (IdStr, &AsciiStr);
- Bbs->StatusFlag = (UINT16) Strtoi (FlagsStr);
+ Bbs->StatusFlag = (UINT16)Strtoi (FlagsStr);
- return (EFI_DEVICE_PATH_PROTOCOL *) Bbs;
+ return (EFI_DEVICE_PATH_PROTOCOL *)Bbs;
}
/**
@@ -3421,24 +3438,24 @@ DevPathFromTextBBS (
**/
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextSata (
- IN CHAR16 *TextDeviceNode
+ IN CHAR16 *TextDeviceNode
)
{
- SATA_DEVICE_PATH *Sata;
- CHAR16 *Param1;
- CHAR16 *Param2;
- CHAR16 *Param3;
+ SATA_DEVICE_PATH *Sata;
+ CHAR16 *Param1;
+ CHAR16 *Param2;
+ CHAR16 *Param3;
Param1 = GetNextParamStr (&TextDeviceNode);
Param2 = GetNextParamStr (&TextDeviceNode);
Param3 = GetNextParamStr (&TextDeviceNode);
- Sata = (SATA_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_SATA_DP,
- (UINT16) sizeof (SATA_DEVICE_PATH)
- );
- Sata->HBAPortNumber = (UINT16) Strtoi (Param1);
+ Sata = (SATA_DEVICE_PATH *)CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_SATA_DP,
+ (UINT16)sizeof (SATA_DEVICE_PATH)
+ );
+ Sata->HBAPortNumber = (UINT16)Strtoi (Param1);
//
// According to UEFI spec, if PMPN is not provided, the default is 0xFFFF
@@ -3446,105 +3463,106 @@ DevPathFromTextSata (
if (*Param2 == L'\0' ) {
Sata->PortMultiplierPortNumber = 0xFFFF;
} else {
- Sata->PortMultiplierPortNumber = (UINT16) Strtoi (Param2);
- }
- Sata->Lun = (UINT16) Strtoi (Param3);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) Sata;
-}
-
-GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE mUefiDevicePathLibDevPathFromTextTable[] = {
- {L"Path", DevPathFromTextPath },
-
- {L"HardwarePath", DevPathFromTextHardwarePath },
- {L"Pci", DevPathFromTextPci },
- {L"PcCard", DevPathFromTextPcCard },
- {L"MemoryMapped", DevPathFromTextMemoryMapped },
- {L"VenHw", DevPathFromTextVenHw },
- {L"Ctrl", DevPathFromTextCtrl },
- {L"BMC", DevPathFromTextBmc },
-
- {L"AcpiPath", DevPathFromTextAcpiPath },
- {L"Acpi", DevPathFromTextAcpi },
- {L"PciRoot", DevPathFromTextPciRoot },
- {L"PcieRoot", DevPathFromTextPcieRoot },
- {L"Floppy", DevPathFromTextFloppy },
- {L"Keyboard", DevPathFromTextKeyboard },
- {L"Serial", DevPathFromTextSerial },
- {L"ParallelPort", DevPathFromTextParallelPort },
- {L"AcpiEx", DevPathFromTextAcpiEx },
- {L"AcpiExp", DevPathFromTextAcpiExp },
- {L"AcpiAdr", DevPathFromTextAcpiAdr },
-
- {L"Msg", DevPathFromTextMsg },
- {L"Ata", DevPathFromTextAta },
- {L"Scsi", DevPathFromTextScsi },
- {L"Fibre", DevPathFromTextFibre },
- {L"FibreEx", DevPathFromTextFibreEx },
- {L"I1394", DevPathFromText1394 },
- {L"USB", DevPathFromTextUsb },
- {L"I2O", DevPathFromTextI2O },
- {L"Infiniband", DevPathFromTextInfiniband },
- {L"VenMsg", DevPathFromTextVenMsg },
- {L"VenPcAnsi", DevPathFromTextVenPcAnsi },
- {L"VenVt100", DevPathFromTextVenVt100 },
- {L"VenVt100Plus", DevPathFromTextVenVt100Plus },
- {L"VenUtf8", DevPathFromTextVenUtf8 },
- {L"UartFlowCtrl", DevPathFromTextUartFlowCtrl },
- {L"SAS", DevPathFromTextSAS },
- {L"SasEx", DevPathFromTextSasEx },
- {L"NVMe", DevPathFromTextNVMe },
- {L"UFS", DevPathFromTextUfs },
- {L"SD", DevPathFromTextSd },
- {L"eMMC", DevPathFromTextEmmc },
- {L"DebugPort", DevPathFromTextDebugPort },
- {L"MAC", DevPathFromTextMAC },
- {L"IPv4", DevPathFromTextIPv4 },
- {L"IPv6", DevPathFromTextIPv6 },
- {L"Uart", DevPathFromTextUart },
- {L"UsbClass", DevPathFromTextUsbClass },
- {L"UsbAudio", DevPathFromTextUsbAudio },
- {L"UsbCDCControl", DevPathFromTextUsbCDCControl },
- {L"UsbHID", DevPathFromTextUsbHID },
- {L"UsbImage", DevPathFromTextUsbImage },
- {L"UsbPrinter", DevPathFromTextUsbPrinter },
- {L"UsbMassStorage", DevPathFromTextUsbMassStorage },
- {L"UsbHub", DevPathFromTextUsbHub },
- {L"UsbCDCData", DevPathFromTextUsbCDCData },
- {L"UsbSmartCard", DevPathFromTextUsbSmartCard },
- {L"UsbVideo", DevPathFromTextUsbVideo },
- {L"UsbDiagnostic", DevPathFromTextUsbDiagnostic },
- {L"UsbWireless", DevPathFromTextUsbWireless },
- {L"UsbDeviceFirmwareUpdate", DevPathFromTextUsbDeviceFirmwareUpdate },
- {L"UsbIrdaBridge", DevPathFromTextUsbIrdaBridge },
- {L"UsbTestAndMeasurement", DevPathFromTextUsbTestAndMeasurement },
- {L"UsbWwid", DevPathFromTextUsbWwid },
- {L"Unit", DevPathFromTextUnit },
- {L"iSCSI", DevPathFromTextiSCSI },
- {L"Vlan", DevPathFromTextVlan },
- {L"Dns", DevPathFromTextDns },
- {L"Uri", DevPathFromTextUri },
- {L"Bluetooth", DevPathFromTextBluetooth },
- {L"Wi-Fi", DevPathFromTextWiFi },
- {L"BluetoothLE", DevPathFromTextBluetoothLE },
- {L"MediaPath", DevPathFromTextMediaPath },
- {L"HD", DevPathFromTextHD },
- {L"CDROM", DevPathFromTextCDROM },
- {L"VenMedia", DevPathFromTextVenMedia },
- {L"Media", DevPathFromTextMedia },
- {L"Fv", DevPathFromTextFv },
- {L"FvFile", DevPathFromTextFvFile },
- {L"Offset", DevPathFromTextRelativeOffsetRange },
- {L"RamDisk", DevPathFromTextRamDisk },
- {L"VirtualDisk", DevPathFromTextVirtualDisk },
- {L"VirtualCD", DevPathFromTextVirtualCd },
- {L"PersistentVirtualDisk", DevPathFromTextPersistentVirtualDisk },
- {L"PersistentVirtualCD", DevPathFromTextPersistentVirtualCd },
-
- {L"BbsPath", DevPathFromTextBbsPath },
- {L"BBS", DevPathFromTextBBS },
- {L"Sata", DevPathFromTextSata },
- {NULL, NULL}
+ Sata->PortMultiplierPortNumber = (UINT16)Strtoi (Param2);
+ }
+
+ Sata->Lun = (UINT16)Strtoi (Param3);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *)Sata;
+}
+
+GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE mUefiDevicePathLibDevPathFromTextTable[] = {
+ { L"Path", DevPathFromTextPath },
+
+ { L"HardwarePath", DevPathFromTextHardwarePath },
+ { L"Pci", DevPathFromTextPci },
+ { L"PcCard", DevPathFromTextPcCard },
+ { L"MemoryMapped", DevPathFromTextMemoryMapped },
+ { L"VenHw", DevPathFromTextVenHw },
+ { L"Ctrl", DevPathFromTextCtrl },
+ { L"BMC", DevPathFromTextBmc },
+
+ { L"AcpiPath", DevPathFromTextAcpiPath },
+ { L"Acpi", DevPathFromTextAcpi },
+ { L"PciRoot", DevPathFromTextPciRoot },
+ { L"PcieRoot", DevPathFromTextPcieRoot },
+ { L"Floppy", DevPathFromTextFloppy },
+ { L"Keyboard", DevPathFromTextKeyboard },
+ { L"Serial", DevPathFromTextSerial },
+ { L"ParallelPort", DevPathFromTextParallelPort },
+ { L"AcpiEx", DevPathFromTextAcpiEx },
+ { L"AcpiExp", DevPathFromTextAcpiExp },
+ { L"AcpiAdr", DevPathFromTextAcpiAdr },
+
+ { L"Msg", DevPathFromTextMsg },
+ { L"Ata", DevPathFromTextAta },
+ { L"Scsi", DevPathFromTextScsi },
+ { L"Fibre", DevPathFromTextFibre },
+ { L"FibreEx", DevPathFromTextFibreEx },
+ { L"I1394", DevPathFromText1394 },
+ { L"USB", DevPathFromTextUsb },
+ { L"I2O", DevPathFromTextI2O },
+ { L"Infiniband", DevPathFromTextInfiniband },
+ { L"VenMsg", DevPathFromTextVenMsg },
+ { L"VenPcAnsi", DevPathFromTextVenPcAnsi },
+ { L"VenVt100", DevPathFromTextVenVt100 },
+ { L"VenVt100Plus", DevPathFromTextVenVt100Plus },
+ { L"VenUtf8", DevPathFromTextVenUtf8 },
+ { L"UartFlowCtrl", DevPathFromTextUartFlowCtrl },
+ { L"SAS", DevPathFromTextSAS },
+ { L"SasEx", DevPathFromTextSasEx },
+ { L"NVMe", DevPathFromTextNVMe },
+ { L"UFS", DevPathFromTextUfs },
+ { L"SD", DevPathFromTextSd },
+ { L"eMMC", DevPathFromTextEmmc },
+ { L"DebugPort", DevPathFromTextDebugPort },
+ { L"MAC", DevPathFromTextMAC },
+ { L"IPv4", DevPathFromTextIPv4 },
+ { L"IPv6", DevPathFromTextIPv6 },
+ { L"Uart", DevPathFromTextUart },
+ { L"UsbClass", DevPathFromTextUsbClass },
+ { L"UsbAudio", DevPathFromTextUsbAudio },
+ { L"UsbCDCControl", DevPathFromTextUsbCDCControl },
+ { L"UsbHID", DevPathFromTextUsbHID },
+ { L"UsbImage", DevPathFromTextUsbImage },
+ { L"UsbPrinter", DevPathFromTextUsbPrinter },
+ { L"UsbMassStorage", DevPathFromTextUsbMassStorage },
+ { L"UsbHub", DevPathFromTextUsbHub },
+ { L"UsbCDCData", DevPathFromTextUsbCDCData },
+ { L"UsbSmartCard", DevPathFromTextUsbSmartCard },
+ { L"UsbVideo", DevPathFromTextUsbVideo },
+ { L"UsbDiagnostic", DevPathFromTextUsbDiagnostic },
+ { L"UsbWireless", DevPathFromTextUsbWireless },
+ { L"UsbDeviceFirmwareUpdate", DevPathFromTextUsbDeviceFirmwareUpdate },
+ { L"UsbIrdaBridge", DevPathFromTextUsbIrdaBridge },
+ { L"UsbTestAndMeasurement", DevPathFromTextUsbTestAndMeasurement },
+ { L"UsbWwid", DevPathFromTextUsbWwid },
+ { L"Unit", DevPathFromTextUnit },
+ { L"iSCSI", DevPathFromTextiSCSI },
+ { L"Vlan", DevPathFromTextVlan },
+ { L"Dns", DevPathFromTextDns },
+ { L"Uri", DevPathFromTextUri },
+ { L"Bluetooth", DevPathFromTextBluetooth },
+ { L"Wi-Fi", DevPathFromTextWiFi },
+ { L"BluetoothLE", DevPathFromTextBluetoothLE },
+ { L"MediaPath", DevPathFromTextMediaPath },
+ { L"HD", DevPathFromTextHD },
+ { L"CDROM", DevPathFromTextCDROM },
+ { L"VenMedia", DevPathFromTextVenMedia },
+ { L"Media", DevPathFromTextMedia },
+ { L"Fv", DevPathFromTextFv },
+ { L"FvFile", DevPathFromTextFvFile },
+ { L"Offset", DevPathFromTextRelativeOffsetRange },
+ { L"RamDisk", DevPathFromTextRamDisk },
+ { L"VirtualDisk", DevPathFromTextVirtualDisk },
+ { L"VirtualCD", DevPathFromTextVirtualCd },
+ { L"PersistentVirtualDisk", DevPathFromTextPersistentVirtualDisk },
+ { L"PersistentVirtualCD", DevPathFromTextPersistentVirtualCd },
+
+ { L"BbsPath", DevPathFromTextBbsPath },
+ { L"BBS", DevPathFromTextBBS },
+ { L"Sata", DevPathFromTextSata },
+ { NULL, NULL }
};
/**
@@ -3561,14 +3579,14 @@ GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE mUefiDevicePathLibDevP
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
UefiDevicePathLibConvertTextToDeviceNode (
- IN CONST CHAR16 *TextDeviceNode
+ IN CONST CHAR16 *TextDeviceNode
)
{
- DEVICE_PATH_FROM_TEXT FromText;
- CHAR16 *ParamStr;
- EFI_DEVICE_PATH_PROTOCOL *DeviceNode;
- CHAR16 *DeviceNodeStr;
- UINTN Index;
+ DEVICE_PATH_FROM_TEXT FromText;
+ CHAR16 *ParamStr;
+ EFI_DEVICE_PATH_PROTOCOL *DeviceNode;
+ CHAR16 *DeviceNodeStr;
+ UINTN Index;
if ((TextDeviceNode == NULL) || (IS_NULL (*TextDeviceNode))) {
return NULL;
@@ -3591,7 +3609,7 @@ UefiDevicePathLibConvertTextToDeviceNode (
//
// A file path
//
- FromText = DevPathFromTextFilePath;
+ FromText = DevPathFromTextFilePath;
DeviceNode = FromText (DeviceNodeStr);
} else {
DeviceNode = FromText (ParamStr);
@@ -3618,28 +3636,28 @@ UefiDevicePathLibConvertTextToDeviceNode (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
UefiDevicePathLibConvertTextToDevicePath (
- IN CONST CHAR16 *TextDevicePath
+ IN CONST CHAR16 *TextDevicePath
)
{
- EFI_DEVICE_PATH_PROTOCOL *DeviceNode;
- EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
- CHAR16 *DevicePathStr;
- CHAR16 *Str;
- CHAR16 *DeviceNodeStr;
- BOOLEAN IsInstanceEnd;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *DeviceNode;
+ EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
+ CHAR16 *DevicePathStr;
+ CHAR16 *Str;
+ CHAR16 *DeviceNodeStr;
+ BOOLEAN IsInstanceEnd;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
if ((TextDevicePath == NULL) || (IS_NULL (*TextDevicePath))) {
return NULL;
}
- DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) AllocatePool (END_DEVICE_PATH_LENGTH);
+ DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)AllocatePool (END_DEVICE_PATH_LENGTH);
ASSERT (DevicePath != NULL);
SetDevicePathEndNode (DevicePath);
DevicePathStr = UefiDevicePathLibStrDuplicate (TextDevicePath);
- Str = DevicePathStr;
+ Str = DevicePathStr;
while ((DeviceNodeStr = GetNextDeviceNodeStr (&Str, &IsInstanceEnd)) != NULL) {
DeviceNode = UefiDevicePathLibConvertTextToDeviceNode (DeviceNodeStr);
@@ -3649,7 +3667,7 @@ UefiDevicePathLibConvertTextToDevicePath (
DevicePath = NewDevicePath;
if (IsInstanceEnd) {
- DeviceNode = (EFI_DEVICE_PATH_PROTOCOL *) AllocatePool (END_DEVICE_PATH_LENGTH);
+ DeviceNode = (EFI_DEVICE_PATH_PROTOCOL *)AllocatePool (END_DEVICE_PATH_LENGTH);
ASSERT (DeviceNode != NULL);
SetDevicePathEndNode (DeviceNode);
DeviceNode->SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE;
diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
index fb65ebd8f4..dd90dfa58e 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
@@ -26,27 +26,28 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
CHAR16 *
EFIAPI
UefiDevicePathLibCatPrint (
- IN OUT POOL_PRINT *Str,
- IN CHAR16 *Fmt,
+ IN OUT POOL_PRINT *Str,
+ IN CHAR16 *Fmt,
...
)
{
- UINTN Count;
- VA_LIST Args;
+ UINTN Count;
+ VA_LIST Args;
VA_START (Args, Fmt);
Count = SPrintLength (Fmt, Args);
- VA_END(Args);
+ VA_END (Args);
if ((Str->Count + (Count + 1)) * sizeof (CHAR16) > Str->Capacity) {
Str->Capacity = (Str->Count + (Count + 1) * 2) * sizeof (CHAR16);
- Str->Str = ReallocatePool (
- Str->Count * sizeof (CHAR16),
- Str->Capacity,
- Str->Str
- );
+ Str->Str = ReallocatePool (
+ Str->Count * sizeof (CHAR16),
+ Str->Capacity,
+ Str->Str
+ );
ASSERT (Str->Str != NULL);
}
+
VA_START (Args, Fmt);
UnicodeVSPrint (&Str->Str[Str->Count], Str->Capacity - Str->Count * sizeof (CHAR16), Fmt, Args);
Str->Count += Count;
@@ -76,7 +77,7 @@ DevPathToTextPci (
IN BOOLEAN AllowShortcuts
)
{
- PCI_DEVICE_PATH *Pci;
+ PCI_DEVICE_PATH *Pci;
Pci = DevPath;
UefiDevicePathLibCatPrint (Str, L"Pci(0x%x,0x%x)", Pci->Device, Pci->Function);
@@ -170,94 +171,95 @@ DevPathToTextVendor (
UINT32 FlowControlMap;
UINT16 Info;
- Vendor = (VENDOR_DEVICE_PATH *) DevPath;
+ Vendor = (VENDOR_DEVICE_PATH *)DevPath;
switch (DevicePathType (&Vendor->Header)) {
- case HARDWARE_DEVICE_PATH:
- Type = L"Hw";
- break;
-
- case MESSAGING_DEVICE_PATH:
- Type = L"Msg";
- if (AllowShortcuts) {
- if (CompareGuid (&Vendor->Guid, &gEfiPcAnsiGuid)) {
- UefiDevicePathLibCatPrint (Str, L"VenPcAnsi()");
- return ;
- } else if (CompareGuid (&Vendor->Guid, &gEfiVT100Guid)) {
- UefiDevicePathLibCatPrint (Str, L"VenVt100()");
- return ;
- } else if (CompareGuid (&Vendor->Guid, &gEfiVT100PlusGuid)) {
- UefiDevicePathLibCatPrint (Str, L"VenVt100Plus()");
- return ;
- } else if (CompareGuid (&Vendor->Guid, &gEfiVTUTF8Guid)) {
- UefiDevicePathLibCatPrint (Str, L"VenUtf8()");
- return ;
- } else if (CompareGuid (&Vendor->Guid, &gEfiUartDevicePathGuid)) {
- FlowControlMap = (((UART_FLOW_CONTROL_DEVICE_PATH *) Vendor)->FlowControlMap);
- switch (FlowControlMap & 0x00000003) {
- case 0:
- UefiDevicePathLibCatPrint (Str, L"UartFlowCtrl(%s)", L"None");
- break;
-
- case 1:
- UefiDevicePathLibCatPrint (Str, L"UartFlowCtrl(%s)", L"Hardware");
- break;
-
- case 2:
- UefiDevicePathLibCatPrint (Str, L"UartFlowCtrl(%s)", L"XonXoff");
- break;
-
- default:
- break;
- }
+ case HARDWARE_DEVICE_PATH:
+ Type = L"Hw";
+ break;
- return ;
- } else if (CompareGuid (&Vendor->Guid, &gEfiSasDevicePathGuid)) {
- UefiDevicePathLibCatPrint (
- Str,
- L"SAS(0x%lx,0x%lx,0x%x,",
- ((SAS_DEVICE_PATH *) Vendor)->SasAddress,
- ((SAS_DEVICE_PATH *) Vendor)->Lun,
- ((SAS_DEVICE_PATH *) Vendor)->RelativeTargetPort
- );
- Info = (((SAS_DEVICE_PATH *) Vendor)->DeviceTopology);
- if (((Info & 0x0f) == 0) && ((Info & BIT7) == 0)) {
- UefiDevicePathLibCatPrint (Str, L"NoTopology,0,0,0,");
- } else if (((Info & 0x0f) <= 2) && ((Info & BIT7) == 0)) {
+ case MESSAGING_DEVICE_PATH:
+ Type = L"Msg";
+ if (AllowShortcuts) {
+ if (CompareGuid (&Vendor->Guid, &gEfiPcAnsiGuid)) {
+ UefiDevicePathLibCatPrint (Str, L"VenPcAnsi()");
+ return;
+ } else if (CompareGuid (&Vendor->Guid, &gEfiVT100Guid)) {
+ UefiDevicePathLibCatPrint (Str, L"VenVt100()");
+ return;
+ } else if (CompareGuid (&Vendor->Guid, &gEfiVT100PlusGuid)) {
+ UefiDevicePathLibCatPrint (Str, L"VenVt100Plus()");
+ return;
+ } else if (CompareGuid (&Vendor->Guid, &gEfiVTUTF8Guid)) {
+ UefiDevicePathLibCatPrint (Str, L"VenUtf8()");
+ return;
+ } else if (CompareGuid (&Vendor->Guid, &gEfiUartDevicePathGuid)) {
+ FlowControlMap = (((UART_FLOW_CONTROL_DEVICE_PATH *)Vendor)->FlowControlMap);
+ switch (FlowControlMap & 0x00000003) {
+ case 0:
+ UefiDevicePathLibCatPrint (Str, L"UartFlowCtrl(%s)", L"None");
+ break;
+
+ case 1:
+ UefiDevicePathLibCatPrint (Str, L"UartFlowCtrl(%s)", L"Hardware");
+ break;
+
+ case 2:
+ UefiDevicePathLibCatPrint (Str, L"UartFlowCtrl(%s)", L"XonXoff");
+ break;
+
+ default:
+ break;
+ }
+
+ return;
+ } else if (CompareGuid (&Vendor->Guid, &gEfiSasDevicePathGuid)) {
UefiDevicePathLibCatPrint (
Str,
- L"%s,%s,%s,",
- ((Info & BIT4) != 0) ? L"SATA" : L"SAS",
- ((Info & BIT5) != 0) ? L"External" : L"Internal",
- ((Info & BIT6) != 0) ? L"Expanded" : L"Direct"
+ L"SAS(0x%lx,0x%lx,0x%x,",
+ ((SAS_DEVICE_PATH *)Vendor)->SasAddress,
+ ((SAS_DEVICE_PATH *)Vendor)->Lun,
+ ((SAS_DEVICE_PATH *)Vendor)->RelativeTargetPort
);
- if ((Info & 0x0f) == 1) {
- UefiDevicePathLibCatPrint (Str, L"0,");
+ Info = (((SAS_DEVICE_PATH *)Vendor)->DeviceTopology);
+ if (((Info & 0x0f) == 0) && ((Info & BIT7) == 0)) {
+ UefiDevicePathLibCatPrint (Str, L"NoTopology,0,0,0,");
+ } else if (((Info & 0x0f) <= 2) && ((Info & BIT7) == 0)) {
+ UefiDevicePathLibCatPrint (
+ Str,
+ L"%s,%s,%s,",
+ ((Info & BIT4) != 0) ? L"SATA" : L"SAS",
+ ((Info & BIT5) != 0) ? L"External" : L"Internal",
+ ((Info & BIT6) != 0) ? L"Expanded" : L"Direct"
+ );
+ if ((Info & 0x0f) == 1) {
+ UefiDevicePathLibCatPrint (Str, L"0,");
+ } else {
+ //
+ // Value 0x0 thru 0xFF -> Drive 1 thru Drive 256
+ //
+ UefiDevicePathLibCatPrint (Str, L"0x%x,", ((Info >> 8) & 0xff) + 1);
+ }
} else {
- //
- // Value 0x0 thru 0xFF -> Drive 1 thru Drive 256
- //
- UefiDevicePathLibCatPrint (Str, L"0x%x,", ((Info >> 8) & 0xff) + 1);
+ UefiDevicePathLibCatPrint (Str, L"0x%x,0,0,0,", Info);
}
- } else {
- UefiDevicePathLibCatPrint (Str, L"0x%x,0,0,0,", Info);
- }
- UefiDevicePathLibCatPrint (Str, L"0x%x)", ((SAS_DEVICE_PATH *) Vendor)->Reserved);
- return ;
- } else if (CompareGuid (&Vendor->Guid, &gEfiDebugPortProtocolGuid)) {
- UefiDevicePathLibCatPrint (Str, L"DebugPort()");
- return ;
+ UefiDevicePathLibCatPrint (Str, L"0x%x)", ((SAS_DEVICE_PATH *)Vendor)->Reserved);
+ return;
+ } else if (CompareGuid (&Vendor->Guid, &gEfiDebugPortProtocolGuid)) {
+ UefiDevicePathLibCatPrint (Str, L"DebugPort()");
+ return;
+ }
}
- }
- break;
- case MEDIA_DEVICE_PATH:
- Type = L"Media";
- break;
+ break;
+
+ case MEDIA_DEVICE_PATH:
+ Type = L"Media";
+ break;
- default:
- Type = L"?";
- break;
+ default:
+ Type = L"?";
+ break;
}
DataLength = DevicePathNodeLength (&Vendor->Header) - sizeof (VENDOR_DEVICE_PATH);
@@ -265,7 +267,7 @@ DevPathToTextVendor (
if (DataLength != 0) {
UefiDevicePathLibCatPrint (Str, L",");
for (Index = 0; Index < DataLength; Index++) {
- UefiDevicePathLibCatPrint (Str, L"%02x", ((VENDOR_DEVICE_PATH_WITH_DATA *) Vendor)->VendorDefinedData[Index]);
+ UefiDevicePathLibCatPrint (Str, L"%02x", ((VENDOR_DEVICE_PATH_WITH_DATA *)Vendor)->VendorDefinedData[Index]);
}
}
@@ -324,14 +326,14 @@ DevPathToTextBmc (
IN BOOLEAN AllowShortcuts
)
{
- BMC_DEVICE_PATH *Bmc;
+ BMC_DEVICE_PATH *Bmc;
Bmc = DevPath;
UefiDevicePathLibCatPrint (
Str,
L"BMC(0x%x,0x%lx)",
Bmc->InterfaceType,
- ReadUnaligned64 ((UINT64 *) (&Bmc->BaseAddress))
+ ReadUnaligned64 ((UINT64 *)(&Bmc->BaseAddress))
);
}
@@ -361,33 +363,33 @@ DevPathToTextAcpi (
Acpi = DevPath;
if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {
switch (EISA_ID_TO_NUM (Acpi->HID)) {
- case 0x0a03:
- UefiDevicePathLibCatPrint (Str, L"PciRoot(0x%x)", Acpi->UID);
- break;
+ case 0x0a03:
+ UefiDevicePathLibCatPrint (Str, L"PciRoot(0x%x)", Acpi->UID);
+ break;
- case 0x0a08:
- UefiDevicePathLibCatPrint (Str, L"PcieRoot(0x%x)", Acpi->UID);
- break;
+ case 0x0a08:
+ UefiDevicePathLibCatPrint (Str, L"PcieRoot(0x%x)", Acpi->UID);
+ break;
- case 0x0604:
- UefiDevicePathLibCatPrint (Str, L"Floppy(0x%x)", Acpi->UID);
- break;
+ case 0x0604:
+ UefiDevicePathLibCatPrint (Str, L"Floppy(0x%x)", Acpi->UID);
+ break;
- case 0x0301:
- UefiDevicePathLibCatPrint (Str, L"Keyboard(0x%x)", Acpi->UID);
- break;
+ case 0x0301:
+ UefiDevicePathLibCatPrint (Str, L"Keyboard(0x%x)", Acpi->UID);
+ break;
- case 0x0501:
- UefiDevicePathLibCatPrint (Str, L"Serial(0x%x)", Acpi->UID);
- break;
+ case 0x0501:
+ UefiDevicePathLibCatPrint (Str, L"Serial(0x%x)", Acpi->UID);
+ break;
- case 0x0401:
- UefiDevicePathLibCatPrint (Str, L"ParallelPort(0x%x)", Acpi->UID);
- break;
+ case 0x0401:
+ UefiDevicePathLibCatPrint (Str, L"ParallelPort(0x%x)", Acpi->UID);
+ break;
- default:
- UefiDevicePathLibCatPrint (Str, L"Acpi(PNP%04x,0x%x)", EISA_ID_TO_NUM (Acpi->HID), Acpi->UID);
- break;
+ default:
+ UefiDevicePathLibCatPrint (Str, L"Acpi(PNP%04x,0x%x)", EISA_ID_TO_NUM (Acpi->HID), Acpi->UID);
+ break;
}
} else {
UefiDevicePathLibCatPrint (Str, L"Acpi(0x%08x,0x%x)", Acpi->HID, Acpi->UID);
@@ -423,27 +425,30 @@ DevPathToTextAcpiEx (
CHAR16 CIDText[11];
AcpiEx = DevPath;
- HIDStr = (CHAR8 *) (((UINT8 *) AcpiEx) + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH));
+ HIDStr = (CHAR8 *)(((UINT8 *)AcpiEx) + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH));
UIDStr = HIDStr + AsciiStrLen (HIDStr) + 1;
CIDStr = UIDStr + AsciiStrLen (UIDStr) + 1;
if (DisplayOnly) {
if ((EISA_ID_TO_NUM (AcpiEx->HID) == 0x0A03) ||
- (EISA_ID_TO_NUM (AcpiEx->CID) == 0x0A03 && EISA_ID_TO_NUM (AcpiEx->HID) != 0x0A08)) {
+ ((EISA_ID_TO_NUM (AcpiEx->CID) == 0x0A03) && (EISA_ID_TO_NUM (AcpiEx->HID) != 0x0A08)))
+ {
if (AcpiEx->UID == 0) {
UefiDevicePathLibCatPrint (Str, L"PciRoot(%a)", UIDStr);
} else {
UefiDevicePathLibCatPrint (Str, L"PciRoot(0x%x)", AcpiEx->UID);
}
+
return;
}
- if (EISA_ID_TO_NUM (AcpiEx->HID) == 0x0A08 || EISA_ID_TO_NUM (AcpiEx->CID) == 0x0A08) {
+ if ((EISA_ID_TO_NUM (AcpiEx->HID) == 0x0A08) || (EISA_ID_TO_NUM (AcpiEx->CID) == 0x0A08)) {
if (AcpiEx->UID == 0) {
UefiDevicePathLibCatPrint (Str, L"PcieRoot(%a)", UIDStr);
} else {
UefiDevicePathLibCatPrint (Str, L"PcieRoot(0x%x)", AcpiEx->UID);
}
+
return;
}
}
@@ -480,7 +485,7 @@ DevPathToTextAcpiEx (
L"AcpiExp(%s,0,%a)",
HIDText,
UIDStr
- );
+ );
} else {
UefiDevicePathLibCatPrint (
Str,
@@ -488,7 +493,7 @@ DevPathToTextAcpiEx (
HIDText,
CIDText,
UIDStr
- );
+ );
}
} else {
if (DisplayOnly) {
@@ -548,19 +553,20 @@ DevPathToTextAcpiAdr (
IN BOOLEAN AllowShortcuts
)
{
- ACPI_ADR_DEVICE_PATH *AcpiAdr;
- UINT16 Index;
- UINT16 Length;
- UINT16 AdditionalAdrCount;
+ ACPI_ADR_DEVICE_PATH *AcpiAdr;
+ UINT16 Index;
+ UINT16 Length;
+ UINT16 AdditionalAdrCount;
AcpiAdr = DevPath;
- Length = (UINT16) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) AcpiAdr);
- AdditionalAdrCount = (UINT16) ((Length - 8) / 4);
+ Length = (UINT16)DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *)AcpiAdr);
+ AdditionalAdrCount = (UINT16)((Length - 8) / 4);
UefiDevicePathLibCatPrint (Str, L"AcpiAdr(0x%x", AcpiAdr->ADR);
for (Index = 0; Index < AdditionalAdrCount; Index++) {
- UefiDevicePathLibCatPrint (Str, L",0x%x", *(UINT32 *) ((UINT8 *) AcpiAdr + 8 + Index * 4));
+ UefiDevicePathLibCatPrint (Str, L",0x%x", *(UINT32 *)((UINT8 *)AcpiAdr + 8 + Index * 4));
}
+
UefiDevicePathLibCatPrint (Str, L")");
}
@@ -585,7 +591,7 @@ DevPathToTextAtapi (
IN BOOLEAN AllowShortcuts
)
{
- ATAPI_DEVICE_PATH *Atapi;
+ ATAPI_DEVICE_PATH *Atapi;
Atapi = DevPath;
@@ -685,10 +691,12 @@ DevPathToTextFibreEx (
for (Index = 0; Index < sizeof (FibreEx->WWN) / sizeof (FibreEx->WWN[0]); Index++) {
UefiDevicePathLibCatPrint (Str, L"%02x", FibreEx->WWN[Index]);
}
+
UefiDevicePathLibCatPrint (Str, L",0x");
for (Index = 0; Index < sizeof (FibreEx->Lun) / sizeof (FibreEx->Lun[0]); Index++) {
UefiDevicePathLibCatPrint (Str, L"%02x", FibreEx->Lun[Index]);
}
+
UefiDevicePathLibCatPrint (Str, L")");
}
@@ -722,10 +730,12 @@ DevPathToTextSasEx (
for (Index = 0; Index < sizeof (SasEx->SasAddress) / sizeof (SasEx->SasAddress[0]); Index++) {
UefiDevicePathLibCatPrint (Str, L"%02x", SasEx->SasAddress[Index]);
}
+
UefiDevicePathLibCatPrint (Str, L",0x");
for (Index = 0; Index < sizeof (SasEx->Lun) / sizeof (SasEx->Lun[0]); Index++) {
UefiDevicePathLibCatPrint (Str, L"%02x", SasEx->Lun[Index]);
}
+
UefiDevicePathLibCatPrint (Str, L",0x%x,", SasEx->RelativeTargetPort);
if (((SasEx->DeviceTopology & 0x0f) == 0) && ((SasEx->DeviceTopology & BIT7) == 0)) {
@@ -751,8 +761,7 @@ DevPathToTextSasEx (
}
UefiDevicePathLibCatPrint (Str, L")");
- return ;
-
+ return;
}
/**
@@ -776,17 +785,23 @@ DevPathToTextNVMe (
IN BOOLEAN AllowShortcuts
)
{
- NVME_NAMESPACE_DEVICE_PATH *Nvme;
- UINT8 *Uuid;
+ NVME_NAMESPACE_DEVICE_PATH *Nvme;
+ UINT8 *Uuid;
Nvme = DevPath;
- Uuid = (UINT8 *) &Nvme->NamespaceUuid;
+ Uuid = (UINT8 *)&Nvme->NamespaceUuid;
UefiDevicePathLibCatPrint (
Str,
L"NVMe(0x%x,%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x)",
Nvme->NamespaceId,
- Uuid[7], Uuid[6], Uuid[5], Uuid[4],
- Uuid[3], Uuid[2], Uuid[1], Uuid[0]
+ Uuid[7],
+ Uuid[6],
+ Uuid[5],
+ Uuid[4],
+ Uuid[3],
+ Uuid[2],
+ Uuid[1],
+ Uuid[0]
);
}
@@ -838,7 +853,7 @@ DevPathToTextSd (
IN BOOLEAN AllowShortcuts
)
{
- SD_DEVICE_PATH *Sd;
+ SD_DEVICE_PATH *Sd;
Sd = DevPath;
UefiDevicePathLibCatPrint (
@@ -869,7 +884,7 @@ DevPathToTextEmmc (
IN BOOLEAN AllowShortcuts
)
{
- EMMC_DEVICE_PATH *Emmc;
+ EMMC_DEVICE_PATH *Emmc;
Emmc = DevPath;
UefiDevicePathLibCatPrint (
@@ -900,7 +915,7 @@ DevPathToText1394 (
IN BOOLEAN AllowShortcuts
)
{
- F1394_DEVICE_PATH *F1394DevPath;
+ F1394_DEVICE_PATH *F1394DevPath;
F1394DevPath = DevPath;
//
@@ -930,7 +945,7 @@ DevPathToTextUsb (
IN BOOLEAN AllowShortcuts
)
{
- USB_DEVICE_PATH *Usb;
+ USB_DEVICE_PATH *Usb;
Usb = DevPath;
UefiDevicePathLibCatPrint (Str, L"USB(0x%x,0x%x)", Usb->ParentPortNumber, Usb->InterfaceNumber);
@@ -964,15 +979,15 @@ DevPathToTextUsbWWID (
UsbWWId = DevPath;
- SerialNumberStr = (CHAR16 *) ((UINT8 *) UsbWWId + sizeof (USB_WWID_DEVICE_PATH));
- Length = (UINT16) ((DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) UsbWWId) - sizeof (USB_WWID_DEVICE_PATH)) / sizeof (CHAR16));
- if (Length >= 1 && SerialNumberStr [Length - 1] != 0) {
+ SerialNumberStr = (CHAR16 *)((UINT8 *)UsbWWId + sizeof (USB_WWID_DEVICE_PATH));
+ Length = (UINT16)((DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *)UsbWWId) - sizeof (USB_WWID_DEVICE_PATH)) / sizeof (CHAR16));
+ if ((Length >= 1) && (SerialNumberStr[Length - 1] != 0)) {
//
// In case no NULL terminator in SerialNumber, create a new one with NULL terminator
//
NewStr = AllocateCopyPool ((Length + 1) * sizeof (CHAR16), SerialNumberStr);
ASSERT (NewStr != NULL);
- NewStr [Length] = 0;
+ NewStr[Length] = 0;
SerialNumberStr = NewStr;
}
@@ -1007,7 +1022,7 @@ DevPathToTextLogicalUnit (
IN BOOLEAN AllowShortcuts
)
{
- DEVICE_LOGICAL_UNIT_DEVICE_PATH *LogicalUnit;
+ DEVICE_LOGICAL_UNIT_DEVICE_PATH *LogicalUnit;
LogicalUnit = DevPath;
UefiDevicePathLibCatPrint (Str, L"Unit(0x%x)", LogicalUnit->Lun);
@@ -1034,65 +1049,64 @@ DevPathToTextUsbClass (
IN BOOLEAN AllowShortcuts
)
{
- USB_CLASS_DEVICE_PATH *UsbClass;
- BOOLEAN IsKnownSubClass;
-
+ USB_CLASS_DEVICE_PATH *UsbClass;
+ BOOLEAN IsKnownSubClass;
UsbClass = DevPath;
IsKnownSubClass = TRUE;
switch (UsbClass->DeviceClass) {
- case USB_CLASS_AUDIO:
- UefiDevicePathLibCatPrint (Str, L"UsbAudio");
- break;
+ case USB_CLASS_AUDIO:
+ UefiDevicePathLibCatPrint (Str, L"UsbAudio");
+ break;
- case USB_CLASS_CDCCONTROL:
- UefiDevicePathLibCatPrint (Str, L"UsbCDCControl");
- break;
+ case USB_CLASS_CDCCONTROL:
+ UefiDevicePathLibCatPrint (Str, L"UsbCDCControl");
+ break;
- case USB_CLASS_HID:
- UefiDevicePathLibCatPrint (Str, L"UsbHID");
- break;
+ case USB_CLASS_HID:
+ UefiDevicePathLibCatPrint (Str, L"UsbHID");
+ break;
- case USB_CLASS_IMAGE:
- UefiDevicePathLibCatPrint (Str, L"UsbImage");
- break;
+ case USB_CLASS_IMAGE:
+ UefiDevicePathLibCatPrint (Str, L"UsbImage");
+ break;
- case USB_CLASS_PRINTER:
- UefiDevicePathLibCatPrint (Str, L"UsbPrinter");
- break;
+ case USB_CLASS_PRINTER:
+ UefiDevicePathLibCatPrint (Str, L"UsbPrinter");
+ break;
- case USB_CLASS_MASS_STORAGE:
- UefiDevicePathLibCatPrint (Str, L"UsbMassStorage");
- break;
+ case USB_CLASS_MASS_STORAGE:
+ UefiDevicePathLibCatPrint (Str, L"UsbMassStorage");
+ break;
- case USB_CLASS_HUB:
- UefiDevicePathLibCatPrint (Str, L"UsbHub");
- break;
+ case USB_CLASS_HUB:
+ UefiDevicePathLibCatPrint (Str, L"UsbHub");
+ break;
- case USB_CLASS_CDCDATA:
- UefiDevicePathLibCatPrint (Str, L"UsbCDCData");
- break;
+ case USB_CLASS_CDCDATA:
+ UefiDevicePathLibCatPrint (Str, L"UsbCDCData");
+ break;
- case USB_CLASS_SMART_CARD:
- UefiDevicePathLibCatPrint (Str, L"UsbSmartCard");
- break;
+ case USB_CLASS_SMART_CARD:
+ UefiDevicePathLibCatPrint (Str, L"UsbSmartCard");
+ break;
- case USB_CLASS_VIDEO:
- UefiDevicePathLibCatPrint (Str, L"UsbVideo");
- break;
+ case USB_CLASS_VIDEO:
+ UefiDevicePathLibCatPrint (Str, L"UsbVideo");
+ break;
- case USB_CLASS_DIAGNOSTIC:
- UefiDevicePathLibCatPrint (Str, L"UsbDiagnostic");
- break;
+ case USB_CLASS_DIAGNOSTIC:
+ UefiDevicePathLibCatPrint (Str, L"UsbDiagnostic");
+ break;
- case USB_CLASS_WIRELESS:
- UefiDevicePathLibCatPrint (Str, L"UsbWireless");
- break;
+ case USB_CLASS_WIRELESS:
+ UefiDevicePathLibCatPrint (Str, L"UsbWireless");
+ break;
- default:
- IsKnownSubClass = FALSE;
- break;
+ default:
+ IsKnownSubClass = FALSE;
+ break;
}
if (IsKnownSubClass) {
@@ -1170,7 +1184,7 @@ DevPathToTextSata (
IN BOOLEAN AllowShortcuts
)
{
- SATA_DEVICE_PATH *Sata;
+ SATA_DEVICE_PATH *Sata;
Sata = DevPath;
UefiDevicePathLibCatPrint (
@@ -1203,7 +1217,7 @@ DevPathToTextI2O (
IN BOOLEAN AllowShortcuts
)
{
- I2O_DEVICE_PATH *I2ODevPath;
+ I2O_DEVICE_PATH *I2ODevPath;
I2ODevPath = DevPath;
UefiDevicePathLibCatPrint (Str, L"I2O(0x%x)", I2ODevPath->Tid);
@@ -1237,7 +1251,7 @@ DevPathToTextMacAddr (
MacDevPath = DevPath;
HwAddressSize = sizeof (EFI_MAC_ADDRESS);
- if (MacDevPath->IfType == 0x01 || MacDevPath->IfType == 0x00) {
+ if ((MacDevPath->IfType == 0x01) || (MacDevPath->IfType == 0x00)) {
HwAddressSize = 6;
}
@@ -1280,8 +1294,8 @@ CatNetworkProtocol (
**/
VOID
CatIPv4Address (
- IN OUT POOL_PRINT *Str,
- IN EFI_IPv4_ADDRESS *Address
+ IN OUT POOL_PRINT *Str,
+ IN EFI_IPv4_ADDRESS *Address
)
{
UefiDevicePathLibCatPrint (Str, L"%d.%d.%d.%d", Address->Addr[0], Address->Addr[1], Address->Addr[2], Address->Addr[3]);
@@ -1295,21 +1309,30 @@ CatIPv4Address (
**/
VOID
CatIPv6Address (
- IN OUT POOL_PRINT *Str,
- IN EFI_IPv6_ADDRESS *Address
+ IN OUT POOL_PRINT *Str,
+ IN EFI_IPv6_ADDRESS *Address
)
{
UefiDevicePathLibCatPrint (
- Str, L"%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
- Address->Addr[0], Address->Addr[1],
- Address->Addr[2], Address->Addr[3],
- Address->Addr[4], Address->Addr[5],
- Address->Addr[6], Address->Addr[7],
- Address->Addr[8], Address->Addr[9],
- Address->Addr[10], Address->Addr[11],
- Address->Addr[12], Address->Addr[13],
- Address->Addr[14], Address->Addr[15]
- );
+ Str,
+ L"%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
+ Address->Addr[0],
+ Address->Addr[1],
+ Address->Addr[2],
+ Address->Addr[3],
+ Address->Addr[4],
+ Address->Addr[5],
+ Address->Addr[6],
+ Address->Addr[7],
+ Address->Addr[8],
+ Address->Addr[9],
+ Address->Addr[10],
+ Address->Addr[11],
+ Address->Addr[12],
+ Address->Addr[13],
+ Address->Addr[14],
+ Address->Addr[15]
+ );
}
/**
@@ -1341,7 +1364,7 @@ DevPathToTextIPv4 (
if (DisplayOnly) {
UefiDevicePathLibCatPrint (Str, L")");
- return ;
+ return;
}
UefiDevicePathLibCatPrint (Str, L",");
@@ -1355,6 +1378,7 @@ DevPathToTextIPv4 (
UefiDevicePathLibCatPrint (Str, L",");
CatIPv4Address (Str, &IPDevPath->SubnetMask);
}
+
UefiDevicePathLibCatPrint (Str, L")");
}
@@ -1386,7 +1410,7 @@ DevPathToTextIPv6 (
CatIPv6Address (Str, &IPDevPath->RemoteIpAddress);
if (DisplayOnly) {
UefiDevicePathLibCatPrint (Str, L")");
- return ;
+ return;
}
UefiDevicePathLibCatPrint (Str, L",");
@@ -1410,6 +1434,7 @@ DevPathToTextIPv6 (
UefiDevicePathLibCatPrint (Str, L",0x%x,", IPDevPath->PrefixLength);
CatIPv6Address (Str, &IPDevPath->GatewayIpAddress);
}
+
UefiDevicePathLibCatPrint (Str, L")");
}
@@ -1474,33 +1499,33 @@ DevPathToTextUart (
Uart = DevPath;
switch (Uart->Parity) {
- case 0:
- Parity = 'D';
- break;
+ case 0:
+ Parity = 'D';
+ break;
- case 1:
- Parity = 'N';
- break;
+ case 1:
+ Parity = 'N';
+ break;
- case 2:
- Parity = 'E';
- break;
+ case 2:
+ Parity = 'E';
+ break;
- case 3:
- Parity = 'O';
- break;
+ case 3:
+ Parity = 'O';
+ break;
- case 4:
- Parity = 'M';
- break;
+ case 4:
+ Parity = 'M';
+ break;
- case 5:
- Parity = 'S';
- break;
+ case 5:
+ Parity = 'S';
+ break;
- default:
- Parity = 'x';
- break;
+ default:
+ Parity = 'x';
+ break;
}
if (Uart->BaudRate == 0) {
@@ -1518,25 +1543,25 @@ DevPathToTextUart (
UefiDevicePathLibCatPrint (Str, L"%c,", Parity);
switch (Uart->StopBits) {
- case 0:
- UefiDevicePathLibCatPrint (Str, L"D)");
- break;
+ case 0:
+ UefiDevicePathLibCatPrint (Str, L"D)");
+ break;
- case 1:
- UefiDevicePathLibCatPrint (Str, L"1)");
- break;
+ case 1:
+ UefiDevicePathLibCatPrint (Str, L"1)");
+ break;
- case 2:
- UefiDevicePathLibCatPrint (Str, L"1.5)");
- break;
+ case 2:
+ UefiDevicePathLibCatPrint (Str, L"1.5)");
+ break;
- case 3:
- UefiDevicePathLibCatPrint (Str, L"2)");
- break;
+ case 3:
+ UefiDevicePathLibCatPrint (Str, L"2)");
+ break;
- default:
- UefiDevicePathLibCatPrint (Str, L"x)");
- break;
+ default:
+ UefiDevicePathLibCatPrint (Str, L"x)");
+ break;
}
}
@@ -1561,9 +1586,9 @@ DevPathToTextiSCSI (
IN BOOLEAN AllowShortcuts
)
{
- ISCSI_DEVICE_PATH_WITH_NAME *ISCSIDevPath;
- UINT16 Options;
- UINTN Index;
+ ISCSI_DEVICE_PATH_WITH_NAME *ISCSIDevPath;
+ UINT16 Options;
+ UINTN Index;
ISCSIDevPath = DevPath;
UefiDevicePathLibCatPrint (
@@ -1575,6 +1600,7 @@ DevPathToTextiSCSI (
for (Index = 0; Index < sizeof (ISCSIDevPath->Lun) / sizeof (UINT8); Index++) {
UefiDevicePathLibCatPrint (Str, L"%02x", ((UINT8 *)&ISCSIDevPath->Lun)[Index]);
}
+
Options = ISCSIDevPath->LoginOption;
UefiDevicePathLibCatPrint (Str, L",%s,", (((Options >> 1) & 0x0001) != 0) ? L"CRC32C" : L"None");
UefiDevicePathLibCatPrint (Str, L"%s,", (((Options >> 3) & 0x0001) != 0) ? L"CRC32C" : L"None");
@@ -1584,7 +1610,6 @@ DevPathToTextiSCSI (
UefiDevicePathLibCatPrint (Str, L"%s,", L"CHAP_UNI");
} else {
UefiDevicePathLibCatPrint (Str, L"%s,", L"CHAP_BI");
-
}
UefiDevicePathLibCatPrint (Str, L"%s)", (ISCSIDevPath->NetworkProtocol == 0) ? L"TCP" : L"reserved");
@@ -1674,8 +1699,8 @@ DevPathToTextWiFi (
IN BOOLEAN AllowShortcuts
)
{
- WIFI_DEVICE_PATH *WiFi;
- UINT8 SSId[33];
+ WIFI_DEVICE_PATH *WiFi;
+ UINT8 SSId[33];
WiFi = DevPath;
@@ -1747,8 +1772,8 @@ DevPathToTextDns (
UINT32 DnsServerIpCount;
UINT32 DnsServerIpIndex;
- DnsDevPath = DevPath;
- DnsServerIpCount = (UINT32) (DevicePathNodeLength(DnsDevPath) - sizeof (EFI_DEVICE_PATH_PROTOCOL) - sizeof (DnsDevPath->IsIPv6)) / sizeof (EFI_IP_ADDRESS);
+ DnsDevPath = DevPath;
+ DnsServerIpCount = (UINT32)(DevicePathNodeLength (DnsDevPath) - sizeof (EFI_DEVICE_PATH_PROTOCOL) - sizeof (DnsDevPath->IsIPv6)) / sizeof (EFI_IP_ADDRESS);
UefiDevicePathLibCatPrint (Str, L"Dns(");
@@ -1788,16 +1813,16 @@ DevPathToTextUri (
IN BOOLEAN AllowShortcuts
)
{
- URI_DEVICE_PATH *Uri;
- UINTN UriLength;
- CHAR8 *UriStr;
+ URI_DEVICE_PATH *Uri;
+ UINTN UriLength;
+ CHAR8 *UriStr;
//
// Uri in the device path may not be null terminated.
//
Uri = DevPath;
UriLength = DevicePathNodeLength (Uri) - sizeof (URI_DEVICE_PATH);
- UriStr = AllocatePool (UriLength + 1);
+ UriStr = AllocatePool (UriLength + 1);
ASSERT (UriStr != NULL);
CopyMem (UriStr, Uri->Uri, UriLength);
@@ -1827,38 +1852,38 @@ DevPathToTextHardDrive (
IN BOOLEAN AllowShortcuts
)
{
- HARDDRIVE_DEVICE_PATH *Hd;
+ HARDDRIVE_DEVICE_PATH *Hd;
Hd = DevPath;
switch (Hd->SignatureType) {
- case SIGNATURE_TYPE_MBR:
- UefiDevicePathLibCatPrint (
- Str,
- L"HD(%d,%s,0x%08x,",
- Hd->PartitionNumber,
- L"MBR",
- *((UINT32 *) (&(Hd->Signature[0])))
- );
- break;
+ case SIGNATURE_TYPE_MBR:
+ UefiDevicePathLibCatPrint (
+ Str,
+ L"HD(%d,%s,0x%08x,",
+ Hd->PartitionNumber,
+ L"MBR",
+ *((UINT32 *)(&(Hd->Signature[0])))
+ );
+ break;
- case SIGNATURE_TYPE_GUID:
- UefiDevicePathLibCatPrint (
- Str,
- L"HD(%d,%s,%g,",
- Hd->PartitionNumber,
- L"GPT",
- (EFI_GUID *) &(Hd->Signature[0])
- );
- break;
+ case SIGNATURE_TYPE_GUID:
+ UefiDevicePathLibCatPrint (
+ Str,
+ L"HD(%d,%s,%g,",
+ Hd->PartitionNumber,
+ L"GPT",
+ (EFI_GUID *)&(Hd->Signature[0])
+ );
+ break;
- default:
- UefiDevicePathLibCatPrint (
- Str,
- L"HD(%d,%d,0,",
- Hd->PartitionNumber,
- Hd->SignatureType
- );
- break;
+ default:
+ UefiDevicePathLibCatPrint (
+ Str,
+ L"HD(%d,%d,0,",
+ Hd->PartitionNumber,
+ Hd->SignatureType
+ );
+ break;
}
UefiDevicePathLibCatPrint (Str, L"0x%lx,0x%lx)", Hd->PartitionStart, Hd->PartitionSize);
@@ -1885,12 +1910,12 @@ DevPathToTextCDROM (
IN BOOLEAN AllowShortcuts
)
{
- CDROM_DEVICE_PATH *Cd;
+ CDROM_DEVICE_PATH *Cd;
Cd = DevPath;
if (DisplayOnly) {
UefiDevicePathLibCatPrint (Str, L"CDROM(0x%x)", Cd->BootEntry);
- return ;
+ return;
}
UefiDevicePathLibCatPrint (Str, L"CDROM(0x%x,0x%lx,0x%lx)", Cd->BootEntry, Cd->PartitionStart, Cd->PartitionSize);
@@ -2019,13 +2044,13 @@ DevPathToTextFvFile (
**/
VOID
DevPathRelativeOffsetRange (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath,
+ IN BOOLEAN DisplayOnly,
+ IN BOOLEAN AllowShortcuts
)
{
- MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH *Offset;
+ MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH *Offset;
Offset = DevPath;
UefiDevicePathLibCatPrint (
@@ -2051,13 +2076,13 @@ DevPathRelativeOffsetRange (
**/
VOID
DevPathToTextRamDisk (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath,
+ IN BOOLEAN DisplayOnly,
+ IN BOOLEAN AllowShortcuts
)
{
- MEDIA_RAM_DISK_DEVICE_PATH *RamDisk;
+ MEDIA_RAM_DISK_DEVICE_PATH *RamDisk;
RamDisk = DevPath;
@@ -2126,38 +2151,38 @@ DevPathToTextBBS (
IN BOOLEAN AllowShortcuts
)
{
- BBS_BBS_DEVICE_PATH *Bbs;
- CHAR16 *Type;
+ BBS_BBS_DEVICE_PATH *Bbs;
+ CHAR16 *Type;
Bbs = DevPath;
switch (Bbs->DeviceType) {
- case BBS_TYPE_FLOPPY:
- Type = L"Floppy";
- break;
+ case BBS_TYPE_FLOPPY:
+ Type = L"Floppy";
+ break;
- case BBS_TYPE_HARDDRIVE:
- Type = L"HD";
- break;
+ case BBS_TYPE_HARDDRIVE:
+ Type = L"HD";
+ break;
- case BBS_TYPE_CDROM:
- Type = L"CDROM";
- break;
+ case BBS_TYPE_CDROM:
+ Type = L"CDROM";
+ break;
- case BBS_TYPE_PCMCIA:
- Type = L"PCMCIA";
- break;
+ case BBS_TYPE_PCMCIA:
+ Type = L"PCMCIA";
+ break;
- case BBS_TYPE_USB:
- Type = L"USB";
- break;
+ case BBS_TYPE_USB:
+ Type = L"USB";
+ break;
- case BBS_TYPE_EMBEDDED_NETWORK:
- Type = L"Network";
- break;
+ case BBS_TYPE_EMBEDDED_NETWORK:
+ Type = L"Network";
+ break;
- default:
- Type = NULL;
- break;
+ default:
+ Type = NULL;
+ break;
}
if (Type != NULL) {
@@ -2168,7 +2193,7 @@ DevPathToTextBBS (
if (DisplayOnly) {
UefiDevicePathLibCatPrint (Str, L")");
- return ;
+ return;
}
UefiDevicePathLibCatPrint (Str, L",0x%x)", Bbs->StatusFlag);
@@ -2198,13 +2223,13 @@ DevPathToTextEndInstance (
UefiDevicePathLibCatPrint (Str, L",");
}
-GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_GENERIC_TABLE mUefiDevicePathLibToTextTableGeneric[] = {
- {HARDWARE_DEVICE_PATH, L"HardwarePath" },
- {ACPI_DEVICE_PATH, L"AcpiPath" },
- {MESSAGING_DEVICE_PATH, L"Msg" },
- {MEDIA_DEVICE_PATH, L"MediaPath" },
- {BBS_DEVICE_PATH, L"BbsPath" },
- {0, NULL}
+GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_GENERIC_TABLE mUefiDevicePathLibToTextTableGeneric[] = {
+ { HARDWARE_DEVICE_PATH, L"HardwarePath" },
+ { ACPI_DEVICE_PATH, L"AcpiPath" },
+ { MESSAGING_DEVICE_PATH, L"Msg" },
+ { MEDIA_DEVICE_PATH, L"MediaPath" },
+ { BBS_DEVICE_PATH, L"BbsPath" },
+ { 0, NULL }
};
/**
@@ -2228,8 +2253,8 @@ DevPathToTextNodeGeneric (
IN BOOLEAN AllowShortcuts
)
{
- EFI_DEVICE_PATH_PROTOCOL *Node;
- UINTN Index;
+ EFI_DEVICE_PATH_PROTOCOL *Node;
+ UINTN Index;
Node = DevPath;
@@ -2254,65 +2279,65 @@ DevPathToTextNodeGeneric (
Index = sizeof (EFI_DEVICE_PATH_PROTOCOL);
if (Index < DevicePathNodeLength (Node)) {
UefiDevicePathLibCatPrint (Str, L",");
- for (; Index < DevicePathNodeLength (Node); Index++) {
- UefiDevicePathLibCatPrint (Str, L"%02x", ((UINT8 *) Node)[Index]);
+ for ( ; Index < DevicePathNodeLength (Node); Index++) {
+ UefiDevicePathLibCatPrint (Str, L"%02x", ((UINT8 *)Node)[Index]);
}
}
UefiDevicePathLibCatPrint (Str, L")");
}
-GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLibToTextTable[] = {
- {HARDWARE_DEVICE_PATH, HW_PCI_DP, DevPathToTextPci },
- {HARDWARE_DEVICE_PATH, HW_PCCARD_DP, DevPathToTextPccard },
- {HARDWARE_DEVICE_PATH, HW_MEMMAP_DP, DevPathToTextMemMap },
- {HARDWARE_DEVICE_PATH, HW_VENDOR_DP, DevPathToTextVendor },
- {HARDWARE_DEVICE_PATH, HW_CONTROLLER_DP, DevPathToTextController },
- {HARDWARE_DEVICE_PATH, HW_BMC_DP, DevPathToTextBmc },
- {ACPI_DEVICE_PATH, ACPI_DP, DevPathToTextAcpi },
- {ACPI_DEVICE_PATH, ACPI_EXTENDED_DP, DevPathToTextAcpiEx },
- {ACPI_DEVICE_PATH, ACPI_ADR_DP, DevPathToTextAcpiAdr },
- {MESSAGING_DEVICE_PATH, MSG_ATAPI_DP, DevPathToTextAtapi },
- {MESSAGING_DEVICE_PATH, MSG_SCSI_DP, DevPathToTextScsi },
- {MESSAGING_DEVICE_PATH, MSG_FIBRECHANNEL_DP, DevPathToTextFibre },
- {MESSAGING_DEVICE_PATH, MSG_FIBRECHANNELEX_DP, DevPathToTextFibreEx },
- {MESSAGING_DEVICE_PATH, MSG_SASEX_DP, DevPathToTextSasEx },
- {MESSAGING_DEVICE_PATH, MSG_NVME_NAMESPACE_DP, DevPathToTextNVMe },
- {MESSAGING_DEVICE_PATH, MSG_UFS_DP, DevPathToTextUfs },
- {MESSAGING_DEVICE_PATH, MSG_SD_DP, DevPathToTextSd },
- {MESSAGING_DEVICE_PATH, MSG_EMMC_DP, DevPathToTextEmmc },
- {MESSAGING_DEVICE_PATH, MSG_1394_DP, DevPathToText1394 },
- {MESSAGING_DEVICE_PATH, MSG_USB_DP, DevPathToTextUsb },
- {MESSAGING_DEVICE_PATH, MSG_USB_WWID_DP, DevPathToTextUsbWWID },
- {MESSAGING_DEVICE_PATH, MSG_DEVICE_LOGICAL_UNIT_DP, DevPathToTextLogicalUnit },
- {MESSAGING_DEVICE_PATH, MSG_USB_CLASS_DP, DevPathToTextUsbClass },
- {MESSAGING_DEVICE_PATH, MSG_SATA_DP, DevPathToTextSata },
- {MESSAGING_DEVICE_PATH, MSG_I2O_DP, DevPathToTextI2O },
- {MESSAGING_DEVICE_PATH, MSG_MAC_ADDR_DP, DevPathToTextMacAddr },
- {MESSAGING_DEVICE_PATH, MSG_IPv4_DP, DevPathToTextIPv4 },
- {MESSAGING_DEVICE_PATH, MSG_IPv6_DP, DevPathToTextIPv6 },
- {MESSAGING_DEVICE_PATH, MSG_INFINIBAND_DP, DevPathToTextInfiniBand },
- {MESSAGING_DEVICE_PATH, MSG_UART_DP, DevPathToTextUart },
- {MESSAGING_DEVICE_PATH, MSG_VENDOR_DP, DevPathToTextVendor },
- {MESSAGING_DEVICE_PATH, MSG_ISCSI_DP, DevPathToTextiSCSI },
- {MESSAGING_DEVICE_PATH, MSG_VLAN_DP, DevPathToTextVlan },
- {MESSAGING_DEVICE_PATH, MSG_DNS_DP, DevPathToTextDns },
- {MESSAGING_DEVICE_PATH, MSG_URI_DP, DevPathToTextUri },
- {MESSAGING_DEVICE_PATH, MSG_BLUETOOTH_DP, DevPathToTextBluetooth },
- {MESSAGING_DEVICE_PATH, MSG_WIFI_DP, DevPathToTextWiFi },
- {MESSAGING_DEVICE_PATH, MSG_BLUETOOTH_LE_DP, DevPathToTextBluetoothLE },
- {MEDIA_DEVICE_PATH, MEDIA_HARDDRIVE_DP, DevPathToTextHardDrive },
- {MEDIA_DEVICE_PATH, MEDIA_CDROM_DP, DevPathToTextCDROM },
- {MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP, DevPathToTextVendor },
- {MEDIA_DEVICE_PATH, MEDIA_PROTOCOL_DP, DevPathToTextMediaProtocol },
- {MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP, DevPathToTextFilePath },
- {MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_VOL_DP, DevPathToTextFv },
- {MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_FILE_DP, DevPathToTextFvFile },
- {MEDIA_DEVICE_PATH, MEDIA_RELATIVE_OFFSET_RANGE_DP, DevPathRelativeOffsetRange },
- {MEDIA_DEVICE_PATH, MEDIA_RAM_DISK_DP, DevPathToTextRamDisk },
- {BBS_DEVICE_PATH, BBS_BBS_DP, DevPathToTextBBS },
- {END_DEVICE_PATH_TYPE, END_INSTANCE_DEVICE_PATH_SUBTYPE, DevPathToTextEndInstance },
- {0, 0, NULL}
+GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLibToTextTable[] = {
+ { HARDWARE_DEVICE_PATH, HW_PCI_DP, DevPathToTextPci },
+ { HARDWARE_DEVICE_PATH, HW_PCCARD_DP, DevPathToTextPccard },
+ { HARDWARE_DEVICE_PATH, HW_MEMMAP_DP, DevPathToTextMemMap },
+ { HARDWARE_DEVICE_PATH, HW_VENDOR_DP, DevPathToTextVendor },
+ { HARDWARE_DEVICE_PATH, HW_CONTROLLER_DP, DevPathToTextController },
+ { HARDWARE_DEVICE_PATH, HW_BMC_DP, DevPathToTextBmc },
+ { ACPI_DEVICE_PATH, ACPI_DP, DevPathToTextAcpi },
+ { ACPI_DEVICE_PATH, ACPI_EXTENDED_DP, DevPathToTextAcpiEx },
+ { ACPI_DEVICE_PATH, ACPI_ADR_DP, DevPathToTextAcpiAdr },
+ { MESSAGING_DEVICE_PATH, MSG_ATAPI_DP, DevPathToTextAtapi },
+ { MESSAGING_DEVICE_PATH, MSG_SCSI_DP, DevPathToTextScsi },
+ { MESSAGING_DEVICE_PATH, MSG_FIBRECHANNEL_DP, DevPathToTextFibre },
+ { MESSAGING_DEVICE_PATH, MSG_FIBRECHANNELEX_DP, DevPathToTextFibreEx },
+ { MESSAGING_DEVICE_PATH, MSG_SASEX_DP, DevPathToTextSasEx },
+ { MESSAGING_DEVICE_PATH, MSG_NVME_NAMESPACE_DP, DevPathToTextNVMe },
+ { MESSAGING_DEVICE_PATH, MSG_UFS_DP, DevPathToTextUfs },
+ { MESSAGING_DEVICE_PATH, MSG_SD_DP, DevPathToTextSd },
+ { MESSAGING_DEVICE_PATH, MSG_EMMC_DP, DevPathToTextEmmc },
+ { MESSAGING_DEVICE_PATH, MSG_1394_DP, DevPathToText1394 },
+ { MESSAGING_DEVICE_PATH, MSG_USB_DP, DevPathToTextUsb },
+ { MESSAGING_DEVICE_PATH, MSG_USB_WWID_DP, DevPathToTextUsbWWID },
+ { MESSAGING_DEVICE_PATH, MSG_DEVICE_LOGICAL_UNIT_DP, DevPathToTextLogicalUnit },
+ { MESSAGING_DEVICE_PATH, MSG_USB_CLASS_DP, DevPathToTextUsbClass },
+ { MESSAGING_DEVICE_PATH, MSG_SATA_DP, DevPathToTextSata },
+ { MESSAGING_DEVICE_PATH, MSG_I2O_DP, DevPathToTextI2O },
+ { MESSAGING_DEVICE_PATH, MSG_MAC_ADDR_DP, DevPathToTextMacAddr },
+ { MESSAGING_DEVICE_PATH, MSG_IPv4_DP, DevPathToTextIPv4 },
+ { MESSAGING_DEVICE_PATH, MSG_IPv6_DP, DevPathToTextIPv6 },
+ { MESSAGING_DEVICE_PATH, MSG_INFINIBAND_DP, DevPathToTextInfiniBand },
+ { MESSAGING_DEVICE_PATH, MSG_UART_DP, DevPathToTextUart },
+ { MESSAGING_DEVICE_PATH, MSG_VENDOR_DP, DevPathToTextVendor },
+ { MESSAGING_DEVICE_PATH, MSG_ISCSI_DP, DevPathToTextiSCSI },
+ { MESSAGING_DEVICE_PATH, MSG_VLAN_DP, DevPathToTextVlan },
+ { MESSAGING_DEVICE_PATH, MSG_DNS_DP, DevPathToTextDns },
+ { MESSAGING_DEVICE_PATH, MSG_URI_DP, DevPathToTextUri },
+ { MESSAGING_DEVICE_PATH, MSG_BLUETOOTH_DP, DevPathToTextBluetooth },
+ { MESSAGING_DEVICE_PATH, MSG_WIFI_DP, DevPathToTextWiFi },
+ { MESSAGING_DEVICE_PATH, MSG_BLUETOOTH_LE_DP, DevPathToTextBluetoothLE },
+ { MEDIA_DEVICE_PATH, MEDIA_HARDDRIVE_DP, DevPathToTextHardDrive },
+ { MEDIA_DEVICE_PATH, MEDIA_CDROM_DP, DevPathToTextCDROM },
+ { MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP, DevPathToTextVendor },
+ { MEDIA_DEVICE_PATH, MEDIA_PROTOCOL_DP, DevPathToTextMediaProtocol },
+ { MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP, DevPathToTextFilePath },
+ { MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_VOL_DP, DevPathToTextFv },
+ { MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_FILE_DP, DevPathToTextFvFile },
+ { MEDIA_DEVICE_PATH, MEDIA_RELATIVE_OFFSET_RANGE_DP, DevPathRelativeOffsetRange },
+ { MEDIA_DEVICE_PATH, MEDIA_RAM_DISK_DP, DevPathToTextRamDisk },
+ { BBS_DEVICE_PATH, BBS_BBS_DP, DevPathToTextBBS },
+ { END_DEVICE_PATH_TYPE, END_INSTANCE_DEVICE_PATH_SUBTYPE, DevPathToTextEndInstance },
+ { 0, 0, NULL }
};
/**
@@ -2338,9 +2363,9 @@ UefiDevicePathLibConvertDeviceNodeToText (
IN BOOLEAN AllowShortcuts
)
{
- POOL_PRINT Str;
- UINTN Index;
- DEVICE_PATH_TO_TEXT ToText;
+ POOL_PRINT Str;
+ UINTN Index;
+ DEVICE_PATH_TO_TEXT ToText;
if (DeviceNode == NULL) {
return NULL;
@@ -2354,9 +2379,10 @@ UefiDevicePathLibConvertDeviceNodeToText (
//
ToText = DevPathToTextNodeGeneric;
for (Index = 0; mUefiDevicePathLibToTextTable[Index].Function != NULL; Index++) {
- if (DevicePathType (DeviceNode) == mUefiDevicePathLibToTextTable[Index].Type &&
- DevicePathSubType (DeviceNode) == mUefiDevicePathLibToTextTable[Index].SubType
- ) {
+ if ((DevicePathType (DeviceNode) == mUefiDevicePathLibToTextTable[Index].Type) &&
+ (DevicePathSubType (DeviceNode) == mUefiDevicePathLibToTextTable[Index].SubType)
+ )
+ {
ToText = mUefiDevicePathLibToTextTable[Index].Function;
break;
}
@@ -2365,7 +2391,7 @@ UefiDevicePathLibConvertDeviceNodeToText (
//
// Print this node
//
- ToText (&Str, (VOID *) DeviceNode, DisplayOnly, AllowShortcuts);
+ ToText (&Str, (VOID *)DeviceNode, DisplayOnly, AllowShortcuts);
ASSERT (Str.Str != NULL);
return Str.Str;
@@ -2389,16 +2415,16 @@ UefiDevicePathLibConvertDeviceNodeToText (
CHAR16 *
EFIAPI
UefiDevicePathLibConvertDevicePathToText (
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ IN BOOLEAN DisplayOnly,
+ IN BOOLEAN AllowShortcuts
)
{
- POOL_PRINT Str;
- EFI_DEVICE_PATH_PROTOCOL *Node;
- EFI_DEVICE_PATH_PROTOCOL *AlignedNode;
- UINTN Index;
- DEVICE_PATH_TO_TEXT ToText;
+ POOL_PRINT Str;
+ EFI_DEVICE_PATH_PROTOCOL *Node;
+ EFI_DEVICE_PATH_PROTOCOL *AlignedNode;
+ UINTN Index;
+ DEVICE_PATH_TO_TEXT ToText;
if (DevicePath == NULL) {
return NULL;
@@ -2409,7 +2435,7 @@ UefiDevicePathLibConvertDevicePathToText (
//
// Process each device path node
//
- Node = (EFI_DEVICE_PATH_PROTOCOL *) DevicePath;
+ Node = (EFI_DEVICE_PATH_PROTOCOL *)DevicePath;
while (!IsDevicePathEnd (Node)) {
//
// Find the handler to dump this device path node
@@ -2417,14 +2443,15 @@ UefiDevicePathLibConvertDevicePathToText (
//
ToText = DevPathToTextNodeGeneric;
for (Index = 0; mUefiDevicePathLibToTextTable[Index].Function != NULL; Index += 1) {
-
- if (DevicePathType (Node) == mUefiDevicePathLibToTextTable[Index].Type &&
- DevicePathSubType (Node) == mUefiDevicePathLibToTextTable[Index].SubType
- ) {
+ if ((DevicePathType (Node) == mUefiDevicePathLibToTextTable[Index].Type) &&
+ (DevicePathSubType (Node) == mUefiDevicePathLibToTextTable[Index].SubType)
+ )
+ {
ToText = mUefiDevicePathLibToTextTable[Index].Function;
break;
}
}
+
//
// Put a path separator in if needed
//
diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c
index b9aa462fdf..5ee3e9a31f 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c
@@ -46,18 +46,18 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_PROTOCOL mUefiDevicePathLib
BOOLEAN
EFIAPI
IsDevicePathValid (
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN UINTN MaxSize
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ IN UINTN MaxSize
)
{
- UINTN Count;
- UINTN Size;
- UINTN NodeLength;
+ UINTN Count;
+ UINTN Size;
+ UINTN NodeLength;
//
- //Validate the input whether exists and its size big enough to touch the first node
+ // Validate the input whether exists and its size big enough to touch the first node
//
- if (DevicePath == NULL || (MaxSize > 0 && MaxSize < END_DEVICE_PATH_LENGTH)) {
+ if ((DevicePath == NULL) || ((MaxSize > 0) && (MaxSize < END_DEVICE_PATH_LENGTH))) {
return FALSE;
}
@@ -74,6 +74,7 @@ IsDevicePathValid (
if (NodeLength > MAX_UINTN - Size) {
return FALSE;
}
+
Size += NodeLength;
//
@@ -93,9 +94,10 @@ IsDevicePathValid (
//
// FilePath must be a NULL-terminated string.
//
- if (DevicePathType (DevicePath) == MEDIA_DEVICE_PATH &&
- DevicePathSubType (DevicePath) == MEDIA_FILEPATH_DP &&
- *(CHAR16 *)((UINT8 *)DevicePath + NodeLength - 2) != 0) {
+ if ((DevicePathType (DevicePath) == MEDIA_DEVICE_PATH) &&
+ (DevicePathSubType (DevicePath) == MEDIA_FILEPATH_DP) &&
+ (*(CHAR16 *)((UINT8 *)DevicePath + NodeLength - 2) != 0))
+ {
return FALSE;
}
}
@@ -103,10 +105,9 @@ IsDevicePathValid (
//
// Only return TRUE when the End Device Path node is valid.
//
- return (BOOLEAN) (DevicePathNodeLength (DevicePath) == END_DEVICE_PATH_LENGTH);
+ return (BOOLEAN)(DevicePathNodeLength (DevicePath) == END_DEVICE_PATH_LENGTH);
}
-
/**
Returns the Type field of a device path node.
@@ -197,7 +198,7 @@ NextDevicePathNode (
)
{
ASSERT (Node != NULL);
- return (EFI_DEVICE_PATH_PROTOCOL *)((UINT8 *)(Node) + DevicePathNodeLength(Node));
+ return (EFI_DEVICE_PATH_PROTOCOL *)((UINT8 *)(Node) + DevicePathNodeLength (Node));
}
/**
@@ -227,7 +228,7 @@ IsDevicePathEndType (
)
{
ASSERT (Node != NULL);
- return (BOOLEAN) (DevicePathType (Node) == END_DEVICE_PATH_TYPE);
+ return (BOOLEAN)(DevicePathType (Node) == END_DEVICE_PATH_TYPE);
}
/**
@@ -254,7 +255,7 @@ IsDevicePathEnd (
)
{
ASSERT (Node != NULL);
- return (BOOLEAN) (IsDevicePathEndType (Node) && DevicePathSubType(Node) == END_ENTIRE_DEVICE_PATH_SUBTYPE);
+ return (BOOLEAN)(IsDevicePathEndType (Node) && DevicePathSubType (Node) == END_ENTIRE_DEVICE_PATH_SUBTYPE);
}
/**
@@ -281,7 +282,7 @@ IsDevicePathEndInstance (
)
{
ASSERT (Node != NULL);
- return (BOOLEAN) (IsDevicePathEndType (Node) && DevicePathSubType(Node) == END_INSTANCE_DEVICE_PATH_SUBTYPE);
+ return (BOOLEAN)(IsDevicePathEndType (Node) && DevicePathSubType (Node) == END_INSTANCE_DEVICE_PATH_SUBTYPE);
}
/**
@@ -380,7 +381,7 @@ UefiDevicePathLibGetDevicePathSize (
//
// Compute the size and add back in the size of the end device path structure
//
- return ((UINTN) DevicePath - (UINTN) Start) + DevicePathNodeLength (DevicePath);
+ return ((UINTN)DevicePath - (UINTN)Start) + DevicePathNodeLength (DevicePath);
}
/**
@@ -405,7 +406,7 @@ UefiDevicePathLibDuplicateDevicePath (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
- UINTN Size;
+ UINTN Size;
//
// Compute the size
@@ -478,9 +479,9 @@ UefiDevicePathLibAppendDevicePath (
// Allocate space for the combined device path. It only has one end node of
// length EFI_DEVICE_PATH_PROTOCOL.
//
- Size1 = GetDevicePathSize (FirstDevicePath);
- Size2 = GetDevicePathSize (SecondDevicePath);
- Size = Size1 + Size2 - END_DEVICE_PATH_LENGTH;
+ Size1 = GetDevicePathSize (FirstDevicePath);
+ Size2 = GetDevicePathSize (SecondDevicePath);
+ Size = Size1 + Size2 - END_DEVICE_PATH_LENGTH;
NewDevicePath = AllocatePool (Size);
@@ -489,8 +490,8 @@ UefiDevicePathLibAppendDevicePath (
//
// Over write FirstDevicePath EndNode and do the copy
//
- DevicePath2 = (EFI_DEVICE_PATH_PROTOCOL *) ((CHAR8 *) NewDevicePath +
- (Size1 - END_DEVICE_PATH_LENGTH));
+ DevicePath2 = (EFI_DEVICE_PATH_PROTOCOL *)((CHAR8 *)NewDevicePath +
+ (Size1 - END_DEVICE_PATH_LENGTH));
CopyMem (DevicePath2, SecondDevicePath, Size2);
}
@@ -540,6 +541,7 @@ UefiDevicePathLibAppendDevicePathNode (
if (DevicePathNode == NULL) {
return DuplicateDevicePath ((DevicePath != NULL) ? DevicePath : &mUefiDevicePathLibEndDevicePath);
}
+
//
// Build a Node that has a terminator on it
//
@@ -549,6 +551,7 @@ UefiDevicePathLibAppendDevicePathNode (
if (TempDevicePath == NULL) {
return NULL;
}
+
TempDevicePath = CopyMem (TempDevicePath, DevicePathNode, NodeLength);
//
// Add and end device path node to convert Node to device path
@@ -612,20 +615,19 @@ UefiDevicePathLibAppendDevicePathInstance (
return NULL;
}
- SrcSize = GetDevicePathSize (DevicePath);
- InstanceSize = GetDevicePathSize (DevicePathInstance);
+ SrcSize = GetDevicePathSize (DevicePath);
+ InstanceSize = GetDevicePathSize (DevicePathInstance);
NewDevicePath = AllocatePool (SrcSize + InstanceSize);
if (NewDevicePath != NULL) {
-
- TempDevicePath = CopyMem (NewDevicePath, DevicePath, SrcSize);;
+ TempDevicePath = CopyMem (NewDevicePath, DevicePath, SrcSize);
while (!IsDevicePathEnd (TempDevicePath)) {
TempDevicePath = NextDevicePathNode (TempDevicePath);
}
- TempDevicePath->SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE;
- TempDevicePath = NextDevicePathNode (TempDevicePath);
+ TempDevicePath->SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE;
+ TempDevicePath = NextDevicePathNode (TempDevicePath);
CopyMem (TempDevicePath, DevicePathInstance, InstanceSize);
}
@@ -663,8 +665,8 @@ UefiDevicePathLibAppendDevicePathInstance (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
UefiDevicePathLibGetNextDevicePathInstance (
- IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
- OUT UINTN *Size
+ IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
+ OUT UINTN *Size
)
{
EFI_DEVICE_PATH_PROTOCOL *DevPath;
@@ -673,7 +675,7 @@ UefiDevicePathLibGetNextDevicePathInstance (
ASSERT (Size != NULL);
- if (DevicePath == NULL || *DevicePath == NULL) {
+ if ((DevicePath == NULL) || (*DevicePath == NULL)) {
*Size = 0;
return NULL;
}
@@ -693,15 +695,15 @@ UefiDevicePathLibGetNextDevicePathInstance (
//
// Compute the size of the device path instance
//
- *Size = ((UINTN) DevPath - (UINTN) (*DevicePath)) + sizeof (EFI_DEVICE_PATH_PROTOCOL);
+ *Size = ((UINTN)DevPath - (UINTN)(*DevicePath)) + sizeof (EFI_DEVICE_PATH_PROTOCOL);
//
// Make a copy and return the device path instance
//
- Temp = DevPath->SubType;
- DevPath->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE;
- ReturnValue = DuplicateDevicePath (*DevicePath);
- DevPath->SubType = Temp;
+ Temp = DevPath->SubType;
+ DevPath->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE;
+ ReturnValue = DuplicateDevicePath (*DevicePath);
+ DevPath->SubType = Temp;
//
// If DevPath is the end of an entire device path, then another instance
@@ -738,12 +740,12 @@ UefiDevicePathLibGetNextDevicePathInstance (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
UefiDevicePathLibCreateDeviceNode (
- IN UINT8 NodeType,
- IN UINT8 NodeSubType,
- IN UINT16 NodeLength
+ IN UINT8 NodeType,
+ IN UINT8 NodeSubType,
+ IN UINT16 NodeLength
)
{
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
if (NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {
//
@@ -754,9 +756,9 @@ UefiDevicePathLibCreateDeviceNode (
DevicePath = AllocateZeroPool (NodeLength);
if (DevicePath != NULL) {
- DevicePath->Type = NodeType;
- DevicePath->SubType = NodeSubType;
- SetDevicePathNodeLength (DevicePath, NodeLength);
+ DevicePath->Type = NodeType;
+ DevicePath->SubType = NodeSubType;
+ SetDevicePathNodeLength (DevicePath, NodeLength);
}
return DevicePath;
@@ -783,7 +785,7 @@ UefiDevicePathLibIsDevicePathMultiInstance (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
- CONST EFI_DEVICE_PATH_PROTOCOL *Node;
+ CONST EFI_DEVICE_PATH_PROTOCOL *Node;
if (DevicePath == NULL) {
return FALSE;
@@ -805,7 +807,6 @@ UefiDevicePathLibIsDevicePathMultiInstance (
return FALSE;
}
-
/**
Allocates a device path for a file and appends it to an existing device path.
@@ -830,8 +831,8 @@ UefiDevicePathLibIsDevicePathMultiInstance (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
FileDevicePath (
- IN EFI_HANDLE Device OPTIONAL,
- IN CONST CHAR16 *FileName
+ IN EFI_HANDLE Device OPTIONAL,
+ IN CONST CHAR16 *FileName
)
{
UINTN Size;
@@ -841,10 +842,10 @@ FileDevicePath (
DevicePath = NULL;
- Size = StrSize (FileName);
+ Size = StrSize (FileName);
FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + END_DEVICE_PATH_LENGTH);
if (FileDevicePath != NULL) {
- FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePath;
+ FilePath = (FILEPATH_DEVICE_PATH *)FileDevicePath;
FilePath->Header.Type = MEDIA_DEVICE_PATH;
FilePath->Header.SubType = MEDIA_FILEPATH_DP;
CopyMem (&FilePath->PathName, FileName, Size);
diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesDxeSmm.c b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesDxeSmm.c
index 7f3b6076ef..ddd139567e 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesDxeSmm.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesDxeSmm.c
@@ -16,7 +16,6 @@
#include "UefiDevicePathLib.h"
-
/**
Retrieves the device path protocol from a handle.
@@ -33,7 +32,7 @@
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
DevicePathFromHandle (
- IN EFI_HANDLE Handle
+ IN EFI_HANDLE Handle
)
{
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
@@ -42,10 +41,11 @@ DevicePathFromHandle (
Status = gBS->HandleProtocol (
Handle,
&gEfiDevicePathProtocolGuid,
- (VOID *) &DevicePath
+ (VOID *)&DevicePath
);
if (EFI_ERROR (Status)) {
DevicePath = NULL;
}
+
return DevicePath;
}
diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesStandaloneMm.c b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesStandaloneMm.c
index 930e778d37..096f835b90 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesStandaloneMm.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesStandaloneMm.c
@@ -16,7 +16,6 @@
#include "UefiDevicePathLib.h"
-
/**
Retrieves the device path protocol from a handle.
@@ -33,7 +32,7 @@
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
DevicePathFromHandle (
- IN EFI_HANDLE Handle
+ IN EFI_HANDLE Handle
)
{
return NULL;
diff --git a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c
index af4b219387..a67d1cb30c 100644
--- a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c
+++ b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c
@@ -13,7 +13,6 @@
**/
-
#include "UefiDevicePathLib.h"
/**
@@ -199,8 +198,8 @@ AppendDevicePathInstance (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
GetNextDevicePathInstance (
- IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
- OUT UINTN *Size
+ IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
+ OUT UINTN *Size
)
{
return UefiDevicePathLibGetNextDevicePathInstance (DevicePath, Size);
@@ -228,9 +227,9 @@ GetNextDevicePathInstance (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
CreateDeviceNode (
- IN UINT8 NodeType,
- IN UINT8 NodeSubType,
- IN UINT16 NodeLength
+ IN UINT8 NodeType,
+ IN UINT8 NodeSubType,
+ IN UINT16 NodeLength
)
{
return UefiDevicePathLibCreateDeviceNode (NodeType, NodeSubType, NodeLength);
@@ -304,9 +303,9 @@ ConvertDeviceNodeToText (
CHAR16 *
EFIAPI
ConvertDevicePathToText (
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ IN BOOLEAN DisplayOnly,
+ IN BOOLEAN AllowShortcuts
)
{
return UefiDevicePathLibConvertDevicePathToText (DevicePath, DisplayOnly, AllowShortcuts);
@@ -326,7 +325,7 @@ ConvertDevicePathToText (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
ConvertTextToDeviceNode (
- IN CONST CHAR16 *TextDeviceNode
+ IN CONST CHAR16 *TextDeviceNode
)
{
return UefiDevicePathLibConvertTextToDeviceNode (TextDeviceNode);
@@ -347,7 +346,7 @@ ConvertTextToDeviceNode (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
ConvertTextToDevicePath (
- IN CONST CHAR16 *TextDevicePath
+ IN CONST CHAR16 *TextDevicePath
)
{
return UefiDevicePathLibConvertTextToDevicePath (TextDevicePath);
diff --git a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.h b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.h
index 04b2375000..8f759f18fa 100644
--- a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.h
+++ b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.h
@@ -24,28 +24,27 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/PcdLib.h>
#include <IndustryStandard/Bluetooth.h>
-#define IS_COMMA(a) ((a) == L',')
-#define IS_HYPHEN(a) ((a) == L'-')
-#define IS_DOT(a) ((a) == L'.')
-#define IS_LEFT_PARENTH(a) ((a) == L'(')
-#define IS_RIGHT_PARENTH(a) ((a) == L')')
-#define IS_SLASH(a) ((a) == L'/')
-#define IS_NULL(a) ((a) == L'\0')
-
+#define IS_COMMA(a) ((a) == L',')
+#define IS_HYPHEN(a) ((a) == L'-')
+#define IS_DOT(a) ((a) == L'.')
+#define IS_LEFT_PARENTH(a) ((a) == L'(')
+#define IS_RIGHT_PARENTH(a) ((a) == L')')
+#define IS_SLASH(a) ((a) == L'/')
+#define IS_NULL(a) ((a) == L'\0')
//
// Private Data structure
//
typedef struct {
- CHAR16 *Str;
- UINTN Count;
- UINTN Capacity;
+ CHAR16 *Str;
+ UINTN Count;
+ UINTN Capacity;
} POOL_PRINT;
typedef
EFI_DEVICE_PATH_PROTOCOL *
(*DEVICE_PATH_FROM_TEXT) (
- IN CHAR16 *Str
+ IN CHAR16 *Str
);
typedef
@@ -58,90 +57,90 @@ VOID
);
typedef struct {
- UINT8 Type;
- UINT8 SubType;
- DEVICE_PATH_TO_TEXT Function;
+ UINT8 Type;
+ UINT8 SubType;
+ DEVICE_PATH_TO_TEXT Function;
} DEVICE_PATH_TO_TEXT_TABLE;
typedef struct {
- UINT8 Type;
- CHAR16 *Text;
+ UINT8 Type;
+ CHAR16 *Text;
} DEVICE_PATH_TO_TEXT_GENERIC_TABLE;
typedef struct {
- CHAR16 *DevicePathNodeText;
- DEVICE_PATH_FROM_TEXT Function;
+ CHAR16 *DevicePathNodeText;
+ DEVICE_PATH_FROM_TEXT Function;
} DEVICE_PATH_FROM_TEXT_TABLE;
typedef struct {
- BOOLEAN ClassExist;
- UINT8 Class;
- BOOLEAN SubClassExist;
- UINT8 SubClass;
+ BOOLEAN ClassExist;
+ UINT8 Class;
+ BOOLEAN SubClassExist;
+ UINT8 SubClass;
} USB_CLASS_TEXT;
-#define USB_CLASS_AUDIO 1
-#define USB_CLASS_CDCCONTROL 2
-#define USB_CLASS_HID 3
-#define USB_CLASS_IMAGE 6
-#define USB_CLASS_PRINTER 7
-#define USB_CLASS_MASS_STORAGE 8
-#define USB_CLASS_HUB 9
-#define USB_CLASS_CDCDATA 10
-#define USB_CLASS_SMART_CARD 11
-#define USB_CLASS_VIDEO 14
-#define USB_CLASS_DIAGNOSTIC 220
-#define USB_CLASS_WIRELESS 224
-
-#define USB_CLASS_RESERVE 254
-#define USB_SUBCLASS_FW_UPDATE 1
-#define USB_SUBCLASS_IRDA_BRIDGE 2
-#define USB_SUBCLASS_TEST 3
-
-#define RFC_1700_UDP_PROTOCOL 17
-#define RFC_1700_TCP_PROTOCOL 6
+#define USB_CLASS_AUDIO 1
+#define USB_CLASS_CDCCONTROL 2
+#define USB_CLASS_HID 3
+#define USB_CLASS_IMAGE 6
+#define USB_CLASS_PRINTER 7
+#define USB_CLASS_MASS_STORAGE 8
+#define USB_CLASS_HUB 9
+#define USB_CLASS_CDCDATA 10
+#define USB_CLASS_SMART_CARD 11
+#define USB_CLASS_VIDEO 14
+#define USB_CLASS_DIAGNOSTIC 220
+#define USB_CLASS_WIRELESS 224
+
+#define USB_CLASS_RESERVE 254
+#define USB_SUBCLASS_FW_UPDATE 1
+#define USB_SUBCLASS_IRDA_BRIDGE 2
+#define USB_SUBCLASS_TEST 3
+
+#define RFC_1700_UDP_PROTOCOL 17
+#define RFC_1700_TCP_PROTOCOL 6
#pragma pack(1)
typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- EFI_GUID Guid;
- UINT8 VendorDefinedData[1];
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ EFI_GUID Guid;
+ UINT8 VendorDefinedData[1];
} VENDOR_DEFINED_HARDWARE_DEVICE_PATH;
typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- EFI_GUID Guid;
- UINT8 VendorDefinedData[1];
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ EFI_GUID Guid;
+ UINT8 VendorDefinedData[1];
} VENDOR_DEFINED_MESSAGING_DEVICE_PATH;
typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- EFI_GUID Guid;
- UINT8 VendorDefinedData[1];
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ EFI_GUID Guid;
+ UINT8 VendorDefinedData[1];
} VENDOR_DEFINED_MEDIA_DEVICE_PATH;
typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- UINT32 Hid;
- UINT32 Uid;
- UINT32 Cid;
- CHAR8 HidUidCidStr[3];
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ UINT32 Hid;
+ UINT32 Uid;
+ UINT32 Cid;
+ CHAR8 HidUidCidStr[3];
} ACPI_EXTENDED_HID_DEVICE_PATH_WITH_STR;
typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- UINT16 NetworkProtocol;
- UINT16 LoginOption;
- UINT64 Lun;
- UINT16 TargetPortalGroupTag;
- CHAR8 TargetName[1];
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ UINT16 NetworkProtocol;
+ UINT16 LoginOption;
+ UINT64 Lun;
+ UINT16 TargetPortalGroupTag;
+ CHAR8 TargetName[1];
} ISCSI_DEVICE_PATH_WITH_NAME;
typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- EFI_GUID Guid;
- UINT8 VendorDefinedData[1];
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ EFI_GUID Guid;
+ UINT8 VendorDefinedData[1];
} VENDOR_DEVICE_PATH_WITH_DATA;
#pragma pack()
@@ -314,8 +313,8 @@ UefiDevicePathLibAppendDevicePathInstance (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
UefiDevicePathLibGetNextDevicePathInstance (
- IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
- OUT UINTN *Size
+ IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
+ OUT UINTN *Size
);
/**
@@ -340,9 +339,9 @@ UefiDevicePathLibGetNextDevicePathInstance (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
UefiDevicePathLibCreateDeviceNode (
- IN UINT8 NodeType,
- IN UINT8 NodeSubType,
- IN UINT16 NodeLength
+ IN UINT8 NodeType,
+ IN UINT8 NodeSubType,
+ IN UINT16 NodeLength
);
/**
@@ -366,7 +365,6 @@ UefiDevicePathLibIsDevicePathMultiInstance (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
-
/**
Converts a device path to its text representation.
@@ -385,9 +383,9 @@ UefiDevicePathLibIsDevicePathMultiInstance (
CHAR16 *
EFIAPI
UefiDevicePathLibConvertDevicePathToText (
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ IN BOOLEAN DisplayOnly,
+ IN BOOLEAN AllowShortcuts
);
/**
@@ -427,7 +425,7 @@ UefiDevicePathLibConvertDeviceNodeToText (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
UefiDevicePathLibConvertTextToDeviceNode (
- IN CONST CHAR16 *TextDeviceNode
+ IN CONST CHAR16 *TextDeviceNode
);
/**
@@ -445,7 +443,7 @@ UefiDevicePathLibConvertTextToDeviceNode (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
UefiDevicePathLibConvertTextToDevicePath (
- IN CONST CHAR16 *TextDevicePath
+ IN CONST CHAR16 *TextDevicePath
);
#endif
diff --git a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.c b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.c
index e1e629442a..dfe211205b 100644
--- a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.c
+++ b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.c
@@ -13,12 +13,11 @@
**/
-
#include "UefiDevicePathLib.h"
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_UTILITIES_PROTOCOL *mDevicePathLibDevicePathUtilities = NULL;
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *mDevicePathLibDevicePathToText = NULL;
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *mDevicePathLibDevicePathFromText = NULL;
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_UTILITIES_PROTOCOL *mDevicePathLibDevicePathUtilities = NULL;
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *mDevicePathLibDevicePathToText = NULL;
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *mDevicePathLibDevicePathFromText = NULL;
/**
The constructor function caches the pointer to DevicePathUtilites protocol,
@@ -37,16 +36,16 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *mDevicePathLib
EFI_STATUS
EFIAPI
UefiDevicePathLibOptionalDevicePathProtocolConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
Status = gBS->LocateProtocol (
&gEfiDevicePathUtilitiesProtocolGuid,
NULL,
- (VOID**) &mDevicePathLibDevicePathUtilities
+ (VOID **)&mDevicePathLibDevicePathUtilities
);
ASSERT_EFI_ERROR (Status);
ASSERT (mDevicePathLibDevicePathUtilities != NULL);
@@ -256,8 +255,8 @@ AppendDevicePathInstance (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
GetNextDevicePathInstance (
- IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
- OUT UINTN *Size
+ IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
+ OUT UINTN *Size
)
{
if (mDevicePathLibDevicePathUtilities != NULL) {
@@ -289,9 +288,9 @@ GetNextDevicePathInstance (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
CreateDeviceNode (
- IN UINT8 NodeType,
- IN UINT8 NodeSubType,
- IN UINT16 NodeLength
+ IN UINT8 NodeType,
+ IN UINT8 NodeSubType,
+ IN UINT16 NodeLength
)
{
if (mDevicePathLibDevicePathUtilities != NULL) {
@@ -338,15 +337,16 @@ IsDevicePathMultiInstance (
**/
VOID *
UefiDevicePathLibLocateProtocol (
- EFI_GUID *ProtocolGuid
+ EFI_GUID *ProtocolGuid
)
{
- EFI_STATUS Status;
- VOID *Protocol;
+ EFI_STATUS Status;
+ VOID *Protocol;
+
Status = gBS->LocateProtocol (
ProtocolGuid,
NULL,
- (VOID**) &Protocol
+ (VOID **)&Protocol
);
if (EFI_ERROR (Status)) {
return NULL;
@@ -381,6 +381,7 @@ ConvertDeviceNodeToText (
if (mDevicePathLibDevicePathToText == NULL) {
mDevicePathLibDevicePathToText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathToTextProtocolGuid);
}
+
if (mDevicePathLibDevicePathToText != NULL) {
return mDevicePathLibDevicePathToText->ConvertDeviceNodeToText (DeviceNode, DisplayOnly, AllowShortcuts);
}
@@ -406,14 +407,15 @@ ConvertDeviceNodeToText (
CHAR16 *
EFIAPI
ConvertDevicePathToText (
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ IN BOOLEAN DisplayOnly,
+ IN BOOLEAN AllowShortcuts
)
{
if (mDevicePathLibDevicePathToText == NULL) {
mDevicePathLibDevicePathToText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathToTextProtocolGuid);
}
+
if (mDevicePathLibDevicePathToText != NULL) {
return mDevicePathLibDevicePathToText->ConvertDevicePathToText (DevicePath, DisplayOnly, AllowShortcuts);
}
@@ -435,12 +437,13 @@ ConvertDevicePathToText (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
ConvertTextToDeviceNode (
- IN CONST CHAR16 *TextDeviceNode
+ IN CONST CHAR16 *TextDeviceNode
)
{
if (mDevicePathLibDevicePathFromText == NULL) {
mDevicePathLibDevicePathFromText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathFromTextProtocolGuid);
}
+
if (mDevicePathLibDevicePathFromText != NULL) {
return mDevicePathLibDevicePathFromText->ConvertTextToDeviceNode (TextDeviceNode);
}
@@ -463,12 +466,13 @@ ConvertTextToDeviceNode (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
ConvertTextToDevicePath (
- IN CONST CHAR16 *TextDevicePath
+ IN CONST CHAR16 *TextDevicePath
)
{
if (mDevicePathLibDevicePathFromText == NULL) {
mDevicePathLibDevicePathFromText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathFromTextProtocolGuid);
}
+
if (mDevicePathLibDevicePathFromText != NULL) {
return mDevicePathLibDevicePathFromText->ConvertTextToDevicePath (TextDevicePath);
}
diff --git a/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c b/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c
index 8fdd9490b5..4ff9308a68 100644
--- a/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c
+++ b/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c
@@ -7,7 +7,6 @@
**/
-
#include <Uefi.h>
#include <Protocol/DevicePathUtilities.h>
@@ -22,9 +21,9 @@
#include <Library/UefiBootServicesTableLib.h>
#include <Library/PcdLib.h>
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_UTILITIES_PROTOCOL *mDevicePathLibDevicePathUtilities = NULL;
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *mDevicePathLibDevicePathToText = NULL;
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *mDevicePathLibDevicePathFromText = NULL;
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_UTILITIES_PROTOCOL *mDevicePathLibDevicePathUtilities = NULL;
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *mDevicePathLibDevicePathToText = NULL;
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *mDevicePathLibDevicePathFromText = NULL;
//
// Template for an end-of-device path node.
@@ -53,16 +52,16 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_PROTOCOL mUefiDevicePathLib
EFI_STATUS
EFIAPI
DevicePathLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
Status = gBS->LocateProtocol (
&gEfiDevicePathUtilitiesProtocolGuid,
NULL,
- (VOID**) &mDevicePathLibDevicePathUtilities
+ (VOID **)&mDevicePathLibDevicePathUtilities
);
ASSERT_EFI_ERROR (Status);
ASSERT (mDevicePathLibDevicePathUtilities != NULL);
@@ -87,13 +86,13 @@ DevicePathLibConstructor (
BOOLEAN
EFIAPI
IsDevicePathValid (
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN UINTN MaxSize
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ IN UINTN MaxSize
)
{
- UINTN Count;
- UINTN Size;
- UINTN NodeLength;
+ UINTN Count;
+ UINTN Size;
+ UINTN NodeLength;
ASSERT (DevicePath != NULL);
@@ -117,6 +116,7 @@ IsDevicePathValid (
if (NodeLength > MAX_UINTN - Size) {
return FALSE;
}
+
Size += NodeLength;
//
@@ -136,9 +136,10 @@ IsDevicePathValid (
//
// FilePath must be a NULL-terminated string.
//
- if (DevicePathType (DevicePath) == MEDIA_DEVICE_PATH &&
- DevicePathSubType (DevicePath) == MEDIA_FILEPATH_DP &&
- *(CHAR16 *)((UINT8 *)DevicePath + NodeLength - 2) != 0) {
+ if ((DevicePathType (DevicePath) == MEDIA_DEVICE_PATH) &&
+ (DevicePathSubType (DevicePath) == MEDIA_FILEPATH_DP) &&
+ (*(CHAR16 *)((UINT8 *)DevicePath + NodeLength - 2) != 0))
+ {
return FALSE;
}
}
@@ -146,7 +147,7 @@ IsDevicePathValid (
//
// Only return TRUE when the End Device Path node is valid.
//
- return (BOOLEAN) (DevicePathNodeLength (DevicePath) == END_DEVICE_PATH_LENGTH);
+ return (BOOLEAN)(DevicePathNodeLength (DevicePath) == END_DEVICE_PATH_LENGTH);
}
/**
@@ -239,7 +240,7 @@ NextDevicePathNode (
)
{
ASSERT (Node != NULL);
- return (EFI_DEVICE_PATH_PROTOCOL *)((UINT8 *)(Node) + DevicePathNodeLength(Node));
+ return (EFI_DEVICE_PATH_PROTOCOL *)((UINT8 *)(Node) + DevicePathNodeLength (Node));
}
/**
@@ -268,7 +269,7 @@ IsDevicePathEndType (
)
{
ASSERT (Node != NULL);
- return (BOOLEAN) (DevicePathType (Node) == END_DEVICE_PATH_TYPE);
+ return (BOOLEAN)(DevicePathType (Node) == END_DEVICE_PATH_TYPE);
}
/**
@@ -294,7 +295,7 @@ IsDevicePathEnd (
)
{
ASSERT (Node != NULL);
- return (BOOLEAN) (IsDevicePathEndType (Node) && DevicePathSubType(Node) == END_ENTIRE_DEVICE_PATH_SUBTYPE);
+ return (BOOLEAN)(IsDevicePathEndType (Node) && DevicePathSubType (Node) == END_ENTIRE_DEVICE_PATH_SUBTYPE);
}
/**
@@ -322,7 +323,7 @@ IsDevicePathEndInstance (
)
{
ASSERT (Node != NULL);
- return (BOOLEAN) (IsDevicePathEndType (Node) && DevicePathSubType(Node) == END_INSTANCE_DEVICE_PATH_SUBTYPE);
+ return (BOOLEAN)(IsDevicePathEndType (Node) && DevicePathSubType (Node) == END_INSTANCE_DEVICE_PATH_SUBTYPE);
}
/**
@@ -564,8 +565,8 @@ AppendDevicePathInstance (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
GetNextDevicePathInstance (
- IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
- OUT UINTN *Size
+ IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
+ OUT UINTN *Size
)
{
ASSERT (Size != NULL);
@@ -594,9 +595,9 @@ GetNextDevicePathInstance (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
CreateDeviceNode (
- IN UINT8 NodeType,
- IN UINT8 NodeSubType,
- IN UINT16 NodeLength
+ IN UINT8 NodeType,
+ IN UINT8 NodeSubType,
+ IN UINT16 NodeLength
)
{
return mDevicePathLibDevicePathUtilities->CreateDeviceNode (NodeType, NodeSubType, NodeLength);
@@ -642,7 +643,7 @@ IsDevicePathMultiInstance (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
DevicePathFromHandle (
- IN EFI_HANDLE Handle
+ IN EFI_HANDLE Handle
)
{
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
@@ -651,11 +652,12 @@ DevicePathFromHandle (
Status = gBS->HandleProtocol (
Handle,
&gEfiDevicePathProtocolGuid,
- (VOID *) &DevicePath
+ (VOID *)&DevicePath
);
if (EFI_ERROR (Status)) {
DevicePath = NULL;
}
+
return DevicePath;
}
@@ -684,8 +686,8 @@ DevicePathFromHandle (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
FileDevicePath (
- IN EFI_HANDLE Device OPTIONAL,
- IN CONST CHAR16 *FileName
+ IN EFI_HANDLE Device OPTIONAL,
+ IN CONST CHAR16 *FileName
)
{
UINTN Size;
@@ -695,10 +697,10 @@ FileDevicePath (
DevicePath = NULL;
- Size = StrSize (FileName);
+ Size = StrSize (FileName);
FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + END_DEVICE_PATH_LENGTH);
if (FileDevicePath != NULL) {
- FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePath;
+ FilePath = (FILEPATH_DEVICE_PATH *)FileDevicePath;
FilePath->Header.Type = MEDIA_DEVICE_PATH;
FilePath->Header.SubType = MEDIA_FILEPATH_DP;
CopyMem (&FilePath->PathName, FileName, Size);
@@ -725,15 +727,16 @@ FileDevicePath (
**/
VOID *
UefiDevicePathLibLocateProtocol (
- EFI_GUID *ProtocolGuid
+ EFI_GUID *ProtocolGuid
)
{
- EFI_STATUS Status;
- VOID *Protocol;
+ EFI_STATUS Status;
+ VOID *Protocol;
+
Status = gBS->LocateProtocol (
ProtocolGuid,
NULL,
- (VOID**) &Protocol
+ (VOID **)&Protocol
);
if (EFI_ERROR (Status)) {
return NULL;
@@ -768,6 +771,7 @@ ConvertDeviceNodeToText (
if (mDevicePathLibDevicePathToText == NULL) {
mDevicePathLibDevicePathToText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathToTextProtocolGuid);
}
+
if (mDevicePathLibDevicePathToText != NULL) {
return mDevicePathLibDevicePathToText->ConvertDeviceNodeToText (DeviceNode, DisplayOnly, AllowShortcuts);
} else {
@@ -793,14 +797,15 @@ ConvertDeviceNodeToText (
CHAR16 *
EFIAPI
ConvertDevicePathToText (
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ IN BOOLEAN DisplayOnly,
+ IN BOOLEAN AllowShortcuts
)
{
if (mDevicePathLibDevicePathToText == NULL) {
mDevicePathLibDevicePathToText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathToTextProtocolGuid);
}
+
if (mDevicePathLibDevicePathToText != NULL) {
return mDevicePathLibDevicePathToText->ConvertDevicePathToText (DevicePath, DisplayOnly, AllowShortcuts);
} else {
@@ -822,12 +827,13 @@ ConvertDevicePathToText (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
ConvertTextToDeviceNode (
- IN CONST CHAR16 *TextDeviceNode
+ IN CONST CHAR16 *TextDeviceNode
)
{
if (mDevicePathLibDevicePathFromText == NULL) {
mDevicePathLibDevicePathFromText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathFromTextProtocolGuid);
}
+
if (mDevicePathLibDevicePathFromText != NULL) {
return mDevicePathLibDevicePathFromText->ConvertTextToDeviceNode (TextDeviceNode);
} else {
@@ -850,12 +856,13 @@ ConvertTextToDeviceNode (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
ConvertTextToDevicePath (
- IN CONST CHAR16 *TextDevicePath
+ IN CONST CHAR16 *TextDevicePath
)
{
if (mDevicePathLibDevicePathFromText == NULL) {
mDevicePathLibDevicePathFromText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathFromTextProtocolGuid);
}
+
if (mDevicePathLibDevicePathFromText != NULL) {
return mDevicePathLibDevicePathFromText->ConvertTextToDevicePath (TextDevicePath);
} else {
diff --git a/MdePkg/Library/UefiDriverEntryPoint/DriverEntryPoint.c b/MdePkg/Library/UefiDriverEntryPoint/DriverEntryPoint.c
index c3ccf0fe9e..dc6445b8a5 100644
--- a/MdePkg/Library/UefiDriverEntryPoint/DriverEntryPoint.c
+++ b/MdePkg/Library/UefiDriverEntryPoint/DriverEntryPoint.c
@@ -6,8 +6,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-
-
#include <Uefi.h>
#include <Protocol/LoadedImage.h>
@@ -17,7 +15,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h>
-
/**
Unloads an image from memory.
@@ -32,7 +29,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
EFI_STATUS
EFIAPI
_DriverUnloadHandler (
- EFI_HANDLE ImageHandle
+ EFI_HANDLE ImageHandle
)
{
EFI_STATUS Status;
@@ -57,7 +54,6 @@ _DriverUnloadHandler (
return Status;
}
-
/**
The entry point of PE/COFF Image for a DXE Driver, DXE Runtime Driver, DXE SMM
Driver, or UEFI Driver.
@@ -139,7 +135,6 @@ _ModuleEntryPoint (
return Status;
}
-
/**
Required by the EBC compiler and identical in functionality to _ModuleEntryPoint().
diff --git a/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c b/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c
index ab34e6ccd5..86678e965d 100644
--- a/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c
+++ b/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c
@@ -21,10 +21,10 @@
#include <Library/PcdLib.h>
#include <Library/PrintLib.h>
-CONST UINT16 gUnicodeFileTag = EFI_UNICODE_BYTE_ORDER_MARK;
+CONST UINT16 gUnicodeFileTag = EFI_UNICODE_BYTE_ORDER_MARK;
-#define MAX_FILE_NAME_LEN 522 // (20 * (6+5+2))+1) unicode characters from EFI FAT spec (doubled for bytes)
-#define FIND_XXXXX_FILE_BUFFER_SIZE (SIZE_OF_EFI_FILE_INFO + MAX_FILE_NAME_LEN)
+#define MAX_FILE_NAME_LEN 522// (20 * (6+5+2))+1) unicode characters from EFI FAT spec (doubled for bytes)
+#define FIND_XXXXX_FILE_BUFFER_SIZE (SIZE_OF_EFI_FILE_INFO + MAX_FILE_NAME_LEN)
/**
This function will retrieve the information about the file for the handle
@@ -40,15 +40,15 @@ CONST UINT16 gUnicodeFileTag = EFI_UNICODE_BYTE_ORDER_MARK;
@return the information about the file
**/
-EFI_FILE_INFO*
+EFI_FILE_INFO *
EFIAPI
FileHandleGetInfo (
- IN EFI_FILE_HANDLE FileHandle
+ IN EFI_FILE_HANDLE FileHandle
)
{
- EFI_FILE_INFO *FileInfo;
- UINTN FileInfoSize;
- EFI_STATUS Status;
+ EFI_FILE_INFO *FileInfo;
+ UINTN FileInfoSize;
+ EFI_STATUS Status;
if (FileHandle == NULL) {
return (NULL);
@@ -58,33 +58,38 @@ FileHandleGetInfo (
// Get the required size to allocate
//
FileInfoSize = 0;
- FileInfo = NULL;
- Status = FileHandle->GetInfo(FileHandle,
+ FileInfo = NULL;
+ Status = FileHandle->GetInfo (
+ FileHandle,
&gEfiFileInfoGuid,
&FileInfoSize,
- NULL);
- if (Status == EFI_BUFFER_TOO_SMALL){
+ NULL
+ );
+ if (Status == EFI_BUFFER_TOO_SMALL) {
//
// error is expected. getting size to allocate
//
- FileInfo = AllocateZeroPool(FileInfoSize);
+ FileInfo = AllocateZeroPool (FileInfoSize);
if (FileInfo != NULL) {
//
// now get the information
//
- Status = FileHandle->GetInfo(FileHandle,
- &gEfiFileInfoGuid,
- &FileInfoSize,
- FileInfo);
+ Status = FileHandle->GetInfo (
+ FileHandle,
+ &gEfiFileInfoGuid,
+ &FileInfoSize,
+ FileInfo
+ );
//
// if we got an error free the memory and return NULL
//
- if (EFI_ERROR(Status)) {
- FreePool(FileInfo);
+ if (EFI_ERROR (Status)) {
+ FreePool (FileInfo);
FileInfo = NULL;
}
}
}
+
return (FileInfo);
}
@@ -110,22 +115,23 @@ FileHandleGetInfo (
EFI_STATUS
EFIAPI
FileHandleSetInfo (
- IN EFI_FILE_HANDLE FileHandle,
- IN CONST EFI_FILE_INFO *FileInfo
+ IN EFI_FILE_HANDLE FileHandle,
+ IN CONST EFI_FILE_INFO *FileInfo
)
{
-
- if (FileHandle == NULL || FileInfo == NULL) {
+ if ((FileHandle == NULL) || (FileInfo == NULL)) {
return (EFI_INVALID_PARAMETER);
}
//
// Set the info
//
- return (FileHandle->SetInfo(FileHandle,
- &gEfiFileInfoGuid,
- (UINTN)FileInfo->Size,
- (EFI_FILE_INFO*)FileInfo));
+ return (FileHandle->SetInfo (
+ FileHandle,
+ &gEfiFileInfoGuid,
+ (UINTN)FileInfo->Size,
+ (EFI_FILE_INFO *)FileInfo
+ ));
}
/**
@@ -159,10 +165,10 @@ FileHandleSetInfo (
**/
EFI_STATUS
EFIAPI
-FileHandleRead(
- IN EFI_FILE_HANDLE FileHandle,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
+FileHandleRead (
+ IN EFI_FILE_HANDLE FileHandle,
+ IN OUT UINTN *BufferSize,
+ OUT VOID *Buffer
)
{
if (FileHandle == NULL) {
@@ -172,10 +178,9 @@ FileHandleRead(
//
// Perform the read based on EFI_FILE_PROTOCOL
//
- return (FileHandle->Read(FileHandle, BufferSize, Buffer));
+ return (FileHandle->Read (FileHandle, BufferSize, Buffer));
}
-
/**
Write data to a file.
@@ -202,10 +207,10 @@ FileHandleRead(
**/
EFI_STATUS
EFIAPI
-FileHandleWrite(
- IN EFI_FILE_HANDLE FileHandle,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
+FileHandleWrite (
+ IN EFI_FILE_HANDLE FileHandle,
+ IN OUT UINTN *BufferSize,
+ IN VOID *Buffer
)
{
if (FileHandle == NULL) {
@@ -215,7 +220,7 @@ FileHandleWrite(
//
// Perform the write based on EFI_FILE_PROTOCOL
//
- return (FileHandle->Write(FileHandle, BufferSize, Buffer));
+ return (FileHandle->Write (FileHandle, BufferSize, Buffer));
}
/**
@@ -232,10 +237,10 @@ FileHandleWrite(
EFI_STATUS
EFIAPI
FileHandleClose (
- IN EFI_FILE_HANDLE FileHandle
+ IN EFI_FILE_HANDLE FileHandle
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
if (FileHandle == NULL) {
return (EFI_INVALID_PARAMETER);
@@ -244,7 +249,7 @@ FileHandleClose (
//
// Perform the Close based on EFI_FILE_PROTOCOL
//
- Status = FileHandle->Close(FileHandle);
+ Status = FileHandle->Close (FileHandle);
return Status;
}
@@ -265,10 +270,10 @@ FileHandleClose (
EFI_STATUS
EFIAPI
FileHandleDelete (
- IN EFI_FILE_HANDLE FileHandle
+ IN EFI_FILE_HANDLE FileHandle
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
if (FileHandle == NULL) {
return (EFI_INVALID_PARAMETER);
@@ -277,7 +282,7 @@ FileHandleDelete (
//
// Perform the Delete based on EFI_FILE_PROTOCOL
//
- Status = FileHandle->Delete(FileHandle);
+ Status = FileHandle->Delete (FileHandle);
return Status;
}
@@ -303,8 +308,8 @@ FileHandleDelete (
EFI_STATUS
EFIAPI
FileHandleSetPosition (
- IN EFI_FILE_HANDLE FileHandle,
- IN UINT64 Position
+ IN EFI_FILE_HANDLE FileHandle,
+ IN UINT64 Position
)
{
if (FileHandle == NULL) {
@@ -314,7 +319,7 @@ FileHandleSetPosition (
//
// Perform the SetPosition based on EFI_FILE_PROTOCOL
//
- return (FileHandle->SetPosition(FileHandle, Position));
+ return (FileHandle->SetPosition (FileHandle, Position));
}
/**
@@ -335,19 +340,20 @@ FileHandleSetPosition (
EFI_STATUS
EFIAPI
FileHandleGetPosition (
- IN EFI_FILE_HANDLE FileHandle,
- OUT UINT64 *Position
+ IN EFI_FILE_HANDLE FileHandle,
+ OUT UINT64 *Position
)
{
- if (Position == NULL || FileHandle == NULL) {
+ if ((Position == NULL) || (FileHandle == NULL)) {
return (EFI_INVALID_PARAMETER);
}
//
// Perform the GetPosition based on EFI_FILE_PROTOCOL
//
- return (FileHandle->GetPosition(FileHandle, Position));
+ return (FileHandle->GetPosition (FileHandle, Position));
}
+
/**
Flushes data on a file
@@ -365,7 +371,7 @@ FileHandleGetPosition (
EFI_STATUS
EFIAPI
FileHandleFlush (
- IN EFI_FILE_HANDLE FileHandle
+ IN EFI_FILE_HANDLE FileHandle
)
{
if (FileHandle == NULL) {
@@ -375,7 +381,7 @@ FileHandleFlush (
//
// Perform the Flush based on EFI_FILE_PROTOCOL
//
- return (FileHandle->Flush(FileHandle));
+ return (FileHandle->Flush (FileHandle));
}
/**
@@ -394,10 +400,10 @@ FileHandleFlush (
EFI_STATUS
EFIAPI
FileHandleIsDirectory (
- IN EFI_FILE_HANDLE DirHandle
+ IN EFI_FILE_HANDLE DirHandle
)
{
- EFI_FILE_INFO *DirInfo;
+ EFI_FILE_INFO *DirInfo;
if (DirHandle == NULL) {
return (EFI_INVALID_PARAMETER);
@@ -417,6 +423,7 @@ FileHandleIsDirectory (
//
return (EFI_INVALID_PARAMETER);
}
+
if ((DirInfo->Attribute & EFI_FILE_DIRECTORY) == 0) {
//
// Attributes say this is not a directory
@@ -424,6 +431,7 @@ FileHandleIsDirectory (
FreePool (DirInfo);
return (EFI_NOT_FOUND);
}
+
//
// all good...
//
@@ -456,22 +464,22 @@ FileHandleIsDirectory (
EFI_STATUS
EFIAPI
FileHandleFindFirstFile (
- IN EFI_FILE_HANDLE DirHandle,
- OUT EFI_FILE_INFO **Buffer
+ IN EFI_FILE_HANDLE DirHandle,
+ OUT EFI_FILE_INFO **Buffer
)
{
- EFI_STATUS Status;
- UINTN BufferSize;
+ EFI_STATUS Status;
+ UINTN BufferSize;
- if (Buffer == NULL || DirHandle == NULL) {
+ if ((Buffer == NULL) || (DirHandle == NULL)) {
return (EFI_INVALID_PARAMETER);
}
//
// verify that DirHandle is a directory
//
- Status = FileHandleIsDirectory(DirHandle);
- if (EFI_ERROR(Status)) {
+ Status = FileHandleIsDirectory (DirHandle);
+ if (EFI_ERROR (Status)) {
return (Status);
}
@@ -479,17 +487,17 @@ FileHandleFindFirstFile (
// Allocate a buffer sized to struct size + enough for the string at the end
//
BufferSize = FIND_XXXXX_FILE_BUFFER_SIZE;
- *Buffer = AllocateZeroPool(BufferSize);
- if (*Buffer == NULL){
+ *Buffer = AllocateZeroPool (BufferSize);
+ if (*Buffer == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
//
// reset to the beginning of the directory
//
- Status = FileHandleSetPosition(DirHandle, 0);
- if (EFI_ERROR(Status)) {
- FreePool(*Buffer);
+ Status = FileHandleSetPosition (DirHandle, 0);
+ if (EFI_ERROR (Status)) {
+ FreePool (*Buffer);
*Buffer = NULL;
return (Status);
}
@@ -498,15 +506,17 @@ FileHandleFindFirstFile (
// read in the info about the first file
//
Status = FileHandleRead (DirHandle, &BufferSize, *Buffer);
- ASSERT(Status != EFI_BUFFER_TOO_SMALL);
- if (EFI_ERROR(Status) || BufferSize == 0) {
- FreePool(*Buffer);
+ ASSERT (Status != EFI_BUFFER_TOO_SMALL);
+ if (EFI_ERROR (Status) || (BufferSize == 0)) {
+ FreePool (*Buffer);
*Buffer = NULL;
if (BufferSize == 0) {
return (EFI_NOT_FOUND);
}
+
return (Status);
}
+
return (EFI_SUCCESS);
}
@@ -530,16 +540,16 @@ FileHandleFindFirstFile (
**/
EFI_STATUS
EFIAPI
-FileHandleFindNextFile(
- IN EFI_FILE_HANDLE DirHandle,
- OUT EFI_FILE_INFO *Buffer,
- OUT BOOLEAN *NoFile
+FileHandleFindNextFile (
+ IN EFI_FILE_HANDLE DirHandle,
+ OUT EFI_FILE_INFO *Buffer,
+ OUT BOOLEAN *NoFile
)
{
- EFI_STATUS Status;
- UINTN BufferSize;
+ EFI_STATUS Status;
+ UINTN BufferSize;
- if (DirHandle == NULL || Buffer == NULL || NoFile == NULL) {
+ if ((DirHandle == NULL) || (Buffer == NULL) || (NoFile == NULL)) {
return (EFI_INVALID_PARAMETER);
}
@@ -552,8 +562,8 @@ FileHandleFindNextFile(
// read in the info about the next file
//
Status = FileHandleRead (DirHandle, &BufferSize, Buffer);
- ASSERT(Status != EFI_BUFFER_TOO_SMALL);
- if (EFI_ERROR(Status)) {
+ ASSERT (Status != EFI_BUFFER_TOO_SMALL);
+ if (EFI_ERROR (Status)) {
return (Status);
}
@@ -561,7 +571,7 @@ FileHandleFindNextFile(
// If we read 0 bytes (but did not have erros) we already read in the last file.
//
if (BufferSize == 0) {
- FreePool(Buffer);
+ FreePool (Buffer);
*NoFile = TRUE;
}
@@ -585,20 +595,20 @@ FileHandleFindNextFile(
EFI_STATUS
EFIAPI
FileHandleGetSize (
- IN EFI_FILE_HANDLE FileHandle,
- OUT UINT64 *Size
+ IN EFI_FILE_HANDLE FileHandle,
+ OUT UINT64 *Size
)
{
- EFI_FILE_INFO *FileInfo;
+ EFI_FILE_INFO *FileInfo;
- if (FileHandle == NULL || Size == NULL) {
+ if ((FileHandle == NULL) || (Size == NULL)) {
return (EFI_INVALID_PARAMETER);
}
//
// get the FileInfo structure
//
- FileInfo = FileHandleGetInfo(FileHandle);
+ FileInfo = FileHandleGetInfo (FileHandle);
if (FileInfo == NULL) {
return (EFI_DEVICE_ERROR);
}
@@ -611,7 +621,7 @@ FileHandleGetSize (
//
// free the FileInfo memory
//
- FreePool(FileInfo);
+ FreePool (FileInfo);
return (EFI_SUCCESS);
}
@@ -632,12 +642,12 @@ FileHandleGetSize (
EFI_STATUS
EFIAPI
FileHandleSetSize (
- IN EFI_FILE_HANDLE FileHandle,
- IN UINT64 Size
+ IN EFI_FILE_HANDLE FileHandle,
+ IN UINT64 Size
)
{
- EFI_FILE_INFO *FileInfo;
- EFI_STATUS Status;
+ EFI_FILE_INFO *FileInfo;
+ EFI_STATUS Status;
if (FileHandle == NULL) {
return (EFI_INVALID_PARAMETER);
@@ -646,7 +656,7 @@ FileHandleSetSize (
//
// get the FileInfo structure
//
- FileInfo = FileHandleGetInfo(FileHandle);
+ FileInfo = FileHandleGetInfo (FileHandle);
if (FileInfo == NULL) {
return (EFI_DEVICE_ERROR);
}
@@ -656,11 +666,11 @@ FileHandleSetSize (
//
FileInfo->FileSize = Size;
- Status = FileHandleSetInfo(FileHandle, FileInfo);
+ Status = FileHandleSetInfo (FileHandle, FileInfo);
//
// free the FileInfo memory
//
- FreePool(FileInfo);
+ FreePool (FileInfo);
return (Status);
}
@@ -697,18 +707,18 @@ FileHandleSetSize (
@return Destination return the resultant string.
**/
-CHAR16*
+CHAR16 *
EFIAPI
StrnCatGrowLeft (
- IN OUT CHAR16 **Destination,
- IN OUT UINTN *CurrentSize,
- IN CONST CHAR16 *Source,
- IN UINTN Count
+ IN OUT CHAR16 **Destination,
+ IN OUT UINTN *CurrentSize,
+ IN CONST CHAR16 *Source,
+ IN UINTN Count
)
{
- UINTN DestinationStartSize;
- UINTN NewSize;
- UINTN CopySize;
+ UINTN DestinationStartSize;
+ UINTN NewSize;
+ UINTN CopySize;
if (Destination == NULL) {
return (NULL);
@@ -725,19 +735,19 @@ StrnCatGrowLeft (
// allow for NULL pointers address as Destination
//
if (*Destination != NULL) {
- ASSERT(CurrentSize != 0);
- DestinationStartSize = StrSize(*Destination);
- ASSERT(DestinationStartSize <= *CurrentSize);
+ ASSERT (CurrentSize != 0);
+ DestinationStartSize = StrSize (*Destination);
+ ASSERT (DestinationStartSize <= *CurrentSize);
} else {
DestinationStartSize = 0;
-// ASSERT(*CurrentSize == 0);
+ // ASSERT(*CurrentSize == 0);
}
//
// Append all of Source?
//
if (Count == 0) {
- Count = StrSize(Source);
+ Count = StrSize (Source);
}
//
@@ -748,18 +758,20 @@ StrnCatGrowLeft (
while (NewSize < (DestinationStartSize + Count)) {
NewSize += 2 * Count;
}
- *Destination = ReallocatePool(*CurrentSize, NewSize, *Destination);
+
+ *Destination = ReallocatePool (*CurrentSize, NewSize, *Destination);
*CurrentSize = NewSize;
} else {
- *Destination = AllocateZeroPool(Count+sizeof(CHAR16));
+ *Destination = AllocateZeroPool (Count+sizeof (CHAR16));
}
+
if (*Destination == NULL) {
return NULL;
}
- CopySize = StrSize(*Destination);
- CopyMem((*Destination)+((Count-2)/sizeof(CHAR16)), *Destination, CopySize);
- CopyMem(*Destination, Source, Count-2);
+ CopySize = StrSize (*Destination);
+ CopyMem ((*Destination)+((Count-2)/sizeof (CHAR16)), *Destination, CopySize);
+ CopyMem (*Destination, Source, Count-2);
return (*Destination);
}
@@ -783,35 +795,35 @@ StrnCatGrowLeft (
EFI_STATUS
EFIAPI
FileHandleGetFileName (
- IN CONST EFI_FILE_HANDLE Handle,
- OUT CHAR16 **FullFileName
+ IN CONST EFI_FILE_HANDLE Handle,
+ OUT CHAR16 **FullFileName
)
{
- EFI_STATUS Status;
- UINTN Size;
- EFI_FILE_HANDLE CurrentHandle;
- EFI_FILE_HANDLE NextHigherHandle;
- EFI_FILE_INFO *FileInfo;
+ EFI_STATUS Status;
+ UINTN Size;
+ EFI_FILE_HANDLE CurrentHandle;
+ EFI_FILE_HANDLE NextHigherHandle;
+ EFI_FILE_INFO *FileInfo;
Size = 0;
//
// Check our parameters
//
- if (FullFileName == NULL || Handle == NULL) {
+ if ((FullFileName == NULL) || (Handle == NULL)) {
return (EFI_INVALID_PARAMETER);
}
*FullFileName = NULL;
CurrentHandle = NULL;
- Status = Handle->Open(Handle, &CurrentHandle, L".", EFI_FILE_MODE_READ, 0);
- if (!EFI_ERROR(Status)) {
+ Status = Handle->Open (Handle, &CurrentHandle, L".", EFI_FILE_MODE_READ, 0);
+ if (!EFI_ERROR (Status)) {
//
// Reverse out the current directory on the device
//
- for (;;) {
- FileInfo = FileHandleGetInfo(CurrentHandle);
+ for ( ; ;) {
+ FileInfo = FileHandleGetInfo (CurrentHandle);
if (FileInfo == NULL) {
Status = EFI_OUT_OF_RESOURCES;
break;
@@ -836,24 +848,26 @@ FileHandleGetFileName (
//
Status = EFI_SUCCESS;
if (*FullFileName == NULL) {
- ASSERT((*FullFileName == NULL && Size == 0) || (*FullFileName != NULL));
- *FullFileName = StrnCatGrowLeft(FullFileName, &Size, L"\\", 0);
+ ASSERT ((*FullFileName == NULL && Size == 0) || (*FullFileName != NULL));
+ *FullFileName = StrnCatGrowLeft (FullFileName, &Size, L"\\", 0);
}
- FreePool(FileInfo);
+
+ FreePool (FileInfo);
break;
} else {
if (*FullFileName == NULL) {
- ASSERT((*FullFileName == NULL && Size == 0) || (*FullFileName != NULL));
- *FullFileName = StrnCatGrowLeft(FullFileName, &Size, L"\\", 0);
+ ASSERT ((*FullFileName == NULL && Size == 0) || (*FullFileName != NULL));
+ *FullFileName = StrnCatGrowLeft (FullFileName, &Size, L"\\", 0);
}
- ASSERT((*FullFileName == NULL && Size == 0) || (*FullFileName != NULL));
- *FullFileName = StrnCatGrowLeft(FullFileName, &Size, FileInfo->FileName, 0);
- *FullFileName = StrnCatGrowLeft(FullFileName, &Size, L"\\", 0);
- FreePool(FileInfo);
+
+ ASSERT ((*FullFileName == NULL && Size == 0) || (*FullFileName != NULL));
+ *FullFileName = StrnCatGrowLeft (FullFileName, &Size, FileInfo->FileName, 0);
+ *FullFileName = StrnCatGrowLeft (FullFileName, &Size, L"\\", 0);
+ FreePool (FileInfo);
}
}
- FileHandleClose(CurrentHandle);
+ FileHandleClose (CurrentHandle);
//
// Move to the parent directory
//
@@ -861,24 +875,25 @@ FileHandleGetFileName (
}
} else if (Status == EFI_NOT_FOUND) {
Status = EFI_SUCCESS;
- ASSERT((*FullFileName == NULL && Size == 0) || (*FullFileName != NULL));
- *FullFileName = StrnCatGrowLeft(FullFileName, &Size, L"\\", 0);
+ ASSERT ((*FullFileName == NULL && Size == 0) || (*FullFileName != NULL));
+ *FullFileName = StrnCatGrowLeft (FullFileName, &Size, L"\\", 0);
}
- if (*FullFileName != NULL &&
- (*FullFileName)[StrLen(*FullFileName) - 1] == L'\\' &&
- StrLen(*FullFileName) > 1 &&
- FileHandleIsDirectory(Handle) == EFI_NOT_FOUND
- ) {
- (*FullFileName)[StrLen(*FullFileName) - 1] = CHAR_NULL;
+ if ((*FullFileName != NULL) &&
+ ((*FullFileName)[StrLen (*FullFileName) - 1] == L'\\') &&
+ (StrLen (*FullFileName) > 1) &&
+ (FileHandleIsDirectory (Handle) == EFI_NOT_FOUND)
+ )
+ {
+ (*FullFileName)[StrLen (*FullFileName) - 1] = CHAR_NULL;
}
if (CurrentHandle != NULL) {
CurrentHandle->Close (CurrentHandle);
}
- if (EFI_ERROR(Status) && *FullFileName != NULL) {
- FreePool(*FullFileName);
+ if (EFI_ERROR (Status) && (*FullFileName != NULL)) {
+ FreePool (*FullFileName);
}
return (Status);
@@ -898,30 +913,32 @@ FileHandleGetFileName (
@sa FileHandleReadLine
**/
-CHAR16*
+CHAR16 *
EFIAPI
-FileHandleReturnLine(
- IN EFI_FILE_HANDLE Handle,
- IN OUT BOOLEAN *Ascii
+FileHandleReturnLine (
+ IN EFI_FILE_HANDLE Handle,
+ IN OUT BOOLEAN *Ascii
)
{
- CHAR16 *RetVal;
- UINTN Size;
- EFI_STATUS Status;
+ CHAR16 *RetVal;
+ UINTN Size;
+ EFI_STATUS Status;
- Size = 0;
+ Size = 0;
RetVal = NULL;
- Status = FileHandleReadLine(Handle, RetVal, &Size, FALSE, Ascii);
+ Status = FileHandleReadLine (Handle, RetVal, &Size, FALSE, Ascii);
if (Status == EFI_BUFFER_TOO_SMALL) {
- RetVal = AllocateZeroPool(Size);
- Status = FileHandleReadLine(Handle, RetVal, &Size, FALSE, Ascii);
+ RetVal = AllocateZeroPool (Size);
+ Status = FileHandleReadLine (Handle, RetVal, &Size, FALSE, Ascii);
}
- ASSERT_EFI_ERROR(Status);
- if (EFI_ERROR(Status) && (RetVal != NULL)) {
- FreePool(RetVal);
+
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status) && (RetVal != NULL)) {
+ FreePool (RetVal);
RetVal = NULL;
}
+
return (RetVal);
}
@@ -955,12 +972,12 @@ FileHandleReturnLine(
**/
EFI_STATUS
EFIAPI
-FileHandleReadLine(
- IN EFI_FILE_HANDLE Handle,
- IN OUT CHAR16 *Buffer,
- IN OUT UINTN *Size,
- IN BOOLEAN Truncate,
- IN OUT BOOLEAN *Ascii
+FileHandleReadLine (
+ IN EFI_FILE_HANDLE Handle,
+ IN OUT CHAR16 *Buffer,
+ IN OUT UINTN *Size,
+ IN BOOLEAN Truncate,
+ IN OUT BOOLEAN *Ascii
)
{
EFI_STATUS Status;
@@ -972,14 +989,15 @@ FileHandleReadLine(
UINTN OldSize;
UINT64 OriginalFilePosition;
- if (Handle == NULL
- ||Size == NULL
- ||(Buffer==NULL&&*Size!=0)
- ){
+ if ( (Handle == NULL)
+ || (Size == NULL)
+ || ((Buffer == NULL) && (*Size != 0))
+ )
+ {
return (EFI_INVALID_PARAMETER);
}
- if (Buffer != NULL && *Size != 0) {
+ if ((Buffer != NULL) && (*Size != 0)) {
*Buffer = CHAR_NULL;
}
@@ -991,65 +1009,70 @@ FileHandleReadLine(
return EFI_SUCCESS;
}
- FileHandleGetPosition(Handle, &OriginalFilePosition);
+ FileHandleGetPosition (Handle, &OriginalFilePosition);
if (OriginalFilePosition == 0) {
- CharSize = sizeof(CHAR16);
- Status = FileHandleRead(Handle, &CharSize, &CharBuffer);
- ASSERT_EFI_ERROR(Status);
+ CharSize = sizeof (CHAR16);
+ Status = FileHandleRead (Handle, &CharSize, &CharBuffer);
+ ASSERT_EFI_ERROR (Status);
if (CharBuffer == gUnicodeFileTag) {
*Ascii = FALSE;
} else {
*Ascii = TRUE;
- FileHandleSetPosition(Handle, OriginalFilePosition);
+ FileHandleSetPosition (Handle, OriginalFilePosition);
}
}
CrCount = 0;
- for (CountSoFar = 0;;CountSoFar++){
+ for (CountSoFar = 0; ; CountSoFar++) {
CharBuffer = 0;
if (*Ascii) {
- CharSize = sizeof(CHAR8);
+ CharSize = sizeof (CHAR8);
} else {
- CharSize = sizeof(CHAR16);
+ CharSize = sizeof (CHAR16);
}
- Status = FileHandleRead(Handle, &CharSize, &CharBuffer);
- if ( EFI_ERROR(Status)
- || CharSize == 0
- || (CharBuffer == L'\n' && !(*Ascii))
- || (CharBuffer == '\n' && *Ascii)
- ){
+
+ Status = FileHandleRead (Handle, &CharSize, &CharBuffer);
+ if ( EFI_ERROR (Status)
+ || (CharSize == 0)
+ || ((CharBuffer == L'\n') && !(*Ascii))
+ || ((CharBuffer == '\n') && *Ascii)
+ )
+ {
break;
} else if (
- (CharBuffer == L'\r' && !(*Ascii)) ||
- (CharBuffer == '\r' && *Ascii)
- ) {
+ ((CharBuffer == L'\r') && !(*Ascii)) ||
+ ((CharBuffer == '\r') && *Ascii)
+ )
+ {
CrCount++;
continue;
}
+
//
// if we have space save it...
//
- if ((CountSoFar+1-CrCount)*sizeof(CHAR16) < *Size){
- ASSERT(Buffer != NULL);
- ((CHAR16*)Buffer)[CountSoFar-CrCount] = CharBuffer;
- ((CHAR16*)Buffer)[CountSoFar+1-CrCount] = CHAR_NULL;
+ if ((CountSoFar+1-CrCount)*sizeof (CHAR16) < *Size) {
+ ASSERT (Buffer != NULL);
+ ((CHAR16 *)Buffer)[CountSoFar-CrCount] = CharBuffer;
+ ((CHAR16 *)Buffer)[CountSoFar+1-CrCount] = CHAR_NULL;
}
}
//
// if we ran out of space tell when...
//
- if ((CountSoFar+1-CrCount)*sizeof(CHAR16) > *Size){
+ if ((CountSoFar+1-CrCount)*sizeof (CHAR16) > *Size) {
OldSize = *Size;
- *Size = (CountSoFar+1-CrCount)*sizeof(CHAR16);
+ *Size = (CountSoFar+1-CrCount)*sizeof (CHAR16);
if (!Truncate) {
- if (Buffer != NULL && OldSize != 0) {
- ZeroMem(Buffer, OldSize);
+ if ((Buffer != NULL) && (OldSize != 0)) {
+ ZeroMem (Buffer, OldSize);
}
- FileHandleSetPosition(Handle, OriginalFilePosition);
+
+ FileHandleSetPosition (Handle, OriginalFilePosition);
return (EFI_BUFFER_TOO_SMALL);
} else {
- DEBUG((DEBUG_WARN, "The line was truncated in FileHandleReadLine"));
+ DEBUG ((DEBUG_WARN, "The line was truncated in FileHandleReadLine"));
return (EFI_SUCCESS);
}
}
@@ -1080,9 +1103,9 @@ FileHandleReadLine(
**/
EFI_STATUS
EFIAPI
-FileHandleWriteLine(
- IN EFI_FILE_HANDLE Handle,
- IN CHAR16 *Buffer
+FileHandleWriteLine (
+ IN EFI_FILE_HANDLE Handle,
+ IN CHAR16 *Buffer
)
{
EFI_STATUS Status;
@@ -1103,21 +1126,21 @@ FileHandleWriteLine(
return (EFI_INVALID_PARAMETER);
}
- Ascii = FALSE;
+ Ascii = FALSE;
AsciiBuffer = NULL;
- Status = FileHandleGetPosition(Handle, &OriginalFilePosition);
- if (EFI_ERROR(Status)) {
+ Status = FileHandleGetPosition (Handle, &OriginalFilePosition);
+ if (EFI_ERROR (Status)) {
return Status;
}
- Status = FileHandleSetPosition(Handle, 0);
- if (EFI_ERROR(Status)) {
+ Status = FileHandleSetPosition (Handle, 0);
+ if (EFI_ERROR (Status)) {
return Status;
}
- Status = FileHandleGetSize(Handle, &FileSize);
- if (EFI_ERROR(Status)) {
+ Status = FileHandleGetSize (Handle, &FileSize);
+ if (EFI_ERROR (Status)) {
return Status;
}
@@ -1125,7 +1148,7 @@ FileHandleWriteLine(
Ascii = TRUE;
} else {
CharSize = sizeof (CHAR16);
- Status = FileHandleRead (Handle, &CharSize, &CharBuffer);
+ Status = FileHandleRead (Handle, &CharSize, &CharBuffer);
ASSERT_EFI_ERROR (Status);
if (CharBuffer == gUnicodeFileTag) {
Ascii = FALSE;
@@ -1134,52 +1157,57 @@ FileHandleWriteLine(
}
}
- Status = FileHandleSetPosition(Handle, OriginalFilePosition);
- if (EFI_ERROR(Status)) {
+ Status = FileHandleSetPosition (Handle, OriginalFilePosition);
+ if (EFI_ERROR (Status)) {
return Status;
}
if (Ascii) {
- Size = ( StrSize(Buffer) / sizeof(CHAR16) ) * sizeof(CHAR8);
- AsciiBuffer = (CHAR8 *)AllocateZeroPool(Size);
+ Size = (StrSize (Buffer) / sizeof (CHAR16)) * sizeof (CHAR8);
+ AsciiBuffer = (CHAR8 *)AllocateZeroPool (Size);
if (AsciiBuffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
UnicodeStrToAsciiStrS (Buffer, AsciiBuffer, Size);
for (Index = 0; Index < Size; Index++) {
if ((AsciiBuffer[Index] & BIT7) != 0) {
- FreePool(AsciiBuffer);
+ FreePool (AsciiBuffer);
return EFI_INVALID_PARAMETER;
}
}
- Size = AsciiStrSize(AsciiBuffer) - sizeof(CHAR8);
- Status = FileHandleWrite(Handle, &Size, AsciiBuffer);
- if (EFI_ERROR(Status)) {
+ Size = AsciiStrSize (AsciiBuffer) - sizeof (CHAR8);
+ Status = FileHandleWrite (Handle, &Size, AsciiBuffer);
+ if (EFI_ERROR (Status)) {
FreePool (AsciiBuffer);
return (Status);
}
- Size = AsciiStrSize("\r\n") - sizeof(CHAR8);
- Status = FileHandleWrite(Handle, &Size, "\r\n");
+
+ Size = AsciiStrSize ("\r\n") - sizeof (CHAR8);
+ Status = FileHandleWrite (Handle, &Size, "\r\n");
} else {
if (OriginalFilePosition == 0) {
- Status = FileHandleSetPosition (Handle, sizeof(CHAR16));
- if (EFI_ERROR(Status)) {
+ Status = FileHandleSetPosition (Handle, sizeof (CHAR16));
+ if (EFI_ERROR (Status)) {
return Status;
}
}
- Size = StrSize(Buffer) - sizeof(CHAR16);
- Status = FileHandleWrite(Handle, &Size, Buffer);
- if (EFI_ERROR(Status)) {
+
+ Size = StrSize (Buffer) - sizeof (CHAR16);
+ Status = FileHandleWrite (Handle, &Size, Buffer);
+ if (EFI_ERROR (Status)) {
return (Status);
}
- Size = StrSize(L"\r\n") - sizeof(CHAR16);
- Status = FileHandleWrite(Handle, &Size, L"\r\n");
+
+ Size = StrSize (L"\r\n") - sizeof (CHAR16);
+ Status = FileHandleWrite (Handle, &Size, L"\r\n");
}
if (AsciiBuffer != NULL) {
FreePool (AsciiBuffer);
}
+
return Status;
}
@@ -1197,15 +1225,15 @@ FileHandleWriteLine(
**/
EFI_STATUS
EFIAPI
-FileHandlePrintLine(
+FileHandlePrintLine (
IN EFI_FILE_HANDLE Handle,
IN CONST CHAR16 *Format,
...
)
{
- VA_LIST Marker;
- CHAR16 *Buffer;
- EFI_STATUS Status;
+ VA_LIST Marker;
+ CHAR16 *Buffer;
+ EFI_STATUS Status;
//
// Get a buffer to print into
@@ -1225,12 +1253,12 @@ FileHandlePrintLine(
//
// Print buffer into file
//
- Status = FileHandleWriteLine(Handle, Buffer);
+ Status = FileHandleWriteLine (Handle, Buffer);
//
// Cleanup and return
//
- FreePool(Buffer);
+ FreePool (Buffer);
return (Status);
}
@@ -1248,26 +1276,26 @@ FileHandlePrintLine(
**/
BOOLEAN
EFIAPI
-FileHandleEof(
- IN EFI_FILE_HANDLE Handle
+FileHandleEof (
+ IN EFI_FILE_HANDLE Handle
)
{
- EFI_FILE_INFO *Info;
- UINT64 Pos;
- BOOLEAN RetVal;
+ EFI_FILE_INFO *Info;
+ UINT64 Pos;
+ BOOLEAN RetVal;
if (Handle == NULL) {
return (FALSE);
}
- FileHandleGetPosition(Handle, &Pos);
+ FileHandleGetPosition (Handle, &Pos);
Info = FileHandleGetInfo (Handle);
if (Info == NULL) {
return (FALSE);
}
- FileHandleSetPosition(Handle, Pos);
+ FileHandleSetPosition (Handle, Pos);
if (Pos == Info->FileSize) {
RetVal = TRUE;
diff --git a/MdePkg/Library/UefiLib/Acpi.c b/MdePkg/Library/UefiLib/Acpi.c
index d4f7fc8aa8..397fde24ed 100644
--- a/MdePkg/Library/UefiLib/Acpi.c
+++ b/MdePkg/Library/UefiLib/Acpi.c
@@ -30,18 +30,18 @@
**/
EFI_ACPI_COMMON_HEADER *
ScanTableInSDT (
- IN EFI_ACPI_DESCRIPTION_HEADER *Sdt,
- IN UINTN TablePointerSize,
- IN UINT32 Signature,
- IN EFI_ACPI_COMMON_HEADER *PreviousTable OPTIONAL,
- OUT BOOLEAN *PreviousTableLocated OPTIONAL
+ IN EFI_ACPI_DESCRIPTION_HEADER *Sdt,
+ IN UINTN TablePointerSize,
+ IN UINT32 Signature,
+ IN EFI_ACPI_COMMON_HEADER *PreviousTable OPTIONAL,
+ OUT BOOLEAN *PreviousTableLocated OPTIONAL
)
{
- UINTN Index;
- UINTN EntryCount;
- UINT64 EntryPtr;
- UINTN BasePtr;
- EFI_ACPI_COMMON_HEADER *Table;
+ UINTN Index;
+ UINTN EntryCount;
+ UINT64 EntryPtr;
+ UINTN BasePtr;
+ EFI_ACPI_COMMON_HEADER *Table;
if (PreviousTableLocated != NULL) {
ASSERT (PreviousTable != NULL);
@@ -57,7 +57,7 @@ ScanTableInSDT (
EntryCount = (Sdt->Length - sizeof (EFI_ACPI_DESCRIPTION_HEADER)) / TablePointerSize;
BasePtr = (UINTN)(Sdt + 1);
- for (Index = 0; Index < EntryCount; Index ++) {
+ for (Index = 0; Index < EntryCount; Index++) {
EntryPtr = 0;
CopyMem (&EntryPtr, (VOID *)(BasePtr + Index * TablePointerSize), TablePointerSize);
Table = (EFI_ACPI_COMMON_HEADER *)((UINTN)(EntryPtr));
@@ -77,7 +77,6 @@ ScanTableInSDT (
//
return Table;
}
-
}
}
@@ -97,8 +96,8 @@ LocateAcpiFacsFromFadt (
IN EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt
)
{
- EFI_ACPI_COMMON_HEADER *Facs;
- UINT64 Data64;
+ EFI_ACPI_COMMON_HEADER *Facs;
+ UINT64 Data64;
if (Fadt == NULL) {
return NULL;
@@ -107,13 +106,14 @@ LocateAcpiFacsFromFadt (
if (Fadt->Header.Revision < EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION) {
Facs = (EFI_ACPI_COMMON_HEADER *)(UINTN)Fadt->FirmwareCtrl;
} else {
- CopyMem (&Data64, &Fadt->XFirmwareCtrl, sizeof(UINT64));
+ CopyMem (&Data64, &Fadt->XFirmwareCtrl, sizeof (UINT64));
if (Data64 != 0) {
Facs = (EFI_ACPI_COMMON_HEADER *)(UINTN)Data64;
} else {
Facs = (EFI_ACPI_COMMON_HEADER *)(UINTN)Fadt->FirmwareCtrl;
}
}
+
return Facs;
}
@@ -130,8 +130,8 @@ LocateAcpiDsdtFromFadt (
IN EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt
)
{
- EFI_ACPI_COMMON_HEADER *Dsdt;
- UINT64 Data64;
+ EFI_ACPI_COMMON_HEADER *Dsdt;
+ UINT64 Data64;
if (Fadt == NULL) {
return NULL;
@@ -140,13 +140,14 @@ LocateAcpiDsdtFromFadt (
if (Fadt->Header.Revision < EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION) {
Dsdt = (EFI_ACPI_COMMON_HEADER *)(UINTN)Fadt->Dsdt;
} else {
- CopyMem (&Data64, &Fadt->XDsdt, sizeof(UINT64));
+ CopyMem (&Data64, &Fadt->XDsdt, sizeof (UINT64));
if (Data64 != 0) {
Dsdt = (EFI_ACPI_COMMON_HEADER *)(UINTN)Data64;
} else {
Dsdt = (EFI_ACPI_COMMON_HEADER *)(UINTN)Fadt->Dsdt;
}
}
+
return Dsdt;
}
@@ -170,10 +171,10 @@ LocateAcpiDsdtFromFadt (
**/
EFI_ACPI_COMMON_HEADER *
LocateAcpiTableInAcpiConfigurationTable (
- IN EFI_GUID *AcpiGuid,
- IN UINT32 Signature,
- IN EFI_ACPI_COMMON_HEADER *PreviousTable OPTIONAL,
- OUT BOOLEAN *PreviousTableLocated OPTIONAL
+ IN EFI_GUID *AcpiGuid,
+ IN UINT32 Signature,
+ IN EFI_ACPI_COMMON_HEADER *PreviousTable OPTIONAL,
+ OUT BOOLEAN *PreviousTableLocated OPTIONAL
)
{
EFI_STATUS Status;
@@ -194,7 +195,7 @@ LocateAcpiTableInAcpiConfigurationTable (
//
// Get ACPI ConfigurationTable (RSD_PTR)
//
- Status = EfiGetSystemConfigurationTable(AcpiGuid, (VOID **)&Rsdp);
+ Status = EfiGetSystemConfigurationTable (AcpiGuid, (VOID **)&Rsdp);
if (EFI_ERROR (Status) || (Rsdp == NULL)) {
return NULL;
}
@@ -205,20 +206,20 @@ LocateAcpiTableInAcpiConfigurationTable (
// Search XSDT
//
if (Rsdp->Revision >= EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION) {
- Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN) Rsdp->XsdtAddress;
+ Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)Rsdp->XsdtAddress;
if (Signature == EFI_ACPI_2_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE) {
ASSERT (PreviousTable == NULL);
//
// It is to locate DSDT,
// need to locate FADT first.
//
- Fadt = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *) ScanTableInSDT (
- Xsdt,
- sizeof (UINT64),
- EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
- NULL,
- NULL
- );
+ Fadt = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *)ScanTableInSDT (
+ Xsdt,
+ sizeof (UINT64),
+ EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
+ NULL,
+ NULL
+ );
Table = LocateAcpiDsdtFromFadt (Fadt);
} else if (Signature == EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) {
ASSERT (PreviousTable == NULL);
@@ -226,13 +227,13 @@ LocateAcpiTableInAcpiConfigurationTable (
// It is to locate FACS,
// need to locate FADT first.
//
- Fadt = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *) ScanTableInSDT (
- Xsdt,
- sizeof (UINT64),
- EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
- NULL,
- NULL
- );
+ Fadt = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *)ScanTableInSDT (
+ Xsdt,
+ sizeof (UINT64),
+ EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
+ NULL,
+ NULL
+ );
Table = LocateAcpiFacsFromFadt (Fadt);
} else {
Table = ScanTableInSDT (
@@ -248,7 +249,8 @@ LocateAcpiTableInAcpiConfigurationTable (
if (Table != NULL) {
return Table;
} else if ((PreviousTableLocated != NULL) &&
- *PreviousTableLocated) {
+ *PreviousTableLocated)
+ {
//
// PreviousTable could be located in XSDT,
// but next table could not be located in XSDT.
@@ -259,20 +261,20 @@ LocateAcpiTableInAcpiConfigurationTable (
//
// Search RSDT
//
- Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN) Rsdp->RsdtAddress;
+ Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)Rsdp->RsdtAddress;
if (Signature == EFI_ACPI_2_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE) {
ASSERT (PreviousTable == NULL);
//
// It is to locate DSDT,
// need to locate FADT first.
//
- Fadt = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *) ScanTableInSDT (
- Rsdt,
- sizeof (UINT32),
- EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
- NULL,
- NULL
- );
+ Fadt = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *)ScanTableInSDT (
+ Rsdt,
+ sizeof (UINT32),
+ EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
+ NULL,
+ NULL
+ );
Table = LocateAcpiDsdtFromFadt (Fadt);
} else if (Signature == EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) {
ASSERT (PreviousTable == NULL);
@@ -280,13 +282,13 @@ LocateAcpiTableInAcpiConfigurationTable (
// It is to locate FACS,
// need to locate FADT first.
//
- Fadt = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *) ScanTableInSDT (
- Rsdt,
- sizeof (UINT32),
- EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
- NULL,
- NULL
- );
+ Fadt = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *)ScanTableInSDT (
+ Rsdt,
+ sizeof (UINT32),
+ EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
+ NULL,
+ NULL
+ );
Table = LocateAcpiFacsFromFadt (Fadt);
} else {
Table = ScanTableInSDT (
@@ -339,13 +341,13 @@ LocateAcpiTableInAcpiConfigurationTable (
EFI_ACPI_COMMON_HEADER *
EFIAPI
EfiLocateNextAcpiTable (
- IN UINT32 Signature,
- IN EFI_ACPI_COMMON_HEADER *PreviousTable OPTIONAL
+ IN UINT32 Signature,
+ IN EFI_ACPI_COMMON_HEADER *PreviousTable OPTIONAL
)
{
- EFI_ACPI_COMMON_HEADER *Table;
- BOOLEAN TempPreviousTableLocated;
- BOOLEAN *PreviousTableLocated;
+ EFI_ACPI_COMMON_HEADER *Table;
+ BOOLEAN TempPreviousTableLocated;
+ BOOLEAN *PreviousTableLocated;
if (PreviousTable != NULL) {
if (PreviousTable->Signature != Signature) {
@@ -355,7 +357,8 @@ EfiLocateNextAcpiTable (
return NULL;
} else if ((Signature == EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) ||
(Signature == EFI_ACPI_2_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE) ||
- (Signature == EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE)) {
+ (Signature == EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE))
+ {
//
// There is only one FADT/DSDT/FACS table,
// so don't try to locate next one.
@@ -363,7 +366,7 @@ EfiLocateNextAcpiTable (
return NULL;
}
- PreviousTableLocated = &TempPreviousTableLocated;
+ PreviousTableLocated = &TempPreviousTableLocated;
*PreviousTableLocated = FALSE;
} else {
PreviousTableLocated = NULL;
@@ -378,7 +381,8 @@ EfiLocateNextAcpiTable (
if (Table != NULL) {
return Table;
} else if ((PreviousTableLocated != NULL) &&
- *PreviousTableLocated) {
+ *PreviousTableLocated)
+ {
//
// PreviousTable could be located in gEfiAcpi20TableGuid system
// configuration table, but next table could not be located in
@@ -415,7 +419,7 @@ EfiLocateNextAcpiTable (
EFI_ACPI_COMMON_HEADER *
EFIAPI
EfiLocateFirstAcpiTable (
- IN UINT32 Signature
+ IN UINT32 Signature
)
{
return EfiLocateNextAcpiTable (Signature, NULL);
diff --git a/MdePkg/Library/UefiLib/Console.c b/MdePkg/Library/UefiLib/Console.c
index e5b04849d8..c37e3d0f58 100644
--- a/MdePkg/Library/UefiLib/Console.c
+++ b/MdePkg/Library/UefiLib/Console.c
@@ -6,24 +6,22 @@
**/
-
-
-
#include "UefiLibInternal.h"
typedef struct {
- CHAR16 WChar;
- UINT32 Width;
+ CHAR16 WChar;
+ UINT32 Width;
} UNICODE_WIDTH_ENTRY;
-#define NARROW_CHAR 0xFFF0
-#define WIDE_CHAR 0xFFF1
+#define NARROW_CHAR 0xFFF0
+#define WIDE_CHAR 0xFFF1
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UNICODE_WIDTH_ENTRY mUnicodeWidthTable[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UNICODE_WIDTH_ENTRY mUnicodeWidthTable[] = {
//
// General script area
//
- {(CHAR16)0x1FFF, 1},
+ { (CHAR16)0x1FFF, 1 },
+
/*
* Merge the blocks and replace them with the above entry as they fall to
* the same category and they are all narrow glyph. This will reduce search
@@ -70,7 +68,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UNICODE_WIDTH_ENTRY mUnicodeWidthTable[] = {
//
// Symbol area
//
- {(CHAR16)0x2FFF, 1},
+ { (CHAR16)0x2FFF, 1 },
+
/*
* Merge the blocks and replace them with the above entry as they fall to
* the same category and they are all narrow glyph. This will reduce search
@@ -102,7 +101,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UNICODE_WIDTH_ENTRY mUnicodeWidthTable[] = {
//
// CJK phonetics and symbol area
//
- {(CHAR16)0x33FF, 2},
+ { (CHAR16)0x33FF, 2 },
+
/*
* Merge the blocks and replace them with the above entry as they fall to
* the same category and they are all wide glyph. This will reduce search
@@ -125,7 +125,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UNICODE_WIDTH_ENTRY mUnicodeWidthTable[] = {
//
// CJK ideograph area
//
- {(CHAR16)0x9FFF, 2},
+ { (CHAR16)0x9FFF, 2 },
+
/*
* Merge the blocks and replace them with the above entry as they fall to
* the same category and they are all wide glyph. This will reduce search
@@ -142,12 +143,13 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UNICODE_WIDTH_ENTRY mUnicodeWidthTable[] = {
//
// Reserved
//
- {(CHAR16)0xABFF, 0}, // Reserved. 0xA000-0xA490 as Yi syllables. 0xA490-0xA4D0
+ { (CHAR16)0xABFF, 0 }, // Reserved. 0xA000-0xA490 as Yi syllables. 0xA490-0xA4D0
// as Yi radicals in ver3.0. 0xA000-0xABFF
//
// Hangul syllables
//
- {(CHAR16)0xD7FF, 2},
+ { (CHAR16)0xD7FF, 2 },
+
/*
* Merge the blocks and replace them with the above entry as they fall to
* the same category and they are all wide glyph. This will reduce search
@@ -163,26 +165,26 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UNICODE_WIDTH_ENTRY mUnicodeWidthTable[] = {
//
// Surrogates area
//
- {(CHAR16)0xDFFF, 0}, // Surrogates, not used now. 0xD800-0xDFFF
+ { (CHAR16)0xDFFF, 0 }, // Surrogates, not used now. 0xD800-0xDFFF
//
// Private use area
//
- {(CHAR16)0xF8FF, 0}, // Private use area. 0xE000-0xF8FF
+ { (CHAR16)0xF8FF, 0 }, // Private use area. 0xE000-0xF8FF
//
// Compatibility area and specials
//
- {(CHAR16)0xFAFF, 2}, // CJK compatibility ideographs. 0xF900-0xFAFF
- {(CHAR16)0xFB4F, 1}, // Alphabetic presentation forms. 0xFB00-0xFB4F
- {(CHAR16)0xFDFF, 1}, // Arabic presentation forms-A. 0xFB50-0xFDFF
- {(CHAR16)0xFE1F, 0}, // Reserved. As variation selectors in ver3.0. 0xFE00-0xFE1F
- {(CHAR16)0xFE2F, 1}, // Combining half marks. 0xFE20-0xFE2F
- {(CHAR16)0xFE4F, 2}, // CJK compatibility forms. 0xFE30-0xFE4F
- {(CHAR16)0xFE6F, 1}, // Small Form Variants. 0xFE50-0xFE6F
- {(CHAR16)0xFEFF, 1}, // Arabic presentation forms-B. 0xFE70-0xFEFF
- {(CHAR16)0xFFEF, 1}, // Half width and full width forms. 0xFF00-0xFFEF
- {(CHAR16)0xFFFF, 0}, // Speicials. 0xFFF0-0xFFFF
+ { (CHAR16)0xFAFF, 2 }, // CJK compatibility ideographs. 0xF900-0xFAFF
+ { (CHAR16)0xFB4F, 1 }, // Alphabetic presentation forms. 0xFB00-0xFB4F
+ { (CHAR16)0xFDFF, 1 }, // Arabic presentation forms-A. 0xFB50-0xFDFF
+ { (CHAR16)0xFE1F, 0 }, // Reserved. As variation selectors in ver3.0. 0xFE00-0xFE1F
+ { (CHAR16)0xFE2F, 1 }, // Combining half marks. 0xFE20-0xFE2F
+ { (CHAR16)0xFE4F, 2 }, // CJK compatibility forms. 0xFE30-0xFE4F
+ { (CHAR16)0xFE6F, 1 }, // Small Form Variants. 0xFE50-0xFE6F
+ { (CHAR16)0xFEFF, 1 }, // Arabic presentation forms-B. 0xFE70-0xFEFF
+ { (CHAR16)0xFFEF, 1 }, // Half width and full width forms. 0xFF00-0xFFEF
+ { (CHAR16)0xFFFF, 0 }, // Speicials. 0xFFF0-0xFFFF
};
/**
@@ -204,14 +206,14 @@ GetGlyphWidth (
IN CHAR16 UnicodeChar
)
{
- UINTN Index;
- UINTN Low;
- UINTN High;
- CONST UNICODE_WIDTH_ENTRY *Item;
-
- Item = NULL;
- Low = 0;
- High = (sizeof (mUnicodeWidthTable)) / (sizeof (UNICODE_WIDTH_ENTRY)) - 1;
+ UINTN Index;
+ UINTN Low;
+ UINTN High;
+ CONST UNICODE_WIDTH_ENTRY *Item;
+
+ Item = NULL;
+ Low = 0;
+ High = (sizeof (mUnicodeWidthTable)) / (sizeof (UNICODE_WIDTH_ENTRY)) - 1;
while (Low <= High) {
Index = (Low + High) >> 1;
Item = &(mUnicodeWidthTable[Index]);
@@ -264,8 +266,8 @@ UnicodeStringDisplayLength (
IN CONST CHAR16 *String
)
{
- UINTN Length;
- UINTN Width;
+ UINTN Length;
+ UINTN Width;
if (String == NULL) {
return 0;
@@ -304,32 +306,32 @@ UnicodeStringDisplayLength (
**/
UINTN
UefiLibGetStringWidth (
- IN CHAR16 *String,
- IN BOOLEAN LimitLen,
- IN UINTN MaxWidth,
- OUT UINTN *Offset
+ IN CHAR16 *String,
+ IN BOOLEAN LimitLen,
+ IN UINTN MaxWidth,
+ OUT UINTN *Offset
)
{
- UINTN Index;
- UINTN Count;
- UINTN IncrementValue;
+ UINTN Index;
+ UINTN Count;
+ UINTN IncrementValue;
if (String == NULL) {
return 0;
}
- Index = 0;
- Count = 0;
- IncrementValue = 1;
+ Index = 0;
+ Count = 0;
+ IncrementValue = 1;
do {
//
// Advance to the null-terminator or to the first width directive
//
- for (;(String[Index] != NARROW_CHAR) && (String[Index] != WIDE_CHAR) && (String[Index] != 0); Index++) {
+ for ( ; (String[Index] != NARROW_CHAR) && (String[Index] != WIDE_CHAR) && (String[Index] != 0); Index++) {
Count = Count + IncrementValue;
- if (LimitLen && Count > MaxWidth) {
+ if (LimitLen && (Count > MaxWidth)) {
break;
}
}
@@ -341,7 +343,7 @@ UefiLibGetStringWidth (
break;
}
- if (LimitLen && Count > MaxWidth) {
+ if (LimitLen && (Count > MaxWidth)) {
*Offset = Index;
break;
}
@@ -415,12 +417,13 @@ CreatePopUp (
// number of lines in the popup
//
VA_START (Args, Key);
- MaxLength = 0;
+ MaxLength = 0;
NumberOfLines = 0;
while ((String = VA_ARG (Args, CHAR16 *)) != NULL) {
MaxLength = MAX (MaxLength, UefiLibGetStringWidth (String, FALSE, 0, NULL) / 2);
NumberOfLines++;
}
+
VA_END (Args);
//
@@ -518,8 +521,10 @@ CreatePopUp (
ConOut->OutputString (ConOut, TmpString);
FreePool (TmpString);
}
+
NumberOfLines--;
}
+
VA_END (Args);
//
@@ -540,9 +545,9 @@ CreatePopUp (
//
// Restore the cursor visibility, position, and attributes
//
- ConOut->EnableCursor (ConOut, SavedConsoleMode.CursorVisible);
+ ConOut->EnableCursor (ConOut, SavedConsoleMode.CursorVisible);
ConOut->SetCursorPosition (ConOut, SavedConsoleMode.CursorColumn, SavedConsoleMode.CursorRow);
- ConOut->SetAttribute (ConOut, SavedConsoleMode.Attribute);
+ ConOut->SetAttribute (ConOut, SavedConsoleMode.Attribute);
//
// Wait for a keystroke
@@ -560,6 +565,7 @@ CreatePopUp (
if (Status != EFI_NOT_READY) {
continue;
}
+
gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);
}
}
diff --git a/MdePkg/Library/UefiLib/UefiDriverModel.c b/MdePkg/Library/UefiLib/UefiDriverModel.c
index deaf9a74a9..fdcf4f9c4f 100644
--- a/MdePkg/Library/UefiLib/UefiDriverModel.c
+++ b/MdePkg/Library/UefiLib/UefiDriverModel.c
@@ -8,7 +8,6 @@
**/
-
#include "UefiLibInternal.h"
/**
@@ -54,7 +53,8 @@ EfiLibInstallDriverBinding (
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
NULL
);
//
@@ -65,8 +65,6 @@ EfiLibInstallDriverBinding (
return Status;
}
-
-
/**
Uninstalls a Driver Binding Protocol instance.
@@ -91,7 +89,8 @@ EfiLibUninstallDriverBinding (
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
NULL
);
//
@@ -102,8 +101,6 @@ EfiLibUninstallDriverBinding (
return Status;
}
-
-
/**
Installs and completes the initialization of a Driver Binding Protocol instance and
optionally installs the Component Name, Driver Configuration and Driver Diagnostics Protocols.
@@ -152,74 +149,94 @@ EfiLibInstallAllDriverProtocols (
DriverBinding->ImageHandle = ImageHandle;
DriverBinding->DriverBindingHandle = DriverBindingHandle;
- if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
+ if ((DriverDiagnostics == NULL) || FeaturePcdGet (PcdDriverDiagnosticsDisable)) {
if (DriverConfiguration == NULL) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
NULL
);
}
} else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
NULL
);
}
}
} else {
if (DriverConfiguration == NULL) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
}
} else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
}
@@ -234,8 +251,6 @@ EfiLibInstallAllDriverProtocols (
return Status;
}
-
-
/**
Uninstalls a Driver Binding Protocol instance and optionally uninstalls the
Component Name, Driver Configuration and Driver Diagnostics Protocols.
@@ -265,74 +280,94 @@ EfiLibUninstallAllDriverProtocols (
ASSERT (DriverBinding != NULL);
- if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
+ if ((DriverDiagnostics == NULL) || FeaturePcdGet (PcdDriverDiagnosticsDisable)) {
if (DriverConfiguration == NULL) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
NULL
);
}
} else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
NULL
);
}
}
} else {
if (DriverConfiguration == NULL) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
}
} else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- Status = gBS->UninstallMultipleProtocolInterfaces (
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
}
@@ -347,8 +382,6 @@ EfiLibUninstallAllDriverProtocols (
return Status;
}
-
-
/**
Installs Driver Binding Protocol with optional Component Name and Component Name 2 Protocols.
@@ -375,12 +408,12 @@ EfiLibUninstallAllDriverProtocols (
EFI_STATUS
EFIAPI
EfiLibInstallDriverBindingComponentName2 (
- IN CONST EFI_HANDLE ImageHandle,
- IN CONST EFI_SYSTEM_TABLE *SystemTable,
- IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
- IN EFI_HANDLE DriverBindingHandle,
- IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName OPTIONAL,
- IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL
+ IN CONST EFI_HANDLE ImageHandle,
+ IN CONST EFI_SYSTEM_TABLE *SystemTable,
+ IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
+ IN EFI_HANDLE DriverBindingHandle,
+ IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName OPTIONAL,
+ IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL
)
{
EFI_STATUS Status;
@@ -393,37 +426,45 @@ EfiLibInstallDriverBindingComponentName2 (
DriverBinding->ImageHandle = ImageHandle;
DriverBinding->DriverBindingHandle = DriverBindingHandle;
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
NULL
);
- } else {
+ } else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
NULL
);
- }
+ }
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- NULL
- );
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &DriverBinding->DriverBindingHandle,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ NULL
+ );
+ } else {
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &DriverBinding->DriverBindingHandle,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ NULL
+ );
}
}
@@ -435,8 +476,6 @@ EfiLibInstallDriverBindingComponentName2 (
return Status;
}
-
-
/**
Uninstalls Driver Binding Protocol with optional Component Name and Component Name 2 Protocols.
@@ -454,46 +493,54 @@ EfiLibInstallDriverBindingComponentName2 (
EFI_STATUS
EFIAPI
EfiLibUninstallDriverBindingComponentName2 (
- IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
- IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName OPTIONAL,
- IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL
+ IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
+ IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName OPTIONAL,
+ IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL
)
{
EFI_STATUS Status;
ASSERT (DriverBinding != NULL);
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
NULL
);
- } else {
+ } else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
NULL
);
- }
+ }
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->UninstallMultipleProtocolInterfaces (
- DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- NULL
- );
- } else {
- Status = gBS->UninstallMultipleProtocolInterfaces (
- DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- NULL
- );
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
+ Status = gBS->UninstallMultipleProtocolInterfaces (
+ DriverBinding->DriverBindingHandle,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ NULL
+ );
+ } else {
+ Status = gBS->UninstallMultipleProtocolInterfaces (
+ DriverBinding->DriverBindingHandle,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ NULL
+ );
}
}
@@ -505,8 +552,6 @@ EfiLibUninstallDriverBindingComponentName2 (
return Status;
}
-
-
/**
Installs Driver Binding Protocol with optional Component Name, Component Name 2, Driver
Configuration, Driver Configuration 2, Driver Diagnostics, and Driver Diagnostics 2 Protocols.
@@ -539,16 +584,16 @@ EfiLibUninstallDriverBindingComponentName2 (
EFI_STATUS
EFIAPI
EfiLibInstallAllDriverProtocols2 (
- IN CONST EFI_HANDLE ImageHandle,
- IN CONST EFI_SYSTEM_TABLE *SystemTable,
- IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
- IN EFI_HANDLE DriverBindingHandle,
- IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName OPTIONAL,
- IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL,
- IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration OPTIONAL,
- IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2 OPTIONAL,
- IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL,
- IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL
+ IN CONST EFI_HANDLE ImageHandle,
+ IN CONST EFI_SYSTEM_TABLE *SystemTable,
+ IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
+ IN EFI_HANDLE DriverBindingHandle,
+ IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName OPTIONAL,
+ IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL,
+ IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration OPTIONAL,
+ IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2 OPTIONAL,
+ IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL,
+ IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL
)
{
EFI_STATUS Status;
@@ -563,157 +608,205 @@ EfiLibInstallAllDriverProtocols2 (
if (DriverConfiguration2 == NULL) {
if (DriverConfiguration == NULL) {
- if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
- if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((DriverDiagnostics == NULL) || FeaturePcdGet (PcdDriverDiagnosticsDisable)) {
+ if ((DriverDiagnostics2 == NULL) || FeaturePcdGet (PcdDriverDiagnostics2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
NULL
);
}
}
} else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
}
}
} else {
- if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((DriverDiagnostics2 == NULL) || FeaturePcdGet (PcdDriverDiagnostics2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
}
}
} else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
@@ -721,173 +814,237 @@ EfiLibInstallAllDriverProtocols2 (
}
}
} else {
- if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
- if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((DriverDiagnostics == NULL) || FeaturePcdGet (PcdDriverDiagnosticsDisable)) {
+ if ((DriverDiagnostics2 == NULL) || FeaturePcdGet (PcdDriverDiagnostics2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
NULL
);
}
}
} else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
}
}
} else {
- if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((DriverDiagnostics2 == NULL) || FeaturePcdGet (PcdDriverDiagnostics2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
}
}
} else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
@@ -897,173 +1054,237 @@ EfiLibInstallAllDriverProtocols2 (
}
} else {
if (DriverConfiguration == NULL) {
- if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
- if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((DriverDiagnostics == NULL) || FeaturePcdGet (PcdDriverDiagnosticsDisable)) {
+ if ((DriverDiagnostics2 == NULL) || FeaturePcdGet (PcdDriverDiagnostics2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
NULL
);
}
}
} else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
}
}
} else {
- if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((DriverDiagnostics2 == NULL) || FeaturePcdGet (PcdDriverDiagnostics2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
}
}
} else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
@@ -1071,189 +1292,269 @@ EfiLibInstallAllDriverProtocols2 (
}
}
} else {
- if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
- if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((DriverDiagnostics == NULL) || FeaturePcdGet (PcdDriverDiagnosticsDisable)) {
+ if ((DriverDiagnostics2 == NULL) || FeaturePcdGet (PcdDriverDiagnostics2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
NULL
);
}
}
} else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
}
}
} else {
- if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((DriverDiagnostics2 == NULL) || FeaturePcdGet (PcdDriverDiagnostics2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
}
}
} else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
@@ -1271,8 +1572,6 @@ EfiLibInstallAllDriverProtocols2 (
return Status;
}
-
-
/**
Uninstalls Driver Binding Protocol with optional Component Name, Component Name 2, Driver
Configuration, Driver Configuration 2, Driver Diagnostics, and Driver Diagnostics 2 Protocols.
@@ -1296,13 +1595,13 @@ EfiLibInstallAllDriverProtocols2 (
EFI_STATUS
EFIAPI
EfiLibUninstallAllDriverProtocols2 (
- IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
- IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName OPTIONAL,
- IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL,
- IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration OPTIONAL,
- IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2 OPTIONAL,
- IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL,
- IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL
+ IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
+ IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName OPTIONAL,
+ IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL,
+ IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration OPTIONAL,
+ IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2 OPTIONAL,
+ IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL,
+ IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL
)
{
EFI_STATUS Status;
@@ -1311,157 +1610,205 @@ EfiLibUninstallAllDriverProtocols2 (
if (DriverConfiguration2 == NULL) {
if (DriverConfiguration == NULL) {
- if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
- if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((DriverDiagnostics == NULL) || FeaturePcdGet (PcdDriverDiagnosticsDisable)) {
+ if ((DriverDiagnostics2 == NULL) || FeaturePcdGet (PcdDriverDiagnostics2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
NULL
);
}
}
} else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
}
}
} else {
- if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((DriverDiagnostics2 == NULL) || FeaturePcdGet (PcdDriverDiagnostics2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
}
}
} else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
@@ -1469,173 +1816,237 @@ EfiLibUninstallAllDriverProtocols2 (
}
}
} else {
- if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
- if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((DriverDiagnostics == NULL) || FeaturePcdGet (PcdDriverDiagnosticsDisable)) {
+ if ((DriverDiagnostics2 == NULL) || FeaturePcdGet (PcdDriverDiagnostics2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
NULL
);
}
}
} else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
}
}
} else {
- if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((DriverDiagnostics2 == NULL) || FeaturePcdGet (PcdDriverDiagnostics2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
}
}
} else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
@@ -1645,173 +2056,237 @@ EfiLibUninstallAllDriverProtocols2 (
}
} else {
if (DriverConfiguration == NULL) {
- if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
- if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((DriverDiagnostics == NULL) || FeaturePcdGet (PcdDriverDiagnosticsDisable)) {
+ if ((DriverDiagnostics2 == NULL) || FeaturePcdGet (PcdDriverDiagnostics2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
NULL
);
}
}
} else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
}
}
} else {
- if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((DriverDiagnostics2 == NULL) || FeaturePcdGet (PcdDriverDiagnostics2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
}
}
} else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
@@ -1819,189 +2294,269 @@ EfiLibUninstallAllDriverProtocols2 (
}
}
} else {
- if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
- if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((DriverDiagnostics == NULL) || FeaturePcdGet (PcdDriverDiagnosticsDisable)) {
+ if ((DriverDiagnostics2 == NULL) || FeaturePcdGet (PcdDriverDiagnostics2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
NULL
);
}
}
} else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
}
}
} else {
- if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((DriverDiagnostics2 == NULL) || FeaturePcdGet (PcdDriverDiagnostics2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
NULL
);
}
}
} else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+ if ((ComponentName == NULL) || FeaturePcdGet (PcdComponentNameDisable)) {
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
} else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->UninstallMultipleProtocolInterfaces (
- DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- } else {
- Status = gBS->UninstallMultipleProtocolInterfaces (
- DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+ if ((ComponentName2 == NULL) || FeaturePcdGet (PcdComponentName2Disable)) {
+ Status = gBS->UninstallMultipleProtocolInterfaces (
+ DriverBinding->DriverBindingHandle,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
+ NULL
+ );
+ } else {
+ Status = gBS->UninstallMultipleProtocolInterfaces (
+ DriverBinding->DriverBindingHandle,
+ &gEfiDriverBindingProtocolGuid,
+ DriverBinding,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ &gEfiDriverConfigurationProtocolGuid,
+ DriverConfiguration,
+ &gEfiDriverConfiguration2ProtocolGuid,
+ DriverConfiguration2,
+ &gEfiDriverDiagnosticsProtocolGuid,
+ DriverDiagnostics,
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ DriverDiagnostics2,
NULL
);
}
diff --git a/MdePkg/Library/UefiLib/UefiLib.c b/MdePkg/Library/UefiLib/UefiLib.c
index c2d143e821..95d0319d3a 100644
--- a/MdePkg/Library/UefiLib/UefiLib.c
+++ b/MdePkg/Library/UefiLib/UefiLib.c
@@ -10,7 +10,6 @@
**/
-
#include "UefiLibInternal.h"
/**
@@ -54,10 +53,10 @@ CompareIso639LanguageCode (
UINT32 Name1;
UINT32 Name2;
- Name1 = ReadUnaligned24 ((CONST UINT32 *) Language1);
- Name2 = ReadUnaligned24 ((CONST UINT32 *) Language2);
+ Name1 = ReadUnaligned24 ((CONST UINT32 *)Language1);
+ Name2 = ReadUnaligned24 ((CONST UINT32 *)Language2);
- return (BOOLEAN) (Name1 == Name2);
+ return (BOOLEAN)(Name1 == Name2);
}
/**
@@ -92,7 +91,7 @@ EfiGetSystemConfigurationTable (
ASSERT (Table != NULL);
SystemTable = gST;
- *Table = NULL;
+ *Table = NULL;
for (Index = 0; Index < SystemTable->NumberOfTableEntries; Index++) {
if (CompareGuid (TableGuid, &(SystemTable->ConfigurationTable[Index].VendorGuid))) {
*Table = SystemTable->ConfigurationTable[Index].VendorTable;
@@ -132,7 +131,7 @@ EfiGetSystemConfigurationTable (
**/
EFI_EVENT
EFIAPI
-EfiCreateProtocolNotifyEvent(
+EfiCreateProtocolNotifyEvent (
IN EFI_GUID *ProtocolGuid,
IN EFI_TPL NotifyTpl,
IN EFI_EVENT_NOTIFY NotifyFunction,
@@ -226,7 +225,7 @@ EfiNamedEventListen (
EVT_NOTIFY_SIGNAL,
NotifyTpl,
NotifyFunction,
- (VOID *) NotifyContext,
+ (VOID *)NotifyContext,
&Event
);
ASSERT_EFI_ERROR (Status);
@@ -246,7 +245,7 @@ EfiNamedEventListen (
//
Status = gBS->RegisterProtocolNotify (
- (EFI_GUID *) Name,
+ (EFI_GUID *)Name,
Event,
RegistrationLocal
);
@@ -277,12 +276,12 @@ EfiNamedEventSignal (
EFI_STATUS Status;
EFI_HANDLE Handle;
- ASSERT(Name != NULL);
+ ASSERT (Name != NULL);
Handle = NULL;
Status = gBS->InstallProtocolInterface (
&Handle,
- (EFI_GUID *) Name,
+ (EFI_GUID *)Name,
EFI_NATIVE_INTERFACE,
NULL
);
@@ -290,7 +289,7 @@ EfiNamedEventSignal (
Status = gBS->UninstallProtocolInterface (
Handle,
- (EFI_GUID *) Name,
+ (EFI_GUID *)Name,
NULL
);
ASSERT_EFI_ERROR (Status);
@@ -313,11 +312,11 @@ EfiNamedEventSignal (
EFI_STATUS
EFIAPI
EfiEventGroupSignal (
- IN CONST EFI_GUID *EventGroup
+ IN CONST EFI_GUID *EventGroup
)
{
- EFI_STATUS Status;
- EFI_EVENT Event;
+ EFI_STATUS Status;
+ EFI_EVENT Event;
if (EventGroup == NULL) {
return EFI_INVALID_PARAMETER;
@@ -353,8 +352,8 @@ EfiEventGroupSignal (
VOID
EFIAPI
EfiEventEmptyFunction (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
}
@@ -377,7 +376,7 @@ EfiGetCurrentTpl (
VOID
)
{
- EFI_TPL Tpl;
+ EFI_TPL Tpl;
Tpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
gBS->RestoreTPL (Tpl);
@@ -385,7 +384,6 @@ EfiGetCurrentTpl (
return Tpl;
}
-
/**
Initializes a basic mutual exclusion lock.
@@ -406,15 +404,15 @@ EFI_LOCK *
EFIAPI
EfiInitializeLock (
IN OUT EFI_LOCK *Lock,
- IN EFI_TPL Priority
+ IN EFI_TPL Priority
)
{
ASSERT (Lock != NULL);
ASSERT (Priority <= TPL_HIGH_LEVEL);
- Lock->Tpl = Priority;
- Lock->OwnerTpl = TPL_APPLICATION;
- Lock->Lock = EfiLockReleased ;
+ Lock->Tpl = Priority;
+ Lock->OwnerTpl = TPL_APPLICATION;
+ Lock->Lock = EfiLockReleased;
return Lock;
}
@@ -466,7 +464,6 @@ EfiAcquireLockOrFail (
IN EFI_LOCK *Lock
)
{
-
ASSERT (Lock != NULL);
ASSERT (Lock->Lock != EfiLockUninitialized);
@@ -503,7 +500,7 @@ EfiReleaseLock (
IN EFI_LOCK *Lock
)
{
- EFI_TPL Tpl;
+ EFI_TPL Tpl;
ASSERT (Lock != NULL);
ASSERT (Lock->Lock == EfiLockAcquired);
@@ -541,19 +538,19 @@ EfiReleaseLock (
EFI_STATUS
EFIAPI
EfiTestManagedDevice (
- IN CONST EFI_HANDLE ControllerHandle,
- IN CONST EFI_HANDLE DriverBindingHandle,
- IN CONST EFI_GUID *ProtocolGuid
+ IN CONST EFI_HANDLE ControllerHandle,
+ IN CONST EFI_HANDLE DriverBindingHandle,
+ IN CONST EFI_GUID *ProtocolGuid
)
{
- EFI_STATUS Status;
- VOID *ManagedInterface;
+ EFI_STATUS Status;
+ VOID *ManagedInterface;
ASSERT (ProtocolGuid != NULL);
Status = gBS->OpenProtocol (
ControllerHandle,
- (EFI_GUID *) ProtocolGuid,
+ (EFI_GUID *)ProtocolGuid,
&ManagedInterface,
DriverBindingHandle,
ControllerHandle,
@@ -562,7 +559,7 @@ EfiTestManagedDevice (
if (!EFI_ERROR (Status)) {
gBS->CloseProtocol (
ControllerHandle,
- (EFI_GUID *) ProtocolGuid,
+ (EFI_GUID *)ProtocolGuid,
DriverBindingHandle,
ControllerHandle
);
@@ -598,15 +595,15 @@ EfiTestManagedDevice (
EFI_STATUS
EFIAPI
EfiTestChildHandle (
- IN CONST EFI_HANDLE ControllerHandle,
- IN CONST EFI_HANDLE ChildHandle,
- IN CONST EFI_GUID *ProtocolGuid
+ IN CONST EFI_HANDLE ControllerHandle,
+ IN CONST EFI_HANDLE ChildHandle,
+ IN CONST EFI_GUID *ProtocolGuid
)
{
- EFI_STATUS Status;
- EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
- UINTN EntryCount;
- UINTN Index;
+ EFI_STATUS Status;
+ EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
+ UINTN EntryCount;
+ UINTN Index;
ASSERT (ProtocolGuid != NULL);
@@ -616,7 +613,7 @@ EfiTestChildHandle (
//
Status = gBS->OpenProtocolInformation (
ControllerHandle,
- (EFI_GUID *) ProtocolGuid,
+ (EFI_GUID *)ProtocolGuid,
&OpenInfoBuffer,
&EntryCount
);
@@ -630,7 +627,8 @@ EfiTestChildHandle (
Status = EFI_UNSUPPORTED;
for (Index = 0; Index < EntryCount; Index++) {
if ((OpenInfoBuffer[Index].ControllerHandle == ChildHandle) &&
- (OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
+ ((OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0))
+ {
Status = EFI_SUCCESS;
break;
}
@@ -653,18 +651,23 @@ EfiTestChildHandle (
EFI_STATUS
EFIAPI
IsLanguageSupported (
- IN CONST CHAR8 *SupportedLanguages,
- IN CONST CHAR8 *TargetLanguage
+ IN CONST CHAR8 *SupportedLanguages,
+ IN CONST CHAR8 *TargetLanguage
)
{
- UINTN Index;
+ UINTN Index;
+
while (*SupportedLanguages != 0) {
- for (Index = 0; SupportedLanguages[Index] != 0 && SupportedLanguages[Index] != ';'; Index++);
- if ((AsciiStrnCmp(SupportedLanguages, TargetLanguage, Index) == 0) && (TargetLanguage[Index] == 0)) {
+ for (Index = 0; SupportedLanguages[Index] != 0 && SupportedLanguages[Index] != ';'; Index++) {
+ }
+
+ if ((AsciiStrnCmp (SupportedLanguages, TargetLanguage, Index) == 0) && (TargetLanguage[Index] == 0)) {
return EFI_SUCCESS;
}
+
SupportedLanguages += Index;
- for (; *SupportedLanguages != 0 && *SupportedLanguages == ';'; SupportedLanguages++);
+ for ( ; *SupportedLanguages != 0 && *SupportedLanguages == ';'; SupportedLanguages++) {
+ }
}
return EFI_UNSUPPORTED;
@@ -712,7 +715,7 @@ LookupUnicodeString (
//
// Make sure the parameters are valid
//
- if (Language == NULL || UnicodeString == NULL) {
+ if ((Language == NULL) || (UnicodeString == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -720,7 +723,7 @@ LookupUnicodeString (
// If there are no supported languages, or the Unicode String Table is empty, then the
// Unicode String specified by Language is not supported by this Unicode String Table
//
- if (SupportedLanguages == NULL || UnicodeStringTable == NULL) {
+ if ((SupportedLanguages == NULL) || (UnicodeStringTable == NULL)) {
return EFI_UNSUPPORTED;
}
@@ -729,13 +732,11 @@ LookupUnicodeString (
//
while (*SupportedLanguages != 0) {
if (CompareIso639LanguageCode (Language, SupportedLanguages)) {
-
//
// Search the Unicode String Table for the matching Language specifier
//
while (UnicodeStringTable->Language != NULL) {
if (CompareIso639LanguageCode (Language, UnicodeStringTable->Language)) {
-
//
// A matching string was found, so return it
//
@@ -755,8 +756,6 @@ LookupUnicodeString (
return EFI_UNSUPPORTED;
}
-
-
/**
This function looks up a Unicode string in UnicodeStringTable.
@@ -807,14 +806,14 @@ LookupUnicodeString2 (
IN BOOLEAN Iso639Language
)
{
- BOOLEAN Found;
- UINTN Index;
- CHAR8 *LanguageString;
+ BOOLEAN Found;
+ UINTN Index;
+ CHAR8 *LanguageString;
//
// Make sure the parameters are valid
//
- if (Language == NULL || UnicodeString == NULL) {
+ if ((Language == NULL) || (UnicodeString == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -822,7 +821,7 @@ LookupUnicodeString2 (
// If there are no supported languages, or the Unicode String Table is empty, then the
// Unicode String specified by Language is not supported by this Unicode String Table
//
- if (SupportedLanguages == NULL || UnicodeStringTable == NULL) {
+ if ((SupportedLanguages == NULL) || (UnicodeStringTable == NULL)) {
return EFI_UNSUPPORTED;
}
@@ -836,13 +835,13 @@ LookupUnicodeString2 (
Found = TRUE;
break;
}
+
SupportedLanguages += 3;
}
} else {
- Found = !IsLanguageSupported(SupportedLanguages, Language);
+ Found = !IsLanguageSupported (SupportedLanguages, Language);
}
-
//
// If Language is not a member of SupportedLanguages, then return EFI_UNSUPPORTED
//
@@ -856,21 +855,25 @@ LookupUnicodeString2 (
while (UnicodeStringTable->Language != NULL) {
LanguageString = UnicodeStringTable->Language;
while (0 != *LanguageString) {
- for (Index = 0 ;LanguageString[Index] != 0 && LanguageString[Index] != ';'; Index++);
- if (AsciiStrnCmp(LanguageString, Language, Index) == 0) {
+ for (Index = 0; LanguageString[Index] != 0 && LanguageString[Index] != ';'; Index++) {
+ }
+
+ if (AsciiStrnCmp (LanguageString, Language, Index) == 0) {
*UnicodeString = UnicodeStringTable->UnicodeString;
return EFI_SUCCESS;
}
+
LanguageString += Index;
- for (Index = 0 ;LanguageString[Index] != 0 && LanguageString[Index] == ';'; Index++);
+ for (Index = 0; LanguageString[Index] != 0 && LanguageString[Index] == ';'; Index++) {
+ }
}
+
UnicodeStringTable++;
}
return EFI_UNSUPPORTED;
}
-
/**
This function adds a Unicode string to UnicodeStringTable.
@@ -921,7 +924,7 @@ AddUnicodeString (
//
// Make sure the parameter are valid
//
- if (Language == NULL || UnicodeString == NULL || UnicodeStringTable == NULL) {
+ if ((Language == NULL) || (UnicodeString == NULL) || (UnicodeStringTable == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -944,7 +947,6 @@ AddUnicodeString (
//
while (*SupportedLanguages != 0) {
if (CompareIso639LanguageCode (Language, SupportedLanguages)) {
-
//
// Determine the size of the Unicode String Table by looking for a NULL Language entry
//
@@ -977,10 +979,10 @@ AddUnicodeString (
//
if (*UnicodeStringTable != NULL) {
CopyMem (
- NewUnicodeStringTable,
- *UnicodeStringTable,
- NumberOfEntries * sizeof (EFI_UNICODE_STRING_TABLE)
- );
+ NewUnicodeStringTable,
+ *UnicodeStringTable,
+ NumberOfEntries * sizeof (EFI_UNICODE_STRING_TABLE)
+ );
}
//
@@ -995,16 +997,16 @@ AddUnicodeString (
//
// Compute the length of the Unicode String
//
- for (UnicodeStringLength = 0; UnicodeString[UnicodeStringLength] != 0; UnicodeStringLength++)
- ;
+ for (UnicodeStringLength = 0; UnicodeString[UnicodeStringLength] != 0; UnicodeStringLength++) {
+ }
//
// Allocate space for a copy of the Unicode String
//
NewUnicodeStringTable[NumberOfEntries].UnicodeString = AllocateCopyPool (
- (UnicodeStringLength + 1) * sizeof (CHAR16),
- UnicodeString
- );
+ (UnicodeStringLength + 1) * sizeof (CHAR16),
+ UnicodeString
+ );
if (NewUnicodeStringTable[NumberOfEntries].UnicodeString == NULL) {
FreePool (NewUnicodeStringTable[NumberOfEntries].Language);
FreePool (NewUnicodeStringTable);
@@ -1014,8 +1016,8 @@ AddUnicodeString (
//
// Mark the end of the Unicode String Table
//
- NewUnicodeStringTable[NumberOfEntries + 1].Language = NULL;
- NewUnicodeStringTable[NumberOfEntries + 1].UnicodeString = NULL;
+ NewUnicodeStringTable[NumberOfEntries + 1].Language = NULL;
+ NewUnicodeStringTable[NumberOfEntries + 1].UnicodeString = NULL;
//
// Free the old Unicode String Table
@@ -1038,7 +1040,6 @@ AddUnicodeString (
return EFI_UNSUPPORTED;
}
-
/**
This function adds the Null-terminated Unicode string specified by UnicodeString
to UnicodeStringTable.
@@ -1102,7 +1103,7 @@ AddUnicodeString2 (
//
// Make sure the parameter are valid
//
- if (Language == NULL || UnicodeString == NULL || UnicodeStringTable == NULL) {
+ if ((Language == NULL) || (UnicodeString == NULL) || (UnicodeStringTable == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -1130,11 +1131,13 @@ AddUnicodeString2 (
Found = TRUE;
break;
}
+
SupportedLanguages += 3;
}
} else {
- Found = !IsLanguageSupported(SupportedLanguages, Language);
+ Found = !IsLanguageSupported (SupportedLanguages, Language);
}
+
//
// If Language is not a member of SupportedLanguages, then return EFI_UNSUPPORTED
//
@@ -1152,14 +1155,18 @@ AddUnicodeString2 (
LanguageString = OldUnicodeStringTable->Language;
while (*LanguageString != 0) {
- for (Index = 0; LanguageString[Index] != 0 && LanguageString[Index] != ';'; Index++);
+ for (Index = 0; LanguageString[Index] != 0 && LanguageString[Index] != ';'; Index++) {
+ }
if (AsciiStrnCmp (Language, LanguageString, Index) == 0) {
return EFI_ALREADY_STARTED;
}
+
LanguageString += Index;
- for (; *LanguageString != 0 && *LanguageString == ';'; LanguageString++);
+ for ( ; *LanguageString != 0 && *LanguageString == ';'; LanguageString++) {
+ }
}
+
OldUnicodeStringTable++;
NumberOfEntries++;
}
@@ -1190,7 +1197,7 @@ AddUnicodeString2 (
//
// Allocate space for a copy of the Language specifier
//
- NewUnicodeStringTable[NumberOfEntries].Language = AllocateCopyPool (AsciiStrSize(Language), Language);
+ NewUnicodeStringTable[NumberOfEntries].Language = AllocateCopyPool (AsciiStrSize (Language), Language);
if (NewUnicodeStringTable[NumberOfEntries].Language == NULL) {
FreePool (NewUnicodeStringTable);
return EFI_OUT_OF_RESOURCES;
@@ -1199,7 +1206,8 @@ AddUnicodeString2 (
//
// Compute the length of the Unicode String
//
- for (UnicodeStringLength = 0; UnicodeString[UnicodeStringLength] != 0; UnicodeStringLength++);
+ for (UnicodeStringLength = 0; UnicodeString[UnicodeStringLength] != 0; UnicodeStringLength++) {
+ }
//
// Allocate space for a copy of the Unicode String
@@ -1214,8 +1222,8 @@ AddUnicodeString2 (
//
// Mark the end of the Unicode String Table
//
- NewUnicodeStringTable[NumberOfEntries + 1].Language = NULL;
- NewUnicodeStringTable[NumberOfEntries + 1].UnicodeString = NULL;
+ NewUnicodeStringTable[NumberOfEntries + 1].Language = NULL;
+ NewUnicodeStringTable[NumberOfEntries + 1].UnicodeString = NULL;
//
// Free the old Unicode String Table
@@ -1250,7 +1258,7 @@ FreeUnicodeStringTable (
IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable
)
{
- UINTN Index;
+ UINTN Index;
//
// If the Unicode String Table is NULL, then it is already freed
@@ -1263,7 +1271,6 @@ FreeUnicodeStringTable (
// Loop through the Unicode String Table until we reach the end of table marker
//
for (Index = 0; UnicodeStringTable[Index].Language != NULL; Index++) {
-
//
// Free the Language string from the Unicode String Table
//
@@ -1285,7 +1292,6 @@ FreeUnicodeStringTable (
return EFI_SUCCESS;
}
-
/**
Returns the status whether get the variable success. The function retrieves
variable through the UEFI Runtime Service GetVariable(). The
@@ -1326,10 +1332,10 @@ GetVariable2 (
BufferSize = 0;
*Value = NULL;
if (Size != NULL) {
- *Size = 0;
+ *Size = 0;
}
- Status = gRT->GetVariable ((CHAR16 *) Name, (EFI_GUID *) Guid, NULL, &BufferSize, *Value);
+ Status = gRT->GetVariable ((CHAR16 *)Name, (EFI_GUID *)Guid, NULL, &BufferSize, *Value);
if (Status != EFI_BUFFER_TOO_SMALL) {
return Status;
}
@@ -1346,9 +1352,9 @@ GetVariable2 (
//
// Get the variable data.
//
- Status = gRT->GetVariable ((CHAR16 *) Name, (EFI_GUID *) Guid, NULL, &BufferSize, *Value);
+ Status = gRT->GetVariable ((CHAR16 *)Name, (EFI_GUID *)Guid, NULL, &BufferSize, *Value);
if (EFI_ERROR (Status)) {
- FreePool(*Value);
+ FreePool (*Value);
*Value = NULL;
}
@@ -1384,24 +1390,24 @@ GetVariable2 (
**/
EFI_STATUS
EFIAPI
-GetVariable3(
- IN CONST CHAR16 *Name,
- IN CONST EFI_GUID *Guid,
- OUT VOID **Value,
- OUT UINTN *Size OPTIONAL,
- OUT UINT32 *Attr OPTIONAL
+GetVariable3 (
+ IN CONST CHAR16 *Name,
+ IN CONST EFI_GUID *Guid,
+ OUT VOID **Value,
+ OUT UINTN *Size OPTIONAL,
+ OUT UINT32 *Attr OPTIONAL
)
{
EFI_STATUS Status;
UINTN BufferSize;
- ASSERT(Name != NULL && Guid != NULL && Value != NULL);
+ ASSERT (Name != NULL && Guid != NULL && Value != NULL);
//
// Try to get the variable size.
//
BufferSize = 0;
- *Value = NULL;
+ *Value = NULL;
if (Size != NULL) {
*Size = 0;
}
@@ -1410,7 +1416,7 @@ GetVariable3(
*Attr = 0;
}
- Status = gRT->GetVariable((CHAR16 *)Name, (EFI_GUID *)Guid, Attr, &BufferSize, *Value);
+ Status = gRT->GetVariable ((CHAR16 *)Name, (EFI_GUID *)Guid, Attr, &BufferSize, *Value);
if (Status != EFI_BUFFER_TOO_SMALL) {
return Status;
}
@@ -1418,8 +1424,8 @@ GetVariable3(
//
// Allocate buffer to get the variable.
//
- *Value = AllocatePool(BufferSize);
- ASSERT(*Value != NULL);
+ *Value = AllocatePool (BufferSize);
+ ASSERT (*Value != NULL);
if (*Value == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@@ -1427,9 +1433,9 @@ GetVariable3(
//
// Get the variable data.
//
- Status = gRT->GetVariable((CHAR16 *)Name, (EFI_GUID *)Guid, Attr, &BufferSize, *Value);
- if (EFI_ERROR(Status)) {
- FreePool(*Value);
+ Status = gRT->GetVariable ((CHAR16 *)Name, (EFI_GUID *)Guid, Attr, &BufferSize, *Value);
+ if (EFI_ERROR (Status)) {
+ FreePool (*Value);
*Value = NULL;
}
@@ -1462,9 +1468,9 @@ GetVariable3(
EFI_STATUS
EFIAPI
GetEfiGlobalVariable2 (
- IN CONST CHAR16 *Name,
- OUT VOID **Value,
- OUT UINTN *Size OPTIONAL
+ IN CONST CHAR16 *Name,
+ OUT VOID **Value,
+ OUT UINTN *Size OPTIONAL
)
{
return GetVariable2 (Name, &gEfiGlobalVariableGuid, Value, Size);
@@ -1540,7 +1546,8 @@ GetBestLanguage (
// If in RFC 4646 mode, then determine the length of the first RFC 4646 language code in Language
//
if (Iso639Language == 0) {
- for (LanguageLength = 0; Language[LanguageLength] != 0 && Language[LanguageLength] != ';'; LanguageLength++);
+ for (LanguageLength = 0; Language[LanguageLength] != 0 && Language[LanguageLength] != ';'; LanguageLength++) {
+ }
}
//
@@ -1558,11 +1565,15 @@ GetBestLanguage (
//
// Skip ';' characters in Supported
//
- for (; *Supported != '\0' && *Supported == ';'; Supported++);
+ for ( ; *Supported != '\0' && *Supported == ';'; Supported++) {
+ }
+
//
// Determine the length of the next language code in Supported
//
- for (CompareLength = 0; Supported[CompareLength] != 0 && Supported[CompareLength] != ';'; CompareLength++);
+ for (CompareLength = 0; Supported[CompareLength] != 0 && Supported[CompareLength] != ';'; CompareLength++) {
+ }
+
//
// If Language is longer than the Supported, then skip to the next language
//
@@ -1570,6 +1581,7 @@ GetBestLanguage (
continue;
}
}
+
//
// See if the first LanguageLength characters in Supported match Language
//
@@ -1582,6 +1594,7 @@ GetBestLanguage (
if (BestLanguage == NULL) {
return NULL;
}
+
return CopyMem (BestLanguage, Supported, CompareLength);
}
}
@@ -1595,10 +1608,12 @@ GetBestLanguage (
//
// If RFC 4646 mode, then trim Language from the right to the next '-' character
//
- for (LanguageLength--; LanguageLength > 0 && Language[LanguageLength] != '-'; LanguageLength--);
+ for (LanguageLength--; LanguageLength > 0 && Language[LanguageLength] != '-'; LanguageLength--) {
+ }
}
}
}
+
VA_END (Args);
//
@@ -1646,7 +1661,7 @@ EfiLocateProtocolBuffer (
//
// Check input parameters
//
- if (Protocol == NULL || NoProtocols == NULL || Buffer == NULL) {
+ if ((Protocol == NULL) || (NoProtocols == NULL) || (Buffer == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -1654,7 +1669,7 @@ EfiLocateProtocolBuffer (
// Initialze output parameters
//
*NoProtocols = 0;
- *Buffer = NULL;
+ *Buffer = NULL;
//
// Retrieve the array of handles that support Protocol
@@ -1685,6 +1700,7 @@ EfiLocateProtocolBuffer (
gBS->FreePool (HandleBuffer);
return EFI_OUT_OF_RESOURCES;
}
+
ZeroMem (*Buffer, NoHandles * sizeof (VOID *));
//
@@ -1794,18 +1810,19 @@ EfiOpenFileByDevicePath (
IN UINT64 Attributes
)
{
- EFI_STATUS Status;
- EFI_HANDLE FileSystemHandle;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FileSystem;
- EFI_FILE_PROTOCOL *LastFile;
- FILEPATH_DEVICE_PATH *FilePathNode;
- CHAR16 *AlignedPathName;
- CHAR16 *PathName;
- EFI_FILE_PROTOCOL *NextFile;
+ EFI_STATUS Status;
+ EFI_HANDLE FileSystemHandle;
+ EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FileSystem;
+ EFI_FILE_PROTOCOL *LastFile;
+ FILEPATH_DEVICE_PATH *FilePathNode;
+ CHAR16 *AlignedPathName;
+ CHAR16 *PathName;
+ EFI_FILE_PROTOCOL *NextFile;
if (File == NULL) {
return EFI_INVALID_PARAMETER;
}
+
*File = NULL;
if (FilePath == NULL) {
@@ -1823,6 +1840,7 @@ EfiOpenFileByDevicePath (
if (EFI_ERROR (Status)) {
return Status;
}
+
Status = gBS->OpenProtocol (
FileSystemHandle,
&gEfiSimpleFileSystemProtocolGuid,
@@ -1848,11 +1866,13 @@ EfiOpenFileByDevicePath (
// Traverse the device path nodes relative to the filesystem.
//
while (!IsDevicePathEnd (*FilePath)) {
- if (DevicePathType (*FilePath) != MEDIA_DEVICE_PATH ||
- DevicePathSubType (*FilePath) != MEDIA_FILEPATH_DP) {
+ if ((DevicePathType (*FilePath) != MEDIA_DEVICE_PATH) ||
+ (DevicePathSubType (*FilePath) != MEDIA_FILEPATH_DP))
+ {
Status = EFI_INVALID_PARAMETER;
goto CloseLastFile;
}
+
FilePathNode = (FILEPATH_DEVICE_PATH *)*FilePath;
//
@@ -1862,7 +1882,7 @@ EfiOpenFileByDevicePath (
//
if ((UINTN)FilePathNode->PathName % sizeof *FilePathNode->PathName == 0) {
AlignedPathName = NULL;
- PathName = FilePathNode->PathName;
+ PathName = FilePathNode->PathName;
} else {
AlignedPathName = AllocateCopyPool (
(DevicePathNodeLength (FilePathNode) -
@@ -1873,6 +1893,7 @@ EfiOpenFileByDevicePath (
Status = EFI_OUT_OF_RESOURCES;
goto CloseLastFile;
}
+
PathName = AlignedPathName;
}
@@ -1894,6 +1915,7 @@ EfiOpenFileByDevicePath (
if (AlignedPathName != NULL) {
FreePool (AlignedPathName);
}
+
if (EFI_ERROR (Status)) {
goto CloseLastFile;
}
@@ -1902,7 +1924,7 @@ EfiOpenFileByDevicePath (
// Advance to the next device path node.
//
LastFile->Close (LastFile);
- LastFile = NextFile;
+ LastFile = NextFile;
*FilePath = NextDevicePathNode (FilePathNode);
}
diff --git a/MdePkg/Library/UefiLib/UefiLibInternal.h b/MdePkg/Library/UefiLib/UefiLibInternal.h
index 60b5297c75..4365282cf2 100644
--- a/MdePkg/Library/UefiLib/UefiLibInternal.h
+++ b/MdePkg/Library/UefiLib/UefiLibInternal.h
@@ -8,7 +8,6 @@
#ifndef __UEFI_LIB_INTERNAL_H_
#define __UEFI_LIB_INTERNAL_H_
-
#include <Uefi.h>
#include <Protocol/DriverBinding.h>
#include <Protocol/ComponentName.h>
diff --git a/MdePkg/Library/UefiLib/UefiLibPrint.c b/MdePkg/Library/UefiLib/UefiLibPrint.c
index 41db7bdfc3..39edeb7283 100644
--- a/MdePkg/Library/UefiLib/UefiLibPrint.c
+++ b/MdePkg/Library/UefiLib/UefiLibPrint.c
@@ -9,7 +9,7 @@
#include "UefiLibInternal.h"
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = {
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = {
{ 0x00, 0x00, 0x00, 0x00 },
{ 0x98, 0x00, 0x00, 0x00 },
{ 0x00, 0x98, 0x00, 0x00 },
@@ -59,17 +59,17 @@ InternalPrint (
UINTN BufferSize;
ASSERT (Format != NULL);
- ASSERT (((UINTN) Format & BIT0) == 0);
+ ASSERT (((UINTN)Format & BIT0) == 0);
ASSERT (Console != NULL);
BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);
- Buffer = (CHAR16 *) AllocatePool(BufferSize);
+ Buffer = (CHAR16 *)AllocatePool (BufferSize);
ASSERT (Buffer != NULL);
Return = UnicodeVSPrint (Buffer, BufferSize, Format, Marker);
- if (Console != NULL && Return > 0) {
+ if ((Console != NULL) && (Return > 0)) {
//
// To be extra safe make sure Console has been initialized
//
@@ -111,8 +111,8 @@ Print (
...
)
{
- VA_LIST Marker;
- UINTN Return;
+ VA_LIST Marker;
+ UINTN Return;
VA_START (Marker, Format);
@@ -150,19 +150,18 @@ ErrorPrint (
...
)
{
- VA_LIST Marker;
- UINTN Return;
+ VA_LIST Marker;
+ UINTN Return;
VA_START (Marker, Format);
- Return = InternalPrint( Format, gST->StdErr, Marker);
+ Return = InternalPrint (Format, gST->StdErr, Marker);
VA_END (Marker);
return Return;
}
-
/**
Internal function which prints a formatted ASCII string to the console output device
specified by Console
@@ -199,7 +198,7 @@ AsciiInternalPrint (
BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);
- Buffer = (CHAR16 *) AllocatePool(BufferSize);
+ Buffer = (CHAR16 *)AllocatePool (BufferSize);
ASSERT (Buffer != NULL);
Return = UnicodeVSPrintAsciiFormat (Buffer, BufferSize, Format, Marker);
@@ -245,13 +244,14 @@ AsciiPrint (
...
)
{
- VA_LIST Marker;
- UINTN Return;
+ VA_LIST Marker;
+ UINTN Return;
+
ASSERT (Format != NULL);
VA_START (Marker, Format);
- Return = AsciiInternalPrint( Format, gST->ConOut, Marker);
+ Return = AsciiInternalPrint (Format, gST->ConOut, Marker);
VA_END (Marker);
@@ -284,14 +284,14 @@ AsciiErrorPrint (
...
)
{
- VA_LIST Marker;
- UINTN Return;
+ VA_LIST Marker;
+ UINTN Return;
ASSERT (Format != NULL);
VA_START (Marker, Format);
- Return = AsciiInternalPrint( Format, gST->StdErr, Marker);
+ Return = AsciiInternalPrint (Format, gST->StdErr, Marker);
VA_END (Marker);
@@ -333,45 +333,45 @@ AsciiErrorPrint (
**/
UINTN
InternalPrintGraphic (
- IN UINTN PointX,
- IN UINTN PointY,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Foreground,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Background,
- IN CHAR16 *Buffer,
- IN UINTN PrintNum
+ IN UINTN PointX,
+ IN UINTN PointY,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Foreground,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Background,
+ IN CHAR16 *Buffer,
+ IN UINTN PrintNum
)
{
- EFI_STATUS Status;
- UINT32 HorizontalResolution;
- UINT32 VerticalResolution;
- UINT32 ColorDepth;
- UINT32 RefreshRate;
- EFI_HII_FONT_PROTOCOL *HiiFont;
- EFI_IMAGE_OUTPUT *Blt;
- EFI_FONT_DISPLAY_INFO FontInfo;
- EFI_HII_ROW_INFO *RowInfoArray;
- UINTN RowInfoArraySize;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Sto;
- EFI_HANDLE ConsoleHandle;
- UINTN Width;
- UINTN Height;
- UINTN Delta;
-
- HorizontalResolution = 0;
- VerticalResolution = 0;
- Blt = NULL;
- RowInfoArray = NULL;
+ EFI_STATUS Status;
+ UINT32 HorizontalResolution;
+ UINT32 VerticalResolution;
+ UINT32 ColorDepth;
+ UINT32 RefreshRate;
+ EFI_HII_FONT_PROTOCOL *HiiFont;
+ EFI_IMAGE_OUTPUT *Blt;
+ EFI_FONT_DISPLAY_INFO FontInfo;
+ EFI_HII_ROW_INFO *RowInfoArray;
+ UINTN RowInfoArraySize;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
+ EFI_UGA_DRAW_PROTOCOL *UgaDraw;
+ EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Sto;
+ EFI_HANDLE ConsoleHandle;
+ UINTN Width;
+ UINTN Height;
+ UINTN Delta;
+
+ HorizontalResolution = 0;
+ VerticalResolution = 0;
+ Blt = NULL;
+ RowInfoArray = NULL;
ConsoleHandle = gST->ConsoleOutHandle;
- ASSERT( ConsoleHandle != NULL);
+ ASSERT (ConsoleHandle != NULL);
Status = gBS->HandleProtocol (
ConsoleHandle,
&gEfiGraphicsOutputProtocolGuid,
- (VOID **) &GraphicsOutput
+ (VOID **)&GraphicsOutput
);
UgaDraw = NULL;
@@ -384,9 +384,10 @@ InternalPrintGraphic (
Status = gBS->HandleProtocol (
ConsoleHandle,
&gEfiUgaDrawProtocolGuid,
- (VOID **) &UgaDraw
+ (VOID **)&UgaDraw
);
}
+
if (EFI_ERROR (Status)) {
goto Error;
}
@@ -394,7 +395,7 @@ InternalPrintGraphic (
Status = gBS->HandleProtocol (
ConsoleHandle,
&gEfiSimpleTextOutProtocolGuid,
- (VOID **) &Sto
+ (VOID **)&Sto
);
if (EFI_ERROR (Status)) {
@@ -403,25 +404,25 @@ InternalPrintGraphic (
if (GraphicsOutput != NULL) {
HorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution;
- VerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution;
- } else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {
+ VerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution;
+ } else if ((UgaDraw != NULL) && FeaturePcdGet (PcdUgaConsumeSupport)) {
UgaDraw->GetMode (UgaDraw, &HorizontalResolution, &VerticalResolution, &ColorDepth, &RefreshRate);
} else {
goto Error;
}
- ASSERT ((HorizontalResolution != 0) && (VerticalResolution !=0));
+ ASSERT ((HorizontalResolution != 0) && (VerticalResolution != 0));
- Status = gBS->LocateProtocol (&gEfiHiiFontProtocolGuid, NULL, (VOID **) &HiiFont);
+ Status = gBS->LocateProtocol (&gEfiHiiFontProtocolGuid, NULL, (VOID **)&HiiFont);
if (EFI_ERROR (Status)) {
goto Error;
}
- Blt = (EFI_IMAGE_OUTPUT *) AllocateZeroPool (sizeof (EFI_IMAGE_OUTPUT));
+ Blt = (EFI_IMAGE_OUTPUT *)AllocateZeroPool (sizeof (EFI_IMAGE_OUTPUT));
ASSERT (Blt != NULL);
- Blt->Width = (UINT16) (HorizontalResolution);
- Blt->Height = (UINT16) (VerticalResolution);
+ Blt->Width = (UINT16)(HorizontalResolution);
+ Blt->Height = (UINT16)(VerticalResolution);
ZeroMem (&FontInfo, sizeof (EFI_FONT_DISPLAY_INFO));
@@ -434,6 +435,7 @@ InternalPrintGraphic (
sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
);
}
+
if (Background != NULL) {
CopyMem (&FontInfo.BackgroundColor, Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
} else {
@@ -448,25 +450,24 @@ InternalPrintGraphic (
Blt->Image.Screen = GraphicsOutput;
Status = HiiFont->StringToImage (
- HiiFont,
- EFI_HII_IGNORE_IF_NO_GLYPH | EFI_HII_OUT_FLAG_CLIP |
- EFI_HII_OUT_FLAG_CLIP_CLEAN_X | EFI_HII_OUT_FLAG_CLIP_CLEAN_Y |
- EFI_HII_IGNORE_LINE_BREAK | EFI_HII_DIRECT_TO_SCREEN,
- Buffer,
- &FontInfo,
- &Blt,
- PointX,
- PointY,
- &RowInfoArray,
- &RowInfoArraySize,
- NULL
- );
+ HiiFont,
+ EFI_HII_IGNORE_IF_NO_GLYPH | EFI_HII_OUT_FLAG_CLIP |
+ EFI_HII_OUT_FLAG_CLIP_CLEAN_X | EFI_HII_OUT_FLAG_CLIP_CLEAN_Y |
+ EFI_HII_IGNORE_LINE_BREAK | EFI_HII_DIRECT_TO_SCREEN,
+ Buffer,
+ &FontInfo,
+ &Blt,
+ PointX,
+ PointY,
+ &RowInfoArray,
+ &RowInfoArraySize,
+ NULL
+ );
if (EFI_ERROR (Status)) {
goto Error;
}
-
} else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
- ASSERT (UgaDraw!= NULL);
+ ASSERT (UgaDraw != NULL);
//
// Ensure Width * Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) doesn't overflow.
@@ -475,7 +476,7 @@ InternalPrintGraphic (
goto Error;
}
- Blt->Image.Bitmap = AllocateZeroPool ((UINT32) Blt->Width * Blt->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
+ Blt->Image.Bitmap = AllocateZeroPool ((UINT32)Blt->Width * Blt->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
ASSERT (Blt->Image.Bitmap != NULL);
//
@@ -483,19 +484,19 @@ InternalPrintGraphic (
// we ask StringToImage to print the string to blt buffer, then blt to device using UgaDraw.
//
Status = HiiFont->StringToImage (
- HiiFont,
- EFI_HII_IGNORE_IF_NO_GLYPH | EFI_HII_OUT_FLAG_CLIP |
- EFI_HII_OUT_FLAG_CLIP_CLEAN_X | EFI_HII_OUT_FLAG_CLIP_CLEAN_Y |
- EFI_HII_IGNORE_LINE_BREAK,
- Buffer,
- &FontInfo,
- &Blt,
- PointX,
- PointY,
- &RowInfoArray,
- &RowInfoArraySize,
- NULL
- );
+ HiiFont,
+ EFI_HII_IGNORE_IF_NO_GLYPH | EFI_HII_OUT_FLAG_CLIP |
+ EFI_HII_OUT_FLAG_CLIP_CLEAN_X | EFI_HII_OUT_FLAG_CLIP_CLEAN_Y |
+ EFI_HII_IGNORE_LINE_BREAK,
+ Buffer,
+ &FontInfo,
+ &Blt,
+ PointX,
+ PointY,
+ &RowInfoArray,
+ &RowInfoArraySize,
+ NULL
+ );
if (!EFI_ERROR (Status)) {
ASSERT (RowInfoArray != NULL);
@@ -514,9 +515,10 @@ InternalPrintGraphic (
Height = 0;
Delta = 0;
}
+
Status = UgaDraw->Blt (
UgaDraw,
- (EFI_UGA_PIXEL *) Blt->Image.Bitmap,
+ (EFI_UGA_PIXEL *)Blt->Image.Bitmap,
EfiUgaBltBufferToVideo,
PointX,
PointY,
@@ -529,10 +531,12 @@ InternalPrintGraphic (
} else {
goto Error;
}
+
FreePool (Blt->Image.Bitmap);
} else {
goto Error;
}
+
//
// Calculate the number of actual printed characters
//
@@ -550,6 +554,7 @@ Error:
if (Blt != NULL) {
FreePool (Blt);
}
+
return 0;
}
@@ -598,28 +603,28 @@ Error:
UINTN
EFIAPI
PrintXY (
- IN UINTN PointX,
- IN UINTN PointY,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround OPTIONAL,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround OPTIONAL,
- IN CONST CHAR16 *Format,
+ IN UINTN PointX,
+ IN UINTN PointY,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround OPTIONAL,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround OPTIONAL,
+ IN CONST CHAR16 *Format,
...
)
{
- VA_LIST Marker;
- CHAR16 *Buffer;
- UINTN BufferSize;
- UINTN PrintNum;
- UINTN ReturnNum;
+ VA_LIST Marker;
+ CHAR16 *Buffer;
+ UINTN BufferSize;
+ UINTN PrintNum;
+ UINTN ReturnNum;
ASSERT (Format != NULL);
- ASSERT (((UINTN) Format & BIT0) == 0);
+ ASSERT (((UINTN)Format & BIT0) == 0);
VA_START (Marker, Format);
BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);
- Buffer = (CHAR16 *) AllocatePool (BufferSize);
+ Buffer = (CHAR16 *)AllocatePool (BufferSize);
ASSERT (Buffer != NULL);
PrintNum = UnicodeVSPrint (Buffer, BufferSize, Format, Marker);
@@ -677,19 +682,19 @@ PrintXY (
UINTN
EFIAPI
AsciiPrintXY (
- IN UINTN PointX,
- IN UINTN PointY,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround OPTIONAL,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround OPTIONAL,
- IN CONST CHAR8 *Format,
+ IN UINTN PointX,
+ IN UINTN PointY,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround OPTIONAL,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround OPTIONAL,
+ IN CONST CHAR8 *Format,
...
)
{
- VA_LIST Marker;
- CHAR16 *Buffer;
- UINTN BufferSize;
- UINTN PrintNum;
- UINTN ReturnNum;
+ VA_LIST Marker;
+ CHAR16 *Buffer;
+ UINTN BufferSize;
+ UINTN PrintNum;
+ UINTN ReturnNum;
ASSERT (Format != NULL);
@@ -697,7 +702,7 @@ AsciiPrintXY (
BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);
- Buffer = (CHAR16 *) AllocatePool (BufferSize);
+ Buffer = (CHAR16 *)AllocatePool (BufferSize);
ASSERT (Buffer != NULL);
PrintNum = UnicodeSPrintAsciiFormat (Buffer, BufferSize, Format, Marker);
@@ -732,30 +737,30 @@ AsciiPrintXY (
@return Null-terminated Unicode string is that is the formatted
string appended to String.
**/
-CHAR16*
+CHAR16 *
EFIAPI
CatVSPrint (
- IN CHAR16 *String OPTIONAL,
+ IN CHAR16 *String OPTIONAL,
IN CONST CHAR16 *FormatString,
IN VA_LIST Marker
)
{
- UINTN CharactersRequired;
- UINTN SizeRequired;
- CHAR16 *BufferToReturn;
- VA_LIST ExtraMarker;
+ UINTN CharactersRequired;
+ UINTN SizeRequired;
+ CHAR16 *BufferToReturn;
+ VA_LIST ExtraMarker;
VA_COPY (ExtraMarker, Marker);
- CharactersRequired = SPrintLength(FormatString, ExtraMarker);
+ CharactersRequired = SPrintLength (FormatString, ExtraMarker);
VA_END (ExtraMarker);
if (String != NULL) {
- SizeRequired = StrSize(String) + (CharactersRequired * sizeof(CHAR16));
+ SizeRequired = StrSize (String) + (CharactersRequired * sizeof (CHAR16));
} else {
- SizeRequired = sizeof(CHAR16) + (CharactersRequired * sizeof(CHAR16));
+ SizeRequired = sizeof (CHAR16) + (CharactersRequired * sizeof (CHAR16));
}
- BufferToReturn = AllocatePool(SizeRequired);
+ BufferToReturn = AllocatePool (SizeRequired);
if (BufferToReturn == NULL) {
return NULL;
@@ -764,12 +769,12 @@ CatVSPrint (
}
if (String != NULL) {
- StrCpyS(BufferToReturn, SizeRequired / sizeof(CHAR16), String);
+ StrCpyS (BufferToReturn, SizeRequired / sizeof (CHAR16), String);
}
- UnicodeVSPrint(BufferToReturn + StrLen(BufferToReturn), (CharactersRequired+1) * sizeof(CHAR16), FormatString, Marker);
+ UnicodeVSPrint (BufferToReturn + StrLen (BufferToReturn), (CharactersRequired+1) * sizeof (CHAR16), FormatString, Marker);
- ASSERT(StrSize(BufferToReturn)==SizeRequired);
+ ASSERT (StrSize (BufferToReturn) == SizeRequired);
return (BufferToReturn);
}
@@ -800,16 +805,16 @@ CatVSPrint (
CHAR16 *
EFIAPI
CatSPrint (
- IN CHAR16 *String OPTIONAL,
+ IN CHAR16 *String OPTIONAL,
IN CONST CHAR16 *FormatString,
...
)
{
- VA_LIST Marker;
- CHAR16 *NewString;
+ VA_LIST Marker;
+ CHAR16 *NewString;
VA_START (Marker, FormatString);
- NewString = CatVSPrint(String, FormatString, Marker);
+ NewString = CatVSPrint (String, FormatString, Marker);
VA_END (Marker);
return NewString;
}
diff --git a/MdePkg/Library/UefiLib/UefiNotTiano.c b/MdePkg/Library/UefiLib/UefiNotTiano.c
index 32cc26cfc9..d84e91fd01 100644
--- a/MdePkg/Library/UefiLib/UefiNotTiano.c
+++ b/MdePkg/Library/UefiLib/UefiNotTiano.c
@@ -11,8 +11,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-
-
#include "UefiLibInternal.h"
/**
@@ -97,6 +95,7 @@ EfiCreateEventLegacyBootEx (
} else {
WorkerNotifyFunction = NotifyFunction;
}
+
Status = gBS->CreateEventEx (
EVT_NOTIFY_SIGNAL,
NotifyTpl,
@@ -192,6 +191,7 @@ EfiCreateEventReadyToBootEx (
} else {
WorkerNotifyFunction = NotifyFunction;
}
+
Status = gBS->CreateEventEx (
EVT_NOTIFY_SIGNAL,
NotifyTpl,
@@ -205,7 +205,6 @@ EfiCreateEventReadyToBootEx (
return Status;
}
-
/**
Create, Signal, and Close the Ready to Boot event using EfiSignalEventReadyToBoot().
@@ -221,8 +220,8 @@ EfiSignalEventReadyToBoot (
VOID
)
{
- EFI_STATUS Status;
- EFI_EVENT ReadyToBootEvent;
+ EFI_STATUS Status;
+ EFI_EVENT ReadyToBootEvent;
Status = EfiCreateEventReadyToBoot (&ReadyToBootEvent);
if (!EFI_ERROR (Status)) {
@@ -246,8 +245,8 @@ EfiSignalEventLegacyBoot (
VOID
)
{
- EFI_STATUS Status;
- EFI_EVENT LegacyBootEvent;
+ EFI_STATUS Status;
+ EFI_EVENT LegacyBootEvent;
Status = EfiCreateEventLegacyBoot (&LegacyBootEvent);
if (!EFI_ERROR (Status)) {
@@ -256,7 +255,6 @@ EfiSignalEventLegacyBoot (
}
}
-
/**
Check to see if the Firmware Volume (FV) Media Device Path is valid
@@ -283,15 +281,15 @@ EfiGetNameGuidFromFwVolDevicePathNode (
{
ASSERT (FvDevicePathNode != NULL);
- if (DevicePathType (&FvDevicePathNode->Header) == MEDIA_DEVICE_PATH &&
- DevicePathSubType (&FvDevicePathNode->Header) == MEDIA_PIWG_FW_FILE_DP) {
- return (EFI_GUID *) &FvDevicePathNode->FvFileName;
+ if ((DevicePathType (&FvDevicePathNode->Header) == MEDIA_DEVICE_PATH) &&
+ (DevicePathSubType (&FvDevicePathNode->Header) == MEDIA_PIWG_FW_FILE_DP))
+ {
+ return (EFI_GUID *)&FvDevicePathNode->FvFileName;
}
return NULL;
}
-
/**
Initialize a Firmware Volume (FV) Media Device Path node.
@@ -321,8 +319,8 @@ EfiInitializeFwVolDevicepathNode (
//
// Use the new Device path that does not conflict with the UEFI
//
- FvDevicePathNode->Header.Type = MEDIA_DEVICE_PATH;
- FvDevicePathNode->Header.SubType = MEDIA_PIWG_FW_FILE_DP;
+ FvDevicePathNode->Header.Type = MEDIA_DEVICE_PATH;
+ FvDevicePathNode->Header.SubType = MEDIA_PIWG_FW_FILE_DP;
SetDevicePathNodeLength (&FvDevicePathNode->Header, sizeof (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH));
CopyGuid (&FvDevicePathNode->FvFileName, NameGuid);
diff --git a/MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c b/MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c
index 554b6a7e8b..eb1226612f 100644
--- a/MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c
+++ b/MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c
@@ -7,10 +7,8 @@
**/
-
#include <Uefi.h>
-
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseMemoryLib.h>
@@ -46,7 +44,8 @@ InternalAllocatePages (
if (EFI_ERROR (Status)) {
return NULL;
}
- return (VOID *) (UINTN) Memory;
+
+ return (VOID *)(UINTN)Memory;
}
/**
@@ -142,7 +141,7 @@ FreePages (
EFI_STATUS Status;
ASSERT (Pages != 0);
- Status = gBS->FreePages ((EFI_PHYSICAL_ADDRESS) (UINTN) Buffer, Pages);
+ Status = gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, Pages);
ASSERT_EFI_ERROR (Status);
}
@@ -186,23 +185,25 @@ InternalAllocateAlignedPages (
if (Pages == 0) {
return NULL;
}
+
if (Alignment > EFI_PAGE_SIZE) {
//
// Calculate the total number of pages since alignment is larger than page size.
//
- AlignmentMask = Alignment - 1;
- RealPages = Pages + EFI_SIZE_TO_PAGES (Alignment);
+ AlignmentMask = Alignment - 1;
+ RealPages = Pages + EFI_SIZE_TO_PAGES (Alignment);
//
// Make sure that Pages plus EFI_SIZE_TO_PAGES (Alignment) does not overflow.
//
ASSERT (RealPages > Pages);
- Status = gBS->AllocatePages (AllocateAnyPages, MemoryType, RealPages, &Memory);
+ Status = gBS->AllocatePages (AllocateAnyPages, MemoryType, RealPages, &Memory);
if (EFI_ERROR (Status)) {
return NULL;
}
- AlignedMemory = ((UINTN) Memory + AlignmentMask) & ~AlignmentMask;
- UnalignedPages = EFI_SIZE_TO_PAGES (AlignedMemory - (UINTN) Memory);
+
+ AlignedMemory = ((UINTN)Memory + AlignmentMask) & ~AlignmentMask;
+ UnalignedPages = EFI_SIZE_TO_PAGES (AlignedMemory - (UINTN)Memory);
if (UnalignedPages > 0) {
//
// Free first unaligned page(s).
@@ -210,6 +211,7 @@ InternalAllocateAlignedPages (
Status = gBS->FreePages (Memory, UnalignedPages);
ASSERT_EFI_ERROR (Status);
}
+
Memory = AlignedMemory + EFI_PAGES_TO_SIZE (Pages);
UnalignedPages = RealPages - Pages - UnalignedPages;
if (UnalignedPages > 0) {
@@ -227,9 +229,11 @@ InternalAllocateAlignedPages (
if (EFI_ERROR (Status)) {
return NULL;
}
- AlignedMemory = (UINTN) Memory;
+
+ AlignedMemory = (UINTN)Memory;
}
- return (VOID *) AlignedMemory;
+
+ return (VOID *)AlignedMemory;
}
/**
@@ -343,7 +347,7 @@ FreeAlignedPages (
EFI_STATUS Status;
ASSERT (Pages != 0);
- Status = gBS->FreePages ((EFI_PHYSICAL_ADDRESS) (UINTN) Buffer, Pages);
+ Status = gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, Pages);
ASSERT_EFI_ERROR (Status);
}
@@ -373,6 +377,7 @@ InternalAllocatePool (
if (EFI_ERROR (Status)) {
Memory = NULL;
}
+
return Memory;
}
@@ -465,6 +470,7 @@ InternalAllocateZeroPool (
if (Memory != NULL) {
Memory = ZeroMem (Memory, AllocationSize);
}
+
return Memory;
}
@@ -561,12 +567,13 @@ InternalAllocateCopyPool (
VOID *Memory;
ASSERT (Buffer != NULL);
- ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));
+ ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN)Buffer + 1));
Memory = InternalAllocatePool (PoolType, AllocationSize);
if (Memory != NULL) {
- Memory = CopyMem (Memory, Buffer, AllocationSize);
+ Memory = CopyMem (Memory, Buffer, AllocationSize);
}
+
return Memory;
}
@@ -684,10 +691,11 @@ InternalReallocatePool (
VOID *NewBuffer;
NewBuffer = InternalAllocateZeroPool (PoolType, NewSize);
- if (NewBuffer != NULL && OldBuffer != NULL) {
+ if ((NewBuffer != NULL) && (OldBuffer != NULL)) {
CopyMem (NewBuffer, OldBuffer, MIN (OldSize, NewSize));
FreePool (OldBuffer);
}
+
return NewBuffer;
}
@@ -804,12 +812,11 @@ ReallocateReservedPool (
VOID
EFIAPI
FreePool (
- IN VOID *Buffer
+ IN VOID *Buffer
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
Status = gBS->FreePool (Buffer);
ASSERT_EFI_ERROR (Status);
}
-
diff --git a/MdePkg/Library/UefiMemoryLib/CompareMemWrapper.c b/MdePkg/Library/UefiMemoryLib/CompareMemWrapper.c
index 6c539a685e..5b65a1d264 100644
--- a/MdePkg/Library/UefiMemoryLib/CompareMemWrapper.c
+++ b/MdePkg/Library/UefiMemoryLib/CompareMemWrapper.c
@@ -48,9 +48,10 @@ CompareMem (
IN UINTN Length
)
{
- if (Length == 0 || DestinationBuffer == SourceBuffer) {
+ if ((Length == 0) || (DestinationBuffer == SourceBuffer)) {
return 0;
}
+
ASSERT (DestinationBuffer != NULL);
ASSERT (SourceBuffer != NULL);
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer));
diff --git a/MdePkg/Library/UefiMemoryLib/CopyMemWrapper.c b/MdePkg/Library/UefiMemoryLib/CopyMemWrapper.c
index 438abf4e86..dc48904766 100644
--- a/MdePkg/Library/UefiMemoryLib/CopyMemWrapper.c
+++ b/MdePkg/Library/UefiMemoryLib/CopyMemWrapper.c
@@ -47,11 +47,13 @@ CopyMem (
if (Length == 0) {
return DestinationBuffer;
}
+
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)SourceBuffer));
if (DestinationBuffer == SourceBuffer) {
return DestinationBuffer;
}
+
return InternalMemCopyMem (DestinationBuffer, SourceBuffer, Length);
}
diff --git a/MdePkg/Library/UefiMemoryLib/MemLib.c b/MdePkg/Library/UefiMemoryLib/MemLib.c
index 983db8c3f5..061281f9be 100644
--- a/MdePkg/Library/UefiMemoryLib/MemLib.c
+++ b/MdePkg/Library/UefiMemoryLib/MemLib.c
@@ -23,12 +23,12 @@
VOID *
EFIAPI
InternalMemCopyMem (
- OUT VOID *Destination,
- IN CONST VOID *Source,
- IN UINTN Length
+ OUT VOID *Destination,
+ IN CONST VOID *Source,
+ IN UINTN Length
)
{
- gBS->CopyMem (Destination, (VOID*)Source, Length);
+ gBS->CopyMem (Destination, (VOID *)Source, Length);
return Destination;
}
@@ -47,9 +47,9 @@ InternalMemCopyMem (
VOID *
EFIAPI
InternalMemSetMem (
- OUT VOID *Buffer,
- IN UINTN Size,
- IN UINT8 Value
+ OUT VOID *Buffer,
+ IN UINTN Size,
+ IN UINT8 Value
)
{
gBS->SetMem (Buffer, Size, Value);
diff --git a/MdePkg/Library/UefiMemoryLib/MemLibGeneric.c b/MdePkg/Library/UefiMemoryLib/MemLibGeneric.c
index 73ef0d92d1..1808d3f2b5 100644
--- a/MdePkg/Library/UefiMemoryLib/MemLibGeneric.c
+++ b/MdePkg/Library/UefiMemoryLib/MemLibGeneric.c
@@ -26,14 +26,15 @@
VOID *
EFIAPI
InternalMemSetMem16 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT16 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT16 Value
)
{
- for (; Length != 0; Length--) {
- ((UINT16*)Buffer)[Length - 1] = Value;
+ for ( ; Length != 0; Length--) {
+ ((UINT16 *)Buffer)[Length - 1] = Value;
}
+
return Buffer;
}
@@ -50,14 +51,15 @@ InternalMemSetMem16 (
VOID *
EFIAPI
InternalMemSetMem32 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT32 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT32 Value
)
{
- for (; Length != 0; Length--) {
- ((UINT32*)Buffer)[Length - 1] = Value;
+ for ( ; Length != 0; Length--) {
+ ((UINT32 *)Buffer)[Length - 1] = Value;
}
+
return Buffer;
}
@@ -74,14 +76,15 @@ InternalMemSetMem32 (
VOID *
EFIAPI
InternalMemSetMem64 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT64 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT64 Value
)
{
- for (; Length != 0; Length--) {
- ((UINT64*)Buffer)[Length - 1] = Value;
+ for ( ; Length != 0; Length--) {
+ ((UINT64 *)Buffer)[Length - 1] = Value;
}
+
return Buffer;
}
@@ -97,8 +100,8 @@ InternalMemSetMem64 (
VOID *
EFIAPI
InternalMemZeroMem (
- OUT VOID *Buffer,
- IN UINTN Length
+ OUT VOID *Buffer,
+ IN UINTN Length
)
{
return InternalMemSetMem (Buffer, Length, 0);
@@ -120,17 +123,19 @@ InternalMemZeroMem (
INTN
EFIAPI
InternalMemCompareMem (
- IN CONST VOID *DestinationBuffer,
- IN CONST VOID *SourceBuffer,
- IN UINTN Length
+ IN CONST VOID *DestinationBuffer,
+ IN CONST VOID *SourceBuffer,
+ IN UINTN Length
)
{
while ((--Length != 0) &&
- (*(INT8*)DestinationBuffer == *(INT8*)SourceBuffer)) {
- DestinationBuffer = (INT8*)DestinationBuffer + 1;
- SourceBuffer = (INT8*)SourceBuffer + 1;
+ (*(INT8 *)DestinationBuffer == *(INT8 *)SourceBuffer))
+ {
+ DestinationBuffer = (INT8 *)DestinationBuffer + 1;
+ SourceBuffer = (INT8 *)SourceBuffer + 1;
}
- return (INTN)*(UINT8*)DestinationBuffer - (INTN)*(UINT8*)SourceBuffer;
+
+ return (INTN)*(UINT8 *)DestinationBuffer - (INTN)*(UINT8 *)SourceBuffer;
}
/**
@@ -147,19 +152,20 @@ InternalMemCompareMem (
CONST VOID *
EFIAPI
InternalMemScanMem8 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT8 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT8 Value
)
{
- CONST UINT8 *Pointer;
+ CONST UINT8 *Pointer;
- Pointer = (CONST UINT8*)Buffer;
+ Pointer = (CONST UINT8 *)Buffer;
do {
if (*(Pointer++) == Value) {
return --Pointer;
}
} while (--Length != 0);
+
return NULL;
}
@@ -177,19 +183,20 @@ InternalMemScanMem8 (
CONST VOID *
EFIAPI
InternalMemScanMem16 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT16 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT16 Value
)
{
- CONST UINT16 *Pointer;
+ CONST UINT16 *Pointer;
- Pointer = (CONST UINT16*)Buffer;
+ Pointer = (CONST UINT16 *)Buffer;
do {
if (*(Pointer++) == Value) {
return --Pointer;
}
} while (--Length != 0);
+
return NULL;
}
@@ -207,19 +214,20 @@ InternalMemScanMem16 (
CONST VOID *
EFIAPI
InternalMemScanMem32 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT32 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT32 Value
)
{
- CONST UINT32 *Pointer;
+ CONST UINT32 *Pointer;
- Pointer = (CONST UINT32*)Buffer;
+ Pointer = (CONST UINT32 *)Buffer;
do {
if (*(Pointer++) == Value) {
return --Pointer;
}
} while (--Length != 0);
+
return NULL;
}
@@ -237,19 +245,20 @@ InternalMemScanMem32 (
CONST VOID *
EFIAPI
InternalMemScanMem64 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT64 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT64 Value
)
{
- CONST UINT64 *Pointer;
+ CONST UINT64 *Pointer;
- Pointer = (CONST UINT64*)Buffer;
+ Pointer = (CONST UINT64 *)Buffer;
do {
if (*(Pointer++) == Value) {
return --Pointer;
}
} while (--Length != 0);
+
return NULL;
}
@@ -270,8 +279,8 @@ InternalMemIsZeroBuffer (
IN UINTN Length
)
{
- CONST UINT8 *BufferData;
- UINTN Index;
+ CONST UINT8 *BufferData;
+ UINTN Index;
BufferData = Buffer;
for (Index = 0; Index < Length; Index++) {
@@ -279,5 +288,6 @@ InternalMemIsZeroBuffer (
return FALSE;
}
}
+
return TRUE;
}
diff --git a/MdePkg/Library/UefiMemoryLib/MemLibGuid.c b/MdePkg/Library/UefiMemoryLib/MemLibGuid.c
index 319487dda9..9ded5ca0f1 100644
--- a/MdePkg/Library/UefiMemoryLib/MemLibGuid.c
+++ b/MdePkg/Library/UefiMemoryLib/MemLibGuid.c
@@ -42,12 +42,12 @@ CopyGuid (
)
{
WriteUnaligned64 (
- (UINT64*)DestinationGuid,
- ReadUnaligned64 ((CONST UINT64*)SourceGuid)
+ (UINT64 *)DestinationGuid,
+ ReadUnaligned64 ((CONST UINT64 *)SourceGuid)
);
WriteUnaligned64 (
- (UINT64*)DestinationGuid + 1,
- ReadUnaligned64 ((CONST UINT64*)SourceGuid + 1)
+ (UINT64 *)DestinationGuid + 1,
+ ReadUnaligned64 ((CONST UINT64 *)SourceGuid + 1)
);
return DestinationGuid;
}
@@ -80,12 +80,12 @@ CompareGuid (
UINT64 HighPartOfGuid1;
UINT64 HighPartOfGuid2;
- LowPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1);
- LowPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2);
- HighPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1 + 1);
- HighPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2 + 1);
+ LowPartOfGuid1 = ReadUnaligned64 ((CONST UINT64 *)Guid1);
+ LowPartOfGuid2 = ReadUnaligned64 ((CONST UINT64 *)Guid2);
+ HighPartOfGuid1 = ReadUnaligned64 ((CONST UINT64 *)Guid1 + 1);
+ HighPartOfGuid2 = ReadUnaligned64 ((CONST UINT64 *)Guid2 + 1);
- return (BOOLEAN) (LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2);
+ return (BOOLEAN)(LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2);
}
/**
@@ -118,20 +118,22 @@ ScanGuid (
IN CONST GUID *Guid
)
{
- CONST GUID *GuidPtr;
+ CONST GUID *GuidPtr;
ASSERT (((UINTN)Buffer & (sizeof (Guid->Data1) - 1)) == 0);
ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1));
ASSERT ((Length & (sizeof (*GuidPtr) - 1)) == 0);
- GuidPtr = (GUID*)Buffer;
+ GuidPtr = (GUID *)Buffer;
Buffer = GuidPtr + Length / sizeof (*GuidPtr);
- while (GuidPtr < (CONST GUID*)Buffer) {
+ while (GuidPtr < (CONST GUID *)Buffer) {
if (CompareGuid (GuidPtr, Guid)) {
- return (VOID*)GuidPtr;
+ return (VOID *)GuidPtr;
}
+
GuidPtr++;
}
+
return NULL;
}
@@ -158,8 +160,8 @@ IsZeroGuid (
UINT64 LowPartOfGuid;
UINT64 HighPartOfGuid;
- LowPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid);
- HighPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid + 1);
+ LowPartOfGuid = ReadUnaligned64 ((CONST UINT64 *)Guid);
+ HighPartOfGuid = ReadUnaligned64 ((CONST UINT64 *)Guid + 1);
- return (BOOLEAN) (LowPartOfGuid == 0 && HighPartOfGuid == 0);
+ return (BOOLEAN)(LowPartOfGuid == 0 && HighPartOfGuid == 0);
}
diff --git a/MdePkg/Library/UefiMemoryLib/MemLibInternals.h b/MdePkg/Library/UefiMemoryLib/MemLibInternals.h
index cda2a52d72..0713234fe7 100644
--- a/MdePkg/Library/UefiMemoryLib/MemLibInternals.h
+++ b/MdePkg/Library/UefiMemoryLib/MemLibInternals.h
@@ -31,9 +31,9 @@
VOID *
EFIAPI
InternalMemCopyMem (
- OUT VOID *Destination,
- IN CONST VOID *Source,
- IN UINTN Length
+ OUT VOID *Destination,
+ IN CONST VOID *Source,
+ IN UINTN Length
);
/**
@@ -51,9 +51,9 @@ InternalMemCopyMem (
VOID *
EFIAPI
InternalMemSetMem (
- OUT VOID *Buffer,
- IN UINTN Size,
- IN UINT8 Value
+ OUT VOID *Buffer,
+ IN UINTN Size,
+ IN UINT8 Value
);
/**
@@ -69,9 +69,9 @@ InternalMemSetMem (
VOID *
EFIAPI
InternalMemSetMem16 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT16 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT16 Value
);
/**
@@ -87,9 +87,9 @@ InternalMemSetMem16 (
VOID *
EFIAPI
InternalMemSetMem32 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT32 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT32 Value
);
/**
@@ -105,9 +105,9 @@ InternalMemSetMem32 (
VOID *
EFIAPI
InternalMemSetMem64 (
- OUT VOID *Buffer,
- IN UINTN Length,
- IN UINT64 Value
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT64 Value
);
/**
@@ -122,8 +122,8 @@ InternalMemSetMem64 (
VOID *
EFIAPI
InternalMemZeroMem (
- OUT VOID *Buffer,
- IN UINTN Length
+ OUT VOID *Buffer,
+ IN UINTN Length
);
/**
@@ -142,9 +142,9 @@ InternalMemZeroMem (
INTN
EFIAPI
InternalMemCompareMem (
- IN CONST VOID *DestinationBuffer,
- IN CONST VOID *SourceBuffer,
- IN UINTN Length
+ IN CONST VOID *DestinationBuffer,
+ IN CONST VOID *SourceBuffer,
+ IN UINTN Length
);
/**
@@ -161,9 +161,9 @@ InternalMemCompareMem (
CONST VOID *
EFIAPI
InternalMemScanMem8 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT8 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT8 Value
);
/**
@@ -180,9 +180,9 @@ InternalMemScanMem8 (
CONST VOID *
EFIAPI
InternalMemScanMem16 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT16 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT16 Value
);
/**
@@ -199,9 +199,9 @@ InternalMemScanMem16 (
CONST VOID *
EFIAPI
InternalMemScanMem32 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT32 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT32 Value
);
/**
@@ -218,9 +218,9 @@ InternalMemScanMem32 (
CONST VOID *
EFIAPI
InternalMemScanMem64 (
- IN CONST VOID *Buffer,
- IN UINTN Length,
- IN UINT64 Value
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT64 Value
);
/**
diff --git a/MdePkg/Library/UefiMemoryLib/ScanMem16Wrapper.c b/MdePkg/Library/UefiMemoryLib/ScanMem16Wrapper.c
index 8201313523..7eeb1a48be 100644
--- a/MdePkg/Library/UefiMemoryLib/ScanMem16Wrapper.c
+++ b/MdePkg/Library/UefiMemoryLib/ScanMem16Wrapper.c
@@ -57,5 +57,5 @@ ScanMem16 (
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
- return (VOID*)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value);
+ return (VOID *)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value);
}
diff --git a/MdePkg/Library/UefiMemoryLib/ScanMem32Wrapper.c b/MdePkg/Library/UefiMemoryLib/ScanMem32Wrapper.c
index 22c0c79ff6..bdcee0e2eb 100644
--- a/MdePkg/Library/UefiMemoryLib/ScanMem32Wrapper.c
+++ b/MdePkg/Library/UefiMemoryLib/ScanMem32Wrapper.c
@@ -56,5 +56,5 @@ ScanMem32 (
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
- return (VOID*)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value);
+ return (VOID *)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value);
}
diff --git a/MdePkg/Library/UefiMemoryLib/ScanMem64Wrapper.c b/MdePkg/Library/UefiMemoryLib/ScanMem64Wrapper.c
index a617d870a0..eb75390d24 100644
--- a/MdePkg/Library/UefiMemoryLib/ScanMem64Wrapper.c
+++ b/MdePkg/Library/UefiMemoryLib/ScanMem64Wrapper.c
@@ -57,5 +57,5 @@ ScanMem64 (
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
- return (VOID*)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value);
+ return (VOID *)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value);
}
diff --git a/MdePkg/Library/UefiMemoryLib/ScanMem8Wrapper.c b/MdePkg/Library/UefiMemoryLib/ScanMem8Wrapper.c
index f2bf7d6f68..aa0de6442f 100644
--- a/MdePkg/Library/UefiMemoryLib/ScanMem8Wrapper.c
+++ b/MdePkg/Library/UefiMemoryLib/ScanMem8Wrapper.c
@@ -49,10 +49,11 @@ ScanMem8 (
if (Length == 0) {
return NULL;
}
+
ASSERT (Buffer != NULL);
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
- return (VOID*)InternalMemScanMem8 (Buffer, Length, Value);
+ return (VOID *)InternalMemScanMem8 (Buffer, Length, Value);
}
/**
@@ -90,4 +91,3 @@ ScanMemN (
return ScanMem32 (Buffer, Length, (UINT32)Value);
}
}
-
diff --git a/MdePkg/Library/UefiPciLibPciRootBridgeIo/PciLib.c b/MdePkg/Library/UefiPciLibPciRootBridgeIo/PciLib.c
index 57eb37c3e0..f4e9882eba 100644
--- a/MdePkg/Library/UefiPciLibPciRootBridgeIo/PciLib.c
+++ b/MdePkg/Library/UefiPciLibPciRootBridgeIo/PciLib.c
@@ -21,7 +21,7 @@
@param M Additional bits to assert to be zero.
**/
-#define ASSERT_INVALID_PCI_ADDRESS(A,M) \
+#define ASSERT_INVALID_PCI_ADDRESS(A, M) \
ASSERT (((A) & (~0xfffffff | (M))) == 0)
/**
@@ -37,7 +37,7 @@
//
// Global varible to cache pointer to PCI Root Bridge I/O protocol.
//
-EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *mPciRootBridgeIo = NULL;
+EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *mPciRootBridgeIo = NULL;
/**
The constructor function caches the pointer to PCI Root Bridge I/O protocol.
@@ -54,13 +54,13 @@ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *mPciRootBridgeIo = NULL;
EFI_STATUS
EFIAPI
PciLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
- Status = gBS->LocateProtocol (&gEfiPciRootBridgeIoProtocolGuid, NULL, (VOID**) &mPciRootBridgeIo);
+ Status = gBS->LocateProtocol (&gEfiPciRootBridgeIoProtocolGuid, NULL, (VOID **)&mPciRootBridgeIo);
ASSERT_EFI_ERROR (Status);
ASSERT (mPciRootBridgeIo != NULL);
@@ -182,12 +182,12 @@ PciRegisterForRuntimeAccess (
UINT8
EFIAPI
PciRead8 (
- IN UINTN Address
+ IN UINTN Address
)
{
ASSERT_INVALID_PCI_ADDRESS (Address, 0);
- return (UINT8) DxePciLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint8);
+ return (UINT8)DxePciLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint8);
}
/**
@@ -209,13 +209,13 @@ PciRead8 (
UINT8
EFIAPI
PciWrite8 (
- IN UINTN Address,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINT8 Value
)
{
ASSERT_INVALID_PCI_ADDRESS (Address, 0);
- return (UINT8) DxePciLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint8, Value);
+ return (UINT8)DxePciLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint8, Value);
}
/**
@@ -241,11 +241,11 @@ PciWrite8 (
UINT8
EFIAPI
PciOr8 (
- IN UINTN Address,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 OrData
)
{
- return PciWrite8 (Address, (UINT8) (PciRead8 (Address) | OrData));
+ return PciWrite8 (Address, (UINT8)(PciRead8 (Address) | OrData));
}
/**
@@ -271,11 +271,11 @@ PciOr8 (
UINT8
EFIAPI
PciAnd8 (
- IN UINTN Address,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINT8 AndData
)
{
- return PciWrite8 (Address, (UINT8) (PciRead8 (Address) & AndData));
+ return PciWrite8 (Address, (UINT8)(PciRead8 (Address) & AndData));
}
/**
@@ -303,12 +303,12 @@ PciAnd8 (
UINT8
EFIAPI
PciAndThenOr8 (
- IN UINTN Address,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
- return PciWrite8 (Address, (UINT8) ((PciRead8 (Address) & AndData) | OrData));
+ return PciWrite8 (Address, (UINT8)((PciRead8 (Address) & AndData) | OrData));
}
/**
@@ -335,9 +335,9 @@ PciAndThenOr8 (
UINT8
EFIAPI
PciBitFieldRead8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead8 (PciRead8 (Address), StartBit, EndBit);
@@ -370,10 +370,10 @@ PciBitFieldRead8 (
UINT8
EFIAPI
PciBitFieldWrite8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
return PciWrite8 (
@@ -412,10 +412,10 @@ PciBitFieldWrite8 (
UINT8
EFIAPI
PciBitFieldOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
return PciWrite8 (
@@ -454,10 +454,10 @@ PciBitFieldOr8 (
UINT8
EFIAPI
PciBitFieldAnd8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
return PciWrite8 (
@@ -500,11 +500,11 @@ PciBitFieldAnd8 (
UINT8
EFIAPI
PciBitFieldAndThenOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
return PciWrite8 (
@@ -532,12 +532,12 @@ PciBitFieldAndThenOr8 (
UINT16
EFIAPI
PciRead16 (
- IN UINTN Address
+ IN UINTN Address
)
{
ASSERT_INVALID_PCI_ADDRESS (Address, 1);
- return (UINT16) DxePciLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint16);
+ return (UINT16)DxePciLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint16);
}
/**
@@ -560,13 +560,13 @@ PciRead16 (
UINT16
EFIAPI
PciWrite16 (
- IN UINTN Address,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINT16 Value
)
{
ASSERT_INVALID_PCI_ADDRESS (Address, 1);
- return (UINT16) DxePciLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint16, Value);
+ return (UINT16)DxePciLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint16, Value);
}
/**
@@ -593,11 +593,11 @@ PciWrite16 (
UINT16
EFIAPI
PciOr16 (
- IN UINTN Address,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 OrData
)
{
- return PciWrite16 (Address, (UINT16) (PciRead16 (Address) | OrData));
+ return PciWrite16 (Address, (UINT16)(PciRead16 (Address) | OrData));
}
/**
@@ -624,11 +624,11 @@ PciOr16 (
UINT16
EFIAPI
PciAnd16 (
- IN UINTN Address,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINT16 AndData
)
{
- return PciWrite16 (Address, (UINT16) (PciRead16 (Address) & AndData));
+ return PciWrite16 (Address, (UINT16)(PciRead16 (Address) & AndData));
}
/**
@@ -657,12 +657,12 @@ PciAnd16 (
UINT16
EFIAPI
PciAndThenOr16 (
- IN UINTN Address,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
- return PciWrite16 (Address, (UINT16) ((PciRead16 (Address) & AndData) | OrData));
+ return PciWrite16 (Address, (UINT16)((PciRead16 (Address) & AndData) | OrData));
}
/**
@@ -690,9 +690,9 @@ PciAndThenOr16 (
UINT16
EFIAPI
PciBitFieldRead16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead16 (PciRead16 (Address), StartBit, EndBit);
@@ -726,10 +726,10 @@ PciBitFieldRead16 (
UINT16
EFIAPI
PciBitFieldWrite16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
return PciWrite16 (
@@ -769,10 +769,10 @@ PciBitFieldWrite16 (
UINT16
EFIAPI
PciBitFieldOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
return PciWrite16 (
@@ -812,10 +812,10 @@ PciBitFieldOr16 (
UINT16
EFIAPI
PciBitFieldAnd16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
return PciWrite16 (
@@ -859,11 +859,11 @@ PciBitFieldAnd16 (
UINT16
EFIAPI
PciBitFieldAndThenOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
return PciWrite16 (
@@ -891,7 +891,7 @@ PciBitFieldAndThenOr16 (
UINT32
EFIAPI
PciRead32 (
- IN UINTN Address
+ IN UINTN Address
)
{
ASSERT_INVALID_PCI_ADDRESS (Address, 3);
@@ -919,8 +919,8 @@ PciRead32 (
UINT32
EFIAPI
PciWrite32 (
- IN UINTN Address,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINT32 Value
)
{
ASSERT_INVALID_PCI_ADDRESS (Address, 3);
@@ -952,8 +952,8 @@ PciWrite32 (
UINT32
EFIAPI
PciOr32 (
- IN UINTN Address,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 OrData
)
{
return PciWrite32 (Address, PciRead32 (Address) | OrData);
@@ -983,8 +983,8 @@ PciOr32 (
UINT32
EFIAPI
PciAnd32 (
- IN UINTN Address,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINT32 AndData
)
{
return PciWrite32 (Address, PciRead32 (Address) & AndData);
@@ -1016,9 +1016,9 @@ PciAnd32 (
UINT32
EFIAPI
PciAndThenOr32 (
- IN UINTN Address,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return PciWrite32 (Address, (PciRead32 (Address) & AndData) | OrData);
@@ -1049,9 +1049,9 @@ PciAndThenOr32 (
UINT32
EFIAPI
PciBitFieldRead32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead32 (PciRead32 (Address), StartBit, EndBit);
@@ -1085,10 +1085,10 @@ PciBitFieldRead32 (
UINT32
EFIAPI
PciBitFieldWrite32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
return PciWrite32 (
@@ -1128,10 +1128,10 @@ PciBitFieldWrite32 (
UINT32
EFIAPI
PciBitFieldOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
return PciWrite32 (
@@ -1171,10 +1171,10 @@ PciBitFieldOr32 (
UINT32
EFIAPI
PciBitFieldAnd32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
return PciWrite32 (
@@ -1218,11 +1218,11 @@ PciBitFieldAnd32 (
UINT32
EFIAPI
PciBitFieldAndThenOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return PciWrite32 (
@@ -1257,12 +1257,12 @@ PciBitFieldAndThenOr32 (
UINTN
EFIAPI
PciReadBuffer (
- IN UINTN StartAddress,
- IN UINTN Size,
- OUT VOID *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Size,
+ OUT VOID *Buffer
)
{
- UINTN ReturnValue;
+ UINTN ReturnValue;
ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
@@ -1283,19 +1283,19 @@ PciReadBuffer (
// Read a byte if StartAddress is byte aligned
//
*(volatile UINT8 *)Buffer = PciRead8 (StartAddress);
- StartAddress += sizeof (UINT8);
- Size -= sizeof (UINT8);
- Buffer = (UINT8*)Buffer + 1;
+ StartAddress += sizeof (UINT8);
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *)Buffer + 1;
}
- if (Size >= sizeof (UINT16) && (StartAddress & BIT1) != 0) {
+ if ((Size >= sizeof (UINT16)) && ((StartAddress & BIT1) != 0)) {
//
// Read a word if StartAddress is word aligned
//
WriteUnaligned16 (Buffer, PciRead16 (StartAddress));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
while (Size >= sizeof (UINT32)) {
@@ -1304,8 +1304,8 @@ PciReadBuffer (
//
WriteUnaligned32 (Buffer, PciRead32 (StartAddress));
StartAddress += sizeof (UINT32);
- Size -= sizeof (UINT32);
- Buffer = (UINT32*)Buffer + 1;
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *)Buffer + 1;
}
if (Size >= sizeof (UINT16)) {
@@ -1314,8 +1314,8 @@ PciReadBuffer (
//
WriteUnaligned16 (Buffer, PciRead16 (StartAddress));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
if (Size >= sizeof (UINT8)) {
@@ -1355,12 +1355,12 @@ PciReadBuffer (
UINTN
EFIAPI
PciWriteBuffer (
- IN UINTN StartAddress,
- IN UINTN Size,
- IN VOID *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Size,
+ IN VOID *Buffer
)
{
- UINTN ReturnValue;
+ UINTN ReturnValue;
ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
@@ -1380,20 +1380,20 @@ PciWriteBuffer (
//
// Write a byte if StartAddress is byte aligned
//
- PciWrite8 (StartAddress, *(UINT8*)Buffer);
+ PciWrite8 (StartAddress, *(UINT8 *)Buffer);
StartAddress += sizeof (UINT8);
- Size -= sizeof (UINT8);
- Buffer = (UINT8*)Buffer + 1;
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *)Buffer + 1;
}
- if (Size >= sizeof (UINT16) && (StartAddress & BIT1) != 0) {
+ if ((Size >= sizeof (UINT16)) && ((StartAddress & BIT1) != 0)) {
//
// Write a word if StartAddress is word aligned
//
PciWrite16 (StartAddress, ReadUnaligned16 (Buffer));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
while (Size >= sizeof (UINT32)) {
@@ -1402,8 +1402,8 @@ PciWriteBuffer (
//
PciWrite32 (StartAddress, ReadUnaligned32 (Buffer));
StartAddress += sizeof (UINT32);
- Size -= sizeof (UINT32);
- Buffer = (UINT32*)Buffer + 1;
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *)Buffer + 1;
}
if (Size >= sizeof (UINT16)) {
@@ -1412,15 +1412,15 @@ PciWriteBuffer (
//
PciWrite16 (StartAddress, ReadUnaligned16 (Buffer));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
if (Size >= sizeof (UINT8)) {
//
// Write the last remaining byte if exist
//
- PciWrite8 (StartAddress, *(UINT8*)Buffer);
+ PciWrite8 (StartAddress, *(UINT8 *)Buffer);
}
return ReturnValue;
diff --git a/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/PciSegmentLib.c b/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/PciSegmentLib.c
index 65f2fa3071..c7988367cf 100644
--- a/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/PciSegmentLib.c
+++ b/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/PciSegmentLib.c
@@ -11,8 +11,8 @@
//
// Global variable to record data of PCI Root Bridge I/O Protocol instances
//
-PCI_ROOT_BRIDGE_DATA *mPciRootBridgeData = NULL;
-UINTN mNumberOfPciRootBridges = 0;
+PCI_ROOT_BRIDGE_DATA *mPciRootBridgeData = NULL;
+UINTN mNumberOfPciRootBridges = 0;
/**
The constructor function caches data of PCI Root Bridge I/O Protocol instances.
@@ -30,16 +30,16 @@ UINTN mNumberOfPciRootBridges = 0;
EFI_STATUS
EFIAPI
PciSegmentLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- UINTN Index;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;
+ EFI_STATUS Status;
+ UINTN Index;
+ UINTN HandleCount;
+ EFI_HANDLE *HandleBuffer;
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
+ EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;
HandleCount = 0;
HandleBuffer = NULL;
@@ -68,14 +68,14 @@ PciSegmentLibConstructor (
Status = gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiPciRootBridgeIoProtocolGuid,
- (VOID **) &PciRootBridgeIo
+ (VOID **)&PciRootBridgeIo
);
ASSERT_EFI_ERROR (Status);
mPciRootBridgeData[Index].PciRootBridgeIo = PciRootBridgeIo;
mPciRootBridgeData[Index].SegmentNumber = PciRootBridgeIo->SegmentNumber;
- Status = PciRootBridgeIo->Configuration (PciRootBridgeIo, (VOID **) &Descriptors);
+ Status = PciRootBridgeIo->Configuration (PciRootBridgeIo, (VOID **)&Descriptors);
ASSERT_EFI_ERROR (Status);
while (Descriptors->Desc != ACPI_END_TAG_DESCRIPTOR) {
@@ -84,12 +84,14 @@ PciSegmentLibConstructor (
mPciRootBridgeData[Index].MaxBusNumber = Descriptors->AddrRangeMax;
break;
}
+
Descriptors++;
}
+
ASSERT (Descriptors->Desc != ACPI_END_TAG_DESCRIPTOR);
}
- FreePool(HandleBuffer);
+ FreePool (HandleBuffer);
return EFI_SUCCESS;
}
@@ -109,8 +111,8 @@ PciSegmentLibConstructor (
EFI_STATUS
EFIAPI
PciSegmentLibDestructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
FreePool (mPciRootBridgeData);
@@ -132,12 +134,12 @@ PciSegmentLibDestructor (
**/
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *
PciSegmentLibSearchForRootBridge (
- IN UINT64 Address
+ IN UINT64 Address
)
{
- UINTN Index;
- UINT64 SegmentNumber;
- UINT64 BusNumber;
+ UINTN Index;
+ UINT64 SegmentNumber;
+ UINT64 BusNumber;
for (Index = 0; Index < mNumberOfPciRootBridges; Index++) {
//
@@ -149,11 +151,12 @@ PciSegmentLibSearchForRootBridge (
// Matches the bus number of address with bus number range of protocol instance.
//
BusNumber = BitFieldRead64 (Address, 20, 27);
- if (BusNumber >= mPciRootBridgeData[Index].MinBusNumber && BusNumber <= mPciRootBridgeData[Index].MaxBusNumber) {
+ if ((BusNumber >= mPciRootBridgeData[Index].MinBusNumber) && (BusNumber <= mPciRootBridgeData[Index].MaxBusNumber)) {
return mPciRootBridgeData[Index].PciRootBridgeIo;
}
}
}
+
return NULL;
}
@@ -177,8 +180,8 @@ DxePciSegmentLibPciRootBridgeIoReadWorker (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width
)
{
- UINT32 Data;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
+ UINT32 Data;
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
PciRootBridgeIo = PciSegmentLibSearchForRootBridge (Address);
ASSERT (PciRootBridgeIo != NULL);
@@ -217,7 +220,7 @@ DxePciSegmentLibPciRootBridgeIoWriteWorker (
IN UINT32 Data
)
{
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
PciRootBridgeIo = PciSegmentLibSearchForRootBridge (Address);
ASSERT (PciRootBridgeIo != NULL);
@@ -277,12 +280,12 @@ PciSegmentRegisterForRuntimeAccess (
UINT8
EFIAPI
PciSegmentRead8 (
- IN UINT64 Address
+ IN UINT64 Address
)
{
ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0);
- return (UINT8) DxePciSegmentLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint8);
+ return (UINT8)DxePciSegmentLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint8);
}
/**
@@ -302,13 +305,13 @@ PciSegmentRead8 (
UINT8
EFIAPI
PciSegmentWrite8 (
- IN UINT64 Address,
- IN UINT8 Value
+ IN UINT64 Address,
+ IN UINT8 Value
)
{
ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0);
- return (UINT8) DxePciSegmentLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint8, Value);
+ return (UINT8)DxePciSegmentLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint8, Value);
}
/**
@@ -331,11 +334,11 @@ PciSegmentWrite8 (
UINT8
EFIAPI
PciSegmentOr8 (
- IN UINT64 Address,
- IN UINT8 OrData
+ IN UINT64 Address,
+ IN UINT8 OrData
)
{
- return PciSegmentWrite8 (Address, (UINT8) (PciSegmentRead8 (Address) | OrData));
+ return PciSegmentWrite8 (Address, (UINT8)(PciSegmentRead8 (Address) | OrData));
}
/**
@@ -357,11 +360,11 @@ PciSegmentOr8 (
UINT8
EFIAPI
PciSegmentAnd8 (
- IN UINT64 Address,
- IN UINT8 AndData
+ IN UINT64 Address,
+ IN UINT8 AndData
)
{
- return PciSegmentWrite8 (Address, (UINT8) (PciSegmentRead8 (Address) & AndData));
+ return PciSegmentWrite8 (Address, (UINT8)(PciSegmentRead8 (Address) & AndData));
}
/**
@@ -387,12 +390,12 @@ PciSegmentAnd8 (
UINT8
EFIAPI
PciSegmentAndThenOr8 (
- IN UINT64 Address,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINT64 Address,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
- return PciSegmentWrite8 (Address, (UINT8) ((PciSegmentRead8 (Address) & AndData) | OrData));
+ return PciSegmentWrite8 (Address, (UINT8)((PciSegmentRead8 (Address) & AndData) | OrData));
}
/**
@@ -419,9 +422,9 @@ PciSegmentAndThenOr8 (
UINT8
EFIAPI
PciSegmentBitFieldRead8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead8 (PciSegmentRead8 (Address), StartBit, EndBit);
@@ -454,10 +457,10 @@ PciSegmentBitFieldRead8 (
UINT8
EFIAPI
PciSegmentBitFieldWrite8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
return PciSegmentWrite8 (
@@ -496,10 +499,10 @@ PciSegmentBitFieldWrite8 (
UINT8
EFIAPI
PciSegmentBitFieldOr8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
return PciSegmentWrite8 (
@@ -538,10 +541,10 @@ PciSegmentBitFieldOr8 (
UINT8
EFIAPI
PciSegmentBitFieldAnd8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
return PciSegmentWrite8 (
@@ -583,11 +586,11 @@ PciSegmentBitFieldAnd8 (
UINT8
EFIAPI
PciSegmentBitFieldAndThenOr8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
return PciSegmentWrite8 (
@@ -613,12 +616,12 @@ PciSegmentBitFieldAndThenOr8 (
UINT16
EFIAPI
PciSegmentRead16 (
- IN UINT64 Address
+ IN UINT64 Address
)
{
ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 1);
- return (UINT16) DxePciSegmentLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint16);
+ return (UINT16)DxePciSegmentLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint16);
}
/**
@@ -639,13 +642,13 @@ PciSegmentRead16 (
UINT16
EFIAPI
PciSegmentWrite16 (
- IN UINT64 Address,
- IN UINT16 Value
+ IN UINT64 Address,
+ IN UINT16 Value
)
{
ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 1);
- return (UINT16) DxePciSegmentLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint16, Value);
+ return (UINT16)DxePciSegmentLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint16, Value);
}
/**
@@ -671,11 +674,11 @@ PciSegmentWrite16 (
UINT16
EFIAPI
PciSegmentOr16 (
- IN UINT64 Address,
- IN UINT16 OrData
+ IN UINT64 Address,
+ IN UINT16 OrData
)
{
- return PciSegmentWrite16 (Address, (UINT16) (PciSegmentRead16 (Address) | OrData));
+ return PciSegmentWrite16 (Address, (UINT16)(PciSegmentRead16 (Address) | OrData));
}
/**
@@ -699,11 +702,11 @@ PciSegmentOr16 (
UINT16
EFIAPI
PciSegmentAnd16 (
- IN UINT64 Address,
- IN UINT16 AndData
+ IN UINT64 Address,
+ IN UINT16 AndData
)
{
- return PciSegmentWrite16 (Address, (UINT16) (PciSegmentRead16 (Address) & AndData));
+ return PciSegmentWrite16 (Address, (UINT16)(PciSegmentRead16 (Address) & AndData));
}
/**
@@ -730,12 +733,12 @@ PciSegmentAnd16 (
UINT16
EFIAPI
PciSegmentAndThenOr16 (
- IN UINT64 Address,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINT64 Address,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
- return PciSegmentWrite16 (Address, (UINT16) ((PciSegmentRead16 (Address) & AndData) | OrData));
+ return PciSegmentWrite16 (Address, (UINT16)((PciSegmentRead16 (Address) & AndData) | OrData));
}
/**
@@ -763,9 +766,9 @@ PciSegmentAndThenOr16 (
UINT16
EFIAPI
PciSegmentBitFieldRead16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead16 (PciSegmentRead16 (Address), StartBit, EndBit);
@@ -799,10 +802,10 @@ PciSegmentBitFieldRead16 (
UINT16
EFIAPI
PciSegmentBitFieldWrite16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
return PciSegmentWrite16 (
@@ -842,10 +845,10 @@ PciSegmentBitFieldWrite16 (
UINT16
EFIAPI
PciSegmentBitFieldOr16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
return PciSegmentWrite16 (
@@ -885,10 +888,10 @@ PciSegmentBitFieldOr16 (
UINT16
EFIAPI
PciSegmentBitFieldAnd16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
return PciSegmentWrite16 (
@@ -931,11 +934,11 @@ PciSegmentBitFieldAnd16 (
UINT16
EFIAPI
PciSegmentBitFieldAndThenOr16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
return PciSegmentWrite16 (
@@ -961,7 +964,7 @@ PciSegmentBitFieldAndThenOr16 (
UINT32
EFIAPI
PciSegmentRead32 (
- IN UINT64 Address
+ IN UINT64 Address
)
{
ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 3);
@@ -987,8 +990,8 @@ PciSegmentRead32 (
UINT32
EFIAPI
PciSegmentWrite32 (
- IN UINT64 Address,
- IN UINT32 Value
+ IN UINT64 Address,
+ IN UINT32 Value
)
{
ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 3);
@@ -1017,8 +1020,8 @@ PciSegmentWrite32 (
UINT32
EFIAPI
PciSegmentOr32 (
- IN UINT64 Address,
- IN UINT32 OrData
+ IN UINT64 Address,
+ IN UINT32 OrData
)
{
return PciSegmentWrite32 (Address, PciSegmentRead32 (Address) | OrData);
@@ -1045,8 +1048,8 @@ PciSegmentOr32 (
UINT32
EFIAPI
PciSegmentAnd32 (
- IN UINT64 Address,
- IN UINT32 AndData
+ IN UINT64 Address,
+ IN UINT32 AndData
)
{
return PciSegmentWrite32 (Address, PciSegmentRead32 (Address) & AndData);
@@ -1076,9 +1079,9 @@ PciSegmentAnd32 (
UINT32
EFIAPI
PciSegmentAndThenOr32 (
- IN UINT64 Address,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINT64 Address,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return PciSegmentWrite32 (Address, (PciSegmentRead32 (Address) & AndData) | OrData);
@@ -1109,9 +1112,9 @@ PciSegmentAndThenOr32 (
UINT32
EFIAPI
PciSegmentBitFieldRead32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead32 (PciSegmentRead32 (Address), StartBit, EndBit);
@@ -1145,10 +1148,10 @@ PciSegmentBitFieldRead32 (
UINT32
EFIAPI
PciSegmentBitFieldWrite32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
return PciSegmentWrite32 (
@@ -1187,10 +1190,10 @@ PciSegmentBitFieldWrite32 (
UINT32
EFIAPI
PciSegmentBitFieldOr32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
return PciSegmentWrite32 (
@@ -1229,10 +1232,10 @@ PciSegmentBitFieldOr32 (
UINT32
EFIAPI
PciSegmentBitFieldAnd32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
return PciSegmentWrite32 (
@@ -1275,11 +1278,11 @@ PciSegmentBitFieldAnd32 (
UINT32
EFIAPI
PciSegmentBitFieldAndThenOr32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return PciSegmentWrite32 (
@@ -1314,12 +1317,12 @@ PciSegmentBitFieldAndThenOr32 (
UINTN
EFIAPI
PciSegmentReadBuffer (
- IN UINT64 StartAddress,
- IN UINTN Size,
- OUT VOID *Buffer
+ IN UINT64 StartAddress,
+ IN UINTN Size,
+ OUT VOID *Buffer
)
{
- UINTN ReturnValue;
+ UINTN ReturnValue;
ASSERT_INVALID_PCI_SEGMENT_ADDRESS (StartAddress, 0);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
@@ -1340,19 +1343,19 @@ PciSegmentReadBuffer (
// Read a byte if StartAddress is byte aligned
//
*(volatile UINT8 *)Buffer = PciSegmentRead8 (StartAddress);
- StartAddress += sizeof (UINT8);
- Size -= sizeof (UINT8);
- Buffer = (UINT8*)Buffer + 1;
+ StartAddress += sizeof (UINT8);
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *)Buffer + 1;
}
- if (Size >= sizeof (UINT16) && (StartAddress & BIT1) != 0) {
+ if ((Size >= sizeof (UINT16)) && ((StartAddress & BIT1) != 0)) {
//
// Read a word if StartAddress is word aligned
//
WriteUnaligned16 (Buffer, PciSegmentRead16 (StartAddress));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
while (Size >= sizeof (UINT32)) {
@@ -1361,8 +1364,8 @@ PciSegmentReadBuffer (
//
WriteUnaligned32 (Buffer, PciSegmentRead32 (StartAddress));
StartAddress += sizeof (UINT32);
- Size -= sizeof (UINT32);
- Buffer = (UINT32*)Buffer + 1;
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *)Buffer + 1;
}
if (Size >= sizeof (UINT16)) {
@@ -1371,8 +1374,8 @@ PciSegmentReadBuffer (
//
WriteUnaligned16 (Buffer, PciSegmentRead16 (StartAddress));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
if (Size >= sizeof (UINT8)) {
@@ -1412,12 +1415,12 @@ PciSegmentReadBuffer (
UINTN
EFIAPI
PciSegmentWriteBuffer (
- IN UINT64 StartAddress,
- IN UINTN Size,
- IN VOID *Buffer
+ IN UINT64 StartAddress,
+ IN UINTN Size,
+ IN VOID *Buffer
)
{
- UINTN ReturnValue;
+ UINTN ReturnValue;
ASSERT_INVALID_PCI_SEGMENT_ADDRESS (StartAddress, 0);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
@@ -1437,20 +1440,20 @@ PciSegmentWriteBuffer (
//
// Write a byte if StartAddress is byte aligned
//
- PciSegmentWrite8 (StartAddress, *(UINT8*)Buffer);
+ PciSegmentWrite8 (StartAddress, *(UINT8 *)Buffer);
StartAddress += sizeof (UINT8);
- Size -= sizeof (UINT8);
- Buffer = (UINT8*)Buffer + 1;
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *)Buffer + 1;
}
- if (Size >= sizeof (UINT16) && (StartAddress & BIT1) != 0) {
+ if ((Size >= sizeof (UINT16)) && ((StartAddress & BIT1) != 0)) {
//
// Write a word if StartAddress is word aligned
//
PciSegmentWrite16 (StartAddress, ReadUnaligned16 (Buffer));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
while (Size >= sizeof (UINT32)) {
@@ -1459,8 +1462,8 @@ PciSegmentWriteBuffer (
//
PciSegmentWrite32 (StartAddress, ReadUnaligned32 (Buffer));
StartAddress += sizeof (UINT32);
- Size -= sizeof (UINT32);
- Buffer = (UINT32*)Buffer + 1;
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *)Buffer + 1;
}
if (Size >= sizeof (UINT16)) {
@@ -1469,15 +1472,15 @@ PciSegmentWriteBuffer (
//
PciSegmentWrite16 (StartAddress, ReadUnaligned16 (Buffer));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
if (Size >= sizeof (UINT8)) {
//
// Write the last remaining byte if exist
//
- PciSegmentWrite8 (StartAddress, *(UINT8*)Buffer);
+ PciSegmentWrite8 (StartAddress, *(UINT8 *)Buffer);
}
return ReturnValue;
diff --git a/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/PciSegmentLib.h b/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/PciSegmentLib.h
index 693702f3e0..8c2f6b4d55 100644
--- a/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/PciSegmentLib.h
+++ b/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/PciSegmentLib.h
@@ -9,7 +9,6 @@
#ifndef __DXE_PCI_SEGMENT_LIB__
#define __DXE_PCI_SEGMENT_LIB__
-
#include <Protocol/PciRootBridgeIo.h>
#include <Library/PciSegmentLib.h>
@@ -35,7 +34,7 @@ typedef struct {
@param M Additional bits to assert to be zero.
**/
-#define ASSERT_INVALID_PCI_SEGMENT_ADDRESS(A,M) \
+#define ASSERT_INVALID_PCI_SEGMENT_ADDRESS(A, M) \
ASSERT (((A) & (0xffff0000f0000000ULL | (M))) == 0)
/**
diff --git a/MdePkg/Library/UefiRuntimeLib/RuntimeLib.c b/MdePkg/Library/UefiRuntimeLib/RuntimeLib.c
index a2eadafac8..ffc4cf4d2a 100644
--- a/MdePkg/Library/UefiRuntimeLib/RuntimeLib.c
+++ b/MdePkg/Library/UefiRuntimeLib/RuntimeLib.c
@@ -21,11 +21,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
///
/// Driver Lib Module Globals
///
-EFI_EVENT mEfiVirtualNotifyEvent;
-EFI_EVENT mEfiExitBootServicesEvent;
-BOOLEAN mEfiGoneVirtual = FALSE;
-BOOLEAN mEfiAtRuntime = FALSE;
-EFI_RUNTIME_SERVICES *mInternalRT;
+EFI_EVENT mEfiVirtualNotifyEvent;
+EFI_EVENT mEfiExitBootServicesEvent;
+BOOLEAN mEfiGoneVirtual = FALSE;
+BOOLEAN mEfiAtRuntime = FALSE;
+EFI_RUNTIME_SERVICES *mInternalRT;
/**
Set AtRuntime flag as TRUE after ExitBootServices.
@@ -37,8 +37,8 @@ EFI_RUNTIME_SERVICES *mInternalRT;
VOID
EFIAPI
RuntimeLibExitBootServicesEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
mEfiAtRuntime = TRUE;
@@ -55,14 +55,14 @@ RuntimeLibExitBootServicesEvent (
VOID
EFIAPI
RuntimeLibVirtualNotifyEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
//
// Update global for Runtime Services Table and IO
//
- EfiConvertPointer (0, (VOID **) &mInternalRT);
+ EfiConvertPointer (0, (VOID **)&mInternalRT);
mEfiGoneVirtual = TRUE;
}
@@ -80,8 +80,8 @@ RuntimeLibVirtualNotifyEvent (
EFI_STATUS
EFIAPI
RuntimeDriverLibConstruct (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
@@ -192,7 +192,6 @@ EfiGoneVirtual (
return mEfiGoneVirtual;
}
-
/**
This service is a wrapper for the UEFI Runtime Service ResetSystem().
@@ -225,16 +224,15 @@ EfiGoneVirtual (
VOID
EFIAPI
EfiResetSystem (
- IN EFI_RESET_TYPE ResetType,
- IN EFI_STATUS ResetStatus,
- IN UINTN DataSize,
- IN VOID *ResetData OPTIONAL
+ IN EFI_RESET_TYPE ResetType,
+ IN EFI_STATUS ResetStatus,
+ IN UINTN DataSize,
+ IN VOID *ResetData OPTIONAL
)
{
mInternalRT->ResetSystem (ResetType, ResetStatus, DataSize, ResetData);
}
-
/**
This service is a wrapper for the UEFI Runtime Service GetTime().
@@ -259,14 +257,13 @@ EfiResetSystem (
EFI_STATUS
EFIAPI
EfiGetTime (
- OUT EFI_TIME *Time,
- OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL
+ OUT EFI_TIME *Time,
+ OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL
)
{
return mInternalRT->GetTime (Time, Capabilities);
}
-
/**
This service is a wrapper for the UEFI Runtime Service SetTime().
@@ -292,13 +289,12 @@ EfiGetTime (
EFI_STATUS
EFIAPI
EfiSetTime (
- IN EFI_TIME *Time
+ IN EFI_TIME *Time
)
{
return mInternalRT->SetTime (Time);
}
-
/**
This service is a wrapper for the UEFI Runtime Service GetWakeupTime().
@@ -323,16 +319,14 @@ EfiSetTime (
EFI_STATUS
EFIAPI
EfiGetWakeupTime (
- OUT BOOLEAN *Enabled,
- OUT BOOLEAN *Pending,
- OUT EFI_TIME *Time
+ OUT BOOLEAN *Enabled,
+ OUT BOOLEAN *Pending,
+ OUT EFI_TIME *Time
)
{
return mInternalRT->GetWakeupTime (Enabled, Pending, Time);
}
-
-
/**
This service is a wrapper for the UEFI Runtime Service SetWakeupTime()
@@ -358,14 +352,13 @@ EfiGetWakeupTime (
EFI_STATUS
EFIAPI
EfiSetWakeupTime (
- IN BOOLEAN Enable,
- IN EFI_TIME *Time OPTIONAL
+ IN BOOLEAN Enable,
+ IN EFI_TIME *Time OPTIONAL
)
{
return mInternalRT->SetWakeupTime (Enable, Time);
}
-
/**
This service is a wrapper for the UEFI Runtime Service GetVariable().
@@ -399,17 +392,16 @@ EfiSetWakeupTime (
EFI_STATUS
EFIAPI
EfiGetVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- OUT UINT32 *Attributes OPTIONAL,
- IN OUT UINTN *DataSize,
- OUT VOID *Data
+ IN CHAR16 *VariableName,
+ IN EFI_GUID *VendorGuid,
+ OUT UINT32 *Attributes OPTIONAL,
+ IN OUT UINTN *DataSize,
+ OUT VOID *Data
)
{
return mInternalRT->GetVariable (VariableName, VendorGuid, Attributes, DataSize, Data);
}
-
/**
This service is a wrapper for the UEFI Runtime Service GetNextVariableName().
@@ -443,15 +435,14 @@ EfiGetVariable (
EFI_STATUS
EFIAPI
EfiGetNextVariableName (
- IN OUT UINTN *VariableNameSize,
- IN OUT CHAR16 *VariableName,
- IN OUT EFI_GUID *VendorGuid
+ IN OUT UINTN *VariableNameSize,
+ IN OUT CHAR16 *VariableName,
+ IN OUT EFI_GUID *VendorGuid
)
{
return mInternalRT->GetNextVariableName (VariableNameSize, VariableName, VendorGuid);
}
-
/**
This service is a wrapper for the UEFI Runtime Service GetNextVariableName()
@@ -484,17 +475,16 @@ EfiGetNextVariableName (
EFI_STATUS
EFIAPI
EfiSetVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- IN UINT32 Attributes,
- IN UINTN DataSize,
- IN VOID *Data
+ IN CHAR16 *VariableName,
+ IN EFI_GUID *VendorGuid,
+ IN UINT32 Attributes,
+ IN UINTN DataSize,
+ IN VOID *Data
)
{
return mInternalRT->SetVariable (VariableName, VendorGuid, Attributes, DataSize, Data);
}
-
/**
This service is a wrapper for the UEFI Runtime Service GetNextHighMonotonicCount().
@@ -514,13 +504,12 @@ EfiSetVariable (
EFI_STATUS
EFIAPI
EfiGetNextHighMonotonicCount (
- OUT UINT32 *HighCount
+ OUT UINT32 *HighCount
)
{
return mInternalRT->GetNextHighMonotonicCount (HighCount);
}
-
/**
This service is a wrapper for the UEFI Runtime Service ConvertPointer().
@@ -542,14 +531,13 @@ EfiGetNextHighMonotonicCount (
EFI_STATUS
EFIAPI
EfiConvertPointer (
- IN UINTN DebugDisposition,
- IN OUT VOID **Address
+ IN UINTN DebugDisposition,
+ IN OUT VOID **Address
)
{
return gRT->ConvertPointer (DebugDisposition, Address);
}
-
/**
Determines the new virtual address that is to be used on subsequent memory accesses.
@@ -575,14 +563,13 @@ EfiConvertPointer (
EFI_STATUS
EFIAPI
EfiConvertFunctionPointer (
- IN UINTN DebugDisposition,
- IN OUT VOID **Address
+ IN UINTN DebugDisposition,
+ IN OUT VOID **Address
)
{
return EfiConvertPointer (DebugDisposition, Address);
}
-
/**
Convert the standard Lib double linked list to a virtual mapping.
@@ -600,8 +587,8 @@ EfiConvertFunctionPointer (
EFI_STATUS
EFIAPI
EfiConvertList (
- IN UINTN DebugDisposition,
- IN OUT LIST_ENTRY *ListHead
+ IN UINTN DebugDisposition,
+ IN OUT LIST_ENTRY *ListHead
)
{
LIST_ENTRY *Link;
@@ -623,20 +610,20 @@ EfiConvertList (
EfiConvertPointer (
Link->ForwardLink == ListHead ? DebugDisposition : 0,
- (VOID **) &Link->ForwardLink
+ (VOID **)&Link->ForwardLink
);
EfiConvertPointer (
Link->BackLink == ListHead ? DebugDisposition : 0,
- (VOID **) &Link->BackLink
+ (VOID **)&Link->BackLink
);
Link = NextLink;
} while (Link != ListHead);
+
return EFI_SUCCESS;
}
-
/**
This service is a wrapper for the UEFI Runtime Service SetVirtualAddressMap().
@@ -666,21 +653,20 @@ EfiConvertList (
EFI_STATUS
EFIAPI
EfiSetVirtualAddressMap (
- IN UINTN MemoryMapSize,
- IN UINTN DescriptorSize,
- IN UINT32 DescriptorVersion,
- IN CONST EFI_MEMORY_DESCRIPTOR *VirtualMap
+ IN UINTN MemoryMapSize,
+ IN UINTN DescriptorSize,
+ IN UINT32 DescriptorVersion,
+ IN CONST EFI_MEMORY_DESCRIPTOR *VirtualMap
)
{
return mInternalRT->SetVirtualAddressMap (
MemoryMapSize,
DescriptorSize,
DescriptorVersion,
- (EFI_MEMORY_DESCRIPTOR *) VirtualMap
+ (EFI_MEMORY_DESCRIPTOR *)VirtualMap
);
}
-
/**
This service is a wrapper for the UEFI Runtime Service UpdateCapsule().
@@ -718,9 +704,9 @@ EfiSetVirtualAddressMap (
EFI_STATUS
EFIAPI
EfiUpdateCapsule (
- IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,
- IN UINTN CapsuleCount,
- IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL
+ IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,
+ IN UINTN CapsuleCount,
+ IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL
)
{
return mInternalRT->UpdateCapsule (
@@ -730,7 +716,6 @@ EfiUpdateCapsule (
);
}
-
/**
This service is a wrapper for the UEFI Runtime Service QueryCapsuleCapabilities().
@@ -768,10 +753,10 @@ EfiUpdateCapsule (
EFI_STATUS
EFIAPI
EfiQueryCapsuleCapabilities (
- IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,
- IN UINTN CapsuleCount,
- OUT UINT64 *MaximumCapsuleSize,
- OUT EFI_RESET_TYPE *ResetType
+ IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,
+ IN UINTN CapsuleCount,
+ OUT UINT64 *MaximumCapsuleSize,
+ OUT EFI_RESET_TYPE *ResetType
)
{
return mInternalRT->QueryCapsuleCapabilities (
@@ -782,7 +767,6 @@ EfiQueryCapsuleCapabilities (
);
}
-
/**
This service is a wrapper for the UEFI Runtime Service QueryVariableInfo().
diff --git a/MdePkg/Library/UefiScsiLib/UefiScsiLib.c b/MdePkg/Library/UefiScsiLib/UefiScsiLib.c
index 28c7dd6074..a33cadd716 100644
--- a/MdePkg/Library/UefiScsiLib/UefiScsiLib.c
+++ b/MdePkg/Library/UefiScsiLib/UefiScsiLib.c
@@ -6,7 +6,6 @@
**/
-
#include <Uefi.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
@@ -17,10 +16,9 @@
#include <IndustryStandard/Scsi.h>
-
- //
- // Scsi Command Length
- //
+//
+// Scsi Command Length
+//
#define EFI_SCSI_OP_LENGTH_SIX 0x6
#define EFI_SCSI_OP_LENGTH_TEN 0xa
#define EFI_SCSI_OP_LENGTH_TWELVE 0xc
@@ -35,32 +33,30 @@ typedef struct {
/// The SCSI request packet to send to the SCSI controller specified by
/// the device handle.
///
- EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
+ EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
///
/// The length of the output sense data.
///
- UINT8 *SenseDataLength;
+ UINT8 *SenseDataLength;
///
/// The status of the SCSI host adapter.
///
- UINT8 *HostAdapterStatus;
+ UINT8 *HostAdapterStatus;
///
/// The status of the target SCSI device.
///
- UINT8 *TargetStatus;
+ UINT8 *TargetStatus;
///
/// The length of the data buffer for the SCSI read/write command.
///
- UINT32 *DataLength;
+ UINT32 *DataLength;
///
/// The caller event to be signaled when the SCSI read/write command
/// completes.
///
- EFI_EVENT CallerEvent;
+ EFI_EVENT CallerEvent;
} EFI_SCSI_LIB_ASYNC_CONTEXT;
-
-
/**
Execute Test Unit Ready SCSI command on a specific SCSI target.
@@ -135,13 +131,13 @@ ScsiTestUnitReadyCommand (
IN UINT64 Timeout,
IN OUT VOID *SenseData OPTIONAL,
IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus
+ OUT UINT8 *HostAdapterStatus,
+ OUT UINT8 *TargetStatus
)
{
- EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
- EFI_STATUS Status;
- UINT8 Cdb[EFI_SCSI_OP_LENGTH_SIX];
+ EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
+ EFI_STATUS Status;
+ UINT8 Cdb[EFI_SCSI_OP_LENGTH_SIX];
ASSERT (SenseDataLength != NULL);
ASSERT (HostAdapterStatus != NULL);
@@ -151,30 +147,29 @@ ScsiTestUnitReadyCommand (
ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_SIX);
- CommandPacket.Timeout = Timeout;
- CommandPacket.InDataBuffer = NULL;
- CommandPacket.InTransferLength= 0;
- CommandPacket.OutDataBuffer = NULL;
- CommandPacket.OutTransferLength= 0;
- CommandPacket.SenseData = SenseData;
- CommandPacket.Cdb = Cdb;
+ CommandPacket.Timeout = Timeout;
+ CommandPacket.InDataBuffer = NULL;
+ CommandPacket.InTransferLength = 0;
+ CommandPacket.OutDataBuffer = NULL;
+ CommandPacket.OutTransferLength = 0;
+ CommandPacket.SenseData = SenseData;
+ CommandPacket.Cdb = Cdb;
//
// Fill Cdb for Test Unit Ready Command
//
Cdb[0] = EFI_SCSI_OP_TEST_UNIT_READY;
- CommandPacket.CdbLength = (UINT8) EFI_SCSI_OP_LENGTH_SIX;
+ CommandPacket.CdbLength = (UINT8)EFI_SCSI_OP_LENGTH_SIX;
CommandPacket.SenseDataLength = *SenseDataLength;
- Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
+ Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
- *HostAdapterStatus = CommandPacket.HostAdapterStatus;
- *TargetStatus = CommandPacket.TargetStatus;
- *SenseDataLength = CommandPacket.SenseDataLength;
+ *HostAdapterStatus = CommandPacket.HostAdapterStatus;
+ *TargetStatus = CommandPacket.TargetStatus;
+ *SenseDataLength = CommandPacket.SenseDataLength;
return Status;
}
-
/**
Execute Inquiry SCSI command on a specific SCSI target.
@@ -271,17 +266,17 @@ ScsiInquiryCommandEx (
IN UINT64 Timeout,
IN OUT VOID *SenseData OPTIONAL,
IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
+ OUT UINT8 *HostAdapterStatus,
+ OUT UINT8 *TargetStatus,
IN OUT VOID *InquiryDataBuffer OPTIONAL,
IN OUT UINT32 *InquiryDataLength,
IN BOOLEAN EnableVitalProductData,
IN UINT8 PageCode
)
{
- EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
- EFI_STATUS Status;
- UINT8 Cdb[EFI_SCSI_OP_LENGTH_SIX];
+ EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
+ EFI_STATUS Status;
+ UINT8 Cdb[EFI_SCSI_OP_LENGTH_SIX];
ASSERT (SenseDataLength != NULL);
ASSERT (HostAdapterStatus != NULL);
@@ -292,14 +287,14 @@ ScsiInquiryCommandEx (
ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_SIX);
- CommandPacket.Timeout = Timeout;
- CommandPacket.InDataBuffer = InquiryDataBuffer;
- CommandPacket.InTransferLength= *InquiryDataLength;
- CommandPacket.SenseData = SenseData;
- CommandPacket.SenseDataLength = *SenseDataLength;
- CommandPacket.Cdb = Cdb;
+ CommandPacket.Timeout = Timeout;
+ CommandPacket.InDataBuffer = InquiryDataBuffer;
+ CommandPacket.InTransferLength = *InquiryDataLength;
+ CommandPacket.SenseData = SenseData;
+ CommandPacket.SenseDataLength = *SenseDataLength;
+ CommandPacket.Cdb = Cdb;
- Cdb[0] = EFI_SCSI_OP_INQUIRY;
+ Cdb[0] = EFI_SCSI_OP_INQUIRY;
if (EnableVitalProductData) {
Cdb[1] |= 0x01;
Cdb[2] = PageCode;
@@ -309,21 +304,20 @@ ScsiInquiryCommandEx (
*InquiryDataLength = 0xff;
}
- Cdb[4] = (UINT8) (*InquiryDataLength);
- CommandPacket.CdbLength = (UINT8) EFI_SCSI_OP_LENGTH_SIX;
+ Cdb[4] = (UINT8)(*InquiryDataLength);
+ CommandPacket.CdbLength = (UINT8)EFI_SCSI_OP_LENGTH_SIX;
CommandPacket.DataDirection = EFI_SCSI_DATA_IN;
- Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
+ Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
- *HostAdapterStatus = CommandPacket.HostAdapterStatus;
- *TargetStatus = CommandPacket.TargetStatus;
- *SenseDataLength = CommandPacket.SenseDataLength;
- *InquiryDataLength = CommandPacket.InTransferLength;
+ *HostAdapterStatus = CommandPacket.HostAdapterStatus;
+ *TargetStatus = CommandPacket.TargetStatus;
+ *SenseDataLength = CommandPacket.SenseDataLength;
+ *InquiryDataLength = CommandPacket.InTransferLength;
return Status;
}
-
/**
Execute Inquiry SCSI command on a specific SCSI target.
@@ -418,8 +412,8 @@ ScsiInquiryCommand (
IN UINT64 Timeout,
IN OUT VOID *SenseData OPTIONAL,
IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
+ OUT UINT8 *HostAdapterStatus,
+ OUT UINT8 *TargetStatus,
IN OUT VOID *InquiryDataBuffer OPTIONAL,
IN OUT UINT32 *InquiryDataLength,
IN BOOLEAN EnableVitalProductData
@@ -531,22 +525,22 @@ ScsiInquiryCommand (
EFI_STATUS
EFIAPI
ScsiModeSense10Command (
- IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
- IN UINT64 Timeout,
- IN OUT VOID *SenseData OPTIONAL,
- IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
- IN OUT VOID *DataBuffer OPTIONAL,
- IN OUT UINT32 *DataLength,
- IN UINT8 DBDField OPTIONAL,
- IN UINT8 PageControl,
- IN UINT8 PageCode
+ IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
+ IN UINT64 Timeout,
+ IN OUT VOID *SenseData OPTIONAL,
+ IN OUT UINT8 *SenseDataLength,
+ OUT UINT8 *HostAdapterStatus,
+ OUT UINT8 *TargetStatus,
+ IN OUT VOID *DataBuffer OPTIONAL,
+ IN OUT UINT32 *DataLength,
+ IN UINT8 DBDField OPTIONAL,
+ IN UINT8 PageControl,
+ IN UINT8 PageCode
)
{
- EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
- EFI_STATUS Status;
- UINT8 Cdb[EFI_SCSI_OP_LENGTH_TEN];
+ EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
+ EFI_STATUS Status;
+ UINT8 Cdb[EFI_SCSI_OP_LENGTH_TEN];
ASSERT (SenseDataLength != NULL);
ASSERT (HostAdapterStatus != NULL);
@@ -557,41 +551,40 @@ ScsiModeSense10Command (
ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_TEN);
- CommandPacket.Timeout = Timeout;
- CommandPacket.InDataBuffer = DataBuffer;
- CommandPacket.SenseData = SenseData;
- CommandPacket.InTransferLength= *DataLength;
- CommandPacket.Cdb = Cdb;
+ CommandPacket.Timeout = Timeout;
+ CommandPacket.InDataBuffer = DataBuffer;
+ CommandPacket.SenseData = SenseData;
+ CommandPacket.InTransferLength = *DataLength;
+ CommandPacket.Cdb = Cdb;
//
// Fill Cdb for Mode Sense (10) Command
//
- Cdb[0] = EFI_SCSI_OP_MODE_SEN10;
+ Cdb[0] = EFI_SCSI_OP_MODE_SEN10;
//
// DBDField is in Cdb[1] bit3 of (bit7..0)
//
- Cdb[1] = (UINT8) ((DBDField << 3) & 0x08);
+ Cdb[1] = (UINT8)((DBDField << 3) & 0x08);
//
// PageControl is in Cdb[2] bit7..6, PageCode is in Cdb[2] bit5..0
//
- Cdb[2] = (UINT8) (((PageControl << 6) & 0xc0) | (PageCode & 0x3f));
- Cdb[7] = (UINT8) (*DataLength >> 8);
- Cdb[8] = (UINT8) (*DataLength);
+ Cdb[2] = (UINT8)(((PageControl << 6) & 0xc0) | (PageCode & 0x3f));
+ Cdb[7] = (UINT8)(*DataLength >> 8);
+ Cdb[8] = (UINT8)(*DataLength);
CommandPacket.CdbLength = EFI_SCSI_OP_LENGTH_TEN;
CommandPacket.DataDirection = EFI_SCSI_DATA_IN;
CommandPacket.SenseDataLength = *SenseDataLength;
- Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
+ Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
- *HostAdapterStatus = CommandPacket.HostAdapterStatus;
- *TargetStatus = CommandPacket.TargetStatus;
- *SenseDataLength = CommandPacket.SenseDataLength;
- *DataLength = CommandPacket.InTransferLength;
+ *HostAdapterStatus = CommandPacket.HostAdapterStatus;
+ *TargetStatus = CommandPacket.TargetStatus;
+ *SenseDataLength = CommandPacket.SenseDataLength;
+ *DataLength = CommandPacket.InTransferLength;
return Status;
}
-
/**
Execute Request Sense SCSI command on a specific SCSI target.
@@ -631,13 +624,13 @@ ScsiRequestSenseCommand (
IN UINT64 Timeout,
IN OUT VOID *SenseData OPTIONAL,
IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus
+ OUT UINT8 *HostAdapterStatus,
+ OUT UINT8 *TargetStatus
)
{
- EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
- EFI_STATUS Status;
- UINT8 Cdb[EFI_SCSI_OP_LENGTH_SIX];
+ EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
+ EFI_STATUS Status;
+ UINT8 Cdb[EFI_SCSI_OP_LENGTH_SIX];
ASSERT (SenseDataLength != NULL);
ASSERT (HostAdapterStatus != NULL);
@@ -647,31 +640,30 @@ ScsiRequestSenseCommand (
ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_SIX);
- CommandPacket.Timeout = Timeout;
- CommandPacket.InDataBuffer = SenseData;
- CommandPacket.SenseData = NULL;
- CommandPacket.InTransferLength= *SenseDataLength;
- CommandPacket.Cdb = Cdb;
+ CommandPacket.Timeout = Timeout;
+ CommandPacket.InDataBuffer = SenseData;
+ CommandPacket.SenseData = NULL;
+ CommandPacket.InTransferLength = *SenseDataLength;
+ CommandPacket.Cdb = Cdb;
//
// Fill Cdb for Request Sense Command
//
- Cdb[0] = EFI_SCSI_OP_REQUEST_SENSE;
- Cdb[4] = (UINT8) (*SenseDataLength);
+ Cdb[0] = EFI_SCSI_OP_REQUEST_SENSE;
+ Cdb[4] = (UINT8)(*SenseDataLength);
- CommandPacket.CdbLength = (UINT8) EFI_SCSI_OP_LENGTH_SIX;
+ CommandPacket.CdbLength = (UINT8)EFI_SCSI_OP_LENGTH_SIX;
CommandPacket.DataDirection = EFI_SCSI_DATA_IN;
CommandPacket.SenseDataLength = 0;
- Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
+ Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
- *HostAdapterStatus = CommandPacket.HostAdapterStatus;
- *TargetStatus = CommandPacket.TargetStatus;
- *SenseDataLength = (UINT8) CommandPacket.InTransferLength;
+ *HostAdapterStatus = CommandPacket.HostAdapterStatus;
+ *TargetStatus = CommandPacket.TargetStatus;
+ *SenseDataLength = (UINT8)CommandPacket.InTransferLength;
return Status;
}
-
/**
Execute Read Capacity SCSI command on a specific SCSI target.
@@ -723,16 +715,16 @@ ScsiReadCapacityCommand (
IN UINT64 Timeout,
IN OUT VOID *SenseData OPTIONAL,
IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
+ OUT UINT8 *HostAdapterStatus,
+ OUT UINT8 *TargetStatus,
IN OUT VOID *DataBuffer OPTIONAL,
IN OUT UINT32 *DataLength,
IN BOOLEAN Pmi
)
{
- EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
- EFI_STATUS Status;
- UINT8 Cdb[EFI_SCSI_OP_LENGTH_TEN];
+ EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
+ EFI_STATUS Status;
+ UINT8 Cdb[EFI_SCSI_OP_LENGTH_TEN];
ASSERT (SenseDataLength != NULL);
ASSERT (HostAdapterStatus != NULL);
@@ -743,15 +735,15 @@ ScsiReadCapacityCommand (
ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_TEN);
- CommandPacket.Timeout = Timeout;
- CommandPacket.InDataBuffer = DataBuffer;
- CommandPacket.SenseData = SenseData;
- CommandPacket.InTransferLength= *DataLength;
- CommandPacket.Cdb = Cdb;
+ CommandPacket.Timeout = Timeout;
+ CommandPacket.InDataBuffer = DataBuffer;
+ CommandPacket.SenseData = SenseData;
+ CommandPacket.InTransferLength = *DataLength;
+ CommandPacket.Cdb = Cdb;
//
// Fill Cdb for Read Capacity Command
//
- Cdb[0] = EFI_SCSI_OP_READ_CAPACITY;
+ Cdb[0] = EFI_SCSI_OP_READ_CAPACITY;
if (!Pmi) {
//
// Partial medium indicator,if Pmi is FALSE, the Cdb.2 ~ Cdb.5 MUST BE ZERO.
@@ -765,17 +757,16 @@ ScsiReadCapacityCommand (
CommandPacket.DataDirection = EFI_SCSI_DATA_IN;
CommandPacket.SenseDataLength = *SenseDataLength;
- Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
+ Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
- *HostAdapterStatus = CommandPacket.HostAdapterStatus;
- *TargetStatus = CommandPacket.TargetStatus;
- *SenseDataLength = CommandPacket.SenseDataLength;
- *DataLength = CommandPacket.InTransferLength;
+ *HostAdapterStatus = CommandPacket.HostAdapterStatus;
+ *TargetStatus = CommandPacket.TargetStatus;
+ *SenseDataLength = CommandPacket.SenseDataLength;
+ *DataLength = CommandPacket.InTransferLength;
return Status;
}
-
/**
Execute Read Capacity SCSI 16 command on a specific SCSI target.
@@ -827,16 +818,16 @@ ScsiReadCapacity16Command (
IN UINT64 Timeout,
IN OUT VOID *SenseData OPTIONAL,
IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
+ OUT UINT8 *HostAdapterStatus,
+ OUT UINT8 *TargetStatus,
IN OUT VOID *DataBuffer OPTIONAL,
IN OUT UINT32 *DataLength,
IN BOOLEAN Pmi
)
{
- EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
- EFI_STATUS Status;
- UINT8 Cdb[16];
+ EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
+ EFI_STATUS Status;
+ UINT8 Cdb[16];
ASSERT (SenseDataLength != NULL);
ASSERT (HostAdapterStatus != NULL);
@@ -847,16 +838,16 @@ ScsiReadCapacity16Command (
ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
ZeroMem (Cdb, 16);
- CommandPacket.Timeout = Timeout;
- CommandPacket.InDataBuffer = DataBuffer;
- CommandPacket.SenseData = SenseData;
- CommandPacket.InTransferLength= *DataLength;
- CommandPacket.Cdb = Cdb;
+ CommandPacket.Timeout = Timeout;
+ CommandPacket.InDataBuffer = DataBuffer;
+ CommandPacket.SenseData = SenseData;
+ CommandPacket.InTransferLength = *DataLength;
+ CommandPacket.Cdb = Cdb;
//
// Fill Cdb for Read Capacity Command
//
- Cdb[0] = EFI_SCSI_OP_READ_CAPACITY16;
- Cdb[1] = 0x10;
+ Cdb[0] = EFI_SCSI_OP_READ_CAPACITY16;
+ Cdb[1] = 0x10;
if (!Pmi) {
//
// Partial medium indicator,if Pmi is FALSE, the Cdb.2 ~ Cdb.9 MUST BE ZERO.
@@ -866,22 +857,21 @@ ScsiReadCapacity16Command (
Cdb[14] |= 0x01;
}
- Cdb[13] = 0x20;
+ Cdb[13] = 0x20;
CommandPacket.CdbLength = 16;
CommandPacket.DataDirection = EFI_SCSI_DATA_IN;
CommandPacket.SenseDataLength = *SenseDataLength;
- Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
+ Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
- *HostAdapterStatus = CommandPacket.HostAdapterStatus;
- *TargetStatus = CommandPacket.TargetStatus;
- *SenseDataLength = CommandPacket.SenseDataLength;
- *DataLength = CommandPacket.InTransferLength;
+ *HostAdapterStatus = CommandPacket.HostAdapterStatus;
+ *TargetStatus = CommandPacket.TargetStatus;
+ *SenseDataLength = CommandPacket.SenseDataLength;
+ *DataLength = CommandPacket.InTransferLength;
return Status;
}
-
/**
Execute Read(10) SCSI command on a specific SCSI target.
@@ -934,17 +924,17 @@ ScsiRead10Command (
IN UINT64 Timeout,
IN OUT VOID *SenseData OPTIONAL,
IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
+ OUT UINT8 *HostAdapterStatus,
+ OUT UINT8 *TargetStatus,
IN OUT VOID *DataBuffer OPTIONAL,
IN OUT UINT32 *DataLength,
IN UINT32 StartLba,
IN UINT32 SectorSize
)
{
- EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
- EFI_STATUS Status;
- UINT8 Cdb[EFI_SCSI_OP_LENGTH_TEN];
+ EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
+ EFI_STATUS Status;
+ UINT8 Cdb[EFI_SCSI_OP_LENGTH_TEN];
ASSERT (SenseDataLength != NULL);
ASSERT (HostAdapterStatus != NULL);
@@ -955,33 +945,32 @@ ScsiRead10Command (
ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_TEN);
- CommandPacket.Timeout = Timeout;
- CommandPacket.InDataBuffer = DataBuffer;
- CommandPacket.SenseData = SenseData;
- CommandPacket.InTransferLength= *DataLength;
- CommandPacket.Cdb = Cdb;
+ CommandPacket.Timeout = Timeout;
+ CommandPacket.InDataBuffer = DataBuffer;
+ CommandPacket.SenseData = SenseData;
+ CommandPacket.InTransferLength = *DataLength;
+ CommandPacket.Cdb = Cdb;
//
// Fill Cdb for Read (10) Command
//
- Cdb[0] = EFI_SCSI_OP_READ10;
+ Cdb[0] = EFI_SCSI_OP_READ10;
WriteUnaligned32 ((UINT32 *)&Cdb[2], SwapBytes32 (StartLba));
- WriteUnaligned16 ((UINT16 *)&Cdb[7], SwapBytes16 ((UINT16) SectorSize));
+ WriteUnaligned16 ((UINT16 *)&Cdb[7], SwapBytes16 ((UINT16)SectorSize));
CommandPacket.CdbLength = EFI_SCSI_OP_LENGTH_TEN;
CommandPacket.DataDirection = EFI_SCSI_DATA_IN;
CommandPacket.SenseDataLength = *SenseDataLength;
- Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
+ Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
- *HostAdapterStatus = CommandPacket.HostAdapterStatus;
- *TargetStatus = CommandPacket.TargetStatus;
- *SenseDataLength = CommandPacket.SenseDataLength;
- *DataLength = CommandPacket.InTransferLength;
+ *HostAdapterStatus = CommandPacket.HostAdapterStatus;
+ *TargetStatus = CommandPacket.TargetStatus;
+ *SenseDataLength = CommandPacket.SenseDataLength;
+ *DataLength = CommandPacket.InTransferLength;
return Status;
}
-
/**
Execute Write(10) SCSI command on a specific SCSI target.
@@ -1034,17 +1023,17 @@ ScsiWrite10Command (
IN UINT64 Timeout,
IN OUT VOID *SenseData OPTIONAL,
IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
+ OUT UINT8 *HostAdapterStatus,
+ OUT UINT8 *TargetStatus,
IN OUT VOID *DataBuffer OPTIONAL,
IN OUT UINT32 *DataLength,
IN UINT32 StartLba,
IN UINT32 SectorSize
)
{
- EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
- EFI_STATUS Status;
- UINT8 Cdb[EFI_SCSI_OP_LENGTH_TEN];
+ EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
+ EFI_STATUS Status;
+ UINT8 Cdb[EFI_SCSI_OP_LENGTH_TEN];
ASSERT (SenseDataLength != NULL);
ASSERT (HostAdapterStatus != NULL);
@@ -1063,21 +1052,21 @@ ScsiWrite10Command (
//
// Fill Cdb for Write (10) Command
//
- Cdb[0] = EFI_SCSI_OP_WRITE10;
- Cdb[1] = EFI_SCSI_BLOCK_FUA;
+ Cdb[0] = EFI_SCSI_OP_WRITE10;
+ Cdb[1] = EFI_SCSI_BLOCK_FUA;
WriteUnaligned32 ((UINT32 *)&Cdb[2], SwapBytes32 (StartLba));
- WriteUnaligned16 ((UINT16 *)&Cdb[7], SwapBytes16 ((UINT16) SectorSize));
+ WriteUnaligned16 ((UINT16 *)&Cdb[7], SwapBytes16 ((UINT16)SectorSize));
CommandPacket.CdbLength = EFI_SCSI_OP_LENGTH_TEN;
CommandPacket.DataDirection = EFI_SCSI_DATA_OUT;
CommandPacket.SenseDataLength = *SenseDataLength;
- Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
+ Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
- *HostAdapterStatus = CommandPacket.HostAdapterStatus;
- *TargetStatus = CommandPacket.TargetStatus;
- *SenseDataLength = CommandPacket.SenseDataLength;
- *DataLength = CommandPacket.OutTransferLength;
+ *HostAdapterStatus = CommandPacket.HostAdapterStatus;
+ *TargetStatus = CommandPacket.TargetStatus;
+ *SenseDataLength = CommandPacket.SenseDataLength;
+ *DataLength = CommandPacket.OutTransferLength;
return Status;
}
@@ -1134,17 +1123,17 @@ ScsiRead16Command (
IN UINT64 Timeout,
IN OUT VOID *SenseData OPTIONAL,
IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
+ OUT UINT8 *HostAdapterStatus,
+ OUT UINT8 *TargetStatus,
IN OUT VOID *DataBuffer OPTIONAL,
IN OUT UINT32 *DataLength,
IN UINT64 StartLba,
IN UINT32 SectorSize
)
{
- EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
- EFI_STATUS Status;
- UINT8 Cdb[EFI_SCSI_OP_LENGTH_SIXTEEN];
+ EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
+ EFI_STATUS Status;
+ UINT8 Cdb[EFI_SCSI_OP_LENGTH_SIXTEEN];
ASSERT (SenseDataLength != NULL);
ASSERT (HostAdapterStatus != NULL);
@@ -1163,7 +1152,7 @@ ScsiRead16Command (
//
// Fill Cdb for Read (16) Command
//
- Cdb[0] = EFI_SCSI_OP_READ16;
+ Cdb[0] = EFI_SCSI_OP_READ16;
WriteUnaligned64 ((UINT64 *)&Cdb[2], SwapBytes64 (StartLba));
WriteUnaligned32 ((UINT32 *)&Cdb[10], SwapBytes32 (SectorSize));
@@ -1171,17 +1160,16 @@ ScsiRead16Command (
CommandPacket.DataDirection = EFI_SCSI_DATA_IN;
CommandPacket.SenseDataLength = *SenseDataLength;
- Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
+ Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
- *HostAdapterStatus = CommandPacket.HostAdapterStatus;
- *TargetStatus = CommandPacket.TargetStatus;
- *SenseDataLength = CommandPacket.SenseDataLength;
- *DataLength = CommandPacket.InTransferLength;
+ *HostAdapterStatus = CommandPacket.HostAdapterStatus;
+ *TargetStatus = CommandPacket.TargetStatus;
+ *SenseDataLength = CommandPacket.SenseDataLength;
+ *DataLength = CommandPacket.InTransferLength;
return Status;
}
-
/**
Execute Write(16) SCSI command on a specific SCSI target.
@@ -1234,17 +1222,17 @@ ScsiWrite16Command (
IN UINT64 Timeout,
IN OUT VOID *SenseData OPTIONAL,
IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
+ OUT UINT8 *HostAdapterStatus,
+ OUT UINT8 *TargetStatus,
IN OUT VOID *DataBuffer OPTIONAL,
IN OUT UINT32 *DataLength,
IN UINT64 StartLba,
IN UINT32 SectorSize
)
{
- EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
- EFI_STATUS Status;
- UINT8 Cdb[EFI_SCSI_OP_LENGTH_SIXTEEN];
+ EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
+ EFI_STATUS Status;
+ UINT8 Cdb[EFI_SCSI_OP_LENGTH_SIXTEEN];
ASSERT (SenseDataLength != NULL);
ASSERT (HostAdapterStatus != NULL);
@@ -1263,8 +1251,8 @@ ScsiWrite16Command (
//
// Fill Cdb for Write (16) Command
//
- Cdb[0] = EFI_SCSI_OP_WRITE16;
- Cdb[1] = EFI_SCSI_BLOCK_FUA;
+ Cdb[0] = EFI_SCSI_OP_WRITE16;
+ Cdb[1] = EFI_SCSI_BLOCK_FUA;
WriteUnaligned64 ((UINT64 *)&Cdb[2], SwapBytes64 (StartLba));
WriteUnaligned32 ((UINT32 *)&Cdb[10], SwapBytes32 (SectorSize));
@@ -1272,17 +1260,16 @@ ScsiWrite16Command (
CommandPacket.DataDirection = EFI_SCSI_DATA_OUT;
CommandPacket.SenseDataLength = *SenseDataLength;
- Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
+ Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
- *HostAdapterStatus = CommandPacket.HostAdapterStatus;
- *TargetStatus = CommandPacket.TargetStatus;
- *SenseDataLength = CommandPacket.SenseDataLength;
- *DataLength = CommandPacket.OutTransferLength;
+ *HostAdapterStatus = CommandPacket.HostAdapterStatus;
+ *TargetStatus = CommandPacket.TargetStatus;
+ *SenseDataLength = CommandPacket.SenseDataLength;
+ *DataLength = CommandPacket.OutTransferLength;
return Status;
}
-
/**
Execute Security Protocol In SCSI command on a specific SCSI target.
@@ -1338,19 +1325,19 @@ ScsiSecurityProtocolInCommand (
IN UINT64 Timeout,
IN OUT VOID *SenseData OPTIONAL,
IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
+ OUT UINT8 *HostAdapterStatus,
+ OUT UINT8 *TargetStatus,
IN UINT8 SecurityProtocol,
IN UINT16 SecurityProtocolSpecific,
IN BOOLEAN Inc512,
IN UINTN DataLength,
IN OUT VOID *DataBuffer OPTIONAL,
- OUT UINTN *TransferLength
+ OUT UINTN *TransferLength
)
{
- EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
- EFI_STATUS Status;
- UINT8 Cdb[EFI_SCSI_OP_LENGTH_TWELVE];
+ EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
+ EFI_STATUS Status;
+ UINT8 Cdb[EFI_SCSI_OP_LENGTH_TWELVE];
ASSERT (SenseDataLength != NULL);
ASSERT (HostAdapterStatus != NULL);
@@ -1362,43 +1349,43 @@ ScsiSecurityProtocolInCommand (
ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_TWELVE);
- CommandPacket.Timeout = Timeout;
- CommandPacket.InDataBuffer = DataBuffer;
- CommandPacket.SenseData = SenseData;
- CommandPacket.InTransferLength = (UINT32) DataLength;
- CommandPacket.Cdb = Cdb;
+ CommandPacket.Timeout = Timeout;
+ CommandPacket.InDataBuffer = DataBuffer;
+ CommandPacket.SenseData = SenseData;
+ CommandPacket.InTransferLength = (UINT32)DataLength;
+ CommandPacket.Cdb = Cdb;
//
// Fill Cdb for Security Protocol In Command
//
- Cdb[0] = EFI_SCSI_OP_SECURITY_PROTOCOL_IN;
- Cdb[1] = SecurityProtocol;
+ Cdb[0] = EFI_SCSI_OP_SECURITY_PROTOCOL_IN;
+ Cdb[1] = SecurityProtocol;
WriteUnaligned16 ((UINT16 *)&Cdb[2], SwapBytes16 (SecurityProtocolSpecific));
if (Inc512) {
if (DataLength % 512 != 0) {
return EFI_INVALID_PARAMETER;
}
- Cdb[4] = BIT7;
- WriteUnaligned32 ((UINT32 *)&Cdb[6], SwapBytes32 ((UINT32) DataLength / 512));
+
+ Cdb[4] = BIT7;
+ WriteUnaligned32 ((UINT32 *)&Cdb[6], SwapBytes32 ((UINT32)DataLength / 512));
} else {
- WriteUnaligned32 ((UINT32 *)&Cdb[6], SwapBytes32 ((UINT32) DataLength));
+ WriteUnaligned32 ((UINT32 *)&Cdb[6], SwapBytes32 ((UINT32)DataLength));
}
CommandPacket.CdbLength = EFI_SCSI_OP_LENGTH_TWELVE;
CommandPacket.DataDirection = EFI_SCSI_DATA_IN;
CommandPacket.SenseDataLength = *SenseDataLength;
- Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
+ Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
- *HostAdapterStatus = CommandPacket.HostAdapterStatus;
- *TargetStatus = CommandPacket.TargetStatus;
- *SenseDataLength = CommandPacket.SenseDataLength;
- *TransferLength = (UINTN) CommandPacket.InTransferLength;
+ *HostAdapterStatus = CommandPacket.HostAdapterStatus;
+ *TargetStatus = CommandPacket.TargetStatus;
+ *SenseDataLength = CommandPacket.SenseDataLength;
+ *TransferLength = (UINTN)CommandPacket.InTransferLength;
return Status;
}
-
/**
Execute Security Protocol Out SCSI command on a specific SCSI target.
@@ -1451,8 +1438,8 @@ ScsiSecurityProtocolOutCommand (
IN UINT64 Timeout,
IN OUT VOID *SenseData OPTIONAL,
IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
+ OUT UINT8 *HostAdapterStatus,
+ OUT UINT8 *TargetStatus,
IN UINT8 SecurityProtocol,
IN UINT16 SecurityProtocolSpecific,
IN BOOLEAN Inc512,
@@ -1460,9 +1447,9 @@ ScsiSecurityProtocolOutCommand (
IN OUT VOID *DataBuffer OPTIONAL
)
{
- EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
- EFI_STATUS Status;
- UINT8 Cdb[EFI_SCSI_OP_LENGTH_TWELVE];
+ EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
+ EFI_STATUS Status;
+ UINT8 Cdb[EFI_SCSI_OP_LENGTH_TWELVE];
ASSERT (SenseDataLength != NULL);
ASSERT (HostAdapterStatus != NULL);
@@ -1476,39 +1463,39 @@ ScsiSecurityProtocolOutCommand (
CommandPacket.Timeout = Timeout;
CommandPacket.OutDataBuffer = DataBuffer;
CommandPacket.SenseData = SenseData;
- CommandPacket.OutTransferLength = (UINT32) DataLength;
+ CommandPacket.OutTransferLength = (UINT32)DataLength;
CommandPacket.Cdb = Cdb;
//
// Fill Cdb for Security Protocol Out Command
//
- Cdb[0] = EFI_SCSI_OP_SECURITY_PROTOCOL_OUT;
- Cdb[1] = SecurityProtocol;
+ Cdb[0] = EFI_SCSI_OP_SECURITY_PROTOCOL_OUT;
+ Cdb[1] = SecurityProtocol;
WriteUnaligned16 ((UINT16 *)&Cdb[2], SwapBytes16 (SecurityProtocolSpecific));
if (Inc512) {
if (DataLength % 512 != 0) {
return EFI_INVALID_PARAMETER;
}
- Cdb[4] = BIT7;
- WriteUnaligned32 ((UINT32 *)&Cdb[6], SwapBytes32 ((UINT32) DataLength / 512));
+
+ Cdb[4] = BIT7;
+ WriteUnaligned32 ((UINT32 *)&Cdb[6], SwapBytes32 ((UINT32)DataLength / 512));
} else {
- WriteUnaligned32 ((UINT32 *)&Cdb[6], SwapBytes32 ((UINT32) DataLength));
+ WriteUnaligned32 ((UINT32 *)&Cdb[6], SwapBytes32 ((UINT32)DataLength));
}
CommandPacket.CdbLength = EFI_SCSI_OP_LENGTH_TWELVE;
CommandPacket.DataDirection = EFI_SCSI_DATA_OUT;
CommandPacket.SenseDataLength = *SenseDataLength;
- Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
+ Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
- *HostAdapterStatus = CommandPacket.HostAdapterStatus;
- *TargetStatus = CommandPacket.TargetStatus;
- *SenseDataLength = CommandPacket.SenseDataLength;
+ *HostAdapterStatus = CommandPacket.HostAdapterStatus;
+ *TargetStatus = CommandPacket.TargetStatus;
+ *SenseDataLength = CommandPacket.SenseDataLength;
return Status;
}
-
/**
Internal helper notify function in which update the result of the
non-blocking SCSI Read/Write commands and signal caller event.
@@ -1524,36 +1511,36 @@ ScsiLibNotify (
IN VOID *Context
)
{
- EFI_SCSI_LIB_ASYNC_CONTEXT *LibContext;
- EFI_SCSI_IO_SCSI_REQUEST_PACKET *CommandPacket;
- EFI_EVENT CallerEvent;
+ EFI_SCSI_LIB_ASYNC_CONTEXT *LibContext;
+ EFI_SCSI_IO_SCSI_REQUEST_PACKET *CommandPacket;
+ EFI_EVENT CallerEvent;
- LibContext = (EFI_SCSI_LIB_ASYNC_CONTEXT *) Context;
+ LibContext = (EFI_SCSI_LIB_ASYNC_CONTEXT *)Context;
CommandPacket = &LibContext->CommandPacket;
- CallerEvent = LibContext->CallerEvent;
+ CallerEvent = LibContext->CallerEvent;
//
// Update SCSI Read/Write operation results
//
- *LibContext->SenseDataLength = CommandPacket->SenseDataLength;
- *LibContext->HostAdapterStatus = CommandPacket->HostAdapterStatus;
- *LibContext->TargetStatus = CommandPacket->TargetStatus;
+ *LibContext->SenseDataLength = CommandPacket->SenseDataLength;
+ *LibContext->HostAdapterStatus = CommandPacket->HostAdapterStatus;
+ *LibContext->TargetStatus = CommandPacket->TargetStatus;
if (CommandPacket->InDataBuffer != NULL) {
- *LibContext->DataLength = CommandPacket->InTransferLength;
+ *LibContext->DataLength = CommandPacket->InTransferLength;
} else {
- *LibContext->DataLength = CommandPacket->OutTransferLength;
+ *LibContext->DataLength = CommandPacket->OutTransferLength;
}
if (CommandPacket->Cdb != NULL) {
FreePool (CommandPacket->Cdb);
}
+
FreePool (Context);
gBS->CloseEvent (Event);
gBS->SignalEvent (CallerEvent);
}
-
/**
Execute blocking/non-blocking Read(10) SCSI command on a specific SCSI
target.
@@ -1634,8 +1621,8 @@ ScsiRead10CommandEx (
IN UINT64 Timeout,
IN OUT VOID *SenseData OPTIONAL,
IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
+ OUT UINT8 *HostAdapterStatus,
+ OUT UINT8 *TargetStatus,
IN OUT VOID *DataBuffer OPTIONAL,
IN OUT UINT32 *DataLength,
IN UINT32 StartLba,
@@ -1643,11 +1630,11 @@ ScsiRead10CommandEx (
IN EFI_EVENT Event OPTIONAL
)
{
- EFI_SCSI_LIB_ASYNC_CONTEXT *Context;
- EFI_SCSI_IO_SCSI_REQUEST_PACKET *CommandPacket;
- EFI_STATUS Status;
- UINT8 *Cdb;
- EFI_EVENT SelfEvent;
+ EFI_SCSI_LIB_ASYNC_CONTEXT *Context;
+ EFI_SCSI_IO_SCSI_REQUEST_PACKET *CommandPacket;
+ EFI_STATUS Status;
+ UINT8 *Cdb;
+ EFI_EVENT SelfEvent;
if (Event == NULL) {
return ScsiRead10Command (
@@ -1681,10 +1668,10 @@ ScsiRead10CommandEx (
goto ErrorExit;
}
- Context->SenseDataLength = SenseDataLength;
- Context->HostAdapterStatus = HostAdapterStatus;
- Context->TargetStatus = TargetStatus;
- Context->CallerEvent = Event;
+ Context->SenseDataLength = SenseDataLength;
+ Context->HostAdapterStatus = HostAdapterStatus;
+ Context->TargetStatus = TargetStatus;
+ Context->CallerEvent = Event;
CommandPacket = &Context->CommandPacket;
CommandPacket->Timeout = Timeout;
@@ -1695,13 +1682,13 @@ ScsiRead10CommandEx (
//
// Fill Cdb for Read (10) Command
//
- Cdb[0] = EFI_SCSI_OP_READ10;
+ Cdb[0] = EFI_SCSI_OP_READ10;
WriteUnaligned32 ((UINT32 *)&Cdb[2], SwapBytes32 (StartLba));
- WriteUnaligned16 ((UINT16 *)&Cdb[7], SwapBytes16 ((UINT16) SectorSize));
+ WriteUnaligned16 ((UINT16 *)&Cdb[7], SwapBytes16 ((UINT16)SectorSize));
- CommandPacket->CdbLength = EFI_SCSI_OP_LENGTH_TEN;
- CommandPacket->DataDirection = EFI_SCSI_DATA_IN;
- CommandPacket->SenseDataLength = *SenseDataLength;
+ CommandPacket->CdbLength = EFI_SCSI_OP_LENGTH_TEN;
+ CommandPacket->DataDirection = EFI_SCSI_DATA_IN;
+ CommandPacket->SenseDataLength = *SenseDataLength;
//
// Create Event
@@ -1713,12 +1700,12 @@ ScsiRead10CommandEx (
Context,
&SelfEvent
);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
goto ErrorExit;
}
Status = ScsiIo->ExecuteScsiCommand (ScsiIo, CommandPacket, SelfEvent);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
//
// Since ScsiLibNotify() will not be signaled if ExecuteScsiCommand()
// returns with error, close the event here.
@@ -1737,7 +1724,6 @@ ErrorExit:
return Status;
}
-
/**
Execute blocking/non-blocking Write(10) SCSI command on a specific SCSI
target.
@@ -1818,8 +1804,8 @@ ScsiWrite10CommandEx (
IN UINT64 Timeout,
IN OUT VOID *SenseData OPTIONAL,
IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
+ OUT UINT8 *HostAdapterStatus,
+ OUT UINT8 *TargetStatus,
IN OUT VOID *DataBuffer OPTIONAL,
IN OUT UINT32 *DataLength,
IN UINT32 StartLba,
@@ -1827,11 +1813,11 @@ ScsiWrite10CommandEx (
IN EFI_EVENT Event OPTIONAL
)
{
- EFI_SCSI_LIB_ASYNC_CONTEXT *Context;
- EFI_SCSI_IO_SCSI_REQUEST_PACKET *CommandPacket;
- EFI_STATUS Status;
- UINT8 *Cdb;
- EFI_EVENT SelfEvent;
+ EFI_SCSI_LIB_ASYNC_CONTEXT *Context;
+ EFI_SCSI_IO_SCSI_REQUEST_PACKET *CommandPacket;
+ EFI_STATUS Status;
+ UINT8 *Cdb;
+ EFI_EVENT SelfEvent;
if (Event == NULL) {
return ScsiWrite10Command (
@@ -1865,10 +1851,10 @@ ScsiWrite10CommandEx (
goto ErrorExit;
}
- Context->SenseDataLength = SenseDataLength;
- Context->HostAdapterStatus = HostAdapterStatus;
- Context->TargetStatus = TargetStatus;
- Context->CallerEvent = Event;
+ Context->SenseDataLength = SenseDataLength;
+ Context->HostAdapterStatus = HostAdapterStatus;
+ Context->TargetStatus = TargetStatus;
+ Context->CallerEvent = Event;
CommandPacket = &Context->CommandPacket;
CommandPacket->Timeout = Timeout;
@@ -1879,13 +1865,13 @@ ScsiWrite10CommandEx (
//
// Fill Cdb for Write (10) Command
//
- Cdb[0] = EFI_SCSI_OP_WRITE10;
+ Cdb[0] = EFI_SCSI_OP_WRITE10;
WriteUnaligned32 ((UINT32 *)&Cdb[2], SwapBytes32 (StartLba));
- WriteUnaligned16 ((UINT16 *)&Cdb[7], SwapBytes16 ((UINT16) SectorSize));
+ WriteUnaligned16 ((UINT16 *)&Cdb[7], SwapBytes16 ((UINT16)SectorSize));
- CommandPacket->CdbLength = EFI_SCSI_OP_LENGTH_TEN;
- CommandPacket->DataDirection = EFI_SCSI_DATA_OUT;
- CommandPacket->SenseDataLength = *SenseDataLength;
+ CommandPacket->CdbLength = EFI_SCSI_OP_LENGTH_TEN;
+ CommandPacket->DataDirection = EFI_SCSI_DATA_OUT;
+ CommandPacket->SenseDataLength = *SenseDataLength;
//
// Create Event
@@ -1897,12 +1883,12 @@ ScsiWrite10CommandEx (
Context,
&SelfEvent
);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
goto ErrorExit;
}
Status = ScsiIo->ExecuteScsiCommand (ScsiIo, CommandPacket, SelfEvent);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
//
// Since ScsiLibNotify() will not be signaled if ExecuteScsiCommand()
// returns with error, close the event here.
@@ -1921,7 +1907,6 @@ ErrorExit:
return Status;
}
-
/**
Execute blocking/non-blocking Read(16) SCSI command on a specific SCSI
target.
@@ -2002,8 +1987,8 @@ ScsiRead16CommandEx (
IN UINT64 Timeout,
IN OUT VOID *SenseData OPTIONAL,
IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
+ OUT UINT8 *HostAdapterStatus,
+ OUT UINT8 *TargetStatus,
IN OUT VOID *DataBuffer OPTIONAL,
IN OUT UINT32 *DataLength,
IN UINT64 StartLba,
@@ -2011,11 +1996,11 @@ ScsiRead16CommandEx (
IN EFI_EVENT Event OPTIONAL
)
{
- EFI_SCSI_LIB_ASYNC_CONTEXT *Context;
- EFI_SCSI_IO_SCSI_REQUEST_PACKET *CommandPacket;
- EFI_STATUS Status;
- UINT8 *Cdb;
- EFI_EVENT SelfEvent;
+ EFI_SCSI_LIB_ASYNC_CONTEXT *Context;
+ EFI_SCSI_IO_SCSI_REQUEST_PACKET *CommandPacket;
+ EFI_STATUS Status;
+ UINT8 *Cdb;
+ EFI_EVENT SelfEvent;
if (Event == NULL) {
return ScsiRead16Command (
@@ -2049,10 +2034,10 @@ ScsiRead16CommandEx (
goto ErrorExit;
}
- Context->SenseDataLength = SenseDataLength;
- Context->HostAdapterStatus = HostAdapterStatus;
- Context->TargetStatus = TargetStatus;
- Context->CallerEvent = Event;
+ Context->SenseDataLength = SenseDataLength;
+ Context->HostAdapterStatus = HostAdapterStatus;
+ Context->TargetStatus = TargetStatus;
+ Context->CallerEvent = Event;
CommandPacket = &Context->CommandPacket;
CommandPacket->Timeout = Timeout;
@@ -2063,13 +2048,13 @@ ScsiRead16CommandEx (
//
// Fill Cdb for Read (16) Command
//
- Cdb[0] = EFI_SCSI_OP_READ16;
+ Cdb[0] = EFI_SCSI_OP_READ16;
WriteUnaligned64 ((UINT64 *)&Cdb[2], SwapBytes64 (StartLba));
WriteUnaligned32 ((UINT32 *)&Cdb[10], SwapBytes32 (SectorSize));
- CommandPacket->CdbLength = EFI_SCSI_OP_LENGTH_SIXTEEN;
- CommandPacket->DataDirection = EFI_SCSI_DATA_IN;
- CommandPacket->SenseDataLength = *SenseDataLength;
+ CommandPacket->CdbLength = EFI_SCSI_OP_LENGTH_SIXTEEN;
+ CommandPacket->DataDirection = EFI_SCSI_DATA_IN;
+ CommandPacket->SenseDataLength = *SenseDataLength;
//
// Create Event
@@ -2081,12 +2066,12 @@ ScsiRead16CommandEx (
Context,
&SelfEvent
);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
goto ErrorExit;
}
Status = ScsiIo->ExecuteScsiCommand (ScsiIo, CommandPacket, SelfEvent);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
//
// Since ScsiLibNotify() will not be signaled if ExecuteScsiCommand()
// returns with error, close the event here.
@@ -2105,7 +2090,6 @@ ErrorExit:
return Status;
}
-
/**
Execute blocking/non-blocking Write(16) SCSI command on a specific SCSI
target.
@@ -2186,8 +2170,8 @@ ScsiWrite16CommandEx (
IN UINT64 Timeout,
IN OUT VOID *SenseData OPTIONAL,
IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
+ OUT UINT8 *HostAdapterStatus,
+ OUT UINT8 *TargetStatus,
IN OUT VOID *DataBuffer OPTIONAL,
IN OUT UINT32 *DataLength,
IN UINT64 StartLba,
@@ -2195,11 +2179,11 @@ ScsiWrite16CommandEx (
IN EFI_EVENT Event OPTIONAL
)
{
- EFI_SCSI_LIB_ASYNC_CONTEXT *Context;
- EFI_SCSI_IO_SCSI_REQUEST_PACKET *CommandPacket;
- EFI_STATUS Status;
- UINT8 *Cdb;
- EFI_EVENT SelfEvent;
+ EFI_SCSI_LIB_ASYNC_CONTEXT *Context;
+ EFI_SCSI_IO_SCSI_REQUEST_PACKET *CommandPacket;
+ EFI_STATUS Status;
+ UINT8 *Cdb;
+ EFI_EVENT SelfEvent;
if (Event == NULL) {
return ScsiWrite16Command (
@@ -2233,10 +2217,10 @@ ScsiWrite16CommandEx (
goto ErrorExit;
}
- Context->SenseDataLength = SenseDataLength;
- Context->HostAdapterStatus = HostAdapterStatus;
- Context->TargetStatus = TargetStatus;
- Context->CallerEvent = Event;
+ Context->SenseDataLength = SenseDataLength;
+ Context->HostAdapterStatus = HostAdapterStatus;
+ Context->TargetStatus = TargetStatus;
+ Context->CallerEvent = Event;
CommandPacket = &Context->CommandPacket;
CommandPacket->Timeout = Timeout;
@@ -2247,13 +2231,13 @@ ScsiWrite16CommandEx (
//
// Fill Cdb for Write (16) Command
//
- Cdb[0] = EFI_SCSI_OP_WRITE16;
+ Cdb[0] = EFI_SCSI_OP_WRITE16;
WriteUnaligned64 ((UINT64 *)&Cdb[2], SwapBytes64 (StartLba));
WriteUnaligned32 ((UINT32 *)&Cdb[10], SwapBytes32 (SectorSize));
- CommandPacket->CdbLength = EFI_SCSI_OP_LENGTH_SIXTEEN;
- CommandPacket->DataDirection = EFI_SCSI_DATA_OUT;
- CommandPacket->SenseDataLength = *SenseDataLength;
+ CommandPacket->CdbLength = EFI_SCSI_OP_LENGTH_SIXTEEN;
+ CommandPacket->DataDirection = EFI_SCSI_DATA_OUT;
+ CommandPacket->SenseDataLength = *SenseDataLength;
//
// Create Event
@@ -2265,12 +2249,12 @@ ScsiWrite16CommandEx (
Context,
&SelfEvent
);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
goto ErrorExit;
}
Status = ScsiIo->ExecuteScsiCommand (ScsiIo, CommandPacket, SelfEvent);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
//
// Since ScsiLibNotify() will not be signaled if ExecuteScsiCommand()
// returns with error, close the event here.
diff --git a/MdePkg/Library/UefiUsbLib/Hid.c b/MdePkg/Library/UefiUsbLib/Hid.c
index 1d65552719..a03922cf1f 100644
--- a/MdePkg/Library/UefiUsbLib/Hid.c
+++ b/MdePkg/Library/UefiUsbLib/Hid.c
@@ -45,23 +45,23 @@
EFI_STATUS
EFIAPI
UsbGetHidDescriptor (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- OUT EFI_USB_HID_DESCRIPTOR *HidDescriptor
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT8 Interface,
+ OUT EFI_USB_HID_DESCRIPTOR *HidDescriptor
)
{
UINT32 Status;
EFI_STATUS Result;
EFI_USB_DEVICE_REQUEST Request;
- ASSERT(UsbIo != NULL);
- ASSERT(HidDescriptor != NULL);
+ ASSERT (UsbIo != NULL);
+ ASSERT (HidDescriptor != NULL);
Request.RequestType = USB_HID_GET_DESCRIPTOR_REQ_TYPE;
Request.Request = USB_REQ_GET_DESCRIPTOR;
- Request.Value = (UINT16) (USB_DESC_TYPE_HID << 8);
+ Request.Value = (UINT16)(USB_DESC_TYPE_HID << 8);
Request.Index = Interface;
- Request.Length = (UINT16) sizeof (EFI_USB_HID_DESCRIPTOR);
+ Request.Length = (UINT16)sizeof (EFI_USB_HID_DESCRIPTOR);
Result = UsbIo->UsbControlTransfer (
UsbIo,
@@ -74,7 +74,6 @@ UsbGetHidDescriptor (
);
return Result;
-
}
/**
@@ -101,10 +100,10 @@ UsbGetHidDescriptor (
EFI_STATUS
EFIAPI
UsbGetReportDescriptor (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT16 DescriptorLength,
- OUT UINT8 *DescriptorBuffer
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT8 Interface,
+ IN UINT16 DescriptorLength,
+ OUT UINT8 *DescriptorBuffer
)
{
UINT32 Status;
@@ -119,7 +118,7 @@ UsbGetReportDescriptor (
//
Request.RequestType = USB_HID_GET_DESCRIPTOR_REQ_TYPE;
Request.Request = USB_REQ_GET_DESCRIPTOR;
- Request.Value = (UINT16) (USB_DESC_TYPE_REPORT << 8);
+ Request.Value = (UINT16)(USB_DESC_TYPE_REPORT << 8);
Request.Index = Interface;
Request.Length = DescriptorLength;
@@ -134,7 +133,6 @@ UsbGetReportDescriptor (
);
return Result;
-
}
/**
@@ -157,9 +155,9 @@ UsbGetReportDescriptor (
EFI_STATUS
EFIAPI
UsbGetProtocolRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- OUT UINT8 *Protocol
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT8 Interface,
+ OUT UINT8 *Protocol
)
{
UINT32 Status;
@@ -173,10 +171,10 @@ UsbGetProtocolRequest (
// Fill Device request packet
//
Request.RequestType = USB_HID_CLASS_GET_REQ_TYPE;
- Request.Request = EFI_USB_GET_PROTOCOL_REQUEST;
- Request.Value = 0;
- Request.Index = Interface;
- Request.Length = 1;
+ Request.Request = EFI_USB_GET_PROTOCOL_REQUEST;
+ Request.Value = 0;
+ Request.Index = Interface;
+ Request.Length = 1;
Result = UsbIo->UsbControlTransfer (
UsbIo,
@@ -191,8 +189,6 @@ UsbGetProtocolRequest (
return Result;
}
-
-
/**
Set the HID protocol of the specified USB HID interface.
@@ -212,9 +208,9 @@ UsbGetProtocolRequest (
EFI_STATUS
EFIAPI
UsbSetProtocolRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 Protocol
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT8 Interface,
+ IN UINT8 Protocol
)
{
UINT32 Status;
@@ -227,10 +223,10 @@ UsbSetProtocolRequest (
// Fill Device request packet
//
Request.RequestType = USB_HID_CLASS_SET_REQ_TYPE;
- Request.Request = EFI_USB_SET_PROTOCOL_REQUEST;
- Request.Value = Protocol;
- Request.Index = Interface;
- Request.Length = 0;
+ Request.Request = EFI_USB_SET_PROTOCOL_REQUEST;
+ Request.Value = Protocol;
+ Request.Index = Interface;
+ Request.Length = 0;
Result = UsbIo->UsbControlTransfer (
UsbIo,
@@ -244,7 +240,6 @@ UsbSetProtocolRequest (
return Result;
}
-
/**
Set the idle rate of the specified USB HID report.
@@ -265,10 +260,10 @@ UsbSetProtocolRequest (
EFI_STATUS
EFIAPI
UsbSetIdleRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 ReportId,
- IN UINT8 Duration
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT8 Interface,
+ IN UINT8 ReportId,
+ IN UINT8 Duration
)
{
UINT32 Status;
@@ -280,10 +275,10 @@ UsbSetIdleRequest (
// Fill Device request packet
//
Request.RequestType = USB_HID_CLASS_SET_REQ_TYPE;
- Request.Request = EFI_USB_SET_IDLE_REQUEST;
- Request.Value = (UINT16) ((Duration << 8) | ReportId);
- Request.Index = Interface;
- Request.Length = 0;
+ Request.Request = EFI_USB_SET_IDLE_REQUEST;
+ Request.Value = (UINT16)((Duration << 8) | ReportId);
+ Request.Index = Interface;
+ Request.Length = 0;
Result = UsbIo->UsbControlTransfer (
UsbIo,
@@ -297,7 +292,6 @@ UsbSetIdleRequest (
return Result;
}
-
/**
Get the idle rate of the specified USB HID report.
@@ -319,10 +313,10 @@ UsbSetIdleRequest (
EFI_STATUS
EFIAPI
UsbGetIdleRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 ReportId,
- OUT UINT8 *Duration
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT8 Interface,
+ IN UINT8 ReportId,
+ OUT UINT8 *Duration
)
{
UINT32 Status;
@@ -335,10 +329,10 @@ UsbGetIdleRequest (
// Fill Device request packet
//
Request.RequestType = USB_HID_CLASS_GET_REQ_TYPE;
- Request.Request = EFI_USB_GET_IDLE_REQUEST;
- Request.Value = ReportId;
- Request.Index = Interface;
- Request.Length = 1;
+ Request.Request = EFI_USB_GET_IDLE_REQUEST;
+ Request.Value = ReportId;
+ Request.Index = Interface;
+ Request.Length = 1;
Result = UsbIo->UsbControlTransfer (
UsbIo,
@@ -353,8 +347,6 @@ UsbGetIdleRequest (
return Result;
}
-
-
/**
Set the report descriptor of the specified USB HID interface.
@@ -379,12 +371,12 @@ UsbGetIdleRequest (
EFI_STATUS
EFIAPI
UsbSetReportRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 ReportId,
- IN UINT8 ReportType,
- IN UINT16 ReportLen,
- IN UINT8 *Report
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT8 Interface,
+ IN UINT8 ReportId,
+ IN UINT8 ReportType,
+ IN UINT16 ReportLen,
+ IN UINT8 *Report
)
{
UINT32 Status;
@@ -398,10 +390,10 @@ UsbSetReportRequest (
// Fill Device request packet
//
Request.RequestType = USB_HID_CLASS_SET_REQ_TYPE;
- Request.Request = EFI_USB_SET_REPORT_REQUEST;
- Request.Value = (UINT16) ((ReportType << 8) | ReportId);
- Request.Index = Interface;
- Request.Length = ReportLen;
+ Request.Request = EFI_USB_SET_REPORT_REQUEST;
+ Request.Value = (UINT16)((ReportType << 8) | ReportId);
+ Request.Index = Interface;
+ Request.Length = ReportLen;
Result = UsbIo->UsbControlTransfer (
UsbIo,
@@ -416,7 +408,6 @@ UsbSetReportRequest (
return Result;
}
-
/**
Get the report descriptor of the specified USB HID interface.
@@ -444,12 +435,12 @@ UsbSetReportRequest (
EFI_STATUS
EFIAPI
UsbGetReportRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 ReportId,
- IN UINT8 ReportType,
- IN UINT16 ReportLen,
- OUT UINT8 *Report
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT8 Interface,
+ IN UINT8 ReportId,
+ IN UINT8 ReportType,
+ IN UINT16 ReportLen,
+ OUT UINT8 *Report
)
{
UINT32 Status;
@@ -463,10 +454,10 @@ UsbGetReportRequest (
// Fill Device request packet
//
Request.RequestType = USB_HID_CLASS_GET_REQ_TYPE;
- Request.Request = EFI_USB_GET_REPORT_REQUEST;
- Request.Value = (UINT16) ((ReportType << 8) | ReportId);
- Request.Index = Interface;
- Request.Length = ReportLen;
+ Request.Request = EFI_USB_GET_REPORT_REQUEST;
+ Request.Value = (UINT16)((ReportType << 8) | ReportId);
+ Request.Index = Interface;
+ Request.Length = ReportLen;
Result = UsbIo->UsbControlTransfer (
UsbIo,
diff --git a/MdePkg/Library/UefiUsbLib/UefiUsbLibInternal.h b/MdePkg/Library/UefiUsbLib/UefiUsbLibInternal.h
index 5909d96e9a..185fc6d86e 100644
--- a/MdePkg/Library/UefiUsbLib/UefiUsbLibInternal.h
+++ b/MdePkg/Library/UefiUsbLib/UefiUsbLibInternal.h
@@ -20,5 +20,4 @@
#include <IndustryStandard/Usb.h>
-
#endif
diff --git a/MdePkg/Library/UefiUsbLib/UsbDxeLib.c b/MdePkg/Library/UefiUsbLib/UsbDxeLib.c
index e75df8d044..53b90984f7 100644
--- a/MdePkg/Library/UefiUsbLib/UsbDxeLib.c
+++ b/MdePkg/Library/UefiUsbLib/UsbDxeLib.c
@@ -10,7 +10,6 @@
#include "UefiUsbLibInternal.h"
-
/**
Get the descriptor of the specified USB device.
@@ -40,12 +39,12 @@
EFI_STATUS
EFIAPI
UsbGetDescriptor (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 Value,
- IN UINT16 Index,
- IN UINT16 DescriptorLength,
- OUT VOID *Descriptor,
- OUT UINT32 *Status
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT16 Value,
+ IN UINT16 Index,
+ IN UINT16 DescriptorLength,
+ OUT VOID *Descriptor,
+ OUT UINT32 *Status
)
{
EFI_USB_DEVICE_REQUEST DevReq;
@@ -56,11 +55,11 @@ UsbGetDescriptor (
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
- DevReq.RequestType = USB_DEV_GET_DESCRIPTOR_REQ_TYPE;
- DevReq.Request = USB_REQ_GET_DESCRIPTOR;
- DevReq.Value = Value;
- DevReq.Index = Index;
- DevReq.Length = DescriptorLength;
+ DevReq.RequestType = USB_DEV_GET_DESCRIPTOR_REQ_TYPE;
+ DevReq.Request = USB_REQ_GET_DESCRIPTOR;
+ DevReq.Value = Value;
+ DevReq.Index = Index;
+ DevReq.Length = DescriptorLength;
return UsbIo->UsbControlTransfer (
UsbIo,
@@ -73,7 +72,6 @@ UsbGetDescriptor (
);
}
-
/**
Set the descriptor of the specified USB device.
@@ -100,12 +98,12 @@ UsbGetDescriptor (
EFI_STATUS
EFIAPI
UsbSetDescriptor (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 Value,
- IN UINT16 Index,
- IN UINT16 DescriptorLength,
- IN VOID *Descriptor,
- OUT UINT32 *Status
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT16 Value,
+ IN UINT16 Index,
+ IN UINT16 DescriptorLength,
+ IN VOID *Descriptor,
+ OUT UINT32 *Status
)
{
EFI_USB_DEVICE_REQUEST DevReq;
@@ -116,11 +114,11 @@ UsbSetDescriptor (
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
- DevReq.RequestType = USB_DEV_SET_DESCRIPTOR_REQ_TYPE;
- DevReq.Request = USB_REQ_SET_DESCRIPTOR;
- DevReq.Value = Value;
- DevReq.Index = Index;
- DevReq.Length = DescriptorLength;
+ DevReq.RequestType = USB_DEV_SET_DESCRIPTOR_REQ_TYPE;
+ DevReq.Request = USB_REQ_SET_DESCRIPTOR;
+ DevReq.Value = Value;
+ DevReq.Index = Index;
+ DevReq.Length = DescriptorLength;
return UsbIo->UsbControlTransfer (
UsbIo,
@@ -133,7 +131,6 @@ UsbSetDescriptor (
);
}
-
/**
Get the interface setting of the specified USB device.
@@ -158,10 +155,10 @@ UsbSetDescriptor (
EFI_STATUS
EFIAPI
UsbGetInterface (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 Interface,
- OUT UINT16 *AlternateSetting,
- OUT UINT32 *Status
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT16 Interface,
+ OUT UINT16 *AlternateSetting,
+ OUT UINT32 *Status
)
{
EFI_USB_DEVICE_REQUEST DevReq;
@@ -174,10 +171,10 @@ UsbGetInterface (
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
- DevReq.RequestType = USB_DEV_GET_INTERFACE_REQ_TYPE;
- DevReq.Request = USB_REQ_GET_INTERFACE;
- DevReq.Index = Interface;
- DevReq.Length = 1;
+ DevReq.RequestType = USB_DEV_GET_INTERFACE_REQ_TYPE;
+ DevReq.Request = USB_REQ_GET_INTERFACE;
+ DevReq.Index = Interface;
+ DevReq.Length = 1;
return UsbIo->UsbControlTransfer (
UsbIo,
@@ -190,7 +187,6 @@ UsbGetInterface (
);
}
-
/**
Set the interface setting of the specified USB device.
@@ -214,10 +210,10 @@ UsbGetInterface (
EFI_STATUS
EFIAPI
UsbSetInterface (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 Interface,
- IN UINT16 AlternateSetting,
- OUT UINT32 *Status
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT16 Interface,
+ IN UINT16 AlternateSetting,
+ OUT UINT32 *Status
)
{
EFI_USB_DEVICE_REQUEST DevReq;
@@ -227,10 +223,10 @@ UsbSetInterface (
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
- DevReq.RequestType = USB_DEV_SET_INTERFACE_REQ_TYPE;
- DevReq.Request = USB_REQ_SET_INTERFACE;
- DevReq.Value = AlternateSetting;
- DevReq.Index = Interface;
+ DevReq.RequestType = USB_DEV_SET_INTERFACE_REQ_TYPE;
+ DevReq.Request = USB_REQ_SET_INTERFACE;
+ DevReq.Value = AlternateSetting;
+ DevReq.Index = Interface;
return UsbIo->UsbControlTransfer (
UsbIo,
@@ -243,7 +239,6 @@ UsbSetInterface (
);
}
-
/**
Get the device configuration.
@@ -267,9 +262,9 @@ UsbSetInterface (
EFI_STATUS
EFIAPI
UsbGetConfiguration (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- OUT UINT16 *ConfigurationValue,
- OUT UINT32 *Status
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ OUT UINT16 *ConfigurationValue,
+ OUT UINT32 *Status
)
{
EFI_USB_DEVICE_REQUEST DevReq;
@@ -282,9 +277,9 @@ UsbGetConfiguration (
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
- DevReq.RequestType = USB_DEV_GET_CONFIGURATION_REQ_TYPE;
- DevReq.Request = USB_REQ_GET_CONFIG;
- DevReq.Length = 1;
+ DevReq.RequestType = USB_DEV_GET_CONFIGURATION_REQ_TYPE;
+ DevReq.Request = USB_REQ_GET_CONFIG;
+ DevReq.Length = 1;
return UsbIo->UsbControlTransfer (
UsbIo,
@@ -297,7 +292,6 @@ UsbGetConfiguration (
);
}
-
/**
Set the device configuration.
@@ -320,9 +314,9 @@ UsbGetConfiguration (
EFI_STATUS
EFIAPI
UsbSetConfiguration (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 ConfigurationValue,
- OUT UINT32 *Status
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT16 ConfigurationValue,
+ OUT UINT32 *Status
)
{
EFI_USB_DEVICE_REQUEST DevReq;
@@ -332,9 +326,9 @@ UsbSetConfiguration (
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
- DevReq.RequestType = USB_DEV_SET_CONFIGURATION_REQ_TYPE;
- DevReq.Request = USB_REQ_SET_CONFIG;
- DevReq.Value = ConfigurationValue;
+ DevReq.RequestType = USB_DEV_SET_CONFIGURATION_REQ_TYPE;
+ DevReq.Request = USB_REQ_SET_CONFIG;
+ DevReq.Value = ConfigurationValue;
return UsbIo->UsbControlTransfer (
UsbIo,
@@ -347,7 +341,6 @@ UsbSetConfiguration (
);
}
-
/**
Set the specified feature of the specified device.
@@ -374,11 +367,11 @@ UsbSetConfiguration (
EFI_STATUS
EFIAPI
UsbSetFeature (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN USB_TYPES_DEFINITION Recipient,
- IN UINT16 Value,
- IN UINT16 Target,
- OUT UINT32 *Status
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN USB_TYPES_DEFINITION Recipient,
+ IN UINT16 Value,
+ IN UINT16 Target,
+ OUT UINT32 *Status
)
{
EFI_USB_DEVICE_REQUEST DevReq;
@@ -389,29 +382,28 @@ UsbSetFeature (
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
switch (Recipient) {
+ case USB_TARGET_DEVICE:
+ DevReq.RequestType = USB_DEV_SET_FEATURE_REQ_TYPE_D;
+ break;
- case USB_TARGET_DEVICE:
- DevReq.RequestType = USB_DEV_SET_FEATURE_REQ_TYPE_D;
- break;
-
- case USB_TARGET_INTERFACE:
- DevReq.RequestType = USB_DEV_SET_FEATURE_REQ_TYPE_I;
- break;
+ case USB_TARGET_INTERFACE:
+ DevReq.RequestType = USB_DEV_SET_FEATURE_REQ_TYPE_I;
+ break;
- case USB_TARGET_ENDPOINT:
- DevReq.RequestType = USB_DEV_SET_FEATURE_REQ_TYPE_E;
- break;
+ case USB_TARGET_ENDPOINT:
+ DevReq.RequestType = USB_DEV_SET_FEATURE_REQ_TYPE_E;
+ break;
- default:
- break;
+ default:
+ break;
}
+
//
// Fill device request, see USB1.1 spec
//
- DevReq.Request = USB_REQ_SET_FEATURE;
- DevReq.Value = Value;
- DevReq.Index = Target;
-
+ DevReq.Request = USB_REQ_SET_FEATURE;
+ DevReq.Value = Value;
+ DevReq.Index = Target;
return UsbIo->UsbControlTransfer (
UsbIo,
@@ -424,7 +416,6 @@ UsbSetFeature (
);
}
-
/**
Clear the specified feature of the specified device.
@@ -451,11 +442,11 @@ UsbSetFeature (
EFI_STATUS
EFIAPI
UsbClearFeature (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN USB_TYPES_DEFINITION Recipient,
- IN UINT16 Value,
- IN UINT16 Target,
- OUT UINT32 *Status
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN USB_TYPES_DEFINITION Recipient,
+ IN UINT16 Value,
+ IN UINT16 Target,
+ OUT UINT32 *Status
)
{
EFI_USB_DEVICE_REQUEST DevReq;
@@ -463,33 +454,31 @@ UsbClearFeature (
ASSERT (UsbIo != NULL);
ASSERT (Status != NULL);
-
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
switch (Recipient) {
+ case USB_TARGET_DEVICE:
+ DevReq.RequestType = USB_DEV_CLEAR_FEATURE_REQ_TYPE_D;
+ break;
- case USB_TARGET_DEVICE:
- DevReq.RequestType = USB_DEV_CLEAR_FEATURE_REQ_TYPE_D;
- break;
-
- case USB_TARGET_INTERFACE:
- DevReq.RequestType = USB_DEV_CLEAR_FEATURE_REQ_TYPE_I;
- break;
+ case USB_TARGET_INTERFACE:
+ DevReq.RequestType = USB_DEV_CLEAR_FEATURE_REQ_TYPE_I;
+ break;
- case USB_TARGET_ENDPOINT:
- DevReq.RequestType = USB_DEV_CLEAR_FEATURE_REQ_TYPE_E;
- break;
+ case USB_TARGET_ENDPOINT:
+ DevReq.RequestType = USB_DEV_CLEAR_FEATURE_REQ_TYPE_E;
+ break;
- default:
- break;
+ default:
+ break;
}
+
//
// Fill device request, see USB1.1 spec
//
- DevReq.Request = USB_REQ_CLEAR_FEATURE;
- DevReq.Value = Value;
- DevReq.Index = Target;
-
+ DevReq.Request = USB_REQ_CLEAR_FEATURE;
+ DevReq.Value = Value;
+ DevReq.Index = Target;
return UsbIo->UsbControlTransfer (
UsbIo,
@@ -502,7 +491,6 @@ UsbClearFeature (
);
}
-
/**
Get the status of the specified device.
@@ -530,11 +518,11 @@ UsbClearFeature (
EFI_STATUS
EFIAPI
UsbGetStatus (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN USB_TYPES_DEFINITION Recipient,
- IN UINT16 Target,
- OUT UINT16 *DeviceStatus,
- OUT UINT32 *Status
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN USB_TYPES_DEFINITION Recipient,
+ IN UINT16 Target,
+ OUT UINT16 *DeviceStatus,
+ OUT UINT32 *Status
)
{
EFI_USB_DEVICE_REQUEST DevReq;
@@ -546,29 +534,29 @@ UsbGetStatus (
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
switch (Recipient) {
+ case USB_TARGET_DEVICE:
+ DevReq.RequestType = USB_DEV_GET_STATUS_REQ_TYPE_D;
+ break;
- case USB_TARGET_DEVICE:
- DevReq.RequestType = USB_DEV_GET_STATUS_REQ_TYPE_D;
- break;
-
- case USB_TARGET_INTERFACE:
- DevReq.RequestType = USB_DEV_GET_STATUS_REQ_TYPE_I;
- break;
+ case USB_TARGET_INTERFACE:
+ DevReq.RequestType = USB_DEV_GET_STATUS_REQ_TYPE_I;
+ break;
- case USB_TARGET_ENDPOINT:
- DevReq.RequestType = USB_DEV_GET_STATUS_REQ_TYPE_E;
- break;
+ case USB_TARGET_ENDPOINT:
+ DevReq.RequestType = USB_DEV_GET_STATUS_REQ_TYPE_E;
+ break;
- default:
- break;
+ default:
+ break;
}
+
//
// Fill device request, see USB1.1 spec
//
- DevReq.Request = USB_REQ_GET_STATUS;
- DevReq.Value = 0;
- DevReq.Index = Target;
- DevReq.Length = 2;
+ DevReq.Request = USB_REQ_GET_STATUS;
+ DevReq.Value = 0;
+ DevReq.Index = Target;
+ DevReq.Length = 2;
return UsbIo->UsbControlTransfer (
UsbIo,
@@ -581,7 +569,6 @@ UsbGetStatus (
);
}
-
/**
Clear halt feature of the specified usb endpoint.
@@ -606,9 +593,9 @@ UsbGetStatus (
EFI_STATUS
EFIAPI
UsbClearEndpointHalt (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Endpoint,
- OUT UINT32 *Status
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT8 Endpoint,
+ OUT UINT32 *Status
)
{
EFI_STATUS Result;
@@ -654,12 +641,12 @@ UsbClearEndpointHalt (
}
Result = UsbClearFeature (
- UsbIo,
- USB_TARGET_ENDPOINT,
- USB_FEATURE_ENDPOINT_HALT,
- EndpointDescriptor.EndpointAddress,
- Status
- );
+ UsbIo,
+ USB_TARGET_ENDPOINT,
+ USB_FEATURE_ENDPOINT_HALT,
+ EndpointDescriptor.EndpointAddress,
+ Status
+ );
return Result;
}